The so-called path roaming: Create a dynamic object and a multi-point line, and then let the dynamic object fly along the line
First draw a line, actually the path roaming is not need to draw the line, I just to confirm whether the dynamic object is flying along the line, the code is as follows:
Draw path double[] Cverticesarray = null; Cverticesarray = new double[] { 116.35, 27.98, 0, 116.45, 28.98, 0, 116.45, 28.11, 0, 116.65, 28.45, 0, }; Ilinestring pilinestring = SgWorld.Creator.GeometryCreator.CreateLineStringGeometry (Cverticesarray); IColor66 color = sgWorld.Creator.CreateColor (255, 0, 0,); var polyline = sgWorld.Creator.CreatePolyline (pilinestring, color);
Next, create the dynamic object with the following code:
var dynamicobject = this.sgWorld.Creator.CreateDynamicObject (0, Dynamicmotionstyle.motion_ground_vehicle, Dynamicobjecttype.dynamic_image_label, @ "f:\ project management \ Wisdom Fuzhou \ Use of fly\data11\ car icon \ Whole vehicle. png", altitudetypecode.atc_ Terrain_relative, "", "dynamic Object");
Parameter description:
First parameter 0: A set of IRouteWaypoint66 objects that are subsequently added to the dynamic object
a second parameter Dynamicmotionstyle: Move Way, is an enumeration type, concrete effect you can try it .
a third parameter Dynamicobjecttype: A Dynamic object type, which is an enumeration type that also determines the file type of your fourth parameter
Fourth parameter: Because of the third parameter selection of the Image_label, here I chose a picture
Fifth parameter 50: size of File Scaling
Sixth parameter Altitudetypecode: Height mode
Once the dynamic object is created, the inflection point of the path is created, and the code is as follows:
var wayPoint1 = This.sgWorld.Creator.CreateRouteWaypoint (116.35, 27.98, 0, +); var wayPoint2 = This.sgWorld.Creator.CreateRouteWaypoint (116.45, 28.98, 0, +); var wayPoint3 = This.sgWorld.Creator.CreateRouteWaypoint (116.55, 28.11, 0, +); var wayPoint4 = This.sgWorld.Creator.CreateRouteWaypoint (116.65, 28.45, 0, 800);
Then add the inflection point to the dynamic object:
DynamicObject.Waypoints.AddWaypoint (wayPoint1); DynamicObject.Waypoints.AddWaypoint (WayPoint2); DynamicObject.Waypoints.AddWaypoint (WAYPOINT3); DynamicObject.Waypoints.AddWaypoint (WAYPOINT4); Dynamicobject.circularroute = false; Dynamicobject.restartroute (0);
The last call to fly to the object, you can achieve the path roaming effect:
SgWorld.Navigate.FlyTo (Dynamicobject.id, actioncode.ac_jump);
Skyline Desktop Two-time development path Roaming (C #)