C#操作Styline二次开发实现画线功能的案例-创新互联

这篇文章给大家分享的是有关C#操作Styline二次开发实现画线功能的案例的内容。小编觉得挺实用的,因此分享给大家做个参考。一起跟随小编过来看看吧。

在酉阳土家族苗族等地区,都构建了全面的区域性战略布局,加强发展的系统性、市场前瞻性、产品创新能力,以专注、极致的服务理念,为客户提供成都网站设计、成都做网站 网站设计制作按需网站策划,公司网站建设,企业网站建设,高端网站设计,网络营销推广,外贸网站制作,酉阳土家族苗族网站建设费用合理。

 c#操作styline模型左键点击模型获取坐标,完成画线操作。

1:鼠标点击模型事件

 List pos = new List();
        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:操作画线

  string tMsg = String.Empty;
            ILinearRing cRing = null;
            IGeometry cPolygonGeometry = null;
            ITerrainPolyline66 cpolyo = null;
            //创建实例
            //MessageBox.Show(String.Format("X:{0}\r\nY:{1}", posl[i].PosX, posl[i].PosX));
            var sgworld = new SGWorld66();
            List posl = pos;
            int sin = 0;
            sin = posl.Count*3;
            double[] cVerticesArray = new double[sin];
            //获取坐标值
            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; //颜色样式
                AltitudeTypeCode AltitudeType = AltitudeTypeCode.ATC_ON_TERRAIN;
                // D2. Create polygon
                cpolyo = sgworld.Creator.CreatePolyline(cPolygonGeometry, nLineColor, AltitudeType, string.Empty, "Polygon");
                ///注意坐标
                sgworld.Window.PixelToWorld(sgworld.Window.Rect.Left, sgworld.Window.Rect.Top, WorldPointType.WPT_TERRAIN);
            }

感谢各位的阅读!关于C#操作Styline二次开发实现画线功能的案例就分享到这里了,希望以上内容可以对大家有一定的帮助,让大家可以学到更多知识。如果觉得文章不错,可以把它分享出去让更多的人看到吧!


标题名称:C#操作Styline二次开发实现画线功能的案例-创新互联
当前地址:http://lszwz.com/article/jcicg.html

其他资讯

售后响应及时

7×24小时客服热线

数据备份

更安全、更高效、更稳定

价格公道精准

项目经理精准报价不弄虚作假

合作无风险

重合同讲信誉,无效全额退款