Beispiel #1
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);
            }
        }
Beispiel #2
0
        void sceneControl1_TrackPolylineAnalysisEndEvent(object sender, TrackPolylineEndEventArgs e)
        {
            if (e.Polyline != null)
            {
                // 如果是剖面分析
                 if (ProfileAnalysisMenuItem.Checked)
                 {
                     GSOPoint3d pntMax,pntMin,pntStart,pntEnd;
                     GSOPoint3ds pnt3ds;
                     double dLineLength;
                     globeControl1.Globe.Analysis3D.ProfileAnalyse(e.Polyline, 100, out pnt3ds, out dLineLength, out pntMax, out pntMin, out pntStart, out pntEnd);
                     FrmAnalysisProfile dlg=new FrmAnalysisProfile();
                     dlg.m_pnt3ds = pnt3ds;
                     dlg.m_pntMax = pntMax;
                     dlg.m_pntMin = pntMin;
                     dlg.m_pntStart = pntStart;
                     dlg.m_pntEnd = pntEnd;
                     dlg.m_dXTotalLength = dLineLength;
                     dlg.m_dSphereLength = e.Polyline.GetSphereLength(6378137.0);
                     dlg.m_dSpaceLength = e.Polyline.GetSpaceLength(false,6378137.0);
                     dlg.m_dGroundLength = globeControl1.Globe.Analysis3D.GetGroundLength(e.Polyline,false,0);
                     dlg.Show(this);
                 }
                 else if (BaselineProfileAnalysisMenuItem.Checked) //基线剖面分析
                 {
                     FrmBaseLineProfillAnalysis dlg = new FrmBaseLineProfillAnalysis();
                     dlg.m_globe = globeControl1.Globe;
                     dlg.m_geopolyline = e.Polyline;
                     dlg.Show(this);
                 }
                 else if (LineDigPitMenuItem.Checked) //沿线挖坑
                 {
                     GSOGeoPolygon3D resPolygon=e.Polyline.CreateBuffer(m_dDigPitWidthAlongLine,false,0,false, false);
                     GSOGeoPit geoPit = new GSOGeoPit();
                     geoPit.PitPolygon = resPolygon;
                     if(m_bDigPitByDepth)
                     {
                         geoPit.PitDepth = m_dDigPitValue;
                         geoPit.PitDepthUsing = true;
                     }
                     else
                     {
                         geoPit.PitBottomAlt = m_dDigPitValue;
                         geoPit.PitDepthUsing = false;
                     }

                     globeControl1.Globe.AddPit("", geoPit);
                     // 清除当前TrackPolygonAnalysis的痕迹
                     globeControl1.Globe.ClearLastTrackPolyline();
                 }
                 else if (横断面分析toolStripMenuItem3.Checked)
                 {
                     ArrayList arraylistPoint = new ArrayList();
                     ArrayList arraylistLine = new ArrayList();
                     for (int i = 0; i < globeControl1.Globe.Layers.Count; i++)
                     {
                         GSOLayer layer = globeControl1.Globe.Layers[i];
                         if (layer == null)
                         {
                             return;
                         }
                         if (layer.Visible == false)
                         {
                             continue;
                         }
                         GSOFeatureLayer featurelayer = layer as GSOFeatureLayer;
                         if (featurelayer != null)
                         {
                             GSOFeatures feats = featurelayer.GetAllFeatures(); //featurelayer.FindFeaturesInPolygon(polygon,false);// featurelayer.GetAllFeatures();
                             for (int j = 0; j < feats.Length; j++)
                             {
                                 GSOFeature feateline = feats[j];
                                 GSOGeoPolyline3D geoline = feateline.Geometry as GSOGeoPolyline3D;

                                 if (geoline != null)
                                 {
                                     GSOPoint3d pntIntersect1;
                                     GSOPoint3d pntIntersect2;
                                     double dHonLen;
                                     double dVerLen;
                                     double dNoIntersectStartRatio = 0;
                                     bool isIntersect = globeControl1.Globe.Analysis3D.IsTwoGeoPolylineIntersect2D(e.Polyline, geoline);
                                     if (isIntersect)
                                     {
                                         double dDist = globeControl1.Globe.Analysis3D.ComputeTwoGeoPolylineDistance(e.Polyline, geoline, out pntIntersect1, out pntIntersect2, out dHonLen, out dVerLen, false, false, dNoIntersectStartRatio);
                                         if (dDist > -1)
                                         {
                                             arraylistPoint.Add(pntIntersect2);
                                             arraylistLine.Add(feateline);
                                         }
                                     }
                                     globeControl1.Globe.Action = EnumAction3D.ActionNull;
                                 }
                             }
                         }
                     }
                     FrmAnalysisHengDuanMian frm = FrmAnalysisHengDuanMian.GetForm(arraylistPoint, arraylistLine, e.Polyline, globeControl1);
                     if (!frm.isShowFirst)
                     {
                         frm.Show(this);
                     }
                     frm.LoadChartEvent();
                     globeControl1.Globe.ClearAnalysis();
                 }
            }
            globeControl1.Globe.Action = EnumAction3D.ActionNull;
            ActionToolMenuChecked();
        }
Beispiel #3
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();
        }