C#操作Styline二次开发实现画线功能
导读:收集整理的这篇文章主要介绍了C#操作Styline二次开发实现画线功能,觉得挺不错的,现在分享给大家,也给大家做个参考。c#操作styline模型左键点击模型获取坐标,完成画线操作。1:鼠标点击模型事件 List<IPOsITion6...
收集整理的这篇文章主要介绍了C#操作Styline二次开发实现画线功能,觉得挺不错的,现在分享给大家,也给大家做个参考。c#操作styline模型左键点击模型获取坐标,完成画线操作。1:鼠标点击模型事件
ListIPOsITion66> pos = new ListIPosition66> (); 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(); ListIPosition66> 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二次开发实现画线功能的详细内容,更多请关注其它相关文章!
声明:本文内容由网友自发贡献,本站不承担相应法律责任。对本内容有异议或投诉,请联系2913721942#qq.com核实处理,我们将尽快回复您,谢谢合作!
若转载请注明出处: C#操作Styline二次开发实现画线功能
本文地址: https://pptw.com/jishu/592963.html