Exemple #1
0
 /// <summary>
 /// 分析范围画完事件
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 void globeControl1_TrackPolygonEndEvent(object sender, TrackPolygonEndEventArgs e)
 {
     if (e.Polygon != null)
     {
         if (trackPolygonType == "填挖方分析")
         {
             globeControl1.Globe.Action = EnumAction3D.ActionNull;
             FrmAnalysisDigFillOfTerrain frm = new FrmAnalysisDigFillOfTerrain(globeControl1, e.Polygon);
             frm.Show(this);
         }
     }
 }
Exemple #2
0
        private void GlobeControl1OnTrackPolygonEndEvent(object sender, TrackPolygonEndEventArgs e)
        {
            GSOGeoPolygon3D polygon = e.Polygon;

            if (TracPolygonType == "挖坑")
            {
                //创建坑对象
                GSOGeoPit pit = new GSOGeoPit();
                pit.PitDepthUsing = true;    //是否使用深度
                pit.PitDepth      = 10;      //深度
                pit.PitPolygon    = polygon; //坑的面
                globeControl1.Globe.AddPit("坑1", pit);
            }
        }
Exemple #3
0
 //绘制面
 void mGlobeControl_TrackPolygonAnalysisEndEvent(object sender, TrackPolygonEndEventArgs e)
 {
     if (e.Polygon != null)
     {
         if (layer != null && isSelectObject)
         {
             GSOFeatures feats = layer.FindFeaturesInPolygon(e.Polygon, false);
             if (feats != null && feats.Length > 0)
             {
                 SetDataTable(feats);
             }
             else
             {
                 MessageBox.Show("框选查询结果为空!", "提示");
             }
             globeControl1.Globe.ClearLastTrackPolygon();
             globeControl1.Globe.Refresh();
             return;
         }
     }
 }
 //绘制面
 void mGlobeControl_TrackPolygonAnalysisEndEvent(object sender, TrackPolygonEndEventArgs e)
 {
     if (e.Polygon != null)
     {
         if (layer != null && isSelectObject)
         {
             GSOFeatures feats = layer.FindFeaturesInPolygon(e.Polygon, false);
             if (feats != null && feats.Length > 0)
             {
                 SetDataTable(feats);
             }
             else
             {
                 MessageBox.Show("框选查询结果为空!","提示");
             }
             globeControl1.Globe.ClearLastTrackPolygon();
             globeControl1.Globe.Refresh();
             return;
         }
     }
 }
Exemple #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;
        }
Exemple #6
0
        void sceneControl1_TrackPolygonAnalysisEndEvent(object sender, TrackPolygonEndEventArgs e)
        {
            if (e.Polygon != null)
            {
                // 如果是剖面分析
                if (DigFillAnalysisMenuItem.Checked)
                {
                    FrmAnalysisDigFill dlg = new FrmAnalysisDigFill();
                    dlg.m_globe = globeControl1.Globe;
                    dlg.m_polygon3D = e.Polygon;
                    dlg.Show(this);
                }
                else if (NoSourceFloodSubmergeMenuItem.Checked)
                {
                    FrmFloodSubmergeAnalysis dlg = new FrmFloodSubmergeAnalysis();
                    dlg.m_globe = globeControl1.Globe;
                    dlg.m_polygon3D = e.Polygon;
                    dlg.Show(this);
                }
                else if (PolygonDigPitMenuItem.Checked)
                {
                    GSOGeoPit geoPit=new GSOGeoPit();
                    if (m_bDigPitByDepth)
                    {
                        geoPit.PitDepth = m_dDigPitValue;
                        geoPit.PitDepthUsing = true;
                    }
                    else
                    {
                        geoPit.PitBottomAlt = m_dDigPitValue;
                        geoPit.PitDepthUsing = false;
                    }
                    geoPit.PitPolygon = e.Polygon;
                    globeControl1.Globe.AddPit("", geoPit);

                    // 清除当前TrackPolygonAnalysis的痕迹
                    globeControl1.Globe.ClearLastTrackPolygon();
                    globeControl1.Globe.ClearLastTrackPolyline();
                }
                else if (trackPolygonEndFunction == "polygonOpenAttributes")
                {
                    TreeNode node = layerNodeContexMenu.Tag as TreeNode;
                    GSOLayer layer = node.Tag as GSOLayer;
                    if (layer != null)
                    {
                        GSOFeatures features = layer.FindFeaturesInPolygon(e.Polygon,false);
                        if (features == null || features.Length <= 0)
                        {
                            MessageBox.Show("选中的对象为空,请重新选择!","提示");
                            return;
                        }
                        FrmEditLayerAttributesByTable frm_editor = FrmEditLayerAttributesByTable.GetForm(layer, features, globeControl1);
                        frm_editor.SetDataTable();
                        if (!frm_editor.isShow)
                        {
                            return;
                        }
                        if (!frm_editor.isShowFirst)
                        {
                            frm_editor.Show(this);
                        }
                    }
                    globeControl1.Globe.ClearLastTrackPolygon();
                    globeControl1.Globe.Refresh();
                    trackPolygonEndFunction = "";
                }
                else if (trackPolygonEndFunction == "polygonDelete")
                {
                    GSOLayer layer = globeControl1.Globe.DestLayerFeatureAdd;
                    if (layer != null)
                    {
                        GSOFeatures fs = layer.FindFeaturesInPolygon(e.Polygon, false);
                        if (fs != null && fs.Length > 0)
                        {
                            for (int i = 0; i < fs.Length; i++)
                            {
                                fs[i].Delete();
                            }
                        }
                    }
                    globeControl1.Globe.ClearLastTrackPolygon();
                    globeControl1.Globe.Refresh();
                    return;
                }
            }

            globeControl1.Globe.Action = EnumAction3D.ActionNull;
            ActionToolMenuChecked();
        }