C # operation Styline model left click on the model to get the coordinates, complete the line drawing operation.
1: Mouse Click Model Event
list<iposition66> pos = new list<iposition66> (); private bool sgworld_onlbuttonclicked (int Flags, int X, int Y) { var sgworld = new SGWorld66 (); var postioninfo = Sgworld. Window.pixeltoworld (X, Y); IPosition66 ss = Postioninfo. Position; Ss. X = Postioninfo. position.x; Ss. Y = Postioninfo. POSITION.Y; Pos. ADD (ss); return false; }
2: Operation Draw Line
string tmsg = String.Empty; Ilinearring cring = null; Igeometry cpolygongeometry = null; ITerrainPolyline66 cpolyo = null; Create Instance//messagebox.show (String.Format ("X:{0}\r\ny:{1}", Posl[i]. PosX, Posl[i]. PosX)); var sgworld = new SGWorld66 (); list<iposition66> POSL = pos; int sin = 0; Sin = Posl. count*3; double[] Cverticesarray = new Double[sin]; Gets the coordinate value for (int i = 0; i < POSL. Count; i++) {cverticesarray[i*3] = Posl[i]. X CVERTICESARRAY[I*3+1] = Posl[i]. Y Cverticesarray[i * 3 + 2] = Posl[i]. Altitude; } {cring = Sgworld. Creator.GeometryCreator.CreateLinearRingGeometry (Cverticesarray); Cpolygongeometry = Sgworld. Creator.GeometryCreator.CreateLinearRingGeometry (cring); } {UINT Nlinecolor = 0xff00ff00; Color style Altitudetypecode Altitudetype = Altitudetypecode.atc_on_terrain; D2. Create Polygon Cpolyo = Sgworld. Creator.createpolyline (Cpolygongeometry, Nlinecolor, Altitudetype, String. Empty, "Polygon"); Note the coordinate sgworld. Window.pixeltoworld (Sgworld. Window.Rect.Left, Sgworld. Window.Rect.Top, Worldpointtype.wpt_terrain); }