C # operation Styline Two-time development to achieve line drawing function

Source: Internet
Author: User
Tags sin
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); }
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.