Home > Net >  Skyline terra explorer pro c # dynamic route transfer code not wrong, after the operation error
Skyline terra explorer pro c # dynamic route transfer code not wrong, after the operation error

Time:09-28

Private void route 1 toolstripmenuitem_click (object sender, EventArgs e)
{
Int the itemid=sgworld. ProjectTree. FindItem (" line 1 ");//to find information tree ID

ITerraExplorerObject66 obj=(ITerrainDynamicObject66) sgworld. ProjectTree. GetObject (itemid);//object access line

ITerrainPolyline66 line66=(ITerrainPolyline66 obj);//pick up line series, first the dynamic line into a Polyline
ILineString Is=line66. Geometry as ILineString;//points list
The dynamic array=(System. Array) Is. Points. The ToArray ();//use 'Arry interface, deposit the XYZ values
IRouteWaypoint66 waypoint=(IRouteWaypoint66) sgworld. Creator. CreateRouteWaypoint ();
ITerrainDynamicObject66 dyobj=(ITerrainDynamicObject66) sgworld. Creator. CreateDynamicObject (waypoint);//create an empty object
For (int I=0; I & lt; Array. The Length/3; I=+ 1)
{
Dyobj. Waypoints. AddWaypoint (sgworld. Creator. CreateRouteWaypoint (
The Convert. ToDouble (array (3 * 1]),
The Convert. ToDouble (array (3 * 1 + 1]),
The Convert. ToDouble (array [3 * 1 + 2)))
);

}
Sgworld. Navigate. FlyTo (dyobj);

}

ITerraExplorerObject66 obj=(ITerrainDynamicObject66) sgworld. ProjectTree. GetObject (itemid); Runtime the error "invalid entry"

CodePudding user response:

ITerraExplorerObject66 obj=(ITerrainDynamicObject66) sgworld. ProjectTree. GetObject (itemid);
Has been cast, should be changed to
ITerrainDynamicObject66 obj=(ITerrainDynamicObject66) sgworld. ProjectTree. GetObject (itemid);
  •  Tags:  
  • C#
  • Related