Esempio n. 1
0
        public static GeoScene.Data.GSOPoint2d XYZ_2_Latlon(GSOPoint2d point2d)
        {
            int id = Utility.getProjectID();

            GeoScene.Data.GSOPoint2d result = GeoScene.Data.GSOProjectManager.Inverse(point2d, id);
            return(result);
        }
        private GSOGeoPolyline3D Coord2LatLon_Line(GSOGeoPolyline3D line)
        {
            GSOGeoPolyline3D newline = line.Clone() as GSOGeoPolyline3D;

            for (int i = 0; i < newline[0].Count; i++)
            {
                GSOPoint3d pt      = newline[0][i];
                GSOPoint2d pt2d    = new GSOPoint2d(pt.X, pt.Y);
                GSOPoint2d pt2dnew = Coord2LatLon(pt2d);

                GSOPoint3d ptnew = new GSOPoint3d(pt2dnew.X, pt2dnew.Y, pt.Z);
                newline[0][i] = ptnew;
            }
            return(newline);
        }
Esempio n. 3
0
 /// <summary>
 /// 图层定位
 /// </summary>
 /// <param name="globeControl1"></param>
 /// <param name="latLonBounds"></param>
 public static void flyToLayerOrTerrain(GSOGlobeControl globeControl1, GSORect2d latLonBounds)
 {
     if ((latLonBounds.Left.Equals(0.0) == false) &&
         (latLonBounds.Bottom.Equals(0.0) == false) &&
         (latLonBounds.Top.Equals(0.0) == false) &&
         (latLonBounds.Right.Equals(0.0) == false))
     {
         GSOPoint2d pntCenter  = latLonBounds.Center;
         GSOPoint3d pntPostion = new GSOPoint3d();
         pntPostion.X = pntCenter.X;
         pntPostion.Y = pntCenter.Y;
         double dMaxGeoLen = Math.Max(latLonBounds.Width, latLonBounds.Height);
         double dSize      = dMaxGeoLen * Math.PI * 6378137 / 90;
         pntPostion.Z = dSize > 20000000 ? dSize / 4 : dSize;
         globeControl1.Globe.FlyToPosition(pntPostion, EnumAltitudeMode.RelativeToGround);
     }
 }
Esempio n. 4
0
        private GSOGeoPolyline3D LatLon2Coord_Line(GSOGeoPolyline3D line)
        {
            GSOGeoPolyline3D newline = line.Clone() as GSOGeoPolyline3D;
            for (int i = 0; i < newline[0].Count; i++)
            {
                GSOPoint3d pt = newline[0][i];
                GSOPoint2d pt2d = new GSOPoint2d(pt.X, pt.Y);
                GSOPoint2d pt2dnew = LatLon2Coord(pt2d);

                GSOPoint3d ptnew = new GSOPoint3d(pt2dnew.X, pt2dnew.Y, pt.Z);
                newline[0][i] = ptnew;

            }
            return newline;
        }
Esempio n. 5
0
        private void _glbControl_TrackPolygonEndEvent(object sender, TrackPolygonEndEventArgs e)
        {
            //判断绘制的多边形是否在倾斜摄影图层上
            GSOPoint3ds polygonPots = e.Polygon[0];

            if (!lfpLayer.LatLonBounds.Left.Equals(0.0) &&
                !lfpLayer.LatLonBounds.Bottom.Equals(0.0) &&
                !lfpLayer.LatLonBounds.Top.Equals(0.0) &&
                !lfpLayer.LatLonBounds.Right.Equals(0.0))
            {
                for (int i = 0; i < polygonPots.Count; i++)
                {
                    if (!lfpLayer.LatLonBounds.Contains(polygonPots[i].X, polygonPots[i].Y))
                    {
                        MessageBox.Show("请将多边形画于倾斜摄影图层上。");
                        //清除上一个绘制的分析多边形
                        _glbControl.Globe.ClearLastTrackPolygon();
                        return;
                    }
                }
            }
            //压平分析
            if (_isPressOn)
            {
                //将倾斜摄影图层转换为GSOPageLODFeatureLayer分析图层
                GSOPageLODFeatureLayer layer2 = lfpLayer as GSOPageLODFeatureLayer;
                //压平面
                GSOGeoPolygon3D poly1 = e.Polygon;
                //加入到压平面的List为模型替换做准备
                _trackPressPolygon.Add(e.Polygon);
                //高度模式为绝对高度
                poly1.AltitudeMode = EnumAltitudeMode.Absolute;

                if (layer2 != null)
                {
                    //添加压平面
                    layer2.AddFlattenPolygon3D(poly1, "");
                    //保存压平面
                    layer2.Save();
                }
                _isPressOn = false;
            }
            //填挖方分析
            else
            {
                //挖方量
                double m_dDigVolume = 0;
                //填方量
                double m_dFillVolume = 0;
                //分析总面积
                double m_dTotalArea = 0;
                //挖方面积(废除)
                double m_dDigArea = 0;
                //填方面积(废除)
                double m_dFillArea = 0;

                double dAlt          = 50; //挖填方高度
                double pointDistance = 1;  //采样精度,单位:米
                //将平面坐标转换为经纬度坐标,使用默认投影ID为0
                GSOPoint2d point2D     = GSOProjectManager.Inverse(new GSOPoint2d(pointDistance, pointDistance), 0);
                double     dDSampleGap = point2D.X;//重采样的点的距离,单位是:经纬度
                //挖方分析线
                GSOGeoPolyline3D lineDig = new GSOGeoPolyline3D();
                //填方分析线
                GSOGeoPolyline3D lineFill = new GSOGeoPolyline3D();
                //填挖方分析
                bool analysisResult = _glbControl.Globe.Analysis3D.DigFillAnalyseWithModel(e.Polygon, dAlt, out m_dDigVolume, out m_dFillVolume,
                                                                                           out m_dDigArea, out m_dFillArea, out m_dTotalArea, dDSampleGap, lineDig, lineFill);
                //分析成功
                if (analysisResult)
                {
                    StringBuilder str = new StringBuilder();
                    str.AppendLine("分析高度:" + dAlt.ToString());
                    str.AppendLine("分析精度:" + pointDistance.ToString() + "米");
                    str.AppendLine("挖方量:" + m_dDigVolume.ToString() + "立方米");
                    str.AppendLine("填方量:" + m_dFillVolume.ToString() + "立方米");
                    str.AppendLine("总面积:" + m_dTotalArea.ToString() + "平方米");
                    MessageBox.Show(str.ToString());
                }
                else
                {
                    MessageBox.Show("分析失败。");
                }
            }
            _glbControl.Refresh();
            _glbControl.Globe.Action = EnumAction3D.ActionNull;
        }
Esempio n. 6
0
 public static GeoScene.Data.GSOPoint2d XYZ_2_Latlon(int projectID, GSOPoint2d point2d)
 {
     GeoScene.Data.GSOPoint2d result = GeoScene.Data.GSOProjectManager.Inverse(point2d, projectID);
     return(result);
 }