首先你需要将三维线获取到节点,然后通过下面的代码
function TestFreeFly()
{
var listXY = [{"longitude":114.09533937,"latitude":22.56983689},
{"longitude":114.09554749,"latitude":22.56959892},
{"longitude":114.0955031,"latitude":22.56946074},
{"longitude":114.0954814,"latitude":22.56961318},
{"longitude":114.09551804,"latitude":22.56963345},
{"longitude":114.09552056,"latitude":22.56962687}];
FreeFly(listXY,10);
}
function FreeFly(listXY,speed)
{
var flyRoutes = flyManager.get_routes();
var flyRoute = new SuperMap.Web.Realspace.FlyRoute();
var routestops=flyRoute.get_routeStops();
for (var m = 0; m < listXY.length; m++) {
var lon = listXY[m].longitude;
var alt = scene.getHeight(listXY[m].longitude, listXY[m].latitude);
var routestop=new SuperMap.Web.Realspace.RouteStop();
var camera= new SuperMap.Web.Realspace.Camera(listXY[m].longitude, listXY[m].latitude, alt+ 30);
routestop.set_name("stop"+m);
routestop.set_camera(camera);
routestops.add(routestop);
}
flyRoute.set_isHeadingFixed(true);
flyRoute.set_isFlyAlongTheRoute(true);
// flyRoute.set_isLinesVisible(false);
// flyRoute.set_isStopsVisible(false);
flyRoute.set_speed(speed);
flyRoutes.add(flyRoute);
//设置当前飞行路线是否可见
//flyRoute.set_isLinesVisible();
//开始飞行
flyManager.play();