diff --git a/Cyberpipe.suo b/Cyberpipe.suo
index 2b3fc7a..c87d798 100644
--- a/Cyberpipe.suo
+++ b/Cyberpipe.suo
Binary files differ
diff --git a/Cyberpipe.suo b/Cyberpipe.suo
index 2b3fc7a..c87d798 100644
--- a/Cyberpipe.suo
+++ b/Cyberpipe.suo
Binary files differ
diff --git a/FrmCompareFeature.cs b/FrmCompareFeature.cs
index 74fa33e..71323e5 100644
--- a/FrmCompareFeature.cs
+++ b/FrmCompareFeature.cs
@@ -23,14 +23,15 @@
GSOGeoPolygon3D resPolygon;
static FrmCompareFeature frm;
- public static void ShowForm(GSOGlobeControl _globeControl1, GSOGlobeControl _globeControl2,
+
+ public static void ShowForm(GSOGlobeControl _globeControl1, GSOGlobeControl _globeControl2,
GSOLayer _layerTemp, GSOLayer _layerTemp2, int width)
{
if (frm == null)
{
frm = new FrmCompareFeature(_globeControl1, _globeControl2, _layerTemp, _layerTemp2);
- frm.Location = new Point((width - frm.Width) / 2, 50);
+ frm.Location = new Point((width - frm.Width)/2, 50);
frm.Show(_globeControl1.Parent);
}
else
@@ -40,7 +41,7 @@
}
}
- public FrmCompareFeature(GSOGlobeControl _globeControl1, GSOGlobeControl _globeControl2,
+ public FrmCompareFeature(GSOGlobeControl _globeControl1, GSOGlobeControl _globeControl2,
GSOLayer _layerTemp, GSOLayer _layerTemp2)
{
globeControl1 = _globeControl1;
@@ -51,7 +52,7 @@
globeControl2.Globe.Action = EnumAction3D.SelectObject;
layerTemp = _layerTemp;
layerTemp2 = _layerTemp2;
-
+
globeControl1.MouseClick += globeControl1_MouseClick;
globeControl2.MouseClick += globeControl2_MouseClick;
}
@@ -62,37 +63,29 @@
double bufferWidth = Convert.ToDouble(textBox1.Text);
- if (srcFeature != null && dscFeature != null)
- {
- if (srcFeature.Geometry.Type != dscFeature.Geometry.Type)
- {
- MessageBox.Show("请选择同种类型图层!");
- }
-
- //TODO LIST按缓冲区的方式处理线的方式
- else
- if (srcFeature.Geometry.Type == dscFeature.Geometry.Type && srcFeature.Geometry.Type == EnumGeometryType.GeoPolyline3D)
- {
- lineLayerCompare(srcFeature, dscFeature, bufferWidth);
- if (isSamePolyline)
- {
- lineFeatureCompare(srcFeature, dscFeature);
- globeControl1.Globe.Action = EnumAction3D.ActionNull;
- globeControl2.Globe.Action = EnumAction3D.ActionNull;
- }
- else
- {
- MessageBox.Show("实测管段与施工管段非同一条管段,请选择同一管段进行比较!", "提示");
- }
- }
- else
- {
- MessageBox.Show("无法处理该类型图层!");
- }
- }
+ if (srcFeature == null || dscFeature == null)
+ MessageBox.Show("请选择要对比的管段!", "提示");
else
{
- MessageBox.Show("请选择要对比的管段!", "提示");
+ if (srcFeature.Geometry.Type != dscFeature.Geometry.Type)
+ MessageBox.Show("请选择同种类型图层!");
+ else if (srcFeature.Geometry.Type == dscFeature.Geometry.Type &&
+ srcFeature.Geometry.Type == EnumGeometryType.GeoPolyline3D)
+ {
+ lineLayerCompare(srcFeature, dscFeature, bufferWidth);
+ if (!isSamePolyline)
+ MessageBox.Show("实测管段与施工管段非同一条管段,请选择同一管段进行比较!", "提示");
+ else
+ {
+ lineFeatureCompare(srcFeature, dscFeature);
+ globeControl1.Globe.Action = EnumAction3D.ActionNull;
+ globeControl2.Globe.Action = EnumAction3D.ActionNull;
+ }
+ }
+ else
+ {
+ MessageBox.Show("无法处理该类型图层!");
+ }
}
}
@@ -165,8 +158,8 @@
GSOGeoPolyline3D dscLine = dscFeature.Geometry as GSOGeoPolyline3D;
double dscLineLength = dscLine.GetSpaceLength(false, 6378137);
- double horizonDistance = HorizonDistance(srcLine, dscLine);
- double verticalDistance = VerticalDistance(srcLine, dscLine);
+ double horizonDistance = calculateDistance(srcLine, dscLine,false);
+ double verticalDistance = calculateDistance(srcLine, dscLine,true);
DataTable dt = new DataTable();
dt.Columns.Add("数据名称");
@@ -187,7 +180,7 @@
srcRow[6] = verticalDistance.ToString("0.000");
dt.Rows.Add(srcRow);
- DataRow dscRow=dt.NewRow();
+ DataRow dscRow = dt.NewRow();
dscRow[0] = "施工数据";
dscRow[1] = dscFeature.Dataset.Caption;
dscRow[2] = dscFeature.Name;
@@ -207,6 +200,38 @@
frm = null;
}
+ private void addPologyToGlobeControl(GSOGeoPolyline3D line, double bufferWidth)
+ {
+ new_feat = new GSOFeature();
+ resPolygon = line.CreateBuffer(bufferWidth*2, true, 0, false, false);
+ resPolygon.AltitudeMode = EnumAltitudeMode.RelativeToGround;
+ new_feat.Geometry = resPolygon;
+
+ layerTemp.AddFeature(new_feat);
+ layerTemp2.AddFeature(new_feat);
+ globeControl1.Refresh();
+ globeControl2.Refresh();
+ }
+
+ private GSOLayer getSameLayer(GSOFeature feature)
+ {
+ GSOLayer layer = null;
+ if (!feature.Dataset.Caption.StartsWith("施工"))
+ {
+ layer = feature.Dataset.Caption == "供电管线"
+ ? globeControl2.Globe.Layers.GetLayerByCaption("施工电力管线")
+ : globeControl2.Globe.Layers.GetLayerByCaption("施工" + feature.Dataset.Caption);
+ }
+ else
+ {
+ layer = feature.Dataset.Caption == "施工电力管线"
+ ? globeControl1.Globe.Layers.GetLayerByCaption("供电管线")
+ : globeControl1.Globe.Layers.GetLayerByCaption(feature.Dataset.Caption.Replace("施工", ""));
+ }
+
+ return layer;
+ }
+
///
/// 地球1中点击地球2中同步添加缓冲区
///
@@ -214,15 +239,12 @@
///
void globeControl1_MouseClick(object sender, MouseEventArgs e)
{
- //add by zhangfan
layerTemp.Visible = true;
layerTemp2.Visible = true;
GSOFeatures listFeatures = new GSOFeatures();
double maxLength = 0;
- if (globeControl1.Globe.SelectedObject == null)
- {
- }
+ if (globeControl1.Globe.SelectedObject == null) return;
else
{
clearFeatureHighLight(globeControl1, globeControl2);
@@ -230,102 +252,34 @@
{
double bufferWidth = Convert.ToDouble(textBox1.Text);
resPolygon = null;
- layerTemp.RemoveAllFeature();
- if (new_feat != null)
- {
- layerTemp2.RemoveFeatureByID(new_feat.ID);
- }
- //双屏通视增加缓冲区
- if (globeControl1.Globe.Action == EnumAction3D.SelectObject && globeControl1.Globe.SelectedObject != null)
+
+ if (globeControl1.Globe.Action == EnumAction3D.SelectObject &&
+ globeControl1.Globe.SelectedObject != null)
{
GSOGeoPolyline3D line = globeControl1.Globe.SelectedObject.Geometry as GSOGeoPolyline3D;
-
- new_feat = new GSOFeature();
- resPolygon = line.CreateBuffer(bufferWidth * 2, true, 0, false, false);
- resPolygon.AltitudeMode = EnumAltitudeMode.RelativeToGround;
-
- new_feat.Geometry = resPolygon;
- layerTemp.AddFeature(new_feat);
- layerTemp2.AddFeature(new_feat);
- globeControl1.Refresh();
- globeControl2.Refresh();
+ addPologyToGlobeControl(line, bufferWidth);
}
+
srcFeature = globeControl1.Globe.SelectedObject;
-
- //双屏同时选中同一管段
- GSOLayer layers = null;
- //获取相对图层,后续得改
- if (srcFeature.Dataset.Caption == "雨水管线")
- {
- layers = globeControl2.Globe.Layers.GetLayerByCaption("施工雨水管线");
- }
- else
- {
- if (srcFeature.Dataset.Caption == "污水管线")
- {
- layers = globeControl2.Globe.Layers.GetLayerByCaption("施工污水管线");
- }
- else
- if (srcFeature.Dataset.Caption == "供电管线")
- {
- layers = globeControl2.Globe.Layers.GetLayerByCaption("施工电力管线");
- }
- }
+ GSOLayer layers = getSameLayer(srcFeature);
GSOFeatures features = layers.FindFeaturesInPolygon(resPolygon, false);
GSOGeoPolyline3D scLine = srcFeature.Geometry as GSOGeoPolyline3D;
+
for (int i = 0; i < features.Length; i++)
{
lineLayerCompare(srcFeature, features[i], Convert.ToDouble(textBox1.Text));
if (isSamePolyline)
- {
listFeatures.Add(features[i]);
- }
}
-
- if (listFeatures.Length != 0)
- {
- if (listFeatures.Length == 1)
- {
- dscFeature = listFeatures[0];
- listFeatures[0].HighLight = true;
- }
- else
- {
- for (int m = 0; m < listFeatures.Length; m++)
- {
- GSOGeoPolyline3D tempSGLine = listFeatures[m].Geometry as GSOGeoPolyline3D;
-
- double tempLength = tempSGLine.GetSpaceLength(false, 6378137);
- double lengthAbs = Math.Abs(tempLength - scLine.GetSpaceLength(false, 6378137));
- //tempLengthList.Add(lengthAbs);
- if (m == 0)
- {
- dscFeature = listFeatures[0];
- listFeatures[0].HighLight = true;
- maxLength = lengthAbs;
- }
- else if (lengthAbs < maxLength)
- {
- dscFeature = listFeatures[m];
- listFeatures[m].HighLight = true;
- maxLength = lengthAbs;
- }
- }
- }
- }
- else
- {
- dscFeature = null;
- }
-
+ calculate(out maxLength, out dscFeature, listFeatures, scLine);
+
}
catch (Exception ex)
{
-
+ LogError.PublishError(ex);
}
}
-
}
///
@@ -335,15 +289,12 @@
///
void globeControl2_MouseClick(object sender, MouseEventArgs e)
{
- //add by zhangfan
layerTemp.Visible = true;
layerTemp2.Visible = true;
GSOFeatures listFeatures = new GSOFeatures();
double maxLength = 0;
- if (globeControl2.Globe.SelectedObject == null)
- {
- }
+ if (globeControl2.Globe.SelectedObject == null) return;
else
{
clearFeatureHighLight(globeControl1, globeControl2);
@@ -351,51 +302,23 @@
{
double bufferWidth = Convert.ToDouble(textBox1.Text);
resPolygon = null;
- layerTemp.RemoveAllFeature();
- if (new_feat != null)
- {
- layerTemp2.RemoveFeatureByID(new_feat.ID);
- }
- if (globeControl2.Globe.Action == EnumAction3D.SelectObject && globeControl2.Globe.SelectedObject != null)
+ if (globeControl2.Globe.Action != EnumAction3D.SelectObject ||
+ globeControl2.Globe.SelectedObject == null)
+ return;
+ else
{
-
GSOGeoPolyline3D line = globeControl2.Globe.SelectedObject.Geometry as GSOGeoPolyline3D;
- new_feat = new GSOFeature();
- resPolygon = line.CreateBuffer(bufferWidth * 2, true, 0, false, false);
- resPolygon.AltitudeMode = EnumAltitudeMode.RelativeToGround;
-
- new_feat.Geometry = resPolygon;
- layerTemp.AddFeature(new_feat);
- layerTemp2.AddFeature(new_feat);
- globeControl1.Refresh();
- globeControl2.Refresh();
+ addPologyToGlobeControl(line, bufferWidth);
}
dscFeature = globeControl2.Globe.SelectedObject;
//双屏同时选中同一管段
- GSOLayer layers = null;
- //获取相对图层,后续得改
- if (dscFeature.Dataset.Caption == "施工雨水管线")
- {
- layers = globeControl1.Globe.Layers.GetLayerByCaption("雨水管线");
- }
- else
- {
- if (dscFeature.Dataset.Caption == "施工污水管线")
- {
- layers = globeControl1.Globe.Layers.GetLayerByCaption("污水管线");
- }
- else
- if (dscFeature.Dataset.Caption == "施工电力管线")
- {
- layers = globeControl1.Globe.Layers.GetLayerByCaption("供电管线");
- }
- }
+ GSOLayer layers = getSameLayer(dscFeature);
GSOFeatures features = layers.FindFeaturesInPolygon(resPolygon, false);
- GSOGeoPolyline3D scLine = srcFeature.Geometry as GSOGeoPolyline3D;
+ GSOGeoPolyline3D scLine = dscFeature.Geometry as GSOGeoPolyline3D;
for (int i = 0; i < features.Length; i++)
{
@@ -405,94 +328,83 @@
listFeatures.Add(features[i]);
}
}
+ calculate(out maxLength, out srcFeature, listFeatures, scLine);
- if (listFeatures.Length != 0)
+ }
+ catch (Exception ex)
+ {
+ LogError.PublishError(ex);
+ }
+ }
+ }
+
+ private void calculate(out double maxLength, out GSOFeature feature, GSOFeatures listFeatures,
+ GSOGeoPolyline3D scLine)
+ {
+ maxLength = 0;
+ feature=new GSOFeature();
+ if (listFeatures.Length == 0)
+ feature = null;
+ else
+ {
+ if (listFeatures.Length == 1)
+ {
+ feature = listFeatures[0];
+ listFeatures[0].HighLight = true;
+ }
+ else
+ {
+ for (int m = 0; m < listFeatures.Length; m++)
{
- if (listFeatures.Length == 1)
+ GSOGeoPolyline3D tempSGLine = listFeatures[m].Geometry as GSOGeoPolyline3D;
+
+ double tempLength = tempSGLine.GetSpaceLength(false, 6378137);
+ double lengthAbs = Math.Abs(tempLength - scLine.GetSpaceLength(false, 6378137));
+ if (m == 0)
{
- srcFeature = listFeatures[0];
+ feature = listFeatures[0];
listFeatures[0].HighLight = true;
+ maxLength = lengthAbs;
}
- else
+ else if (lengthAbs < maxLength)
{
- for (int m = 0; m < listFeatures.Length; m++)
- {
- GSOGeoPolyline3D tempSGLine = listFeatures[m].Geometry as GSOGeoPolyline3D;
-
- double tempLength = tempSGLine.GetSpaceLength(false, 6378137);
- double lengthAbs = Math.Abs(tempLength - scLine.GetSpaceLength(false, 6378137));
- //tempLengthList.Add(lengthAbs);
- if (m == 0)
- {
- srcFeature = listFeatures[0];
- listFeatures[0].HighLight = true;
- maxLength = lengthAbs;
- }
- else if (lengthAbs < maxLength)
- {
- srcFeature = listFeatures[m];
- listFeatures[m].HighLight = true;
- maxLength = lengthAbs;
- }
- }
+ feature = listFeatures[m];
+ listFeatures[m].HighLight = true;
+ maxLength = lengthAbs;
}
}
- else
- {
- srcFeature = null;
- }
}
- catch (Exception ex) { }
+ }
+ }
+
+ ///
+ /// 计算距离
+ ///
+ ///
+ ///
+ ///
+ double calculateDistance(GSOGeoPolyline3D line1, GSOGeoPolyline3D line2,bool isVertical)
+ {
+ GSOPoint3d pntIntersect1 = new GSOPoint3d();
+ GSOPoint3d pntIntersect2 = new GSOPoint3d();
+ GSOPoint3d pntProIntersect1 = new GSOPoint3d();
+ GSOPoint3d pntProIntersect2 = new GSOPoint3d();
+ double dDist = 0;
+ if (isVertical)
+ {
+ dDist = globeControl1.Globe.Analysis3D.ComputeVerticalDistance(line1, line2,
+ out pntIntersect1, out pntIntersect2, out pntProIntersect1, out pntProIntersect2, false);
+
+ LabelDistance(layerTemp, layerTemp2, pntProIntersect1, pntProIntersect2, dDist, true, "垂直");
+ }
+ else
+ {
+ dDist = globeControl1.Globe.Analysis3D.ComputeHorizonDistance(line1, line2,
+ out pntIntersect1, out pntIntersect2, out pntProIntersect1, out pntProIntersect2, false);
+
+ LabelDistance(layerTemp, layerTemp2, pntProIntersect1, pntProIntersect2, dDist, true, "水平");
}
- }
-
- ///
- /// 计算水平距离
- ///
- ///
- ///
- ///
- private double HorizonDistance(GSOGeoPolyline3D line1, GSOGeoPolyline3D line2)
- {
-
- GSOPoint3d pntIntersect1 = new GSOPoint3d();
- GSOPoint3d pntIntersect2 = new GSOPoint3d();
- GSOPoint3d pntProIntersect1 = new GSOPoint3d();
- GSOPoint3d pntProIntersect2 = new GSOPoint3d();
-
- GSOPipeLineStyle3D pipeStyle1 = line1.Style as GSOPipeLineStyle3D;
- GSOPipeLineStyle3D pipeStyle2 = line2.Style as GSOPipeLineStyle3D;
-
- double dDist = globeControl1.Globe.Analysis3D.ComputeHorizonDistance(line1, line2, out pntIntersect1, out pntIntersect2, out pntProIntersect1, out pntProIntersect2, false);
-
- GSOPoint3d markerPosition = new GSOPoint3d();
- markerPosition = LabelHorizontalDistance(layerTemp, layerTemp2, pntProIntersect1, pntProIntersect2, dDist, true);
-
- return dDist;
- }
-
- ///
- /// 计算垂直距离
- ///
- ///
- ///
- ///
- private double VerticalDistance(GSOGeoPolyline3D line1, GSOGeoPolyline3D line2)
- {
- GSOPoint3d pntIntersect1 = new GSOPoint3d();
- GSOPoint3d pntIntersect2 = new GSOPoint3d();
- GSOPoint3d pntProIntersect1 = new GSOPoint3d();
- GSOPoint3d pntProIntersect2 = new GSOPoint3d();
-
- GSOPipeLineStyle3D pipeStyle1 = line1.Style as GSOPipeLineStyle3D;
- GSOPipeLineStyle3D pipeStyle2 = line2.Style as GSOPipeLineStyle3D;
-
- double dDist = globeControl1.Globe.Analysis3D.ComputeVerticalDistance(line1, line2, out pntIntersect1, out pntIntersect2, out pntProIntersect1, out pntProIntersect2, false);
-
- GSOPoint3d markerPosition = new GSOPoint3d();
- markerPosition = LabelVerticalDistance(layerTemp, layerTemp2, pntProIntersect1, pntProIntersect2, dDist, true);
-
return dDist;
}
@@ -502,42 +414,36 @@
///
private void clearFeatureHighLight(GSOGlobeControl glb1,GSOGlobeControl glb2)
{
-
layerTemp.RemoveAllFeature();
layerTemp2.RemoveAllFeature();
//清除gbl1中高亮
for (int i = 0; i < glb1.Globe.Layers.Count; i++)
{
GSOLayer layer = glb1.Globe.Layers[i];
- if (layer is GSOFeatureLayer)
+ if (!(layer is GSOFeatureLayer)) continue;
+ GSOFeatures feats = layer.GetAllFeatures();
+ for (int j = 0; j < feats.Length; j++)
{
- GSOFeatures feats = layer.GetAllFeatures();
- for (int j = 0; j < feats.Length; j++)
- {
- GSOFeature feat = feats[j];
- feat.HighLight = false;
-
- }
+ GSOFeature feat = feats[j];
+ feat.HighLight = false;
}
}
//清除gbl2中高亮
for (int i = 0; i < glb2.Globe.Layers.Count; i++)
{
GSOLayer layer = glb2.Globe.Layers[i];
- if (layer is GSOFeatureLayer)
+ if (!(layer is GSOFeatureLayer)) continue;
+ GSOFeatures feats = layer.GetAllFeatures();
+ for (int j = 0; j < feats.Length; j++)
{
- GSOFeatures feats = layer.GetAllFeatures();
- for (int j = 0; j < feats.Length; j++)
- {
- GSOFeature feat = feats[j];
- feat.HighLight = false;
- }
+ GSOFeature feat = feats[j];
+ feat.HighLight = false;
}
}
}
///
- /// 添加垂直标注
+ /// 添加标注
///
///
///
@@ -545,34 +451,60 @@
///
///
///
- private GSOPoint3d LabelVerticalDistance(GSOLayer markerLayer, GSOLayer markerLayer2, GSOPoint3d pntIntersect1, GSOPoint3d pntIntersect2, double distance, bool markerVisible)
+ private GSOPoint3d LabelDistance(GSOLayer markerLayer, GSOLayer markerLayer2,
+ GSOPoint3d pntIntersect1, GSOPoint3d pntIntersect2, double distance, bool markerVisible,string label)
{
if (pntIntersect1 == null || pntIntersect2 == null)
- {
return new GSOPoint3d();
- }
GSOGeoPolyline3D disline = new GSOGeoPolyline3D();
GSOPoint3ds point3ds = new GSOPoint3ds();
point3ds.Add(pntIntersect1);
point3ds.Add(pntIntersect2);
disline.AddPart(point3ds);
- GSOSimpleLineStyle3D style = new GSOSimpleLineStyle3D();//创建线的风格
- //设置透明度及颜色,FromArgb()中的四个参数分别为alpha、red、green、blue,取值范围为0到255
+
+ GSOGeoMarker dismarker = new GSOGeoMarker();
+ GSOFeature marker = null;
+ GSOFeature line = null;
+ createLineStyle(out marker, out line,disline, pntIntersect1, pntIntersect2, distance, label, dismarker);
+
+ line.Visible = marker.Visible = markerVisible;
+ markerLayer.AddFeature(line);
+ markerLayer.AddFeature(marker);
+
+ markerLayer2.AddFeature(line);
+ markerLayer2.AddFeature(marker);
+
+ return dismarker.Position;
+ }
+ ///
+ /// 控制标注和字体的颜色
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ private void createLineStyle(out GSOFeature marker,out GSOFeature line,GSOGeoPolyline3D disline,
+ GSOPoint3d pntIntersect1,GSOPoint3d pntIntersect2, double distance, string label, GSOGeoMarker dismarker)
+ {
+ GSOSimpleLineStyle3D style = new GSOSimpleLineStyle3D(); //创建线的风格
style.LineColor = Color.Red;
style.LineWidth = 5; //设置线的宽度为5
style.VertexVisible = true; //显示线的节点
disline.Style = style; //把风格添加到线上
disline.AltitudeMode = EnumAltitudeMode.Absolute;
-
- GSOFeature line = new GSOFeature();
+ line=new GSOFeature();
line.Geometry = disline;
- GSOGeoMarker dismarker = new GSOGeoMarker();
dismarker.X = pntIntersect1.X;
dismarker.Y = pntIntersect1.Y;
dismarker.Z = (pntIntersect1.Z + pntIntersect2.Z) / 2;
- dismarker.Text = "垂直" + distance.ToString("0.00") + "米";
+ dismarker.Text = label + distance.ToString("0.00") + "米";
dismarker.AltitudeMode = EnumAltitudeMode.Absolute;
+
GSOMarkerStyle3D styleMarker = new GSOMarkerStyle3D();
GSOTextStyle styleText = new GSOTextStyle();
styleText.IsSizeFixed = true;
@@ -581,77 +513,9 @@
styleMarker.TextStyle = styleText;
dismarker.Style = styleMarker;
- GSOFeature marker = new GSOFeature();
+ marker=new GSOFeature();
marker.Geometry = dismarker;
-
- line.Visible = marker.Visible = markerVisible;
- markerLayer.AddFeature(line);
- markerLayer.AddFeature(marker);
-
- markerLayer2.AddFeature(line);
- markerLayer2.AddFeature(marker);
-
- return dismarker.Position;
}
-
- ///
- /// 添加水平标注
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- private GSOPoint3d LabelHorizontalDistance(GSOLayer markerLayer, GSOLayer markerLayer2, GSOPoint3d pntIntersect1, GSOPoint3d pntIntersect2, double distance, bool markerVisible)
- {
- if (pntIntersect1 == null || pntIntersect2 == null)
- {
- return new GSOPoint3d();
- }
- GSOGeoPolyline3D disline = new GSOGeoPolyline3D();
- GSOPoint3ds point3ds = new GSOPoint3ds();
- point3ds.Add(pntIntersect1);
- point3ds.Add(pntIntersect2);
- disline.AddPart(point3ds);
- GSOSimpleLineStyle3D style = new GSOSimpleLineStyle3D(); //创建线的风格
- //设置透明度及颜色,FromArgb()中的四个参数分别为alpha、red、green、blue,取值范围为0到255
- style.LineColor = Color.Red;
- style.LineWidth = 5; //设置线的宽度为3
- style.VertexVisible = true; //显示线的节点
- disline.Style = style; //把风格添加到线上
- disline.AltitudeMode = EnumAltitudeMode.Absolute;
-
- GSOFeature line = new GSOFeature();
- line.Geometry = disline;
-
- GSOGeoMarker dismarker = new GSOGeoMarker();
- dismarker.X = pntIntersect1.X;
- dismarker.Y = pntIntersect1.Y;
- dismarker.Z = (pntIntersect1.Z + pntIntersect2.Z) / 2;
- dismarker.Text = "水平" + distance.ToString("0.00") + "米";
- dismarker.AltitudeMode = EnumAltitudeMode.Absolute;
- GSOMarkerStyle3D styleMarker = new GSOMarkerStyle3D();
- GSOTextStyle styleText = new GSOTextStyle();
- styleText.IsSizeFixed = true;
- styleText.ForeColor = Color.Red;
- styleText.FontSize = 20;
- styleMarker.TextStyle = styleText;
- dismarker.Style = styleMarker;
-
- GSOFeature marker = new GSOFeature();
- marker.Geometry = dismarker;
-
- line.Visible = marker.Visible = markerVisible;
- markerLayer.AddFeature(line);
- markerLayer.AddFeature(marker);
-
- markerLayer2.AddFeature(line);
- markerLayer2.AddFeature(marker);
-
- return dismarker.Position;
- }
-
}
}
diff --git a/Cyberpipe.suo b/Cyberpipe.suo
index 2b3fc7a..c87d798 100644
--- a/Cyberpipe.suo
+++ b/Cyberpipe.suo
Binary files differ
diff --git a/FrmCompareFeature.cs b/FrmCompareFeature.cs
index 74fa33e..71323e5 100644
--- a/FrmCompareFeature.cs
+++ b/FrmCompareFeature.cs
@@ -23,14 +23,15 @@
GSOGeoPolygon3D resPolygon;
static FrmCompareFeature frm;
- public static void ShowForm(GSOGlobeControl _globeControl1, GSOGlobeControl _globeControl2,
+
+ public static void ShowForm(GSOGlobeControl _globeControl1, GSOGlobeControl _globeControl2,
GSOLayer _layerTemp, GSOLayer _layerTemp2, int width)
{
if (frm == null)
{
frm = new FrmCompareFeature(_globeControl1, _globeControl2, _layerTemp, _layerTemp2);
- frm.Location = new Point((width - frm.Width) / 2, 50);
+ frm.Location = new Point((width - frm.Width)/2, 50);
frm.Show(_globeControl1.Parent);
}
else
@@ -40,7 +41,7 @@
}
}
- public FrmCompareFeature(GSOGlobeControl _globeControl1, GSOGlobeControl _globeControl2,
+ public FrmCompareFeature(GSOGlobeControl _globeControl1, GSOGlobeControl _globeControl2,
GSOLayer _layerTemp, GSOLayer _layerTemp2)
{
globeControl1 = _globeControl1;
@@ -51,7 +52,7 @@
globeControl2.Globe.Action = EnumAction3D.SelectObject;
layerTemp = _layerTemp;
layerTemp2 = _layerTemp2;
-
+
globeControl1.MouseClick += globeControl1_MouseClick;
globeControl2.MouseClick += globeControl2_MouseClick;
}
@@ -62,37 +63,29 @@
double bufferWidth = Convert.ToDouble(textBox1.Text);
- if (srcFeature != null && dscFeature != null)
- {
- if (srcFeature.Geometry.Type != dscFeature.Geometry.Type)
- {
- MessageBox.Show("请选择同种类型图层!");
- }
-
- //TODO LIST按缓冲区的方式处理线的方式
- else
- if (srcFeature.Geometry.Type == dscFeature.Geometry.Type && srcFeature.Geometry.Type == EnumGeometryType.GeoPolyline3D)
- {
- lineLayerCompare(srcFeature, dscFeature, bufferWidth);
- if (isSamePolyline)
- {
- lineFeatureCompare(srcFeature, dscFeature);
- globeControl1.Globe.Action = EnumAction3D.ActionNull;
- globeControl2.Globe.Action = EnumAction3D.ActionNull;
- }
- else
- {
- MessageBox.Show("实测管段与施工管段非同一条管段,请选择同一管段进行比较!", "提示");
- }
- }
- else
- {
- MessageBox.Show("无法处理该类型图层!");
- }
- }
+ if (srcFeature == null || dscFeature == null)
+ MessageBox.Show("请选择要对比的管段!", "提示");
else
{
- MessageBox.Show("请选择要对比的管段!", "提示");
+ if (srcFeature.Geometry.Type != dscFeature.Geometry.Type)
+ MessageBox.Show("请选择同种类型图层!");
+ else if (srcFeature.Geometry.Type == dscFeature.Geometry.Type &&
+ srcFeature.Geometry.Type == EnumGeometryType.GeoPolyline3D)
+ {
+ lineLayerCompare(srcFeature, dscFeature, bufferWidth);
+ if (!isSamePolyline)
+ MessageBox.Show("实测管段与施工管段非同一条管段,请选择同一管段进行比较!", "提示");
+ else
+ {
+ lineFeatureCompare(srcFeature, dscFeature);
+ globeControl1.Globe.Action = EnumAction3D.ActionNull;
+ globeControl2.Globe.Action = EnumAction3D.ActionNull;
+ }
+ }
+ else
+ {
+ MessageBox.Show("无法处理该类型图层!");
+ }
}
}
@@ -165,8 +158,8 @@
GSOGeoPolyline3D dscLine = dscFeature.Geometry as GSOGeoPolyline3D;
double dscLineLength = dscLine.GetSpaceLength(false, 6378137);
- double horizonDistance = HorizonDistance(srcLine, dscLine);
- double verticalDistance = VerticalDistance(srcLine, dscLine);
+ double horizonDistance = calculateDistance(srcLine, dscLine,false);
+ double verticalDistance = calculateDistance(srcLine, dscLine,true);
DataTable dt = new DataTable();
dt.Columns.Add("数据名称");
@@ -187,7 +180,7 @@
srcRow[6] = verticalDistance.ToString("0.000");
dt.Rows.Add(srcRow);
- DataRow dscRow=dt.NewRow();
+ DataRow dscRow = dt.NewRow();
dscRow[0] = "施工数据";
dscRow[1] = dscFeature.Dataset.Caption;
dscRow[2] = dscFeature.Name;
@@ -207,6 +200,38 @@
frm = null;
}
+ private void addPologyToGlobeControl(GSOGeoPolyline3D line, double bufferWidth)
+ {
+ new_feat = new GSOFeature();
+ resPolygon = line.CreateBuffer(bufferWidth*2, true, 0, false, false);
+ resPolygon.AltitudeMode = EnumAltitudeMode.RelativeToGround;
+ new_feat.Geometry = resPolygon;
+
+ layerTemp.AddFeature(new_feat);
+ layerTemp2.AddFeature(new_feat);
+ globeControl1.Refresh();
+ globeControl2.Refresh();
+ }
+
+ private GSOLayer getSameLayer(GSOFeature feature)
+ {
+ GSOLayer layer = null;
+ if (!feature.Dataset.Caption.StartsWith("施工"))
+ {
+ layer = feature.Dataset.Caption == "供电管线"
+ ? globeControl2.Globe.Layers.GetLayerByCaption("施工电力管线")
+ : globeControl2.Globe.Layers.GetLayerByCaption("施工" + feature.Dataset.Caption);
+ }
+ else
+ {
+ layer = feature.Dataset.Caption == "施工电力管线"
+ ? globeControl1.Globe.Layers.GetLayerByCaption("供电管线")
+ : globeControl1.Globe.Layers.GetLayerByCaption(feature.Dataset.Caption.Replace("施工", ""));
+ }
+
+ return layer;
+ }
+
///
/// 地球1中点击地球2中同步添加缓冲区
///
@@ -214,15 +239,12 @@
///
void globeControl1_MouseClick(object sender, MouseEventArgs e)
{
- //add by zhangfan
layerTemp.Visible = true;
layerTemp2.Visible = true;
GSOFeatures listFeatures = new GSOFeatures();
double maxLength = 0;
- if (globeControl1.Globe.SelectedObject == null)
- {
- }
+ if (globeControl1.Globe.SelectedObject == null) return;
else
{
clearFeatureHighLight(globeControl1, globeControl2);
@@ -230,102 +252,34 @@
{
double bufferWidth = Convert.ToDouble(textBox1.Text);
resPolygon = null;
- layerTemp.RemoveAllFeature();
- if (new_feat != null)
- {
- layerTemp2.RemoveFeatureByID(new_feat.ID);
- }
- //双屏通视增加缓冲区
- if (globeControl1.Globe.Action == EnumAction3D.SelectObject && globeControl1.Globe.SelectedObject != null)
+
+ if (globeControl1.Globe.Action == EnumAction3D.SelectObject &&
+ globeControl1.Globe.SelectedObject != null)
{
GSOGeoPolyline3D line = globeControl1.Globe.SelectedObject.Geometry as GSOGeoPolyline3D;
-
- new_feat = new GSOFeature();
- resPolygon = line.CreateBuffer(bufferWidth * 2, true, 0, false, false);
- resPolygon.AltitudeMode = EnumAltitudeMode.RelativeToGround;
-
- new_feat.Geometry = resPolygon;
- layerTemp.AddFeature(new_feat);
- layerTemp2.AddFeature(new_feat);
- globeControl1.Refresh();
- globeControl2.Refresh();
+ addPologyToGlobeControl(line, bufferWidth);
}
+
srcFeature = globeControl1.Globe.SelectedObject;
-
- //双屏同时选中同一管段
- GSOLayer layers = null;
- //获取相对图层,后续得改
- if (srcFeature.Dataset.Caption == "雨水管线")
- {
- layers = globeControl2.Globe.Layers.GetLayerByCaption("施工雨水管线");
- }
- else
- {
- if (srcFeature.Dataset.Caption == "污水管线")
- {
- layers = globeControl2.Globe.Layers.GetLayerByCaption("施工污水管线");
- }
- else
- if (srcFeature.Dataset.Caption == "供电管线")
- {
- layers = globeControl2.Globe.Layers.GetLayerByCaption("施工电力管线");
- }
- }
+ GSOLayer layers = getSameLayer(srcFeature);
GSOFeatures features = layers.FindFeaturesInPolygon(resPolygon, false);
GSOGeoPolyline3D scLine = srcFeature.Geometry as GSOGeoPolyline3D;
+
for (int i = 0; i < features.Length; i++)
{
lineLayerCompare(srcFeature, features[i], Convert.ToDouble(textBox1.Text));
if (isSamePolyline)
- {
listFeatures.Add(features[i]);
- }
}
-
- if (listFeatures.Length != 0)
- {
- if (listFeatures.Length == 1)
- {
- dscFeature = listFeatures[0];
- listFeatures[0].HighLight = true;
- }
- else
- {
- for (int m = 0; m < listFeatures.Length; m++)
- {
- GSOGeoPolyline3D tempSGLine = listFeatures[m].Geometry as GSOGeoPolyline3D;
-
- double tempLength = tempSGLine.GetSpaceLength(false, 6378137);
- double lengthAbs = Math.Abs(tempLength - scLine.GetSpaceLength(false, 6378137));
- //tempLengthList.Add(lengthAbs);
- if (m == 0)
- {
- dscFeature = listFeatures[0];
- listFeatures[0].HighLight = true;
- maxLength = lengthAbs;
- }
- else if (lengthAbs < maxLength)
- {
- dscFeature = listFeatures[m];
- listFeatures[m].HighLight = true;
- maxLength = lengthAbs;
- }
- }
- }
- }
- else
- {
- dscFeature = null;
- }
-
+ calculate(out maxLength, out dscFeature, listFeatures, scLine);
+
}
catch (Exception ex)
{
-
+ LogError.PublishError(ex);
}
}
-
}
///
@@ -335,15 +289,12 @@
///
void globeControl2_MouseClick(object sender, MouseEventArgs e)
{
- //add by zhangfan
layerTemp.Visible = true;
layerTemp2.Visible = true;
GSOFeatures listFeatures = new GSOFeatures();
double maxLength = 0;
- if (globeControl2.Globe.SelectedObject == null)
- {
- }
+ if (globeControl2.Globe.SelectedObject == null) return;
else
{
clearFeatureHighLight(globeControl1, globeControl2);
@@ -351,51 +302,23 @@
{
double bufferWidth = Convert.ToDouble(textBox1.Text);
resPolygon = null;
- layerTemp.RemoveAllFeature();
- if (new_feat != null)
- {
- layerTemp2.RemoveFeatureByID(new_feat.ID);
- }
- if (globeControl2.Globe.Action == EnumAction3D.SelectObject && globeControl2.Globe.SelectedObject != null)
+ if (globeControl2.Globe.Action != EnumAction3D.SelectObject ||
+ globeControl2.Globe.SelectedObject == null)
+ return;
+ else
{
-
GSOGeoPolyline3D line = globeControl2.Globe.SelectedObject.Geometry as GSOGeoPolyline3D;
- new_feat = new GSOFeature();
- resPolygon = line.CreateBuffer(bufferWidth * 2, true, 0, false, false);
- resPolygon.AltitudeMode = EnumAltitudeMode.RelativeToGround;
-
- new_feat.Geometry = resPolygon;
- layerTemp.AddFeature(new_feat);
- layerTemp2.AddFeature(new_feat);
- globeControl1.Refresh();
- globeControl2.Refresh();
+ addPologyToGlobeControl(line, bufferWidth);
}
dscFeature = globeControl2.Globe.SelectedObject;
//双屏同时选中同一管段
- GSOLayer layers = null;
- //获取相对图层,后续得改
- if (dscFeature.Dataset.Caption == "施工雨水管线")
- {
- layers = globeControl1.Globe.Layers.GetLayerByCaption("雨水管线");
- }
- else
- {
- if (dscFeature.Dataset.Caption == "施工污水管线")
- {
- layers = globeControl1.Globe.Layers.GetLayerByCaption("污水管线");
- }
- else
- if (dscFeature.Dataset.Caption == "施工电力管线")
- {
- layers = globeControl1.Globe.Layers.GetLayerByCaption("供电管线");
- }
- }
+ GSOLayer layers = getSameLayer(dscFeature);
GSOFeatures features = layers.FindFeaturesInPolygon(resPolygon, false);
- GSOGeoPolyline3D scLine = srcFeature.Geometry as GSOGeoPolyline3D;
+ GSOGeoPolyline3D scLine = dscFeature.Geometry as GSOGeoPolyline3D;
for (int i = 0; i < features.Length; i++)
{
@@ -405,94 +328,83 @@
listFeatures.Add(features[i]);
}
}
+ calculate(out maxLength, out srcFeature, listFeatures, scLine);
- if (listFeatures.Length != 0)
+ }
+ catch (Exception ex)
+ {
+ LogError.PublishError(ex);
+ }
+ }
+ }
+
+ private void calculate(out double maxLength, out GSOFeature feature, GSOFeatures listFeatures,
+ GSOGeoPolyline3D scLine)
+ {
+ maxLength = 0;
+ feature=new GSOFeature();
+ if (listFeatures.Length == 0)
+ feature = null;
+ else
+ {
+ if (listFeatures.Length == 1)
+ {
+ feature = listFeatures[0];
+ listFeatures[0].HighLight = true;
+ }
+ else
+ {
+ for (int m = 0; m < listFeatures.Length; m++)
{
- if (listFeatures.Length == 1)
+ GSOGeoPolyline3D tempSGLine = listFeatures[m].Geometry as GSOGeoPolyline3D;
+
+ double tempLength = tempSGLine.GetSpaceLength(false, 6378137);
+ double lengthAbs = Math.Abs(tempLength - scLine.GetSpaceLength(false, 6378137));
+ if (m == 0)
{
- srcFeature = listFeatures[0];
+ feature = listFeatures[0];
listFeatures[0].HighLight = true;
+ maxLength = lengthAbs;
}
- else
+ else if (lengthAbs < maxLength)
{
- for (int m = 0; m < listFeatures.Length; m++)
- {
- GSOGeoPolyline3D tempSGLine = listFeatures[m].Geometry as GSOGeoPolyline3D;
-
- double tempLength = tempSGLine.GetSpaceLength(false, 6378137);
- double lengthAbs = Math.Abs(tempLength - scLine.GetSpaceLength(false, 6378137));
- //tempLengthList.Add(lengthAbs);
- if (m == 0)
- {
- srcFeature = listFeatures[0];
- listFeatures[0].HighLight = true;
- maxLength = lengthAbs;
- }
- else if (lengthAbs < maxLength)
- {
- srcFeature = listFeatures[m];
- listFeatures[m].HighLight = true;
- maxLength = lengthAbs;
- }
- }
+ feature = listFeatures[m];
+ listFeatures[m].HighLight = true;
+ maxLength = lengthAbs;
}
}
- else
- {
- srcFeature = null;
- }
}
- catch (Exception ex) { }
+ }
+ }
+
+ ///
+ /// 计算距离
+ ///
+ ///
+ ///
+ ///
+ double calculateDistance(GSOGeoPolyline3D line1, GSOGeoPolyline3D line2,bool isVertical)
+ {
+ GSOPoint3d pntIntersect1 = new GSOPoint3d();
+ GSOPoint3d pntIntersect2 = new GSOPoint3d();
+ GSOPoint3d pntProIntersect1 = new GSOPoint3d();
+ GSOPoint3d pntProIntersect2 = new GSOPoint3d();
+ double dDist = 0;
+ if (isVertical)
+ {
+ dDist = globeControl1.Globe.Analysis3D.ComputeVerticalDistance(line1, line2,
+ out pntIntersect1, out pntIntersect2, out pntProIntersect1, out pntProIntersect2, false);
+
+ LabelDistance(layerTemp, layerTemp2, pntProIntersect1, pntProIntersect2, dDist, true, "垂直");
+ }
+ else
+ {
+ dDist = globeControl1.Globe.Analysis3D.ComputeHorizonDistance(line1, line2,
+ out pntIntersect1, out pntIntersect2, out pntProIntersect1, out pntProIntersect2, false);
+
+ LabelDistance(layerTemp, layerTemp2, pntProIntersect1, pntProIntersect2, dDist, true, "水平");
}
- }
-
- ///
- /// 计算水平距离
- ///
- ///
- ///
- ///
- private double HorizonDistance(GSOGeoPolyline3D line1, GSOGeoPolyline3D line2)
- {
-
- GSOPoint3d pntIntersect1 = new GSOPoint3d();
- GSOPoint3d pntIntersect2 = new GSOPoint3d();
- GSOPoint3d pntProIntersect1 = new GSOPoint3d();
- GSOPoint3d pntProIntersect2 = new GSOPoint3d();
-
- GSOPipeLineStyle3D pipeStyle1 = line1.Style as GSOPipeLineStyle3D;
- GSOPipeLineStyle3D pipeStyle2 = line2.Style as GSOPipeLineStyle3D;
-
- double dDist = globeControl1.Globe.Analysis3D.ComputeHorizonDistance(line1, line2, out pntIntersect1, out pntIntersect2, out pntProIntersect1, out pntProIntersect2, false);
-
- GSOPoint3d markerPosition = new GSOPoint3d();
- markerPosition = LabelHorizontalDistance(layerTemp, layerTemp2, pntProIntersect1, pntProIntersect2, dDist, true);
-
- return dDist;
- }
-
- ///
- /// 计算垂直距离
- ///
- ///
- ///
- ///
- private double VerticalDistance(GSOGeoPolyline3D line1, GSOGeoPolyline3D line2)
- {
- GSOPoint3d pntIntersect1 = new GSOPoint3d();
- GSOPoint3d pntIntersect2 = new GSOPoint3d();
- GSOPoint3d pntProIntersect1 = new GSOPoint3d();
- GSOPoint3d pntProIntersect2 = new GSOPoint3d();
-
- GSOPipeLineStyle3D pipeStyle1 = line1.Style as GSOPipeLineStyle3D;
- GSOPipeLineStyle3D pipeStyle2 = line2.Style as GSOPipeLineStyle3D;
-
- double dDist = globeControl1.Globe.Analysis3D.ComputeVerticalDistance(line1, line2, out pntIntersect1, out pntIntersect2, out pntProIntersect1, out pntProIntersect2, false);
-
- GSOPoint3d markerPosition = new GSOPoint3d();
- markerPosition = LabelVerticalDistance(layerTemp, layerTemp2, pntProIntersect1, pntProIntersect2, dDist, true);
-
return dDist;
}
@@ -502,42 +414,36 @@
///
private void clearFeatureHighLight(GSOGlobeControl glb1,GSOGlobeControl glb2)
{
-
layerTemp.RemoveAllFeature();
layerTemp2.RemoveAllFeature();
//清除gbl1中高亮
for (int i = 0; i < glb1.Globe.Layers.Count; i++)
{
GSOLayer layer = glb1.Globe.Layers[i];
- if (layer is GSOFeatureLayer)
+ if (!(layer is GSOFeatureLayer)) continue;
+ GSOFeatures feats = layer.GetAllFeatures();
+ for (int j = 0; j < feats.Length; j++)
{
- GSOFeatures feats = layer.GetAllFeatures();
- for (int j = 0; j < feats.Length; j++)
- {
- GSOFeature feat = feats[j];
- feat.HighLight = false;
-
- }
+ GSOFeature feat = feats[j];
+ feat.HighLight = false;
}
}
//清除gbl2中高亮
for (int i = 0; i < glb2.Globe.Layers.Count; i++)
{
GSOLayer layer = glb2.Globe.Layers[i];
- if (layer is GSOFeatureLayer)
+ if (!(layer is GSOFeatureLayer)) continue;
+ GSOFeatures feats = layer.GetAllFeatures();
+ for (int j = 0; j < feats.Length; j++)
{
- GSOFeatures feats = layer.GetAllFeatures();
- for (int j = 0; j < feats.Length; j++)
- {
- GSOFeature feat = feats[j];
- feat.HighLight = false;
- }
+ GSOFeature feat = feats[j];
+ feat.HighLight = false;
}
}
}
///
- /// 添加垂直标注
+ /// 添加标注
///
///
///
@@ -545,34 +451,60 @@
///
///
///
- private GSOPoint3d LabelVerticalDistance(GSOLayer markerLayer, GSOLayer markerLayer2, GSOPoint3d pntIntersect1, GSOPoint3d pntIntersect2, double distance, bool markerVisible)
+ private GSOPoint3d LabelDistance(GSOLayer markerLayer, GSOLayer markerLayer2,
+ GSOPoint3d pntIntersect1, GSOPoint3d pntIntersect2, double distance, bool markerVisible,string label)
{
if (pntIntersect1 == null || pntIntersect2 == null)
- {
return new GSOPoint3d();
- }
GSOGeoPolyline3D disline = new GSOGeoPolyline3D();
GSOPoint3ds point3ds = new GSOPoint3ds();
point3ds.Add(pntIntersect1);
point3ds.Add(pntIntersect2);
disline.AddPart(point3ds);
- GSOSimpleLineStyle3D style = new GSOSimpleLineStyle3D();//创建线的风格
- //设置透明度及颜色,FromArgb()中的四个参数分别为alpha、red、green、blue,取值范围为0到255
+
+ GSOGeoMarker dismarker = new GSOGeoMarker();
+ GSOFeature marker = null;
+ GSOFeature line = null;
+ createLineStyle(out marker, out line,disline, pntIntersect1, pntIntersect2, distance, label, dismarker);
+
+ line.Visible = marker.Visible = markerVisible;
+ markerLayer.AddFeature(line);
+ markerLayer.AddFeature(marker);
+
+ markerLayer2.AddFeature(line);
+ markerLayer2.AddFeature(marker);
+
+ return dismarker.Position;
+ }
+ ///
+ /// 控制标注和字体的颜色
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ private void createLineStyle(out GSOFeature marker,out GSOFeature line,GSOGeoPolyline3D disline,
+ GSOPoint3d pntIntersect1,GSOPoint3d pntIntersect2, double distance, string label, GSOGeoMarker dismarker)
+ {
+ GSOSimpleLineStyle3D style = new GSOSimpleLineStyle3D(); //创建线的风格
style.LineColor = Color.Red;
style.LineWidth = 5; //设置线的宽度为5
style.VertexVisible = true; //显示线的节点
disline.Style = style; //把风格添加到线上
disline.AltitudeMode = EnumAltitudeMode.Absolute;
-
- GSOFeature line = new GSOFeature();
+ line=new GSOFeature();
line.Geometry = disline;
- GSOGeoMarker dismarker = new GSOGeoMarker();
dismarker.X = pntIntersect1.X;
dismarker.Y = pntIntersect1.Y;
dismarker.Z = (pntIntersect1.Z + pntIntersect2.Z) / 2;
- dismarker.Text = "垂直" + distance.ToString("0.00") + "米";
+ dismarker.Text = label + distance.ToString("0.00") + "米";
dismarker.AltitudeMode = EnumAltitudeMode.Absolute;
+
GSOMarkerStyle3D styleMarker = new GSOMarkerStyle3D();
GSOTextStyle styleText = new GSOTextStyle();
styleText.IsSizeFixed = true;
@@ -581,77 +513,9 @@
styleMarker.TextStyle = styleText;
dismarker.Style = styleMarker;
- GSOFeature marker = new GSOFeature();
+ marker=new GSOFeature();
marker.Geometry = dismarker;
-
- line.Visible = marker.Visible = markerVisible;
- markerLayer.AddFeature(line);
- markerLayer.AddFeature(marker);
-
- markerLayer2.AddFeature(line);
- markerLayer2.AddFeature(marker);
-
- return dismarker.Position;
}
-
- ///
- /// 添加水平标注
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- private GSOPoint3d LabelHorizontalDistance(GSOLayer markerLayer, GSOLayer markerLayer2, GSOPoint3d pntIntersect1, GSOPoint3d pntIntersect2, double distance, bool markerVisible)
- {
- if (pntIntersect1 == null || pntIntersect2 == null)
- {
- return new GSOPoint3d();
- }
- GSOGeoPolyline3D disline = new GSOGeoPolyline3D();
- GSOPoint3ds point3ds = new GSOPoint3ds();
- point3ds.Add(pntIntersect1);
- point3ds.Add(pntIntersect2);
- disline.AddPart(point3ds);
- GSOSimpleLineStyle3D style = new GSOSimpleLineStyle3D(); //创建线的风格
- //设置透明度及颜色,FromArgb()中的四个参数分别为alpha、red、green、blue,取值范围为0到255
- style.LineColor = Color.Red;
- style.LineWidth = 5; //设置线的宽度为3
- style.VertexVisible = true; //显示线的节点
- disline.Style = style; //把风格添加到线上
- disline.AltitudeMode = EnumAltitudeMode.Absolute;
-
- GSOFeature line = new GSOFeature();
- line.Geometry = disline;
-
- GSOGeoMarker dismarker = new GSOGeoMarker();
- dismarker.X = pntIntersect1.X;
- dismarker.Y = pntIntersect1.Y;
- dismarker.Z = (pntIntersect1.Z + pntIntersect2.Z) / 2;
- dismarker.Text = "水平" + distance.ToString("0.00") + "米";
- dismarker.AltitudeMode = EnumAltitudeMode.Absolute;
- GSOMarkerStyle3D styleMarker = new GSOMarkerStyle3D();
- GSOTextStyle styleText = new GSOTextStyle();
- styleText.IsSizeFixed = true;
- styleText.ForeColor = Color.Red;
- styleText.FontSize = 20;
- styleMarker.TextStyle = styleText;
- dismarker.Style = styleMarker;
-
- GSOFeature marker = new GSOFeature();
- marker.Geometry = dismarker;
-
- line.Visible = marker.Visible = markerVisible;
- markerLayer.AddFeature(line);
- markerLayer.AddFeature(marker);
-
- markerLayer2.AddFeature(line);
- markerLayer2.AddFeature(marker);
-
- return dismarker.Position;
- }
-
}
}
diff --git a/MainFrm.designer.cs b/MainFrm.designer.cs
index 93a213d..803967c 100644
--- a/MainFrm.designer.cs
+++ b/MainFrm.designer.cs
@@ -3688,10 +3688,10 @@
//
// buttonItemBZ10
//
- this.buttonItemBZ10.Image = ((System.Drawing.Image)(resources.GetObject("buttonItemBZ10.Image")));
- this.buttonItemBZ10.Name = "buttonItemBZ10";
- this.buttonItemBZ10.Text = "红线工具";
- this.buttonItemBZ10.Click += new System.EventHandler(this.buttonItemBZ10_Click);
+ //this.buttonItemBZ10.Image = ((System.Drawing.Image)(resources.GetObject("buttonItemBZ10.Image")));
+ //this.buttonItemBZ10.Name = "buttonItemBZ10";
+ //this.buttonItemBZ10.Text = "红线工具";
+ //this.buttonItemBZ10.Click += new System.EventHandler(this.buttonItemBZ10_Click);
//
// buttonItemBZ11
//
diff --git a/Cyberpipe.suo b/Cyberpipe.suo
index 2b3fc7a..c87d798 100644
--- a/Cyberpipe.suo
+++ b/Cyberpipe.suo
Binary files differ
diff --git a/FrmCompareFeature.cs b/FrmCompareFeature.cs
index 74fa33e..71323e5 100644
--- a/FrmCompareFeature.cs
+++ b/FrmCompareFeature.cs
@@ -23,14 +23,15 @@
GSOGeoPolygon3D resPolygon;
static FrmCompareFeature frm;
- public static void ShowForm(GSOGlobeControl _globeControl1, GSOGlobeControl _globeControl2,
+
+ public static void ShowForm(GSOGlobeControl _globeControl1, GSOGlobeControl _globeControl2,
GSOLayer _layerTemp, GSOLayer _layerTemp2, int width)
{
if (frm == null)
{
frm = new FrmCompareFeature(_globeControl1, _globeControl2, _layerTemp, _layerTemp2);
- frm.Location = new Point((width - frm.Width) / 2, 50);
+ frm.Location = new Point((width - frm.Width)/2, 50);
frm.Show(_globeControl1.Parent);
}
else
@@ -40,7 +41,7 @@
}
}
- public FrmCompareFeature(GSOGlobeControl _globeControl1, GSOGlobeControl _globeControl2,
+ public FrmCompareFeature(GSOGlobeControl _globeControl1, GSOGlobeControl _globeControl2,
GSOLayer _layerTemp, GSOLayer _layerTemp2)
{
globeControl1 = _globeControl1;
@@ -51,7 +52,7 @@
globeControl2.Globe.Action = EnumAction3D.SelectObject;
layerTemp = _layerTemp;
layerTemp2 = _layerTemp2;
-
+
globeControl1.MouseClick += globeControl1_MouseClick;
globeControl2.MouseClick += globeControl2_MouseClick;
}
@@ -62,37 +63,29 @@
double bufferWidth = Convert.ToDouble(textBox1.Text);
- if (srcFeature != null && dscFeature != null)
- {
- if (srcFeature.Geometry.Type != dscFeature.Geometry.Type)
- {
- MessageBox.Show("请选择同种类型图层!");
- }
-
- //TODO LIST按缓冲区的方式处理线的方式
- else
- if (srcFeature.Geometry.Type == dscFeature.Geometry.Type && srcFeature.Geometry.Type == EnumGeometryType.GeoPolyline3D)
- {
- lineLayerCompare(srcFeature, dscFeature, bufferWidth);
- if (isSamePolyline)
- {
- lineFeatureCompare(srcFeature, dscFeature);
- globeControl1.Globe.Action = EnumAction3D.ActionNull;
- globeControl2.Globe.Action = EnumAction3D.ActionNull;
- }
- else
- {
- MessageBox.Show("实测管段与施工管段非同一条管段,请选择同一管段进行比较!", "提示");
- }
- }
- else
- {
- MessageBox.Show("无法处理该类型图层!");
- }
- }
+ if (srcFeature == null || dscFeature == null)
+ MessageBox.Show("请选择要对比的管段!", "提示");
else
{
- MessageBox.Show("请选择要对比的管段!", "提示");
+ if (srcFeature.Geometry.Type != dscFeature.Geometry.Type)
+ MessageBox.Show("请选择同种类型图层!");
+ else if (srcFeature.Geometry.Type == dscFeature.Geometry.Type &&
+ srcFeature.Geometry.Type == EnumGeometryType.GeoPolyline3D)
+ {
+ lineLayerCompare(srcFeature, dscFeature, bufferWidth);
+ if (!isSamePolyline)
+ MessageBox.Show("实测管段与施工管段非同一条管段,请选择同一管段进行比较!", "提示");
+ else
+ {
+ lineFeatureCompare(srcFeature, dscFeature);
+ globeControl1.Globe.Action = EnumAction3D.ActionNull;
+ globeControl2.Globe.Action = EnumAction3D.ActionNull;
+ }
+ }
+ else
+ {
+ MessageBox.Show("无法处理该类型图层!");
+ }
}
}
@@ -165,8 +158,8 @@
GSOGeoPolyline3D dscLine = dscFeature.Geometry as GSOGeoPolyline3D;
double dscLineLength = dscLine.GetSpaceLength(false, 6378137);
- double horizonDistance = HorizonDistance(srcLine, dscLine);
- double verticalDistance = VerticalDistance(srcLine, dscLine);
+ double horizonDistance = calculateDistance(srcLine, dscLine,false);
+ double verticalDistance = calculateDistance(srcLine, dscLine,true);
DataTable dt = new DataTable();
dt.Columns.Add("数据名称");
@@ -187,7 +180,7 @@
srcRow[6] = verticalDistance.ToString("0.000");
dt.Rows.Add(srcRow);
- DataRow dscRow=dt.NewRow();
+ DataRow dscRow = dt.NewRow();
dscRow[0] = "施工数据";
dscRow[1] = dscFeature.Dataset.Caption;
dscRow[2] = dscFeature.Name;
@@ -207,6 +200,38 @@
frm = null;
}
+ private void addPologyToGlobeControl(GSOGeoPolyline3D line, double bufferWidth)
+ {
+ new_feat = new GSOFeature();
+ resPolygon = line.CreateBuffer(bufferWidth*2, true, 0, false, false);
+ resPolygon.AltitudeMode = EnumAltitudeMode.RelativeToGround;
+ new_feat.Geometry = resPolygon;
+
+ layerTemp.AddFeature(new_feat);
+ layerTemp2.AddFeature(new_feat);
+ globeControl1.Refresh();
+ globeControl2.Refresh();
+ }
+
+ private GSOLayer getSameLayer(GSOFeature feature)
+ {
+ GSOLayer layer = null;
+ if (!feature.Dataset.Caption.StartsWith("施工"))
+ {
+ layer = feature.Dataset.Caption == "供电管线"
+ ? globeControl2.Globe.Layers.GetLayerByCaption("施工电力管线")
+ : globeControl2.Globe.Layers.GetLayerByCaption("施工" + feature.Dataset.Caption);
+ }
+ else
+ {
+ layer = feature.Dataset.Caption == "施工电力管线"
+ ? globeControl1.Globe.Layers.GetLayerByCaption("供电管线")
+ : globeControl1.Globe.Layers.GetLayerByCaption(feature.Dataset.Caption.Replace("施工", ""));
+ }
+
+ return layer;
+ }
+
///
/// 地球1中点击地球2中同步添加缓冲区
///
@@ -214,15 +239,12 @@
///
void globeControl1_MouseClick(object sender, MouseEventArgs e)
{
- //add by zhangfan
layerTemp.Visible = true;
layerTemp2.Visible = true;
GSOFeatures listFeatures = new GSOFeatures();
double maxLength = 0;
- if (globeControl1.Globe.SelectedObject == null)
- {
- }
+ if (globeControl1.Globe.SelectedObject == null) return;
else
{
clearFeatureHighLight(globeControl1, globeControl2);
@@ -230,102 +252,34 @@
{
double bufferWidth = Convert.ToDouble(textBox1.Text);
resPolygon = null;
- layerTemp.RemoveAllFeature();
- if (new_feat != null)
- {
- layerTemp2.RemoveFeatureByID(new_feat.ID);
- }
- //双屏通视增加缓冲区
- if (globeControl1.Globe.Action == EnumAction3D.SelectObject && globeControl1.Globe.SelectedObject != null)
+
+ if (globeControl1.Globe.Action == EnumAction3D.SelectObject &&
+ globeControl1.Globe.SelectedObject != null)
{
GSOGeoPolyline3D line = globeControl1.Globe.SelectedObject.Geometry as GSOGeoPolyline3D;
-
- new_feat = new GSOFeature();
- resPolygon = line.CreateBuffer(bufferWidth * 2, true, 0, false, false);
- resPolygon.AltitudeMode = EnumAltitudeMode.RelativeToGround;
-
- new_feat.Geometry = resPolygon;
- layerTemp.AddFeature(new_feat);
- layerTemp2.AddFeature(new_feat);
- globeControl1.Refresh();
- globeControl2.Refresh();
+ addPologyToGlobeControl(line, bufferWidth);
}
+
srcFeature = globeControl1.Globe.SelectedObject;
-
- //双屏同时选中同一管段
- GSOLayer layers = null;
- //获取相对图层,后续得改
- if (srcFeature.Dataset.Caption == "雨水管线")
- {
- layers = globeControl2.Globe.Layers.GetLayerByCaption("施工雨水管线");
- }
- else
- {
- if (srcFeature.Dataset.Caption == "污水管线")
- {
- layers = globeControl2.Globe.Layers.GetLayerByCaption("施工污水管线");
- }
- else
- if (srcFeature.Dataset.Caption == "供电管线")
- {
- layers = globeControl2.Globe.Layers.GetLayerByCaption("施工电力管线");
- }
- }
+ GSOLayer layers = getSameLayer(srcFeature);
GSOFeatures features = layers.FindFeaturesInPolygon(resPolygon, false);
GSOGeoPolyline3D scLine = srcFeature.Geometry as GSOGeoPolyline3D;
+
for (int i = 0; i < features.Length; i++)
{
lineLayerCompare(srcFeature, features[i], Convert.ToDouble(textBox1.Text));
if (isSamePolyline)
- {
listFeatures.Add(features[i]);
- }
}
-
- if (listFeatures.Length != 0)
- {
- if (listFeatures.Length == 1)
- {
- dscFeature = listFeatures[0];
- listFeatures[0].HighLight = true;
- }
- else
- {
- for (int m = 0; m < listFeatures.Length; m++)
- {
- GSOGeoPolyline3D tempSGLine = listFeatures[m].Geometry as GSOGeoPolyline3D;
-
- double tempLength = tempSGLine.GetSpaceLength(false, 6378137);
- double lengthAbs = Math.Abs(tempLength - scLine.GetSpaceLength(false, 6378137));
- //tempLengthList.Add(lengthAbs);
- if (m == 0)
- {
- dscFeature = listFeatures[0];
- listFeatures[0].HighLight = true;
- maxLength = lengthAbs;
- }
- else if (lengthAbs < maxLength)
- {
- dscFeature = listFeatures[m];
- listFeatures[m].HighLight = true;
- maxLength = lengthAbs;
- }
- }
- }
- }
- else
- {
- dscFeature = null;
- }
-
+ calculate(out maxLength, out dscFeature, listFeatures, scLine);
+
}
catch (Exception ex)
{
-
+ LogError.PublishError(ex);
}
}
-
}
///
@@ -335,15 +289,12 @@
///
void globeControl2_MouseClick(object sender, MouseEventArgs e)
{
- //add by zhangfan
layerTemp.Visible = true;
layerTemp2.Visible = true;
GSOFeatures listFeatures = new GSOFeatures();
double maxLength = 0;
- if (globeControl2.Globe.SelectedObject == null)
- {
- }
+ if (globeControl2.Globe.SelectedObject == null) return;
else
{
clearFeatureHighLight(globeControl1, globeControl2);
@@ -351,51 +302,23 @@
{
double bufferWidth = Convert.ToDouble(textBox1.Text);
resPolygon = null;
- layerTemp.RemoveAllFeature();
- if (new_feat != null)
- {
- layerTemp2.RemoveFeatureByID(new_feat.ID);
- }
- if (globeControl2.Globe.Action == EnumAction3D.SelectObject && globeControl2.Globe.SelectedObject != null)
+ if (globeControl2.Globe.Action != EnumAction3D.SelectObject ||
+ globeControl2.Globe.SelectedObject == null)
+ return;
+ else
{
-
GSOGeoPolyline3D line = globeControl2.Globe.SelectedObject.Geometry as GSOGeoPolyline3D;
- new_feat = new GSOFeature();
- resPolygon = line.CreateBuffer(bufferWidth * 2, true, 0, false, false);
- resPolygon.AltitudeMode = EnumAltitudeMode.RelativeToGround;
-
- new_feat.Geometry = resPolygon;
- layerTemp.AddFeature(new_feat);
- layerTemp2.AddFeature(new_feat);
- globeControl1.Refresh();
- globeControl2.Refresh();
+ addPologyToGlobeControl(line, bufferWidth);
}
dscFeature = globeControl2.Globe.SelectedObject;
//双屏同时选中同一管段
- GSOLayer layers = null;
- //获取相对图层,后续得改
- if (dscFeature.Dataset.Caption == "施工雨水管线")
- {
- layers = globeControl1.Globe.Layers.GetLayerByCaption("雨水管线");
- }
- else
- {
- if (dscFeature.Dataset.Caption == "施工污水管线")
- {
- layers = globeControl1.Globe.Layers.GetLayerByCaption("污水管线");
- }
- else
- if (dscFeature.Dataset.Caption == "施工电力管线")
- {
- layers = globeControl1.Globe.Layers.GetLayerByCaption("供电管线");
- }
- }
+ GSOLayer layers = getSameLayer(dscFeature);
GSOFeatures features = layers.FindFeaturesInPolygon(resPolygon, false);
- GSOGeoPolyline3D scLine = srcFeature.Geometry as GSOGeoPolyline3D;
+ GSOGeoPolyline3D scLine = dscFeature.Geometry as GSOGeoPolyline3D;
for (int i = 0; i < features.Length; i++)
{
@@ -405,94 +328,83 @@
listFeatures.Add(features[i]);
}
}
+ calculate(out maxLength, out srcFeature, listFeatures, scLine);
- if (listFeatures.Length != 0)
+ }
+ catch (Exception ex)
+ {
+ LogError.PublishError(ex);
+ }
+ }
+ }
+
+ private void calculate(out double maxLength, out GSOFeature feature, GSOFeatures listFeatures,
+ GSOGeoPolyline3D scLine)
+ {
+ maxLength = 0;
+ feature=new GSOFeature();
+ if (listFeatures.Length == 0)
+ feature = null;
+ else
+ {
+ if (listFeatures.Length == 1)
+ {
+ feature = listFeatures[0];
+ listFeatures[0].HighLight = true;
+ }
+ else
+ {
+ for (int m = 0; m < listFeatures.Length; m++)
{
- if (listFeatures.Length == 1)
+ GSOGeoPolyline3D tempSGLine = listFeatures[m].Geometry as GSOGeoPolyline3D;
+
+ double tempLength = tempSGLine.GetSpaceLength(false, 6378137);
+ double lengthAbs = Math.Abs(tempLength - scLine.GetSpaceLength(false, 6378137));
+ if (m == 0)
{
- srcFeature = listFeatures[0];
+ feature = listFeatures[0];
listFeatures[0].HighLight = true;
+ maxLength = lengthAbs;
}
- else
+ else if (lengthAbs < maxLength)
{
- for (int m = 0; m < listFeatures.Length; m++)
- {
- GSOGeoPolyline3D tempSGLine = listFeatures[m].Geometry as GSOGeoPolyline3D;
-
- double tempLength = tempSGLine.GetSpaceLength(false, 6378137);
- double lengthAbs = Math.Abs(tempLength - scLine.GetSpaceLength(false, 6378137));
- //tempLengthList.Add(lengthAbs);
- if (m == 0)
- {
- srcFeature = listFeatures[0];
- listFeatures[0].HighLight = true;
- maxLength = lengthAbs;
- }
- else if (lengthAbs < maxLength)
- {
- srcFeature = listFeatures[m];
- listFeatures[m].HighLight = true;
- maxLength = lengthAbs;
- }
- }
+ feature = listFeatures[m];
+ listFeatures[m].HighLight = true;
+ maxLength = lengthAbs;
}
}
- else
- {
- srcFeature = null;
- }
}
- catch (Exception ex) { }
+ }
+ }
+
+ ///
+ /// 计算距离
+ ///
+ ///
+ ///
+ ///
+ double calculateDistance(GSOGeoPolyline3D line1, GSOGeoPolyline3D line2,bool isVertical)
+ {
+ GSOPoint3d pntIntersect1 = new GSOPoint3d();
+ GSOPoint3d pntIntersect2 = new GSOPoint3d();
+ GSOPoint3d pntProIntersect1 = new GSOPoint3d();
+ GSOPoint3d pntProIntersect2 = new GSOPoint3d();
+ double dDist = 0;
+ if (isVertical)
+ {
+ dDist = globeControl1.Globe.Analysis3D.ComputeVerticalDistance(line1, line2,
+ out pntIntersect1, out pntIntersect2, out pntProIntersect1, out pntProIntersect2, false);
+
+ LabelDistance(layerTemp, layerTemp2, pntProIntersect1, pntProIntersect2, dDist, true, "垂直");
+ }
+ else
+ {
+ dDist = globeControl1.Globe.Analysis3D.ComputeHorizonDistance(line1, line2,
+ out pntIntersect1, out pntIntersect2, out pntProIntersect1, out pntProIntersect2, false);
+
+ LabelDistance(layerTemp, layerTemp2, pntProIntersect1, pntProIntersect2, dDist, true, "水平");
}
- }
-
- ///
- /// 计算水平距离
- ///
- ///
- ///
- ///
- private double HorizonDistance(GSOGeoPolyline3D line1, GSOGeoPolyline3D line2)
- {
-
- GSOPoint3d pntIntersect1 = new GSOPoint3d();
- GSOPoint3d pntIntersect2 = new GSOPoint3d();
- GSOPoint3d pntProIntersect1 = new GSOPoint3d();
- GSOPoint3d pntProIntersect2 = new GSOPoint3d();
-
- GSOPipeLineStyle3D pipeStyle1 = line1.Style as GSOPipeLineStyle3D;
- GSOPipeLineStyle3D pipeStyle2 = line2.Style as GSOPipeLineStyle3D;
-
- double dDist = globeControl1.Globe.Analysis3D.ComputeHorizonDistance(line1, line2, out pntIntersect1, out pntIntersect2, out pntProIntersect1, out pntProIntersect2, false);
-
- GSOPoint3d markerPosition = new GSOPoint3d();
- markerPosition = LabelHorizontalDistance(layerTemp, layerTemp2, pntProIntersect1, pntProIntersect2, dDist, true);
-
- return dDist;
- }
-
- ///
- /// 计算垂直距离
- ///
- ///
- ///
- ///
- private double VerticalDistance(GSOGeoPolyline3D line1, GSOGeoPolyline3D line2)
- {
- GSOPoint3d pntIntersect1 = new GSOPoint3d();
- GSOPoint3d pntIntersect2 = new GSOPoint3d();
- GSOPoint3d pntProIntersect1 = new GSOPoint3d();
- GSOPoint3d pntProIntersect2 = new GSOPoint3d();
-
- GSOPipeLineStyle3D pipeStyle1 = line1.Style as GSOPipeLineStyle3D;
- GSOPipeLineStyle3D pipeStyle2 = line2.Style as GSOPipeLineStyle3D;
-
- double dDist = globeControl1.Globe.Analysis3D.ComputeVerticalDistance(line1, line2, out pntIntersect1, out pntIntersect2, out pntProIntersect1, out pntProIntersect2, false);
-
- GSOPoint3d markerPosition = new GSOPoint3d();
- markerPosition = LabelVerticalDistance(layerTemp, layerTemp2, pntProIntersect1, pntProIntersect2, dDist, true);
-
return dDist;
}
@@ -502,42 +414,36 @@
///
private void clearFeatureHighLight(GSOGlobeControl glb1,GSOGlobeControl glb2)
{
-
layerTemp.RemoveAllFeature();
layerTemp2.RemoveAllFeature();
//清除gbl1中高亮
for (int i = 0; i < glb1.Globe.Layers.Count; i++)
{
GSOLayer layer = glb1.Globe.Layers[i];
- if (layer is GSOFeatureLayer)
+ if (!(layer is GSOFeatureLayer)) continue;
+ GSOFeatures feats = layer.GetAllFeatures();
+ for (int j = 0; j < feats.Length; j++)
{
- GSOFeatures feats = layer.GetAllFeatures();
- for (int j = 0; j < feats.Length; j++)
- {
- GSOFeature feat = feats[j];
- feat.HighLight = false;
-
- }
+ GSOFeature feat = feats[j];
+ feat.HighLight = false;
}
}
//清除gbl2中高亮
for (int i = 0; i < glb2.Globe.Layers.Count; i++)
{
GSOLayer layer = glb2.Globe.Layers[i];
- if (layer is GSOFeatureLayer)
+ if (!(layer is GSOFeatureLayer)) continue;
+ GSOFeatures feats = layer.GetAllFeatures();
+ for (int j = 0; j < feats.Length; j++)
{
- GSOFeatures feats = layer.GetAllFeatures();
- for (int j = 0; j < feats.Length; j++)
- {
- GSOFeature feat = feats[j];
- feat.HighLight = false;
- }
+ GSOFeature feat = feats[j];
+ feat.HighLight = false;
}
}
}
///
- /// 添加垂直标注
+ /// 添加标注
///
///
///
@@ -545,34 +451,60 @@
///
///
///
- private GSOPoint3d LabelVerticalDistance(GSOLayer markerLayer, GSOLayer markerLayer2, GSOPoint3d pntIntersect1, GSOPoint3d pntIntersect2, double distance, bool markerVisible)
+ private GSOPoint3d LabelDistance(GSOLayer markerLayer, GSOLayer markerLayer2,
+ GSOPoint3d pntIntersect1, GSOPoint3d pntIntersect2, double distance, bool markerVisible,string label)
{
if (pntIntersect1 == null || pntIntersect2 == null)
- {
return new GSOPoint3d();
- }
GSOGeoPolyline3D disline = new GSOGeoPolyline3D();
GSOPoint3ds point3ds = new GSOPoint3ds();
point3ds.Add(pntIntersect1);
point3ds.Add(pntIntersect2);
disline.AddPart(point3ds);
- GSOSimpleLineStyle3D style = new GSOSimpleLineStyle3D();//创建线的风格
- //设置透明度及颜色,FromArgb()中的四个参数分别为alpha、red、green、blue,取值范围为0到255
+
+ GSOGeoMarker dismarker = new GSOGeoMarker();
+ GSOFeature marker = null;
+ GSOFeature line = null;
+ createLineStyle(out marker, out line,disline, pntIntersect1, pntIntersect2, distance, label, dismarker);
+
+ line.Visible = marker.Visible = markerVisible;
+ markerLayer.AddFeature(line);
+ markerLayer.AddFeature(marker);
+
+ markerLayer2.AddFeature(line);
+ markerLayer2.AddFeature(marker);
+
+ return dismarker.Position;
+ }
+ ///
+ /// 控制标注和字体的颜色
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ private void createLineStyle(out GSOFeature marker,out GSOFeature line,GSOGeoPolyline3D disline,
+ GSOPoint3d pntIntersect1,GSOPoint3d pntIntersect2, double distance, string label, GSOGeoMarker dismarker)
+ {
+ GSOSimpleLineStyle3D style = new GSOSimpleLineStyle3D(); //创建线的风格
style.LineColor = Color.Red;
style.LineWidth = 5; //设置线的宽度为5
style.VertexVisible = true; //显示线的节点
disline.Style = style; //把风格添加到线上
disline.AltitudeMode = EnumAltitudeMode.Absolute;
-
- GSOFeature line = new GSOFeature();
+ line=new GSOFeature();
line.Geometry = disline;
- GSOGeoMarker dismarker = new GSOGeoMarker();
dismarker.X = pntIntersect1.X;
dismarker.Y = pntIntersect1.Y;
dismarker.Z = (pntIntersect1.Z + pntIntersect2.Z) / 2;
- dismarker.Text = "垂直" + distance.ToString("0.00") + "米";
+ dismarker.Text = label + distance.ToString("0.00") + "米";
dismarker.AltitudeMode = EnumAltitudeMode.Absolute;
+
GSOMarkerStyle3D styleMarker = new GSOMarkerStyle3D();
GSOTextStyle styleText = new GSOTextStyle();
styleText.IsSizeFixed = true;
@@ -581,77 +513,9 @@
styleMarker.TextStyle = styleText;
dismarker.Style = styleMarker;
- GSOFeature marker = new GSOFeature();
+ marker=new GSOFeature();
marker.Geometry = dismarker;
-
- line.Visible = marker.Visible = markerVisible;
- markerLayer.AddFeature(line);
- markerLayer.AddFeature(marker);
-
- markerLayer2.AddFeature(line);
- markerLayer2.AddFeature(marker);
-
- return dismarker.Position;
}
-
- ///
- /// 添加水平标注
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- private GSOPoint3d LabelHorizontalDistance(GSOLayer markerLayer, GSOLayer markerLayer2, GSOPoint3d pntIntersect1, GSOPoint3d pntIntersect2, double distance, bool markerVisible)
- {
- if (pntIntersect1 == null || pntIntersect2 == null)
- {
- return new GSOPoint3d();
- }
- GSOGeoPolyline3D disline = new GSOGeoPolyline3D();
- GSOPoint3ds point3ds = new GSOPoint3ds();
- point3ds.Add(pntIntersect1);
- point3ds.Add(pntIntersect2);
- disline.AddPart(point3ds);
- GSOSimpleLineStyle3D style = new GSOSimpleLineStyle3D(); //创建线的风格
- //设置透明度及颜色,FromArgb()中的四个参数分别为alpha、red、green、blue,取值范围为0到255
- style.LineColor = Color.Red;
- style.LineWidth = 5; //设置线的宽度为3
- style.VertexVisible = true; //显示线的节点
- disline.Style = style; //把风格添加到线上
- disline.AltitudeMode = EnumAltitudeMode.Absolute;
-
- GSOFeature line = new GSOFeature();
- line.Geometry = disline;
-
- GSOGeoMarker dismarker = new GSOGeoMarker();
- dismarker.X = pntIntersect1.X;
- dismarker.Y = pntIntersect1.Y;
- dismarker.Z = (pntIntersect1.Z + pntIntersect2.Z) / 2;
- dismarker.Text = "水平" + distance.ToString("0.00") + "米";
- dismarker.AltitudeMode = EnumAltitudeMode.Absolute;
- GSOMarkerStyle3D styleMarker = new GSOMarkerStyle3D();
- GSOTextStyle styleText = new GSOTextStyle();
- styleText.IsSizeFixed = true;
- styleText.ForeColor = Color.Red;
- styleText.FontSize = 20;
- styleMarker.TextStyle = styleText;
- dismarker.Style = styleMarker;
-
- GSOFeature marker = new GSOFeature();
- marker.Geometry = dismarker;
-
- line.Visible = marker.Visible = markerVisible;
- markerLayer.AddFeature(line);
- markerLayer.AddFeature(marker);
-
- markerLayer2.AddFeature(line);
- markerLayer2.AddFeature(marker);
-
- return dismarker.Position;
- }
-
}
}
diff --git a/MainFrm.designer.cs b/MainFrm.designer.cs
index 93a213d..803967c 100644
--- a/MainFrm.designer.cs
+++ b/MainFrm.designer.cs
@@ -3688,10 +3688,10 @@
//
// buttonItemBZ10
//
- this.buttonItemBZ10.Image = ((System.Drawing.Image)(resources.GetObject("buttonItemBZ10.Image")));
- this.buttonItemBZ10.Name = "buttonItemBZ10";
- this.buttonItemBZ10.Text = "红线工具";
- this.buttonItemBZ10.Click += new System.EventHandler(this.buttonItemBZ10_Click);
+ //this.buttonItemBZ10.Image = ((System.Drawing.Image)(resources.GetObject("buttonItemBZ10.Image")));
+ //this.buttonItemBZ10.Name = "buttonItemBZ10";
+ //this.buttonItemBZ10.Text = "红线工具";
+ //this.buttonItemBZ10.Click += new System.EventHandler(this.buttonItemBZ10_Click);
//
// buttonItemBZ11
//
diff --git a/bin/x86/Debug/Cyberpipe.exe b/bin/x86/Debug/Cyberpipe.exe
index e7b3f3d..05852c3 100644
--- a/bin/x86/Debug/Cyberpipe.exe
+++ b/bin/x86/Debug/Cyberpipe.exe
Binary files differ
diff --git a/Cyberpipe.suo b/Cyberpipe.suo
index 2b3fc7a..c87d798 100644
--- a/Cyberpipe.suo
+++ b/Cyberpipe.suo
Binary files differ
diff --git a/FrmCompareFeature.cs b/FrmCompareFeature.cs
index 74fa33e..71323e5 100644
--- a/FrmCompareFeature.cs
+++ b/FrmCompareFeature.cs
@@ -23,14 +23,15 @@
GSOGeoPolygon3D resPolygon;
static FrmCompareFeature frm;
- public static void ShowForm(GSOGlobeControl _globeControl1, GSOGlobeControl _globeControl2,
+
+ public static void ShowForm(GSOGlobeControl _globeControl1, GSOGlobeControl _globeControl2,
GSOLayer _layerTemp, GSOLayer _layerTemp2, int width)
{
if (frm == null)
{
frm = new FrmCompareFeature(_globeControl1, _globeControl2, _layerTemp, _layerTemp2);
- frm.Location = new Point((width - frm.Width) / 2, 50);
+ frm.Location = new Point((width - frm.Width)/2, 50);
frm.Show(_globeControl1.Parent);
}
else
@@ -40,7 +41,7 @@
}
}
- public FrmCompareFeature(GSOGlobeControl _globeControl1, GSOGlobeControl _globeControl2,
+ public FrmCompareFeature(GSOGlobeControl _globeControl1, GSOGlobeControl _globeControl2,
GSOLayer _layerTemp, GSOLayer _layerTemp2)
{
globeControl1 = _globeControl1;
@@ -51,7 +52,7 @@
globeControl2.Globe.Action = EnumAction3D.SelectObject;
layerTemp = _layerTemp;
layerTemp2 = _layerTemp2;
-
+
globeControl1.MouseClick += globeControl1_MouseClick;
globeControl2.MouseClick += globeControl2_MouseClick;
}
@@ -62,37 +63,29 @@
double bufferWidth = Convert.ToDouble(textBox1.Text);
- if (srcFeature != null && dscFeature != null)
- {
- if (srcFeature.Geometry.Type != dscFeature.Geometry.Type)
- {
- MessageBox.Show("请选择同种类型图层!");
- }
-
- //TODO LIST按缓冲区的方式处理线的方式
- else
- if (srcFeature.Geometry.Type == dscFeature.Geometry.Type && srcFeature.Geometry.Type == EnumGeometryType.GeoPolyline3D)
- {
- lineLayerCompare(srcFeature, dscFeature, bufferWidth);
- if (isSamePolyline)
- {
- lineFeatureCompare(srcFeature, dscFeature);
- globeControl1.Globe.Action = EnumAction3D.ActionNull;
- globeControl2.Globe.Action = EnumAction3D.ActionNull;
- }
- else
- {
- MessageBox.Show("实测管段与施工管段非同一条管段,请选择同一管段进行比较!", "提示");
- }
- }
- else
- {
- MessageBox.Show("无法处理该类型图层!");
- }
- }
+ if (srcFeature == null || dscFeature == null)
+ MessageBox.Show("请选择要对比的管段!", "提示");
else
{
- MessageBox.Show("请选择要对比的管段!", "提示");
+ if (srcFeature.Geometry.Type != dscFeature.Geometry.Type)
+ MessageBox.Show("请选择同种类型图层!");
+ else if (srcFeature.Geometry.Type == dscFeature.Geometry.Type &&
+ srcFeature.Geometry.Type == EnumGeometryType.GeoPolyline3D)
+ {
+ lineLayerCompare(srcFeature, dscFeature, bufferWidth);
+ if (!isSamePolyline)
+ MessageBox.Show("实测管段与施工管段非同一条管段,请选择同一管段进行比较!", "提示");
+ else
+ {
+ lineFeatureCompare(srcFeature, dscFeature);
+ globeControl1.Globe.Action = EnumAction3D.ActionNull;
+ globeControl2.Globe.Action = EnumAction3D.ActionNull;
+ }
+ }
+ else
+ {
+ MessageBox.Show("无法处理该类型图层!");
+ }
}
}
@@ -165,8 +158,8 @@
GSOGeoPolyline3D dscLine = dscFeature.Geometry as GSOGeoPolyline3D;
double dscLineLength = dscLine.GetSpaceLength(false, 6378137);
- double horizonDistance = HorizonDistance(srcLine, dscLine);
- double verticalDistance = VerticalDistance(srcLine, dscLine);
+ double horizonDistance = calculateDistance(srcLine, dscLine,false);
+ double verticalDistance = calculateDistance(srcLine, dscLine,true);
DataTable dt = new DataTable();
dt.Columns.Add("数据名称");
@@ -187,7 +180,7 @@
srcRow[6] = verticalDistance.ToString("0.000");
dt.Rows.Add(srcRow);
- DataRow dscRow=dt.NewRow();
+ DataRow dscRow = dt.NewRow();
dscRow[0] = "施工数据";
dscRow[1] = dscFeature.Dataset.Caption;
dscRow[2] = dscFeature.Name;
@@ -207,6 +200,38 @@
frm = null;
}
+ private void addPologyToGlobeControl(GSOGeoPolyline3D line, double bufferWidth)
+ {
+ new_feat = new GSOFeature();
+ resPolygon = line.CreateBuffer(bufferWidth*2, true, 0, false, false);
+ resPolygon.AltitudeMode = EnumAltitudeMode.RelativeToGround;
+ new_feat.Geometry = resPolygon;
+
+ layerTemp.AddFeature(new_feat);
+ layerTemp2.AddFeature(new_feat);
+ globeControl1.Refresh();
+ globeControl2.Refresh();
+ }
+
+ private GSOLayer getSameLayer(GSOFeature feature)
+ {
+ GSOLayer layer = null;
+ if (!feature.Dataset.Caption.StartsWith("施工"))
+ {
+ layer = feature.Dataset.Caption == "供电管线"
+ ? globeControl2.Globe.Layers.GetLayerByCaption("施工电力管线")
+ : globeControl2.Globe.Layers.GetLayerByCaption("施工" + feature.Dataset.Caption);
+ }
+ else
+ {
+ layer = feature.Dataset.Caption == "施工电力管线"
+ ? globeControl1.Globe.Layers.GetLayerByCaption("供电管线")
+ : globeControl1.Globe.Layers.GetLayerByCaption(feature.Dataset.Caption.Replace("施工", ""));
+ }
+
+ return layer;
+ }
+
///
/// 地球1中点击地球2中同步添加缓冲区
///
@@ -214,15 +239,12 @@
///
void globeControl1_MouseClick(object sender, MouseEventArgs e)
{
- //add by zhangfan
layerTemp.Visible = true;
layerTemp2.Visible = true;
GSOFeatures listFeatures = new GSOFeatures();
double maxLength = 0;
- if (globeControl1.Globe.SelectedObject == null)
- {
- }
+ if (globeControl1.Globe.SelectedObject == null) return;
else
{
clearFeatureHighLight(globeControl1, globeControl2);
@@ -230,102 +252,34 @@
{
double bufferWidth = Convert.ToDouble(textBox1.Text);
resPolygon = null;
- layerTemp.RemoveAllFeature();
- if (new_feat != null)
- {
- layerTemp2.RemoveFeatureByID(new_feat.ID);
- }
- //双屏通视增加缓冲区
- if (globeControl1.Globe.Action == EnumAction3D.SelectObject && globeControl1.Globe.SelectedObject != null)
+
+ if (globeControl1.Globe.Action == EnumAction3D.SelectObject &&
+ globeControl1.Globe.SelectedObject != null)
{
GSOGeoPolyline3D line = globeControl1.Globe.SelectedObject.Geometry as GSOGeoPolyline3D;
-
- new_feat = new GSOFeature();
- resPolygon = line.CreateBuffer(bufferWidth * 2, true, 0, false, false);
- resPolygon.AltitudeMode = EnumAltitudeMode.RelativeToGround;
-
- new_feat.Geometry = resPolygon;
- layerTemp.AddFeature(new_feat);
- layerTemp2.AddFeature(new_feat);
- globeControl1.Refresh();
- globeControl2.Refresh();
+ addPologyToGlobeControl(line, bufferWidth);
}
+
srcFeature = globeControl1.Globe.SelectedObject;
-
- //双屏同时选中同一管段
- GSOLayer layers = null;
- //获取相对图层,后续得改
- if (srcFeature.Dataset.Caption == "雨水管线")
- {
- layers = globeControl2.Globe.Layers.GetLayerByCaption("施工雨水管线");
- }
- else
- {
- if (srcFeature.Dataset.Caption == "污水管线")
- {
- layers = globeControl2.Globe.Layers.GetLayerByCaption("施工污水管线");
- }
- else
- if (srcFeature.Dataset.Caption == "供电管线")
- {
- layers = globeControl2.Globe.Layers.GetLayerByCaption("施工电力管线");
- }
- }
+ GSOLayer layers = getSameLayer(srcFeature);
GSOFeatures features = layers.FindFeaturesInPolygon(resPolygon, false);
GSOGeoPolyline3D scLine = srcFeature.Geometry as GSOGeoPolyline3D;
+
for (int i = 0; i < features.Length; i++)
{
lineLayerCompare(srcFeature, features[i], Convert.ToDouble(textBox1.Text));
if (isSamePolyline)
- {
listFeatures.Add(features[i]);
- }
}
-
- if (listFeatures.Length != 0)
- {
- if (listFeatures.Length == 1)
- {
- dscFeature = listFeatures[0];
- listFeatures[0].HighLight = true;
- }
- else
- {
- for (int m = 0; m < listFeatures.Length; m++)
- {
- GSOGeoPolyline3D tempSGLine = listFeatures[m].Geometry as GSOGeoPolyline3D;
-
- double tempLength = tempSGLine.GetSpaceLength(false, 6378137);
- double lengthAbs = Math.Abs(tempLength - scLine.GetSpaceLength(false, 6378137));
- //tempLengthList.Add(lengthAbs);
- if (m == 0)
- {
- dscFeature = listFeatures[0];
- listFeatures[0].HighLight = true;
- maxLength = lengthAbs;
- }
- else if (lengthAbs < maxLength)
- {
- dscFeature = listFeatures[m];
- listFeatures[m].HighLight = true;
- maxLength = lengthAbs;
- }
- }
- }
- }
- else
- {
- dscFeature = null;
- }
-
+ calculate(out maxLength, out dscFeature, listFeatures, scLine);
+
}
catch (Exception ex)
{
-
+ LogError.PublishError(ex);
}
}
-
}
///
@@ -335,15 +289,12 @@
///
void globeControl2_MouseClick(object sender, MouseEventArgs e)
{
- //add by zhangfan
layerTemp.Visible = true;
layerTemp2.Visible = true;
GSOFeatures listFeatures = new GSOFeatures();
double maxLength = 0;
- if (globeControl2.Globe.SelectedObject == null)
- {
- }
+ if (globeControl2.Globe.SelectedObject == null) return;
else
{
clearFeatureHighLight(globeControl1, globeControl2);
@@ -351,51 +302,23 @@
{
double bufferWidth = Convert.ToDouble(textBox1.Text);
resPolygon = null;
- layerTemp.RemoveAllFeature();
- if (new_feat != null)
- {
- layerTemp2.RemoveFeatureByID(new_feat.ID);
- }
- if (globeControl2.Globe.Action == EnumAction3D.SelectObject && globeControl2.Globe.SelectedObject != null)
+ if (globeControl2.Globe.Action != EnumAction3D.SelectObject ||
+ globeControl2.Globe.SelectedObject == null)
+ return;
+ else
{
-
GSOGeoPolyline3D line = globeControl2.Globe.SelectedObject.Geometry as GSOGeoPolyline3D;
- new_feat = new GSOFeature();
- resPolygon = line.CreateBuffer(bufferWidth * 2, true, 0, false, false);
- resPolygon.AltitudeMode = EnumAltitudeMode.RelativeToGround;
-
- new_feat.Geometry = resPolygon;
- layerTemp.AddFeature(new_feat);
- layerTemp2.AddFeature(new_feat);
- globeControl1.Refresh();
- globeControl2.Refresh();
+ addPologyToGlobeControl(line, bufferWidth);
}
dscFeature = globeControl2.Globe.SelectedObject;
//双屏同时选中同一管段
- GSOLayer layers = null;
- //获取相对图层,后续得改
- if (dscFeature.Dataset.Caption == "施工雨水管线")
- {
- layers = globeControl1.Globe.Layers.GetLayerByCaption("雨水管线");
- }
- else
- {
- if (dscFeature.Dataset.Caption == "施工污水管线")
- {
- layers = globeControl1.Globe.Layers.GetLayerByCaption("污水管线");
- }
- else
- if (dscFeature.Dataset.Caption == "施工电力管线")
- {
- layers = globeControl1.Globe.Layers.GetLayerByCaption("供电管线");
- }
- }
+ GSOLayer layers = getSameLayer(dscFeature);
GSOFeatures features = layers.FindFeaturesInPolygon(resPolygon, false);
- GSOGeoPolyline3D scLine = srcFeature.Geometry as GSOGeoPolyline3D;
+ GSOGeoPolyline3D scLine = dscFeature.Geometry as GSOGeoPolyline3D;
for (int i = 0; i < features.Length; i++)
{
@@ -405,94 +328,83 @@
listFeatures.Add(features[i]);
}
}
+ calculate(out maxLength, out srcFeature, listFeatures, scLine);
- if (listFeatures.Length != 0)
+ }
+ catch (Exception ex)
+ {
+ LogError.PublishError(ex);
+ }
+ }
+ }
+
+ private void calculate(out double maxLength, out GSOFeature feature, GSOFeatures listFeatures,
+ GSOGeoPolyline3D scLine)
+ {
+ maxLength = 0;
+ feature=new GSOFeature();
+ if (listFeatures.Length == 0)
+ feature = null;
+ else
+ {
+ if (listFeatures.Length == 1)
+ {
+ feature = listFeatures[0];
+ listFeatures[0].HighLight = true;
+ }
+ else
+ {
+ for (int m = 0; m < listFeatures.Length; m++)
{
- if (listFeatures.Length == 1)
+ GSOGeoPolyline3D tempSGLine = listFeatures[m].Geometry as GSOGeoPolyline3D;
+
+ double tempLength = tempSGLine.GetSpaceLength(false, 6378137);
+ double lengthAbs = Math.Abs(tempLength - scLine.GetSpaceLength(false, 6378137));
+ if (m == 0)
{
- srcFeature = listFeatures[0];
+ feature = listFeatures[0];
listFeatures[0].HighLight = true;
+ maxLength = lengthAbs;
}
- else
+ else if (lengthAbs < maxLength)
{
- for (int m = 0; m < listFeatures.Length; m++)
- {
- GSOGeoPolyline3D tempSGLine = listFeatures[m].Geometry as GSOGeoPolyline3D;
-
- double tempLength = tempSGLine.GetSpaceLength(false, 6378137);
- double lengthAbs = Math.Abs(tempLength - scLine.GetSpaceLength(false, 6378137));
- //tempLengthList.Add(lengthAbs);
- if (m == 0)
- {
- srcFeature = listFeatures[0];
- listFeatures[0].HighLight = true;
- maxLength = lengthAbs;
- }
- else if (lengthAbs < maxLength)
- {
- srcFeature = listFeatures[m];
- listFeatures[m].HighLight = true;
- maxLength = lengthAbs;
- }
- }
+ feature = listFeatures[m];
+ listFeatures[m].HighLight = true;
+ maxLength = lengthAbs;
}
}
- else
- {
- srcFeature = null;
- }
}
- catch (Exception ex) { }
+ }
+ }
+
+ ///
+ /// 计算距离
+ ///
+ ///
+ ///
+ ///
+ double calculateDistance(GSOGeoPolyline3D line1, GSOGeoPolyline3D line2,bool isVertical)
+ {
+ GSOPoint3d pntIntersect1 = new GSOPoint3d();
+ GSOPoint3d pntIntersect2 = new GSOPoint3d();
+ GSOPoint3d pntProIntersect1 = new GSOPoint3d();
+ GSOPoint3d pntProIntersect2 = new GSOPoint3d();
+ double dDist = 0;
+ if (isVertical)
+ {
+ dDist = globeControl1.Globe.Analysis3D.ComputeVerticalDistance(line1, line2,
+ out pntIntersect1, out pntIntersect2, out pntProIntersect1, out pntProIntersect2, false);
+
+ LabelDistance(layerTemp, layerTemp2, pntProIntersect1, pntProIntersect2, dDist, true, "垂直");
+ }
+ else
+ {
+ dDist = globeControl1.Globe.Analysis3D.ComputeHorizonDistance(line1, line2,
+ out pntIntersect1, out pntIntersect2, out pntProIntersect1, out pntProIntersect2, false);
+
+ LabelDistance(layerTemp, layerTemp2, pntProIntersect1, pntProIntersect2, dDist, true, "水平");
}
- }
-
- ///
- /// 计算水平距离
- ///
- ///
- ///
- ///
- private double HorizonDistance(GSOGeoPolyline3D line1, GSOGeoPolyline3D line2)
- {
-
- GSOPoint3d pntIntersect1 = new GSOPoint3d();
- GSOPoint3d pntIntersect2 = new GSOPoint3d();
- GSOPoint3d pntProIntersect1 = new GSOPoint3d();
- GSOPoint3d pntProIntersect2 = new GSOPoint3d();
-
- GSOPipeLineStyle3D pipeStyle1 = line1.Style as GSOPipeLineStyle3D;
- GSOPipeLineStyle3D pipeStyle2 = line2.Style as GSOPipeLineStyle3D;
-
- double dDist = globeControl1.Globe.Analysis3D.ComputeHorizonDistance(line1, line2, out pntIntersect1, out pntIntersect2, out pntProIntersect1, out pntProIntersect2, false);
-
- GSOPoint3d markerPosition = new GSOPoint3d();
- markerPosition = LabelHorizontalDistance(layerTemp, layerTemp2, pntProIntersect1, pntProIntersect2, dDist, true);
-
- return dDist;
- }
-
- ///
- /// 计算垂直距离
- ///
- ///
- ///
- ///
- private double VerticalDistance(GSOGeoPolyline3D line1, GSOGeoPolyline3D line2)
- {
- GSOPoint3d pntIntersect1 = new GSOPoint3d();
- GSOPoint3d pntIntersect2 = new GSOPoint3d();
- GSOPoint3d pntProIntersect1 = new GSOPoint3d();
- GSOPoint3d pntProIntersect2 = new GSOPoint3d();
-
- GSOPipeLineStyle3D pipeStyle1 = line1.Style as GSOPipeLineStyle3D;
- GSOPipeLineStyle3D pipeStyle2 = line2.Style as GSOPipeLineStyle3D;
-
- double dDist = globeControl1.Globe.Analysis3D.ComputeVerticalDistance(line1, line2, out pntIntersect1, out pntIntersect2, out pntProIntersect1, out pntProIntersect2, false);
-
- GSOPoint3d markerPosition = new GSOPoint3d();
- markerPosition = LabelVerticalDistance(layerTemp, layerTemp2, pntProIntersect1, pntProIntersect2, dDist, true);
-
return dDist;
}
@@ -502,42 +414,36 @@
///
private void clearFeatureHighLight(GSOGlobeControl glb1,GSOGlobeControl glb2)
{
-
layerTemp.RemoveAllFeature();
layerTemp2.RemoveAllFeature();
//清除gbl1中高亮
for (int i = 0; i < glb1.Globe.Layers.Count; i++)
{
GSOLayer layer = glb1.Globe.Layers[i];
- if (layer is GSOFeatureLayer)
+ if (!(layer is GSOFeatureLayer)) continue;
+ GSOFeatures feats = layer.GetAllFeatures();
+ for (int j = 0; j < feats.Length; j++)
{
- GSOFeatures feats = layer.GetAllFeatures();
- for (int j = 0; j < feats.Length; j++)
- {
- GSOFeature feat = feats[j];
- feat.HighLight = false;
-
- }
+ GSOFeature feat = feats[j];
+ feat.HighLight = false;
}
}
//清除gbl2中高亮
for (int i = 0; i < glb2.Globe.Layers.Count; i++)
{
GSOLayer layer = glb2.Globe.Layers[i];
- if (layer is GSOFeatureLayer)
+ if (!(layer is GSOFeatureLayer)) continue;
+ GSOFeatures feats = layer.GetAllFeatures();
+ for (int j = 0; j < feats.Length; j++)
{
- GSOFeatures feats = layer.GetAllFeatures();
- for (int j = 0; j < feats.Length; j++)
- {
- GSOFeature feat = feats[j];
- feat.HighLight = false;
- }
+ GSOFeature feat = feats[j];
+ feat.HighLight = false;
}
}
}
///
- /// 添加垂直标注
+ /// 添加标注
///
///
///
@@ -545,34 +451,60 @@
///
///
///
- private GSOPoint3d LabelVerticalDistance(GSOLayer markerLayer, GSOLayer markerLayer2, GSOPoint3d pntIntersect1, GSOPoint3d pntIntersect2, double distance, bool markerVisible)
+ private GSOPoint3d LabelDistance(GSOLayer markerLayer, GSOLayer markerLayer2,
+ GSOPoint3d pntIntersect1, GSOPoint3d pntIntersect2, double distance, bool markerVisible,string label)
{
if (pntIntersect1 == null || pntIntersect2 == null)
- {
return new GSOPoint3d();
- }
GSOGeoPolyline3D disline = new GSOGeoPolyline3D();
GSOPoint3ds point3ds = new GSOPoint3ds();
point3ds.Add(pntIntersect1);
point3ds.Add(pntIntersect2);
disline.AddPart(point3ds);
- GSOSimpleLineStyle3D style = new GSOSimpleLineStyle3D();//创建线的风格
- //设置透明度及颜色,FromArgb()中的四个参数分别为alpha、red、green、blue,取值范围为0到255
+
+ GSOGeoMarker dismarker = new GSOGeoMarker();
+ GSOFeature marker = null;
+ GSOFeature line = null;
+ createLineStyle(out marker, out line,disline, pntIntersect1, pntIntersect2, distance, label, dismarker);
+
+ line.Visible = marker.Visible = markerVisible;
+ markerLayer.AddFeature(line);
+ markerLayer.AddFeature(marker);
+
+ markerLayer2.AddFeature(line);
+ markerLayer2.AddFeature(marker);
+
+ return dismarker.Position;
+ }
+ ///
+ /// 控制标注和字体的颜色
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ private void createLineStyle(out GSOFeature marker,out GSOFeature line,GSOGeoPolyline3D disline,
+ GSOPoint3d pntIntersect1,GSOPoint3d pntIntersect2, double distance, string label, GSOGeoMarker dismarker)
+ {
+ GSOSimpleLineStyle3D style = new GSOSimpleLineStyle3D(); //创建线的风格
style.LineColor = Color.Red;
style.LineWidth = 5; //设置线的宽度为5
style.VertexVisible = true; //显示线的节点
disline.Style = style; //把风格添加到线上
disline.AltitudeMode = EnumAltitudeMode.Absolute;
-
- GSOFeature line = new GSOFeature();
+ line=new GSOFeature();
line.Geometry = disline;
- GSOGeoMarker dismarker = new GSOGeoMarker();
dismarker.X = pntIntersect1.X;
dismarker.Y = pntIntersect1.Y;
dismarker.Z = (pntIntersect1.Z + pntIntersect2.Z) / 2;
- dismarker.Text = "垂直" + distance.ToString("0.00") + "米";
+ dismarker.Text = label + distance.ToString("0.00") + "米";
dismarker.AltitudeMode = EnumAltitudeMode.Absolute;
+
GSOMarkerStyle3D styleMarker = new GSOMarkerStyle3D();
GSOTextStyle styleText = new GSOTextStyle();
styleText.IsSizeFixed = true;
@@ -581,77 +513,9 @@
styleMarker.TextStyle = styleText;
dismarker.Style = styleMarker;
- GSOFeature marker = new GSOFeature();
+ marker=new GSOFeature();
marker.Geometry = dismarker;
-
- line.Visible = marker.Visible = markerVisible;
- markerLayer.AddFeature(line);
- markerLayer.AddFeature(marker);
-
- markerLayer2.AddFeature(line);
- markerLayer2.AddFeature(marker);
-
- return dismarker.Position;
}
-
- ///
- /// 添加水平标注
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- private GSOPoint3d LabelHorizontalDistance(GSOLayer markerLayer, GSOLayer markerLayer2, GSOPoint3d pntIntersect1, GSOPoint3d pntIntersect2, double distance, bool markerVisible)
- {
- if (pntIntersect1 == null || pntIntersect2 == null)
- {
- return new GSOPoint3d();
- }
- GSOGeoPolyline3D disline = new GSOGeoPolyline3D();
- GSOPoint3ds point3ds = new GSOPoint3ds();
- point3ds.Add(pntIntersect1);
- point3ds.Add(pntIntersect2);
- disline.AddPart(point3ds);
- GSOSimpleLineStyle3D style = new GSOSimpleLineStyle3D(); //创建线的风格
- //设置透明度及颜色,FromArgb()中的四个参数分别为alpha、red、green、blue,取值范围为0到255
- style.LineColor = Color.Red;
- style.LineWidth = 5; //设置线的宽度为3
- style.VertexVisible = true; //显示线的节点
- disline.Style = style; //把风格添加到线上
- disline.AltitudeMode = EnumAltitudeMode.Absolute;
-
- GSOFeature line = new GSOFeature();
- line.Geometry = disline;
-
- GSOGeoMarker dismarker = new GSOGeoMarker();
- dismarker.X = pntIntersect1.X;
- dismarker.Y = pntIntersect1.Y;
- dismarker.Z = (pntIntersect1.Z + pntIntersect2.Z) / 2;
- dismarker.Text = "水平" + distance.ToString("0.00") + "米";
- dismarker.AltitudeMode = EnumAltitudeMode.Absolute;
- GSOMarkerStyle3D styleMarker = new GSOMarkerStyle3D();
- GSOTextStyle styleText = new GSOTextStyle();
- styleText.IsSizeFixed = true;
- styleText.ForeColor = Color.Red;
- styleText.FontSize = 20;
- styleMarker.TextStyle = styleText;
- dismarker.Style = styleMarker;
-
- GSOFeature marker = new GSOFeature();
- marker.Geometry = dismarker;
-
- line.Visible = marker.Visible = markerVisible;
- markerLayer.AddFeature(line);
- markerLayer.AddFeature(marker);
-
- markerLayer2.AddFeature(line);
- markerLayer2.AddFeature(marker);
-
- return dismarker.Position;
- }
-
}
}
diff --git a/MainFrm.designer.cs b/MainFrm.designer.cs
index 93a213d..803967c 100644
--- a/MainFrm.designer.cs
+++ b/MainFrm.designer.cs
@@ -3688,10 +3688,10 @@
//
// buttonItemBZ10
//
- this.buttonItemBZ10.Image = ((System.Drawing.Image)(resources.GetObject("buttonItemBZ10.Image")));
- this.buttonItemBZ10.Name = "buttonItemBZ10";
- this.buttonItemBZ10.Text = "红线工具";
- this.buttonItemBZ10.Click += new System.EventHandler(this.buttonItemBZ10_Click);
+ //this.buttonItemBZ10.Image = ((System.Drawing.Image)(resources.GetObject("buttonItemBZ10.Image")));
+ //this.buttonItemBZ10.Name = "buttonItemBZ10";
+ //this.buttonItemBZ10.Text = "红线工具";
+ //this.buttonItemBZ10.Click += new System.EventHandler(this.buttonItemBZ10_Click);
//
// buttonItemBZ11
//
diff --git a/bin/x86/Debug/Cyberpipe.exe b/bin/x86/Debug/Cyberpipe.exe
index e7b3f3d..05852c3 100644
--- a/bin/x86/Debug/Cyberpipe.exe
+++ b/bin/x86/Debug/Cyberpipe.exe
Binary files differ
diff --git a/bin/x86/Debug/Cyberpipe.pdb b/bin/x86/Debug/Cyberpipe.pdb
index 2b95ea6..39081e7 100644
--- a/bin/x86/Debug/Cyberpipe.pdb
+++ b/bin/x86/Debug/Cyberpipe.pdb
Binary files differ
diff --git a/Cyberpipe.suo b/Cyberpipe.suo
index 2b3fc7a..c87d798 100644
--- a/Cyberpipe.suo
+++ b/Cyberpipe.suo
Binary files differ
diff --git a/FrmCompareFeature.cs b/FrmCompareFeature.cs
index 74fa33e..71323e5 100644
--- a/FrmCompareFeature.cs
+++ b/FrmCompareFeature.cs
@@ -23,14 +23,15 @@
GSOGeoPolygon3D resPolygon;
static FrmCompareFeature frm;
- public static void ShowForm(GSOGlobeControl _globeControl1, GSOGlobeControl _globeControl2,
+
+ public static void ShowForm(GSOGlobeControl _globeControl1, GSOGlobeControl _globeControl2,
GSOLayer _layerTemp, GSOLayer _layerTemp2, int width)
{
if (frm == null)
{
frm = new FrmCompareFeature(_globeControl1, _globeControl2, _layerTemp, _layerTemp2);
- frm.Location = new Point((width - frm.Width) / 2, 50);
+ frm.Location = new Point((width - frm.Width)/2, 50);
frm.Show(_globeControl1.Parent);
}
else
@@ -40,7 +41,7 @@
}
}
- public FrmCompareFeature(GSOGlobeControl _globeControl1, GSOGlobeControl _globeControl2,
+ public FrmCompareFeature(GSOGlobeControl _globeControl1, GSOGlobeControl _globeControl2,
GSOLayer _layerTemp, GSOLayer _layerTemp2)
{
globeControl1 = _globeControl1;
@@ -51,7 +52,7 @@
globeControl2.Globe.Action = EnumAction3D.SelectObject;
layerTemp = _layerTemp;
layerTemp2 = _layerTemp2;
-
+
globeControl1.MouseClick += globeControl1_MouseClick;
globeControl2.MouseClick += globeControl2_MouseClick;
}
@@ -62,37 +63,29 @@
double bufferWidth = Convert.ToDouble(textBox1.Text);
- if (srcFeature != null && dscFeature != null)
- {
- if (srcFeature.Geometry.Type != dscFeature.Geometry.Type)
- {
- MessageBox.Show("请选择同种类型图层!");
- }
-
- //TODO LIST按缓冲区的方式处理线的方式
- else
- if (srcFeature.Geometry.Type == dscFeature.Geometry.Type && srcFeature.Geometry.Type == EnumGeometryType.GeoPolyline3D)
- {
- lineLayerCompare(srcFeature, dscFeature, bufferWidth);
- if (isSamePolyline)
- {
- lineFeatureCompare(srcFeature, dscFeature);
- globeControl1.Globe.Action = EnumAction3D.ActionNull;
- globeControl2.Globe.Action = EnumAction3D.ActionNull;
- }
- else
- {
- MessageBox.Show("实测管段与施工管段非同一条管段,请选择同一管段进行比较!", "提示");
- }
- }
- else
- {
- MessageBox.Show("无法处理该类型图层!");
- }
- }
+ if (srcFeature == null || dscFeature == null)
+ MessageBox.Show("请选择要对比的管段!", "提示");
else
{
- MessageBox.Show("请选择要对比的管段!", "提示");
+ if (srcFeature.Geometry.Type != dscFeature.Geometry.Type)
+ MessageBox.Show("请选择同种类型图层!");
+ else if (srcFeature.Geometry.Type == dscFeature.Geometry.Type &&
+ srcFeature.Geometry.Type == EnumGeometryType.GeoPolyline3D)
+ {
+ lineLayerCompare(srcFeature, dscFeature, bufferWidth);
+ if (!isSamePolyline)
+ MessageBox.Show("实测管段与施工管段非同一条管段,请选择同一管段进行比较!", "提示");
+ else
+ {
+ lineFeatureCompare(srcFeature, dscFeature);
+ globeControl1.Globe.Action = EnumAction3D.ActionNull;
+ globeControl2.Globe.Action = EnumAction3D.ActionNull;
+ }
+ }
+ else
+ {
+ MessageBox.Show("无法处理该类型图层!");
+ }
}
}
@@ -165,8 +158,8 @@
GSOGeoPolyline3D dscLine = dscFeature.Geometry as GSOGeoPolyline3D;
double dscLineLength = dscLine.GetSpaceLength(false, 6378137);
- double horizonDistance = HorizonDistance(srcLine, dscLine);
- double verticalDistance = VerticalDistance(srcLine, dscLine);
+ double horizonDistance = calculateDistance(srcLine, dscLine,false);
+ double verticalDistance = calculateDistance(srcLine, dscLine,true);
DataTable dt = new DataTable();
dt.Columns.Add("数据名称");
@@ -187,7 +180,7 @@
srcRow[6] = verticalDistance.ToString("0.000");
dt.Rows.Add(srcRow);
- DataRow dscRow=dt.NewRow();
+ DataRow dscRow = dt.NewRow();
dscRow[0] = "施工数据";
dscRow[1] = dscFeature.Dataset.Caption;
dscRow[2] = dscFeature.Name;
@@ -207,6 +200,38 @@
frm = null;
}
+ private void addPologyToGlobeControl(GSOGeoPolyline3D line, double bufferWidth)
+ {
+ new_feat = new GSOFeature();
+ resPolygon = line.CreateBuffer(bufferWidth*2, true, 0, false, false);
+ resPolygon.AltitudeMode = EnumAltitudeMode.RelativeToGround;
+ new_feat.Geometry = resPolygon;
+
+ layerTemp.AddFeature(new_feat);
+ layerTemp2.AddFeature(new_feat);
+ globeControl1.Refresh();
+ globeControl2.Refresh();
+ }
+
+ private GSOLayer getSameLayer(GSOFeature feature)
+ {
+ GSOLayer layer = null;
+ if (!feature.Dataset.Caption.StartsWith("施工"))
+ {
+ layer = feature.Dataset.Caption == "供电管线"
+ ? globeControl2.Globe.Layers.GetLayerByCaption("施工电力管线")
+ : globeControl2.Globe.Layers.GetLayerByCaption("施工" + feature.Dataset.Caption);
+ }
+ else
+ {
+ layer = feature.Dataset.Caption == "施工电力管线"
+ ? globeControl1.Globe.Layers.GetLayerByCaption("供电管线")
+ : globeControl1.Globe.Layers.GetLayerByCaption(feature.Dataset.Caption.Replace("施工", ""));
+ }
+
+ return layer;
+ }
+
///
/// 地球1中点击地球2中同步添加缓冲区
///
@@ -214,15 +239,12 @@
///
void globeControl1_MouseClick(object sender, MouseEventArgs e)
{
- //add by zhangfan
layerTemp.Visible = true;
layerTemp2.Visible = true;
GSOFeatures listFeatures = new GSOFeatures();
double maxLength = 0;
- if (globeControl1.Globe.SelectedObject == null)
- {
- }
+ if (globeControl1.Globe.SelectedObject == null) return;
else
{
clearFeatureHighLight(globeControl1, globeControl2);
@@ -230,102 +252,34 @@
{
double bufferWidth = Convert.ToDouble(textBox1.Text);
resPolygon = null;
- layerTemp.RemoveAllFeature();
- if (new_feat != null)
- {
- layerTemp2.RemoveFeatureByID(new_feat.ID);
- }
- //双屏通视增加缓冲区
- if (globeControl1.Globe.Action == EnumAction3D.SelectObject && globeControl1.Globe.SelectedObject != null)
+
+ if (globeControl1.Globe.Action == EnumAction3D.SelectObject &&
+ globeControl1.Globe.SelectedObject != null)
{
GSOGeoPolyline3D line = globeControl1.Globe.SelectedObject.Geometry as GSOGeoPolyline3D;
-
- new_feat = new GSOFeature();
- resPolygon = line.CreateBuffer(bufferWidth * 2, true, 0, false, false);
- resPolygon.AltitudeMode = EnumAltitudeMode.RelativeToGround;
-
- new_feat.Geometry = resPolygon;
- layerTemp.AddFeature(new_feat);
- layerTemp2.AddFeature(new_feat);
- globeControl1.Refresh();
- globeControl2.Refresh();
+ addPologyToGlobeControl(line, bufferWidth);
}
+
srcFeature = globeControl1.Globe.SelectedObject;
-
- //双屏同时选中同一管段
- GSOLayer layers = null;
- //获取相对图层,后续得改
- if (srcFeature.Dataset.Caption == "雨水管线")
- {
- layers = globeControl2.Globe.Layers.GetLayerByCaption("施工雨水管线");
- }
- else
- {
- if (srcFeature.Dataset.Caption == "污水管线")
- {
- layers = globeControl2.Globe.Layers.GetLayerByCaption("施工污水管线");
- }
- else
- if (srcFeature.Dataset.Caption == "供电管线")
- {
- layers = globeControl2.Globe.Layers.GetLayerByCaption("施工电力管线");
- }
- }
+ GSOLayer layers = getSameLayer(srcFeature);
GSOFeatures features = layers.FindFeaturesInPolygon(resPolygon, false);
GSOGeoPolyline3D scLine = srcFeature.Geometry as GSOGeoPolyline3D;
+
for (int i = 0; i < features.Length; i++)
{
lineLayerCompare(srcFeature, features[i], Convert.ToDouble(textBox1.Text));
if (isSamePolyline)
- {
listFeatures.Add(features[i]);
- }
}
-
- if (listFeatures.Length != 0)
- {
- if (listFeatures.Length == 1)
- {
- dscFeature = listFeatures[0];
- listFeatures[0].HighLight = true;
- }
- else
- {
- for (int m = 0; m < listFeatures.Length; m++)
- {
- GSOGeoPolyline3D tempSGLine = listFeatures[m].Geometry as GSOGeoPolyline3D;
-
- double tempLength = tempSGLine.GetSpaceLength(false, 6378137);
- double lengthAbs = Math.Abs(tempLength - scLine.GetSpaceLength(false, 6378137));
- //tempLengthList.Add(lengthAbs);
- if (m == 0)
- {
- dscFeature = listFeatures[0];
- listFeatures[0].HighLight = true;
- maxLength = lengthAbs;
- }
- else if (lengthAbs < maxLength)
- {
- dscFeature = listFeatures[m];
- listFeatures[m].HighLight = true;
- maxLength = lengthAbs;
- }
- }
- }
- }
- else
- {
- dscFeature = null;
- }
-
+ calculate(out maxLength, out dscFeature, listFeatures, scLine);
+
}
catch (Exception ex)
{
-
+ LogError.PublishError(ex);
}
}
-
}
///
@@ -335,15 +289,12 @@
///
void globeControl2_MouseClick(object sender, MouseEventArgs e)
{
- //add by zhangfan
layerTemp.Visible = true;
layerTemp2.Visible = true;
GSOFeatures listFeatures = new GSOFeatures();
double maxLength = 0;
- if (globeControl2.Globe.SelectedObject == null)
- {
- }
+ if (globeControl2.Globe.SelectedObject == null) return;
else
{
clearFeatureHighLight(globeControl1, globeControl2);
@@ -351,51 +302,23 @@
{
double bufferWidth = Convert.ToDouble(textBox1.Text);
resPolygon = null;
- layerTemp.RemoveAllFeature();
- if (new_feat != null)
- {
- layerTemp2.RemoveFeatureByID(new_feat.ID);
- }
- if (globeControl2.Globe.Action == EnumAction3D.SelectObject && globeControl2.Globe.SelectedObject != null)
+ if (globeControl2.Globe.Action != EnumAction3D.SelectObject ||
+ globeControl2.Globe.SelectedObject == null)
+ return;
+ else
{
-
GSOGeoPolyline3D line = globeControl2.Globe.SelectedObject.Geometry as GSOGeoPolyline3D;
- new_feat = new GSOFeature();
- resPolygon = line.CreateBuffer(bufferWidth * 2, true, 0, false, false);
- resPolygon.AltitudeMode = EnumAltitudeMode.RelativeToGround;
-
- new_feat.Geometry = resPolygon;
- layerTemp.AddFeature(new_feat);
- layerTemp2.AddFeature(new_feat);
- globeControl1.Refresh();
- globeControl2.Refresh();
+ addPologyToGlobeControl(line, bufferWidth);
}
dscFeature = globeControl2.Globe.SelectedObject;
//双屏同时选中同一管段
- GSOLayer layers = null;
- //获取相对图层,后续得改
- if (dscFeature.Dataset.Caption == "施工雨水管线")
- {
- layers = globeControl1.Globe.Layers.GetLayerByCaption("雨水管线");
- }
- else
- {
- if (dscFeature.Dataset.Caption == "施工污水管线")
- {
- layers = globeControl1.Globe.Layers.GetLayerByCaption("污水管线");
- }
- else
- if (dscFeature.Dataset.Caption == "施工电力管线")
- {
- layers = globeControl1.Globe.Layers.GetLayerByCaption("供电管线");
- }
- }
+ GSOLayer layers = getSameLayer(dscFeature);
GSOFeatures features = layers.FindFeaturesInPolygon(resPolygon, false);
- GSOGeoPolyline3D scLine = srcFeature.Geometry as GSOGeoPolyline3D;
+ GSOGeoPolyline3D scLine = dscFeature.Geometry as GSOGeoPolyline3D;
for (int i = 0; i < features.Length; i++)
{
@@ -405,94 +328,83 @@
listFeatures.Add(features[i]);
}
}
+ calculate(out maxLength, out srcFeature, listFeatures, scLine);
- if (listFeatures.Length != 0)
+ }
+ catch (Exception ex)
+ {
+ LogError.PublishError(ex);
+ }
+ }
+ }
+
+ private void calculate(out double maxLength, out GSOFeature feature, GSOFeatures listFeatures,
+ GSOGeoPolyline3D scLine)
+ {
+ maxLength = 0;
+ feature=new GSOFeature();
+ if (listFeatures.Length == 0)
+ feature = null;
+ else
+ {
+ if (listFeatures.Length == 1)
+ {
+ feature = listFeatures[0];
+ listFeatures[0].HighLight = true;
+ }
+ else
+ {
+ for (int m = 0; m < listFeatures.Length; m++)
{
- if (listFeatures.Length == 1)
+ GSOGeoPolyline3D tempSGLine = listFeatures[m].Geometry as GSOGeoPolyline3D;
+
+ double tempLength = tempSGLine.GetSpaceLength(false, 6378137);
+ double lengthAbs = Math.Abs(tempLength - scLine.GetSpaceLength(false, 6378137));
+ if (m == 0)
{
- srcFeature = listFeatures[0];
+ feature = listFeatures[0];
listFeatures[0].HighLight = true;
+ maxLength = lengthAbs;
}
- else
+ else if (lengthAbs < maxLength)
{
- for (int m = 0; m < listFeatures.Length; m++)
- {
- GSOGeoPolyline3D tempSGLine = listFeatures[m].Geometry as GSOGeoPolyline3D;
-
- double tempLength = tempSGLine.GetSpaceLength(false, 6378137);
- double lengthAbs = Math.Abs(tempLength - scLine.GetSpaceLength(false, 6378137));
- //tempLengthList.Add(lengthAbs);
- if (m == 0)
- {
- srcFeature = listFeatures[0];
- listFeatures[0].HighLight = true;
- maxLength = lengthAbs;
- }
- else if (lengthAbs < maxLength)
- {
- srcFeature = listFeatures[m];
- listFeatures[m].HighLight = true;
- maxLength = lengthAbs;
- }
- }
+ feature = listFeatures[m];
+ listFeatures[m].HighLight = true;
+ maxLength = lengthAbs;
}
}
- else
- {
- srcFeature = null;
- }
}
- catch (Exception ex) { }
+ }
+ }
+
+ ///
+ /// 计算距离
+ ///
+ ///
+ ///
+ ///
+ double calculateDistance(GSOGeoPolyline3D line1, GSOGeoPolyline3D line2,bool isVertical)
+ {
+ GSOPoint3d pntIntersect1 = new GSOPoint3d();
+ GSOPoint3d pntIntersect2 = new GSOPoint3d();
+ GSOPoint3d pntProIntersect1 = new GSOPoint3d();
+ GSOPoint3d pntProIntersect2 = new GSOPoint3d();
+ double dDist = 0;
+ if (isVertical)
+ {
+ dDist = globeControl1.Globe.Analysis3D.ComputeVerticalDistance(line1, line2,
+ out pntIntersect1, out pntIntersect2, out pntProIntersect1, out pntProIntersect2, false);
+
+ LabelDistance(layerTemp, layerTemp2, pntProIntersect1, pntProIntersect2, dDist, true, "垂直");
+ }
+ else
+ {
+ dDist = globeControl1.Globe.Analysis3D.ComputeHorizonDistance(line1, line2,
+ out pntIntersect1, out pntIntersect2, out pntProIntersect1, out pntProIntersect2, false);
+
+ LabelDistance(layerTemp, layerTemp2, pntProIntersect1, pntProIntersect2, dDist, true, "水平");
}
- }
-
- ///
- /// 计算水平距离
- ///
- ///
- ///
- ///
- private double HorizonDistance(GSOGeoPolyline3D line1, GSOGeoPolyline3D line2)
- {
-
- GSOPoint3d pntIntersect1 = new GSOPoint3d();
- GSOPoint3d pntIntersect2 = new GSOPoint3d();
- GSOPoint3d pntProIntersect1 = new GSOPoint3d();
- GSOPoint3d pntProIntersect2 = new GSOPoint3d();
-
- GSOPipeLineStyle3D pipeStyle1 = line1.Style as GSOPipeLineStyle3D;
- GSOPipeLineStyle3D pipeStyle2 = line2.Style as GSOPipeLineStyle3D;
-
- double dDist = globeControl1.Globe.Analysis3D.ComputeHorizonDistance(line1, line2, out pntIntersect1, out pntIntersect2, out pntProIntersect1, out pntProIntersect2, false);
-
- GSOPoint3d markerPosition = new GSOPoint3d();
- markerPosition = LabelHorizontalDistance(layerTemp, layerTemp2, pntProIntersect1, pntProIntersect2, dDist, true);
-
- return dDist;
- }
-
- ///
- /// 计算垂直距离
- ///
- ///
- ///
- ///
- private double VerticalDistance(GSOGeoPolyline3D line1, GSOGeoPolyline3D line2)
- {
- GSOPoint3d pntIntersect1 = new GSOPoint3d();
- GSOPoint3d pntIntersect2 = new GSOPoint3d();
- GSOPoint3d pntProIntersect1 = new GSOPoint3d();
- GSOPoint3d pntProIntersect2 = new GSOPoint3d();
-
- GSOPipeLineStyle3D pipeStyle1 = line1.Style as GSOPipeLineStyle3D;
- GSOPipeLineStyle3D pipeStyle2 = line2.Style as GSOPipeLineStyle3D;
-
- double dDist = globeControl1.Globe.Analysis3D.ComputeVerticalDistance(line1, line2, out pntIntersect1, out pntIntersect2, out pntProIntersect1, out pntProIntersect2, false);
-
- GSOPoint3d markerPosition = new GSOPoint3d();
- markerPosition = LabelVerticalDistance(layerTemp, layerTemp2, pntProIntersect1, pntProIntersect2, dDist, true);
-
return dDist;
}
@@ -502,42 +414,36 @@
///
private void clearFeatureHighLight(GSOGlobeControl glb1,GSOGlobeControl glb2)
{
-
layerTemp.RemoveAllFeature();
layerTemp2.RemoveAllFeature();
//清除gbl1中高亮
for (int i = 0; i < glb1.Globe.Layers.Count; i++)
{
GSOLayer layer = glb1.Globe.Layers[i];
- if (layer is GSOFeatureLayer)
+ if (!(layer is GSOFeatureLayer)) continue;
+ GSOFeatures feats = layer.GetAllFeatures();
+ for (int j = 0; j < feats.Length; j++)
{
- GSOFeatures feats = layer.GetAllFeatures();
- for (int j = 0; j < feats.Length; j++)
- {
- GSOFeature feat = feats[j];
- feat.HighLight = false;
-
- }
+ GSOFeature feat = feats[j];
+ feat.HighLight = false;
}
}
//清除gbl2中高亮
for (int i = 0; i < glb2.Globe.Layers.Count; i++)
{
GSOLayer layer = glb2.Globe.Layers[i];
- if (layer is GSOFeatureLayer)
+ if (!(layer is GSOFeatureLayer)) continue;
+ GSOFeatures feats = layer.GetAllFeatures();
+ for (int j = 0; j < feats.Length; j++)
{
- GSOFeatures feats = layer.GetAllFeatures();
- for (int j = 0; j < feats.Length; j++)
- {
- GSOFeature feat = feats[j];
- feat.HighLight = false;
- }
+ GSOFeature feat = feats[j];
+ feat.HighLight = false;
}
}
}
///
- /// 添加垂直标注
+ /// 添加标注
///
///
///
@@ -545,34 +451,60 @@
///
///
///
- private GSOPoint3d LabelVerticalDistance(GSOLayer markerLayer, GSOLayer markerLayer2, GSOPoint3d pntIntersect1, GSOPoint3d pntIntersect2, double distance, bool markerVisible)
+ private GSOPoint3d LabelDistance(GSOLayer markerLayer, GSOLayer markerLayer2,
+ GSOPoint3d pntIntersect1, GSOPoint3d pntIntersect2, double distance, bool markerVisible,string label)
{
if (pntIntersect1 == null || pntIntersect2 == null)
- {
return new GSOPoint3d();
- }
GSOGeoPolyline3D disline = new GSOGeoPolyline3D();
GSOPoint3ds point3ds = new GSOPoint3ds();
point3ds.Add(pntIntersect1);
point3ds.Add(pntIntersect2);
disline.AddPart(point3ds);
- GSOSimpleLineStyle3D style = new GSOSimpleLineStyle3D();//创建线的风格
- //设置透明度及颜色,FromArgb()中的四个参数分别为alpha、red、green、blue,取值范围为0到255
+
+ GSOGeoMarker dismarker = new GSOGeoMarker();
+ GSOFeature marker = null;
+ GSOFeature line = null;
+ createLineStyle(out marker, out line,disline, pntIntersect1, pntIntersect2, distance, label, dismarker);
+
+ line.Visible = marker.Visible = markerVisible;
+ markerLayer.AddFeature(line);
+ markerLayer.AddFeature(marker);
+
+ markerLayer2.AddFeature(line);
+ markerLayer2.AddFeature(marker);
+
+ return dismarker.Position;
+ }
+ ///
+ /// 控制标注和字体的颜色
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ private void createLineStyle(out GSOFeature marker,out GSOFeature line,GSOGeoPolyline3D disline,
+ GSOPoint3d pntIntersect1,GSOPoint3d pntIntersect2, double distance, string label, GSOGeoMarker dismarker)
+ {
+ GSOSimpleLineStyle3D style = new GSOSimpleLineStyle3D(); //创建线的风格
style.LineColor = Color.Red;
style.LineWidth = 5; //设置线的宽度为5
style.VertexVisible = true; //显示线的节点
disline.Style = style; //把风格添加到线上
disline.AltitudeMode = EnumAltitudeMode.Absolute;
-
- GSOFeature line = new GSOFeature();
+ line=new GSOFeature();
line.Geometry = disline;
- GSOGeoMarker dismarker = new GSOGeoMarker();
dismarker.X = pntIntersect1.X;
dismarker.Y = pntIntersect1.Y;
dismarker.Z = (pntIntersect1.Z + pntIntersect2.Z) / 2;
- dismarker.Text = "垂直" + distance.ToString("0.00") + "米";
+ dismarker.Text = label + distance.ToString("0.00") + "米";
dismarker.AltitudeMode = EnumAltitudeMode.Absolute;
+
GSOMarkerStyle3D styleMarker = new GSOMarkerStyle3D();
GSOTextStyle styleText = new GSOTextStyle();
styleText.IsSizeFixed = true;
@@ -581,77 +513,9 @@
styleMarker.TextStyle = styleText;
dismarker.Style = styleMarker;
- GSOFeature marker = new GSOFeature();
+ marker=new GSOFeature();
marker.Geometry = dismarker;
-
- line.Visible = marker.Visible = markerVisible;
- markerLayer.AddFeature(line);
- markerLayer.AddFeature(marker);
-
- markerLayer2.AddFeature(line);
- markerLayer2.AddFeature(marker);
-
- return dismarker.Position;
}
-
- ///
- /// 添加水平标注
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- private GSOPoint3d LabelHorizontalDistance(GSOLayer markerLayer, GSOLayer markerLayer2, GSOPoint3d pntIntersect1, GSOPoint3d pntIntersect2, double distance, bool markerVisible)
- {
- if (pntIntersect1 == null || pntIntersect2 == null)
- {
- return new GSOPoint3d();
- }
- GSOGeoPolyline3D disline = new GSOGeoPolyline3D();
- GSOPoint3ds point3ds = new GSOPoint3ds();
- point3ds.Add(pntIntersect1);
- point3ds.Add(pntIntersect2);
- disline.AddPart(point3ds);
- GSOSimpleLineStyle3D style = new GSOSimpleLineStyle3D(); //创建线的风格
- //设置透明度及颜色,FromArgb()中的四个参数分别为alpha、red、green、blue,取值范围为0到255
- style.LineColor = Color.Red;
- style.LineWidth = 5; //设置线的宽度为3
- style.VertexVisible = true; //显示线的节点
- disline.Style = style; //把风格添加到线上
- disline.AltitudeMode = EnumAltitudeMode.Absolute;
-
- GSOFeature line = new GSOFeature();
- line.Geometry = disline;
-
- GSOGeoMarker dismarker = new GSOGeoMarker();
- dismarker.X = pntIntersect1.X;
- dismarker.Y = pntIntersect1.Y;
- dismarker.Z = (pntIntersect1.Z + pntIntersect2.Z) / 2;
- dismarker.Text = "水平" + distance.ToString("0.00") + "米";
- dismarker.AltitudeMode = EnumAltitudeMode.Absolute;
- GSOMarkerStyle3D styleMarker = new GSOMarkerStyle3D();
- GSOTextStyle styleText = new GSOTextStyle();
- styleText.IsSizeFixed = true;
- styleText.ForeColor = Color.Red;
- styleText.FontSize = 20;
- styleMarker.TextStyle = styleText;
- dismarker.Style = styleMarker;
-
- GSOFeature marker = new GSOFeature();
- marker.Geometry = dismarker;
-
- line.Visible = marker.Visible = markerVisible;
- markerLayer.AddFeature(line);
- markerLayer.AddFeature(marker);
-
- markerLayer2.AddFeature(line);
- markerLayer2.AddFeature(marker);
-
- return dismarker.Position;
- }
-
}
}
diff --git a/MainFrm.designer.cs b/MainFrm.designer.cs
index 93a213d..803967c 100644
--- a/MainFrm.designer.cs
+++ b/MainFrm.designer.cs
@@ -3688,10 +3688,10 @@
//
// buttonItemBZ10
//
- this.buttonItemBZ10.Image = ((System.Drawing.Image)(resources.GetObject("buttonItemBZ10.Image")));
- this.buttonItemBZ10.Name = "buttonItemBZ10";
- this.buttonItemBZ10.Text = "红线工具";
- this.buttonItemBZ10.Click += new System.EventHandler(this.buttonItemBZ10_Click);
+ //this.buttonItemBZ10.Image = ((System.Drawing.Image)(resources.GetObject("buttonItemBZ10.Image")));
+ //this.buttonItemBZ10.Name = "buttonItemBZ10";
+ //this.buttonItemBZ10.Text = "红线工具";
+ //this.buttonItemBZ10.Click += new System.EventHandler(this.buttonItemBZ10_Click);
//
// buttonItemBZ11
//
diff --git a/bin/x86/Debug/Cyberpipe.exe b/bin/x86/Debug/Cyberpipe.exe
index e7b3f3d..05852c3 100644
--- a/bin/x86/Debug/Cyberpipe.exe
+++ b/bin/x86/Debug/Cyberpipe.exe
Binary files differ
diff --git a/bin/x86/Debug/Cyberpipe.pdb b/bin/x86/Debug/Cyberpipe.pdb
index 2b95ea6..39081e7 100644
--- a/bin/x86/Debug/Cyberpipe.pdb
+++ b/bin/x86/Debug/Cyberpipe.pdb
Binary files differ
diff --git a/bin/x86/Debug/log.txt b/bin/x86/Debug/log.txt
index 5f28270..e134074 100644
--- a/bin/x86/Debug/log.txt
+++ b/bin/x86/Debug/log.txt
@@ -1 +1,260 @@
-
\ No newline at end of file
+
+ exception begin -----------------2016/11/13 15:18:08---------------------
+
+
+
+ e.Message:未将对象引用设置到对象的实例。
+
+ e.Source:Cyberpipe
+
+ e.TargetSite:Void globeControl1_MouseClick(System.Object, System.Windows.Forms.MouseEventArgs)
+
+ e.StackTrace: 在 Cyberpipe.FrmCompareFeature.globeControl1_MouseClick(Object sender, MouseEventArgs e) 位置 D:\GHFX\GHFX_REFACTOR\FrmCompareFeature.cs:行号 278
+
+
+
+ exception over ------------------------------------------------------------
+
+ exception begin -----------------2016/11/13 15:34:01---------------------
+
+
+
+ e.Message:未将对象引用设置到对象的实例。
+
+ e.Source:Cyberpipe
+
+ e.TargetSite:Void globeControl1_MouseClick(System.Object, System.Windows.Forms.MouseEventArgs)
+
+ e.StackTrace: 在 Cyberpipe.FrmCompareFeature.globeControl1_MouseClick(Object sender, MouseEventArgs e) 位置 D:\GHFX\GHFX_REFACTOR\FrmCompareFeature.cs:行号 279
+
+
+
+ exception over ------------------------------------------------------------
+
+ exception begin -----------------2016/11/13 15:34:08---------------------
+
+
+
+ e.Message:未将对象引用设置到对象的实例。
+
+ e.Source:Cyberpipe
+
+ e.TargetSite:Void globeControl1_MouseClick(System.Object, System.Windows.Forms.MouseEventArgs)
+
+ e.StackTrace: 在 Cyberpipe.FrmCompareFeature.globeControl1_MouseClick(Object sender, MouseEventArgs e) 位置 D:\GHFX\GHFX_REFACTOR\FrmCompareFeature.cs:行号 279
+
+
+
+ exception over ------------------------------------------------------------
+
+ exception begin -----------------2016/11/13 15:34:57---------------------
+
+
+
+ e.Message:未将对象引用设置到对象的实例。
+
+ e.Source:Cyberpipe
+
+ e.TargetSite:Void globeControl1_MouseClick(System.Object, System.Windows.Forms.MouseEventArgs)
+
+ e.StackTrace: 在 Cyberpipe.FrmCompareFeature.globeControl1_MouseClick(Object sender, MouseEventArgs e) 位置 D:\GHFX\GHFX_REFACTOR\FrmCompareFeature.cs:行号 279
+
+
+
+ exception over ------------------------------------------------------------
+
+ exception begin -----------------2016/11/13 15:35:04---------------------
+
+
+
+ e.Message:未将对象引用设置到对象的实例。
+
+ e.Source:Cyberpipe
+
+ e.TargetSite:Void globeControl1_MouseClick(System.Object, System.Windows.Forms.MouseEventArgs)
+
+ e.StackTrace: 在 Cyberpipe.FrmCompareFeature.globeControl1_MouseClick(Object sender, MouseEventArgs e) 位置 D:\GHFX\GHFX_REFACTOR\FrmCompareFeature.cs:行号 279
+
+
+
+ exception over ------------------------------------------------------------
+
+ exception begin -----------------2016/11/13 15:38:38---------------------
+
+
+
+ e.Message:未将对象引用设置到对象的实例。
+
+ e.Source:Cyberpipe
+
+ e.TargetSite:Void globeControl1_MouseClick(System.Object, System.Windows.Forms.MouseEventArgs)
+
+ e.StackTrace: 在 Cyberpipe.FrmCompareFeature.globeControl1_MouseClick(Object sender, MouseEventArgs e) 位置 D:\GHFX\GHFX_REFACTOR\FrmCompareFeature.cs:行号 279
+
+
+
+ exception over ------------------------------------------------------------
+
+ exception begin -----------------2016/11/13 15:38:45---------------------
+
+
+
+ e.Message:未将对象引用设置到对象的实例。
+
+ e.Source:Cyberpipe
+
+ e.TargetSite:Void globeControl1_MouseClick(System.Object, System.Windows.Forms.MouseEventArgs)
+
+ e.StackTrace: 在 Cyberpipe.FrmCompareFeature.globeControl1_MouseClick(Object sender, MouseEventArgs e) 位置 D:\GHFX\GHFX_REFACTOR\FrmCompareFeature.cs:行号 279
+
+
+
+ exception over ------------------------------------------------------------
+
+ exception begin -----------------2016/11/13 15:40:07---------------------
+
+
+
+ e.Message:未将对象引用设置到对象的实例。
+
+ e.Source:Cyberpipe
+
+ e.TargetSite:Void globeControl1_MouseClick(System.Object, System.Windows.Forms.MouseEventArgs)
+
+ e.StackTrace: 在 Cyberpipe.FrmCompareFeature.globeControl1_MouseClick(Object sender, MouseEventArgs e) 位置 D:\GHFX\GHFX_REFACTOR\FrmCompareFeature.cs:行号 279
+
+
+
+ exception over ------------------------------------------------------------
+
+ exception begin -----------------2016/11/13 15:40:09---------------------
+
+
+
+ e.Message:未将对象引用设置到对象的实例。
+
+ e.Source:Cyberpipe
+
+ e.TargetSite:Void globeControl1_MouseClick(System.Object, System.Windows.Forms.MouseEventArgs)
+
+ e.StackTrace: 在 Cyberpipe.FrmCompareFeature.globeControl1_MouseClick(Object sender, MouseEventArgs e) 位置 D:\GHFX\GHFX_REFACTOR\FrmCompareFeature.cs:行号 279
+
+
+
+ exception over ------------------------------------------------------------
+
+ exception begin -----------------2016/11/13 15:48:16---------------------
+
+
+
+ e.Message:未将对象引用设置到对象的实例。
+
+ e.Source:Cyberpipe
+
+ e.TargetSite:Void globeControl1_MouseClick(System.Object, System.Windows.Forms.MouseEventArgs)
+
+ e.StackTrace: 在 Cyberpipe.FrmCompareFeature.globeControl1_MouseClick(Object sender, MouseEventArgs e) 位置 D:\GHFX\GHFX_REFACTOR\FrmCompareFeature.cs:行号 279
+
+
+
+ exception over ------------------------------------------------------------
+
+ exception begin -----------------2016/11/13 15:51:21---------------------
+
+
+
+ e.Message:未将对象引用设置到对象的实例。
+
+ e.Source:Cyberpipe
+
+ e.TargetSite:Void globeControl1_MouseClick(System.Object, System.Windows.Forms.MouseEventArgs)
+
+ e.StackTrace: 在 Cyberpipe.FrmCompareFeature.globeControl1_MouseClick(Object sender, MouseEventArgs e) 位置 D:\GHFX\GHFX_REFACTOR\FrmCompareFeature.cs:行号 279
+
+
+
+ exception over ------------------------------------------------------------
+
+ exception begin -----------------2016/11/13 15:52:14---------------------
+
+
+
+ e.Message:未将对象引用设置到对象的实例。
+
+ e.Source:Cyberpipe
+
+ e.TargetSite:Void globeControl1_MouseClick(System.Object, System.Windows.Forms.MouseEventArgs)
+
+ e.StackTrace: 在 Cyberpipe.FrmCompareFeature.globeControl1_MouseClick(Object sender, MouseEventArgs e) 位置 D:\GHFX\GHFX_REFACTOR\FrmCompareFeature.cs:行号 276
+
+
+
+ exception over ------------------------------------------------------------
+
+ exception begin -----------------2016/11/13 16:11:31---------------------
+
+
+
+ e.Message:未将对象引用设置到对象的实例。
+
+ e.Source:Cyberpipe
+
+ e.TargetSite:Void globeControl1_MouseClick(System.Object, System.Windows.Forms.MouseEventArgs)
+
+ e.StackTrace: 在 Cyberpipe.FrmCompareFeature.globeControl1_MouseClick(Object sender, MouseEventArgs e) 位置 D:\GHFX\GHFX_REFACTOR\FrmCompareFeature.cs:行号 277
+
+
+
+ exception over ------------------------------------------------------------
+
+ exception begin -----------------2016/11/13 16:11:33---------------------
+
+
+
+ e.Message:未将对象引用设置到对象的实例。
+
+ e.Source:Cyberpipe
+
+ e.TargetSite:Void globeControl1_MouseClick(System.Object, System.Windows.Forms.MouseEventArgs)
+
+ e.StackTrace: 在 Cyberpipe.FrmCompareFeature.globeControl1_MouseClick(Object sender, MouseEventArgs e) 位置 D:\GHFX\GHFX_REFACTOR\FrmCompareFeature.cs:行号 277
+
+
+
+ exception over ------------------------------------------------------------
+
+ exception begin -----------------2016/11/13 16:41:16---------------------
+
+
+
+ e.Message:未将对象引用设置到对象的实例。
+
+ e.Source:Cyberpipe
+
+ e.TargetSite:Boolean getSameFeatureReslt(GeoScene.Data.GSOGeoPolygon3D, GeoScene.Globe.GSOLayer)
+
+ e.StackTrace: 在 Cyberpipe.FrmCompareFeature.getSameFeatureReslt(GSOGeoPolygon3D BufferPolygon, GSOLayer layer) 位置 D:\GHFX\GHFX_REFACTOR\FrmCompareFeature.cs:行号 111
+ 在 Cyberpipe.FrmCompareFeature.lineLayerCompare(GSOFeature srcFeature, GSOFeature dscFeature, Double bufferWidth) 位置 D:\GHFX\GHFX_REFACTOR\FrmCompareFeature.cs:行号 137
+ 在 Cyberpipe.FrmCompareFeature.globeControl1_MouseClick(Object sender, MouseEventArgs e) 位置 D:\GHFX\GHFX_REFACTOR\FrmCompareFeature.cs:行号 271
+
+
+
+ exception over ------------------------------------------------------------
+
+ exception begin -----------------2016/11/13 16:43:06---------------------
+
+
+
+ e.Message:未将对象引用设置到对象的实例。
+
+ e.Source:Cyberpipe
+
+ e.TargetSite:Boolean getSameFeatureReslt(GeoScene.Data.GSOGeoPolygon3D, GeoScene.Globe.GSOLayer)
+
+ e.StackTrace: 在 Cyberpipe.FrmCompareFeature.getSameFeatureReslt(GSOGeoPolygon3D BufferPolygon, GSOLayer layer) 位置 D:\GHFX\GHFX_REFACTOR\FrmCompareFeature.cs:行号 113
+ 在 Cyberpipe.FrmCompareFeature.lineLayerCompare(GSOFeature srcFeature, GSOFeature dscFeature, Double bufferWidth) 位置 D:\GHFX\GHFX_REFACTOR\FrmCompareFeature.cs:行号 139
+ 在 Cyberpipe.FrmCompareFeature.globeControl1_MouseClick(Object sender, MouseEventArgs e) 位置 D:\GHFX\GHFX_REFACTOR\FrmCompareFeature.cs:行号 273
+
+
+
+ exception over ------------------------------------------------------------