diff --git a/DoublePanelAnalysis.cs b/DoublePanelAnalysis.cs
index a2f8687..e600c6d 100644
--- a/DoublePanelAnalysis.cs
+++ b/DoublePanelAnalysis.cs
@@ -1,4 +1,5 @@
using System;
+using System.Collections.Generic;
using System.Data;
using GeoScene.Data;
using GeoScene.Engine;
@@ -10,8 +11,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;
@@ -748,5 +749,93 @@
}
+ #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/DoublePanelAnalysis.cs b/DoublePanelAnalysis.cs
index a2f8687..e600c6d 100644
--- a/DoublePanelAnalysis.cs
+++ b/DoublePanelAnalysis.cs
@@ -1,4 +1,5 @@
using System;
+using System.Collections.Generic;
using System.Data;
using GeoScene.Data;
using GeoScene.Engine;
@@ -10,8 +11,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;
@@ -748,5 +749,93 @@
}
+ #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 0fcbf97..2b654c0 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();
@@ -5942,21 +5981,21 @@
shlayername = frmSh.rukuLayer.Name;
globeControl1.Refresh();
}
- #region wxl 下面unreachable
- if (frmShResult != null && !frmShResult.IsDisposed)
- {
- try
- {
- clearFeatureHighLight();
- ClearRedlineAnalyseResult();
- frmShResult.Close();
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message);
- }
- }
- #endregion wxl
+ //#region wxl 下面unreachable
+ //if (frmShResult != null && !frmShResult.IsDisposed)
+ //{
+ // try
+ // {
+ // clearFeatureHighLight();
+ // ClearRedlineAnalyseResult();
+ // frmShResult.Close();
+ // }
+ // catch (Exception ex)
+ // {
+ // MessageBox.Show(ex.Message);
+ // }
+ //}
+ //#endregion wxl
frmShResult = new FrmShResult(dVerticalJingJuBiaoZhun, dHorizontalJingJuBiaoZhun, shlayername, globeControl1,
Utility.m_PipelineLayerNames);
@@ -6142,31 +6181,28 @@
if (e.Button == MouseButtons.Left)
{
DataGridView.HitTestInfo hittestinfo = dataGridViewX1.HitTest(e.X, e.Y);
- if (hittestinfo.RowIndex > -1)
+ if (hittestinfo.RowIndex < 0) return;
+ string featureName = "";
+ if (dataGridViewX1.Columns.Contains("编号"))
{
- string featureName = "";
- if (dataGridViewX1.Columns.Contains("编号"))
- {
- featureName = dataGridViewX1.Rows[hittestinfo.RowIndex].Cells["编号"].Value.ToString();
- }
- else if (dataGridViewX1.Columns.Contains("标识器编号"))
- {
- featureName = dataGridViewX1.Rows[hittestinfo.RowIndex].Cells["标识器编号"].Value.ToString();
- }
- featureName = featureName.Trim();
-
- GSOLayer layer = null;
- layer = globeControl1.Globe.Layers.GetLayerByCaption(dataGridViewX1.Tag.ToString());
-
- if (layer == null) return;
-
- GSOFeatures features = layer.GetFeatureByName(featureName, false);
- if (features.Length == 0) return;
- GSOFeature rowFeature = features[0];
-
- ClassSearchAnalysis.AddMakerToLineFeature(globeControl1, rowFeature);
-
+ featureName = dataGridViewX1.Rows[hittestinfo.RowIndex].Cells["编号"].Value.ToString();
}
+ else if (dataGridViewX1.Columns.Contains("标识器编号"))
+ {
+ featureName = dataGridViewX1.Rows[hittestinfo.RowIndex].Cells["标识器编号"].Value.ToString();
+ }
+ featureName = featureName.Trim();
+
+ GSOLayer layer = null;
+ layer = globeControl1.Globe.Layers.GetLayerByCaption(dataGridViewX1.Tag.ToString());
+
+ if (layer == null) return;
+
+ GSOFeatures features = layer.GetFeatureByName(featureName, false);
+ if (features.Length == 0) return;
+ GSOFeature rowFeature = features[0];
+
+ ClassSearchAnalysis.AddMakerToLineFeature(globeControl1, rowFeature);
}
}
else
@@ -6187,17 +6223,14 @@
try
{
DataGridView.HitTestInfo hittestinfo = dataGridViewX1.HitTest(e.X, e.Y);
- if (hittestinfo.RowIndex >= 0)
- {
- string layer = dataGridViewX1.Rows[hittestinfo.RowIndex].Cells["管线类型"].Value.ToString();
- string hxName = dataGridViewX1.Rows[hittestinfo.RowIndex].Cells["红线编号"].Value.ToString();
- FrmAnalysisGuiHuaResult frm = new FrmAnalysisGuiHuaResult(globeControl1, lineStruct, featsList,
- panelOfTable, dataGridViewX1, layer, hxName);
- frm.Location = new Point(Width - frm.Width - 10, Height - frm.Height - 20);
- frm.Show(this);
-
- from = frm;
- }
+ if (hittestinfo.RowIndex < 0) return;
+ string layer = dataGridViewX1.Rows[hittestinfo.RowIndex].Cells["管线类型"].Value.ToString();
+ string hxName = dataGridViewX1.Rows[hittestinfo.RowIndex].Cells["红线编号"].Value.ToString();
+ FrmAnalysisGuiHuaResult frm = new FrmAnalysisGuiHuaResult(globeControl1, lineStruct, featsList,
+ panelOfTable, dataGridViewX1, layer, hxName);
+ frm.Location = new Point(Width - frm.Width - 10, Height - frm.Height - 20);
+ frm.Show(this);
+ from = frm;
}
catch (Exception ex)
{
diff --git a/DoublePanelAnalysis.cs b/DoublePanelAnalysis.cs
index a2f8687..e600c6d 100644
--- a/DoublePanelAnalysis.cs
+++ b/DoublePanelAnalysis.cs
@@ -1,4 +1,5 @@
using System;
+using System.Collections.Generic;
using System.Data;
using GeoScene.Data;
using GeoScene.Engine;
@@ -10,8 +11,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;
@@ -748,5 +749,93 @@
}
+ #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 0fcbf97..2b654c0 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();
@@ -5942,21 +5981,21 @@
shlayername = frmSh.rukuLayer.Name;
globeControl1.Refresh();
}
- #region wxl 下面unreachable
- if (frmShResult != null && !frmShResult.IsDisposed)
- {
- try
- {
- clearFeatureHighLight();
- ClearRedlineAnalyseResult();
- frmShResult.Close();
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message);
- }
- }
- #endregion wxl
+ //#region wxl 下面unreachable
+ //if (frmShResult != null && !frmShResult.IsDisposed)
+ //{
+ // try
+ // {
+ // clearFeatureHighLight();
+ // ClearRedlineAnalyseResult();
+ // frmShResult.Close();
+ // }
+ // catch (Exception ex)
+ // {
+ // MessageBox.Show(ex.Message);
+ // }
+ //}
+ //#endregion wxl
frmShResult = new FrmShResult(dVerticalJingJuBiaoZhun, dHorizontalJingJuBiaoZhun, shlayername, globeControl1,
Utility.m_PipelineLayerNames);
@@ -6142,31 +6181,28 @@
if (e.Button == MouseButtons.Left)
{
DataGridView.HitTestInfo hittestinfo = dataGridViewX1.HitTest(e.X, e.Y);
- if (hittestinfo.RowIndex > -1)
+ if (hittestinfo.RowIndex < 0) return;
+ string featureName = "";
+ if (dataGridViewX1.Columns.Contains("编号"))
{
- string featureName = "";
- if (dataGridViewX1.Columns.Contains("编号"))
- {
- featureName = dataGridViewX1.Rows[hittestinfo.RowIndex].Cells["编号"].Value.ToString();
- }
- else if (dataGridViewX1.Columns.Contains("标识器编号"))
- {
- featureName = dataGridViewX1.Rows[hittestinfo.RowIndex].Cells["标识器编号"].Value.ToString();
- }
- featureName = featureName.Trim();
-
- GSOLayer layer = null;
- layer = globeControl1.Globe.Layers.GetLayerByCaption(dataGridViewX1.Tag.ToString());
-
- if (layer == null) return;
-
- GSOFeatures features = layer.GetFeatureByName(featureName, false);
- if (features.Length == 0) return;
- GSOFeature rowFeature = features[0];
-
- ClassSearchAnalysis.AddMakerToLineFeature(globeControl1, rowFeature);
-
+ featureName = dataGridViewX1.Rows[hittestinfo.RowIndex].Cells["编号"].Value.ToString();
}
+ else if (dataGridViewX1.Columns.Contains("标识器编号"))
+ {
+ featureName = dataGridViewX1.Rows[hittestinfo.RowIndex].Cells["标识器编号"].Value.ToString();
+ }
+ featureName = featureName.Trim();
+
+ GSOLayer layer = null;
+ layer = globeControl1.Globe.Layers.GetLayerByCaption(dataGridViewX1.Tag.ToString());
+
+ if (layer == null) return;
+
+ GSOFeatures features = layer.GetFeatureByName(featureName, false);
+ if (features.Length == 0) return;
+ GSOFeature rowFeature = features[0];
+
+ ClassSearchAnalysis.AddMakerToLineFeature(globeControl1, rowFeature);
}
}
else
@@ -6187,17 +6223,14 @@
try
{
DataGridView.HitTestInfo hittestinfo = dataGridViewX1.HitTest(e.X, e.Y);
- if (hittestinfo.RowIndex >= 0)
- {
- string layer = dataGridViewX1.Rows[hittestinfo.RowIndex].Cells["管线类型"].Value.ToString();
- string hxName = dataGridViewX1.Rows[hittestinfo.RowIndex].Cells["红线编号"].Value.ToString();
- FrmAnalysisGuiHuaResult frm = new FrmAnalysisGuiHuaResult(globeControl1, lineStruct, featsList,
- panelOfTable, dataGridViewX1, layer, hxName);
- frm.Location = new Point(Width - frm.Width - 10, Height - frm.Height - 20);
- frm.Show(this);
-
- from = frm;
- }
+ if (hittestinfo.RowIndex < 0) return;
+ string layer = dataGridViewX1.Rows[hittestinfo.RowIndex].Cells["管线类型"].Value.ToString();
+ string hxName = dataGridViewX1.Rows[hittestinfo.RowIndex].Cells["红线编号"].Value.ToString();
+ FrmAnalysisGuiHuaResult frm = new FrmAnalysisGuiHuaResult(globeControl1, lineStruct, featsList,
+ panelOfTable, dataGridViewX1, layer, hxName);
+ frm.Location = new Point(Width - frm.Width - 10, Height - frm.Height - 20);
+ frm.Show(this);
+ from = frm;
}
catch (Exception ex)
{
diff --git a/MainFrm.resx b/MainFrm.resx
index 2e776e7..f732813 100644
--- a/MainFrm.resx
+++ b/MainFrm.resx
@@ -351,6 +351,7 @@
766, 54
+<<<<<<< HEAD
iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
@@ -386,6 +387,9 @@
+=======
+
+>>>>>>> ee4733fc7a65c70fa650cce53f5587161fab7239
iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAZdEVYdFNvZnR3YXJlAEFkb2JlIEltYWdlUmVhZHlxyWU8AAADZmlUWHRYTUw6Y29tLmFkb2Jl
@@ -4027,7 +4031,45 @@
LxYbJ5nBTuKz00Gm+WG02PMTDocT9TvtlCl2Zpnh4wAAAABJRU5ErkJggg==
+<<<<<<< HEAD
+=======
+
+
+ iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
+ YQUAAAAZdEVYdFNvZnR3YXJlAEFkb2JlIEltYWdlUmVhZHlxyWU8AAADZmlUWHRYTUw6Y29tLmFkb2Jl
+ LnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQi
+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IzNODcg0dV2V36FtsJ7yBJ8UXO8hyzBFzXH
+ ++H/A/YDv9/V87iOlrYAAAAASUVORK5CYII=
+
+
+
+>>>>>>> ee4733fc7a65c70fa650cce53f5587161fab7239
iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAZdEVYdFNvZnR3YXJlAEFkb2JlIEltYWdlUmVhZHlxyWU8AAADZmlUWHRYTUw6Y29tLmFkb2Jl
diff --git a/DoublePanelAnalysis.cs b/DoublePanelAnalysis.cs
index a2f8687..e600c6d 100644
--- a/DoublePanelAnalysis.cs
+++ b/DoublePanelAnalysis.cs
@@ -1,4 +1,5 @@
using System;
+using System.Collections.Generic;
using System.Data;
using GeoScene.Data;
using GeoScene.Engine;
@@ -10,8 +11,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;
@@ -748,5 +749,93 @@
}
+ #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 0fcbf97..2b654c0 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();
@@ -5942,21 +5981,21 @@
shlayername = frmSh.rukuLayer.Name;
globeControl1.Refresh();
}
- #region wxl 下面unreachable
- if (frmShResult != null && !frmShResult.IsDisposed)
- {
- try
- {
- clearFeatureHighLight();
- ClearRedlineAnalyseResult();
- frmShResult.Close();
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message);
- }
- }
- #endregion wxl
+ //#region wxl 下面unreachable
+ //if (frmShResult != null && !frmShResult.IsDisposed)
+ //{
+ // try
+ // {
+ // clearFeatureHighLight();
+ // ClearRedlineAnalyseResult();
+ // frmShResult.Close();
+ // }
+ // catch (Exception ex)
+ // {
+ // MessageBox.Show(ex.Message);
+ // }
+ //}
+ //#endregion wxl
frmShResult = new FrmShResult(dVerticalJingJuBiaoZhun, dHorizontalJingJuBiaoZhun, shlayername, globeControl1,
Utility.m_PipelineLayerNames);
@@ -6142,31 +6181,28 @@
if (e.Button == MouseButtons.Left)
{
DataGridView.HitTestInfo hittestinfo = dataGridViewX1.HitTest(e.X, e.Y);
- if (hittestinfo.RowIndex > -1)
+ if (hittestinfo.RowIndex < 0) return;
+ string featureName = "";
+ if (dataGridViewX1.Columns.Contains("编号"))
{
- string featureName = "";
- if (dataGridViewX1.Columns.Contains("编号"))
- {
- featureName = dataGridViewX1.Rows[hittestinfo.RowIndex].Cells["编号"].Value.ToString();
- }
- else if (dataGridViewX1.Columns.Contains("标识器编号"))
- {
- featureName = dataGridViewX1.Rows[hittestinfo.RowIndex].Cells["标识器编号"].Value.ToString();
- }
- featureName = featureName.Trim();
-
- GSOLayer layer = null;
- layer = globeControl1.Globe.Layers.GetLayerByCaption(dataGridViewX1.Tag.ToString());
-
- if (layer == null) return;
-
- GSOFeatures features = layer.GetFeatureByName(featureName, false);
- if (features.Length == 0) return;
- GSOFeature rowFeature = features[0];
-
- ClassSearchAnalysis.AddMakerToLineFeature(globeControl1, rowFeature);
-
+ featureName = dataGridViewX1.Rows[hittestinfo.RowIndex].Cells["编号"].Value.ToString();
}
+ else if (dataGridViewX1.Columns.Contains("标识器编号"))
+ {
+ featureName = dataGridViewX1.Rows[hittestinfo.RowIndex].Cells["标识器编号"].Value.ToString();
+ }
+ featureName = featureName.Trim();
+
+ GSOLayer layer = null;
+ layer = globeControl1.Globe.Layers.GetLayerByCaption(dataGridViewX1.Tag.ToString());
+
+ if (layer == null) return;
+
+ GSOFeatures features = layer.GetFeatureByName(featureName, false);
+ if (features.Length == 0) return;
+ GSOFeature rowFeature = features[0];
+
+ ClassSearchAnalysis.AddMakerToLineFeature(globeControl1, rowFeature);
}
}
else
@@ -6187,17 +6223,14 @@
try
{
DataGridView.HitTestInfo hittestinfo = dataGridViewX1.HitTest(e.X, e.Y);
- if (hittestinfo.RowIndex >= 0)
- {
- string layer = dataGridViewX1.Rows[hittestinfo.RowIndex].Cells["管线类型"].Value.ToString();
- string hxName = dataGridViewX1.Rows[hittestinfo.RowIndex].Cells["红线编号"].Value.ToString();
- FrmAnalysisGuiHuaResult frm = new FrmAnalysisGuiHuaResult(globeControl1, lineStruct, featsList,
- panelOfTable, dataGridViewX1, layer, hxName);
- frm.Location = new Point(Width - frm.Width - 10, Height - frm.Height - 20);
- frm.Show(this);
-
- from = frm;
- }
+ if (hittestinfo.RowIndex < 0) return;
+ string layer = dataGridViewX1.Rows[hittestinfo.RowIndex].Cells["管线类型"].Value.ToString();
+ string hxName = dataGridViewX1.Rows[hittestinfo.RowIndex].Cells["红线编号"].Value.ToString();
+ FrmAnalysisGuiHuaResult frm = new FrmAnalysisGuiHuaResult(globeControl1, lineStruct, featsList,
+ panelOfTable, dataGridViewX1, layer, hxName);
+ frm.Location = new Point(Width - frm.Width - 10, Height - frm.Height - 20);
+ frm.Show(this);
+ from = frm;
}
catch (Exception ex)
{
diff --git a/MainFrm.resx b/MainFrm.resx
index 2e776e7..f732813 100644
--- a/MainFrm.resx
+++ b/MainFrm.resx
@@ -351,6 +351,7 @@
766, 54
+<<<<<<< HEAD
iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
@@ -386,6 +387,9 @@
+=======
+
+>>>>>>> ee4733fc7a65c70fa650cce53f5587161fab7239
iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAZdEVYdFNvZnR3YXJlAEFkb2JlIEltYWdlUmVhZHlxyWU8AAADZmlUWHRYTUw6Y29tLmFkb2Jl
@@ -4027,7 +4031,45 @@
LxYbJ5nBTuKz00Gm+WG02PMTDocT9TvtlCl2Zpnh4wAAAABJRU5ErkJggg==
+<<<<<<< HEAD
+=======
+
+
+ iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
+ YQUAAAAZdEVYdFNvZnR3YXJlAEFkb2JlIEltYWdlUmVhZHlxyWU8AAADZmlUWHRYTUw6Y29tLmFkb2Jl
+ LnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQi
+ Pz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvY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CYII=
+
+
+
+>>>>>>> ee4733fc7a65c70fa650cce53f5587161fab7239
iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAZdEVYdFNvZnR3YXJlAEFkb2JlIEltYWdlUmVhZHlxyWU8AAADZmlUWHRYTUw6Y29tLmFkb2Jl
diff --git a/bin/x86/Debug/Config.xml b/bin/x86/Debug/Config.xml
index f51e443..5cde6e4 100644
--- a/bin/x86/Debug/Config.xml
+++ b/bin/x86/Debug/Config.xml
@@ -1,12 +1,12 @@
LocaSpace三维地下管线信息系统
- scott
- SZDB
- 127.0.0.1
- SZDB
- 127.0.0.1
- 1500
+ release
+ SZHTDB2
+ 192.168.0.203
+ release
+ 192.168.0.203
+ 2500
http://192.168.0.203/images/
http://192.168.0.203/images/default.jpg
D:/backup
diff --git a/DoublePanelAnalysis.cs b/DoublePanelAnalysis.cs
index a2f8687..e600c6d 100644
--- a/DoublePanelAnalysis.cs
+++ b/DoublePanelAnalysis.cs
@@ -1,4 +1,5 @@
using System;
+using System.Collections.Generic;
using System.Data;
using GeoScene.Data;
using GeoScene.Engine;
@@ -10,8 +11,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;
@@ -748,5 +749,93 @@
}
+ #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 0fcbf97..2b654c0 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();
@@ -5942,21 +5981,21 @@
shlayername = frmSh.rukuLayer.Name;
globeControl1.Refresh();
}
- #region wxl 下面unreachable
- if (frmShResult != null && !frmShResult.IsDisposed)
- {
- try
- {
- clearFeatureHighLight();
- ClearRedlineAnalyseResult();
- frmShResult.Close();
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message);
- }
- }
- #endregion wxl
+ //#region wxl 下面unreachable
+ //if (frmShResult != null && !frmShResult.IsDisposed)
+ //{
+ // try
+ // {
+ // clearFeatureHighLight();
+ // ClearRedlineAnalyseResult();
+ // frmShResult.Close();
+ // }
+ // catch (Exception ex)
+ // {
+ // MessageBox.Show(ex.Message);
+ // }
+ //}
+ //#endregion wxl
frmShResult = new FrmShResult(dVerticalJingJuBiaoZhun, dHorizontalJingJuBiaoZhun, shlayername, globeControl1,
Utility.m_PipelineLayerNames);
@@ -6142,31 +6181,28 @@
if (e.Button == MouseButtons.Left)
{
DataGridView.HitTestInfo hittestinfo = dataGridViewX1.HitTest(e.X, e.Y);
- if (hittestinfo.RowIndex > -1)
+ if (hittestinfo.RowIndex < 0) return;
+ string featureName = "";
+ if (dataGridViewX1.Columns.Contains("编号"))
{
- string featureName = "";
- if (dataGridViewX1.Columns.Contains("编号"))
- {
- featureName = dataGridViewX1.Rows[hittestinfo.RowIndex].Cells["编号"].Value.ToString();
- }
- else if (dataGridViewX1.Columns.Contains("标识器编号"))
- {
- featureName = dataGridViewX1.Rows[hittestinfo.RowIndex].Cells["标识器编号"].Value.ToString();
- }
- featureName = featureName.Trim();
-
- GSOLayer layer = null;
- layer = globeControl1.Globe.Layers.GetLayerByCaption(dataGridViewX1.Tag.ToString());
-
- if (layer == null) return;
-
- GSOFeatures features = layer.GetFeatureByName(featureName, false);
- if (features.Length == 0) return;
- GSOFeature rowFeature = features[0];
-
- ClassSearchAnalysis.AddMakerToLineFeature(globeControl1, rowFeature);
-
+ featureName = dataGridViewX1.Rows[hittestinfo.RowIndex].Cells["编号"].Value.ToString();
}
+ else if (dataGridViewX1.Columns.Contains("标识器编号"))
+ {
+ featureName = dataGridViewX1.Rows[hittestinfo.RowIndex].Cells["标识器编号"].Value.ToString();
+ }
+ featureName = featureName.Trim();
+
+ GSOLayer layer = null;
+ layer = globeControl1.Globe.Layers.GetLayerByCaption(dataGridViewX1.Tag.ToString());
+
+ if (layer == null) return;
+
+ GSOFeatures features = layer.GetFeatureByName(featureName, false);
+ if (features.Length == 0) return;
+ GSOFeature rowFeature = features[0];
+
+ ClassSearchAnalysis.AddMakerToLineFeature(globeControl1, rowFeature);
}
}
else
@@ -6187,17 +6223,14 @@
try
{
DataGridView.HitTestInfo hittestinfo = dataGridViewX1.HitTest(e.X, e.Y);
- if (hittestinfo.RowIndex >= 0)
- {
- string layer = dataGridViewX1.Rows[hittestinfo.RowIndex].Cells["管线类型"].Value.ToString();
- string hxName = dataGridViewX1.Rows[hittestinfo.RowIndex].Cells["红线编号"].Value.ToString();
- FrmAnalysisGuiHuaResult frm = new FrmAnalysisGuiHuaResult(globeControl1, lineStruct, featsList,
- panelOfTable, dataGridViewX1, layer, hxName);
- frm.Location = new Point(Width - frm.Width - 10, Height - frm.Height - 20);
- frm.Show(this);
-
- from = frm;
- }
+ if (hittestinfo.RowIndex < 0) return;
+ string layer = dataGridViewX1.Rows[hittestinfo.RowIndex].Cells["管线类型"].Value.ToString();
+ string hxName = dataGridViewX1.Rows[hittestinfo.RowIndex].Cells["红线编号"].Value.ToString();
+ FrmAnalysisGuiHuaResult frm = new FrmAnalysisGuiHuaResult(globeControl1, lineStruct, featsList,
+ panelOfTable, dataGridViewX1, layer, hxName);
+ frm.Location = new Point(Width - frm.Width - 10, Height - frm.Height - 20);
+ frm.Show(this);
+ from = frm;
}
catch (Exception ex)
{
diff --git a/MainFrm.resx b/MainFrm.resx
index 2e776e7..f732813 100644
--- a/MainFrm.resx
+++ b/MainFrm.resx
@@ -351,6 +351,7 @@
766, 54
+<<<<<<< HEAD
iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
@@ -386,6 +387,9 @@
+=======
+
+>>>>>>> ee4733fc7a65c70fa650cce53f5587161fab7239
iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAZdEVYdFNvZnR3YXJlAEFkb2JlIEltYWdlUmVhZHlxyWU8AAADZmlUWHRYTUw6Y29tLmFkb2Jl
@@ -4027,7 +4031,45 @@
LxYbJ5nBTuKz00Gm+WG02PMTDocT9TvtlCl2Zpnh4wAAAABJRU5ErkJggg==
+<<<<<<< HEAD
+=======
+
+
+ iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
+ YQUAAAAZdEVYdFNvZnR3YXJlAEFkb2JlIEltYWdlU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
+ 7qCmghsw+S6VpV894KuUuKFbfhNNqa749CwY3dm0toK+VABl3HlQM5obYHybwFLc7W1y/Y5BlX6FfgNn
+ DNcEY0DhZZX+MiGKbh0DNR24AYYWMSfJzc6GZBApwS5skIzNODcg0dV2V36FtsJ7yBJ8UXO8hyzBFzXH
+ ++H/A/YDv9/V87iOlrYAAAAASUVORK5CYII=
+
+
+
+>>>>>>> ee4733fc7a65c70fa650cce53f5587161fab7239
iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAZdEVYdFNvZnR3YXJlAEFkb2JlIEltYWdlUmVhZHlxyWU8AAADZmlUWHRYTUw6Y29tLmFkb2Jl
diff --git a/bin/x86/Debug/Config.xml b/bin/x86/Debug/Config.xml
index f51e443..5cde6e4 100644
--- a/bin/x86/Debug/Config.xml
+++ b/bin/x86/Debug/Config.xml
@@ -1,12 +1,12 @@
LocaSpace三维地下管线信息系统
- scott
- SZDB
- 127.0.0.1
- SZDB
- 127.0.0.1
- 1500
+ release
+ SZHTDB2
+ 192.168.0.203
+ release
+ 192.168.0.203
+ 2500
http://192.168.0.203/images/
http://192.168.0.203/images/default.jpg
D:/backup
diff --git a/bin/x86/Debug/glVersion.txt b/bin/x86/Debug/glVersion.txt
index 06a7613..1fc46d0 100644
--- a/bin/x86/Debug/glVersion.txt
+++ b/bin/x86/Debug/glVersion.txt
Binary files differ