diff --git a/Cyberpipe.suo b/Cyberpipe.suo index 5917bad..e8c0bf3 100644 --- a/Cyberpipe.suo +++ b/Cyberpipe.suo Binary files differ diff --git a/Cyberpipe.suo b/Cyberpipe.suo index 5917bad..e8c0bf3 100644 --- a/Cyberpipe.suo +++ b/Cyberpipe.suo Binary files differ diff --git a/DoublePanelAnalysis.cs b/DoublePanelAnalysis.cs index d69018e..b2e089a 100644 --- a/DoublePanelAnalysis.cs +++ b/DoublePanelAnalysis.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.Data; using System.Drawing; using GeoScene.Data; @@ -11,8 +12,8 @@ { public static GSOGlobeControl globeControl1 = null; public static GSOGlobeControl globeControl2 = null; - public static GSOLayer layerTemp = null; - public static GSOLayer layerTemp2 = null; +// public static GSOLayer layerTemp = null; +// public static GSOLayer layerTemp2 = null; public static int bufferWidth = 8; public static string strLabel; /// @@ -932,7 +933,94 @@ } } - + #region wxl 重构 碰撞审查,覆土审查,水平净距审查,垂直净距审查 + + /// + /// 获取跟选择管线垂直距离小于特定值的管线列表和选择管线的距离 + /// + /// 选择管线 + /// 各图层名称 + /// 垂直距离 + /// 水平距离 + /// 管线列表,可为空 + public static Dictionary VerticalDistanceAnalysis(GSOGlobeControl globeControl1,GSOFeature selectedFeature, List _pipelineLayerNames, double verticalDistance) + { + if (selectedFeature == null) return null; + GSOGeoPolyline3D line1 = selectedFeature.Geometry as GSOGeoPolyline3D; + if (line1 == null) return null; + GSOPipeLineStyle3D pipeStyle1 = line1.Style as GSOPipeLineStyle3D; + if (pipeStyle1 == null) return null; + GSOGeoPolygon3D polygon = line1.CreateBuffer(0.1, true, 5, true, false); + Dictionary result = new Dictionary(); + + string caption = selectedFeature.Dataset.Caption; + + GSOPoint3d pntIntersect1 = new GSOPoint3d(); + GSOPoint3d pntIntersect2 = new GSOPoint3d(); + GSOPoint3d pntProIntersect1 = new GSOPoint3d(); + GSOPoint3d pntProIntersect2 = new GSOPoint3d(); + for (int i = 0; i < _pipelineLayerNames.Count; i++) + { + if (caption == _pipelineLayerNames[i]) continue;//排除本图层 + GSOLayer layer2 = globeControl1.Globe.Layers.GetLayerByCaption(_pipelineLayerNames[i]); + if (layer2 == null) continue; + GSOFeatures feats2 = FeatureStatisticsService.getLayerFeatures(polygon, layer2); + if (feats2 == null) continue; + for (int j = 0; j < feats2.Length; j++) + { + GSOFeature feat2 = feats2[j]; + GSOGeoPolyline3D line2 = feat2.Geometry as GSOGeoPolyline3D; + if (line2 == null) continue; + GSOPipeLineStyle3D pipeStyle2 = line2.Style as GSOPipeLineStyle3D; + if (pipeStyle2 == null) continue; + + double dDist = globeControl1.Globe.Analysis3D.ComputeHorizonDistance(line1, line2, out pntIntersect1, + out pntIntersect2, out pntProIntersect1, out pntProIntersect2, false); + if (dDist <= -1) continue; //为什么是-1 wxl注释 + + dDist = Math.Abs(pntIntersect1.Z - pntIntersect2.Z) - pipeStyle1.Radius - pipeStyle2.Radius; //获得净距值 z值是管线中心点吗?wxl + if (dDist >= verticalDistance) continue;//不符合条件 + result.Add(feat2,dDist); + } + } + polygon.ReleaseInnerPointer();//方法的作用是强制释放内存空间吗?? + return result; + } + public static Dictionary HorizontalDistanceAnalysis(GSOGlobeControl globeControl1,GSOFeature selectedFeature, List _pipelineLayerNames, double dis) + { + if (selectedFeature == null) return null; + GSOGeoPolyline3D line1 = selectedFeature.Geometry as GSOGeoPolyline3D; + if (line1 == null) return null; + GSOPipeLineStyle3D pipeStyle1 = line1.Style as GSOPipeLineStyle3D; + if (pipeStyle1 == null) return null; + Dictionary result = new Dictionary(); + string caption = selectedFeature.Dataset.Caption; + GSOGeoPolygon3D polygon = line1.CreateBuffer(dis, true, 5, true, false); + GSOFeature new_feat = new GSOFeature(); + new_feat.Geometry = polygon; + + for (int i = 0; i < _pipelineLayerNames.Count; i++) + { + if (caption == _pipelineLayerNames[i]) continue; + GSOLayer layer2 = globeControl1.Globe.Layers.GetLayerByCaption(_pipelineLayerNames[i]); + if (layer2 == null) continue; + GSOFeatures feats2 = FeatureStatisticsService.getLayerFeatures(polygon, layer2); + for (int j = 0; j < feats2.Length; j++) + { + GSOFeature feat2 = feats2[j]; + GSOGeoPolyline3D line2 = feat2.Geometry as GSOGeoPolyline3D; + if (line2 == null) continue; + GSOPoint3d pntIntersect1, pntIntersect2, pntProIntersect1, pntProIntersect2; + double dDist = globeControl1.Globe.Analysis3D.ComputeHorizonDistance(line1, line2, out pntIntersect1, + out pntIntersect2, out pntProIntersect1, out pntProIntersect2, false); + GSOPipeLineStyle3D pipeStyle2 = line2.Style as GSOPipeLineStyle3D; + if (pipeStyle2 == null) continue; + result.Add(feat2,dDist); + } + } + return result; + } + #endregion } } diff --git a/Cyberpipe.suo b/Cyberpipe.suo index 5917bad..e8c0bf3 100644 --- a/Cyberpipe.suo +++ b/Cyberpipe.suo Binary files differ diff --git a/DoublePanelAnalysis.cs b/DoublePanelAnalysis.cs index d69018e..b2e089a 100644 --- a/DoublePanelAnalysis.cs +++ b/DoublePanelAnalysis.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.Data; using System.Drawing; using GeoScene.Data; @@ -11,8 +12,8 @@ { public static GSOGlobeControl globeControl1 = null; public static GSOGlobeControl globeControl2 = null; - public static GSOLayer layerTemp = null; - public static GSOLayer layerTemp2 = null; +// public static GSOLayer layerTemp = null; +// public static GSOLayer layerTemp2 = null; public static int bufferWidth = 8; public static string strLabel; /// @@ -932,7 +933,94 @@ } } - + #region wxl 重构 碰撞审查,覆土审查,水平净距审查,垂直净距审查 + + /// + /// 获取跟选择管线垂直距离小于特定值的管线列表和选择管线的距离 + /// + /// 选择管线 + /// 各图层名称 + /// 垂直距离 + /// 水平距离 + /// 管线列表,可为空 + public static Dictionary VerticalDistanceAnalysis(GSOGlobeControl globeControl1,GSOFeature selectedFeature, List _pipelineLayerNames, double verticalDistance) + { + if (selectedFeature == null) return null; + GSOGeoPolyline3D line1 = selectedFeature.Geometry as GSOGeoPolyline3D; + if (line1 == null) return null; + GSOPipeLineStyle3D pipeStyle1 = line1.Style as GSOPipeLineStyle3D; + if (pipeStyle1 == null) return null; + GSOGeoPolygon3D polygon = line1.CreateBuffer(0.1, true, 5, true, false); + Dictionary result = new Dictionary(); + + string caption = selectedFeature.Dataset.Caption; + + GSOPoint3d pntIntersect1 = new GSOPoint3d(); + GSOPoint3d pntIntersect2 = new GSOPoint3d(); + GSOPoint3d pntProIntersect1 = new GSOPoint3d(); + GSOPoint3d pntProIntersect2 = new GSOPoint3d(); + for (int i = 0; i < _pipelineLayerNames.Count; i++) + { + if (caption == _pipelineLayerNames[i]) continue;//排除本图层 + GSOLayer layer2 = globeControl1.Globe.Layers.GetLayerByCaption(_pipelineLayerNames[i]); + if (layer2 == null) continue; + GSOFeatures feats2 = FeatureStatisticsService.getLayerFeatures(polygon, layer2); + if (feats2 == null) continue; + for (int j = 0; j < feats2.Length; j++) + { + GSOFeature feat2 = feats2[j]; + GSOGeoPolyline3D line2 = feat2.Geometry as GSOGeoPolyline3D; + if (line2 == null) continue; + GSOPipeLineStyle3D pipeStyle2 = line2.Style as GSOPipeLineStyle3D; + if (pipeStyle2 == null) continue; + + double dDist = globeControl1.Globe.Analysis3D.ComputeHorizonDistance(line1, line2, out pntIntersect1, + out pntIntersect2, out pntProIntersect1, out pntProIntersect2, false); + if (dDist <= -1) continue; //为什么是-1 wxl注释 + + dDist = Math.Abs(pntIntersect1.Z - pntIntersect2.Z) - pipeStyle1.Radius - pipeStyle2.Radius; //获得净距值 z值是管线中心点吗?wxl + if (dDist >= verticalDistance) continue;//不符合条件 + result.Add(feat2,dDist); + } + } + polygon.ReleaseInnerPointer();//方法的作用是强制释放内存空间吗?? + return result; + } + public static Dictionary HorizontalDistanceAnalysis(GSOGlobeControl globeControl1,GSOFeature selectedFeature, List _pipelineLayerNames, double dis) + { + if (selectedFeature == null) return null; + GSOGeoPolyline3D line1 = selectedFeature.Geometry as GSOGeoPolyline3D; + if (line1 == null) return null; + GSOPipeLineStyle3D pipeStyle1 = line1.Style as GSOPipeLineStyle3D; + if (pipeStyle1 == null) return null; + Dictionary result = new Dictionary(); + string caption = selectedFeature.Dataset.Caption; + GSOGeoPolygon3D polygon = line1.CreateBuffer(dis, true, 5, true, false); + GSOFeature new_feat = new GSOFeature(); + new_feat.Geometry = polygon; + + for (int i = 0; i < _pipelineLayerNames.Count; i++) + { + if (caption == _pipelineLayerNames[i]) continue; + GSOLayer layer2 = globeControl1.Globe.Layers.GetLayerByCaption(_pipelineLayerNames[i]); + if (layer2 == null) continue; + GSOFeatures feats2 = FeatureStatisticsService.getLayerFeatures(polygon, layer2); + for (int j = 0; j < feats2.Length; j++) + { + GSOFeature feat2 = feats2[j]; + GSOGeoPolyline3D line2 = feat2.Geometry as GSOGeoPolyline3D; + if (line2 == null) continue; + GSOPoint3d pntIntersect1, pntIntersect2, pntProIntersect1, pntProIntersect2; + double dDist = globeControl1.Globe.Analysis3D.ComputeHorizonDistance(line1, line2, out pntIntersect1, + out pntIntersect2, out pntProIntersect1, out pntProIntersect2, false); + GSOPipeLineStyle3D pipeStyle2 = line2.Style as GSOPipeLineStyle3D; + if (pipeStyle2 == null) continue; + result.Add(feat2,dDist); + } + } + return result; + } + #endregion } } diff --git a/MainFrm.cs b/MainFrm.cs index 626ca8f..d1e6bb2 100644 --- a/MainFrm.cs +++ b/MainFrm.cs @@ -70,7 +70,7 @@ Double m_dDigPitWidthAlongLine = 6; Boolean m_bDigPitByDepth = true; //选择管线 - int selectState; + int selectState;//wxl 注释,表示是否已经计算过净距等了,1已计算,0未计算 //private OracleConnection connBackup = null; //数据集合 @@ -3469,7 +3469,7 @@ globeControl1.Globe.MemoryLayer.SaveAs(Application.StartupPath + "/MyPlace.kml"); } - #region 完善 + #region 完善(各种净距分析) /// /// 垂直净距分析 功能界面中的 选择图层复选框 选中状态改变事件处理 /// @@ -3619,7 +3619,7 @@ Dictionary featCount = new Dictionary(); Dictionary featLenth = new Dictionary(); Dictionary m_FeaturesWithBianhao = new Dictionary();//记录编号和对应的标注点的位置 - GSOFeatures polygonJingJuAnalysises = new GSOFeatures(); + //GSOFeatures polygonJingJuAnalysises = new GSOFeatures(); /// /// 垂直净距分析 功能界面中的 开始分析按钮 事件处理 /// @@ -3643,72 +3643,71 @@ MessageBox.Show("请输入正确的净距标准!", "提示"); return; } - - if (dataGridViewX2.Rows.Count > 0) - { - featCount.Clear(); - featLenth.Clear(); - listBox1.Items.Clear(); - layerTemp.RemoveAllFeature(); - polygonJingJuAnalysises.RemoveAll(); - clearFeatureHighLight(); - dataGridViewX3.Rows.Clear(); - m_FeaturesWithBianhao.Clear(); - Cursor = Cursors.WaitCursor; - if (checkBoxX1.Checked) // 选择管线 - { - for (int i = 0; i < dataGridViewX2.Rows.Count; i++) - { - GSOFeature selectedFeature = dataGridViewX2.Rows[i].Tag as GSOFeature; - if (selectedFeature != null) - { - selectState = 1; - VerticalDistanceAnalysis("垂直净距分析", selectedFeature, Utility.m_PipelineLayerNames, dJingJuBiaoZhun, 0.0); - } - } - } - else if (checkBoxX2.Checked) // 选择图层 - { - if (comboBoxEx1.SelectedItem == null) - { - MessageBox.Show("请选择一个图层!", "提示"); - return; - } - GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(comboBoxEx1.SelectedItem.ToString()); - if (layer == null) - return; - - GSOFeatureLayer flayer = layer as GSOFeatureLayer; - GSOFeatureDataset fdataset = flayer.Dataset as GSOFeatureDataset; - GSOFeatures feats = flayer.GetAllFeatures(); - for (int i = 0; i < feats.Length; i++) - { - selectState = 1; - VerticalDistanceAnalysis("垂直净距分析", feats[i], Utility.m_PipelineLayerNames, dJingJuBiaoZhun, 0.0); - } - } - if (featCount.Count > 0) - { - for (int i = 0; i < Utility.m_PipelineLayerNames.Count; i++) - { - if (featCount.ContainsKey(Utility.m_PipelineLayerNames[i]) && featLenth.ContainsKey(Utility.m_PipelineLayerNames[i])) - { - listBox1.Items.Add(Utility.m_PipelineLayerNames[i] + ":" + featCount[Utility.m_PipelineLayerNames[i]] + "条,共" + featLenth[Utility.m_PipelineLayerNames[i]].ToString("0.00") + "米"); - } - } - } - if (dataGridViewX3.Rows.Count == 0 && selectState == 1) - { - MessageBox.Show("没有不符合净距标准的管线!", "提示"); - } - } - else + if (dataGridViewX2.Rows.Count <= 0) { MessageBox.Show("请选中要进行垂直净距分析的管线!", "提示"); + return; + } + + featCount.Clear(); + featLenth.Clear(); + listBox1.Items.Clear(); + layerTemp.RemoveAllFeature(); + //polygonJingJuAnalysises.RemoveAll(); + clearFeatureHighLight(); + dataGridViewX3.Rows.Clear(); + m_FeaturesWithBianhao.Clear(); + Cursor = Cursors.WaitCursor; + if (checkBoxX1.Checked) // 选择管线 + { + for (int i = 0; i < dataGridViewX2.Rows.Count; i++) + { + GSOFeature selectedFeature = dataGridViewX2.Rows[i].Tag as GSOFeature; + if (selectedFeature == null) continue; + selectState = 1; + VerticalDistanceAnalysis("垂直净距分析", selectedFeature, Utility.m_PipelineLayerNames, + dJingJuBiaoZhun, 0.0); + } + } + else if (checkBoxX2.Checked) // 选择图层 + { + if (comboBoxEx1.SelectedItem == null) + { + MessageBox.Show("请选择一个图层!", "提示"); + return; + } + GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(comboBoxEx1.SelectedItem.ToString()); + if (layer == null) return; + GSOFeatureLayer flayer = layer as GSOFeatureLayer; + //GSOFeatureDataset fdataset = flayer.Dataset as GSOFeatureDataset; + GSOFeatures feats = flayer.GetAllFeatures(); + for (int i = 0; i < feats.Length; i++) + { + selectState = 1; + VerticalDistanceAnalysis("垂直净距分析", feats[i], Utility.m_PipelineLayerNames, dJingJuBiaoZhun, 0.0); + } + } + if (featCount.Count > 0) + { + for (int i = 0; i < Utility.m_PipelineLayerNames.Count; i++) + { + if (featCount.ContainsKey(Utility.m_PipelineLayerNames[i]) && + featLenth.ContainsKey(Utility.m_PipelineLayerNames[i])) + { + listBox1.Items.Add(Utility.m_PipelineLayerNames[i] + ":" + + featCount[Utility.m_PipelineLayerNames[i]] + "条,共" + + featLenth[Utility.m_PipelineLayerNames[i]].ToString("0.00") + "米"); + } + } + } + if (dataGridViewX3.Rows.Count == 0 && selectState == 1) + { + MessageBox.Show("没有不符合净距标准的管线!", "提示"); } globeControl1.Refresh(); Cursor = Cursors.Default; } + /// /// 在指定的两点组成的线的中间添加一个marker对象,并将marker对象添加到指定的图层中 /// @@ -3841,7 +3840,7 @@ idx = dataGridViewX3.Rows.Add(); dataGridViewX3.Rows[idx].Cells[0].Value = caption; dataGridViewX3.Rows[idx].Cells[1].Value = selectedFeature.Name; - dataGridViewX3.Rows[idx].Cells[2].Value = layer2.Caption; + dataGridViewX3.Rows[idx].Cells[2].Value = layer2.Caption;// feat2.Dataset.Caption;一致 dataGridViewX3.Rows[idx].Cells[3].Value = feat2.Name; dataGridViewX3.Rows[idx].Cells[4].Value = dDist.ToString("0.00"); } @@ -3917,6 +3916,7 @@ line1.ReleaseInnerPointer(); selectedFeature.ReleaseInnerPointer(); } + /// /// 垂直净距分析中 表格行的 双击定位 功能。 与覆土分析的实现方法不同,主要原因是需要标注垂距 /// @@ -3967,7 +3967,7 @@ featLenth.Clear(); listBox3.Items.Clear(); layerTemp.RemoveAllFeature(); - polygonJingJuAnalysises.RemoveAll(); + //polygonJingJuAnalysises.RemoveAll(); clearFeatureHighLight(); dataGridViewX9.Rows.Clear(); Cursor = Cursors.WaitCursor; @@ -4020,13 +4020,92 @@ globeControl1.Refresh(); Cursor = Cursors.Default; } - /// - /// 计算指定feature对象与除了该feature所在图层之外的 所有管线图层中的所有feature对象 的水平距离 并记录符合要求的管线 功能 - /// - /// - /// - /// - /// +// /// +// /// 计算指定feature对象与除了该feature所在图层之外的 所有管线图层中的所有feature对象 的水平距离 并记录符合要求的管线 功能 +// /// +// /// +// /// +// /// +// /// +// private void HorizontalDistanceAnalysis(GSOFeature selectedFeature, List _pipelineLayerNames, double dis) +// { +// if (selectedFeature == null) +// { +// selectState = 0; +// MessageBox.Show("请选择一条管线!"); +// return; +// } +// GSOGeoPolyline3D line1 = selectedFeature.Geometry as GSOGeoPolyline3D; +// if (line1 == null) +// { +// selectState = 0; +// MessageBox.Show("请选择一条管线!"); +// return; +// } +// +// string caption = selectedFeature.Dataset.Caption; +// +// GSOGeoPolygon3D polygon = line1.CreateBuffer(dis, true, 5, true, false); +// GSOFeature new_feat = new GSOFeature(); +// new_feat.Geometry = polygon; +// //polygonJingJuAnalysises.Add(new_feat); +// layerTemp.AddFeature(new_feat); +// +// for (int i = 0; i < _pipelineLayerNames.Count; i++) +// { +// if (caption == _pipelineLayerNames[i]) +// { +// continue; +// } +// GSOLayer layer2 = globeControl1.Globe.Layers.GetLayerByCaption(_pipelineLayerNames[i]); +// if (layer2 == null) continue; +// GSOFeatureLayer flayer2 = layer2 as GSOFeatureLayer; +// GSOFeatureDataset fdataset2 = flayer2.Dataset as GSOFeatureDataset; +// GSOFeatures feats2 = Polygon_Contain_PointAnalysis(polygon, _pipelineLayerNames[i]); +// for (int j = 0; j < feats2.Length; j++) +// { +// GSOFeature feat2 = feats2[j]; +// GSOGeoPolyline3D line2 = feats2[j].Geometry as GSOGeoPolyline3D; +// if (line2 == null) +// { +// continue; +// } +// GSOPipeLineStyle3D pipeStyle1 = line1.Style as GSOPipeLineStyle3D; +// GSOPipeLineStyle3D pipeStyle2 = line2.Style as GSOPipeLineStyle3D; +// if (pipeStyle1 == null || pipeStyle2 == null) +// { +// continue; +// } +// +// feat2.HighLight = true; +// int idx = dataGridViewX9.Rows.Add(); +// dataGridViewX9.Rows[idx].Tag = feat2; +// dataGridViewX9.Rows[idx].Cells[0].Value = caption; +// dataGridViewX9.Rows[idx].Cells[1].Value = selectedFeature.Name; +// dataGridViewX9.Rows[idx].Cells[2].Value = layer2.Caption; +// dataGridViewX9.Rows[idx].Cells[3].Value = feats2[j].Name; +// dataGridViewX9.Rows[idx].Cells[4].Value = dis.ToString("0.00"); +// +// if (featCount.ContainsKey(layer2.Caption)) +// { +// featCount[layer2.Caption] = featCount[layer2.Caption] + 1; +// } +// else +// { +// featCount.Add(layer2.Caption, 1); +// } +// if (featLenth.ContainsKey(layer2.Caption)) +// { +// featLenth[layer2.Caption] = featLenth[layer2.Caption] + line2.GetSpaceLength(true, 6378137); +// } +// else +// { +// featLenth.Add(layer2.Caption, line2.GetSpaceLength(true, 6378137)); +// } +// } +// } + // } + #region wxl 未改完 private void HorizontalDistanceAnalysis(GSOFeature selectedFeature, List _pipelineLayerNames, double dis) { if (selectedFeature == null) @@ -4042,69 +4121,40 @@ MessageBox.Show("请选择一条管线!"); return; } - - string caption = selectedFeature.Dataset.Caption; - - GSOGeoPolygon3D polygon = line1.CreateBuffer(dis, true, 5, true, false); - GSOFeature new_feat = new GSOFeature(); - new_feat.Geometry = polygon; - polygonJingJuAnalysises.Add(new_feat); - layerTemp.AddFeature(new_feat); - - for (int i = 0; i < _pipelineLayerNames.Count; i++) + Dictionary featureMap = DoublePanelAnalysis.HorizontalDistanceAnalysis(globeControl1,selectedFeature, + _pipelineLayerNames, dis); + foreach (KeyValuePair kvp in featureMap) { - if (caption == _pipelineLayerNames[i]) + GSOFeature feat2 = kvp.Key; + feat2.HighLight = true; + int idx = dataGridViewX9.Rows.Add(); + dataGridViewX9.Rows[idx].Tag = feat2; + dataGridViewX9.Rows[idx].Cells[0].Value = selectedFeature.Dataset.Caption; + dataGridViewX9.Rows[idx].Cells[1].Value = selectedFeature.Name; + dataGridViewX9.Rows[idx].Cells[2].Value = feat2.Dataset.Caption; + dataGridViewX9.Rows[idx].Cells[3].Value = feat2.Name; + dataGridViewX9.Rows[idx].Cells[4].Value = dis.ToString("0.00"); + GSOGeoPolyline3D line2 = feat2.Geometry as GSOGeoPolyline3D; + if (featCount.ContainsKey(feat2.Dataset.Caption)) { - continue; + featCount[feat2.Dataset.Caption] = featCount[feat2.Dataset.Caption] + 1; } - GSOLayer layer2 = globeControl1.Globe.Layers.GetLayerByCaption(_pipelineLayerNames[i]); - if (layer2 == null) continue; - GSOFeatureLayer flayer2 = layer2 as GSOFeatureLayer; - GSOFeatureDataset fdataset2 = flayer2.Dataset as GSOFeatureDataset; - GSOFeatures feats2 = Polygon_Contain_PointAnalysis(polygon, _pipelineLayerNames[i]); - for (int j = 0; j < feats2.Length; j++) + else { - GSOFeature feat2 = feats2[j]; - GSOGeoPolyline3D line2 = feats2[j].Geometry as GSOGeoPolyline3D; - if (line2 == null) - { - continue; - } - GSOPipeLineStyle3D pipeStyle1 = line1.Style as GSOPipeLineStyle3D; - GSOPipeLineStyle3D pipeStyle2 = line2.Style as GSOPipeLineStyle3D; - if (pipeStyle1 == null || pipeStyle2 == null) - { - continue; - } - - feat2.HighLight = true; - int idx = dataGridViewX9.Rows.Add(); - dataGridViewX9.Rows[idx].Tag = feat2; - dataGridViewX9.Rows[idx].Cells[0].Value = caption; - dataGridViewX9.Rows[idx].Cells[1].Value = selectedFeature.Name; - dataGridViewX9.Rows[idx].Cells[2].Value = layer2.Caption; - dataGridViewX9.Rows[idx].Cells[3].Value = feats2[j].Name; - dataGridViewX9.Rows[idx].Cells[4].Value = dis.ToString("0.00"); - - if (featCount.ContainsKey(layer2.Caption)) - { - featCount[layer2.Caption] = featCount[layer2.Caption] + 1; - } - else - { - featCount.Add(layer2.Caption, 1); - } - if (featLenth.ContainsKey(layer2.Caption)) - { - featLenth[layer2.Caption] = featLenth[layer2.Caption] + line2.GetSpaceLength(true, 6378137); - } - else - { - featLenth.Add(layer2.Caption, line2.GetSpaceLength(true, 6378137)); - } + featCount.Add(feat2.Dataset.Caption, 1); + } + if (featLenth.ContainsKey(feat2.Dataset.Caption)) + { + featLenth[feat2.Dataset.Caption] = featLenth[feat2.Dataset.Caption] + line2.GetSpaceLength(true, 6378137); + } + else + { + featLenth.Add(feat2.Dataset.Caption, line2.GetSpaceLength(true, 6378137)); } } } + #endregion + /// /// 水平净距分析 功能界面中 表格的 双击定位 功能 /// @@ -4149,7 +4199,7 @@ featCount.Clear(); listBox2.Items.Clear(); layerTemp.RemoveAllFeature(); - polygonJingJuAnalysises.RemoveAll(); + //polygonJingJuAnalysises.RemoveAll(); dataGridViewX5.Rows.Clear(); clearFeatureHighLight(); m_FeaturesWithBianhao.Clear(); @@ -4160,21 +4210,18 @@ for (int i = 0; i < dataGridViewX4.Rows.Count; i++) { GSOFeature selectedFeature = dataGridViewX4.Rows[i].Tag as GSOFeature; - if (selectedFeature != null) - { - selectState = 1; - VerticalDistanceAnalysis("碰撞分析", selectedFeature, Utility.m_PipelineLayerNames, 0, 0.0); - } + if (selectedFeature == null) continue; + selectState = 1; + VerticalDistanceAnalysis("碰撞分析", selectedFeature, Utility.m_PipelineLayerNames, 0, 0.0); } } else if (checkBoxX4.Checked) // 选择图层 { GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(comboBoxEx2.SelectedItem.ToString()); - if (layer == null) - return; + if (layer == null) return; GSOFeatureLayer flayer = layer as GSOFeatureLayer; - GSOFeatureDataset fdataset = flayer.Dataset as GSOFeatureDataset; + //GSOFeatureDataset fdataset = flayer.Dataset as GSOFeatureDataset; GSOFeatures feats = flayer.GetAllFeatures(); for (int i = 0; i < feats.Length; i++) { @@ -4334,15 +4381,7 @@ { GSOFeature rowFeature = dataGridViewX6.Rows[i].Tag as GSOFeature; if (rowFeature == null) continue; - string featureName = ""; - if (isFeatureContainsBianhao(rowFeature))//判断rowFeature是否包含“编号”字段 - { - featureName = rowFeature.GetValue(featureIDFieldName).ToString(); - } - else - { - featureName = rowFeature.Name; - } + string featureName = isFeatureContainsBianhao(rowFeature) ? rowFeature.GetValue(featureIDFieldName).ToString() : rowFeature.Name; GSOGeoPolyline3D line = rowFeature.Geometry as GSOGeoPolyline3D; if (line == null) @@ -4970,7 +5009,7 @@ featLenth.Clear(); listBoxStasticsResult.Items.Clear(); layerTemp.RemoveAllFeature(); - polygonJingJuAnalysises.RemoveAll(); + //polygonJingJuAnalysises.RemoveAll(); clearFeatureHighLight(); dataGridViewAnalysisResult.Rows.Clear(); m_FeaturesWithBianhao.Clear(); diff --git a/Cyberpipe.suo b/Cyberpipe.suo index 5917bad..e8c0bf3 100644 --- a/Cyberpipe.suo +++ b/Cyberpipe.suo Binary files differ diff --git a/DoublePanelAnalysis.cs b/DoublePanelAnalysis.cs index d69018e..b2e089a 100644 --- a/DoublePanelAnalysis.cs +++ b/DoublePanelAnalysis.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.Data; using System.Drawing; using GeoScene.Data; @@ -11,8 +12,8 @@ { public static GSOGlobeControl globeControl1 = null; public static GSOGlobeControl globeControl2 = null; - public static GSOLayer layerTemp = null; - public static GSOLayer layerTemp2 = null; +// public static GSOLayer layerTemp = null; +// public static GSOLayer layerTemp2 = null; public static int bufferWidth = 8; public static string strLabel; /// @@ -932,7 +933,94 @@ } } - + #region wxl 重构 碰撞审查,覆土审查,水平净距审查,垂直净距审查 + + /// + /// 获取跟选择管线垂直距离小于特定值的管线列表和选择管线的距离 + /// + /// 选择管线 + /// 各图层名称 + /// 垂直距离 + /// 水平距离 + /// 管线列表,可为空 + public static Dictionary VerticalDistanceAnalysis(GSOGlobeControl globeControl1,GSOFeature selectedFeature, List _pipelineLayerNames, double verticalDistance) + { + if (selectedFeature == null) return null; + GSOGeoPolyline3D line1 = selectedFeature.Geometry as GSOGeoPolyline3D; + if (line1 == null) return null; + GSOPipeLineStyle3D pipeStyle1 = line1.Style as GSOPipeLineStyle3D; + if (pipeStyle1 == null) return null; + GSOGeoPolygon3D polygon = line1.CreateBuffer(0.1, true, 5, true, false); + Dictionary result = new Dictionary(); + + string caption = selectedFeature.Dataset.Caption; + + GSOPoint3d pntIntersect1 = new GSOPoint3d(); + GSOPoint3d pntIntersect2 = new GSOPoint3d(); + GSOPoint3d pntProIntersect1 = new GSOPoint3d(); + GSOPoint3d pntProIntersect2 = new GSOPoint3d(); + for (int i = 0; i < _pipelineLayerNames.Count; i++) + { + if (caption == _pipelineLayerNames[i]) continue;//排除本图层 + GSOLayer layer2 = globeControl1.Globe.Layers.GetLayerByCaption(_pipelineLayerNames[i]); + if (layer2 == null) continue; + GSOFeatures feats2 = FeatureStatisticsService.getLayerFeatures(polygon, layer2); + if (feats2 == null) continue; + for (int j = 0; j < feats2.Length; j++) + { + GSOFeature feat2 = feats2[j]; + GSOGeoPolyline3D line2 = feat2.Geometry as GSOGeoPolyline3D; + if (line2 == null) continue; + GSOPipeLineStyle3D pipeStyle2 = line2.Style as GSOPipeLineStyle3D; + if (pipeStyle2 == null) continue; + + double dDist = globeControl1.Globe.Analysis3D.ComputeHorizonDistance(line1, line2, out pntIntersect1, + out pntIntersect2, out pntProIntersect1, out pntProIntersect2, false); + if (dDist <= -1) continue; //为什么是-1 wxl注释 + + dDist = Math.Abs(pntIntersect1.Z - pntIntersect2.Z) - pipeStyle1.Radius - pipeStyle2.Radius; //获得净距值 z值是管线中心点吗?wxl + if (dDist >= verticalDistance) continue;//不符合条件 + result.Add(feat2,dDist); + } + } + polygon.ReleaseInnerPointer();//方法的作用是强制释放内存空间吗?? + return result; + } + public static Dictionary HorizontalDistanceAnalysis(GSOGlobeControl globeControl1,GSOFeature selectedFeature, List _pipelineLayerNames, double dis) + { + if (selectedFeature == null) return null; + GSOGeoPolyline3D line1 = selectedFeature.Geometry as GSOGeoPolyline3D; + if (line1 == null) return null; + GSOPipeLineStyle3D pipeStyle1 = line1.Style as GSOPipeLineStyle3D; + if (pipeStyle1 == null) return null; + Dictionary result = new Dictionary(); + string caption = selectedFeature.Dataset.Caption; + GSOGeoPolygon3D polygon = line1.CreateBuffer(dis, true, 5, true, false); + GSOFeature new_feat = new GSOFeature(); + new_feat.Geometry = polygon; + + for (int i = 0; i < _pipelineLayerNames.Count; i++) + { + if (caption == _pipelineLayerNames[i]) continue; + GSOLayer layer2 = globeControl1.Globe.Layers.GetLayerByCaption(_pipelineLayerNames[i]); + if (layer2 == null) continue; + GSOFeatures feats2 = FeatureStatisticsService.getLayerFeatures(polygon, layer2); + for (int j = 0; j < feats2.Length; j++) + { + GSOFeature feat2 = feats2[j]; + GSOGeoPolyline3D line2 = feat2.Geometry as GSOGeoPolyline3D; + if (line2 == null) continue; + GSOPoint3d pntIntersect1, pntIntersect2, pntProIntersect1, pntProIntersect2; + double dDist = globeControl1.Globe.Analysis3D.ComputeHorizonDistance(line1, line2, out pntIntersect1, + out pntIntersect2, out pntProIntersect1, out pntProIntersect2, false); + GSOPipeLineStyle3D pipeStyle2 = line2.Style as GSOPipeLineStyle3D; + if (pipeStyle2 == null) continue; + result.Add(feat2,dDist); + } + } + return result; + } + #endregion } } diff --git a/MainFrm.cs b/MainFrm.cs index 626ca8f..d1e6bb2 100644 --- a/MainFrm.cs +++ b/MainFrm.cs @@ -70,7 +70,7 @@ Double m_dDigPitWidthAlongLine = 6; Boolean m_bDigPitByDepth = true; //选择管线 - int selectState; + int selectState;//wxl 注释,表示是否已经计算过净距等了,1已计算,0未计算 //private OracleConnection connBackup = null; //数据集合 @@ -3469,7 +3469,7 @@ globeControl1.Globe.MemoryLayer.SaveAs(Application.StartupPath + "/MyPlace.kml"); } - #region 完善 + #region 完善(各种净距分析) /// /// 垂直净距分析 功能界面中的 选择图层复选框 选中状态改变事件处理 /// @@ -3619,7 +3619,7 @@ Dictionary featCount = new Dictionary(); Dictionary featLenth = new Dictionary(); Dictionary m_FeaturesWithBianhao = new Dictionary();//记录编号和对应的标注点的位置 - GSOFeatures polygonJingJuAnalysises = new GSOFeatures(); + //GSOFeatures polygonJingJuAnalysises = new GSOFeatures(); /// /// 垂直净距分析 功能界面中的 开始分析按钮 事件处理 /// @@ -3643,72 +3643,71 @@ MessageBox.Show("请输入正确的净距标准!", "提示"); return; } - - if (dataGridViewX2.Rows.Count > 0) - { - featCount.Clear(); - featLenth.Clear(); - listBox1.Items.Clear(); - layerTemp.RemoveAllFeature(); - polygonJingJuAnalysises.RemoveAll(); - clearFeatureHighLight(); - dataGridViewX3.Rows.Clear(); - m_FeaturesWithBianhao.Clear(); - Cursor = Cursors.WaitCursor; - if (checkBoxX1.Checked) // 选择管线 - { - for (int i = 0; i < dataGridViewX2.Rows.Count; i++) - { - GSOFeature selectedFeature = dataGridViewX2.Rows[i].Tag as GSOFeature; - if (selectedFeature != null) - { - selectState = 1; - VerticalDistanceAnalysis("垂直净距分析", selectedFeature, Utility.m_PipelineLayerNames, dJingJuBiaoZhun, 0.0); - } - } - } - else if (checkBoxX2.Checked) // 选择图层 - { - if (comboBoxEx1.SelectedItem == null) - { - MessageBox.Show("请选择一个图层!", "提示"); - return; - } - GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(comboBoxEx1.SelectedItem.ToString()); - if (layer == null) - return; - - GSOFeatureLayer flayer = layer as GSOFeatureLayer; - GSOFeatureDataset fdataset = flayer.Dataset as GSOFeatureDataset; - GSOFeatures feats = flayer.GetAllFeatures(); - for (int i = 0; i < feats.Length; i++) - { - selectState = 1; - VerticalDistanceAnalysis("垂直净距分析", feats[i], Utility.m_PipelineLayerNames, dJingJuBiaoZhun, 0.0); - } - } - if (featCount.Count > 0) - { - for (int i = 0; i < Utility.m_PipelineLayerNames.Count; i++) - { - if (featCount.ContainsKey(Utility.m_PipelineLayerNames[i]) && featLenth.ContainsKey(Utility.m_PipelineLayerNames[i])) - { - listBox1.Items.Add(Utility.m_PipelineLayerNames[i] + ":" + featCount[Utility.m_PipelineLayerNames[i]] + "条,共" + featLenth[Utility.m_PipelineLayerNames[i]].ToString("0.00") + "米"); - } - } - } - if (dataGridViewX3.Rows.Count == 0 && selectState == 1) - { - MessageBox.Show("没有不符合净距标准的管线!", "提示"); - } - } - else + if (dataGridViewX2.Rows.Count <= 0) { MessageBox.Show("请选中要进行垂直净距分析的管线!", "提示"); + return; + } + + featCount.Clear(); + featLenth.Clear(); + listBox1.Items.Clear(); + layerTemp.RemoveAllFeature(); + //polygonJingJuAnalysises.RemoveAll(); + clearFeatureHighLight(); + dataGridViewX3.Rows.Clear(); + m_FeaturesWithBianhao.Clear(); + Cursor = Cursors.WaitCursor; + if (checkBoxX1.Checked) // 选择管线 + { + for (int i = 0; i < dataGridViewX2.Rows.Count; i++) + { + GSOFeature selectedFeature = dataGridViewX2.Rows[i].Tag as GSOFeature; + if (selectedFeature == null) continue; + selectState = 1; + VerticalDistanceAnalysis("垂直净距分析", selectedFeature, Utility.m_PipelineLayerNames, + dJingJuBiaoZhun, 0.0); + } + } + else if (checkBoxX2.Checked) // 选择图层 + { + if (comboBoxEx1.SelectedItem == null) + { + MessageBox.Show("请选择一个图层!", "提示"); + return; + } + GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(comboBoxEx1.SelectedItem.ToString()); + if (layer == null) return; + GSOFeatureLayer flayer = layer as GSOFeatureLayer; + //GSOFeatureDataset fdataset = flayer.Dataset as GSOFeatureDataset; + GSOFeatures feats = flayer.GetAllFeatures(); + for (int i = 0; i < feats.Length; i++) + { + selectState = 1; + VerticalDistanceAnalysis("垂直净距分析", feats[i], Utility.m_PipelineLayerNames, dJingJuBiaoZhun, 0.0); + } + } + if (featCount.Count > 0) + { + for (int i = 0; i < Utility.m_PipelineLayerNames.Count; i++) + { + if (featCount.ContainsKey(Utility.m_PipelineLayerNames[i]) && + featLenth.ContainsKey(Utility.m_PipelineLayerNames[i])) + { + listBox1.Items.Add(Utility.m_PipelineLayerNames[i] + ":" + + featCount[Utility.m_PipelineLayerNames[i]] + "条,共" + + featLenth[Utility.m_PipelineLayerNames[i]].ToString("0.00") + "米"); + } + } + } + if (dataGridViewX3.Rows.Count == 0 && selectState == 1) + { + MessageBox.Show("没有不符合净距标准的管线!", "提示"); } globeControl1.Refresh(); Cursor = Cursors.Default; } + /// /// 在指定的两点组成的线的中间添加一个marker对象,并将marker对象添加到指定的图层中 /// @@ -3841,7 +3840,7 @@ idx = dataGridViewX3.Rows.Add(); dataGridViewX3.Rows[idx].Cells[0].Value = caption; dataGridViewX3.Rows[idx].Cells[1].Value = selectedFeature.Name; - dataGridViewX3.Rows[idx].Cells[2].Value = layer2.Caption; + dataGridViewX3.Rows[idx].Cells[2].Value = layer2.Caption;// feat2.Dataset.Caption;一致 dataGridViewX3.Rows[idx].Cells[3].Value = feat2.Name; dataGridViewX3.Rows[idx].Cells[4].Value = dDist.ToString("0.00"); } @@ -3917,6 +3916,7 @@ line1.ReleaseInnerPointer(); selectedFeature.ReleaseInnerPointer(); } + /// /// 垂直净距分析中 表格行的 双击定位 功能。 与覆土分析的实现方法不同,主要原因是需要标注垂距 /// @@ -3967,7 +3967,7 @@ featLenth.Clear(); listBox3.Items.Clear(); layerTemp.RemoveAllFeature(); - polygonJingJuAnalysises.RemoveAll(); + //polygonJingJuAnalysises.RemoveAll(); clearFeatureHighLight(); dataGridViewX9.Rows.Clear(); Cursor = Cursors.WaitCursor; @@ -4020,13 +4020,92 @@ globeControl1.Refresh(); Cursor = Cursors.Default; } - /// - /// 计算指定feature对象与除了该feature所在图层之外的 所有管线图层中的所有feature对象 的水平距离 并记录符合要求的管线 功能 - /// - /// - /// - /// - /// +// /// +// /// 计算指定feature对象与除了该feature所在图层之外的 所有管线图层中的所有feature对象 的水平距离 并记录符合要求的管线 功能 +// /// +// /// +// /// +// /// +// /// +// private void HorizontalDistanceAnalysis(GSOFeature selectedFeature, List _pipelineLayerNames, double dis) +// { +// if (selectedFeature == null) +// { +// selectState = 0; +// MessageBox.Show("请选择一条管线!"); +// return; +// } +// GSOGeoPolyline3D line1 = selectedFeature.Geometry as GSOGeoPolyline3D; +// if (line1 == null) +// { +// selectState = 0; +// MessageBox.Show("请选择一条管线!"); +// return; +// } +// +// string caption = selectedFeature.Dataset.Caption; +// +// GSOGeoPolygon3D polygon = line1.CreateBuffer(dis, true, 5, true, false); +// GSOFeature new_feat = new GSOFeature(); +// new_feat.Geometry = polygon; +// //polygonJingJuAnalysises.Add(new_feat); +// layerTemp.AddFeature(new_feat); +// +// for (int i = 0; i < _pipelineLayerNames.Count; i++) +// { +// if (caption == _pipelineLayerNames[i]) +// { +// continue; +// } +// GSOLayer layer2 = globeControl1.Globe.Layers.GetLayerByCaption(_pipelineLayerNames[i]); +// if (layer2 == null) continue; +// GSOFeatureLayer flayer2 = layer2 as GSOFeatureLayer; +// GSOFeatureDataset fdataset2 = flayer2.Dataset as GSOFeatureDataset; +// GSOFeatures feats2 = Polygon_Contain_PointAnalysis(polygon, _pipelineLayerNames[i]); +// for (int j = 0; j < feats2.Length; j++) +// { +// GSOFeature feat2 = feats2[j]; +// GSOGeoPolyline3D line2 = feats2[j].Geometry as GSOGeoPolyline3D; +// if (line2 == null) +// { +// continue; +// } +// GSOPipeLineStyle3D pipeStyle1 = line1.Style as GSOPipeLineStyle3D; +// GSOPipeLineStyle3D pipeStyle2 = line2.Style as GSOPipeLineStyle3D; +// if (pipeStyle1 == null || pipeStyle2 == null) +// { +// continue; +// } +// +// feat2.HighLight = true; +// int idx = dataGridViewX9.Rows.Add(); +// dataGridViewX9.Rows[idx].Tag = feat2; +// dataGridViewX9.Rows[idx].Cells[0].Value = caption; +// dataGridViewX9.Rows[idx].Cells[1].Value = selectedFeature.Name; +// dataGridViewX9.Rows[idx].Cells[2].Value = layer2.Caption; +// dataGridViewX9.Rows[idx].Cells[3].Value = feats2[j].Name; +// dataGridViewX9.Rows[idx].Cells[4].Value = dis.ToString("0.00"); +// +// if (featCount.ContainsKey(layer2.Caption)) +// { +// featCount[layer2.Caption] = featCount[layer2.Caption] + 1; +// } +// else +// { +// featCount.Add(layer2.Caption, 1); +// } +// if (featLenth.ContainsKey(layer2.Caption)) +// { +// featLenth[layer2.Caption] = featLenth[layer2.Caption] + line2.GetSpaceLength(true, 6378137); +// } +// else +// { +// featLenth.Add(layer2.Caption, line2.GetSpaceLength(true, 6378137)); +// } +// } +// } + // } + #region wxl 未改完 private void HorizontalDistanceAnalysis(GSOFeature selectedFeature, List _pipelineLayerNames, double dis) { if (selectedFeature == null) @@ -4042,69 +4121,40 @@ MessageBox.Show("请选择一条管线!"); return; } - - string caption = selectedFeature.Dataset.Caption; - - GSOGeoPolygon3D polygon = line1.CreateBuffer(dis, true, 5, true, false); - GSOFeature new_feat = new GSOFeature(); - new_feat.Geometry = polygon; - polygonJingJuAnalysises.Add(new_feat); - layerTemp.AddFeature(new_feat); - - for (int i = 0; i < _pipelineLayerNames.Count; i++) + Dictionary featureMap = DoublePanelAnalysis.HorizontalDistanceAnalysis(globeControl1,selectedFeature, + _pipelineLayerNames, dis); + foreach (KeyValuePair kvp in featureMap) { - if (caption == _pipelineLayerNames[i]) + GSOFeature feat2 = kvp.Key; + feat2.HighLight = true; + int idx = dataGridViewX9.Rows.Add(); + dataGridViewX9.Rows[idx].Tag = feat2; + dataGridViewX9.Rows[idx].Cells[0].Value = selectedFeature.Dataset.Caption; + dataGridViewX9.Rows[idx].Cells[1].Value = selectedFeature.Name; + dataGridViewX9.Rows[idx].Cells[2].Value = feat2.Dataset.Caption; + dataGridViewX9.Rows[idx].Cells[3].Value = feat2.Name; + dataGridViewX9.Rows[idx].Cells[4].Value = dis.ToString("0.00"); + GSOGeoPolyline3D line2 = feat2.Geometry as GSOGeoPolyline3D; + if (featCount.ContainsKey(feat2.Dataset.Caption)) { - continue; + featCount[feat2.Dataset.Caption] = featCount[feat2.Dataset.Caption] + 1; } - GSOLayer layer2 = globeControl1.Globe.Layers.GetLayerByCaption(_pipelineLayerNames[i]); - if (layer2 == null) continue; - GSOFeatureLayer flayer2 = layer2 as GSOFeatureLayer; - GSOFeatureDataset fdataset2 = flayer2.Dataset as GSOFeatureDataset; - GSOFeatures feats2 = Polygon_Contain_PointAnalysis(polygon, _pipelineLayerNames[i]); - for (int j = 0; j < feats2.Length; j++) + else { - GSOFeature feat2 = feats2[j]; - GSOGeoPolyline3D line2 = feats2[j].Geometry as GSOGeoPolyline3D; - if (line2 == null) - { - continue; - } - GSOPipeLineStyle3D pipeStyle1 = line1.Style as GSOPipeLineStyle3D; - GSOPipeLineStyle3D pipeStyle2 = line2.Style as GSOPipeLineStyle3D; - if (pipeStyle1 == null || pipeStyle2 == null) - { - continue; - } - - feat2.HighLight = true; - int idx = dataGridViewX9.Rows.Add(); - dataGridViewX9.Rows[idx].Tag = feat2; - dataGridViewX9.Rows[idx].Cells[0].Value = caption; - dataGridViewX9.Rows[idx].Cells[1].Value = selectedFeature.Name; - dataGridViewX9.Rows[idx].Cells[2].Value = layer2.Caption; - dataGridViewX9.Rows[idx].Cells[3].Value = feats2[j].Name; - dataGridViewX9.Rows[idx].Cells[4].Value = dis.ToString("0.00"); - - if (featCount.ContainsKey(layer2.Caption)) - { - featCount[layer2.Caption] = featCount[layer2.Caption] + 1; - } - else - { - featCount.Add(layer2.Caption, 1); - } - if (featLenth.ContainsKey(layer2.Caption)) - { - featLenth[layer2.Caption] = featLenth[layer2.Caption] + line2.GetSpaceLength(true, 6378137); - } - else - { - featLenth.Add(layer2.Caption, line2.GetSpaceLength(true, 6378137)); - } + featCount.Add(feat2.Dataset.Caption, 1); + } + if (featLenth.ContainsKey(feat2.Dataset.Caption)) + { + featLenth[feat2.Dataset.Caption] = featLenth[feat2.Dataset.Caption] + line2.GetSpaceLength(true, 6378137); + } + else + { + featLenth.Add(feat2.Dataset.Caption, line2.GetSpaceLength(true, 6378137)); } } } + #endregion + /// /// 水平净距分析 功能界面中 表格的 双击定位 功能 /// @@ -4149,7 +4199,7 @@ featCount.Clear(); listBox2.Items.Clear(); layerTemp.RemoveAllFeature(); - polygonJingJuAnalysises.RemoveAll(); + //polygonJingJuAnalysises.RemoveAll(); dataGridViewX5.Rows.Clear(); clearFeatureHighLight(); m_FeaturesWithBianhao.Clear(); @@ -4160,21 +4210,18 @@ for (int i = 0; i < dataGridViewX4.Rows.Count; i++) { GSOFeature selectedFeature = dataGridViewX4.Rows[i].Tag as GSOFeature; - if (selectedFeature != null) - { - selectState = 1; - VerticalDistanceAnalysis("碰撞分析", selectedFeature, Utility.m_PipelineLayerNames, 0, 0.0); - } + if (selectedFeature == null) continue; + selectState = 1; + VerticalDistanceAnalysis("碰撞分析", selectedFeature, Utility.m_PipelineLayerNames, 0, 0.0); } } else if (checkBoxX4.Checked) // 选择图层 { GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(comboBoxEx2.SelectedItem.ToString()); - if (layer == null) - return; + if (layer == null) return; GSOFeatureLayer flayer = layer as GSOFeatureLayer; - GSOFeatureDataset fdataset = flayer.Dataset as GSOFeatureDataset; + //GSOFeatureDataset fdataset = flayer.Dataset as GSOFeatureDataset; GSOFeatures feats = flayer.GetAllFeatures(); for (int i = 0; i < feats.Length; i++) { @@ -4334,15 +4381,7 @@ { GSOFeature rowFeature = dataGridViewX6.Rows[i].Tag as GSOFeature; if (rowFeature == null) continue; - string featureName = ""; - if (isFeatureContainsBianhao(rowFeature))//判断rowFeature是否包含“编号”字段 - { - featureName = rowFeature.GetValue(featureIDFieldName).ToString(); - } - else - { - featureName = rowFeature.Name; - } + string featureName = isFeatureContainsBianhao(rowFeature) ? rowFeature.GetValue(featureIDFieldName).ToString() : rowFeature.Name; GSOGeoPolyline3D line = rowFeature.Geometry as GSOGeoPolyline3D; if (line == null) @@ -4970,7 +5009,7 @@ featLenth.Clear(); listBoxStasticsResult.Items.Clear(); layerTemp.RemoveAllFeature(); - polygonJingJuAnalysises.RemoveAll(); + //polygonJingJuAnalysises.RemoveAll(); clearFeatureHighLight(); dataGridViewAnalysisResult.Rows.Clear(); m_FeaturesWithBianhao.Clear(); diff --git a/bin/x86/Debug/Config.xml b/bin/x86/Debug/Config.xml index 508515a..5cde6e4 100644 --- a/bin/x86/Debug/Config.xml +++ b/bin/x86/Debug/Config.xml @@ -6,7 +6,7 @@ 192.168.0.203 release 192.168.0.203 - 1500 + 2500 http://192.168.0.203/images/ http://192.168.0.203/images/default.jpg D:/backup diff --git a/Cyberpipe.suo b/Cyberpipe.suo index 5917bad..e8c0bf3 100644 --- a/Cyberpipe.suo +++ b/Cyberpipe.suo Binary files differ diff --git a/DoublePanelAnalysis.cs b/DoublePanelAnalysis.cs index d69018e..b2e089a 100644 --- a/DoublePanelAnalysis.cs +++ b/DoublePanelAnalysis.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.Data; using System.Drawing; using GeoScene.Data; @@ -11,8 +12,8 @@ { public static GSOGlobeControl globeControl1 = null; public static GSOGlobeControl globeControl2 = null; - public static GSOLayer layerTemp = null; - public static GSOLayer layerTemp2 = null; +// public static GSOLayer layerTemp = null; +// public static GSOLayer layerTemp2 = null; public static int bufferWidth = 8; public static string strLabel; /// @@ -932,7 +933,94 @@ } } - + #region wxl 重构 碰撞审查,覆土审查,水平净距审查,垂直净距审查 + + /// + /// 获取跟选择管线垂直距离小于特定值的管线列表和选择管线的距离 + /// + /// 选择管线 + /// 各图层名称 + /// 垂直距离 + /// 水平距离 + /// 管线列表,可为空 + public static Dictionary VerticalDistanceAnalysis(GSOGlobeControl globeControl1,GSOFeature selectedFeature, List _pipelineLayerNames, double verticalDistance) + { + if (selectedFeature == null) return null; + GSOGeoPolyline3D line1 = selectedFeature.Geometry as GSOGeoPolyline3D; + if (line1 == null) return null; + GSOPipeLineStyle3D pipeStyle1 = line1.Style as GSOPipeLineStyle3D; + if (pipeStyle1 == null) return null; + GSOGeoPolygon3D polygon = line1.CreateBuffer(0.1, true, 5, true, false); + Dictionary result = new Dictionary(); + + string caption = selectedFeature.Dataset.Caption; + + GSOPoint3d pntIntersect1 = new GSOPoint3d(); + GSOPoint3d pntIntersect2 = new GSOPoint3d(); + GSOPoint3d pntProIntersect1 = new GSOPoint3d(); + GSOPoint3d pntProIntersect2 = new GSOPoint3d(); + for (int i = 0; i < _pipelineLayerNames.Count; i++) + { + if (caption == _pipelineLayerNames[i]) continue;//排除本图层 + GSOLayer layer2 = globeControl1.Globe.Layers.GetLayerByCaption(_pipelineLayerNames[i]); + if (layer2 == null) continue; + GSOFeatures feats2 = FeatureStatisticsService.getLayerFeatures(polygon, layer2); + if (feats2 == null) continue; + for (int j = 0; j < feats2.Length; j++) + { + GSOFeature feat2 = feats2[j]; + GSOGeoPolyline3D line2 = feat2.Geometry as GSOGeoPolyline3D; + if (line2 == null) continue; + GSOPipeLineStyle3D pipeStyle2 = line2.Style as GSOPipeLineStyle3D; + if (pipeStyle2 == null) continue; + + double dDist = globeControl1.Globe.Analysis3D.ComputeHorizonDistance(line1, line2, out pntIntersect1, + out pntIntersect2, out pntProIntersect1, out pntProIntersect2, false); + if (dDist <= -1) continue; //为什么是-1 wxl注释 + + dDist = Math.Abs(pntIntersect1.Z - pntIntersect2.Z) - pipeStyle1.Radius - pipeStyle2.Radius; //获得净距值 z值是管线中心点吗?wxl + if (dDist >= verticalDistance) continue;//不符合条件 + result.Add(feat2,dDist); + } + } + polygon.ReleaseInnerPointer();//方法的作用是强制释放内存空间吗?? + return result; + } + public static Dictionary HorizontalDistanceAnalysis(GSOGlobeControl globeControl1,GSOFeature selectedFeature, List _pipelineLayerNames, double dis) + { + if (selectedFeature == null) return null; + GSOGeoPolyline3D line1 = selectedFeature.Geometry as GSOGeoPolyline3D; + if (line1 == null) return null; + GSOPipeLineStyle3D pipeStyle1 = line1.Style as GSOPipeLineStyle3D; + if (pipeStyle1 == null) return null; + Dictionary result = new Dictionary(); + string caption = selectedFeature.Dataset.Caption; + GSOGeoPolygon3D polygon = line1.CreateBuffer(dis, true, 5, true, false); + GSOFeature new_feat = new GSOFeature(); + new_feat.Geometry = polygon; + + for (int i = 0; i < _pipelineLayerNames.Count; i++) + { + if (caption == _pipelineLayerNames[i]) continue; + GSOLayer layer2 = globeControl1.Globe.Layers.GetLayerByCaption(_pipelineLayerNames[i]); + if (layer2 == null) continue; + GSOFeatures feats2 = FeatureStatisticsService.getLayerFeatures(polygon, layer2); + for (int j = 0; j < feats2.Length; j++) + { + GSOFeature feat2 = feats2[j]; + GSOGeoPolyline3D line2 = feat2.Geometry as GSOGeoPolyline3D; + if (line2 == null) continue; + GSOPoint3d pntIntersect1, pntIntersect2, pntProIntersect1, pntProIntersect2; + double dDist = globeControl1.Globe.Analysis3D.ComputeHorizonDistance(line1, line2, out pntIntersect1, + out pntIntersect2, out pntProIntersect1, out pntProIntersect2, false); + GSOPipeLineStyle3D pipeStyle2 = line2.Style as GSOPipeLineStyle3D; + if (pipeStyle2 == null) continue; + result.Add(feat2,dDist); + } + } + return result; + } + #endregion } } diff --git a/MainFrm.cs b/MainFrm.cs index 626ca8f..d1e6bb2 100644 --- a/MainFrm.cs +++ b/MainFrm.cs @@ -70,7 +70,7 @@ Double m_dDigPitWidthAlongLine = 6; Boolean m_bDigPitByDepth = true; //选择管线 - int selectState; + int selectState;//wxl 注释,表示是否已经计算过净距等了,1已计算,0未计算 //private OracleConnection connBackup = null; //数据集合 @@ -3469,7 +3469,7 @@ globeControl1.Globe.MemoryLayer.SaveAs(Application.StartupPath + "/MyPlace.kml"); } - #region 完善 + #region 完善(各种净距分析) /// /// 垂直净距分析 功能界面中的 选择图层复选框 选中状态改变事件处理 /// @@ -3619,7 +3619,7 @@ Dictionary featCount = new Dictionary(); Dictionary featLenth = new Dictionary(); Dictionary m_FeaturesWithBianhao = new Dictionary();//记录编号和对应的标注点的位置 - GSOFeatures polygonJingJuAnalysises = new GSOFeatures(); + //GSOFeatures polygonJingJuAnalysises = new GSOFeatures(); /// /// 垂直净距分析 功能界面中的 开始分析按钮 事件处理 /// @@ -3643,72 +3643,71 @@ MessageBox.Show("请输入正确的净距标准!", "提示"); return; } - - if (dataGridViewX2.Rows.Count > 0) - { - featCount.Clear(); - featLenth.Clear(); - listBox1.Items.Clear(); - layerTemp.RemoveAllFeature(); - polygonJingJuAnalysises.RemoveAll(); - clearFeatureHighLight(); - dataGridViewX3.Rows.Clear(); - m_FeaturesWithBianhao.Clear(); - Cursor = Cursors.WaitCursor; - if (checkBoxX1.Checked) // 选择管线 - { - for (int i = 0; i < dataGridViewX2.Rows.Count; i++) - { - GSOFeature selectedFeature = dataGridViewX2.Rows[i].Tag as GSOFeature; - if (selectedFeature != null) - { - selectState = 1; - VerticalDistanceAnalysis("垂直净距分析", selectedFeature, Utility.m_PipelineLayerNames, dJingJuBiaoZhun, 0.0); - } - } - } - else if (checkBoxX2.Checked) // 选择图层 - { - if (comboBoxEx1.SelectedItem == null) - { - MessageBox.Show("请选择一个图层!", "提示"); - return; - } - GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(comboBoxEx1.SelectedItem.ToString()); - if (layer == null) - return; - - GSOFeatureLayer flayer = layer as GSOFeatureLayer; - GSOFeatureDataset fdataset = flayer.Dataset as GSOFeatureDataset; - GSOFeatures feats = flayer.GetAllFeatures(); - for (int i = 0; i < feats.Length; i++) - { - selectState = 1; - VerticalDistanceAnalysis("垂直净距分析", feats[i], Utility.m_PipelineLayerNames, dJingJuBiaoZhun, 0.0); - } - } - if (featCount.Count > 0) - { - for (int i = 0; i < Utility.m_PipelineLayerNames.Count; i++) - { - if (featCount.ContainsKey(Utility.m_PipelineLayerNames[i]) && featLenth.ContainsKey(Utility.m_PipelineLayerNames[i])) - { - listBox1.Items.Add(Utility.m_PipelineLayerNames[i] + ":" + featCount[Utility.m_PipelineLayerNames[i]] + "条,共" + featLenth[Utility.m_PipelineLayerNames[i]].ToString("0.00") + "米"); - } - } - } - if (dataGridViewX3.Rows.Count == 0 && selectState == 1) - { - MessageBox.Show("没有不符合净距标准的管线!", "提示"); - } - } - else + if (dataGridViewX2.Rows.Count <= 0) { MessageBox.Show("请选中要进行垂直净距分析的管线!", "提示"); + return; + } + + featCount.Clear(); + featLenth.Clear(); + listBox1.Items.Clear(); + layerTemp.RemoveAllFeature(); + //polygonJingJuAnalysises.RemoveAll(); + clearFeatureHighLight(); + dataGridViewX3.Rows.Clear(); + m_FeaturesWithBianhao.Clear(); + Cursor = Cursors.WaitCursor; + if (checkBoxX1.Checked) // 选择管线 + { + for (int i = 0; i < dataGridViewX2.Rows.Count; i++) + { + GSOFeature selectedFeature = dataGridViewX2.Rows[i].Tag as GSOFeature; + if (selectedFeature == null) continue; + selectState = 1; + VerticalDistanceAnalysis("垂直净距分析", selectedFeature, Utility.m_PipelineLayerNames, + dJingJuBiaoZhun, 0.0); + } + } + else if (checkBoxX2.Checked) // 选择图层 + { + if (comboBoxEx1.SelectedItem == null) + { + MessageBox.Show("请选择一个图层!", "提示"); + return; + } + GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(comboBoxEx1.SelectedItem.ToString()); + if (layer == null) return; + GSOFeatureLayer flayer = layer as GSOFeatureLayer; + //GSOFeatureDataset fdataset = flayer.Dataset as GSOFeatureDataset; + GSOFeatures feats = flayer.GetAllFeatures(); + for (int i = 0; i < feats.Length; i++) + { + selectState = 1; + VerticalDistanceAnalysis("垂直净距分析", feats[i], Utility.m_PipelineLayerNames, dJingJuBiaoZhun, 0.0); + } + } + if (featCount.Count > 0) + { + for (int i = 0; i < Utility.m_PipelineLayerNames.Count; i++) + { + if (featCount.ContainsKey(Utility.m_PipelineLayerNames[i]) && + featLenth.ContainsKey(Utility.m_PipelineLayerNames[i])) + { + listBox1.Items.Add(Utility.m_PipelineLayerNames[i] + ":" + + featCount[Utility.m_PipelineLayerNames[i]] + "条,共" + + featLenth[Utility.m_PipelineLayerNames[i]].ToString("0.00") + "米"); + } + } + } + if (dataGridViewX3.Rows.Count == 0 && selectState == 1) + { + MessageBox.Show("没有不符合净距标准的管线!", "提示"); } globeControl1.Refresh(); Cursor = Cursors.Default; } + /// /// 在指定的两点组成的线的中间添加一个marker对象,并将marker对象添加到指定的图层中 /// @@ -3841,7 +3840,7 @@ idx = dataGridViewX3.Rows.Add(); dataGridViewX3.Rows[idx].Cells[0].Value = caption; dataGridViewX3.Rows[idx].Cells[1].Value = selectedFeature.Name; - dataGridViewX3.Rows[idx].Cells[2].Value = layer2.Caption; + dataGridViewX3.Rows[idx].Cells[2].Value = layer2.Caption;// feat2.Dataset.Caption;一致 dataGridViewX3.Rows[idx].Cells[3].Value = feat2.Name; dataGridViewX3.Rows[idx].Cells[4].Value = dDist.ToString("0.00"); } @@ -3917,6 +3916,7 @@ line1.ReleaseInnerPointer(); selectedFeature.ReleaseInnerPointer(); } + /// /// 垂直净距分析中 表格行的 双击定位 功能。 与覆土分析的实现方法不同,主要原因是需要标注垂距 /// @@ -3967,7 +3967,7 @@ featLenth.Clear(); listBox3.Items.Clear(); layerTemp.RemoveAllFeature(); - polygonJingJuAnalysises.RemoveAll(); + //polygonJingJuAnalysises.RemoveAll(); clearFeatureHighLight(); dataGridViewX9.Rows.Clear(); Cursor = Cursors.WaitCursor; @@ -4020,13 +4020,92 @@ globeControl1.Refresh(); Cursor = Cursors.Default; } - /// - /// 计算指定feature对象与除了该feature所在图层之外的 所有管线图层中的所有feature对象 的水平距离 并记录符合要求的管线 功能 - /// - /// - /// - /// - /// +// /// +// /// 计算指定feature对象与除了该feature所在图层之外的 所有管线图层中的所有feature对象 的水平距离 并记录符合要求的管线 功能 +// /// +// /// +// /// +// /// +// /// +// private void HorizontalDistanceAnalysis(GSOFeature selectedFeature, List _pipelineLayerNames, double dis) +// { +// if (selectedFeature == null) +// { +// selectState = 0; +// MessageBox.Show("请选择一条管线!"); +// return; +// } +// GSOGeoPolyline3D line1 = selectedFeature.Geometry as GSOGeoPolyline3D; +// if (line1 == null) +// { +// selectState = 0; +// MessageBox.Show("请选择一条管线!"); +// return; +// } +// +// string caption = selectedFeature.Dataset.Caption; +// +// GSOGeoPolygon3D polygon = line1.CreateBuffer(dis, true, 5, true, false); +// GSOFeature new_feat = new GSOFeature(); +// new_feat.Geometry = polygon; +// //polygonJingJuAnalysises.Add(new_feat); +// layerTemp.AddFeature(new_feat); +// +// for (int i = 0; i < _pipelineLayerNames.Count; i++) +// { +// if (caption == _pipelineLayerNames[i]) +// { +// continue; +// } +// GSOLayer layer2 = globeControl1.Globe.Layers.GetLayerByCaption(_pipelineLayerNames[i]); +// if (layer2 == null) continue; +// GSOFeatureLayer flayer2 = layer2 as GSOFeatureLayer; +// GSOFeatureDataset fdataset2 = flayer2.Dataset as GSOFeatureDataset; +// GSOFeatures feats2 = Polygon_Contain_PointAnalysis(polygon, _pipelineLayerNames[i]); +// for (int j = 0; j < feats2.Length; j++) +// { +// GSOFeature feat2 = feats2[j]; +// GSOGeoPolyline3D line2 = feats2[j].Geometry as GSOGeoPolyline3D; +// if (line2 == null) +// { +// continue; +// } +// GSOPipeLineStyle3D pipeStyle1 = line1.Style as GSOPipeLineStyle3D; +// GSOPipeLineStyle3D pipeStyle2 = line2.Style as GSOPipeLineStyle3D; +// if (pipeStyle1 == null || pipeStyle2 == null) +// { +// continue; +// } +// +// feat2.HighLight = true; +// int idx = dataGridViewX9.Rows.Add(); +// dataGridViewX9.Rows[idx].Tag = feat2; +// dataGridViewX9.Rows[idx].Cells[0].Value = caption; +// dataGridViewX9.Rows[idx].Cells[1].Value = selectedFeature.Name; +// dataGridViewX9.Rows[idx].Cells[2].Value = layer2.Caption; +// dataGridViewX9.Rows[idx].Cells[3].Value = feats2[j].Name; +// dataGridViewX9.Rows[idx].Cells[4].Value = dis.ToString("0.00"); +// +// if (featCount.ContainsKey(layer2.Caption)) +// { +// featCount[layer2.Caption] = featCount[layer2.Caption] + 1; +// } +// else +// { +// featCount.Add(layer2.Caption, 1); +// } +// if (featLenth.ContainsKey(layer2.Caption)) +// { +// featLenth[layer2.Caption] = featLenth[layer2.Caption] + line2.GetSpaceLength(true, 6378137); +// } +// else +// { +// featLenth.Add(layer2.Caption, line2.GetSpaceLength(true, 6378137)); +// } +// } +// } + // } + #region wxl 未改完 private void HorizontalDistanceAnalysis(GSOFeature selectedFeature, List _pipelineLayerNames, double dis) { if (selectedFeature == null) @@ -4042,69 +4121,40 @@ MessageBox.Show("请选择一条管线!"); return; } - - string caption = selectedFeature.Dataset.Caption; - - GSOGeoPolygon3D polygon = line1.CreateBuffer(dis, true, 5, true, false); - GSOFeature new_feat = new GSOFeature(); - new_feat.Geometry = polygon; - polygonJingJuAnalysises.Add(new_feat); - layerTemp.AddFeature(new_feat); - - for (int i = 0; i < _pipelineLayerNames.Count; i++) + Dictionary featureMap = DoublePanelAnalysis.HorizontalDistanceAnalysis(globeControl1,selectedFeature, + _pipelineLayerNames, dis); + foreach (KeyValuePair kvp in featureMap) { - if (caption == _pipelineLayerNames[i]) + GSOFeature feat2 = kvp.Key; + feat2.HighLight = true; + int idx = dataGridViewX9.Rows.Add(); + dataGridViewX9.Rows[idx].Tag = feat2; + dataGridViewX9.Rows[idx].Cells[0].Value = selectedFeature.Dataset.Caption; + dataGridViewX9.Rows[idx].Cells[1].Value = selectedFeature.Name; + dataGridViewX9.Rows[idx].Cells[2].Value = feat2.Dataset.Caption; + dataGridViewX9.Rows[idx].Cells[3].Value = feat2.Name; + dataGridViewX9.Rows[idx].Cells[4].Value = dis.ToString("0.00"); + GSOGeoPolyline3D line2 = feat2.Geometry as GSOGeoPolyline3D; + if (featCount.ContainsKey(feat2.Dataset.Caption)) { - continue; + featCount[feat2.Dataset.Caption] = featCount[feat2.Dataset.Caption] + 1; } - GSOLayer layer2 = globeControl1.Globe.Layers.GetLayerByCaption(_pipelineLayerNames[i]); - if (layer2 == null) continue; - GSOFeatureLayer flayer2 = layer2 as GSOFeatureLayer; - GSOFeatureDataset fdataset2 = flayer2.Dataset as GSOFeatureDataset; - GSOFeatures feats2 = Polygon_Contain_PointAnalysis(polygon, _pipelineLayerNames[i]); - for (int j = 0; j < feats2.Length; j++) + else { - GSOFeature feat2 = feats2[j]; - GSOGeoPolyline3D line2 = feats2[j].Geometry as GSOGeoPolyline3D; - if (line2 == null) - { - continue; - } - GSOPipeLineStyle3D pipeStyle1 = line1.Style as GSOPipeLineStyle3D; - GSOPipeLineStyle3D pipeStyle2 = line2.Style as GSOPipeLineStyle3D; - if (pipeStyle1 == null || pipeStyle2 == null) - { - continue; - } - - feat2.HighLight = true; - int idx = dataGridViewX9.Rows.Add(); - dataGridViewX9.Rows[idx].Tag = feat2; - dataGridViewX9.Rows[idx].Cells[0].Value = caption; - dataGridViewX9.Rows[idx].Cells[1].Value = selectedFeature.Name; - dataGridViewX9.Rows[idx].Cells[2].Value = layer2.Caption; - dataGridViewX9.Rows[idx].Cells[3].Value = feats2[j].Name; - dataGridViewX9.Rows[idx].Cells[4].Value = dis.ToString("0.00"); - - if (featCount.ContainsKey(layer2.Caption)) - { - featCount[layer2.Caption] = featCount[layer2.Caption] + 1; - } - else - { - featCount.Add(layer2.Caption, 1); - } - if (featLenth.ContainsKey(layer2.Caption)) - { - featLenth[layer2.Caption] = featLenth[layer2.Caption] + line2.GetSpaceLength(true, 6378137); - } - else - { - featLenth.Add(layer2.Caption, line2.GetSpaceLength(true, 6378137)); - } + featCount.Add(feat2.Dataset.Caption, 1); + } + if (featLenth.ContainsKey(feat2.Dataset.Caption)) + { + featLenth[feat2.Dataset.Caption] = featLenth[feat2.Dataset.Caption] + line2.GetSpaceLength(true, 6378137); + } + else + { + featLenth.Add(feat2.Dataset.Caption, line2.GetSpaceLength(true, 6378137)); } } } + #endregion + /// /// 水平净距分析 功能界面中 表格的 双击定位 功能 /// @@ -4149,7 +4199,7 @@ featCount.Clear(); listBox2.Items.Clear(); layerTemp.RemoveAllFeature(); - polygonJingJuAnalysises.RemoveAll(); + //polygonJingJuAnalysises.RemoveAll(); dataGridViewX5.Rows.Clear(); clearFeatureHighLight(); m_FeaturesWithBianhao.Clear(); @@ -4160,21 +4210,18 @@ for (int i = 0; i < dataGridViewX4.Rows.Count; i++) { GSOFeature selectedFeature = dataGridViewX4.Rows[i].Tag as GSOFeature; - if (selectedFeature != null) - { - selectState = 1; - VerticalDistanceAnalysis("碰撞分析", selectedFeature, Utility.m_PipelineLayerNames, 0, 0.0); - } + if (selectedFeature == null) continue; + selectState = 1; + VerticalDistanceAnalysis("碰撞分析", selectedFeature, Utility.m_PipelineLayerNames, 0, 0.0); } } else if (checkBoxX4.Checked) // 选择图层 { GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(comboBoxEx2.SelectedItem.ToString()); - if (layer == null) - return; + if (layer == null) return; GSOFeatureLayer flayer = layer as GSOFeatureLayer; - GSOFeatureDataset fdataset = flayer.Dataset as GSOFeatureDataset; + //GSOFeatureDataset fdataset = flayer.Dataset as GSOFeatureDataset; GSOFeatures feats = flayer.GetAllFeatures(); for (int i = 0; i < feats.Length; i++) { @@ -4334,15 +4381,7 @@ { GSOFeature rowFeature = dataGridViewX6.Rows[i].Tag as GSOFeature; if (rowFeature == null) continue; - string featureName = ""; - if (isFeatureContainsBianhao(rowFeature))//判断rowFeature是否包含“编号”字段 - { - featureName = rowFeature.GetValue(featureIDFieldName).ToString(); - } - else - { - featureName = rowFeature.Name; - } + string featureName = isFeatureContainsBianhao(rowFeature) ? rowFeature.GetValue(featureIDFieldName).ToString() : rowFeature.Name; GSOGeoPolyline3D line = rowFeature.Geometry as GSOGeoPolyline3D; if (line == null) @@ -4970,7 +5009,7 @@ featLenth.Clear(); listBoxStasticsResult.Items.Clear(); layerTemp.RemoveAllFeature(); - polygonJingJuAnalysises.RemoveAll(); + //polygonJingJuAnalysises.RemoveAll(); clearFeatureHighLight(); dataGridViewAnalysisResult.Rows.Clear(); m_FeaturesWithBianhao.Clear(); diff --git a/bin/x86/Debug/Config.xml b/bin/x86/Debug/Config.xml index 508515a..5cde6e4 100644 --- a/bin/x86/Debug/Config.xml +++ b/bin/x86/Debug/Config.xml @@ -6,7 +6,7 @@ 192.168.0.203 release 192.168.0.203 - 1500 + 2500 http://192.168.0.203/images/ http://192.168.0.203/images/default.jpg D:/backup diff --git a/bin/x86/Debug/Cyberpipe.exe b/bin/x86/Debug/Cyberpipe.exe index 1249b50..3595fe6 100644 --- a/bin/x86/Debug/Cyberpipe.exe +++ b/bin/x86/Debug/Cyberpipe.exe Binary files differ diff --git a/Cyberpipe.suo b/Cyberpipe.suo index 5917bad..e8c0bf3 100644 --- a/Cyberpipe.suo +++ b/Cyberpipe.suo Binary files differ diff --git a/DoublePanelAnalysis.cs b/DoublePanelAnalysis.cs index d69018e..b2e089a 100644 --- a/DoublePanelAnalysis.cs +++ b/DoublePanelAnalysis.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.Data; using System.Drawing; using GeoScene.Data; @@ -11,8 +12,8 @@ { public static GSOGlobeControl globeControl1 = null; public static GSOGlobeControl globeControl2 = null; - public static GSOLayer layerTemp = null; - public static GSOLayer layerTemp2 = null; +// public static GSOLayer layerTemp = null; +// public static GSOLayer layerTemp2 = null; public static int bufferWidth = 8; public static string strLabel; /// @@ -932,7 +933,94 @@ } } - + #region wxl 重构 碰撞审查,覆土审查,水平净距审查,垂直净距审查 + + /// + /// 获取跟选择管线垂直距离小于特定值的管线列表和选择管线的距离 + /// + /// 选择管线 + /// 各图层名称 + /// 垂直距离 + /// 水平距离 + /// 管线列表,可为空 + public static Dictionary VerticalDistanceAnalysis(GSOGlobeControl globeControl1,GSOFeature selectedFeature, List _pipelineLayerNames, double verticalDistance) + { + if (selectedFeature == null) return null; + GSOGeoPolyline3D line1 = selectedFeature.Geometry as GSOGeoPolyline3D; + if (line1 == null) return null; + GSOPipeLineStyle3D pipeStyle1 = line1.Style as GSOPipeLineStyle3D; + if (pipeStyle1 == null) return null; + GSOGeoPolygon3D polygon = line1.CreateBuffer(0.1, true, 5, true, false); + Dictionary result = new Dictionary(); + + string caption = selectedFeature.Dataset.Caption; + + GSOPoint3d pntIntersect1 = new GSOPoint3d(); + GSOPoint3d pntIntersect2 = new GSOPoint3d(); + GSOPoint3d pntProIntersect1 = new GSOPoint3d(); + GSOPoint3d pntProIntersect2 = new GSOPoint3d(); + for (int i = 0; i < _pipelineLayerNames.Count; i++) + { + if (caption == _pipelineLayerNames[i]) continue;//排除本图层 + GSOLayer layer2 = globeControl1.Globe.Layers.GetLayerByCaption(_pipelineLayerNames[i]); + if (layer2 == null) continue; + GSOFeatures feats2 = FeatureStatisticsService.getLayerFeatures(polygon, layer2); + if (feats2 == null) continue; + for (int j = 0; j < feats2.Length; j++) + { + GSOFeature feat2 = feats2[j]; + GSOGeoPolyline3D line2 = feat2.Geometry as GSOGeoPolyline3D; + if (line2 == null) continue; + GSOPipeLineStyle3D pipeStyle2 = line2.Style as GSOPipeLineStyle3D; + if (pipeStyle2 == null) continue; + + double dDist = globeControl1.Globe.Analysis3D.ComputeHorizonDistance(line1, line2, out pntIntersect1, + out pntIntersect2, out pntProIntersect1, out pntProIntersect2, false); + if (dDist <= -1) continue; //为什么是-1 wxl注释 + + dDist = Math.Abs(pntIntersect1.Z - pntIntersect2.Z) - pipeStyle1.Radius - pipeStyle2.Radius; //获得净距值 z值是管线中心点吗?wxl + if (dDist >= verticalDistance) continue;//不符合条件 + result.Add(feat2,dDist); + } + } + polygon.ReleaseInnerPointer();//方法的作用是强制释放内存空间吗?? + return result; + } + public static Dictionary HorizontalDistanceAnalysis(GSOGlobeControl globeControl1,GSOFeature selectedFeature, List _pipelineLayerNames, double dis) + { + if (selectedFeature == null) return null; + GSOGeoPolyline3D line1 = selectedFeature.Geometry as GSOGeoPolyline3D; + if (line1 == null) return null; + GSOPipeLineStyle3D pipeStyle1 = line1.Style as GSOPipeLineStyle3D; + if (pipeStyle1 == null) return null; + Dictionary result = new Dictionary(); + string caption = selectedFeature.Dataset.Caption; + GSOGeoPolygon3D polygon = line1.CreateBuffer(dis, true, 5, true, false); + GSOFeature new_feat = new GSOFeature(); + new_feat.Geometry = polygon; + + for (int i = 0; i < _pipelineLayerNames.Count; i++) + { + if (caption == _pipelineLayerNames[i]) continue; + GSOLayer layer2 = globeControl1.Globe.Layers.GetLayerByCaption(_pipelineLayerNames[i]); + if (layer2 == null) continue; + GSOFeatures feats2 = FeatureStatisticsService.getLayerFeatures(polygon, layer2); + for (int j = 0; j < feats2.Length; j++) + { + GSOFeature feat2 = feats2[j]; + GSOGeoPolyline3D line2 = feat2.Geometry as GSOGeoPolyline3D; + if (line2 == null) continue; + GSOPoint3d pntIntersect1, pntIntersect2, pntProIntersect1, pntProIntersect2; + double dDist = globeControl1.Globe.Analysis3D.ComputeHorizonDistance(line1, line2, out pntIntersect1, + out pntIntersect2, out pntProIntersect1, out pntProIntersect2, false); + GSOPipeLineStyle3D pipeStyle2 = line2.Style as GSOPipeLineStyle3D; + if (pipeStyle2 == null) continue; + result.Add(feat2,dDist); + } + } + return result; + } + #endregion } } diff --git a/MainFrm.cs b/MainFrm.cs index 626ca8f..d1e6bb2 100644 --- a/MainFrm.cs +++ b/MainFrm.cs @@ -70,7 +70,7 @@ Double m_dDigPitWidthAlongLine = 6; Boolean m_bDigPitByDepth = true; //选择管线 - int selectState; + int selectState;//wxl 注释,表示是否已经计算过净距等了,1已计算,0未计算 //private OracleConnection connBackup = null; //数据集合 @@ -3469,7 +3469,7 @@ globeControl1.Globe.MemoryLayer.SaveAs(Application.StartupPath + "/MyPlace.kml"); } - #region 完善 + #region 完善(各种净距分析) /// /// 垂直净距分析 功能界面中的 选择图层复选框 选中状态改变事件处理 /// @@ -3619,7 +3619,7 @@ Dictionary featCount = new Dictionary(); Dictionary featLenth = new Dictionary(); Dictionary m_FeaturesWithBianhao = new Dictionary();//记录编号和对应的标注点的位置 - GSOFeatures polygonJingJuAnalysises = new GSOFeatures(); + //GSOFeatures polygonJingJuAnalysises = new GSOFeatures(); /// /// 垂直净距分析 功能界面中的 开始分析按钮 事件处理 /// @@ -3643,72 +3643,71 @@ MessageBox.Show("请输入正确的净距标准!", "提示"); return; } - - if (dataGridViewX2.Rows.Count > 0) - { - featCount.Clear(); - featLenth.Clear(); - listBox1.Items.Clear(); - layerTemp.RemoveAllFeature(); - polygonJingJuAnalysises.RemoveAll(); - clearFeatureHighLight(); - dataGridViewX3.Rows.Clear(); - m_FeaturesWithBianhao.Clear(); - Cursor = Cursors.WaitCursor; - if (checkBoxX1.Checked) // 选择管线 - { - for (int i = 0; i < dataGridViewX2.Rows.Count; i++) - { - GSOFeature selectedFeature = dataGridViewX2.Rows[i].Tag as GSOFeature; - if (selectedFeature != null) - { - selectState = 1; - VerticalDistanceAnalysis("垂直净距分析", selectedFeature, Utility.m_PipelineLayerNames, dJingJuBiaoZhun, 0.0); - } - } - } - else if (checkBoxX2.Checked) // 选择图层 - { - if (comboBoxEx1.SelectedItem == null) - { - MessageBox.Show("请选择一个图层!", "提示"); - return; - } - GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(comboBoxEx1.SelectedItem.ToString()); - if (layer == null) - return; - - GSOFeatureLayer flayer = layer as GSOFeatureLayer; - GSOFeatureDataset fdataset = flayer.Dataset as GSOFeatureDataset; - GSOFeatures feats = flayer.GetAllFeatures(); - for (int i = 0; i < feats.Length; i++) - { - selectState = 1; - VerticalDistanceAnalysis("垂直净距分析", feats[i], Utility.m_PipelineLayerNames, dJingJuBiaoZhun, 0.0); - } - } - if (featCount.Count > 0) - { - for (int i = 0; i < Utility.m_PipelineLayerNames.Count; i++) - { - if (featCount.ContainsKey(Utility.m_PipelineLayerNames[i]) && featLenth.ContainsKey(Utility.m_PipelineLayerNames[i])) - { - listBox1.Items.Add(Utility.m_PipelineLayerNames[i] + ":" + featCount[Utility.m_PipelineLayerNames[i]] + "条,共" + featLenth[Utility.m_PipelineLayerNames[i]].ToString("0.00") + "米"); - } - } - } - if (dataGridViewX3.Rows.Count == 0 && selectState == 1) - { - MessageBox.Show("没有不符合净距标准的管线!", "提示"); - } - } - else + if (dataGridViewX2.Rows.Count <= 0) { MessageBox.Show("请选中要进行垂直净距分析的管线!", "提示"); + return; + } + + featCount.Clear(); + featLenth.Clear(); + listBox1.Items.Clear(); + layerTemp.RemoveAllFeature(); + //polygonJingJuAnalysises.RemoveAll(); + clearFeatureHighLight(); + dataGridViewX3.Rows.Clear(); + m_FeaturesWithBianhao.Clear(); + Cursor = Cursors.WaitCursor; + if (checkBoxX1.Checked) // 选择管线 + { + for (int i = 0; i < dataGridViewX2.Rows.Count; i++) + { + GSOFeature selectedFeature = dataGridViewX2.Rows[i].Tag as GSOFeature; + if (selectedFeature == null) continue; + selectState = 1; + VerticalDistanceAnalysis("垂直净距分析", selectedFeature, Utility.m_PipelineLayerNames, + dJingJuBiaoZhun, 0.0); + } + } + else if (checkBoxX2.Checked) // 选择图层 + { + if (comboBoxEx1.SelectedItem == null) + { + MessageBox.Show("请选择一个图层!", "提示"); + return; + } + GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(comboBoxEx1.SelectedItem.ToString()); + if (layer == null) return; + GSOFeatureLayer flayer = layer as GSOFeatureLayer; + //GSOFeatureDataset fdataset = flayer.Dataset as GSOFeatureDataset; + GSOFeatures feats = flayer.GetAllFeatures(); + for (int i = 0; i < feats.Length; i++) + { + selectState = 1; + VerticalDistanceAnalysis("垂直净距分析", feats[i], Utility.m_PipelineLayerNames, dJingJuBiaoZhun, 0.0); + } + } + if (featCount.Count > 0) + { + for (int i = 0; i < Utility.m_PipelineLayerNames.Count; i++) + { + if (featCount.ContainsKey(Utility.m_PipelineLayerNames[i]) && + featLenth.ContainsKey(Utility.m_PipelineLayerNames[i])) + { + listBox1.Items.Add(Utility.m_PipelineLayerNames[i] + ":" + + featCount[Utility.m_PipelineLayerNames[i]] + "条,共" + + featLenth[Utility.m_PipelineLayerNames[i]].ToString("0.00") + "米"); + } + } + } + if (dataGridViewX3.Rows.Count == 0 && selectState == 1) + { + MessageBox.Show("没有不符合净距标准的管线!", "提示"); } globeControl1.Refresh(); Cursor = Cursors.Default; } + /// /// 在指定的两点组成的线的中间添加一个marker对象,并将marker对象添加到指定的图层中 /// @@ -3841,7 +3840,7 @@ idx = dataGridViewX3.Rows.Add(); dataGridViewX3.Rows[idx].Cells[0].Value = caption; dataGridViewX3.Rows[idx].Cells[1].Value = selectedFeature.Name; - dataGridViewX3.Rows[idx].Cells[2].Value = layer2.Caption; + dataGridViewX3.Rows[idx].Cells[2].Value = layer2.Caption;// feat2.Dataset.Caption;一致 dataGridViewX3.Rows[idx].Cells[3].Value = feat2.Name; dataGridViewX3.Rows[idx].Cells[4].Value = dDist.ToString("0.00"); } @@ -3917,6 +3916,7 @@ line1.ReleaseInnerPointer(); selectedFeature.ReleaseInnerPointer(); } + /// /// 垂直净距分析中 表格行的 双击定位 功能。 与覆土分析的实现方法不同,主要原因是需要标注垂距 /// @@ -3967,7 +3967,7 @@ featLenth.Clear(); listBox3.Items.Clear(); layerTemp.RemoveAllFeature(); - polygonJingJuAnalysises.RemoveAll(); + //polygonJingJuAnalysises.RemoveAll(); clearFeatureHighLight(); dataGridViewX9.Rows.Clear(); Cursor = Cursors.WaitCursor; @@ -4020,13 +4020,92 @@ globeControl1.Refresh(); Cursor = Cursors.Default; } - /// - /// 计算指定feature对象与除了该feature所在图层之外的 所有管线图层中的所有feature对象 的水平距离 并记录符合要求的管线 功能 - /// - /// - /// - /// - /// +// /// +// /// 计算指定feature对象与除了该feature所在图层之外的 所有管线图层中的所有feature对象 的水平距离 并记录符合要求的管线 功能 +// /// +// /// +// /// +// /// +// /// +// private void HorizontalDistanceAnalysis(GSOFeature selectedFeature, List _pipelineLayerNames, double dis) +// { +// if (selectedFeature == null) +// { +// selectState = 0; +// MessageBox.Show("请选择一条管线!"); +// return; +// } +// GSOGeoPolyline3D line1 = selectedFeature.Geometry as GSOGeoPolyline3D; +// if (line1 == null) +// { +// selectState = 0; +// MessageBox.Show("请选择一条管线!"); +// return; +// } +// +// string caption = selectedFeature.Dataset.Caption; +// +// GSOGeoPolygon3D polygon = line1.CreateBuffer(dis, true, 5, true, false); +// GSOFeature new_feat = new GSOFeature(); +// new_feat.Geometry = polygon; +// //polygonJingJuAnalysises.Add(new_feat); +// layerTemp.AddFeature(new_feat); +// +// for (int i = 0; i < _pipelineLayerNames.Count; i++) +// { +// if (caption == _pipelineLayerNames[i]) +// { +// continue; +// } +// GSOLayer layer2 = globeControl1.Globe.Layers.GetLayerByCaption(_pipelineLayerNames[i]); +// if (layer2 == null) continue; +// GSOFeatureLayer flayer2 = layer2 as GSOFeatureLayer; +// GSOFeatureDataset fdataset2 = flayer2.Dataset as GSOFeatureDataset; +// GSOFeatures feats2 = Polygon_Contain_PointAnalysis(polygon, _pipelineLayerNames[i]); +// for (int j = 0; j < feats2.Length; j++) +// { +// GSOFeature feat2 = feats2[j]; +// GSOGeoPolyline3D line2 = feats2[j].Geometry as GSOGeoPolyline3D; +// if (line2 == null) +// { +// continue; +// } +// GSOPipeLineStyle3D pipeStyle1 = line1.Style as GSOPipeLineStyle3D; +// GSOPipeLineStyle3D pipeStyle2 = line2.Style as GSOPipeLineStyle3D; +// if (pipeStyle1 == null || pipeStyle2 == null) +// { +// continue; +// } +// +// feat2.HighLight = true; +// int idx = dataGridViewX9.Rows.Add(); +// dataGridViewX9.Rows[idx].Tag = feat2; +// dataGridViewX9.Rows[idx].Cells[0].Value = caption; +// dataGridViewX9.Rows[idx].Cells[1].Value = selectedFeature.Name; +// dataGridViewX9.Rows[idx].Cells[2].Value = layer2.Caption; +// dataGridViewX9.Rows[idx].Cells[3].Value = feats2[j].Name; +// dataGridViewX9.Rows[idx].Cells[4].Value = dis.ToString("0.00"); +// +// if (featCount.ContainsKey(layer2.Caption)) +// { +// featCount[layer2.Caption] = featCount[layer2.Caption] + 1; +// } +// else +// { +// featCount.Add(layer2.Caption, 1); +// } +// if (featLenth.ContainsKey(layer2.Caption)) +// { +// featLenth[layer2.Caption] = featLenth[layer2.Caption] + line2.GetSpaceLength(true, 6378137); +// } +// else +// { +// featLenth.Add(layer2.Caption, line2.GetSpaceLength(true, 6378137)); +// } +// } +// } + // } + #region wxl 未改完 private void HorizontalDistanceAnalysis(GSOFeature selectedFeature, List _pipelineLayerNames, double dis) { if (selectedFeature == null) @@ -4042,69 +4121,40 @@ MessageBox.Show("请选择一条管线!"); return; } - - string caption = selectedFeature.Dataset.Caption; - - GSOGeoPolygon3D polygon = line1.CreateBuffer(dis, true, 5, true, false); - GSOFeature new_feat = new GSOFeature(); - new_feat.Geometry = polygon; - polygonJingJuAnalysises.Add(new_feat); - layerTemp.AddFeature(new_feat); - - for (int i = 0; i < _pipelineLayerNames.Count; i++) + Dictionary featureMap = DoublePanelAnalysis.HorizontalDistanceAnalysis(globeControl1,selectedFeature, + _pipelineLayerNames, dis); + foreach (KeyValuePair kvp in featureMap) { - if (caption == _pipelineLayerNames[i]) + GSOFeature feat2 = kvp.Key; + feat2.HighLight = true; + int idx = dataGridViewX9.Rows.Add(); + dataGridViewX9.Rows[idx].Tag = feat2; + dataGridViewX9.Rows[idx].Cells[0].Value = selectedFeature.Dataset.Caption; + dataGridViewX9.Rows[idx].Cells[1].Value = selectedFeature.Name; + dataGridViewX9.Rows[idx].Cells[2].Value = feat2.Dataset.Caption; + dataGridViewX9.Rows[idx].Cells[3].Value = feat2.Name; + dataGridViewX9.Rows[idx].Cells[4].Value = dis.ToString("0.00"); + GSOGeoPolyline3D line2 = feat2.Geometry as GSOGeoPolyline3D; + if (featCount.ContainsKey(feat2.Dataset.Caption)) { - continue; + featCount[feat2.Dataset.Caption] = featCount[feat2.Dataset.Caption] + 1; } - GSOLayer layer2 = globeControl1.Globe.Layers.GetLayerByCaption(_pipelineLayerNames[i]); - if (layer2 == null) continue; - GSOFeatureLayer flayer2 = layer2 as GSOFeatureLayer; - GSOFeatureDataset fdataset2 = flayer2.Dataset as GSOFeatureDataset; - GSOFeatures feats2 = Polygon_Contain_PointAnalysis(polygon, _pipelineLayerNames[i]); - for (int j = 0; j < feats2.Length; j++) + else { - GSOFeature feat2 = feats2[j]; - GSOGeoPolyline3D line2 = feats2[j].Geometry as GSOGeoPolyline3D; - if (line2 == null) - { - continue; - } - GSOPipeLineStyle3D pipeStyle1 = line1.Style as GSOPipeLineStyle3D; - GSOPipeLineStyle3D pipeStyle2 = line2.Style as GSOPipeLineStyle3D; - if (pipeStyle1 == null || pipeStyle2 == null) - { - continue; - } - - feat2.HighLight = true; - int idx = dataGridViewX9.Rows.Add(); - dataGridViewX9.Rows[idx].Tag = feat2; - dataGridViewX9.Rows[idx].Cells[0].Value = caption; - dataGridViewX9.Rows[idx].Cells[1].Value = selectedFeature.Name; - dataGridViewX9.Rows[idx].Cells[2].Value = layer2.Caption; - dataGridViewX9.Rows[idx].Cells[3].Value = feats2[j].Name; - dataGridViewX9.Rows[idx].Cells[4].Value = dis.ToString("0.00"); - - if (featCount.ContainsKey(layer2.Caption)) - { - featCount[layer2.Caption] = featCount[layer2.Caption] + 1; - } - else - { - featCount.Add(layer2.Caption, 1); - } - if (featLenth.ContainsKey(layer2.Caption)) - { - featLenth[layer2.Caption] = featLenth[layer2.Caption] + line2.GetSpaceLength(true, 6378137); - } - else - { - featLenth.Add(layer2.Caption, line2.GetSpaceLength(true, 6378137)); - } + featCount.Add(feat2.Dataset.Caption, 1); + } + if (featLenth.ContainsKey(feat2.Dataset.Caption)) + { + featLenth[feat2.Dataset.Caption] = featLenth[feat2.Dataset.Caption] + line2.GetSpaceLength(true, 6378137); + } + else + { + featLenth.Add(feat2.Dataset.Caption, line2.GetSpaceLength(true, 6378137)); } } } + #endregion + /// /// 水平净距分析 功能界面中 表格的 双击定位 功能 /// @@ -4149,7 +4199,7 @@ featCount.Clear(); listBox2.Items.Clear(); layerTemp.RemoveAllFeature(); - polygonJingJuAnalysises.RemoveAll(); + //polygonJingJuAnalysises.RemoveAll(); dataGridViewX5.Rows.Clear(); clearFeatureHighLight(); m_FeaturesWithBianhao.Clear(); @@ -4160,21 +4210,18 @@ for (int i = 0; i < dataGridViewX4.Rows.Count; i++) { GSOFeature selectedFeature = dataGridViewX4.Rows[i].Tag as GSOFeature; - if (selectedFeature != null) - { - selectState = 1; - VerticalDistanceAnalysis("碰撞分析", selectedFeature, Utility.m_PipelineLayerNames, 0, 0.0); - } + if (selectedFeature == null) continue; + selectState = 1; + VerticalDistanceAnalysis("碰撞分析", selectedFeature, Utility.m_PipelineLayerNames, 0, 0.0); } } else if (checkBoxX4.Checked) // 选择图层 { GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(comboBoxEx2.SelectedItem.ToString()); - if (layer == null) - return; + if (layer == null) return; GSOFeatureLayer flayer = layer as GSOFeatureLayer; - GSOFeatureDataset fdataset = flayer.Dataset as GSOFeatureDataset; + //GSOFeatureDataset fdataset = flayer.Dataset as GSOFeatureDataset; GSOFeatures feats = flayer.GetAllFeatures(); for (int i = 0; i < feats.Length; i++) { @@ -4334,15 +4381,7 @@ { GSOFeature rowFeature = dataGridViewX6.Rows[i].Tag as GSOFeature; if (rowFeature == null) continue; - string featureName = ""; - if (isFeatureContainsBianhao(rowFeature))//判断rowFeature是否包含“编号”字段 - { - featureName = rowFeature.GetValue(featureIDFieldName).ToString(); - } - else - { - featureName = rowFeature.Name; - } + string featureName = isFeatureContainsBianhao(rowFeature) ? rowFeature.GetValue(featureIDFieldName).ToString() : rowFeature.Name; GSOGeoPolyline3D line = rowFeature.Geometry as GSOGeoPolyline3D; if (line == null) @@ -4970,7 +5009,7 @@ featLenth.Clear(); listBoxStasticsResult.Items.Clear(); layerTemp.RemoveAllFeature(); - polygonJingJuAnalysises.RemoveAll(); + //polygonJingJuAnalysises.RemoveAll(); clearFeatureHighLight(); dataGridViewAnalysisResult.Rows.Clear(); m_FeaturesWithBianhao.Clear(); diff --git a/bin/x86/Debug/Config.xml b/bin/x86/Debug/Config.xml index 508515a..5cde6e4 100644 --- a/bin/x86/Debug/Config.xml +++ b/bin/x86/Debug/Config.xml @@ -6,7 +6,7 @@ 192.168.0.203 release 192.168.0.203 - 1500 + 2500 http://192.168.0.203/images/ http://192.168.0.203/images/default.jpg D:/backup diff --git a/bin/x86/Debug/Cyberpipe.exe b/bin/x86/Debug/Cyberpipe.exe index 1249b50..3595fe6 100644 --- a/bin/x86/Debug/Cyberpipe.exe +++ b/bin/x86/Debug/Cyberpipe.exe Binary files differ diff --git a/bin/x86/Debug/Cyberpipe.pdb b/bin/x86/Debug/Cyberpipe.pdb index 52623ea..6bae7e3 100644 --- a/bin/x86/Debug/Cyberpipe.pdb +++ b/bin/x86/Debug/Cyberpipe.pdb Binary files differ