SuperMap iClient3D for WebGL provides a flight management module for managing flight browsing scenarios in the scene.
Use Supermap iDesktop to edit each site (including latitude and longitude elevation information, camera heading pitch roll parameters, site waiting time, speed, etc.) to generate fpf files.
var routes = new SuperMap3D.RouteCollection();
routes.fromFile(url);
var flyManager = new SuperMap3D.FlyManager(scene,routes);
flyManager.stopArrived.addEventListener(function(routeStop){ //to do //Note: If the asynchronous processing is done when the site arrival event is activated, you should use routeStop.promise to handle it, such as playing a piece of audio: audio.play(); var defer = SuperMap3D.when.defer(); routeStop.promise = defer; audio.onended = function(){ defer.resolve(true); routeStop.promise = undefined; }; //If it is a synchronous execution event, it can be executed sequentially. });
The camera starts to fly with the parameters set in the stations. According to the settings in the fpf file, each station can have different speeds and camera parameters, etc. There are two default flight modes: timed flight mode and constant speed flight mode. Timing mode: the camera's flight interval between every two stations is the same, the default is 10 seconds; Constant speed mode: the camera always keeps the same speed during the whole flight, flying at a constant speed, the speed is determined by the settings in the fpf file, and it can also be adjusted in real time during the flight.
flyManager.play();
You can pause at any time during the flight, and then execute flyManager.play() to continue the flight from the current paused position.
flyManager.pause();
You can stop the flight at any time during the flight, and then execute flyManager.stop() to restart the flight from the starting position.
flyManager.stop();
The flight effect is as follows: