skyline二次开发取得3D窗口内的坐标

时间:2013-4-15    作者:悬浮的青春    分类:


 

 

获取鼠标对应的3D坐标

skyline5.1.3版本下的相关代码

            double dX, dY, dH;

            object oFlag, oScreenX, oScreenY;

            IRender.GetMouseInfo(out oFlag, out oScreenX, out oScreenY);//若获取中心点坐标,则可显示中心点坐标信息。

            IRender.ScreenToTerrain(Convert.ToInt32(oScreenX), Convert.ToInt32(oScreenY), out dX, out dY, out dH);

            label1.Text = "经度" + dX.ToString("#.0000°") + "纬度" + dY.ToString("#.0000°") + "高度" + dH.ToString("#.00");

skyline6.0以上相关代码

             SGWorld sg = new SGWorld();

            IMouseInfo6 mou = sg.Window.GetMouseInfo();

            IWorldPointInfo6 poi= sg.Window.PixelToWorld(mou.X, mou.Y, WorldPointType.WPT_TERRAIN);

            poi.Position.  坐标

            poi.ObjectID  当前坐标位置的实体id

            poi.Type  当前坐标位置的实体类型

          

 

            屏幕中心点坐标

            SGWorld sg = new SGWorld();

            sg.Window.CenterPixelToWorld

 

          

获取3D窗口四角坐标

skyline5.1.3版本下的相关代码

           //获取三维窗口四角坐标。

            //////////////////////////////////////////////////////////////////////////////////////////

            object scwx, scwy, scwh;

            IRender.ScreenToTerrain(5, 5, out scwx, out scwy, out scwh);

            IIEnvelope.XMin = Convert.ToDouble(scwx);

            IIEnvelope.YMax = Convert.ToDouble(scwy);

            object scwx1, scwy1, scwh1;

            IRender.ScreenToTerrain(this.axTE3DWindow1.Width - 5, this.axTE3DWindow1.Height - 5, out scwx1, out scwy1, out scwh1);

            skyline6.0以上相关代码

           SGWorld sg = new SGWorld();

            sg.Window.PixelToWorld(sg.Window.Rect.Left, sg.Window.Rect.Top, WorldPointType.WPT_TERRAIN);

 

标签: skyline二次开发

WRITTEN BY

avatar