diff --git a/Cyberpipe.csproj b/Cyberpipe.csproj
index 6e90a6e..8f4424d 100644
--- a/Cyberpipe.csproj
+++ b/Cyberpipe.csproj
@@ -187,11 +187,6 @@
False
bin\x86\Debug\WHC.Pager.WinControl.dll
-
- False
- .exe
- bin\x86\Debug\WinFormsExtendedViewExample.exe
-
False
bin\x86\Debug\WW.dll
diff --git a/Cyberpipe.csproj b/Cyberpipe.csproj
index 6e90a6e..8f4424d 100644
--- a/Cyberpipe.csproj
+++ b/Cyberpipe.csproj
@@ -187,11 +187,6 @@
False
bin\x86\Debug\WHC.Pager.WinControl.dll
-
- False
- .exe
- bin\x86\Debug\WinFormsExtendedViewExample.exe
-
False
bin\x86\Debug\WW.dll
diff --git a/Cyberpipe.suo b/Cyberpipe.suo
index 0a403c8..eac4ecb 100644
--- a/Cyberpipe.suo
+++ b/Cyberpipe.suo
Binary files differ
diff --git a/Cyberpipe.csproj b/Cyberpipe.csproj
index 6e90a6e..8f4424d 100644
--- a/Cyberpipe.csproj
+++ b/Cyberpipe.csproj
@@ -187,11 +187,6 @@
False
bin\x86\Debug\WHC.Pager.WinControl.dll
-
- False
- .exe
- bin\x86\Debug\WinFormsExtendedViewExample.exe
-
False
bin\x86\Debug\WW.dll
diff --git a/Cyberpipe.suo b/Cyberpipe.suo
index 0a403c8..eac4ecb 100644
--- a/Cyberpipe.suo
+++ b/Cyberpipe.suo
Binary files differ
diff --git a/MainFrm.cs b/MainFrm.cs
index 6e94648..7c574c1 100644
--- a/MainFrm.cs
+++ b/MainFrm.cs
@@ -27,7 +27,6 @@
public partial class MainFrm : Office2007Form
{
TreeNode layerManagerNode;
- TreeNode myPlaceNode = null;
bool m_bFullScreen;
GSOGlobeControl globeControl1;
@@ -45,24 +44,14 @@
GSOLayer layerTemp;
GSOLayer layerTemp2;
- FrmShResult frmShResult = null;
FrmRedlineResult frmredResult = null;
FrmMnModify frmModify;
public bool frmRedlineResult = false;
public bool boolfrmShResult;
public bool boolfrmModify;
- List m_PipelineLayerNames = new List();//线图层名称
- List workwellLayerNames = new List();//工井图层名称
- List valueLayerNames = new List();//阀门图层名称
- List instrumenLayerNames = new List();//附属物图层名称
- List pipefittingLayerNames = new List();//管件图层名称
- List sgPipeLayersNames = new List();//施工管线图层名称
- string roadLayerName = "";
public static string m_CurrentQueryLayer;//定义当前查询的图层
//定位和闪烁初始化定义
- int count = 0;
- private string flashflag = "single";
public bool m_AddPipeLine;//bool添加管线
bool m_isDrawTunnel;//bool创建隧道
@@ -71,10 +60,6 @@
private string trackflag;//定义阀门查询个数
- //管线间距分析
- private GSOFeature disFeature = new GSOFeature();
- private GSOFeature featureDis = new GSOFeature();
-
//记录沿线飞行设置
//int m_nFlyMode = 2;
double m_dFlyAboveLine = 1;
@@ -86,7 +71,7 @@
Boolean m_bDigPitByDepth = true;
//选择管线
int selectState;
- private OracleConnection connBackup = null;
+ //private OracleConnection connBackup = null;
//数据集合
public static GSODataSource ds;
@@ -182,7 +167,7 @@
RigthMenuSet();
MenuSet();
-
+
}
///
/// 右屏中添加管纵图片
@@ -906,13 +891,13 @@
comboBoxEx3.Items.Clear();
comboBoxEx4.Items.Clear();
comboBoxLayer.Items.Clear();
- for (int i = 0; i < m_PipelineLayerNames.Count; i++)
+ foreach (string t1 in Utility.m_PipelineLayerNames)
{
- comboBoxEx1.Items.Add(m_PipelineLayerNames[i]);
- comboBoxEx2.Items.Add(m_PipelineLayerNames[i]);
- comboBoxEx3.Items.Add(m_PipelineLayerNames[i]);
- comboBoxEx4.Items.Add(m_PipelineLayerNames[i]);
- comboBoxLayer.Items.Add(m_PipelineLayerNames[i]);
+ comboBoxEx1.Items.Add(t1);
+ comboBoxEx2.Items.Add(t1);
+ comboBoxEx3.Items.Add(t1);
+ comboBoxEx4.Items.Add(t1);
+ comboBoxLayer.Items.Add(t1);
}
splitContainer1.Panel2Collapsed = true;
@@ -1132,7 +1117,7 @@
}
- delegate void LoadDataForGlobalControl();
+ //delegate void LoadDataForGlobalControl();
private void connectServer()
{
@@ -1142,19 +1127,15 @@
// 勾选实测图层
foreach (TreeNode tn in layerTree.Nodes)
{
- if (tn.Nodes.Count > 0)
+ if (tn.Nodes.Count <= 0) continue;
+ if (tn.Text != "实测数据") continue;
+ tn.Checked = true;
+ foreach (TreeNode tnChild in tn.Nodes)
{
- if (tn.Text == "实测数据")
+ tnChild.Checked = true;
+ foreach (TreeNode tnGrandChild in tnChild.Nodes)
{
- tn.Checked = true;
- foreach (TreeNode tnChild in tn.Nodes)
- {
- tnChild.Checked = true;
- foreach (TreeNode tnGrandChild in tnChild.Nodes)
- {
- tnGrandChild.Checked = true;
- }
- }
+ tnGrandChild.Checked = true;
}
}
}
@@ -1174,7 +1155,7 @@
for (int j = 0; j < Utility.dataSource.DatasetCount; j++)
{
GSODataset dataset = Utility.dataSource.GetDatasetAt(j);
- if (dataset != null && dictionaryNetLayerNameAndCaption.ContainsKey(dataset.Caption))
+ if (dataset != null && Utility.dictionaryNetLayerNameAndCaption.ContainsKey(dataset.Caption))
{
dataset.Caption = dataset.Name;
globeControl1.Globe.Layers.Add(dataset);
@@ -1191,7 +1172,7 @@
for (int j = 0; j < ghDS.DatasetCount; j++)
{
GSODataset dataset = ghDS.GetDatasetAt(j);
- if (dataset != null && dictionaryNetLayerNameAndCaption.ContainsKey(dataset.Caption))
+ if (dataset != null && Utility.dictionaryNetLayerNameAndCaption.ContainsKey(dataset.Caption))
{
dataset.Caption = dataset.Name;
globeControl1.Globe.Layers.Add(dataset);
@@ -1207,7 +1188,7 @@
for (int m = 0; m < sgDS.DatasetCount; m++)
{
GSODataset dataset = sgDS.GetDatasetAt(m);
- if (dataset != null && !dataset.Caption.Contains("SH") && dictionaryNetLayerNameAndCaption.ContainsKey(dataset.Caption))
+ if (dataset != null && !dataset.Caption.Contains("SH") && Utility.dictionaryNetLayerNameAndCaption.ContainsKey(dataset.Caption))
{
dataset.Caption = dataset.Name;
globeControl1.Globe.Layers.Add(dataset);
@@ -1219,8 +1200,14 @@
}
}
- LoadDataForGlobalControl ss = connectServer;
- ss();
+// LoadDataForGlobalControl ss = connectServer;
+// ss();
+
+ this.Invoke((EventHandler) delegate
+ {
+ connectServer();
+ });
+
}
catch (Exception ex)
@@ -1240,7 +1227,7 @@
layerTree.Nodes.Add(layerManagerNode);
XmlDocument doc = new XmlDocument();
- doc.Load(filename);
+ doc.Load(Utility.filename);
XmlNodeList xmlLayerNodes = doc.SelectNodes("//layer");
foreach (XmlNode xmlLayerNode in xmlLayerNodes)
@@ -1295,70 +1282,6 @@
}
- /**
- * 读取Config.xml文件,初始化以下全局Map
- * m_PipelineLayerNames:管线
- * workwellLayerNames:工井
- * valueLayerNames:阀门
- * instrumenLayerNames:附属物
- * pipefittingLayerNames:特征管点
- * sgPipeLayersNames:施工管线
- **/
- private void initGlobalMap()
- {
- XmlDocument doc = new XmlDocument();
- doc.Load(filename);
- XmlNodeList xmlLayerNodes = doc.SelectNodes("//layerchild");
-
- foreach (XmlNode xmlLayerNode in xmlLayerNodes)
- {
- string layerType = xmlLayerNode.Attributes["type"].Value;
- string layerName1 = xmlLayerNode.Attributes["layer"].Value;
- string layerchildName = xmlLayerNode.Attributes["label"].Value;
-
- dictionaryNetLayerNameAndCaption.Add(layerName1, layerchildName);
-
- if (layerType != "db")
- {
- if (xmlLayerNode.Attributes["isRoad"] != null)
- {
- roadLayerName = layerchildName;
- }
- }
- else if (xmlLayerNode.Attributes["isPipeLine"] != null)
- {
- m_PipelineLayerNames.Add(layerchildName);
- g1layername.Add(layerName1);
- }
- else if (xmlLayerNode.Attributes["isWorkWell"] != null)
- {
- workwellLayerNames.Add(layerchildName);
- g1layername.Add(layerName1);
- }
- else if (xmlLayerNode.Attributes["isValve"] != null)
- {
- valueLayerNames.Add(layerchildName);
- g1layername.Add(layerName1);
- }
- else if (xmlLayerNode.Attributes["isAccess"] != null)
- {
- instrumenLayerNames.Add(layerchildName);
- g1layername.Add(layerName1);
- }
- else if (xmlLayerNode.Attributes["isCharacter"] != null)
- {
- pipefittingLayerNames.Add(layerchildName);
- g1layername.Add(layerName1);
- }
- else if (xmlLayerNode.Attributes["isSgData"] != null)
- {
- sgPipeLayersNames.Add(layerchildName);
- g1layername.Add(layerName1);
- }
-
- }
- }
-
private void initMarkerTree()
{
TreeNode node = new TreeNode();
@@ -1380,32 +1303,29 @@
for (int i = 0; i < markerStrs.Length; i++)
{
- if (File.Exists(Application.StartupPath + "\\标注管理\\" + markerStrs[i] + ".lgd"))
- {
- GSOLayer markerLayer = globeControl1.Globe.Layers.Add(Application.StartupPath + "\\标注管理\\" + markerStrs[i] + ".lgd");
- if (markerLayer != null)
- {
- TreeNode node1 = new TreeNode();
- node1.Text = markerLayer.Caption;
- node1.ImageIndex = 0;
- node1.SelectedImageIndex = 0;
- node1.Checked = markerLayer.Visible;
- node1.Tag = markerLayer;
- layerMarkerTree.Nodes[0].Nodes.Add(node1);
- }
- }
+ if (!File.Exists(Application.StartupPath + "\\标注管理\\" + markerStrs[i] + ".lgd")) continue;
+ GSOLayer markerLayer = globeControl1.Globe.Layers.Add(Application.StartupPath + "\\标注管理\\" + markerStrs[i] + ".lgd");
+ if (markerLayer == null) continue;
+ TreeNode node1 = new TreeNode();
+ node1.Text = markerLayer.Caption;
+ node1.ImageIndex = 0;
+ node1.SelectedImageIndex = 0;
+ node1.Checked = markerLayer.Visible;
+ node1.Tag = markerLayer;
+ layerMarkerTree.Nodes[0].Nodes.Add(node1);
}
}
private void MainFrm_Load(object sender, EventArgs e)
{
initGlobalControl();
- initGlobalMap();
+ //initGlobalMap();
initLayerTree();
initMarkerTree();
initLayout();
loadData();
+
double x = Convert.ToDouble(Utility.Query_Roads["绿岛"].ToString().Split(',')[0]);
double y = Convert.ToDouble(Utility.Query_Roads["绿岛"].ToString().Split(',')[1]);
double z = Convert.ToDouble(Utility.Query_Roads["绿岛"].ToString().Split(',')[2]);
@@ -1415,12 +1335,12 @@
#endregion
- Dictionary dictionaryNetLayerNameAndCaption = new Dictionary();
+ //Dictionary Utility.dictionaryNetLayerNameAndCaption = new Dictionary();
void globeControl1_AfterNetLayerAddEvent(object sender, AfterNetLayerAddEventArgs e)
{
- if (e.Layer != null && dictionaryNetLayerNameAndCaption.ContainsKey(e.Layer.Caption))
+ if (e.Layer != null && Utility.dictionaryNetLayerNameAndCaption.ContainsKey(e.Layer.Caption))
{
- e.Layer.Caption = dictionaryNetLayerNameAndCaption[e.Layer.Caption];
+ e.Layer.Caption = Utility.dictionaryNetLayerNameAndCaption[e.Layer.Caption];
}
}
@@ -1530,37 +1450,30 @@
///
Boolean CheckDatasetGeoReference(GSODataset dataset, string strDataPath)
{
+
+ if (dataset.GeoReferenceType != EnumGeoReferenceType.Flat) return true;
Boolean bSuccess = false;
- if (dataset.GeoReferenceType == EnumGeoReferenceType.Flat)
- {
- if (MessageBox.Show("数据没有空间参考信息,请设置空间参考信息!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) == DialogResult.OK)
- {
- String strPath = Application.StartupPath + "\\Coordinate Systems";
- OpenFileDialog dlg = new OpenFileDialog();
+ if (MessageBox.Show("数据没有空间参考信息,请设置空间参考信息!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) !=
+ DialogResult.OK) return bSuccess;
+ String strPath = Application.StartupPath + "\\Coordinate Systems";
+ OpenFileDialog dlg = new OpenFileDialog();
- dlg.InitialDirectory = strPath;
- dlg.RestoreDirectory = true;
+ dlg.InitialDirectory = strPath;
+ dlg.RestoreDirectory = true;
- dlg.Filter = "投影文件|*.prj||";
- if (dlg.ShowDialog() == DialogResult.OK)
- {
- string lprjStr = GSODataEngineUtility.ConvertEsriPrjFileToProj4(dlg.FileName);
- string lprjFileContent = "0prj4" + lprjStr + "";
+ dlg.Filter = "投影文件|*.prj||";
+ if (dlg.ShowDialog() != DialogResult.OK) return bSuccess;
+ string lprjStr = GSODataEngineUtility.ConvertEsriPrjFileToProj4(dlg.FileName);
+ string lprjFileContent = "0prj4" + lprjStr +
+ "";
- bSuccess = dataset.LoadProjectionFromESRIFile(dlg.FileName);
+ bSuccess = dataset.LoadProjectionFromESRIFile(dlg.FileName);
- string lprjFileName = strDataPath.Substring(0, strDataPath.LastIndexOf(".")) + ".lprj";
- StreamWriter writer = new StreamWriter(lprjFileName, false);
- writer.Write(lprjFileContent);
- writer.Close();
+ string lprjFileName = strDataPath.Substring(0, strDataPath.LastIndexOf(".")) + ".lprj";
+ StreamWriter writer = new StreamWriter(lprjFileName, false);
+ writer.Write(lprjFileContent);
+ writer.Close();
- }
- }
- }
- else
- {
- return true;
- }
return bSuccess;
}
@@ -1571,49 +1484,47 @@
///
void globeControl1_TrackRectEndEvent(object sender, TrackRectEndEventArgs e)
{
- if (e.Polygon != null)
+ if (e.Polygon == null) return;
+ globeControl1.Globe.TrackRectTool.Clear();
+ globeControl1.ImmediatelyRefresh();
+ globeControl1.SwapBuffer();
+ Point pt1 = new Point(Convert.ToInt32(e.StartPos.X), Convert.ToInt32(e.StartPos.Y));
+ Point pt2 = new Point(Convert.ToInt32(e.EndPos.X), Convert.ToInt32(e.EndPos.Y));
+
+ int mapWidth = 0;
+ int mapHeight = 0;
+ Point pt = getUpperLeftPoint(pt1, pt2, out mapWidth, out mapHeight);
+ int rightBottomX = pt.X + mapWidth;
+ int rightBottomY = pt.Y + mapHeight;
+ Image myImg = new Bitmap(mapWidth, mapHeight);
+ Graphics g = Graphics.FromImage(myImg);
+ g.CopyFromScreen(pt, new Point(0, 0), new Size(rightBottomX, rightBottomY));
+
+ SaveFileDialog dlg = new SaveFileDialog();
+ dlg.Filter = "输出JPEG(*.jpg)|*.jpg|输出PNG(*.png)|*.png|输出BMP(*.bmp)|*.bmp|输出BMP(*.gif)|*.gif";
+ if (dlg.ShowDialog() == DialogResult.OK)
{
- globeControl1.Globe.TrackRectTool.Clear();
- globeControl1.ImmediatelyRefresh();
- globeControl1.SwapBuffer();
- Point pt1 = new Point(Convert.ToInt32(e.StartPos.X), Convert.ToInt32(e.StartPos.Y));
- Point pt2 = new Point(Convert.ToInt32(e.EndPos.X), Convert.ToInt32(e.EndPos.Y));
-
- int mapWidth = 0;
- int mapHeight = 0;
- Point pt = getUpperLeftPoint(pt1, pt2, out mapWidth, out mapHeight);
- int rightBottomX = pt.X + mapWidth;
- int rightBottomY = pt.Y + mapHeight;
- Image myImg = new Bitmap(mapWidth, mapHeight);
- Graphics g = Graphics.FromImage(myImg);
- g.CopyFromScreen(pt, new Point(0, 0), new Size(rightBottomX, rightBottomY));
-
- SaveFileDialog dlg = new SaveFileDialog();
- dlg.Filter = "输出JPEG(*.jpg)|*.jpg|输出PNG(*.png)|*.png|输出BMP(*.bmp)|*.bmp|输出BMP(*.gif)|*.gif";
- if (dlg.ShowDialog() == DialogResult.OK)
+ string extension = Path.GetExtension(dlg.FileName);//扩展名
+ switch (extension)
{
- string extension = Path.GetExtension(dlg.FileName);//扩展名
- switch (extension)
- {
- case ".jpg":
- myImg.Save(dlg.FileName, ImageFormat.Jpeg);
- break;
- case ".png":
- myImg.Save(dlg.FileName, ImageFormat.Png);
- break;
- case ".bmp":
- myImg.Save(dlg.FileName, ImageFormat.Bmp);
- break;
- case ".gif":
- myImg.Save(dlg.FileName, ImageFormat.Gif);
- break;
- default:
- break;
- }
+ case ".jpg":
+ myImg.Save(dlg.FileName, ImageFormat.Jpeg);
+ break;
+ case ".png":
+ myImg.Save(dlg.FileName, ImageFormat.Png);
+ break;
+ case ".bmp":
+ myImg.Save(dlg.FileName, ImageFormat.Bmp);
+ break;
+ case ".gif":
+ myImg.Save(dlg.FileName, ImageFormat.Gif);
+ break;
+ default:
+ break;
}
- globeControl1.Globe.Action = EnumAction3D.ActionNull;
- globeControl1.Globe.MouseRoamingEnable = true;
}
+ globeControl1.Globe.Action = EnumAction3D.ActionNull;
+ globeControl1.Globe.MouseRoamingEnable = true;
}
///
/// 定位正北正90度俯视
@@ -1711,18 +1622,12 @@
///
private void CheckControl(TreeViewEventArgs e)
{
- if (e.Action != TreeViewAction.Unknown)
+ if (e.Action == TreeViewAction.Unknown||e.Node == null || Convert.IsDBNull(e.Node)) return;
+ CheckParentNode(e.Node);
+ if (e.Node.Nodes.Count > 0)
{
- if (e.Node != null && !Convert.IsDBNull(e.Node))
- {
- CheckParentNode(e.Node);
- if (e.Node.Nodes.Count > 0)
- {
- CheckAllChildNodes(e.Node, e.Node.Checked);
- }
- }
+ CheckAllChildNodes(e.Node, e.Node.Checked);
}
-
}
///
/// 改变所有子节点的状态
@@ -1747,94 +1652,88 @@
{
bool bChecked = false;
- if (curNode.Parent != null)
+ if (curNode.Parent == null) return;
+ foreach (TreeNode node in curNode.Parent.Nodes)
{
- foreach (TreeNode node in curNode.Parent.Nodes)
+ if (node.Checked)
{
- if (node.Checked)
- {
- bChecked = true;
- break;
- }
+ bChecked = true;
+ break;
}
+ }
- if (bChecked)
- {
- curNode.Parent.Checked = true;
- CheckParentNode(curNode.Parent);
- }
- else
- {
- curNode.Parent.Checked = false;
- CheckParentNode(curNode.Parent);
- }
+ if (bChecked)
+ {
+ curNode.Parent.Checked = true;
+ CheckParentNode(curNode.Parent);
+ }
+ else
+ {
+ curNode.Parent.Checked = false;
+ CheckParentNode(curNode.Parent);
}
}
private void layerTree_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
{
- if (e.Button == MouseButtons.Right)
+ if (e.Button != MouseButtons.Right) return;
+ layerTree.SelectedNode = e.Node;
+ if (e.Node.Tag == null) return;
+ if (e.Button == MouseButtons.Right && e.Node.Tag.ToString().Contains("|"))
{
- layerTree.SelectedNode = e.Node;
- if (e.Node.Tag != null)
+
+ if (e.Node.Tag.ToString().Split('|')[0] == "locaserver")
{
- if (e.Button == MouseButtons.Right && e.Node.Tag.ToString().Contains("|"))
+
+ foreach (ToolStripItem item in layerNodeContexMenu.Items)
{
-
- if (e.Node.Tag.ToString().Split('|')[0] == "locaserver")
- {
-
- foreach (ToolStripItem item in layerNodeContexMenu.Items)
- {
- item.Visible = false;
- }
- return;
-
- }
-
- if (e.Node.Tag.ToString().Split('|')[0] == "new")
- {
- LayerEditableMenuItem.Enabled = true;
- foreach (ToolStripItem item in layerNodeContexMenu.Items)
- {
- item.Visible = false;
- }
- LayerSelectableMenuItem.Visible = true;
- LayerEditableMenuItem.Visible = true;
- RemoveLayer.Visible = true;
- RefreshLayerFeatureListMenuItem.Visible = true;
- SaveLayerMenuItem.Visible = true;
- LayerFlyMenuItem.Visible = true;
- }
-
- LayerSelectableMenuItem.Visible = true;
- LayerEditableMenuItem.Visible = true;
- SaveLayerMenuItem.Visible = true;
- LayerFlyMenuItem.Visible = true;
- 导出CADToolStripMenuItem1.Visible = true;
-
- layerNodeContexMenu.Show(layerTree, e.X, e.Y);
- layerNodeContexMenu.Tag = e.Node;
- GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(e.Node.Tag.ToString().Split('|')[1]);
- if (layer != null)
- {
- LayerSelectableMenuItem.Checked = layer.Selectable;
- LayerEditableMenuItem.Checked = layer.Editable;
- }
+ item.Visible = false;
}
- else
+ return;
+
+ }
+
+ if (e.Node.Tag.ToString().Split('|')[0] == "new")
+ {
+ LayerEditableMenuItem.Enabled = true;
+ foreach (ToolStripItem item in layerNodeContexMenu.Items)
{
- if (e.Node.Tag is GSOLayer && e.Node.Parent != null && e.Node.Parent.Text.Trim() == "临时图层")
- {
- contextMenuStripDeleteLayerNode.Show(layerTree, e.X, e.Y);
- contextMenuStripDeleteLayerNode.Tag = e.Node;
- }
- if (e.Node.Tag is GSOFeature && e.Node.Parent != null && e.Node.Parent.Text.Trim() == "我的地标")
- {
- contextMenuStripDeleteLayerNode.Show(layerTree, e.X, e.Y);
- contextMenuStripDeleteLayerNode.Tag = e.Node;
- }
+ item.Visible = false;
}
+ //LayerSelectableMenuItem.Visible = true;
+ //LayerEditableMenuItem.Visible = true;
+ RemoveLayer.Visible = true;
+ RefreshLayerFeatureListMenuItem.Visible = true;
+ //SaveLayerMenuItem.Visible = true;
+ //LayerFlyMenuItem.Visible = true;
+ }
+
+ LayerSelectableMenuItem.Visible = true;
+ LayerEditableMenuItem.Visible = true;
+ SaveLayerMenuItem.Visible = true;
+ LayerFlyMenuItem.Visible = true;
+ 导出CADToolStripMenuItem1.Visible = true;
+
+ layerNodeContexMenu.Show(layerTree, e.X, e.Y);
+ layerNodeContexMenu.Tag = e.Node;
+ GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(e.Node.Tag.ToString().Split('|')[1]);
+ if (layer != null)
+ {
+ LayerSelectableMenuItem.Checked = layer.Selectable;
+ LayerEditableMenuItem.Checked = layer.Editable;
+ }
+ }
+ else
+ {
+ if (e.Node.Tag is GSOLayer && e.Node.Parent != null && e.Node.Parent.Text.Trim() == "临时图层")
+ {
+ contextMenuStripDeleteLayerNode.Show(layerTree, e.X, e.Y);
+ contextMenuStripDeleteLayerNode.Tag = e.Node;
+ }
+ else if (e.Node.Tag is GSOFeature && e.Node.Parent != null && e.Node.Parent.Text.Trim() == "我的地标")
+ {
+ contextMenuStripDeleteLayerNode.Show(layerTree, e.X, e.Y);
+ contextMenuStripDeleteLayerNode.Tag = e.Node;
}
}
}
@@ -1909,110 +1808,103 @@
{
TreeNode node = layerTree.SelectedNode;
- if (node != null)
+ if (node == null) return;
+ if (node.Parent.Text.Trim() == "临时图层")
{
- if (node.Parent.Text.Trim() == "临时图层")
+ GSOLayer lsLayer = globeControl1.Globe.Layers.GetLayerByCaption(node.Text);
+ double x = lsLayer.LatLonBounds.Center.X;
+ double y = lsLayer.LatLonBounds.Center.Y;
+ if (x == 0 && y == 0)
{
- GSOLayer lsLayer = globeControl1.Globe.Layers.GetLayerByCaption(node.Text);
- double x = lsLayer.LatLonBounds.Center.X;
- double y = lsLayer.LatLonBounds.Center.Y;
- if (x == 0 && y == 0)
- {
- x = lsLayer.Bounds.Center.X;
- y = lsLayer.Bounds.Center.Y;
- }
+ x = lsLayer.Bounds.Center.X;
+ y = lsLayer.Bounds.Center.Y;
+ }
- globeControl1.Globe.FlyToPosition(new GSOPoint3d(x, y, 10), EnumAltitudeMode.Absolute);
+ globeControl1.Globe.FlyToPosition(new GSOPoint3d(x, y, 10), EnumAltitudeMode.Absolute);
+ }
+ else
+ {
+ GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(node.Tag.ToString().Split('|')[1]);
+
+ if (layer == null) return;
+ if (layer.Caption == "红线")
+ {
+ globeControl1.Globe.FlyToPosition(new GSOPoint3d(120.610963, 31.188121, 50), EnumAltitudeMode.Absolute, -4, 50, 1000);
+ globeControl1.Globe.FlyToPointSpeed = 10000000;
+ globeControl1.Globe.Action = EnumAction3D.SelectObject;
+
+ GSOLayer redLayer = globeControl1.Globe.Layers.GetLayerByCaption("红线");
+ if (redLayer != null)
+ {
+ redLayer.Visible = true;
+ }
+ globeControl1.Refresh();
}
else
{
- GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(node.Tag.ToString().Split('|')[1]);
-
- if (layer != null)
- {
- if (layer.Caption == "红线")
- {
- globeControl1.Globe.FlyToPosition(new GSOPoint3d(120.610963, 31.188121, 50), EnumAltitudeMode.Absolute, -4, 50, 1000);
- globeControl1.Globe.FlyToPointSpeed = 10000000;
- globeControl1.Globe.Action = EnumAction3D.SelectObject;
-
- GSOLayer redLayer = globeControl1.Globe.Layers.GetLayerByCaption("红线");
- if (redLayer != null)
- {
- redLayer.Visible = true;
- }
- globeControl1.Refresh();
- }
- else
- {
- double x = layer.LatLonBounds.Center.X;
- double y = layer.LatLonBounds.Center.Y;
- globeControl1.Globe.FlyToPosition(new GSOPoint3d(x, y, 100), EnumAltitudeMode.Absolute);
- }
- }
+ double x = layer.LatLonBounds.Center.X;
+ double y = layer.LatLonBounds.Center.Y;
+ globeControl1.Globe.FlyToPosition(new GSOPoint3d(x, y, 100), EnumAltitudeMode.Absolute);
}
}
}
private void layerTree_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e)
{
- if (layerTree.SelectedNode != null)
+ if (layerTree.SelectedNode == null) return;
+ if (layerTree.SelectedNode.Tag.ToString().Contains("|"))
{
- if (layerTree.SelectedNode.Tag.ToString().Contains("|"))
+ string nodeTag = layerTree.SelectedNode.Tag.ToString().Split('|')[1];
+ GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(nodeTag);
+ if (layer != null)
{
- string nodeTag = layerTree.SelectedNode.Tag.ToString().Split('|')[1];
- GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(nodeTag);
- if (layer != null)
+ if (layer.Caption == "红线")
{
- if (layer.Caption == "红线")
- {
- globeControl1.Globe.FlyToPosition(new GSOPoint3d(120.610963, 31.188121, 50), EnumAltitudeMode.Absolute, -4, 50, 1000);
- globeControl1.Globe.FlyToPointSpeed = 10000000;
- globeControl1.Globe.Action = EnumAction3D.SelectObject;
+ globeControl1.Globe.FlyToPosition(new GSOPoint3d(120.610963, 31.188121, 50), EnumAltitudeMode.Absolute, -4, 50, 1000);
+ globeControl1.Globe.FlyToPointSpeed = 10000000;
+ globeControl1.Globe.Action = EnumAction3D.SelectObject;
- GSOLayer redLayer = globeControl1.Globe.Layers.GetLayerByCaption("红线");
- if (redLayer != null)
- {
- redLayer.Visible = true;
- }
- globeControl1.Refresh();
- }
- else
+ GSOLayer redLayer = globeControl1.Globe.Layers.GetLayerByCaption("红线");
+ if (redLayer != null)
{
- double x = layer.LatLonBounds.Center.X;
- double y = layer.LatLonBounds.Center.Y;
- globeControl1.Globe.FlyToPosition(new GSOPoint3d(x, y, 0), EnumAltitudeMode.Absolute);
+ redLayer.Visible = true;
}
+ globeControl1.Refresh();
+ }
+ else
+ {
+ double x = layer.LatLonBounds.Center.X;
+ double y = layer.LatLonBounds.Center.Y;
+ globeControl1.Globe.FlyToPosition(new GSOPoint3d(x, y, 0), EnumAltitudeMode.Absolute);
}
}
- if (layerTree.SelectedNode.Tag is GSOLayer)
+ }
+ if (layerTree.SelectedNode.Tag is GSOLayer)
+ {
+ GSOLayer layer = layerTree.SelectedNode.Tag as GSOLayer;
+ if (layer.GetAllFeatures().Length > 0)
{
- GSOLayer layer = layerTree.SelectedNode.Tag as GSOLayer;
- if (layer.GetAllFeatures().Length > 0)
+ GSOFeature feature = layer.GetAt(0);
+ if (feature != null && feature.Geometry != null)
{
- GSOFeature feature = layer.GetAt(0);
- if (feature != null && feature.Geometry != null)
- {
- globeControl1.Globe.FlyToPosition(feature.Geometry.GeoCenterPoint, EnumAltitudeMode.Absolute);//, 0, 0, 1000);
- }
- else
- {
- globeControl1.Globe.FlyToFeature(feature);
- }
- }
- }
- if (layerTree.SelectedNode.Tag is GSOFeature)
- {
- GSOFeature feature = layerTree.SelectedNode.Tag as GSOFeature;
- if (feature.Geometry != null)
- {
- globeControl1.Globe.FlyToPosition(feature.Geometry.GeoCenterPoint, EnumAltitudeMode.Absolute, 0, 0, 10);
+ globeControl1.Globe.FlyToPosition(feature.Geometry.GeoCenterPoint, EnumAltitudeMode.Absolute);//, 0, 0, 1000);
}
else
{
globeControl1.Globe.FlyToFeature(feature);
}
}
+ } else if (layerTree.SelectedNode.Tag is GSOFeature)
+ {
+ GSOFeature feature = layerTree.SelectedNode.Tag as GSOFeature;
+ if (feature.Geometry != null)
+ {
+ globeControl1.Globe.FlyToPosition(feature.Geometry.GeoCenterPoint, EnumAltitudeMode.Absolute, 0, 0, 10);
+ }
+ else
+ {
+ globeControl1.Globe.FlyToFeature(feature);
+ }
}
}
@@ -2086,7 +1978,7 @@
trackPolylineEndMode == EnumTrackPolylineEndMode.DLDM_Analysis)
{
Dictionary hdmDic = SectionAnalysisTool.HDMAnalysis(globeControl1,
- e.Polyline, m_PipelineLayerNames);
+ e.Polyline, Utility.m_PipelineLayerNames);
FrmHDMAnalysis3 frm = new FrmHDMAnalysis3(hdmDic, globeControl1,
trackPolylineEndMode);
frm.Show(this);
@@ -2103,185 +1995,6 @@
* **/
}
trackPolylineEndMode = EnumTrackPolylineEndMode.Default_Analysis;
- /*
- ArrayList arraylistPoint = new ArrayList();
- ArrayList arraylistLine = new ArrayList();
-
- // globeControl1.Globe.ClearLastTrackPolyline();
-
- if (e.Polyline != null)
- {
- //横断面分析
- if (buttonItemFX2_1.Checked || buttonItemFX2_3.Checked)
- {
- if (m_PipelineLayerNames != null)
- {
- GSOGeoPolygon3D polygon = e.Polyline.CreateBuffer(0.1, true, 5, true, false);
- for (int i = 0; i < m_PipelineLayerNames.Count; i++)
- {
- if (m_PipelineLayerNames[i] != null)
- {
- GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(m_PipelineLayerNames[i]);
- if (layer == null)
- {
- continue;
- }
- if (layer.Visible == false)
- {
- continue;
- }
- GSOFeatureLayer featurelayer = layer as GSOFeatureLayer;
- if (featurelayer != null)
- {
- GSOFeatures feats = featurelayer.FindFeaturesInPolygon(polygon, false); //featurelayer.GetAllFeatures();
- if (feats != null)
- {
- for (int j = 0; j < feats.Length; j++)
- {
- GSOFeature feateline = feats[j];
- GSOGeoPolyline3D geoline = feateline.Geometry as GSOGeoPolyline3D;
-
- if (geoline != null)
- {
- if (geoline.Style != null)
- {
- if (geoline.Style.GetType() == typeof(GSOPipeLineStyle3D))
- {
- GSOPoint3d pntIntersect1 = new GSOPoint3d();
- GSOPoint3d pntIntersect2 = new GSOPoint3d();
-
- double honLen;
- double verLen;
- double dDist = globeControl1.Globe.Analysis3D.ComputeTwoGeoPolylineDistance(e.Polyline, geoline, out pntIntersect1, out pntIntersect2, out honLen, out verLen, false, false, 0);
-
- globeControl1.Globe.Action = EnumAction3D.ActionNull;
- if (dDist > -1)
- {
- arraylistPoint.Add(pntIntersect2);
- arraylistLine.Add(feateline);
- }
- }
- }
- }
- }
- }
- else
- {
- MessageBox.Show("请重新绘制断面");
- return;
- }
-
- }
- }
- }
- }
- if (buttonItemFX2_1.Checked)
- {
- FrmHDMAnalysis3 frm = FrmHDMAnalysis3.GetForm(arraylistPoint, arraylistLine, e.Polyline, globeControl1);
- if (!frm.isShowFirst)
- {
- frm.Show(this);
- }
- frm.LoadChartEvent();
- }
- else
- {
- FrmRoadHDM frm = FrmRoadHDM.GetForm(arraylistPoint, arraylistLine, e.Polyline, globeControl1);
- if (!frm.isShowFirst)
- {
- frm.Show(this);
- }
- frm.LoadChartEvent();
- }
- globeControl1.Globe.ClearLastTrackPolyline();
- }
- else if (buttonItemFX2_4.Checked)
- {
- FrmBaseLineProfillAnalysis dlg = new FrmBaseLineProfillAnalysis(globeControl1.Globe, e.Polyline);
- dlg.Show(this);
- globeControl1.Globe.ClearLastTrackPolyline();
- }
- else if (buttonItemFX4_3.Checked)
- {
- GSOGeoPolygon3D resPolygon = e.Polyline.CreateBuffer(m_dDigPitWidthAlongLine, false, 0, false, false);
-
- GSOGeoPit geoPit = new GSOGeoPit();
- geoPit.PitPolygon = resPolygon;
- if (m_bDigPitByDepth)
- {
- geoPit.PitDepth = m_dDigPitValue;
- geoPit.PitDepthUsing = true;
- }
- else
- {
- geoPit.PitBottomAlt = m_dDigPitValue;
- geoPit.PitDepthUsing = false;
- }
-
- globeControl1.Globe.AddPit("", geoPit);
- GSOLayer layerGround = globeControl1.Globe.Layers.GetLayerByCaption(roadLayerName);// ("180fd");
- if (layerGround != null)
- {
- layerGround.Visible = false;
- }
- // 清除当前TrackPolygonAnalysis的痕迹
- globeControl1.Globe.ClearLastTrackPolyline();
- }
- else if (distanceMarker)
- {
- setMarkerLayerUnVisible("距离标注");
- GSOLayer l = globeControl1.Globe.Layers.GetLayerByCaption("距离标注");
- if (l != null)
- {
- l.Visible = true;
- if (getLabelName(l) != -1)
- {
- GSOGeoPolyline3D line = e.Polyline;
- if (line.PartCount > 0)
- {
- double length = line.GetSpaceLength(true, 6378137);//线的长度
- if (length == 0)
- {
- return;
- }
- else
- {
-
- GSOGeoPoint3D pt = new GSOGeoPoint3D();
- GSOGeoPolyline3D lineLine = line.GetSegment(0, length / 2);
- GSOPoint3d point3d = lineLine[lineLine.PartCount - 1][lineLine[lineLine.PartCount - 1].Count - 1];
- pt.X = point3d.X;
- pt.Y = point3d.Y;
- pt.Z = point3d.Z;
-
- string Twodecimalplaces = string.Format("{0:F}", length);
- string radiusLabelName = "" + Twodecimalplaces + "米";
- //string radiusLabelName = "" + length + "米";//标注名称
-
- GSOPoint2d point2d = new GSOPoint2d(0, 30);//标注位置
-
- int labelText = getLabelName(l);
-
- GSOFeature newFeatureLine = new GSOFeature();
- newFeatureLine.Geometry = line;
- newFeatureLine.Name = (labelText + 1).ToString() + "-line";
- l.AddFeature(newFeatureLine);
- globeControl1.Globe.ClearLastTrackPolyline();
-
- GSOFeature newFeature = new GSOFeature();
- newFeature = createLabel(l, newFeature, pt, radiusLabelName, (labelText + 1).ToString(), point2d);
- l.AddFeature(newFeature);
-
- globeControl1.Refresh();
- }
- }
- }
- }
- }
- }
- globeControl1.Globe.Action = EnumAction3D.ActionNull;
- ActionToolMenuChecked();
- * **/
}
#endregion
@@ -2292,83 +2005,81 @@
///
void globeControl1_TrackPolygonEndEvent(object sender, TrackPolygonEndEventArgs e)
{
- if (globeControl1.Globe.Action == EnumAction3D.TrackPolygon && e.Polygon != null)
+ if (globeControl1.Globe.Action != EnumAction3D.TrackPolygon || e.Polygon == null) return;
+ GSOGeoPolygon3D polygon = e.Polygon;
+
+ switch (trackflag)
{
- GSOGeoPolygon3D polygon = e.Polygon;
+ case "valvequery":
+ FrmValveStatistics frm = new FrmValveStatistics(globeControl1, polygon, InitDataGridViewX1);
+ frm.Show(this);
+ globeControl1.Globe.Action = EnumAction3D.ActionNull;
+ break;
- switch (trackflag)
- {
- case "valvequery":
- FrmValveStatistics frm = new FrmValveStatistics(globeControl1, polygon, InitDataGridViewX1);
- frm.Show(this);
- globeControl1.Globe.Action = EnumAction3D.ActionNull;
- break;
+ case "PipelineDistanceStatistics":
- case "PipelineDistanceStatistics":
+ FrmAllPipelineStatis frm1 = new FrmAllPipelineStatis(globeControl1, polygon, InitDataGridViewX1, Utility.m_PipelineLayerNames);
+ frm1.Show(this);
+ globeControl1.Globe.Action = EnumAction3D.ActionNull;
- FrmAllPipelineStatis frm1 = new FrmAllPipelineStatis(globeControl1, polygon, InitDataGridViewX1, m_PipelineLayerNames);
- frm1.Show(this);
- globeControl1.Globe.Action = EnumAction3D.ActionNull;
+ break;
+ case "PipelineSpatialQuery":
- break;
- case "PipelineSpatialQuery":
+ FrmAllPipelineStatis.ShowForm(globeControl1, polygon, InitDataGridViewX1, Utility.m_PipelineLayerNames);
+ globeControl1.Globe.ClearAnalysis();
+ globeControl1.Globe.Action = EnumAction3D.ActionNull;
- FrmAllPipelineStatis.ShowForm(globeControl1, polygon, InitDataGridViewX1, m_PipelineLayerNames);
- globeControl1.Globe.ClearAnalysis();
- globeControl1.Globe.Action = EnumAction3D.ActionNull;
+ break;
+ case "workwellquery":
+ FrmAllWorkWellStatis frmWell = new FrmAllWorkWellStatis(globeControl1, polygon, InitDataGridViewX1);
+ frmWell.Show(this);
- break;
- case "workwellquery":
- FrmAllWorkWellStatis frmWell = new FrmAllWorkWellStatis(globeControl1, polygon, InitDataGridViewX1);
- frmWell.Show(this);
+ globeControl1.Globe.Action = EnumAction3D.ActionNull;
- globeControl1.Globe.Action = EnumAction3D.ActionNull;
+ break;
- break;
-
- case "pit":
- double depth;
- FrmTackPolygonDlg dlg = new FrmTackPolygonDlg();
- if (dlg.ShowDialog() == DialogResult.OK)
+ case "pit":
+ double depth;
+ FrmTackPolygonDlg dlg = new FrmTackPolygonDlg();
+ if (dlg.ShowDialog() == DialogResult.OK)
+ {
+ depth = dlg.depth;
+ GSOGeoPit geoPit = new GSOGeoPit();
+ geoPit.PitPolygon = polygon;
+ geoPit.PitDepth = depth;
+ geoPit.PitDepthUsing = true;
+ globeControl1.Globe.AddPit("", geoPit);
+ GSOLayer layerGround = globeControl1.Globe.Layers.GetLayerByCaption(Utility.roadLayerName);//("180fd");
+ if (layerGround != null)
{
- depth = dlg.depth;
- GSOGeoPit geoPit = new GSOGeoPit();
- geoPit.PitPolygon = polygon;
- geoPit.PitDepth = depth;
- geoPit.PitDepthUsing = true;
- globeControl1.Globe.AddPit("", geoPit);
- GSOLayer layerGround = globeControl1.Globe.Layers.GetLayerByCaption(roadLayerName);//("180fd");
- if (layerGround != null)
- {
- layerGround.Visible = false;
- }
+ layerGround.Visible = false;
}
- globeControl1.Globe.ClearLastTrackPolygon();
- globeControl1.Globe.Action = EnumAction3D.ActionNull;
- break;
- case "digFillAnalysis":
- DigFillAnalysisDlg dlg1 = new DigFillAnalysisDlg();
- dlg1.m_globe = globeControl1.Globe;
- dlg1.m_polygon3D = polygon;
- globeControl1.Globe.Action = EnumAction3D.ActionNull;
- dlg1.Show(this);
- break;
- case "FloodAnalysis":
- FrmFloodAnalysis frmFloodAnalysis = new FrmFloodAnalysis(globeControl1.Globe, polygon);
- frmFloodAnalysis.Show(this);
- globeControl1.Globe.Action = EnumAction3D.ActionNull;
- break;
- case "BSQDuoBianXiangStatis":
- FrmBSQStatis bsqFrm = new FrmBSQStatis(globeControl1, e.Polygon);
- bsqFrm.Show(this);
- globeControl1.Globe.Action = EnumAction3D.ActionNull;
- break;
+ }
+ globeControl1.Globe.ClearLastTrackPolygon();
+ globeControl1.Globe.Action = EnumAction3D.ActionNull;
+ break;
+ case "digFillAnalysis":
+ DigFillAnalysisDlg dlg1 = new DigFillAnalysisDlg();
+ dlg1.m_globe = globeControl1.Globe;
+ dlg1.m_polygon3D = polygon;
+ globeControl1.Globe.Action = EnumAction3D.ActionNull;
+ dlg1.Show(this);
+ break;
+ case "FloodAnalysis":
+ FrmFloodAnalysis frmFloodAnalysis = new FrmFloodAnalysis(globeControl1.Globe, polygon);
+ frmFloodAnalysis.Show(this);
+ globeControl1.Globe.Action = EnumAction3D.ActionNull;
+ break;
+ case "BSQDuoBianXiangStatis":
+ FrmBSQStatis bsqFrm = new FrmBSQStatis(globeControl1, e.Polygon);
+ bsqFrm.Show(this);
+ globeControl1.Globe.Action = EnumAction3D.ActionNull;
+ break;
- case "":
- break;
- default:
- break;
- }
+ case "":
+ break;
+ default:
+ break;
}
}
///
@@ -2380,16 +2091,14 @@
{
try
{
- if (e.Feature != null)
+ if (e.Feature == null) return;
+ if (isFeatureContainsBianhao(e.Feature))
{
- if (isFeatureContainsBianhao(e.Feature))
- {
- featureTooltip.ShowBalloon((int)e.MousePos.X, (int)e.MousePos.Y, e.Feature.GetValue(featureIDFieldName).ToString());
- }
- else if (e.Feature.Name != "")
- {
- featureTooltip.ShowBalloon((int)e.MousePos.X, (int)e.MousePos.Y, e.Feature.Name);
- }
+ featureTooltip.ShowBalloon((int)e.MousePos.X, (int)e.MousePos.Y, e.Feature.GetValue(featureIDFieldName).ToString());
+ }
+ else if (e.Feature.Name != "")
+ {
+ featureTooltip.ShowBalloon((int)e.MousePos.X, (int)e.MousePos.Y, e.Feature.Name);
}
}
catch (Exception ex)
@@ -2405,192 +2114,188 @@
/// (完善)
void globeControl1_MouseDoubleClick(object sender, MouseEventArgs e)
{
- if (e.Button == MouseButtons.Left)
+ if (e.Button != MouseButtons.Left) return;
+ if (m_AddPipeLine && globeControl1.Globe.Action == EnumAction3D.DrawPolyline)//添加管线
{
- if (m_AddPipeLine && globeControl1.Globe.Action == EnumAction3D.DrawPolyline)//添加管线
+ GSOLayer layerDest = globeControl1.Globe.DestLayerFeatureAdd;
+ if (layerDest != null)
{
- GSOLayer layerDest = globeControl1.Globe.DestLayerFeatureAdd;
- if (layerDest != null)
+ GSOFeatures features = layerDest.GetAllFeatures();
+ GSOFeature f = features[features.Length - 1];
+ GSOGeoPolyline3D line = f.Geometry as GSOGeoPolyline3D;
+ globeControl1.Globe.Action = EnumAction3D.ActionNull;
+ if (f != null && f.Geometry.Type == EnumGeometryType.GeoPolyline3D)
{
- GSOFeatures features = layerDest.GetAllFeatures();
- GSOFeature f = features[features.Length - 1];
- GSOGeoPolyline3D line = f.Geometry as GSOGeoPolyline3D;
- globeControl1.Globe.Action = EnumAction3D.ActionNull;
- if (f != null && f.Geometry.Type == EnumGeometryType.GeoPolyline3D)
- {
- FrmLineCoordinate lineCoordiante = new FrmLineCoordinate(f, globeControl1, layerDest.Caption);
- lineCoordiante.Show(this);
- }
- globeControl1.Refresh();
- }
- }
- if (m_isDrawTunnel && globeControl1.Globe.Action == EnumAction3D.DrawPolyline)//创建隧道
- {
- GSOLayer tunnel = globeControl1.Globe.Layers.GetLayerByCaption("隧道");
- if (tunnel != null && tunnel.GetAllFeatures().Length > 0)
- {
- GSOFeature feature = tunnel.GetAt(tunnel.GetAllFeatures().Length - 1);
- FrmCreateTunnel frm = new FrmCreateTunnel(globeControl1, feature);
- if (frm.ShowDialog() == DialogResult.OK)
- {
- //tunnel.Save();
- }
+ FrmLineCoordinate lineCoordiante = new FrmLineCoordinate(f, globeControl1, layerDest.Caption);
+ lineCoordiante.Show(this);
}
globeControl1.Refresh();
}
- if (m_isDrawCitySevenLine && globeControl1.Globe.Action == EnumAction3D.DrawPolyline)//绘制城市七线
+ }
+ if (m_isDrawTunnel && globeControl1.Globe.Action == EnumAction3D.DrawPolyline)//创建隧道
+ {
+ GSOLayer tunnel = globeControl1.Globe.Layers.GetLayerByCaption("隧道");
+ if (tunnel != null && tunnel.GetAllFeatures().Length > 0)
{
- string lineType = citySevenLineType;
- string lineName = cityServerLineName;
- GSOFeature feature = null;
- switch (lineType)
+ GSOFeature feature = tunnel.GetAt(tunnel.GetAllFeatures().Length - 1);
+ FrmCreateTunnel frm = new FrmCreateTunnel(globeControl1, feature);
+ if (frm.ShowDialog() == DialogResult.OK)
{
- case "城市红线":
- GSOLayer layerRed = globeControl1.Globe.Layers.GetLayerByCaption(lineType);
- if (layerRed != null && layerRed.GetAllFeatures().Length > 0)
- {
- feature = layerRed.GetAt(layerRed.GetAllFeatures().Length - 1);
- if (feature != null)
- {
- feature.Name = lineName;
- GSOSimpleLineStyle3D style = new GSOSimpleLineStyle3D();
- style.LineColor = Color.Red; //改变绘制的线的颜色
- style.LineWidth = 1; //改变绘制的线的宽度
- feature.Geometry.Style = style;
- //layerRed.Save();
- }
- }
- break;
- case "城市橙线":
- GSOLayer layerOrange = globeControl1.Globe.Layers.GetLayerByCaption(lineType);
- if (layerOrange != null && layerOrange.GetAllFeatures().Length > 0)
- {
- feature = layerOrange.GetAt(layerOrange.GetAllFeatures().Length - 1);
- if (feature != null)
- {
- feature.Name = lineName;
- GSOSimpleLineStyle3D style = new GSOSimpleLineStyle3D();
- style.LineColor = Color.Orange;
- feature.Geometry.Style = style;
- //layerOrange.Save();
- }
- }
- break;
- case "城市黄线":
- GSOLayer layerYellow = globeControl1.Globe.Layers.GetLayerByCaption(lineType);
- if (layerYellow != null && layerYellow.GetAllFeatures().Length > 0)
- {
- feature = layerYellow.GetAt(layerYellow.GetAllFeatures().Length - 1);
- if (feature != null)
- {
- feature.Name = lineName;
- GSOSimpleLineStyle3D style = new GSOSimpleLineStyle3D();
- style.LineColor = Color.Yellow;
- feature.Geometry.Style = style;
- //layerYellow.Save();
- }
- }
- break;
- case "城市绿线":
- GSOLayer layerGreen = globeControl1.Globe.Layers.GetLayerByCaption(lineType);
- if (layerGreen != null && layerGreen.GetAllFeatures().Length > 0)
- {
- feature = layerGreen.GetAt(layerGreen.GetAllFeatures().Length - 1);
- if (feature != null)
- {
- feature.Name = lineName;
- GSOSimpleLineStyle3D style = new GSOSimpleLineStyle3D();
- style.LineColor = Color.Green;
- feature.Geometry.Style = style;
- //layerGreen.Save();
- }
- }
- break;
- case "城市蓝线":
- GSOLayer layerBlue = globeControl1.Globe.Layers.GetLayerByCaption(lineType);
- if (layerBlue != null && layerBlue.GetAllFeatures().Length > 0)
- {
- feature = layerBlue.GetAt(layerBlue.GetAllFeatures().Length - 1);
- if (feature != null)
- {
- feature.Name = lineName;
- GSOSimpleLineStyle3D style = new GSOSimpleLineStyle3D();
- style.LineColor = Color.Blue;
- feature.Geometry.Style = style;
- //layerBlue.Save();
- }
- }
- break;
- case "城市紫线":
- GSOLayer layerPurple = globeControl1.Globe.Layers.GetLayerByCaption(lineType);
- if (layerPurple != null && layerPurple.GetAllFeatures().Length > 0)
- {
- feature = layerPurple.GetAt(layerPurple.GetAllFeatures().Length - 1);
- if (feature != null)
- {
- feature.Name = lineName;
- GSOSimpleLineStyle3D style = new GSOSimpleLineStyle3D();
- style.LineColor = Color.Purple;
- feature.Geometry.Style = style;
- //layerPurple.Save();
- }
- }
- break;
- case "城市黑线":
- GSOLayer layerBlack = globeControl1.Globe.Layers.GetLayerByCaption(lineType);
- if (layerBlack != null && layerBlack.GetAllFeatures().Length > 0)
- {
- feature = layerBlack.GetAt(layerBlack.GetAllFeatures().Length - 1);
- if (feature != null)
- {
- feature.Name = lineName;
- GSOSimpleLineStyle3D style = new GSOSimpleLineStyle3D();
- style.LineColor = Color.Black;
- feature.Geometry.Style = style;
- //layerBlack.Save();
- }
- }
- break;
+ //tunnel.Save();
}
-
- globeControl1.Globe.DestLayerFeatureAdd = null;
}
- m_AddPipeLine = false;
- m_isDrawTunnel = false;
- m_isDrawCitySevenLine = false;
- if (m_isDrawRedPology && globeControl1.Globe.Action == EnumAction3D.DrawPolygon)//红线工具
+ globeControl1.Refresh();
+ }
+ if (m_isDrawCitySevenLine && globeControl1.Globe.Action == EnumAction3D.DrawPolyline)//绘制城市七线
+ {
+ string lineType = citySevenLineType;
+ string lineName = cityServerLineName;
+ GSOFeature feature = null;
+ switch (lineType)
{
- GSOLayer layerDest = globeControl1.Globe.DestLayerFeatureAdd;
- if (layerDest != null)
- {
- GSOFeatures features = layerDest.GetAllFeatures();
- //GSOFeatures features = globeControl1.Globe.MemoryLayer.GetAllFeatures();
- GSOFeature f = features[features.Length - 1];
- if (f != null)
+ case "城市红线":
+ GSOLayer layerRed = globeControl1.Globe.Layers.GetLayerByCaption(lineType);
+ if (layerRed != null && layerRed.GetAllFeatures().Length > 0)
{
- GSOGeoPolygon3D polygon = f.Geometry as GSOGeoPolygon3D;
- if (polygon != null)
+ feature = layerRed.GetAt(layerRed.GetAllFeatures().Length - 1);
+ if (feature != null)
{
- GSOSimplePolygonStyle3D geoStyle3d = new GSOSimplePolygonStyle3D();
- f.Name = (getLabelName(layerDest) + 1).ToString();
- geoStyle3d.FillColor = Color.Red;
- polygon.Style = geoStyle3d;
- GSOLabel label = new GSOLabel();
- label.Text = "此区域正在施工中!";
- label.Style = new GSOLabelStyle();
- label.Style.HasTracktionLine = false;
- polygon.Label = label;
-
- globeControl1.Refresh();
+ feature.Name = lineName;
+ GSOSimpleLineStyle3D style = new GSOSimpleLineStyle3D();
+ style.LineColor = Color.Red; //改变绘制的线的颜色
+ style.LineWidth = 1; //改变绘制的线的宽度
+ feature.Geometry.Style = style;
+ //layerRed.Save();
}
}
+ break;
+ case "城市橙线":
+ GSOLayer layerOrange = globeControl1.Globe.Layers.GetLayerByCaption(lineType);
+ if (layerOrange != null && layerOrange.GetAllFeatures().Length > 0)
+ {
+ feature = layerOrange.GetAt(layerOrange.GetAllFeatures().Length - 1);
+ if (feature != null)
+ {
+ feature.Name = lineName;
+ GSOSimpleLineStyle3D style = new GSOSimpleLineStyle3D();
+ style.LineColor = Color.Orange;
+ feature.Geometry.Style = style;
+ //layerOrange.Save();
+ }
+ }
+ break;
+ case "城市黄线":
+ GSOLayer layerYellow = globeControl1.Globe.Layers.GetLayerByCaption(lineType);
+ if (layerYellow != null && layerYellow.GetAllFeatures().Length > 0)
+ {
+ feature = layerYellow.GetAt(layerYellow.GetAllFeatures().Length - 1);
+ if (feature != null)
+ {
+ feature.Name = lineName;
+ GSOSimpleLineStyle3D style = new GSOSimpleLineStyle3D();
+ style.LineColor = Color.Yellow;
+ feature.Geometry.Style = style;
+ //layerYellow.Save();
+ }
+ }
+ break;
+ case "城市绿线":
+ GSOLayer layerGreen = globeControl1.Globe.Layers.GetLayerByCaption(lineType);
+ if (layerGreen != null && layerGreen.GetAllFeatures().Length > 0)
+ {
+ feature = layerGreen.GetAt(layerGreen.GetAllFeatures().Length - 1);
+ if (feature != null)
+ {
+ feature.Name = lineName;
+ GSOSimpleLineStyle3D style = new GSOSimpleLineStyle3D();
+ style.LineColor = Color.Green;
+ feature.Geometry.Style = style;
+ //layerGreen.Save();
+ }
+ }
+ break;
+ case "城市蓝线":
+ GSOLayer layerBlue = globeControl1.Globe.Layers.GetLayerByCaption(lineType);
+ if (layerBlue != null && layerBlue.GetAllFeatures().Length > 0)
+ {
+ feature = layerBlue.GetAt(layerBlue.GetAllFeatures().Length - 1);
+ if (feature != null)
+ {
+ feature.Name = lineName;
+ GSOSimpleLineStyle3D style = new GSOSimpleLineStyle3D();
+ style.LineColor = Color.Blue;
+ feature.Geometry.Style = style;
+ //layerBlue.Save();
+ }
+ }
+ break;
+ case "城市紫线":
+ GSOLayer layerPurple = globeControl1.Globe.Layers.GetLayerByCaption(lineType);
+ if (layerPurple != null && layerPurple.GetAllFeatures().Length > 0)
+ {
+ feature = layerPurple.GetAt(layerPurple.GetAllFeatures().Length - 1);
+ if (feature != null)
+ {
+ feature.Name = lineName;
+ GSOSimpleLineStyle3D style = new GSOSimpleLineStyle3D();
+ style.LineColor = Color.Purple;
+ feature.Geometry.Style = style;
+ //layerPurple.Save();
+ }
+ }
+ break;
+ case "城市黑线":
+ GSOLayer layerBlack = globeControl1.Globe.Layers.GetLayerByCaption(lineType);
+ if (layerBlack != null && layerBlack.GetAllFeatures().Length > 0)
+ {
+ feature = layerBlack.GetAt(layerBlack.GetAllFeatures().Length - 1);
+ if (feature != null)
+ {
+ feature.Name = lineName;
+ GSOSimpleLineStyle3D style = new GSOSimpleLineStyle3D();
+ style.LineColor = Color.Black;
+ feature.Geometry.Style = style;
+ //layerBlack.Save();
+ }
+ }
+ break;
+ }
+
+ globeControl1.Globe.DestLayerFeatureAdd = null;
+ }
+ m_AddPipeLine = false;
+ m_isDrawTunnel = false;
+ m_isDrawCitySevenLine = false;
+ if (m_isDrawRedPology && globeControl1.Globe.Action == EnumAction3D.DrawPolygon)//红线工具
+ {
+ GSOLayer layerDest = globeControl1.Globe.DestLayerFeatureAdd;
+ if (layerDest != null)
+ {
+ GSOFeatures features = layerDest.GetAllFeatures();
+ //GSOFeatures features = globeControl1.Globe.MemoryLayer.GetAllFeatures();
+ GSOFeature f = features[features.Length - 1];
+ if (f != null)
+ {
+ GSOGeoPolygon3D polygon = f.Geometry as GSOGeoPolygon3D;
+ if (polygon != null)
+ {
+ GSOSimplePolygonStyle3D geoStyle3d = new GSOSimplePolygonStyle3D();
+ f.Name = (getLabelName(layerDest) + 1).ToString();
+ geoStyle3d.FillColor = Color.Red;
+ polygon.Style = geoStyle3d;
+ GSOLabel label = new GSOLabel();
+ label.Text = "此区域正在施工中!";
+ label.Style = new GSOLabelStyle();
+ label.Style.HasTracktionLine = false;
+ polygon.Label = label;
+
+ globeControl1.Refresh();
+ }
}
}
- m_isDrawRedPology = false;
- globeControl1.Globe.Action = EnumAction3D.ActionNull;
-
-
}
+ m_isDrawRedPology = false;
+ globeControl1.Globe.Action = EnumAction3D.ActionNull;
}
///
@@ -2627,7 +2332,7 @@
}
}
///
- /// (完善)
+ /// (完善)#wxl 待整理
///
///
///
@@ -2907,7 +2612,7 @@
}
///
- /// 鼠标点击, 弹出气泡功能globeControl1
+ /// 鼠标点击, 弹出气泡功能globeControl1 wxl待整理
///
///
///
@@ -2916,34 +2621,30 @@
GSOFeature feature = e.Feature;
string str1 = "";
- if (feature != null)
+ if (feature == null) return;
+ if (feature.GetFieldDefn("图片编码") != null)//
{
- if (feature.GetFieldDefn("图片编码") != null)//
+ str1 = GetBubbleInfo(feature, globeControl1);
+ if (RemoteFileExists(Utility.PicRootURL + feature.GetValue("图片编码")))
{
- str1 = GetBubbleInfo(feature, globeControl1);
- if (RemoteFileExists(Utility.PicRootURL + feature.GetValue("图片编码")))
- {
- str1 += "
";
- }
- else if (RemoteFileExists(Utility.PicDefaultURL))
- {
- str1 += "
";
- }
+ str1 += "
";
}
- else if (isFeatureContainsBianhao(feature)) //管线模型图层
+ else if (RemoteFileExists(Utility.PicDefaultURL))
{
- str1 = GetBubbleInfo(feature, globeControl1);
- }
-
- if (str1 != "")
- {
- featureTooltip.HideBalloon();
- balloonEx.HideBalloon();
- balloonEx.SetSize(EnumSizeIndexEx.CONTENT_CX, 480);
- balloonEx.SetSize(EnumSizeIndexEx.CONTENT_CY, 420);
- balloonEx.ShowBalloon((int)e.MousePos.X, (int)e.MousePos.Y, str1);
+ str1 += "
";
}
}
+ else if (isFeatureContainsBianhao(feature)) //管线模型图层
+ {
+ str1 = GetBubbleInfo(feature, globeControl1);
+ }
+
+ if (str1 == "") return;
+ featureTooltip.HideBalloon();
+ balloonEx.HideBalloon();
+ balloonEx.SetSize(EnumSizeIndexEx.CONTENT_CX, 480);
+ balloonEx.SetSize(EnumSizeIndexEx.CONTENT_CY, 420);
+ balloonEx.ShowBalloon((int)e.MousePos.X, (int)e.MousePos.Y, str1);
}
///
@@ -2956,35 +2657,30 @@
GSOFeature feature = e.Feature;
string str1 = "";
- if (feature != null)
+ if (feature == null) return;
+ if (feature.GetFieldDefn("图片编码") != null) //
{
- if (feature.GetFieldDefn("图片编码") != null) //
+ str1 = GetBubbleInfo(feature, globeControl2);
+ if (RemoteFileExists(Utility.PicRootURL + feature.GetValue("图片编码")))
{
- str1 = GetBubbleInfo(feature, globeControl2);
- if (RemoteFileExists(Utility.PicRootURL + feature.GetValue("图片编码")))
- {
- str1 += "
";
- }
- else if (RemoteFileExists(Utility.PicDefaultURL))
- {
- str1 += "
";
- }
+ str1 += "
";
}
- else if (isFeatureContainsBianhao(feature)) //管线模型图层
+ else if (RemoteFileExists(Utility.PicDefaultURL))
{
- str1 = GetBubbleInfo(feature, globeControl2);
- }
-
- if (str1 != "")
- {
-
- featureTooltip2.HideBalloon();
- balloonEx2.HideBalloon();
- balloonEx2.SetSize(EnumSizeIndexEx.CONTENT_CX, 480);
- balloonEx2.SetSize(EnumSizeIndexEx.CONTENT_CY, 420);
- balloonEx2.ShowBalloon((int)e.MousePos.X, (int)e.MousePos.Y, str1);
+ str1 += "
";
}
}
+ else if (isFeatureContainsBianhao(feature)) //管线模型图层
+ {
+ str1 = GetBubbleInfo(feature, globeControl2);
+ }
+
+ if (str1 == "") return;
+ featureTooltip2.HideBalloon();
+ balloonEx2.HideBalloon();
+ balloonEx2.SetSize(EnumSizeIndexEx.CONTENT_CX, 480);
+ balloonEx2.SetSize(EnumSizeIndexEx.CONTENT_CY, 420);
+ balloonEx2.ShowBalloon((int)e.MousePos.X, (int)e.MousePos.Y, str1);
}
///
@@ -3011,15 +2707,13 @@
for (int i = 0; i < Utility.listPipelineType.Count; i++)
{
PipelineType pipelineType = Utility.listPipelineType[i];
- if (pipelineType != null && pipelineType.code.Trim() == pipelinecode.Trim())
+ if (pipelineType == null || pipelineType.code.Trim() != pipelinecode.Trim()) continue;
+ title = pipelineType.type + " " + pipelineType.name;
+ if (pipelineType.type == pipelineType.name)
{
- title = pipelineType.type + " " + pipelineType.name;
- if (pipelineType.type == pipelineType.name)
- {
- title = pipelineType.type;
- }
- break;
+ title = pipelineType.type;
}
+ break;
}
}
}
@@ -3172,8 +2866,8 @@
return str;
}
- string filename = Utility.filename;
- List g1layername = new List();
+ //string filename = Utility.filename;
+ //List g1layername = new List();
///
/// 获取目标图层
@@ -3229,17 +2923,15 @@
for (int n = 0; n < tempChildNode1.Nodes.Count; n++)
{
TreeNode tempChildNode2 = tempChildNode1.Nodes[n];
- if (tempChildNode2.Tag.ToString().Split('|').Length > 1)
+ if (tempChildNode2.Tag.ToString().Split('|').Length <= 1) continue;
+ GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(tempChildNode2.Tag.ToString().Split('|')[1]);
+ if (layer == null)
{
- GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(tempChildNode2.Tag.ToString().Split('|')[1]);
- if (layer == null)
- {
- continue;
- }
- if (tempChildNode2.Tag != null && layer.IsDestLayerFeatureAdd())
- {
- return tempChildNode2;
- }
+ continue;
+ }
+ if (tempChildNode2.Tag != null && layer.IsDestLayerFeatureAdd())
+ {
+ return tempChildNode2;
}
}
}
@@ -3260,35 +2952,33 @@
//日志记录
LogManager.saveLog(Utility.userName, buttonItem87.Text);
- if (!buttonItem87.Checked)
- {
- buttonItem87.Checked = true;
- buttonItem88.Checked = false;
- buttonItem27.Checked = false;
+ if (buttonItem87.Checked) return;
+ buttonItem87.Checked = true;
+ buttonItem88.Checked = false;
+ buttonItem27.Checked = false;
- switch (globeControl1.Globe.CameraMode)
- {
- case EnumCameraMode.UnderGround:
- globeControl1.Globe.CameraMode = EnumCameraMode.Navigation;
- GSOCameraState state = new GSOCameraState();
- state.AltitudeMode = globeControl1.Globe.CameraState.AltitudeMode;
- state.Altitude = globeControl1.Globe.CameraState.Altitude;
- state.Distance = globeControl1.Globe.CameraState.Distance;
- state.Heading = globeControl1.Globe.CameraState.Heading;
- state.Latitude = globeControl1.Globe.CameraState.Latitude;
- state.Longitude = globeControl1.Globe.CameraState.Longitude;
- if (globeControl1.Globe.CameraState.Tilt < 95 && globeControl1.Globe.CameraState.Tilt > 85)
- state.Tilt = 85;
- else
- state.Tilt = 180 - globeControl1.Globe.CameraState.Tilt;
- globeControl1.Globe.JumpToCameraState(state);
- break;
- case EnumCameraMode.Walk:
- globeControl1.Globe.CameraMode = EnumCameraMode.Navigation;
- break;
- }
- globeControl1.Globe.Refresh();
+ switch (globeControl1.Globe.CameraMode)
+ {
+ case EnumCameraMode.UnderGround:
+ globeControl1.Globe.CameraMode = EnumCameraMode.Navigation;
+ GSOCameraState state = new GSOCameraState();
+ state.AltitudeMode = globeControl1.Globe.CameraState.AltitudeMode;
+ state.Altitude = globeControl1.Globe.CameraState.Altitude;
+ state.Distance = globeControl1.Globe.CameraState.Distance;
+ state.Heading = globeControl1.Globe.CameraState.Heading;
+ state.Latitude = globeControl1.Globe.CameraState.Latitude;
+ state.Longitude = globeControl1.Globe.CameraState.Longitude;
+ if (globeControl1.Globe.CameraState.Tilt < 95 && globeControl1.Globe.CameraState.Tilt > 85)
+ state.Tilt = 85;
+ else
+ state.Tilt = 180 - globeControl1.Globe.CameraState.Tilt;
+ globeControl1.Globe.JumpToCameraState(state);
+ break;
+ case EnumCameraMode.Walk:
+ globeControl1.Globe.CameraMode = EnumCameraMode.Navigation;
+ break;
}
+ globeControl1.Globe.Refresh();
}
///
/// 地下模式 菜单按钮
@@ -3300,33 +2990,31 @@
//日志记录
LogManager.saveLog(Utility.userName, buttonItem88.Text);
- if (!buttonItem88.Checked)
- {
- buttonItem88.Checked = true;
- buttonItem27.Checked = false;
- buttonItem87.Checked = false;
+ if (buttonItem88.Checked) return;
+ buttonItem88.Checked = true;
+ buttonItem27.Checked = false;
+ buttonItem87.Checked = false;
- switch (globeControl1.Globe.CameraMode)
- {
- case EnumCameraMode.Navigation:
- case EnumCameraMode.Walk:
- globeControl1.Globe.CameraMode = EnumCameraMode.UnderGround;
- GSOCameraState state = new GSOCameraState();
- state.AltitudeMode = globeControl1.Globe.CameraState.AltitudeMode;
- state.Altitude = globeControl1.Globe.CameraState.Altitude;
- state.Distance = globeControl1.Globe.CameraState.Distance;
- state.Heading = globeControl1.Globe.CameraState.Heading;
- state.Latitude = globeControl1.Globe.CameraState.Latitude;
- state.Longitude = globeControl1.Globe.CameraState.Longitude;
- if (globeControl1.Globe.CameraState.Tilt < 95 && globeControl1.Globe.CameraState.Tilt > 85)
- state.Tilt = 95;
- else
- state.Tilt = 180 - globeControl1.Globe.CameraState.Tilt;
- globeControl1.Globe.JumpToCameraState(state);
- break;
- }
- globeControl1.Globe.Refresh();
+ switch (globeControl1.Globe.CameraMode)
+ {
+ case EnumCameraMode.Navigation:
+ case EnumCameraMode.Walk:
+ globeControl1.Globe.CameraMode = EnumCameraMode.UnderGround;
+ GSOCameraState state = new GSOCameraState();
+ state.AltitudeMode = globeControl1.Globe.CameraState.AltitudeMode;
+ state.Altitude = globeControl1.Globe.CameraState.Altitude;
+ state.Distance = globeControl1.Globe.CameraState.Distance;
+ state.Heading = globeControl1.Globe.CameraState.Heading;
+ state.Latitude = globeControl1.Globe.CameraState.Latitude;
+ state.Longitude = globeControl1.Globe.CameraState.Longitude;
+ if (globeControl1.Globe.CameraState.Tilt < 95 && globeControl1.Globe.CameraState.Tilt > 85)
+ state.Tilt = 95;
+ else
+ state.Tilt = 180 - globeControl1.Globe.CameraState.Tilt;
+ globeControl1.Globe.JumpToCameraState(state);
+ break;
}
+ globeControl1.Globe.Refresh();
}
///
/// 行走模式 菜单按钮
@@ -3338,14 +3026,12 @@
//日志记录
LogManager.saveLog(Utility.userName, buttonItem27.Text);
- if (!buttonItem27.Checked)
- {
- buttonItem27.Checked = true;
- buttonItem87.Checked = false;
- buttonItem88.Checked = false;
+ if (buttonItem27.Checked) return;
+ buttonItem27.Checked = true;
+ buttonItem87.Checked = false;
+ buttonItem88.Checked = false;
- globeControl1.Globe.CameraMode = EnumCameraMode.Walk;
- }
+ globeControl1.Globe.CameraMode = EnumCameraMode.Walk;
}
///
/// 地面透明度设置 菜单
@@ -3357,7 +3043,7 @@
LogManager.saveLog(Utility.userName, sliderGroundTransSet1.Text);
globeControl1.Globe.GroundOpaque = 100 - sliderGroundTransSet1.Value;
- GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(roadLayerName);//("180fd");
+ GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(Utility.roadLayerName);//("180fd");
if (layer != null)
layer.Opaque = 100 - sliderGroundTransSet1.Value;
optiValue = sliderGroundTransSet1.Value;
@@ -3890,24 +3576,22 @@
///
private void comboBoxEx1_SelectedIndexChanged(object sender, EventArgs e)
{
- if (comboBoxEx1.SelectedIndex > -1)
- {
- dataGridViewX2.Rows.Clear();
- dataGridViewX3.Rows.Clear();
- listBox1.Items.Clear();
- GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(comboBoxEx1.SelectedItem.ToString());
- if (layer == null)
- return;
+ if (comboBoxEx1.SelectedIndex <= -1) return;
+ dataGridViewX2.Rows.Clear();
+ dataGridViewX3.Rows.Clear();
+ listBox1.Items.Clear();
+ GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(comboBoxEx1.SelectedItem.ToString());
+ if (layer == null)
+ return;
- GSOFeatureLayer flayer = layer as GSOFeatureLayer;
- GSOFeatureDataset fdataset = flayer.Dataset as GSOFeatureDataset;
- GSOFeatures feats = flayer.GetAllFeatures();
- for (int i = 0; i < feats.Length; i++)
- {
- int idx = dataGridViewX2.Rows.Add();
- dataGridViewX2.Rows[idx].Cells[0].Value = comboBoxEx1.SelectedItem.ToString();
- dataGridViewX2.Rows[idx].Cells[1].Value = feats[i].Name;
- }
+ GSOFeatureLayer flayer = layer as GSOFeatureLayer;
+ GSOFeatureDataset fdataset = flayer.Dataset as GSOFeatureDataset;
+ GSOFeatures feats = flayer.GetAllFeatures();
+ for (int i = 0; i < feats.Length; i++)
+ {
+ int idx = dataGridViewX2.Rows.Add();
+ dataGridViewX2.Rows[idx].Cells[0].Value = comboBoxEx1.SelectedItem.ToString();
+ dataGridViewX2.Rows[idx].Cells[1].Value = feats[i].Name;
}
}
///
@@ -3917,24 +3601,22 @@
///
private void comboBoxEx1_SelectedIndexChanged_shuiping(object sender, EventArgs e)
{
- if (comboBoxEx4.SelectedIndex > -1)
- {
- dataGridViewX8.Rows.Clear();
- dataGridViewX9.Rows.Clear();
- listBox3.Items.Clear();
- GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(comboBoxEx4.SelectedItem.ToString());
- if (layer == null)
- return;
+ if (comboBoxEx4.SelectedIndex <= -1) return;
+ dataGridViewX8.Rows.Clear();
+ dataGridViewX9.Rows.Clear();
+ listBox3.Items.Clear();
+ GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(comboBoxEx4.SelectedItem.ToString());
+ if (layer == null)
+ return;
- GSOFeatureLayer flayer = layer as GSOFeatureLayer;
- GSOFeatureDataset fdataset = flayer.Dataset as GSOFeatureDataset;
- GSOFeatures feats = flayer.GetAllFeatures();
- for (int i = 0; i < feats.Length; i++)
- {
- int idx = dataGridViewX8.Rows.Add();
- dataGridViewX8.Rows[idx].Cells[0].Value = comboBoxEx4.SelectedItem.ToString();
- dataGridViewX8.Rows[idx].Cells[1].Value = feats[i].Name;
- }
+ GSOFeatureLayer flayer = layer as GSOFeatureLayer;
+ GSOFeatureDataset fdataset = flayer.Dataset as GSOFeatureDataset;
+ GSOFeatures feats = flayer.GetAllFeatures();
+ for (int i = 0; i < feats.Length; i++)
+ {
+ int idx = dataGridViewX8.Rows.Add();
+ dataGridViewX8.Rows[idx].Cells[0].Value = comboBoxEx4.SelectedItem.ToString();
+ dataGridViewX8.Rows[idx].Cells[1].Value = feats[i].Name;
}
}
Dictionary featCount = new Dictionary();
@@ -3984,7 +3666,7 @@
if (selectedFeature != null)
{
selectState = 1;
- VerticalDistanceAnalysis("垂直净距分析", selectedFeature, m_PipelineLayerNames, dJingJuBiaoZhun, 0.0);
+ VerticalDistanceAnalysis("垂直净距分析", selectedFeature, Utility.m_PipelineLayerNames, dJingJuBiaoZhun, 0.0);
}
}
}
@@ -4005,16 +3687,16 @@
for (int i = 0; i < feats.Length; i++)
{
selectState = 1;
- VerticalDistanceAnalysis("垂直净距分析", feats[i], m_PipelineLayerNames, dJingJuBiaoZhun, 0.0);
+ VerticalDistanceAnalysis("垂直净距分析", feats[i], Utility.m_PipelineLayerNames, dJingJuBiaoZhun, 0.0);
}
}
if (featCount.Count > 0)
{
- for (int i = 0; i < m_PipelineLayerNames.Count; i++)
+ for (int i = 0; i < Utility.m_PipelineLayerNames.Count; i++)
{
- if (featCount.ContainsKey(m_PipelineLayerNames[i]) && featLenth.ContainsKey(m_PipelineLayerNames[i]))
+ if (featCount.ContainsKey(Utility.m_PipelineLayerNames[i]) && featLenth.ContainsKey(Utility.m_PipelineLayerNames[i]))
{
- listBox1.Items.Add(m_PipelineLayerNames[i] + ":" + featCount[m_PipelineLayerNames[i]] + "条,共" + featLenth[m_PipelineLayerNames[i]].ToString("0.00") + "米");
+ listBox1.Items.Add(Utility.m_PipelineLayerNames[i] + ":" + featCount[Utility.m_PipelineLayerNames[i]] + "条,共" + featLenth[Utility.m_PipelineLayerNames[i]].ToString("0.00") + "米");
}
}
}
@@ -4130,112 +3812,110 @@
continue;
}
GSOLayer layer2 = globeControl1.Globe.Layers.GetLayerByCaption(_pipelineLayerNames[i]);
- if (layer2 != null)
+ if (layer2 == null) continue;
+ GSOFeatureLayer flayer2 = layer2 as GSOFeatureLayer;
+ GSOFeatureDataset fdataset2 = flayer2.Dataset as GSOFeatureDataset;
+ GSOFeatures feats2 = Polygon_Contain_PointAnalysis(polygon, _pipelineLayerNames[i]);
+ for (int j = 0; j < feats2.Length; j++)
{
- GSOFeatureLayer flayer2 = layer2 as GSOFeatureLayer;
- GSOFeatureDataset fdataset2 = flayer2.Dataset as GSOFeatureDataset;
- GSOFeatures feats2 = Polygon_Contain_PointAnalysis(polygon, _pipelineLayerNames[i]);
- for (int j = 0; j < feats2.Length; j++)
- {
- GSOFeature feat2 = feats2[j];
- GSOGeoPolyline3D line2 = feats2[j].Geometry as GSOGeoPolyline3D;
- if (line2 == null) continue;
- GSOPipeLineStyle3D pipeStyle1 = line1.Style as GSOPipeLineStyle3D;
- GSOPipeLineStyle3D pipeStyle2 = line2.Style as GSOPipeLineStyle3D;
- if (pipeStyle1 == null || pipeStyle2 == null) continue;
+ GSOFeature feat2 = feats2[j];
+ GSOGeoPolyline3D line2 = feats2[j].Geometry as GSOGeoPolyline3D;
+ if (line2 == null) continue;
+ GSOPipeLineStyle3D pipeStyle1 = line1.Style as GSOPipeLineStyle3D;
+ GSOPipeLineStyle3D pipeStyle2 = line2.Style as GSOPipeLineStyle3D;
+ if (pipeStyle1 == null || pipeStyle2 == null) continue;
- double dDist = -1;
- dDist = globeControl1.Globe.Analysis3D.ComputeHorizonDistance(line1, line2, out pntIntersect1, out pntIntersect2, out pntProIntersect1, out pntProIntersect2, false);
+ double dDist = -1;
+ dDist = globeControl1.Globe.Analysis3D.ComputeHorizonDistance(line1, line2, out pntIntersect1, out pntIntersect2, out pntProIntersect1, out pntProIntersect2, false);
- if (dDist > -1)
+ if (dDist > -1)
+ {
+ dDist = Math.Abs(pntIntersect1.Z - pntIntersect2.Z) - pipeStyle1.Radius - pipeStyle2.Radius;//获得净距值
+
+ if (dDist < verticalDistance)
{
- dDist = Math.Abs(pntIntersect1.Z - pntIntersect2.Z) - pipeStyle1.Radius - pipeStyle2.Radius;//获得净距值
-
- if (dDist < verticalDistance)
+ int idx = -1;
+ GSOPoint3d markerPosition = new GSOPoint3d();
+ if (type == "垂直净距分析")
{
- int idx = -1;
- GSOPoint3d markerPosition = new GSOPoint3d();
- if (type == "垂直净距分析")
- {
- feat2.HighLight = true;
- markerPosition = LabelVerticalDistance(layerTemp, pntIntersect1, pntIntersect2, dDist, true);
+ feat2.HighLight = true;
+ markerPosition = LabelVerticalDistance(layerTemp, pntIntersect1, pntIntersect2, dDist, true);
- idx = dataGridViewX3.Rows.Add();
- dataGridViewX3.Rows[idx].Cells[0].Value = caption;
- dataGridViewX3.Rows[idx].Cells[1].Value = selectedFeature.Name;
- dataGridViewX3.Rows[idx].Cells[2].Value = layer2.Caption;
- dataGridViewX3.Rows[idx].Cells[3].Value = feat2.Name;
- dataGridViewX3.Rows[idx].Cells[4].Value = dDist.ToString("0.00");
- }
- else if (type == "碰撞分析")
- {
- feat2.HighLight = true;
- markerPosition = LabelVerticalDistance(layerTemp, pntIntersect1, pntIntersect2, dDist, false);
+ idx = dataGridViewX3.Rows.Add();
+ dataGridViewX3.Rows[idx].Cells[0].Value = caption;
+ dataGridViewX3.Rows[idx].Cells[1].Value = selectedFeature.Name;
+ dataGridViewX3.Rows[idx].Cells[2].Value = layer2.Caption;
+ dataGridViewX3.Rows[idx].Cells[3].Value = feat2.Name;
+ dataGridViewX3.Rows[idx].Cells[4].Value = dDist.ToString("0.00");
+ }
+ else if (type == "碰撞分析")
+ {
+ feat2.HighLight = true;
+ markerPosition = LabelVerticalDistance(layerTemp, pntIntersect1, pntIntersect2, dDist, false);
- selectedFeature.HighLight = true;
- idx = dataGridViewX5.Rows.Add();
- dataGridViewX5.Rows[idx].Cells[0].Value = dataGridViewX4.Rows[0].Cells[0].Value.ToString();
- dataGridViewX5.Rows[idx].Cells[1].Value = selectedFeature.Name;
- dataGridViewX5.Rows[idx].Cells[2].Value = layer2.Caption;
- dataGridViewX5.Rows[idx].Cells[3].Value = feat2.Name;
- }
- else if (type == "间距分析")
+ selectedFeature.HighLight = true;
+ idx = dataGridViewX5.Rows.Add();
+ dataGridViewX5.Rows[idx].Cells[0].Value = dataGridViewX4.Rows[0].Cells[0].Value.ToString();
+ dataGridViewX5.Rows[idx].Cells[1].Value = selectedFeature.Name;
+ dataGridViewX5.Rows[idx].Cells[2].Value = layer2.Caption;
+ dataGridViewX5.Rows[idx].Cells[3].Value = feat2.Name;
+ }
+ else if (type == "间距分析")
+ {
+ GSOGeoPolygon3D polygonSpacing = line2.CreateBuffer(horizontalDistance, true, 5, false, false);
+ if (polygonSpacing != null)
{
- GSOGeoPolygon3D polygonSpacing = line2.CreateBuffer(horizontalDistance, true, 5, false, false);
- if (polygonSpacing != null)
+ GSOFeatures horizontalFeatures = layer2.FindFeaturesInPolygon(polygonSpacing, false);
+ if (horizontalFeatures != null)
{
- GSOFeatures horizontalFeatures = layer2.FindFeaturesInPolygon(polygonSpacing, false);
- if (horizontalFeatures != null)
+ for (int m = 0; m < horizontalFeatures.Length; m++)
{
- for (int m = 0; m < horizontalFeatures.Length; m++)
+ GSOFeature horizontalFeature = horizontalFeatures[m];
+ if (horizontalFeature != null && horizontalFeature.ID == feat2.ID)
{
- GSOFeature horizontalFeature = horizontalFeatures[m];
- if (horizontalFeature != null && horizontalFeature.ID == feat2.ID)
- {
- feat2.HighLight = true;
- idx = dataGridViewAnalysisResult.Rows.Add();
- dataGridViewAnalysisResult.Rows[idx].Tag = feat2;
- dataGridViewAnalysisResult.Rows[idx].Cells[0].Value = dataGridViewLineList.Rows[0].Cells[0].Value.ToString();
- dataGridViewAnalysisResult.Rows[idx].Cells[1].Value = selectedFeature.Name;
- dataGridViewAnalysisResult.Rows[idx].Cells[2].Value = layer2.Caption;
- dataGridViewAnalysisResult.Rows[idx].Cells[3].Value = feat2.Name;
- dataGridViewAnalysisResult.Rows[idx].Cells[4].Value = dDist.ToString("0.00");
- dataGridViewAnalysisResult.Rows[idx].Cells[5].Value = horizontalDistance.ToString("0.00");
- break;
- }
+ feat2.HighLight = true;
+ idx = dataGridViewAnalysisResult.Rows.Add();
+ dataGridViewAnalysisResult.Rows[idx].Tag = feat2;
+ dataGridViewAnalysisResult.Rows[idx].Cells[0].Value = dataGridViewLineList.Rows[0].Cells[0].Value.ToString();
+ dataGridViewAnalysisResult.Rows[idx].Cells[1].Value = selectedFeature.Name;
+ dataGridViewAnalysisResult.Rows[idx].Cells[2].Value = layer2.Caption;
+ dataGridViewAnalysisResult.Rows[idx].Cells[3].Value = feat2.Name;
+ dataGridViewAnalysisResult.Rows[idx].Cells[4].Value = dDist.ToString("0.00");
+ dataGridViewAnalysisResult.Rows[idx].Cells[5].Value = horizontalDistance.ToString("0.00");
+ break;
}
}
}
}
+ }
- if (m_FeaturesWithBianhao.ContainsKey(selectedFeature.Name + "-" + feats2[j].Name) == false)
- {
- m_FeaturesWithBianhao.Add(selectedFeature.Name + "-" + feats2[j].Name, markerPosition);//添加飞行位置记录
- }
+ if (m_FeaturesWithBianhao.ContainsKey(selectedFeature.Name + "-" + feats2[j].Name) == false)
+ {
+ m_FeaturesWithBianhao.Add(selectedFeature.Name + "-" + feats2[j].Name, markerPosition);//添加飞行位置记录
+ }
- if (featCount.ContainsKey(layer2.Caption))
- {
- featCount[layer2.Caption] = featCount[layer2.Caption] + 1;
- }
- else
- {
- featCount.Add(layer2.Caption, 1);
- }
- if (featLenth.ContainsKey(layer2.Caption))
- {
- featLenth[layer2.Caption] = featLenth[layer2.Caption] + line2.GetSpaceLength(true, 6378137);
- }
- else
- {
- featLenth.Add(layer2.Caption, line2.GetSpaceLength(true, 6378137));
- }
+ if (featCount.ContainsKey(layer2.Caption))
+ {
+ featCount[layer2.Caption] = featCount[layer2.Caption] + 1;
+ }
+ else
+ {
+ featCount.Add(layer2.Caption, 1);
+ }
+ if (featLenth.ContainsKey(layer2.Caption))
+ {
+ featLenth[layer2.Caption] = featLenth[layer2.Caption] + line2.GetSpaceLength(true, 6378137);
+ }
+ else
+ {
+ featLenth.Add(layer2.Caption, line2.GetSpaceLength(true, 6378137));
}
}
- line2.ReleaseInnerPointer();
- feat2.ReleaseInnerPointer();
}
- feats2.ReleaseInnerPointer();
+ line2.ReleaseInnerPointer();
+ feat2.ReleaseInnerPointer();
}
+ feats2.ReleaseInnerPointer();
}
line1.ReleaseInnerPointer();
selectedFeature.ReleaseInnerPointer();
@@ -4302,7 +3982,7 @@
if (selectedFeature != null)
{
selectState = 1;
- HorizontalDistanceAnalysis(selectedFeature, m_PipelineLayerNames, dJingJuBiaoZhun);
+ HorizontalDistanceAnalysis(selectedFeature, Utility.m_PipelineLayerNames, dJingJuBiaoZhun);
}
}
}
@@ -4317,16 +3997,16 @@
GSOFeatures feats = flayer.GetAllFeatures();
for (int i = 0; i < feats.Length; i++)
{
- HorizontalDistanceAnalysis(feats[i], m_PipelineLayerNames, dJingJuBiaoZhun);
+ HorizontalDistanceAnalysis(feats[i], Utility.m_PipelineLayerNames, dJingJuBiaoZhun);
}
}
if (featCount.Count > 0) //统计结果
{
- for (int i = 0; i < m_PipelineLayerNames.Count; i++)
+ for (int i = 0; i < Utility.m_PipelineLayerNames.Count; i++)
{
- if (featCount.ContainsKey(m_PipelineLayerNames[i]) && featLenth.ContainsKey(m_PipelineLayerNames[i]))
+ if (featCount.ContainsKey(Utility.m_PipelineLayerNames[i]) && featLenth.ContainsKey(Utility.m_PipelineLayerNames[i]))
{
- listBox3.Items.Add(m_PipelineLayerNames[i] + ":" + featCount[m_PipelineLayerNames[i]] + "条,共" + featLenth[m_PipelineLayerNames[i]].ToString("0.00") + "米");
+ listBox3.Items.Add(Utility.m_PipelineLayerNames[i] + ":" + featCount[Utility.m_PipelineLayerNames[i]] + "条,共" + featLenth[Utility.m_PipelineLayerNames[i]].ToString("0.00") + "米");
}
}
}
@@ -4381,51 +4061,49 @@
continue;
}
GSOLayer layer2 = globeControl1.Globe.Layers.GetLayerByCaption(_pipelineLayerNames[i]);
- if (layer2 != null)
+ if (layer2 == null) continue;
+ GSOFeatureLayer flayer2 = layer2 as GSOFeatureLayer;
+ GSOFeatureDataset fdataset2 = flayer2.Dataset as GSOFeatureDataset;
+ GSOFeatures feats2 = Polygon_Contain_PointAnalysis(polygon, _pipelineLayerNames[i]);
+ for (int j = 0; j < feats2.Length; j++)
{
- GSOFeatureLayer flayer2 = layer2 as GSOFeatureLayer;
- GSOFeatureDataset fdataset2 = flayer2.Dataset as GSOFeatureDataset;
- GSOFeatures feats2 = Polygon_Contain_PointAnalysis(polygon, _pipelineLayerNames[i]);
- for (int j = 0; j < feats2.Length; j++)
+ GSOFeature feat2 = feats2[j];
+ GSOGeoPolyline3D line2 = feats2[j].Geometry as GSOGeoPolyline3D;
+ if (line2 == null)
{
- GSOFeature feat2 = feats2[j];
- GSOGeoPolyline3D line2 = feats2[j].Geometry as GSOGeoPolyline3D;
- if (line2 == null)
- {
- continue;
- }
- GSOPipeLineStyle3D pipeStyle1 = line1.Style as GSOPipeLineStyle3D;
- GSOPipeLineStyle3D pipeStyle2 = line2.Style as GSOPipeLineStyle3D;
- if (pipeStyle1 == null || pipeStyle2 == null)
- {
- continue;
- }
+ continue;
+ }
+ GSOPipeLineStyle3D pipeStyle1 = line1.Style as GSOPipeLineStyle3D;
+ GSOPipeLineStyle3D pipeStyle2 = line2.Style as GSOPipeLineStyle3D;
+ if (pipeStyle1 == null || pipeStyle2 == null)
+ {
+ continue;
+ }
- feat2.HighLight = true;
- int idx = dataGridViewX9.Rows.Add();
- dataGridViewX9.Rows[idx].Tag = feat2;
- dataGridViewX9.Rows[idx].Cells[0].Value = caption;
- dataGridViewX9.Rows[idx].Cells[1].Value = selectedFeature.Name;
- dataGridViewX9.Rows[idx].Cells[2].Value = layer2.Caption;
- dataGridViewX9.Rows[idx].Cells[3].Value = feats2[j].Name;
- dataGridViewX9.Rows[idx].Cells[4].Value = dis.ToString("0.00");
+ feat2.HighLight = true;
+ int idx = dataGridViewX9.Rows.Add();
+ dataGridViewX9.Rows[idx].Tag = feat2;
+ dataGridViewX9.Rows[idx].Cells[0].Value = caption;
+ dataGridViewX9.Rows[idx].Cells[1].Value = selectedFeature.Name;
+ dataGridViewX9.Rows[idx].Cells[2].Value = layer2.Caption;
+ dataGridViewX9.Rows[idx].Cells[3].Value = feats2[j].Name;
+ dataGridViewX9.Rows[idx].Cells[4].Value = dis.ToString("0.00");
- if (featCount.ContainsKey(layer2.Caption))
- {
- featCount[layer2.Caption] = featCount[layer2.Caption] + 1;
- }
- else
- {
- featCount.Add(layer2.Caption, 1);
- }
- if (featLenth.ContainsKey(layer2.Caption))
- {
- featLenth[layer2.Caption] = featLenth[layer2.Caption] + line2.GetSpaceLength(true, 6378137);
- }
- else
- {
- featLenth.Add(layer2.Caption, line2.GetSpaceLength(true, 6378137));
- }
+ if (featCount.ContainsKey(layer2.Caption))
+ {
+ featCount[layer2.Caption] = featCount[layer2.Caption] + 1;
+ }
+ else
+ {
+ featCount.Add(layer2.Caption, 1);
+ }
+ if (featLenth.ContainsKey(layer2.Caption))
+ {
+ featLenth[layer2.Caption] = featLenth[layer2.Caption] + line2.GetSpaceLength(true, 6378137);
+ }
+ else
+ {
+ featLenth.Add(layer2.Caption, line2.GetSpaceLength(true, 6378137));
}
}
}
@@ -4437,29 +4115,23 @@
///
private void dataGridViewX9_MouseDoubleClick(object sender, MouseEventArgs e)
{
- if (e.Button == MouseButtons.Left)
+ if (e.Button != MouseButtons.Left) return;
+ DataGridView.HitTestInfo hittestinfo = dataGridViewX9.HitTest(e.X, e.Y);
+ if (hittestinfo.RowIndex <= -1) return;
+ GSOFeature rowFeature = dataGridViewX9.Rows[hittestinfo.RowIndex].Tag as GSOFeature;
+ if (rowFeature == null) return;
+ if (rowFeature.Geometry != null && rowFeature.Geometry.Type == EnumGeometryType.GeoPolyline3D)
{
- DataGridView.HitTestInfo hittestinfo = dataGridViewX9.HitTest(e.X, e.Y);
- if (hittestinfo.RowIndex > -1)
- {
- GSOFeature rowFeature = dataGridViewX9.Rows[hittestinfo.RowIndex].Tag as GSOFeature;
- if (rowFeature != null)
- {
- if (rowFeature.Geometry != null && rowFeature.Geometry.Type == EnumGeometryType.GeoPolyline3D)
- {
- GSOGeoPolyline3D line = rowFeature.Geometry as GSOGeoPolyline3D;
- double length = line.GetSpaceLength(true, 6378137);
- GSOGeoPolyline3D lineLine = line.GetSegment(0, length / 2);
- GSOPoint3d point3d = lineLine[lineLine.PartCount - 1][lineLine[lineLine.PartCount - 1].Count - 1];
+ GSOGeoPolyline3D line = rowFeature.Geometry as GSOGeoPolyline3D;
+ double length = line.GetSpaceLength(true, 6378137);
+ GSOGeoPolyline3D lineLine = line.GetSegment(0, length / 2);
+ GSOPoint3d point3d = lineLine[lineLine.PartCount - 1][lineLine[lineLine.PartCount - 1].Count - 1];
- globeControl1.Globe.JumpToPosition(point3d, EnumAltitudeMode.Absolute, 5);
- }
- else
- {
- globeControl1.Globe.JumpToFeature(rowFeature, 5);
- }
- }
- }
+ globeControl1.Globe.JumpToPosition(point3d, EnumAltitudeMode.Absolute, 5);
+ }
+ else
+ {
+ globeControl1.Globe.JumpToFeature(rowFeature, 5);
}
}
///
@@ -4494,7 +4166,7 @@
if (selectedFeature != null)
{
selectState = 1;
- VerticalDistanceAnalysis("碰撞分析", selectedFeature, m_PipelineLayerNames, 0, 0.0);
+ VerticalDistanceAnalysis("碰撞分析", selectedFeature, Utility.m_PipelineLayerNames, 0, 0.0);
}
}
}
@@ -4510,17 +4182,17 @@
for (int i = 0; i < feats.Length; i++)
{
selectState = 1;
- VerticalDistanceAnalysis("碰撞分析", feats[i], m_PipelineLayerNames, 0, 0.0);
+ VerticalDistanceAnalysis("碰撞分析", feats[i], Utility.m_PipelineLayerNames, 0, 0.0);
}
}
if (featCount.Count > 0)
{
- for (int i = 0; i < m_PipelineLayerNames.Count; i++)
+ for (int i = 0; i < Utility.m_PipelineLayerNames.Count; i++)
{
- if (featCount.ContainsKey(m_PipelineLayerNames[i]) && featLenth.ContainsKey(m_PipelineLayerNames[i]))
+ if (featCount.ContainsKey(Utility.m_PipelineLayerNames[i]) && featLenth.ContainsKey(Utility.m_PipelineLayerNames[i]))
{
- listBox2.Items.Add(m_PipelineLayerNames[i] + ":" + featCount[m_PipelineLayerNames[i]] + "条,共" + featLenth[m_PipelineLayerNames[i]].ToString("0.00") + "米");
+ listBox2.Items.Add(Utility.m_PipelineLayerNames[i] + ":" + featCount[Utility.m_PipelineLayerNames[i]] + "条,共" + featLenth[Utility.m_PipelineLayerNames[i]].ToString("0.00") + "米");
}
}
}
@@ -4543,17 +4215,13 @@
///
private void dataGridViewX5_MouseDoubleClick(object sender, MouseEventArgs e)
{
- if (e.Button == MouseButtons.Left)
+ if (e.Button != MouseButtons.Left) return;
+ DataGridView.HitTestInfo hittestinfo = dataGridViewX5.HitTest(e.X, e.Y);
+ if (hittestinfo.RowIndex <= -1) return;
+ string key = dataGridViewX5.Rows[hittestinfo.RowIndex].Cells[1].Value.ToString().Trim() + "-" + dataGridViewX5.Rows[hittestinfo.RowIndex].Cells[3].Value.ToString().Trim();
+ if (m_FeaturesWithBianhao.ContainsKey(key))
{
- DataGridView.HitTestInfo hittestinfo = dataGridViewX5.HitTest(e.X, e.Y);
- if (hittestinfo.RowIndex > -1)
- {
- string key = dataGridViewX5.Rows[hittestinfo.RowIndex].Cells[1].Value.ToString().Trim() + "-" + dataGridViewX5.Rows[hittestinfo.RowIndex].Cells[3].Value.ToString().Trim();
- if (m_FeaturesWithBianhao.ContainsKey(key))
- {
- globeControl1.Globe.JumpToPosition(m_FeaturesWithBianhao[key], EnumAltitudeMode.Absolute, 5);
- }
- }
+ globeControl1.Globe.JumpToPosition(m_FeaturesWithBianhao[key], EnumAltitudeMode.Absolute, 5);
}
}
///
@@ -4611,25 +4279,23 @@
///
private void comboBoxEx3_SelectedIndexChanged(object sender, EventArgs e)
{
- if (comboBoxEx3.SelectedIndex > -1)
+ if (comboBoxEx3.SelectedIndex <= -1) return;
+ dataGridViewX6.Rows.Clear();
+ dataGridViewX7.Rows.Clear();
+
+ GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(comboBoxEx3.SelectedItem.ToString());
+ if (layer == null)
+ return;
+
+ GSOFeatureLayer flayer = layer as GSOFeatureLayer;
+ GSOFeatureDataset fdataset = flayer.Dataset as GSOFeatureDataset;
+ GSOFeatures feats = flayer.GetAllFeatures();
+
+ for (int i = 0; i < feats.Length; i++)
{
- dataGridViewX6.Rows.Clear();
- dataGridViewX7.Rows.Clear();
-
- GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(comboBoxEx3.SelectedItem.ToString());
- if (layer == null)
- return;
-
- GSOFeatureLayer flayer = layer as GSOFeatureLayer;
- GSOFeatureDataset fdataset = flayer.Dataset as GSOFeatureDataset;
- GSOFeatures feats = flayer.GetAllFeatures();
-
- for (int i = 0; i < feats.Length; i++)
- {
- int idx = dataGridViewX6.Rows.Add();
- dataGridViewX6.Rows[idx].Cells[0].Value = comboBoxEx3.SelectedItem.ToString();
- dataGridViewX6.Rows[idx].Cells[1].Value = feats[i].Name;
- }
+ int idx = dataGridViewX6.Rows.Add();
+ dataGridViewX6.Rows[idx].Cells[0].Value = comboBoxEx3.SelectedItem.ToString();
+ dataGridViewX6.Rows[idx].Cells[1].Value = feats[i].Name;
}
}
///
@@ -4670,51 +4336,47 @@
for (int i = 0; i < dataGridViewX6.Rows.Count; i++)
{
GSOFeature rowFeature = dataGridViewX6.Rows[i].Tag as GSOFeature;
- if (rowFeature != null)
+ if (rowFeature == null) continue;
+ string featureName = "";
+ if (isFeatureContainsBianhao(rowFeature))//判断rowFeature是否包含“编号”字段
{
- string featureName = "";
- if (isFeatureContainsBianhao(rowFeature))//判断rowFeature是否包含“编号”字段
- {
- featureName = rowFeature.GetValue(featureIDFieldName).ToString();
- }
- else
- {
- featureName = rowFeature.Name;
- }
+ featureName = rowFeature.GetValue(featureIDFieldName).ToString();
+ }
+ else
+ {
+ featureName = rowFeature.Name;
+ }
- GSOGeoPolyline3D line = rowFeature.Geometry as GSOGeoPolyline3D;
- if (line == null)
- {
- continue;
- }
- GSOPipeLineStyle3D style = line.Style as GSOPipeLineStyle3D;
- if (style == null)
- {
- continue;
- }
- if (line.PartCount > 0)
- {
- GSOPoint3ds pts = line[0];
- GSOPoint3d pt = new GSOPoint3d();
+ GSOGeoPolyline3D line = rowFeature.Geometry as GSOGeoPolyline3D;
+ if (line == null)
+ {
+ continue;
+ }
+ GSOPipeLineStyle3D style = line.Style as GSOPipeLineStyle3D;
+ if (style == null)
+ {
+ continue;
+ }
+ if (line.PartCount <= 0) continue;
+ GSOPoint3ds pts = line[0];
+ GSOPoint3d pt = new GSOPoint3d();
- for (int m = 0; m < pts.Count; m++)
- {
- if (Math.Abs(pts[m].Z + (style.Radius)) < Convert.ToDouble(textBoxX3.Text.Trim()))
- {
- rowFeature.HighLight = true;
- int idx = dataGridViewX7.Rows.Add();
- dataGridViewX7.Rows[idx].Tag = rowFeature;
- dataGridViewX7.Rows[idx].Cells[0].Value = rowFeature.Dataset.Caption;
- dataGridViewX7.Rows[idx].Cells[1].Value = featureName;
- dataGridViewX7.Rows[idx].Cells[2].Value = Math.Abs((pts[m].Z + (style.Radius))).ToString("0.00");
+ for (int m = 0; m < pts.Count; m++)
+ {
+ if (Math.Abs(pts[m].Z + (style.Radius)) < Convert.ToDouble(textBoxX3.Text.Trim()))
+ {
+ rowFeature.HighLight = true;
+ int idx = dataGridViewX7.Rows.Add();
+ dataGridViewX7.Rows[idx].Tag = rowFeature;
+ dataGridViewX7.Rows[idx].Cells[0].Value = rowFeature.Dataset.Caption;
+ dataGridViewX7.Rows[idx].Cells[1].Value = featureName;
+ dataGridViewX7.Rows[idx].Cells[2].Value = Math.Abs((pts[m].Z + (style.Radius))).ToString("0.00");
- pt.X = pts[m].X;
- pt.Y = pts[m].Y;
- pt.Z = 0;
- markerPosition = LabelVerticalDistance(layerTemp, pts[m], pt, Convert.ToDouble(dataGridViewX7.Rows[idx].Cells[2].Value), true);
- break;
- }
- }
+ pt.X = pts[m].X;
+ pt.Y = pts[m].Y;
+ pt.Z = 0;
+ markerPosition = LabelVerticalDistance(layerTemp, pts[m], pt, Convert.ToDouble(dataGridViewX7.Rows[idx].Cells[2].Value), true);
+ break;
}
}
}
@@ -4743,29 +4405,26 @@
GSOGeoPolyline3D line = f.Geometry as GSOGeoPolyline3D;
if (line == null) continue;
GSOPipeLineStyle3D style = line.Style as GSOPipeLineStyle3D;
- if (style == null) continue;
- if (line.PartCount > 0)
+ if (style == null || line.PartCount <= 0) continue;
+ GSOPoint3ds pts = line[0];
+ GSOPoint3d pt = new GSOPoint3d();
+ for (int m = 0; m < pts.Count; m++)
{
- GSOPoint3ds pts = line[0];
- GSOPoint3d pt = new GSOPoint3d();
- for (int m = 0; m < pts.Count; m++)
+ if (Math.Abs(pts[m].Z + (style.Radius)) < Convert.ToDouble(textBoxX3.Text.Trim()))
{
- if (Math.Abs(pts[m].Z + (style.Radius)) < Convert.ToDouble(textBoxX3.Text.Trim()))
- {
- f.HighLight = true;
- int idx = dataGridViewX7.Rows.Add();
- dataGridViewX7.Rows[idx].Tag = f;
- dataGridViewX7.Rows[idx].Cells[0].Value = layer.Caption;
- dataGridViewX7.Rows[idx].Cells[1].Value = featureName;
- dataGridViewX7.Rows[idx].Cells[2].Value = Math.Abs((pts[m].Z + (style.Radius))).ToString("0.00");
+ f.HighLight = true;
+ int idx = dataGridViewX7.Rows.Add();
+ dataGridViewX7.Rows[idx].Tag = f;
+ dataGridViewX7.Rows[idx].Cells[0].Value = layer.Caption;
+ dataGridViewX7.Rows[idx].Cells[1].Value = featureName;
+ dataGridViewX7.Rows[idx].Cells[2].Value = Math.Abs((pts[m].Z + (style.Radius))).ToString("0.00");
- pt.X = pts[m].X;
- pt.Y = pts[m].Y;
- pt.Z = 0;
- markerPosition = LabelVerticalDistance(layerTemp, pts[m], pt, Convert.ToDouble(dataGridViewX7.Rows[idx].Cells[2].Value), true);
+ pt.X = pts[m].X;
+ pt.Y = pts[m].Y;
+ pt.Z = 0;
+ markerPosition = LabelVerticalDistance(layerTemp, pts[m], pt, Convert.ToDouble(dataGridViewX7.Rows[idx].Cells[2].Value), true);
- break;
- }
+ break;
}
}
}
@@ -4789,29 +4448,23 @@
///
private void dataGridViewX7_MouseDoubleClick(object sender, MouseEventArgs e)
{
- if (e.Button == MouseButtons.Left)
+ if (e.Button != MouseButtons.Left) return;
+ DataGridView.HitTestInfo hittestinfo = dataGridViewX7.HitTest(e.X, e.Y);
+ if (hittestinfo.RowIndex <= -1) return;
+ GSOFeature rowFeature = dataGridViewX7.Rows[hittestinfo.RowIndex].Tag as GSOFeature;
+ if (rowFeature == null) return;
+ if (rowFeature.Geometry != null && rowFeature.Geometry.Type == EnumGeometryType.GeoPolyline3D)
{
- DataGridView.HitTestInfo hittestinfo = dataGridViewX7.HitTest(e.X, e.Y);
- if (hittestinfo.RowIndex > -1)
- {
- GSOFeature rowFeature = dataGridViewX7.Rows[hittestinfo.RowIndex].Tag as GSOFeature;
- if (rowFeature != null)
- {
- if (rowFeature.Geometry != null && rowFeature.Geometry.Type == EnumGeometryType.GeoPolyline3D)
- {
- GSOGeoPolyline3D line = rowFeature.Geometry as GSOGeoPolyline3D;
- double length = line.GetSpaceLength(true, 6378137);
- GSOGeoPolyline3D lineLine = line.GetSegment(0, length / 2);
- GSOPoint3d point3d = lineLine[lineLine.PartCount - 1][lineLine[lineLine.PartCount - 1].Count - 1];
+ GSOGeoPolyline3D line = rowFeature.Geometry as GSOGeoPolyline3D;
+ double length = line.GetSpaceLength(true, 6378137);
+ GSOGeoPolyline3D lineLine = line.GetSegment(0, length / 2);
+ GSOPoint3d point3d = lineLine[lineLine.PartCount - 1][lineLine[lineLine.PartCount - 1].Count - 1];
- globeControl1.Globe.JumpToPosition(point3d, EnumAltitudeMode.Absolute, 5);
- }
- else
- {
- globeControl1.Globe.JumpToFeature(rowFeature, 5);
- }
- }
- }
+ globeControl1.Globe.JumpToPosition(point3d, EnumAltitudeMode.Absolute, 5);
+ }
+ else
+ {
+ globeControl1.Globe.JumpToFeature(rowFeature, 5);
}
}
///
@@ -4972,85 +4625,83 @@
///
private void ExportExcel(string type, DataGridView _dataGridView, ListBox _listBox)
{
- if (_dataGridView.Rows.Count > 0)
+ if (_dataGridView.Rows.Count <= 0) return;
+ SaveFileDialog dlg = new SaveFileDialog();
+ dlg.Filter = "Excel files (*.xls)|*.xls";
+ dlg.FilterIndex = 0;
+ dlg.RestoreDirectory = true;
+ //dlg.CreatePrompt = true;
+ dlg.Title = "保存为Excel文件";
+ dlg.FileName = type + "-" + DateTime.Now.ToString("yyyyMMdd") + ".xls";
+ if (dlg.ShowDialog() == DialogResult.OK)
{
- SaveFileDialog dlg = new SaveFileDialog();
- dlg.Filter = "Excel files (*.xls)|*.xls";
- dlg.FilterIndex = 0;
- dlg.RestoreDirectory = true;
- //dlg.CreatePrompt = true;
- dlg.Title = "保存为Excel文件";
- dlg.FileName = type + "-" + DateTime.Now.ToString("yyyyMMdd") + ".xls";
- if (dlg.ShowDialog() == DialogResult.OK)
+ Stream myStream;
+ myStream = dlg.OpenFile();
+ StreamWriter sw = new StreamWriter(myStream, Encoding.GetEncoding(-0));
+ string columnTitle = "";
+ try
{
- Stream myStream;
- myStream = dlg.OpenFile();
- StreamWriter sw = new StreamWriter(myStream, Encoding.GetEncoding(-0));
- string columnTitle = "";
- try
+ if (_listBox != null)
{
- if (_listBox != null)
+ string strList = "";
+ for (int i = 0; i < _listBox.Items.Count; i++)
{
- string strList = "";
- for (int i = 0; i < _listBox.Items.Count; i++)
- {
- strList += _listBox.Items[i] + @"/";
- }
- sw.WriteLine("内容:" + type + " 日期:" + DateTime.Now.ToString("yyyy-MM-dd") + " 结果:" + strList);
+ strList += _listBox.Items[i] + @"/";
}
- else
+ sw.WriteLine("内容:" + type + " 日期:" + DateTime.Now.ToString("yyyy-MM-dd") + " 结果:" + strList);
+ }
+ else
+ {
+ sw.WriteLine("内容:" + type + " 日期:" + DateTime.Now.ToString("yyyy-MM-dd"));
+ }
+ //写入列标题
+ for (int i = 0; i < _dataGridView.ColumnCount; i++)
+ {
+ if (i > 0)
{
- sw.WriteLine("内容:" + type + " 日期:" + DateTime.Now.ToString("yyyy-MM-dd"));
+ columnTitle += "\t";
}
- //写入列标题
- for (int i = 0; i < _dataGridView.ColumnCount; i++)
- {
- if (i > 0)
- {
- columnTitle += "\t";
- }
- columnTitle += _dataGridView.Columns[i].HeaderText;
- }
- sw.WriteLine(columnTitle);
+ columnTitle += _dataGridView.Columns[i].HeaderText;
+ }
+ sw.WriteLine(columnTitle);
- //写入列内容
- for (int j = 0; j < _dataGridView.Rows.Count; j++)
+ //写入列内容
+ for (int j = 0; j < _dataGridView.Rows.Count; j++)
+ {
+ string columnValue = "";
+ for (int k = 0; k < _dataGridView.Columns.Count; k++)
{
- string columnValue = "";
- for (int k = 0; k < _dataGridView.Columns.Count; k++)
+ if (k > 0)
{
- if (k > 0)
- {
- columnValue += "\t";
- }
- if (_dataGridView.Rows[j].Cells[k].Value == null)
- {
- columnValue += "";
- }
- else
- {
- columnValue += _dataGridView.Rows[j].Cells[k].Value.ToString().Trim();
- }
+ columnValue += "\t";
}
+ if (_dataGridView.Rows[j].Cells[k].Value == null)
+ {
+ columnValue += "";
+ }
+ else
+ {
+ columnValue += _dataGridView.Rows[j].Cells[k].Value.ToString().Trim();
+ }
+ }
- sw.WriteLine(columnValue);
- }
- sw.Close();
- myStream.Close();
- if (MessageBox.Show("导出Excel文件成功!是否打开?", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
- {
- Process.Start(dlg.FileName);
- }
+ sw.WriteLine(columnValue);
}
- catch (Exception ex)
+ sw.Close();
+ myStream.Close();
+ if (MessageBox.Show("导出Excel文件成功!是否打开?", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
{
- //MessageBox.Show(ex.ToString());
+ Process.Start(dlg.FileName);
}
- finally
- {
- sw.Close();
- myStream.Close();
- }
+ }
+ catch (Exception ex)
+ {
+ //MessageBox.Show(ex.ToString());
+ }
+ finally
+ {
+ sw.Close();
+ myStream.Close();
}
}
}
@@ -5141,24 +4792,22 @@
///
private void comboBoxEx2_SelectedIndexChanged(object sender, EventArgs e)
{
- if (comboBoxEx2.SelectedIndex > -1)
- {
- listBox2.Items.Clear();
- dataGridViewX4.Rows.Clear();
- dataGridViewX5.Rows.Clear();
- GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(comboBoxEx2.SelectedItem.ToString());
- if (layer == null)
- return;
+ if (comboBoxEx2.SelectedIndex <= -1) return;
+ listBox2.Items.Clear();
+ dataGridViewX4.Rows.Clear();
+ dataGridViewX5.Rows.Clear();
+ GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(comboBoxEx2.SelectedItem.ToString());
+ if (layer == null)
+ return;
- GSOFeatureLayer flayer = layer as GSOFeatureLayer;
- GSOFeatureDataset fdataset = flayer.Dataset as GSOFeatureDataset;
- GSOFeatures feats = flayer.GetAllFeatures();
- for (int i = 0; i < feats.Length; i++)
- {
- int idx = dataGridViewX4.Rows.Add();
- dataGridViewX4.Rows[idx].Cells[0].Value = comboBoxEx2.SelectedItem.ToString();
- dataGridViewX4.Rows[idx].Cells[1].Value = feats[i].Name;
- }
+ GSOFeatureLayer flayer = layer as GSOFeatureLayer;
+ GSOFeatureDataset fdataset = flayer.Dataset as GSOFeatureDataset;
+ GSOFeatures feats = flayer.GetAllFeatures();
+ for (int i = 0; i < feats.Length; i++)
+ {
+ int idx = dataGridViewX4.Rows.Add();
+ dataGridViewX4.Rows[idx].Cells[0].Value = comboBoxEx2.SelectedItem.ToString();
+ dataGridViewX4.Rows[idx].Cells[1].Value = feats[i].Name;
}
}
///
@@ -5343,7 +4992,7 @@
if (selectedFeature != null)
{
selectState = 1;
- VerticalDistanceAnalysis("间距分析", selectedFeature, m_PipelineLayerNames, dVerticalJingJuBiaoZhun, dHorizontalJingJuBiaoZhun);//分析
+ VerticalDistanceAnalysis("间距分析", selectedFeature, Utility.m_PipelineLayerNames, dVerticalJingJuBiaoZhun, dHorizontalJingJuBiaoZhun);//分析
}
}
}
@@ -5374,16 +5023,16 @@
for (int i = 0; i < feats.Length; i++)
{
selectState = 1;
- VerticalDistanceAnalysis("间距分析", feats[i], m_PipelineLayerNames, dVerticalJingJuBiaoZhun, dHorizontalJingJuBiaoZhun);//分析
+ VerticalDistanceAnalysis("间距分析", feats[i], Utility.m_PipelineLayerNames, dVerticalJingJuBiaoZhun, dHorizontalJingJuBiaoZhun);//分析
}
}
if (featCount.Count > 0)
{
- for (int i = 0; i < m_PipelineLayerNames.Count; i++)
+ for (int i = 0; i < Utility.m_PipelineLayerNames.Count; i++)
{
- if (featCount.ContainsKey(m_PipelineLayerNames[i]) && featLenth.ContainsKey(m_PipelineLayerNames[i]))
+ if (featCount.ContainsKey(Utility.m_PipelineLayerNames[i]) && featLenth.ContainsKey(Utility.m_PipelineLayerNames[i]))
{
- listBoxStasticsResult.Items.Add(m_PipelineLayerNames[i] + ":" + featCount[m_PipelineLayerNames[i]] + "条,共" + featLenth[m_PipelineLayerNames[i]].ToString("0.00") + "米");
+ listBoxStasticsResult.Items.Add(Utility.m_PipelineLayerNames[i] + ":" + featCount[Utility.m_PipelineLayerNames[i]] + "条,共" + featLenth[Utility.m_PipelineLayerNames[i]].ToString("0.00") + "米");
}
}
}
@@ -5948,24 +5597,20 @@
///
private void addNodeToLayerManagerNode(GSOLayer layer)
{
- if (layer != null)
- {
- GSODataset dataset = layer.Dataset;
- CheckDatasetGeoReference(layer.Dataset, "");
+ if (layer == null) return;
+ GSODataset dataset = layer.Dataset;
+ CheckDatasetGeoReference(layer.Dataset, "");
- TreeNode node = new TreeNode();
- node.Tag = layer;
- node.Text = layer.Dataset.Caption;
- node.ImageIndex = 0;
- node.SelectedImageIndex = 0;
- node.Checked = layer.Visible;
+ TreeNode node = new TreeNode();
+ node.Tag = layer;
+ node.Text = layer.Dataset.Caption;
+ node.ImageIndex = 0;
+ node.SelectedImageIndex = 0;
+ node.Checked = layer.Visible;
- if (!layerManagerNode.Nodes.Contains(node))
- {
- layerManagerNode.Nodes.Insert(0, node);
- layerManagerNode.Expand();
- }
- }
+ if (layerManagerNode.Nodes.Contains(node)) return;
+ layerManagerNode.Nodes.Insert(0, node);
+ layerManagerNode.Expand();
}
///
/// 获取指定图层中最后一个feature对象的名称对应的整数
@@ -6008,31 +5653,29 @@
for (int i = 0; i < markerStrs.Length; i++)
{
GSOLayer markerLayer = globeControl1.Globe.Layers.GetLayerByCaption(markerStrs[i]);
- if (markerLayer != null)
+ if (markerLayer == null) continue;
+ if (markerStrs[i] != layerName)
{
- if (markerStrs[i] != layerName)
+ markerLayer.Visible = false;
+ if (layerMarkerTree.Nodes[0].Nodes.Count > i)
{
- markerLayer.Visible = false;
- if (layerMarkerTree.Nodes[0].Nodes.Count > i)
+ layerMarkerTree.Nodes[0].Nodes[i].Checked = false;
+ }
+ }
+ else
+ {
+ markerLayer.Visible = true;
+ for (int j = 0; j < markerLayer.GetAllFeatures().Length; j++)
+ {
+ GSOFeature markerFeature = markerLayer.GetAt(j);
+ if (markerFeature != null)
{
- layerMarkerTree.Nodes[0].Nodes[i].Checked = false;
+ markerFeature.Visible = false;
}
}
- else
+ if (layerMarkerTree.Nodes[0].Nodes.Count > i)
{
- markerLayer.Visible = true;
- for (int j = 0; j < markerLayer.GetAllFeatures().Length; j++)
- {
- GSOFeature markerFeature = markerLayer.GetAt(j);
- if (markerFeature != null)
- {
- markerFeature.Visible = false;
- }
- }
- if (layerMarkerTree.Nodes[0].Nodes.Count > i)
- {
- layerMarkerTree.Nodes[0].Nodes[i].Checked = true;
- }
+ layerMarkerTree.Nodes[0].Nodes[i].Checked = true;
}
}
}
@@ -6138,15 +5781,12 @@
private void toolStripMenuItem2_Click(object sender, EventArgs e)
{
TreeNode node = contextMenuStrip3.Tag as TreeNode;
+ if (node == null) return;
GSOFeature feature3d = node.Tag as GSOFeature;
- if (node == null)
- return;
- if (feature3d != null)
- {
- feature3d.Delete();
- globeControl1.Globe.Refresh();
- node.Remove();
- }
+ if (feature3d == null) return;
+ feature3d.Delete();
+ globeControl1.Globe.Refresh();
+ node.Remove();
}
///
/// 图层目录树的 节点对应的复选框选中状态改变事件处理
@@ -6213,12 +5853,10 @@
{
TreeNode node = contextMenuStrip2.Tag as TreeNode;
GSOLayer l = globeControl1.Globe.Layers.GetLayerByCaption(node.Text);
- if (l != null)
- {
- l.RemoveAllFeature();
- node.Nodes.Clear();
- globeControl1.Refresh();
- }
+ if (l == null) return;
+ l.RemoveAllFeature();
+ node.Nodes.Clear();
+ globeControl1.Refresh();
}
//定时检查传感器的状态
public Timer timerOfSensor = null;
@@ -6375,7 +6013,7 @@
}
frmShResult = new FrmShResult(dVerticalJingJuBiaoZhun, dHorizontalJingJuBiaoZhun, shlayername, globeControl1,
- m_PipelineLayerNames);
+ Utility.m_PipelineLayerNames);
if (boolfrmShResult) return;
@@ -6482,13 +6120,11 @@
frmModify = new FrmMnModify(globeControl1, shlayername, shresultLists);
- if (boolfrmModify == false)
- {
- frmModify.Owner = this;
- frmModify.Location = new Point(Width - frmModify.Width - 10, Height - frmModify.Height - 50);
- frmModify.Show();
- boolfrmModify = true;
- }
+ if (boolfrmModify != false) return;
+ frmModify.Owner = this;
+ frmModify.Location = new Point(Width - frmModify.Width - 10, Height - frmModify.Height - 50);
+ frmModify.Show();
+ boolfrmModify = true;
}
///
/// 一键审核中调节透明度
@@ -6500,7 +6136,7 @@
LogManager.saveLog(Utility.userName, sliderItem1.Text);
globeControl1.Globe.GroundOpaque = 100 - sliderItem1.Value;
- GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(roadLayerName); //("180fd");
+ GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(Utility.roadLayerName); //("180fd");
if (layer != null)
layer.Opaque = 100 - sliderItem1.Value;
@@ -6516,7 +6152,7 @@
LogManager.saveLog(Utility.userName, sliderItem3.Text);
globeControl1.Globe.GroundOpaque = 100 - sliderItem3.Value;
- GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(roadLayerName); //("180fd");
+ GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(Utility.roadLayerName); //("180fd");
if (layer != null)
layer.Opaque = 100 - sliderItem3.Value;
optiValue = sliderItem3.Value;
@@ -6647,7 +6283,7 @@
{
LogManager.saveLog(Utility.userName, buttonItemSearch9.Text);
- FrmKeywordQuery.ShowForm(globeControl1, m_PipelineLayerNames, InitDataGridViewX1);
+ FrmKeywordQuery.ShowForm(globeControl1, Utility.m_PipelineLayerNames, InitDataGridViewX1);
}
///
/// 编号查询
@@ -6658,7 +6294,7 @@
{
LogManager.saveLog(Utility.userName, buttonItemSearch2.Text);
- FrmCodingQuery.ShowForm(globeControl1, m_PipelineLayerNames, InitDataGridViewX1);
+ FrmCodingQuery.ShowForm(globeControl1, Utility.m_PipelineLayerNames, InitDataGridViewX1);
}
///
/// 坐标查询
@@ -6680,7 +6316,7 @@
{
LogManager.saveLog(Utility.userName, buttonItemSearch10.Text);
- FrmFittingQuery.ShowForm(globeControl1, instrumenLayerNames, InitDataGridViewX1);
+ FrmFittingQuery.ShowForm(globeControl1, Utility.instrumenLayerNames, InitDataGridViewX1);
}
///
/// 管径查询
@@ -6691,7 +6327,7 @@
{
LogManager.saveLog(Utility.userName, buttonItemSearch4.Text);
- FrmDiameterQuery.ShowForm(globeControl1, m_PipelineLayerNames, InitDataGridViewX1);
+ FrmDiameterQuery.ShowForm(globeControl1, Utility.m_PipelineLayerNames, InitDataGridViewX1);
}
///
/// 材质查询
@@ -6702,7 +6338,7 @@
{
LogManager.saveLog(Utility.userName, buttonItemSearch5.Text);
- FrmMaterialSel.ShowForm(globeControl1, m_PipelineLayerNames, InitDataGridViewX1);
+ FrmMaterialSel.ShowForm(globeControl1, Utility.m_PipelineLayerNames, InitDataGridViewX1);
}
///
/// 基本查询
@@ -6751,8 +6387,8 @@
if (feature == null && feature.Geometry == null || (feature.Geometry.Type == EnumGeometryType.GeoPolygon3D
|| feature.Geometry.Type == EnumGeometryType.GeoWater))
return;
- ClassSearchAnalysis.ResultRelationAnalysis(globeControl1, feature, valueLayerNames, workwellLayerNames,
- instrumenLayerNames, pipefittingLayerNames, m_PipelineLayerNames, valueAllowance);
+ ClassSearchAnalysis.ResultRelationAnalysis(globeControl1, feature, Utility.valueLayerNames, Utility.workwellLayerNames,
+ Utility.instrumenLayerNames, Utility.pipefittingLayerNames, Utility.m_PipelineLayerNames, valueAllowance);
}
}
#endregion
@@ -6789,20 +6425,20 @@
// ClearCloseValvesAnalysis();//清除阀门分析
//清除管线间距分析
- if (disFeature != null)
- {
- if (disFeature.ID != 0)
- {
- globeControl1.Globe.MemoryLayer.RemoveFeatureByID(disFeature.ID);
- }
- }
- if (featureDis != null)
- {
- if (featureDis.ID != 0)
- {
- globeControl1.Globe.MemoryLayer.RemoveFeatureByID(featureDis.ID);
- }
- }
+ //if (disFeature != null)
+ //{
+ // if (disFeature.ID != 0)
+ // {
+ // globeControl1.Globe.MemoryLayer.RemoveFeatureByID(disFeature.ID);
+ // }
+ //}
+ //if (featureDis != null)
+ //{
+ // if (featureDis.ID != 0)
+ // {
+ // globeControl1.Globe.MemoryLayer.RemoveFeatureByID(featureDis.ID);
+ // }
+ //}
GSOFeatures feats = globeControl1.Globe.MemoryLayer.GetFeatureByName("粒子要素", true);
if (feats.Length > 0)
@@ -6838,7 +6474,7 @@
clearFeatureHighLight();//取消管线高亮
- GSOLayer layerGround = globeControl1.Globe.Layers.GetLayerByCaption(roadLayerName);//("180fd");
+ GSOLayer layerGround = globeControl1.Globe.Layers.GetLayerByCaption(Utility.roadLayerName);//("180fd");
if (layerGround != null)
{
layerGround.Visible = true;
@@ -6856,7 +6492,7 @@
private void buttonItemTJ1_ALL_Click(object sender, EventArgs e)
{
LogManager.saveLog(Utility.userName, "管线长度统计");
- FrmAllPipelineStatis frm = new FrmAllPipelineStatis(globeControl1, null, InitDataGridViewX1, m_PipelineLayerNames);
+ FrmAllPipelineStatis frm = new FrmAllPipelineStatis(globeControl1, null, InitDataGridViewX1, Utility.m_PipelineLayerNames);
frm.Show(this);
}
///
@@ -6930,7 +6566,7 @@
{
LogManager.saveLog(Utility.userName, "管径分段统计");
- Frmpipediameterstatis.ShowForm(globeControl1, m_PipelineLayerNames, 0);
+ Frmpipediameterstatis.ShowForm(globeControl1, Utility.m_PipelineLayerNames, 0);
}
///
/// 管径分段统计绘制区域统计
@@ -6942,7 +6578,7 @@
LogManager.saveLog(Utility.userName, "管径分段统计");
trackflag = null;
- Frmpipediameterstatis.ShowForm(globeControl1, m_PipelineLayerNames, 1);
+ Frmpipediameterstatis.ShowForm(globeControl1, Utility.m_PipelineLayerNames, 1);
}
///
/// 埋深分段统计全区域统计
@@ -6952,7 +6588,7 @@
private void buttonItemTJ5_ALL_Click(object sender, EventArgs e)
{
LogManager.saveLog(Utility.userName, "埋深分段统计");
- FrmpipeDeepstatis.ShowForm(globeControl1, m_PipelineLayerNames, 0);
+ FrmpipeDeepstatis.ShowForm(globeControl1, Utility.m_PipelineLayerNames, 0);
}
///
/// 埋深分段统计绘制区域统计
@@ -6963,7 +6599,7 @@
{
LogManager.saveLog(Utility.userName, "埋深分段统计");
trackflag = null;
- FrmpipeDeepstatis.ShowForm(globeControl1, m_PipelineLayerNames, 1);
+ FrmpipeDeepstatis.ShowForm(globeControl1, Utility.m_PipelineLayerNames, 1);
}
///
/// 管径分类统计全区域统计
@@ -6974,7 +6610,7 @@
{
LogManager.saveLog(Utility.userName, "管径分类汇总");
- FrmpipeDiametergather.ShowForm(globeControl1, m_PipelineLayerNames, 0);
+ FrmpipeDiametergather.ShowForm(globeControl1, Utility.m_PipelineLayerNames, 0);
}
///
/// 管径分类统计绘制区域统计
@@ -6986,7 +6622,7 @@
LogManager.saveLog(Utility.userName, "管径分类汇总");
trackflag = null;
- FrmpipeDiametergather.ShowForm(globeControl1, m_PipelineLayerNames, 1);
+ FrmpipeDiametergather.ShowForm(globeControl1, Utility.m_PipelineLayerNames, 1);
}
///
/// 材质分类统计全区域统计
@@ -6997,7 +6633,7 @@
{
LogManager.saveLog(Utility.userName, "材质分类汇总");
- FrmpipeMaterialGather.ShowForm(globeControl1, m_PipelineLayerNames, 0);
+ FrmpipeMaterialGather.ShowForm(globeControl1, Utility.m_PipelineLayerNames, 0);
}
///
/// 材质分类统计绘制区域统计
@@ -7009,7 +6645,7 @@
LogManager.saveLog(Utility.userName, "材质分类汇总");
trackflag = null;
- FrmpipeMaterialGather.ShowForm(globeControl1, m_PipelineLayerNames, 1);
+ FrmpipeMaterialGather.ShowForm(globeControl1, Utility.m_PipelineLayerNames, 1);
}
///
/// 附属物分类统计全区域统计
@@ -7020,7 +6656,7 @@
{
LogManager.saveLog(Utility.userName, "附属物分类汇总");
- FrmAccessoriesgather.ShowForm(globeControl1, instrumenLayerNames, 0);
+ FrmAccessoriesgather.ShowForm(globeControl1, Utility.instrumenLayerNames, 0);
}
///
/// 附属物分类统计绘制区域统计
@@ -7032,7 +6668,7 @@
LogManager.saveLog(Utility.userName, "附属物分类汇总");
trackflag = null;
- FrmAccessoriesgather.ShowForm(globeControl1, instrumenLayerNames, 1);
+ FrmAccessoriesgather.ShowForm(globeControl1, Utility.instrumenLayerNames, 1);
}
#region Predaotr,断面分析
///
@@ -7113,7 +6749,7 @@
//日志记录
LogManager.saveLog(Utility.userName, buttonItemFX3_1.Text);
- FrmGenAndFaMenTopu frm = new FrmGenAndFaMenTopu(globeControl1, m_PipelineLayerNames, valueLayerNames);
+ FrmGenAndFaMenTopu frm = new FrmGenAndFaMenTopu(globeControl1, Utility.m_PipelineLayerNames, Utility.valueLayerNames);
frm.Show(this);
}
#region Predator :拓扑分析
@@ -7166,7 +6802,7 @@
//日志记录
LogManager.saveLog(Utility.userName, buttonItemFX3_4.Text);
- FrmFlow frm = new FrmFlow(globeControl1, m_PipelineLayerNames);
+ FrmFlow frm = new FrmFlow(globeControl1, Utility.m_PipelineLayerNames);
frm.Show(this);
}
///
@@ -7369,16 +7005,14 @@
GSOFeature f = null;
GSOLayer layer = null;
globeControl1.Globe.GetSelectObject(i, out f, out layer);
- if (f != null && f.Dataset.Caption == "隧道")
+ if (f == null || f.Dataset.Caption != "隧道") continue;
+ tunnelCount++;
+ f.Delete();
+ if (layer != null)
{
- tunnelCount++;
- f.Delete();
- if (layer != null)
- {
- globeControl1.Globe.AddToEditHistroy(layer, f, EnumEditType.Delete);
- }
- globeControl1.Refresh();
+ globeControl1.Globe.AddToEditHistroy(layer, f, EnumEditType.Delete);
}
+ globeControl1.Refresh();
}
if (tunnelCount == 0)
{
@@ -7620,7 +7254,7 @@
return;
}
GSOGeoPolyline3D selLine = resFeature.Geometry as GSOGeoPolyline3D;
- if (selLine[0].Count <= 1)
+ if (selLine==null||selLine[0].Count <= 1)//wxl增加为空判断,下面方法同理
{
return;
}
@@ -7763,14 +7397,12 @@
LogManager.saveLog(Utility.userName, buttonItemBZ10.Text);
setMarkerLayerUnVisible("红线工具");
GSOLayer l = globeControl1.Globe.Layers.GetLayerByCaption("红线工具");
- if (l != null)
- {
- l.Visible = true;
- globeControl1.Globe.DestLayerFeatureAdd = l;
- l.Editable = true;
- globeControl1.Globe.Action = EnumAction3D.DrawPolygon;
- m_isDrawRedPology = true;
- }
+ if (l == null) return;
+ l.Visible = true;
+ globeControl1.Globe.DestLayerFeatureAdd = l;
+ l.Editable = true;
+ globeControl1.Globe.Action = EnumAction3D.DrawPolygon;
+ m_isDrawRedPology = true;
}
///
/// 标注管理
@@ -8100,7 +7732,7 @@
{
//日志记录
LogManager.saveLog(Utility.userName, buttonItemSH5.Text);
- FrmCityServerLineAnalysis frm = new FrmCityServerLineAnalysis(globeControl1, m_PipelineLayerNames);
+ FrmCityServerLineAnalysis frm = new FrmCityServerLineAnalysis(globeControl1, Utility.m_PipelineLayerNames);
frm.Show(this);
}
@@ -8287,7 +7919,7 @@
//日志记录
LogManager.saveLog(Utility.userName, buttonItemBJ1.Text);
- frmPipeSetEdit frm = new frmPipeSetEdit(globeControl1, m_PipelineLayerNames);
+ frmPipeSetEdit frm = new frmPipeSetEdit(globeControl1, Utility.m_PipelineLayerNames);
if (frm.ShowDialog() == DialogResult.OK)
{
m_AddPipeLine = true;
@@ -8306,7 +7938,7 @@
//日志记录
LogManager.saveLog(Utility.userName, buttonItemBJ2.Text);
- FrmSetGoalLayer frm = new FrmSetGoalLayer(globeControl1, instrumenLayerNames, "附属物");
+ FrmSetGoalLayer frm = new FrmSetGoalLayer(globeControl1, Utility.instrumenLayerNames, "附属物");
if (frm.ShowDialog() == DialogResult.OK)
{
GSOLayer featureAddLayer = TreeNodeFeatureLayer();
@@ -8327,15 +7959,13 @@
//日志记录
LogManager.saveLog(Utility.userName, buttonItemBJ3.Text);
- FrmSetGoalLayer frm = new FrmSetGoalLayer(globeControl1, pipefittingLayerNames, "管点");
+ FrmSetGoalLayer frm = new FrmSetGoalLayer(globeControl1, Utility.pipefittingLayerNames, "管点");
if (frm.ShowDialog() == DialogResult.OK)
{
GSOLayer featureAddLayer = TreeNodeFeatureLayer();
- if (featureAddLayer != null)
- {
- FrmAddPipeFitting dlg = new FrmAddPipeFitting(globeControl1, featureAddLayer);
- dlg.Show(this);
- }
+ if (featureAddLayer == null) return;
+ FrmAddPipeFitting dlg = new FrmAddPipeFitting(globeControl1, featureAddLayer);
+ dlg.Show(this);
}
}
///
@@ -8516,50 +8146,50 @@
#region 导出成dxf格式
List listVectorNames = new List();
- for (int i = 0; i < m_PipelineLayerNames.Count; i++)
+ for (int i = 0; i < Utility.m_PipelineLayerNames.Count; i++)
{
- if (m_PipelineLayerNames[i] == "移动" || m_PipelineLayerNames[i] == "联通"
- || m_PipelineLayerNames[i] == "电信" || m_PipelineLayerNames[i] == "共通"
- || m_PipelineLayerNames[i] == "有线电视" || m_PipelineLayerNames[i] == "交通信号"
- || m_PipelineLayerNames[i] == "供电")
+ if (Utility.m_PipelineLayerNames[i] == "移动" || Utility.m_PipelineLayerNames[i] == "联通"
+ || Utility.m_PipelineLayerNames[i] == "电信" || Utility.m_PipelineLayerNames[i] == "共通"
+ || Utility.m_PipelineLayerNames[i] == "有线电视" || Utility.m_PipelineLayerNames[i] == "交通信号"
+ || Utility.m_PipelineLayerNames[i] == "供电")
{
continue;
}
- if (listVectorNames.Contains(m_PipelineLayerNames[i]) == false)
+ if (!listVectorNames.Contains(Utility.m_PipelineLayerNames[i]))
{
- listVectorNames.Add(m_PipelineLayerNames[i]);
+ listVectorNames.Add(Utility.m_PipelineLayerNames[i]);
}
}
- for (int i = 0; i < valueLayerNames.Count; i++)
+ for (int i = 0; i < Utility.valueLayerNames.Count; i++)
{
- if (listVectorNames.Contains(valueLayerNames[i]) == false)
+ if (!listVectorNames.Contains(Utility.valueLayerNames[i]))
{
- listVectorNames.Add(valueLayerNames[i]);
+ listVectorNames.Add(Utility.valueLayerNames[i]);
}
}
- for (int i = 0; i < workwellLayerNames.Count; i++)
+ for (int i = 0; i < Utility.workwellLayerNames.Count; i++)
{
- if (listVectorNames.Contains(workwellLayerNames[i]) == false)
+ if (!listVectorNames.Contains(Utility.workwellLayerNames[i]))
{
- listVectorNames.Add(workwellLayerNames[i]);
+ listVectorNames.Add(Utility.workwellLayerNames[i]);
}
}
- for (int i = 0; i < instrumenLayerNames.Count; i++)
+ for (int i = 0; i < Utility.instrumenLayerNames.Count; i++)
{
- if (listVectorNames.Contains(instrumenLayerNames[i]) == false)
+ if (!listVectorNames.Contains(Utility.instrumenLayerNames[i]))
{
- listVectorNames.Add(instrumenLayerNames[i]);
+ listVectorNames.Add(Utility.instrumenLayerNames[i]);
}
}
- for (int i = 0; i < pipefittingLayerNames.Count; i++)
+ for (int i = 0; i < Utility.pipefittingLayerNames.Count; i++)
{
- if (listVectorNames.Contains(pipefittingLayerNames[i]) == false)
+ if (!listVectorNames.Contains(Utility.pipefittingLayerNames[i]))
{
- listVectorNames.Add(pipefittingLayerNames[i]);
+ listVectorNames.Add(Utility.pipefittingLayerNames[i]);
}
}
- FrmExportCADS frm = new FrmExportCADS(globeControl1, listVectorNames);//m_PipelineLayerNames);
+ FrmExportCADS frm = new FrmExportCADS(globeControl1, listVectorNames);//Utility.m_PipelineLayerNames);
frm.ShowDialog();
#endregion
}
@@ -8574,39 +8204,39 @@
LogManager.saveLog(Utility.userName, buttonItemBJ10_2.Text);
List listVectorNames = new List();
- for (int i = 0; i < m_PipelineLayerNames.Count; i++)
+ for (int i = 0; i < Utility.m_PipelineLayerNames.Count; i++)
{
- if (listVectorNames.Contains(m_PipelineLayerNames[i]) == false)
+ if (!listVectorNames.Contains(Utility.m_PipelineLayerNames[i]))
{
- listVectorNames.Add(m_PipelineLayerNames[i]);
+ listVectorNames.Add(Utility.m_PipelineLayerNames[i]);
}
}
- for (int i = 0; i < valueLayerNames.Count; i++)
+ for (int i = 0; i < Utility.valueLayerNames.Count; i++)
{
- if (listVectorNames.Contains(valueLayerNames[i]) == false)
+ if (!listVectorNames.Contains(Utility.valueLayerNames[i]))
{
- listVectorNames.Add(valueLayerNames[i]);
+ listVectorNames.Add(Utility.valueLayerNames[i]);
}
}
- for (int i = 0; i < workwellLayerNames.Count; i++)
+ for (int i = 0; i < Utility.workwellLayerNames.Count; i++)
{
- if (listVectorNames.Contains(workwellLayerNames[i]) == false)
+ if (!listVectorNames.Contains(Utility.workwellLayerNames[i]))
{
- listVectorNames.Add(workwellLayerNames[i]);
+ listVectorNames.Add(Utility.workwellLayerNames[i]);
}
}
- for (int i = 0; i < instrumenLayerNames.Count; i++)
+ for (int i = 0; i < Utility.instrumenLayerNames.Count; i++)
{
- if (listVectorNames.Contains(instrumenLayerNames[i]) == false)
+ if (!listVectorNames.Contains(Utility.instrumenLayerNames[i]))
{
- listVectorNames.Add(instrumenLayerNames[i]);
+ listVectorNames.Add(Utility.instrumenLayerNames[i]);
}
}
- for (int i = 0; i < pipefittingLayerNames.Count; i++)
+ for (int i = 0; i < Utility.pipefittingLayerNames.Count; i++)
{
- if (listVectorNames.Contains(pipefittingLayerNames[i]) == false)
+ if (!listVectorNames.Contains(Utility.pipefittingLayerNames[i]))
{
- listVectorNames.Add(pipefittingLayerNames[i]);
+ listVectorNames.Add(Utility.pipefittingLayerNames[i]);
}
}
FrmExportVector frm = new FrmExportVector(globeControl1, listVectorNames);
@@ -8668,9 +8298,9 @@
List listPipelineLayers = new List();
GSOLayer layer = null;
- for (int i = 0; i < m_PipelineLayerNames.Count; i++)
+ for (int i = 0; i < Utility.m_PipelineLayerNames.Count; i++)
{
- layer = globeControl1.Globe.Layers.GetLayerByCaption(m_PipelineLayerNames[i]);
+ layer = globeControl1.Globe.Layers.GetLayerByCaption(Utility.m_PipelineLayerNames[i]);
if (layer == null) continue;
listPipelineLayers.Add(layer);
}
@@ -8737,7 +8367,7 @@
LogManager.saveLog(Utility.userName, sliderItem2.Text);
globeControl1.Globe.GroundOpaque = 100 - sliderItem2.Value;
- GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(roadLayerName);//("180fd");
+ GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(Utility.roadLayerName);//("180fd");
if (layer != null)
{
layer.Opaque = 100 - sliderItem2.Value;
@@ -8876,7 +8506,7 @@
globeControl1.Globe.GroundOpaque = 100 - sliderGroundTransSet1.Value;
- layer = globeControl1.Globe.Layers.GetLayerByCaption(roadLayerName);//("180fd");
+ layer = globeControl1.Globe.Layers.GetLayerByCaption(Utility.roadLayerName);//("180fd");
if (layer != null)
{
layer.Opaque = 100 - sliderGroundTransSet1.Value;
@@ -9145,7 +8775,7 @@
LogManager.saveLog(Utility.userName, buttonItem8.Text);
int width = Width;
- FrmCompareFeature.ShowForm(globeControl1, globeControl2, layerTemp, layerTemp2, m_PipelineLayerNames, sgPipeLayersNames, width);
+ FrmCompareFeature.ShowForm(globeControl1, globeControl2, layerTemp, layerTemp2, Utility.m_PipelineLayerNames, Utility.sgPipeLayersNames, width);
}
///
/// 红线审核导出图片
diff --git a/Cyberpipe.csproj b/Cyberpipe.csproj
index 6e90a6e..8f4424d 100644
--- a/Cyberpipe.csproj
+++ b/Cyberpipe.csproj
@@ -187,11 +187,6 @@
False
bin\x86\Debug\WHC.Pager.WinControl.dll
-
- False
- .exe
- bin\x86\Debug\WinFormsExtendedViewExample.exe
-
False
bin\x86\Debug\WW.dll
diff --git a/Cyberpipe.suo b/Cyberpipe.suo
index 0a403c8..eac4ecb 100644
--- a/Cyberpipe.suo
+++ b/Cyberpipe.suo
Binary files differ
diff --git a/MainFrm.cs b/MainFrm.cs
index 6e94648..7c574c1 100644
--- a/MainFrm.cs
+++ b/MainFrm.cs
@@ -27,7 +27,6 @@
public partial class MainFrm : Office2007Form
{
TreeNode layerManagerNode;
- TreeNode myPlaceNode = null;
bool m_bFullScreen;
GSOGlobeControl globeControl1;
@@ -45,24 +44,14 @@
GSOLayer layerTemp;
GSOLayer layerTemp2;
- FrmShResult frmShResult = null;
FrmRedlineResult frmredResult = null;
FrmMnModify frmModify;
public bool frmRedlineResult = false;
public bool boolfrmShResult;
public bool boolfrmModify;
- List m_PipelineLayerNames = new List();//线图层名称
- List workwellLayerNames = new List();//工井图层名称
- List valueLayerNames = new List();//阀门图层名称
- List instrumenLayerNames = new List();//附属物图层名称
- List pipefittingLayerNames = new List();//管件图层名称
- List sgPipeLayersNames = new List();//施工管线图层名称
- string roadLayerName = "";
public static string m_CurrentQueryLayer;//定义当前查询的图层
//定位和闪烁初始化定义
- int count = 0;
- private string flashflag = "single";
public bool m_AddPipeLine;//bool添加管线
bool m_isDrawTunnel;//bool创建隧道
@@ -71,10 +60,6 @@
private string trackflag;//定义阀门查询个数
- //管线间距分析
- private GSOFeature disFeature = new GSOFeature();
- private GSOFeature featureDis = new GSOFeature();
-
//记录沿线飞行设置
//int m_nFlyMode = 2;
double m_dFlyAboveLine = 1;
@@ -86,7 +71,7 @@
Boolean m_bDigPitByDepth = true;
//选择管线
int selectState;
- private OracleConnection connBackup = null;
+ //private OracleConnection connBackup = null;
//数据集合
public static GSODataSource ds;
@@ -182,7 +167,7 @@
RigthMenuSet();
MenuSet();
-
+
}
///
/// 右屏中添加管纵图片
@@ -906,13 +891,13 @@
comboBoxEx3.Items.Clear();
comboBoxEx4.Items.Clear();
comboBoxLayer.Items.Clear();
- for (int i = 0; i < m_PipelineLayerNames.Count; i++)
+ foreach (string t1 in Utility.m_PipelineLayerNames)
{
- comboBoxEx1.Items.Add(m_PipelineLayerNames[i]);
- comboBoxEx2.Items.Add(m_PipelineLayerNames[i]);
- comboBoxEx3.Items.Add(m_PipelineLayerNames[i]);
- comboBoxEx4.Items.Add(m_PipelineLayerNames[i]);
- comboBoxLayer.Items.Add(m_PipelineLayerNames[i]);
+ comboBoxEx1.Items.Add(t1);
+ comboBoxEx2.Items.Add(t1);
+ comboBoxEx3.Items.Add(t1);
+ comboBoxEx4.Items.Add(t1);
+ comboBoxLayer.Items.Add(t1);
}
splitContainer1.Panel2Collapsed = true;
@@ -1132,7 +1117,7 @@
}
- delegate void LoadDataForGlobalControl();
+ //delegate void LoadDataForGlobalControl();
private void connectServer()
{
@@ -1142,19 +1127,15 @@
// 勾选实测图层
foreach (TreeNode tn in layerTree.Nodes)
{
- if (tn.Nodes.Count > 0)
+ if (tn.Nodes.Count <= 0) continue;
+ if (tn.Text != "实测数据") continue;
+ tn.Checked = true;
+ foreach (TreeNode tnChild in tn.Nodes)
{
- if (tn.Text == "实测数据")
+ tnChild.Checked = true;
+ foreach (TreeNode tnGrandChild in tnChild.Nodes)
{
- tn.Checked = true;
- foreach (TreeNode tnChild in tn.Nodes)
- {
- tnChild.Checked = true;
- foreach (TreeNode tnGrandChild in tnChild.Nodes)
- {
- tnGrandChild.Checked = true;
- }
- }
+ tnGrandChild.Checked = true;
}
}
}
@@ -1174,7 +1155,7 @@
for (int j = 0; j < Utility.dataSource.DatasetCount; j++)
{
GSODataset dataset = Utility.dataSource.GetDatasetAt(j);
- if (dataset != null && dictionaryNetLayerNameAndCaption.ContainsKey(dataset.Caption))
+ if (dataset != null && Utility.dictionaryNetLayerNameAndCaption.ContainsKey(dataset.Caption))
{
dataset.Caption = dataset.Name;
globeControl1.Globe.Layers.Add(dataset);
@@ -1191,7 +1172,7 @@
for (int j = 0; j < ghDS.DatasetCount; j++)
{
GSODataset dataset = ghDS.GetDatasetAt(j);
- if (dataset != null && dictionaryNetLayerNameAndCaption.ContainsKey(dataset.Caption))
+ if (dataset != null && Utility.dictionaryNetLayerNameAndCaption.ContainsKey(dataset.Caption))
{
dataset.Caption = dataset.Name;
globeControl1.Globe.Layers.Add(dataset);
@@ -1207,7 +1188,7 @@
for (int m = 0; m < sgDS.DatasetCount; m++)
{
GSODataset dataset = sgDS.GetDatasetAt(m);
- if (dataset != null && !dataset.Caption.Contains("SH") && dictionaryNetLayerNameAndCaption.ContainsKey(dataset.Caption))
+ if (dataset != null && !dataset.Caption.Contains("SH") && Utility.dictionaryNetLayerNameAndCaption.ContainsKey(dataset.Caption))
{
dataset.Caption = dataset.Name;
globeControl1.Globe.Layers.Add(dataset);
@@ -1219,8 +1200,14 @@
}
}
- LoadDataForGlobalControl ss = connectServer;
- ss();
+// LoadDataForGlobalControl ss = connectServer;
+// ss();
+
+ this.Invoke((EventHandler) delegate
+ {
+ connectServer();
+ });
+
}
catch (Exception ex)
@@ -1240,7 +1227,7 @@
layerTree.Nodes.Add(layerManagerNode);
XmlDocument doc = new XmlDocument();
- doc.Load(filename);
+ doc.Load(Utility.filename);
XmlNodeList xmlLayerNodes = doc.SelectNodes("//layer");
foreach (XmlNode xmlLayerNode in xmlLayerNodes)
@@ -1295,70 +1282,6 @@
}
- /**
- * 读取Config.xml文件,初始化以下全局Map
- * m_PipelineLayerNames:管线
- * workwellLayerNames:工井
- * valueLayerNames:阀门
- * instrumenLayerNames:附属物
- * pipefittingLayerNames:特征管点
- * sgPipeLayersNames:施工管线
- **/
- private void initGlobalMap()
- {
- XmlDocument doc = new XmlDocument();
- doc.Load(filename);
- XmlNodeList xmlLayerNodes = doc.SelectNodes("//layerchild");
-
- foreach (XmlNode xmlLayerNode in xmlLayerNodes)
- {
- string layerType = xmlLayerNode.Attributes["type"].Value;
- string layerName1 = xmlLayerNode.Attributes["layer"].Value;
- string layerchildName = xmlLayerNode.Attributes["label"].Value;
-
- dictionaryNetLayerNameAndCaption.Add(layerName1, layerchildName);
-
- if (layerType != "db")
- {
- if (xmlLayerNode.Attributes["isRoad"] != null)
- {
- roadLayerName = layerchildName;
- }
- }
- else if (xmlLayerNode.Attributes["isPipeLine"] != null)
- {
- m_PipelineLayerNames.Add(layerchildName);
- g1layername.Add(layerName1);
- }
- else if (xmlLayerNode.Attributes["isWorkWell"] != null)
- {
- workwellLayerNames.Add(layerchildName);
- g1layername.Add(layerName1);
- }
- else if (xmlLayerNode.Attributes["isValve"] != null)
- {
- valueLayerNames.Add(layerchildName);
- g1layername.Add(layerName1);
- }
- else if (xmlLayerNode.Attributes["isAccess"] != null)
- {
- instrumenLayerNames.Add(layerchildName);
- g1layername.Add(layerName1);
- }
- else if (xmlLayerNode.Attributes["isCharacter"] != null)
- {
- pipefittingLayerNames.Add(layerchildName);
- g1layername.Add(layerName1);
- }
- else if (xmlLayerNode.Attributes["isSgData"] != null)
- {
- sgPipeLayersNames.Add(layerchildName);
- g1layername.Add(layerName1);
- }
-
- }
- }
-
private void initMarkerTree()
{
TreeNode node = new TreeNode();
@@ -1380,32 +1303,29 @@
for (int i = 0; i < markerStrs.Length; i++)
{
- if (File.Exists(Application.StartupPath + "\\标注管理\\" + markerStrs[i] + ".lgd"))
- {
- GSOLayer markerLayer = globeControl1.Globe.Layers.Add(Application.StartupPath + "\\标注管理\\" + markerStrs[i] + ".lgd");
- if (markerLayer != null)
- {
- TreeNode node1 = new TreeNode();
- node1.Text = markerLayer.Caption;
- node1.ImageIndex = 0;
- node1.SelectedImageIndex = 0;
- node1.Checked = markerLayer.Visible;
- node1.Tag = markerLayer;
- layerMarkerTree.Nodes[0].Nodes.Add(node1);
- }
- }
+ if (!File.Exists(Application.StartupPath + "\\标注管理\\" + markerStrs[i] + ".lgd")) continue;
+ GSOLayer markerLayer = globeControl1.Globe.Layers.Add(Application.StartupPath + "\\标注管理\\" + markerStrs[i] + ".lgd");
+ if (markerLayer == null) continue;
+ TreeNode node1 = new TreeNode();
+ node1.Text = markerLayer.Caption;
+ node1.ImageIndex = 0;
+ node1.SelectedImageIndex = 0;
+ node1.Checked = markerLayer.Visible;
+ node1.Tag = markerLayer;
+ layerMarkerTree.Nodes[0].Nodes.Add(node1);
}
}
private void MainFrm_Load(object sender, EventArgs e)
{
initGlobalControl();
- initGlobalMap();
+ //initGlobalMap();
initLayerTree();
initMarkerTree();
initLayout();
loadData();
+
double x = Convert.ToDouble(Utility.Query_Roads["绿岛"].ToString().Split(',')[0]);
double y = Convert.ToDouble(Utility.Query_Roads["绿岛"].ToString().Split(',')[1]);
double z = Convert.ToDouble(Utility.Query_Roads["绿岛"].ToString().Split(',')[2]);
@@ -1415,12 +1335,12 @@
#endregion
- Dictionary dictionaryNetLayerNameAndCaption = new Dictionary();
+ //Dictionary Utility.dictionaryNetLayerNameAndCaption = new Dictionary();
void globeControl1_AfterNetLayerAddEvent(object sender, AfterNetLayerAddEventArgs e)
{
- if (e.Layer != null && dictionaryNetLayerNameAndCaption.ContainsKey(e.Layer.Caption))
+ if (e.Layer != null && Utility.dictionaryNetLayerNameAndCaption.ContainsKey(e.Layer.Caption))
{
- e.Layer.Caption = dictionaryNetLayerNameAndCaption[e.Layer.Caption];
+ e.Layer.Caption = Utility.dictionaryNetLayerNameAndCaption[e.Layer.Caption];
}
}
@@ -1530,37 +1450,30 @@
///
Boolean CheckDatasetGeoReference(GSODataset dataset, string strDataPath)
{
+
+ if (dataset.GeoReferenceType != EnumGeoReferenceType.Flat) return true;
Boolean bSuccess = false;
- if (dataset.GeoReferenceType == EnumGeoReferenceType.Flat)
- {
- if (MessageBox.Show("数据没有空间参考信息,请设置空间参考信息!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) == DialogResult.OK)
- {
- String strPath = Application.StartupPath + "\\Coordinate Systems";
- OpenFileDialog dlg = new OpenFileDialog();
+ if (MessageBox.Show("数据没有空间参考信息,请设置空间参考信息!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) !=
+ DialogResult.OK) return bSuccess;
+ String strPath = Application.StartupPath + "\\Coordinate Systems";
+ OpenFileDialog dlg = new OpenFileDialog();
- dlg.InitialDirectory = strPath;
- dlg.RestoreDirectory = true;
+ dlg.InitialDirectory = strPath;
+ dlg.RestoreDirectory = true;
- dlg.Filter = "投影文件|*.prj||";
- if (dlg.ShowDialog() == DialogResult.OK)
- {
- string lprjStr = GSODataEngineUtility.ConvertEsriPrjFileToProj4(dlg.FileName);
- string lprjFileContent = "0prj4" + lprjStr + "";
+ dlg.Filter = "投影文件|*.prj||";
+ if (dlg.ShowDialog() != DialogResult.OK) return bSuccess;
+ string lprjStr = GSODataEngineUtility.ConvertEsriPrjFileToProj4(dlg.FileName);
+ string lprjFileContent = "0prj4" + lprjStr +
+ "";
- bSuccess = dataset.LoadProjectionFromESRIFile(dlg.FileName);
+ bSuccess = dataset.LoadProjectionFromESRIFile(dlg.FileName);
- string lprjFileName = strDataPath.Substring(0, strDataPath.LastIndexOf(".")) + ".lprj";
- StreamWriter writer = new StreamWriter(lprjFileName, false);
- writer.Write(lprjFileContent);
- writer.Close();
+ string lprjFileName = strDataPath.Substring(0, strDataPath.LastIndexOf(".")) + ".lprj";
+ StreamWriter writer = new StreamWriter(lprjFileName, false);
+ writer.Write(lprjFileContent);
+ writer.Close();
- }
- }
- }
- else
- {
- return true;
- }
return bSuccess;
}
@@ -1571,49 +1484,47 @@
///
void globeControl1_TrackRectEndEvent(object sender, TrackRectEndEventArgs e)
{
- if (e.Polygon != null)
+ if (e.Polygon == null) return;
+ globeControl1.Globe.TrackRectTool.Clear();
+ globeControl1.ImmediatelyRefresh();
+ globeControl1.SwapBuffer();
+ Point pt1 = new Point(Convert.ToInt32(e.StartPos.X), Convert.ToInt32(e.StartPos.Y));
+ Point pt2 = new Point(Convert.ToInt32(e.EndPos.X), Convert.ToInt32(e.EndPos.Y));
+
+ int mapWidth = 0;
+ int mapHeight = 0;
+ Point pt = getUpperLeftPoint(pt1, pt2, out mapWidth, out mapHeight);
+ int rightBottomX = pt.X + mapWidth;
+ int rightBottomY = pt.Y + mapHeight;
+ Image myImg = new Bitmap(mapWidth, mapHeight);
+ Graphics g = Graphics.FromImage(myImg);
+ g.CopyFromScreen(pt, new Point(0, 0), new Size(rightBottomX, rightBottomY));
+
+ SaveFileDialog dlg = new SaveFileDialog();
+ dlg.Filter = "输出JPEG(*.jpg)|*.jpg|输出PNG(*.png)|*.png|输出BMP(*.bmp)|*.bmp|输出BMP(*.gif)|*.gif";
+ if (dlg.ShowDialog() == DialogResult.OK)
{
- globeControl1.Globe.TrackRectTool.Clear();
- globeControl1.ImmediatelyRefresh();
- globeControl1.SwapBuffer();
- Point pt1 = new Point(Convert.ToInt32(e.StartPos.X), Convert.ToInt32(e.StartPos.Y));
- Point pt2 = new Point(Convert.ToInt32(e.EndPos.X), Convert.ToInt32(e.EndPos.Y));
-
- int mapWidth = 0;
- int mapHeight = 0;
- Point pt = getUpperLeftPoint(pt1, pt2, out mapWidth, out mapHeight);
- int rightBottomX = pt.X + mapWidth;
- int rightBottomY = pt.Y + mapHeight;
- Image myImg = new Bitmap(mapWidth, mapHeight);
- Graphics g = Graphics.FromImage(myImg);
- g.CopyFromScreen(pt, new Point(0, 0), new Size(rightBottomX, rightBottomY));
-
- SaveFileDialog dlg = new SaveFileDialog();
- dlg.Filter = "输出JPEG(*.jpg)|*.jpg|输出PNG(*.png)|*.png|输出BMP(*.bmp)|*.bmp|输出BMP(*.gif)|*.gif";
- if (dlg.ShowDialog() == DialogResult.OK)
+ string extension = Path.GetExtension(dlg.FileName);//扩展名
+ switch (extension)
{
- string extension = Path.GetExtension(dlg.FileName);//扩展名
- switch (extension)
- {
- case ".jpg":
- myImg.Save(dlg.FileName, ImageFormat.Jpeg);
- break;
- case ".png":
- myImg.Save(dlg.FileName, ImageFormat.Png);
- break;
- case ".bmp":
- myImg.Save(dlg.FileName, ImageFormat.Bmp);
- break;
- case ".gif":
- myImg.Save(dlg.FileName, ImageFormat.Gif);
- break;
- default:
- break;
- }
+ case ".jpg":
+ myImg.Save(dlg.FileName, ImageFormat.Jpeg);
+ break;
+ case ".png":
+ myImg.Save(dlg.FileName, ImageFormat.Png);
+ break;
+ case ".bmp":
+ myImg.Save(dlg.FileName, ImageFormat.Bmp);
+ break;
+ case ".gif":
+ myImg.Save(dlg.FileName, ImageFormat.Gif);
+ break;
+ default:
+ break;
}
- globeControl1.Globe.Action = EnumAction3D.ActionNull;
- globeControl1.Globe.MouseRoamingEnable = true;
}
+ globeControl1.Globe.Action = EnumAction3D.ActionNull;
+ globeControl1.Globe.MouseRoamingEnable = true;
}
///
/// 定位正北正90度俯视
@@ -1711,18 +1622,12 @@
///
private void CheckControl(TreeViewEventArgs e)
{
- if (e.Action != TreeViewAction.Unknown)
+ if (e.Action == TreeViewAction.Unknown||e.Node == null || Convert.IsDBNull(e.Node)) return;
+ CheckParentNode(e.Node);
+ if (e.Node.Nodes.Count > 0)
{
- if (e.Node != null && !Convert.IsDBNull(e.Node))
- {
- CheckParentNode(e.Node);
- if (e.Node.Nodes.Count > 0)
- {
- CheckAllChildNodes(e.Node, e.Node.Checked);
- }
- }
+ CheckAllChildNodes(e.Node, e.Node.Checked);
}
-
}
///
/// 改变所有子节点的状态
@@ -1747,94 +1652,88 @@
{
bool bChecked = false;
- if (curNode.Parent != null)
+ if (curNode.Parent == null) return;
+ foreach (TreeNode node in curNode.Parent.Nodes)
{
- foreach (TreeNode node in curNode.Parent.Nodes)
+ if (node.Checked)
{
- if (node.Checked)
- {
- bChecked = true;
- break;
- }
+ bChecked = true;
+ break;
}
+ }
- if (bChecked)
- {
- curNode.Parent.Checked = true;
- CheckParentNode(curNode.Parent);
- }
- else
- {
- curNode.Parent.Checked = false;
- CheckParentNode(curNode.Parent);
- }
+ if (bChecked)
+ {
+ curNode.Parent.Checked = true;
+ CheckParentNode(curNode.Parent);
+ }
+ else
+ {
+ curNode.Parent.Checked = false;
+ CheckParentNode(curNode.Parent);
}
}
private void layerTree_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
{
- if (e.Button == MouseButtons.Right)
+ if (e.Button != MouseButtons.Right) return;
+ layerTree.SelectedNode = e.Node;
+ if (e.Node.Tag == null) return;
+ if (e.Button == MouseButtons.Right && e.Node.Tag.ToString().Contains("|"))
{
- layerTree.SelectedNode = e.Node;
- if (e.Node.Tag != null)
+
+ if (e.Node.Tag.ToString().Split('|')[0] == "locaserver")
{
- if (e.Button == MouseButtons.Right && e.Node.Tag.ToString().Contains("|"))
+
+ foreach (ToolStripItem item in layerNodeContexMenu.Items)
{
-
- if (e.Node.Tag.ToString().Split('|')[0] == "locaserver")
- {
-
- foreach (ToolStripItem item in layerNodeContexMenu.Items)
- {
- item.Visible = false;
- }
- return;
-
- }
-
- if (e.Node.Tag.ToString().Split('|')[0] == "new")
- {
- LayerEditableMenuItem.Enabled = true;
- foreach (ToolStripItem item in layerNodeContexMenu.Items)
- {
- item.Visible = false;
- }
- LayerSelectableMenuItem.Visible = true;
- LayerEditableMenuItem.Visible = true;
- RemoveLayer.Visible = true;
- RefreshLayerFeatureListMenuItem.Visible = true;
- SaveLayerMenuItem.Visible = true;
- LayerFlyMenuItem.Visible = true;
- }
-
- LayerSelectableMenuItem.Visible = true;
- LayerEditableMenuItem.Visible = true;
- SaveLayerMenuItem.Visible = true;
- LayerFlyMenuItem.Visible = true;
- 导出CADToolStripMenuItem1.Visible = true;
-
- layerNodeContexMenu.Show(layerTree, e.X, e.Y);
- layerNodeContexMenu.Tag = e.Node;
- GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(e.Node.Tag.ToString().Split('|')[1]);
- if (layer != null)
- {
- LayerSelectableMenuItem.Checked = layer.Selectable;
- LayerEditableMenuItem.Checked = layer.Editable;
- }
+ item.Visible = false;
}
- else
+ return;
+
+ }
+
+ if (e.Node.Tag.ToString().Split('|')[0] == "new")
+ {
+ LayerEditableMenuItem.Enabled = true;
+ foreach (ToolStripItem item in layerNodeContexMenu.Items)
{
- if (e.Node.Tag is GSOLayer && e.Node.Parent != null && e.Node.Parent.Text.Trim() == "临时图层")
- {
- contextMenuStripDeleteLayerNode.Show(layerTree, e.X, e.Y);
- contextMenuStripDeleteLayerNode.Tag = e.Node;
- }
- if (e.Node.Tag is GSOFeature && e.Node.Parent != null && e.Node.Parent.Text.Trim() == "我的地标")
- {
- contextMenuStripDeleteLayerNode.Show(layerTree, e.X, e.Y);
- contextMenuStripDeleteLayerNode.Tag = e.Node;
- }
+ item.Visible = false;
}
+ //LayerSelectableMenuItem.Visible = true;
+ //LayerEditableMenuItem.Visible = true;
+ RemoveLayer.Visible = true;
+ RefreshLayerFeatureListMenuItem.Visible = true;
+ //SaveLayerMenuItem.Visible = true;
+ //LayerFlyMenuItem.Visible = true;
+ }
+
+ LayerSelectableMenuItem.Visible = true;
+ LayerEditableMenuItem.Visible = true;
+ SaveLayerMenuItem.Visible = true;
+ LayerFlyMenuItem.Visible = true;
+ 导出CADToolStripMenuItem1.Visible = true;
+
+ layerNodeContexMenu.Show(layerTree, e.X, e.Y);
+ layerNodeContexMenu.Tag = e.Node;
+ GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(e.Node.Tag.ToString().Split('|')[1]);
+ if (layer != null)
+ {
+ LayerSelectableMenuItem.Checked = layer.Selectable;
+ LayerEditableMenuItem.Checked = layer.Editable;
+ }
+ }
+ else
+ {
+ if (e.Node.Tag is GSOLayer && e.Node.Parent != null && e.Node.Parent.Text.Trim() == "临时图层")
+ {
+ contextMenuStripDeleteLayerNode.Show(layerTree, e.X, e.Y);
+ contextMenuStripDeleteLayerNode.Tag = e.Node;
+ }
+ else if (e.Node.Tag is GSOFeature && e.Node.Parent != null && e.Node.Parent.Text.Trim() == "我的地标")
+ {
+ contextMenuStripDeleteLayerNode.Show(layerTree, e.X, e.Y);
+ contextMenuStripDeleteLayerNode.Tag = e.Node;
}
}
}
@@ -1909,110 +1808,103 @@
{
TreeNode node = layerTree.SelectedNode;
- if (node != null)
+ if (node == null) return;
+ if (node.Parent.Text.Trim() == "临时图层")
{
- if (node.Parent.Text.Trim() == "临时图层")
+ GSOLayer lsLayer = globeControl1.Globe.Layers.GetLayerByCaption(node.Text);
+ double x = lsLayer.LatLonBounds.Center.X;
+ double y = lsLayer.LatLonBounds.Center.Y;
+ if (x == 0 && y == 0)
{
- GSOLayer lsLayer = globeControl1.Globe.Layers.GetLayerByCaption(node.Text);
- double x = lsLayer.LatLonBounds.Center.X;
- double y = lsLayer.LatLonBounds.Center.Y;
- if (x == 0 && y == 0)
- {
- x = lsLayer.Bounds.Center.X;
- y = lsLayer.Bounds.Center.Y;
- }
+ x = lsLayer.Bounds.Center.X;
+ y = lsLayer.Bounds.Center.Y;
+ }
- globeControl1.Globe.FlyToPosition(new GSOPoint3d(x, y, 10), EnumAltitudeMode.Absolute);
+ globeControl1.Globe.FlyToPosition(new GSOPoint3d(x, y, 10), EnumAltitudeMode.Absolute);
+ }
+ else
+ {
+ GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(node.Tag.ToString().Split('|')[1]);
+
+ if (layer == null) return;
+ if (layer.Caption == "红线")
+ {
+ globeControl1.Globe.FlyToPosition(new GSOPoint3d(120.610963, 31.188121, 50), EnumAltitudeMode.Absolute, -4, 50, 1000);
+ globeControl1.Globe.FlyToPointSpeed = 10000000;
+ globeControl1.Globe.Action = EnumAction3D.SelectObject;
+
+ GSOLayer redLayer = globeControl1.Globe.Layers.GetLayerByCaption("红线");
+ if (redLayer != null)
+ {
+ redLayer.Visible = true;
+ }
+ globeControl1.Refresh();
}
else
{
- GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(node.Tag.ToString().Split('|')[1]);
-
- if (layer != null)
- {
- if (layer.Caption == "红线")
- {
- globeControl1.Globe.FlyToPosition(new GSOPoint3d(120.610963, 31.188121, 50), EnumAltitudeMode.Absolute, -4, 50, 1000);
- globeControl1.Globe.FlyToPointSpeed = 10000000;
- globeControl1.Globe.Action = EnumAction3D.SelectObject;
-
- GSOLayer redLayer = globeControl1.Globe.Layers.GetLayerByCaption("红线");
- if (redLayer != null)
- {
- redLayer.Visible = true;
- }
- globeControl1.Refresh();
- }
- else
- {
- double x = layer.LatLonBounds.Center.X;
- double y = layer.LatLonBounds.Center.Y;
- globeControl1.Globe.FlyToPosition(new GSOPoint3d(x, y, 100), EnumAltitudeMode.Absolute);
- }
- }
+ double x = layer.LatLonBounds.Center.X;
+ double y = layer.LatLonBounds.Center.Y;
+ globeControl1.Globe.FlyToPosition(new GSOPoint3d(x, y, 100), EnumAltitudeMode.Absolute);
}
}
}
private void layerTree_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e)
{
- if (layerTree.SelectedNode != null)
+ if (layerTree.SelectedNode == null) return;
+ if (layerTree.SelectedNode.Tag.ToString().Contains("|"))
{
- if (layerTree.SelectedNode.Tag.ToString().Contains("|"))
+ string nodeTag = layerTree.SelectedNode.Tag.ToString().Split('|')[1];
+ GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(nodeTag);
+ if (layer != null)
{
- string nodeTag = layerTree.SelectedNode.Tag.ToString().Split('|')[1];
- GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(nodeTag);
- if (layer != null)
+ if (layer.Caption == "红线")
{
- if (layer.Caption == "红线")
- {
- globeControl1.Globe.FlyToPosition(new GSOPoint3d(120.610963, 31.188121, 50), EnumAltitudeMode.Absolute, -4, 50, 1000);
- globeControl1.Globe.FlyToPointSpeed = 10000000;
- globeControl1.Globe.Action = EnumAction3D.SelectObject;
+ globeControl1.Globe.FlyToPosition(new GSOPoint3d(120.610963, 31.188121, 50), EnumAltitudeMode.Absolute, -4, 50, 1000);
+ globeControl1.Globe.FlyToPointSpeed = 10000000;
+ globeControl1.Globe.Action = EnumAction3D.SelectObject;
- GSOLayer redLayer = globeControl1.Globe.Layers.GetLayerByCaption("红线");
- if (redLayer != null)
- {
- redLayer.Visible = true;
- }
- globeControl1.Refresh();
- }
- else
+ GSOLayer redLayer = globeControl1.Globe.Layers.GetLayerByCaption("红线");
+ if (redLayer != null)
{
- double x = layer.LatLonBounds.Center.X;
- double y = layer.LatLonBounds.Center.Y;
- globeControl1.Globe.FlyToPosition(new GSOPoint3d(x, y, 0), EnumAltitudeMode.Absolute);
+ redLayer.Visible = true;
}
+ globeControl1.Refresh();
+ }
+ else
+ {
+ double x = layer.LatLonBounds.Center.X;
+ double y = layer.LatLonBounds.Center.Y;
+ globeControl1.Globe.FlyToPosition(new GSOPoint3d(x, y, 0), EnumAltitudeMode.Absolute);
}
}
- if (layerTree.SelectedNode.Tag is GSOLayer)
+ }
+ if (layerTree.SelectedNode.Tag is GSOLayer)
+ {
+ GSOLayer layer = layerTree.SelectedNode.Tag as GSOLayer;
+ if (layer.GetAllFeatures().Length > 0)
{
- GSOLayer layer = layerTree.SelectedNode.Tag as GSOLayer;
- if (layer.GetAllFeatures().Length > 0)
+ GSOFeature feature = layer.GetAt(0);
+ if (feature != null && feature.Geometry != null)
{
- GSOFeature feature = layer.GetAt(0);
- if (feature != null && feature.Geometry != null)
- {
- globeControl1.Globe.FlyToPosition(feature.Geometry.GeoCenterPoint, EnumAltitudeMode.Absolute);//, 0, 0, 1000);
- }
- else
- {
- globeControl1.Globe.FlyToFeature(feature);
- }
- }
- }
- if (layerTree.SelectedNode.Tag is GSOFeature)
- {
- GSOFeature feature = layerTree.SelectedNode.Tag as GSOFeature;
- if (feature.Geometry != null)
- {
- globeControl1.Globe.FlyToPosition(feature.Geometry.GeoCenterPoint, EnumAltitudeMode.Absolute, 0, 0, 10);
+ globeControl1.Globe.FlyToPosition(feature.Geometry.GeoCenterPoint, EnumAltitudeMode.Absolute);//, 0, 0, 1000);
}
else
{
globeControl1.Globe.FlyToFeature(feature);
}
}
+ } else if (layerTree.SelectedNode.Tag is GSOFeature)
+ {
+ GSOFeature feature = layerTree.SelectedNode.Tag as GSOFeature;
+ if (feature.Geometry != null)
+ {
+ globeControl1.Globe.FlyToPosition(feature.Geometry.GeoCenterPoint, EnumAltitudeMode.Absolute, 0, 0, 10);
+ }
+ else
+ {
+ globeControl1.Globe.FlyToFeature(feature);
+ }
}
}
@@ -2086,7 +1978,7 @@
trackPolylineEndMode == EnumTrackPolylineEndMode.DLDM_Analysis)
{
Dictionary hdmDic = SectionAnalysisTool.HDMAnalysis(globeControl1,
- e.Polyline, m_PipelineLayerNames);
+ e.Polyline, Utility.m_PipelineLayerNames);
FrmHDMAnalysis3 frm = new FrmHDMAnalysis3(hdmDic, globeControl1,
trackPolylineEndMode);
frm.Show(this);
@@ -2103,185 +1995,6 @@
* **/
}
trackPolylineEndMode = EnumTrackPolylineEndMode.Default_Analysis;
- /*
- ArrayList arraylistPoint = new ArrayList();
- ArrayList arraylistLine = new ArrayList();
-
- // globeControl1.Globe.ClearLastTrackPolyline();
-
- if (e.Polyline != null)
- {
- //横断面分析
- if (buttonItemFX2_1.Checked || buttonItemFX2_3.Checked)
- {
- if (m_PipelineLayerNames != null)
- {
- GSOGeoPolygon3D polygon = e.Polyline.CreateBuffer(0.1, true, 5, true, false);
- for (int i = 0; i < m_PipelineLayerNames.Count; i++)
- {
- if (m_PipelineLayerNames[i] != null)
- {
- GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(m_PipelineLayerNames[i]);
- if (layer == null)
- {
- continue;
- }
- if (layer.Visible == false)
- {
- continue;
- }
- GSOFeatureLayer featurelayer = layer as GSOFeatureLayer;
- if (featurelayer != null)
- {
- GSOFeatures feats = featurelayer.FindFeaturesInPolygon(polygon, false); //featurelayer.GetAllFeatures();
- if (feats != null)
- {
- for (int j = 0; j < feats.Length; j++)
- {
- GSOFeature feateline = feats[j];
- GSOGeoPolyline3D geoline = feateline.Geometry as GSOGeoPolyline3D;
-
- if (geoline != null)
- {
- if (geoline.Style != null)
- {
- if (geoline.Style.GetType() == typeof(GSOPipeLineStyle3D))
- {
- GSOPoint3d pntIntersect1 = new GSOPoint3d();
- GSOPoint3d pntIntersect2 = new GSOPoint3d();
-
- double honLen;
- double verLen;
- double dDist = globeControl1.Globe.Analysis3D.ComputeTwoGeoPolylineDistance(e.Polyline, geoline, out pntIntersect1, out pntIntersect2, out honLen, out verLen, false, false, 0);
-
- globeControl1.Globe.Action = EnumAction3D.ActionNull;
- if (dDist > -1)
- {
- arraylistPoint.Add(pntIntersect2);
- arraylistLine.Add(feateline);
- }
- }
- }
- }
- }
- }
- else
- {
- MessageBox.Show("请重新绘制断面");
- return;
- }
-
- }
- }
- }
- }
- if (buttonItemFX2_1.Checked)
- {
- FrmHDMAnalysis3 frm = FrmHDMAnalysis3.GetForm(arraylistPoint, arraylistLine, e.Polyline, globeControl1);
- if (!frm.isShowFirst)
- {
- frm.Show(this);
- }
- frm.LoadChartEvent();
- }
- else
- {
- FrmRoadHDM frm = FrmRoadHDM.GetForm(arraylistPoint, arraylistLine, e.Polyline, globeControl1);
- if (!frm.isShowFirst)
- {
- frm.Show(this);
- }
- frm.LoadChartEvent();
- }
- globeControl1.Globe.ClearLastTrackPolyline();
- }
- else if (buttonItemFX2_4.Checked)
- {
- FrmBaseLineProfillAnalysis dlg = new FrmBaseLineProfillAnalysis(globeControl1.Globe, e.Polyline);
- dlg.Show(this);
- globeControl1.Globe.ClearLastTrackPolyline();
- }
- else if (buttonItemFX4_3.Checked)
- {
- GSOGeoPolygon3D resPolygon = e.Polyline.CreateBuffer(m_dDigPitWidthAlongLine, false, 0, false, false);
-
- GSOGeoPit geoPit = new GSOGeoPit();
- geoPit.PitPolygon = resPolygon;
- if (m_bDigPitByDepth)
- {
- geoPit.PitDepth = m_dDigPitValue;
- geoPit.PitDepthUsing = true;
- }
- else
- {
- geoPit.PitBottomAlt = m_dDigPitValue;
- geoPit.PitDepthUsing = false;
- }
-
- globeControl1.Globe.AddPit("", geoPit);
- GSOLayer layerGround = globeControl1.Globe.Layers.GetLayerByCaption(roadLayerName);// ("180fd");
- if (layerGround != null)
- {
- layerGround.Visible = false;
- }
- // 清除当前TrackPolygonAnalysis的痕迹
- globeControl1.Globe.ClearLastTrackPolyline();
- }
- else if (distanceMarker)
- {
- setMarkerLayerUnVisible("距离标注");
- GSOLayer l = globeControl1.Globe.Layers.GetLayerByCaption("距离标注");
- if (l != null)
- {
- l.Visible = true;
- if (getLabelName(l) != -1)
- {
- GSOGeoPolyline3D line = e.Polyline;
- if (line.PartCount > 0)
- {
- double length = line.GetSpaceLength(true, 6378137);//线的长度
- if (length == 0)
- {
- return;
- }
- else
- {
-
- GSOGeoPoint3D pt = new GSOGeoPoint3D();
- GSOGeoPolyline3D lineLine = line.GetSegment(0, length / 2);
- GSOPoint3d point3d = lineLine[lineLine.PartCount - 1][lineLine[lineLine.PartCount - 1].Count - 1];
- pt.X = point3d.X;
- pt.Y = point3d.Y;
- pt.Z = point3d.Z;
-
- string Twodecimalplaces = string.Format("{0:F}", length);
- string radiusLabelName = "" + Twodecimalplaces + "米";
- //string radiusLabelName = "" + length + "米";//标注名称
-
- GSOPoint2d point2d = new GSOPoint2d(0, 30);//标注位置
-
- int labelText = getLabelName(l);
-
- GSOFeature newFeatureLine = new GSOFeature();
- newFeatureLine.Geometry = line;
- newFeatureLine.Name = (labelText + 1).ToString() + "-line";
- l.AddFeature(newFeatureLine);
- globeControl1.Globe.ClearLastTrackPolyline();
-
- GSOFeature newFeature = new GSOFeature();
- newFeature = createLabel(l, newFeature, pt, radiusLabelName, (labelText + 1).ToString(), point2d);
- l.AddFeature(newFeature);
-
- globeControl1.Refresh();
- }
- }
- }
- }
- }
- }
- globeControl1.Globe.Action = EnumAction3D.ActionNull;
- ActionToolMenuChecked();
- * **/
}
#endregion
@@ -2292,83 +2005,81 @@
///
void globeControl1_TrackPolygonEndEvent(object sender, TrackPolygonEndEventArgs e)
{
- if (globeControl1.Globe.Action == EnumAction3D.TrackPolygon && e.Polygon != null)
+ if (globeControl1.Globe.Action != EnumAction3D.TrackPolygon || e.Polygon == null) return;
+ GSOGeoPolygon3D polygon = e.Polygon;
+
+ switch (trackflag)
{
- GSOGeoPolygon3D polygon = e.Polygon;
+ case "valvequery":
+ FrmValveStatistics frm = new FrmValveStatistics(globeControl1, polygon, InitDataGridViewX1);
+ frm.Show(this);
+ globeControl1.Globe.Action = EnumAction3D.ActionNull;
+ break;
- switch (trackflag)
- {
- case "valvequery":
- FrmValveStatistics frm = new FrmValveStatistics(globeControl1, polygon, InitDataGridViewX1);
- frm.Show(this);
- globeControl1.Globe.Action = EnumAction3D.ActionNull;
- break;
+ case "PipelineDistanceStatistics":
- case "PipelineDistanceStatistics":
+ FrmAllPipelineStatis frm1 = new FrmAllPipelineStatis(globeControl1, polygon, InitDataGridViewX1, Utility.m_PipelineLayerNames);
+ frm1.Show(this);
+ globeControl1.Globe.Action = EnumAction3D.ActionNull;
- FrmAllPipelineStatis frm1 = new FrmAllPipelineStatis(globeControl1, polygon, InitDataGridViewX1, m_PipelineLayerNames);
- frm1.Show(this);
- globeControl1.Globe.Action = EnumAction3D.ActionNull;
+ break;
+ case "PipelineSpatialQuery":
- break;
- case "PipelineSpatialQuery":
+ FrmAllPipelineStatis.ShowForm(globeControl1, polygon, InitDataGridViewX1, Utility.m_PipelineLayerNames);
+ globeControl1.Globe.ClearAnalysis();
+ globeControl1.Globe.Action = EnumAction3D.ActionNull;
- FrmAllPipelineStatis.ShowForm(globeControl1, polygon, InitDataGridViewX1, m_PipelineLayerNames);
- globeControl1.Globe.ClearAnalysis();
- globeControl1.Globe.Action = EnumAction3D.ActionNull;
+ break;
+ case "workwellquery":
+ FrmAllWorkWellStatis frmWell = new FrmAllWorkWellStatis(globeControl1, polygon, InitDataGridViewX1);
+ frmWell.Show(this);
- break;
- case "workwellquery":
- FrmAllWorkWellStatis frmWell = new FrmAllWorkWellStatis(globeControl1, polygon, InitDataGridViewX1);
- frmWell.Show(this);
+ globeControl1.Globe.Action = EnumAction3D.ActionNull;
- globeControl1.Globe.Action = EnumAction3D.ActionNull;
+ break;
- break;
-
- case "pit":
- double depth;
- FrmTackPolygonDlg dlg = new FrmTackPolygonDlg();
- if (dlg.ShowDialog() == DialogResult.OK)
+ case "pit":
+ double depth;
+ FrmTackPolygonDlg dlg = new FrmTackPolygonDlg();
+ if (dlg.ShowDialog() == DialogResult.OK)
+ {
+ depth = dlg.depth;
+ GSOGeoPit geoPit = new GSOGeoPit();
+ geoPit.PitPolygon = polygon;
+ geoPit.PitDepth = depth;
+ geoPit.PitDepthUsing = true;
+ globeControl1.Globe.AddPit("", geoPit);
+ GSOLayer layerGround = globeControl1.Globe.Layers.GetLayerByCaption(Utility.roadLayerName);//("180fd");
+ if (layerGround != null)
{
- depth = dlg.depth;
- GSOGeoPit geoPit = new GSOGeoPit();
- geoPit.PitPolygon = polygon;
- geoPit.PitDepth = depth;
- geoPit.PitDepthUsing = true;
- globeControl1.Globe.AddPit("", geoPit);
- GSOLayer layerGround = globeControl1.Globe.Layers.GetLayerByCaption(roadLayerName);//("180fd");
- if (layerGround != null)
- {
- layerGround.Visible = false;
- }
+ layerGround.Visible = false;
}
- globeControl1.Globe.ClearLastTrackPolygon();
- globeControl1.Globe.Action = EnumAction3D.ActionNull;
- break;
- case "digFillAnalysis":
- DigFillAnalysisDlg dlg1 = new DigFillAnalysisDlg();
- dlg1.m_globe = globeControl1.Globe;
- dlg1.m_polygon3D = polygon;
- globeControl1.Globe.Action = EnumAction3D.ActionNull;
- dlg1.Show(this);
- break;
- case "FloodAnalysis":
- FrmFloodAnalysis frmFloodAnalysis = new FrmFloodAnalysis(globeControl1.Globe, polygon);
- frmFloodAnalysis.Show(this);
- globeControl1.Globe.Action = EnumAction3D.ActionNull;
- break;
- case "BSQDuoBianXiangStatis":
- FrmBSQStatis bsqFrm = new FrmBSQStatis(globeControl1, e.Polygon);
- bsqFrm.Show(this);
- globeControl1.Globe.Action = EnumAction3D.ActionNull;
- break;
+ }
+ globeControl1.Globe.ClearLastTrackPolygon();
+ globeControl1.Globe.Action = EnumAction3D.ActionNull;
+ break;
+ case "digFillAnalysis":
+ DigFillAnalysisDlg dlg1 = new DigFillAnalysisDlg();
+ dlg1.m_globe = globeControl1.Globe;
+ dlg1.m_polygon3D = polygon;
+ globeControl1.Globe.Action = EnumAction3D.ActionNull;
+ dlg1.Show(this);
+ break;
+ case "FloodAnalysis":
+ FrmFloodAnalysis frmFloodAnalysis = new FrmFloodAnalysis(globeControl1.Globe, polygon);
+ frmFloodAnalysis.Show(this);
+ globeControl1.Globe.Action = EnumAction3D.ActionNull;
+ break;
+ case "BSQDuoBianXiangStatis":
+ FrmBSQStatis bsqFrm = new FrmBSQStatis(globeControl1, e.Polygon);
+ bsqFrm.Show(this);
+ globeControl1.Globe.Action = EnumAction3D.ActionNull;
+ break;
- case "":
- break;
- default:
- break;
- }
+ case "":
+ break;
+ default:
+ break;
}
}
///
@@ -2380,16 +2091,14 @@
{
try
{
- if (e.Feature != null)
+ if (e.Feature == null) return;
+ if (isFeatureContainsBianhao(e.Feature))
{
- if (isFeatureContainsBianhao(e.Feature))
- {
- featureTooltip.ShowBalloon((int)e.MousePos.X, (int)e.MousePos.Y, e.Feature.GetValue(featureIDFieldName).ToString());
- }
- else if (e.Feature.Name != "")
- {
- featureTooltip.ShowBalloon((int)e.MousePos.X, (int)e.MousePos.Y, e.Feature.Name);
- }
+ featureTooltip.ShowBalloon((int)e.MousePos.X, (int)e.MousePos.Y, e.Feature.GetValue(featureIDFieldName).ToString());
+ }
+ else if (e.Feature.Name != "")
+ {
+ featureTooltip.ShowBalloon((int)e.MousePos.X, (int)e.MousePos.Y, e.Feature.Name);
}
}
catch (Exception ex)
@@ -2405,192 +2114,188 @@
/// (完善)
void globeControl1_MouseDoubleClick(object sender, MouseEventArgs e)
{
- if (e.Button == MouseButtons.Left)
+ if (e.Button != MouseButtons.Left) return;
+ if (m_AddPipeLine && globeControl1.Globe.Action == EnumAction3D.DrawPolyline)//添加管线
{
- if (m_AddPipeLine && globeControl1.Globe.Action == EnumAction3D.DrawPolyline)//添加管线
+ GSOLayer layerDest = globeControl1.Globe.DestLayerFeatureAdd;
+ if (layerDest != null)
{
- GSOLayer layerDest = globeControl1.Globe.DestLayerFeatureAdd;
- if (layerDest != null)
+ GSOFeatures features = layerDest.GetAllFeatures();
+ GSOFeature f = features[features.Length - 1];
+ GSOGeoPolyline3D line = f.Geometry as GSOGeoPolyline3D;
+ globeControl1.Globe.Action = EnumAction3D.ActionNull;
+ if (f != null && f.Geometry.Type == EnumGeometryType.GeoPolyline3D)
{
- GSOFeatures features = layerDest.GetAllFeatures();
- GSOFeature f = features[features.Length - 1];
- GSOGeoPolyline3D line = f.Geometry as GSOGeoPolyline3D;
- globeControl1.Globe.Action = EnumAction3D.ActionNull;
- if (f != null && f.Geometry.Type == EnumGeometryType.GeoPolyline3D)
- {
- FrmLineCoordinate lineCoordiante = new FrmLineCoordinate(f, globeControl1, layerDest.Caption);
- lineCoordiante.Show(this);
- }
- globeControl1.Refresh();
- }
- }
- if (m_isDrawTunnel && globeControl1.Globe.Action == EnumAction3D.DrawPolyline)//创建隧道
- {
- GSOLayer tunnel = globeControl1.Globe.Layers.GetLayerByCaption("隧道");
- if (tunnel != null && tunnel.GetAllFeatures().Length > 0)
- {
- GSOFeature feature = tunnel.GetAt(tunnel.GetAllFeatures().Length - 1);
- FrmCreateTunnel frm = new FrmCreateTunnel(globeControl1, feature);
- if (frm.ShowDialog() == DialogResult.OK)
- {
- //tunnel.Save();
- }
+ FrmLineCoordinate lineCoordiante = new FrmLineCoordinate(f, globeControl1, layerDest.Caption);
+ lineCoordiante.Show(this);
}
globeControl1.Refresh();
}
- if (m_isDrawCitySevenLine && globeControl1.Globe.Action == EnumAction3D.DrawPolyline)//绘制城市七线
+ }
+ if (m_isDrawTunnel && globeControl1.Globe.Action == EnumAction3D.DrawPolyline)//创建隧道
+ {
+ GSOLayer tunnel = globeControl1.Globe.Layers.GetLayerByCaption("隧道");
+ if (tunnel != null && tunnel.GetAllFeatures().Length > 0)
{
- string lineType = citySevenLineType;
- string lineName = cityServerLineName;
- GSOFeature feature = null;
- switch (lineType)
+ GSOFeature feature = tunnel.GetAt(tunnel.GetAllFeatures().Length - 1);
+ FrmCreateTunnel frm = new FrmCreateTunnel(globeControl1, feature);
+ if (frm.ShowDialog() == DialogResult.OK)
{
- case "城市红线":
- GSOLayer layerRed = globeControl1.Globe.Layers.GetLayerByCaption(lineType);
- if (layerRed != null && layerRed.GetAllFeatures().Length > 0)
- {
- feature = layerRed.GetAt(layerRed.GetAllFeatures().Length - 1);
- if (feature != null)
- {
- feature.Name = lineName;
- GSOSimpleLineStyle3D style = new GSOSimpleLineStyle3D();
- style.LineColor = Color.Red; //改变绘制的线的颜色
- style.LineWidth = 1; //改变绘制的线的宽度
- feature.Geometry.Style = style;
- //layerRed.Save();
- }
- }
- break;
- case "城市橙线":
- GSOLayer layerOrange = globeControl1.Globe.Layers.GetLayerByCaption(lineType);
- if (layerOrange != null && layerOrange.GetAllFeatures().Length > 0)
- {
- feature = layerOrange.GetAt(layerOrange.GetAllFeatures().Length - 1);
- if (feature != null)
- {
- feature.Name = lineName;
- GSOSimpleLineStyle3D style = new GSOSimpleLineStyle3D();
- style.LineColor = Color.Orange;
- feature.Geometry.Style = style;
- //layerOrange.Save();
- }
- }
- break;
- case "城市黄线":
- GSOLayer layerYellow = globeControl1.Globe.Layers.GetLayerByCaption(lineType);
- if (layerYellow != null && layerYellow.GetAllFeatures().Length > 0)
- {
- feature = layerYellow.GetAt(layerYellow.GetAllFeatures().Length - 1);
- if (feature != null)
- {
- feature.Name = lineName;
- GSOSimpleLineStyle3D style = new GSOSimpleLineStyle3D();
- style.LineColor = Color.Yellow;
- feature.Geometry.Style = style;
- //layerYellow.Save();
- }
- }
- break;
- case "城市绿线":
- GSOLayer layerGreen = globeControl1.Globe.Layers.GetLayerByCaption(lineType);
- if (layerGreen != null && layerGreen.GetAllFeatures().Length > 0)
- {
- feature = layerGreen.GetAt(layerGreen.GetAllFeatures().Length - 1);
- if (feature != null)
- {
- feature.Name = lineName;
- GSOSimpleLineStyle3D style = new GSOSimpleLineStyle3D();
- style.LineColor = Color.Green;
- feature.Geometry.Style = style;
- //layerGreen.Save();
- }
- }
- break;
- case "城市蓝线":
- GSOLayer layerBlue = globeControl1.Globe.Layers.GetLayerByCaption(lineType);
- if (layerBlue != null && layerBlue.GetAllFeatures().Length > 0)
- {
- feature = layerBlue.GetAt(layerBlue.GetAllFeatures().Length - 1);
- if (feature != null)
- {
- feature.Name = lineName;
- GSOSimpleLineStyle3D style = new GSOSimpleLineStyle3D();
- style.LineColor = Color.Blue;
- feature.Geometry.Style = style;
- //layerBlue.Save();
- }
- }
- break;
- case "城市紫线":
- GSOLayer layerPurple = globeControl1.Globe.Layers.GetLayerByCaption(lineType);
- if (layerPurple != null && layerPurple.GetAllFeatures().Length > 0)
- {
- feature = layerPurple.GetAt(layerPurple.GetAllFeatures().Length - 1);
- if (feature != null)
- {
- feature.Name = lineName;
- GSOSimpleLineStyle3D style = new GSOSimpleLineStyle3D();
- style.LineColor = Color.Purple;
- feature.Geometry.Style = style;
- //layerPurple.Save();
- }
- }
- break;
- case "城市黑线":
- GSOLayer layerBlack = globeControl1.Globe.Layers.GetLayerByCaption(lineType);
- if (layerBlack != null && layerBlack.GetAllFeatures().Length > 0)
- {
- feature = layerBlack.GetAt(layerBlack.GetAllFeatures().Length - 1);
- if (feature != null)
- {
- feature.Name = lineName;
- GSOSimpleLineStyle3D style = new GSOSimpleLineStyle3D();
- style.LineColor = Color.Black;
- feature.Geometry.Style = style;
- //layerBlack.Save();
- }
- }
- break;
+ //tunnel.Save();
}
-
- globeControl1.Globe.DestLayerFeatureAdd = null;
}
- m_AddPipeLine = false;
- m_isDrawTunnel = false;
- m_isDrawCitySevenLine = false;
- if (m_isDrawRedPology && globeControl1.Globe.Action == EnumAction3D.DrawPolygon)//红线工具
+ globeControl1.Refresh();
+ }
+ if (m_isDrawCitySevenLine && globeControl1.Globe.Action == EnumAction3D.DrawPolyline)//绘制城市七线
+ {
+ string lineType = citySevenLineType;
+ string lineName = cityServerLineName;
+ GSOFeature feature = null;
+ switch (lineType)
{
- GSOLayer layerDest = globeControl1.Globe.DestLayerFeatureAdd;
- if (layerDest != null)
- {
- GSOFeatures features = layerDest.GetAllFeatures();
- //GSOFeatures features = globeControl1.Globe.MemoryLayer.GetAllFeatures();
- GSOFeature f = features[features.Length - 1];
- if (f != null)
+ case "城市红线":
+ GSOLayer layerRed = globeControl1.Globe.Layers.GetLayerByCaption(lineType);
+ if (layerRed != null && layerRed.GetAllFeatures().Length > 0)
{
- GSOGeoPolygon3D polygon = f.Geometry as GSOGeoPolygon3D;
- if (polygon != null)
+ feature = layerRed.GetAt(layerRed.GetAllFeatures().Length - 1);
+ if (feature != null)
{
- GSOSimplePolygonStyle3D geoStyle3d = new GSOSimplePolygonStyle3D();
- f.Name = (getLabelName(layerDest) + 1).ToString();
- geoStyle3d.FillColor = Color.Red;
- polygon.Style = geoStyle3d;
- GSOLabel label = new GSOLabel();
- label.Text = "此区域正在施工中!";
- label.Style = new GSOLabelStyle();
- label.Style.HasTracktionLine = false;
- polygon.Label = label;
-
- globeControl1.Refresh();
+ feature.Name = lineName;
+ GSOSimpleLineStyle3D style = new GSOSimpleLineStyle3D();
+ style.LineColor = Color.Red; //改变绘制的线的颜色
+ style.LineWidth = 1; //改变绘制的线的宽度
+ feature.Geometry.Style = style;
+ //layerRed.Save();
}
}
+ break;
+ case "城市橙线":
+ GSOLayer layerOrange = globeControl1.Globe.Layers.GetLayerByCaption(lineType);
+ if (layerOrange != null && layerOrange.GetAllFeatures().Length > 0)
+ {
+ feature = layerOrange.GetAt(layerOrange.GetAllFeatures().Length - 1);
+ if (feature != null)
+ {
+ feature.Name = lineName;
+ GSOSimpleLineStyle3D style = new GSOSimpleLineStyle3D();
+ style.LineColor = Color.Orange;
+ feature.Geometry.Style = style;
+ //layerOrange.Save();
+ }
+ }
+ break;
+ case "城市黄线":
+ GSOLayer layerYellow = globeControl1.Globe.Layers.GetLayerByCaption(lineType);
+ if (layerYellow != null && layerYellow.GetAllFeatures().Length > 0)
+ {
+ feature = layerYellow.GetAt(layerYellow.GetAllFeatures().Length - 1);
+ if (feature != null)
+ {
+ feature.Name = lineName;
+ GSOSimpleLineStyle3D style = new GSOSimpleLineStyle3D();
+ style.LineColor = Color.Yellow;
+ feature.Geometry.Style = style;
+ //layerYellow.Save();
+ }
+ }
+ break;
+ case "城市绿线":
+ GSOLayer layerGreen = globeControl1.Globe.Layers.GetLayerByCaption(lineType);
+ if (layerGreen != null && layerGreen.GetAllFeatures().Length > 0)
+ {
+ feature = layerGreen.GetAt(layerGreen.GetAllFeatures().Length - 1);
+ if (feature != null)
+ {
+ feature.Name = lineName;
+ GSOSimpleLineStyle3D style = new GSOSimpleLineStyle3D();
+ style.LineColor = Color.Green;
+ feature.Geometry.Style = style;
+ //layerGreen.Save();
+ }
+ }
+ break;
+ case "城市蓝线":
+ GSOLayer layerBlue = globeControl1.Globe.Layers.GetLayerByCaption(lineType);
+ if (layerBlue != null && layerBlue.GetAllFeatures().Length > 0)
+ {
+ feature = layerBlue.GetAt(layerBlue.GetAllFeatures().Length - 1);
+ if (feature != null)
+ {
+ feature.Name = lineName;
+ GSOSimpleLineStyle3D style = new GSOSimpleLineStyle3D();
+ style.LineColor = Color.Blue;
+ feature.Geometry.Style = style;
+ //layerBlue.Save();
+ }
+ }
+ break;
+ case "城市紫线":
+ GSOLayer layerPurple = globeControl1.Globe.Layers.GetLayerByCaption(lineType);
+ if (layerPurple != null && layerPurple.GetAllFeatures().Length > 0)
+ {
+ feature = layerPurple.GetAt(layerPurple.GetAllFeatures().Length - 1);
+ if (feature != null)
+ {
+ feature.Name = lineName;
+ GSOSimpleLineStyle3D style = new GSOSimpleLineStyle3D();
+ style.LineColor = Color.Purple;
+ feature.Geometry.Style = style;
+ //layerPurple.Save();
+ }
+ }
+ break;
+ case "城市黑线":
+ GSOLayer layerBlack = globeControl1.Globe.Layers.GetLayerByCaption(lineType);
+ if (layerBlack != null && layerBlack.GetAllFeatures().Length > 0)
+ {
+ feature = layerBlack.GetAt(layerBlack.GetAllFeatures().Length - 1);
+ if (feature != null)
+ {
+ feature.Name = lineName;
+ GSOSimpleLineStyle3D style = new GSOSimpleLineStyle3D();
+ style.LineColor = Color.Black;
+ feature.Geometry.Style = style;
+ //layerBlack.Save();
+ }
+ }
+ break;
+ }
+
+ globeControl1.Globe.DestLayerFeatureAdd = null;
+ }
+ m_AddPipeLine = false;
+ m_isDrawTunnel = false;
+ m_isDrawCitySevenLine = false;
+ if (m_isDrawRedPology && globeControl1.Globe.Action == EnumAction3D.DrawPolygon)//红线工具
+ {
+ GSOLayer layerDest = globeControl1.Globe.DestLayerFeatureAdd;
+ if (layerDest != null)
+ {
+ GSOFeatures features = layerDest.GetAllFeatures();
+ //GSOFeatures features = globeControl1.Globe.MemoryLayer.GetAllFeatures();
+ GSOFeature f = features[features.Length - 1];
+ if (f != null)
+ {
+ GSOGeoPolygon3D polygon = f.Geometry as GSOGeoPolygon3D;
+ if (polygon != null)
+ {
+ GSOSimplePolygonStyle3D geoStyle3d = new GSOSimplePolygonStyle3D();
+ f.Name = (getLabelName(layerDest) + 1).ToString();
+ geoStyle3d.FillColor = Color.Red;
+ polygon.Style = geoStyle3d;
+ GSOLabel label = new GSOLabel();
+ label.Text = "此区域正在施工中!";
+ label.Style = new GSOLabelStyle();
+ label.Style.HasTracktionLine = false;
+ polygon.Label = label;
+
+ globeControl1.Refresh();
+ }
}
}
- m_isDrawRedPology = false;
- globeControl1.Globe.Action = EnumAction3D.ActionNull;
-
-
}
+ m_isDrawRedPology = false;
+ globeControl1.Globe.Action = EnumAction3D.ActionNull;
}
///
@@ -2627,7 +2332,7 @@
}
}
///
- /// (完善)
+ /// (完善)#wxl 待整理
///
///
///
@@ -2907,7 +2612,7 @@
}
///
- /// 鼠标点击, 弹出气泡功能globeControl1
+ /// 鼠标点击, 弹出气泡功能globeControl1 wxl待整理
///
///
///
@@ -2916,34 +2621,30 @@
GSOFeature feature = e.Feature;
string str1 = "";
- if (feature != null)
+ if (feature == null) return;
+ if (feature.GetFieldDefn("图片编码") != null)//
{
- if (feature.GetFieldDefn("图片编码") != null)//
+ str1 = GetBubbleInfo(feature, globeControl1);
+ if (RemoteFileExists(Utility.PicRootURL + feature.GetValue("图片编码")))
{
- str1 = GetBubbleInfo(feature, globeControl1);
- if (RemoteFileExists(Utility.PicRootURL + feature.GetValue("图片编码")))
- {
- str1 += "
";
- }
- else if (RemoteFileExists(Utility.PicDefaultURL))
- {
- str1 += "
";
- }
+ str1 += "
";
}
- else if (isFeatureContainsBianhao(feature)) //管线模型图层
+ else if (RemoteFileExists(Utility.PicDefaultURL))
{
- str1 = GetBubbleInfo(feature, globeControl1);
- }
-
- if (str1 != "")
- {
- featureTooltip.HideBalloon();
- balloonEx.HideBalloon();
- balloonEx.SetSize(EnumSizeIndexEx.CONTENT_CX, 480);
- balloonEx.SetSize(EnumSizeIndexEx.CONTENT_CY, 420);
- balloonEx.ShowBalloon((int)e.MousePos.X, (int)e.MousePos.Y, str1);
+ str1 += "
";
}
}
+ else if (isFeatureContainsBianhao(feature)) //管线模型图层
+ {
+ str1 = GetBubbleInfo(feature, globeControl1);
+ }
+
+ if (str1 == "") return;
+ featureTooltip.HideBalloon();
+ balloonEx.HideBalloon();
+ balloonEx.SetSize(EnumSizeIndexEx.CONTENT_CX, 480);
+ balloonEx.SetSize(EnumSizeIndexEx.CONTENT_CY, 420);
+ balloonEx.ShowBalloon((int)e.MousePos.X, (int)e.MousePos.Y, str1);
}
///
@@ -2956,35 +2657,30 @@
GSOFeature feature = e.Feature;
string str1 = "";
- if (feature != null)
+ if (feature == null) return;
+ if (feature.GetFieldDefn("图片编码") != null) //
{
- if (feature.GetFieldDefn("图片编码") != null) //
+ str1 = GetBubbleInfo(feature, globeControl2);
+ if (RemoteFileExists(Utility.PicRootURL + feature.GetValue("图片编码")))
{
- str1 = GetBubbleInfo(feature, globeControl2);
- if (RemoteFileExists(Utility.PicRootURL + feature.GetValue("图片编码")))
- {
- str1 += "
";
- }
- else if (RemoteFileExists(Utility.PicDefaultURL))
- {
- str1 += "
";
- }
+ str1 += "
";
}
- else if (isFeatureContainsBianhao(feature)) //管线模型图层
+ else if (RemoteFileExists(Utility.PicDefaultURL))
{
- str1 = GetBubbleInfo(feature, globeControl2);
- }
-
- if (str1 != "")
- {
-
- featureTooltip2.HideBalloon();
- balloonEx2.HideBalloon();
- balloonEx2.SetSize(EnumSizeIndexEx.CONTENT_CX, 480);
- balloonEx2.SetSize(EnumSizeIndexEx.CONTENT_CY, 420);
- balloonEx2.ShowBalloon((int)e.MousePos.X, (int)e.MousePos.Y, str1);
+ str1 += "
";
}
}
+ else if (isFeatureContainsBianhao(feature)) //管线模型图层
+ {
+ str1 = GetBubbleInfo(feature, globeControl2);
+ }
+
+ if (str1 == "") return;
+ featureTooltip2.HideBalloon();
+ balloonEx2.HideBalloon();
+ balloonEx2.SetSize(EnumSizeIndexEx.CONTENT_CX, 480);
+ balloonEx2.SetSize(EnumSizeIndexEx.CONTENT_CY, 420);
+ balloonEx2.ShowBalloon((int)e.MousePos.X, (int)e.MousePos.Y, str1);
}
///
@@ -3011,15 +2707,13 @@
for (int i = 0; i < Utility.listPipelineType.Count; i++)
{
PipelineType pipelineType = Utility.listPipelineType[i];
- if (pipelineType != null && pipelineType.code.Trim() == pipelinecode.Trim())
+ if (pipelineType == null || pipelineType.code.Trim() != pipelinecode.Trim()) continue;
+ title = pipelineType.type + " " + pipelineType.name;
+ if (pipelineType.type == pipelineType.name)
{
- title = pipelineType.type + " " + pipelineType.name;
- if (pipelineType.type == pipelineType.name)
- {
- title = pipelineType.type;
- }
- break;
+ title = pipelineType.type;
}
+ break;
}
}
}
@@ -3172,8 +2866,8 @@
return str;
}
- string filename = Utility.filename;
- List g1layername = new List();
+ //string filename = Utility.filename;
+ //List g1layername = new List();
///
/// 获取目标图层
@@ -3229,17 +2923,15 @@
for (int n = 0; n < tempChildNode1.Nodes.Count; n++)
{
TreeNode tempChildNode2 = tempChildNode1.Nodes[n];
- if (tempChildNode2.Tag.ToString().Split('|').Length > 1)
+ if (tempChildNode2.Tag.ToString().Split('|').Length <= 1) continue;
+ GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(tempChildNode2.Tag.ToString().Split('|')[1]);
+ if (layer == null)
{
- GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(tempChildNode2.Tag.ToString().Split('|')[1]);
- if (layer == null)
- {
- continue;
- }
- if (tempChildNode2.Tag != null && layer.IsDestLayerFeatureAdd())
- {
- return tempChildNode2;
- }
+ continue;
+ }
+ if (tempChildNode2.Tag != null && layer.IsDestLayerFeatureAdd())
+ {
+ return tempChildNode2;
}
}
}
@@ -3260,35 +2952,33 @@
//日志记录
LogManager.saveLog(Utility.userName, buttonItem87.Text);
- if (!buttonItem87.Checked)
- {
- buttonItem87.Checked = true;
- buttonItem88.Checked = false;
- buttonItem27.Checked = false;
+ if (buttonItem87.Checked) return;
+ buttonItem87.Checked = true;
+ buttonItem88.Checked = false;
+ buttonItem27.Checked = false;
- switch (globeControl1.Globe.CameraMode)
- {
- case EnumCameraMode.UnderGround:
- globeControl1.Globe.CameraMode = EnumCameraMode.Navigation;
- GSOCameraState state = new GSOCameraState();
- state.AltitudeMode = globeControl1.Globe.CameraState.AltitudeMode;
- state.Altitude = globeControl1.Globe.CameraState.Altitude;
- state.Distance = globeControl1.Globe.CameraState.Distance;
- state.Heading = globeControl1.Globe.CameraState.Heading;
- state.Latitude = globeControl1.Globe.CameraState.Latitude;
- state.Longitude = globeControl1.Globe.CameraState.Longitude;
- if (globeControl1.Globe.CameraState.Tilt < 95 && globeControl1.Globe.CameraState.Tilt > 85)
- state.Tilt = 85;
- else
- state.Tilt = 180 - globeControl1.Globe.CameraState.Tilt;
- globeControl1.Globe.JumpToCameraState(state);
- break;
- case EnumCameraMode.Walk:
- globeControl1.Globe.CameraMode = EnumCameraMode.Navigation;
- break;
- }
- globeControl1.Globe.Refresh();
+ switch (globeControl1.Globe.CameraMode)
+ {
+ case EnumCameraMode.UnderGround:
+ globeControl1.Globe.CameraMode = EnumCameraMode.Navigation;
+ GSOCameraState state = new GSOCameraState();
+ state.AltitudeMode = globeControl1.Globe.CameraState.AltitudeMode;
+ state.Altitude = globeControl1.Globe.CameraState.Altitude;
+ state.Distance = globeControl1.Globe.CameraState.Distance;
+ state.Heading = globeControl1.Globe.CameraState.Heading;
+ state.Latitude = globeControl1.Globe.CameraState.Latitude;
+ state.Longitude = globeControl1.Globe.CameraState.Longitude;
+ if (globeControl1.Globe.CameraState.Tilt < 95 && globeControl1.Globe.CameraState.Tilt > 85)
+ state.Tilt = 85;
+ else
+ state.Tilt = 180 - globeControl1.Globe.CameraState.Tilt;
+ globeControl1.Globe.JumpToCameraState(state);
+ break;
+ case EnumCameraMode.Walk:
+ globeControl1.Globe.CameraMode = EnumCameraMode.Navigation;
+ break;
}
+ globeControl1.Globe.Refresh();
}
///
/// 地下模式 菜单按钮
@@ -3300,33 +2990,31 @@
//日志记录
LogManager.saveLog(Utility.userName, buttonItem88.Text);
- if (!buttonItem88.Checked)
- {
- buttonItem88.Checked = true;
- buttonItem27.Checked = false;
- buttonItem87.Checked = false;
+ if (buttonItem88.Checked) return;
+ buttonItem88.Checked = true;
+ buttonItem27.Checked = false;
+ buttonItem87.Checked = false;
- switch (globeControl1.Globe.CameraMode)
- {
- case EnumCameraMode.Navigation:
- case EnumCameraMode.Walk:
- globeControl1.Globe.CameraMode = EnumCameraMode.UnderGround;
- GSOCameraState state = new GSOCameraState();
- state.AltitudeMode = globeControl1.Globe.CameraState.AltitudeMode;
- state.Altitude = globeControl1.Globe.CameraState.Altitude;
- state.Distance = globeControl1.Globe.CameraState.Distance;
- state.Heading = globeControl1.Globe.CameraState.Heading;
- state.Latitude = globeControl1.Globe.CameraState.Latitude;
- state.Longitude = globeControl1.Globe.CameraState.Longitude;
- if (globeControl1.Globe.CameraState.Tilt < 95 && globeControl1.Globe.CameraState.Tilt > 85)
- state.Tilt = 95;
- else
- state.Tilt = 180 - globeControl1.Globe.CameraState.Tilt;
- globeControl1.Globe.JumpToCameraState(state);
- break;
- }
- globeControl1.Globe.Refresh();
+ switch (globeControl1.Globe.CameraMode)
+ {
+ case EnumCameraMode.Navigation:
+ case EnumCameraMode.Walk:
+ globeControl1.Globe.CameraMode = EnumCameraMode.UnderGround;
+ GSOCameraState state = new GSOCameraState();
+ state.AltitudeMode = globeControl1.Globe.CameraState.AltitudeMode;
+ state.Altitude = globeControl1.Globe.CameraState.Altitude;
+ state.Distance = globeControl1.Globe.CameraState.Distance;
+ state.Heading = globeControl1.Globe.CameraState.Heading;
+ state.Latitude = globeControl1.Globe.CameraState.Latitude;
+ state.Longitude = globeControl1.Globe.CameraState.Longitude;
+ if (globeControl1.Globe.CameraState.Tilt < 95 && globeControl1.Globe.CameraState.Tilt > 85)
+ state.Tilt = 95;
+ else
+ state.Tilt = 180 - globeControl1.Globe.CameraState.Tilt;
+ globeControl1.Globe.JumpToCameraState(state);
+ break;
}
+ globeControl1.Globe.Refresh();
}
///
/// 行走模式 菜单按钮
@@ -3338,14 +3026,12 @@
//日志记录
LogManager.saveLog(Utility.userName, buttonItem27.Text);
- if (!buttonItem27.Checked)
- {
- buttonItem27.Checked = true;
- buttonItem87.Checked = false;
- buttonItem88.Checked = false;
+ if (buttonItem27.Checked) return;
+ buttonItem27.Checked = true;
+ buttonItem87.Checked = false;
+ buttonItem88.Checked = false;
- globeControl1.Globe.CameraMode = EnumCameraMode.Walk;
- }
+ globeControl1.Globe.CameraMode = EnumCameraMode.Walk;
}
///
/// 地面透明度设置 菜单
@@ -3357,7 +3043,7 @@
LogManager.saveLog(Utility.userName, sliderGroundTransSet1.Text);
globeControl1.Globe.GroundOpaque = 100 - sliderGroundTransSet1.Value;
- GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(roadLayerName);//("180fd");
+ GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(Utility.roadLayerName);//("180fd");
if (layer != null)
layer.Opaque = 100 - sliderGroundTransSet1.Value;
optiValue = sliderGroundTransSet1.Value;
@@ -3890,24 +3576,22 @@
///
private void comboBoxEx1_SelectedIndexChanged(object sender, EventArgs e)
{
- if (comboBoxEx1.SelectedIndex > -1)
- {
- dataGridViewX2.Rows.Clear();
- dataGridViewX3.Rows.Clear();
- listBox1.Items.Clear();
- GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(comboBoxEx1.SelectedItem.ToString());
- if (layer == null)
- return;
+ if (comboBoxEx1.SelectedIndex <= -1) return;
+ dataGridViewX2.Rows.Clear();
+ dataGridViewX3.Rows.Clear();
+ listBox1.Items.Clear();
+ GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(comboBoxEx1.SelectedItem.ToString());
+ if (layer == null)
+ return;
- GSOFeatureLayer flayer = layer as GSOFeatureLayer;
- GSOFeatureDataset fdataset = flayer.Dataset as GSOFeatureDataset;
- GSOFeatures feats = flayer.GetAllFeatures();
- for (int i = 0; i < feats.Length; i++)
- {
- int idx = dataGridViewX2.Rows.Add();
- dataGridViewX2.Rows[idx].Cells[0].Value = comboBoxEx1.SelectedItem.ToString();
- dataGridViewX2.Rows[idx].Cells[1].Value = feats[i].Name;
- }
+ GSOFeatureLayer flayer = layer as GSOFeatureLayer;
+ GSOFeatureDataset fdataset = flayer.Dataset as GSOFeatureDataset;
+ GSOFeatures feats = flayer.GetAllFeatures();
+ for (int i = 0; i < feats.Length; i++)
+ {
+ int idx = dataGridViewX2.Rows.Add();
+ dataGridViewX2.Rows[idx].Cells[0].Value = comboBoxEx1.SelectedItem.ToString();
+ dataGridViewX2.Rows[idx].Cells[1].Value = feats[i].Name;
}
}
///
@@ -3917,24 +3601,22 @@
///
private void comboBoxEx1_SelectedIndexChanged_shuiping(object sender, EventArgs e)
{
- if (comboBoxEx4.SelectedIndex > -1)
- {
- dataGridViewX8.Rows.Clear();
- dataGridViewX9.Rows.Clear();
- listBox3.Items.Clear();
- GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(comboBoxEx4.SelectedItem.ToString());
- if (layer == null)
- return;
+ if (comboBoxEx4.SelectedIndex <= -1) return;
+ dataGridViewX8.Rows.Clear();
+ dataGridViewX9.Rows.Clear();
+ listBox3.Items.Clear();
+ GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(comboBoxEx4.SelectedItem.ToString());
+ if (layer == null)
+ return;
- GSOFeatureLayer flayer = layer as GSOFeatureLayer;
- GSOFeatureDataset fdataset = flayer.Dataset as GSOFeatureDataset;
- GSOFeatures feats = flayer.GetAllFeatures();
- for (int i = 0; i < feats.Length; i++)
- {
- int idx = dataGridViewX8.Rows.Add();
- dataGridViewX8.Rows[idx].Cells[0].Value = comboBoxEx4.SelectedItem.ToString();
- dataGridViewX8.Rows[idx].Cells[1].Value = feats[i].Name;
- }
+ GSOFeatureLayer flayer = layer as GSOFeatureLayer;
+ GSOFeatureDataset fdataset = flayer.Dataset as GSOFeatureDataset;
+ GSOFeatures feats = flayer.GetAllFeatures();
+ for (int i = 0; i < feats.Length; i++)
+ {
+ int idx = dataGridViewX8.Rows.Add();
+ dataGridViewX8.Rows[idx].Cells[0].Value = comboBoxEx4.SelectedItem.ToString();
+ dataGridViewX8.Rows[idx].Cells[1].Value = feats[i].Name;
}
}
Dictionary featCount = new Dictionary();
@@ -3984,7 +3666,7 @@
if (selectedFeature != null)
{
selectState = 1;
- VerticalDistanceAnalysis("垂直净距分析", selectedFeature, m_PipelineLayerNames, dJingJuBiaoZhun, 0.0);
+ VerticalDistanceAnalysis("垂直净距分析", selectedFeature, Utility.m_PipelineLayerNames, dJingJuBiaoZhun, 0.0);
}
}
}
@@ -4005,16 +3687,16 @@
for (int i = 0; i < feats.Length; i++)
{
selectState = 1;
- VerticalDistanceAnalysis("垂直净距分析", feats[i], m_PipelineLayerNames, dJingJuBiaoZhun, 0.0);
+ VerticalDistanceAnalysis("垂直净距分析", feats[i], Utility.m_PipelineLayerNames, dJingJuBiaoZhun, 0.0);
}
}
if (featCount.Count > 0)
{
- for (int i = 0; i < m_PipelineLayerNames.Count; i++)
+ for (int i = 0; i < Utility.m_PipelineLayerNames.Count; i++)
{
- if (featCount.ContainsKey(m_PipelineLayerNames[i]) && featLenth.ContainsKey(m_PipelineLayerNames[i]))
+ if (featCount.ContainsKey(Utility.m_PipelineLayerNames[i]) && featLenth.ContainsKey(Utility.m_PipelineLayerNames[i]))
{
- listBox1.Items.Add(m_PipelineLayerNames[i] + ":" + featCount[m_PipelineLayerNames[i]] + "条,共" + featLenth[m_PipelineLayerNames[i]].ToString("0.00") + "米");
+ listBox1.Items.Add(Utility.m_PipelineLayerNames[i] + ":" + featCount[Utility.m_PipelineLayerNames[i]] + "条,共" + featLenth[Utility.m_PipelineLayerNames[i]].ToString("0.00") + "米");
}
}
}
@@ -4130,112 +3812,110 @@
continue;
}
GSOLayer layer2 = globeControl1.Globe.Layers.GetLayerByCaption(_pipelineLayerNames[i]);
- if (layer2 != null)
+ if (layer2 == null) continue;
+ GSOFeatureLayer flayer2 = layer2 as GSOFeatureLayer;
+ GSOFeatureDataset fdataset2 = flayer2.Dataset as GSOFeatureDataset;
+ GSOFeatures feats2 = Polygon_Contain_PointAnalysis(polygon, _pipelineLayerNames[i]);
+ for (int j = 0; j < feats2.Length; j++)
{
- GSOFeatureLayer flayer2 = layer2 as GSOFeatureLayer;
- GSOFeatureDataset fdataset2 = flayer2.Dataset as GSOFeatureDataset;
- GSOFeatures feats2 = Polygon_Contain_PointAnalysis(polygon, _pipelineLayerNames[i]);
- for (int j = 0; j < feats2.Length; j++)
- {
- GSOFeature feat2 = feats2[j];
- GSOGeoPolyline3D line2 = feats2[j].Geometry as GSOGeoPolyline3D;
- if (line2 == null) continue;
- GSOPipeLineStyle3D pipeStyle1 = line1.Style as GSOPipeLineStyle3D;
- GSOPipeLineStyle3D pipeStyle2 = line2.Style as GSOPipeLineStyle3D;
- if (pipeStyle1 == null || pipeStyle2 == null) continue;
+ GSOFeature feat2 = feats2[j];
+ GSOGeoPolyline3D line2 = feats2[j].Geometry as GSOGeoPolyline3D;
+ if (line2 == null) continue;
+ GSOPipeLineStyle3D pipeStyle1 = line1.Style as GSOPipeLineStyle3D;
+ GSOPipeLineStyle3D pipeStyle2 = line2.Style as GSOPipeLineStyle3D;
+ if (pipeStyle1 == null || pipeStyle2 == null) continue;
- double dDist = -1;
- dDist = globeControl1.Globe.Analysis3D.ComputeHorizonDistance(line1, line2, out pntIntersect1, out pntIntersect2, out pntProIntersect1, out pntProIntersect2, false);
+ double dDist = -1;
+ dDist = globeControl1.Globe.Analysis3D.ComputeHorizonDistance(line1, line2, out pntIntersect1, out pntIntersect2, out pntProIntersect1, out pntProIntersect2, false);
- if (dDist > -1)
+ if (dDist > -1)
+ {
+ dDist = Math.Abs(pntIntersect1.Z - pntIntersect2.Z) - pipeStyle1.Radius - pipeStyle2.Radius;//获得净距值
+
+ if (dDist < verticalDistance)
{
- dDist = Math.Abs(pntIntersect1.Z - pntIntersect2.Z) - pipeStyle1.Radius - pipeStyle2.Radius;//获得净距值
-
- if (dDist < verticalDistance)
+ int idx = -1;
+ GSOPoint3d markerPosition = new GSOPoint3d();
+ if (type == "垂直净距分析")
{
- int idx = -1;
- GSOPoint3d markerPosition = new GSOPoint3d();
- if (type == "垂直净距分析")
- {
- feat2.HighLight = true;
- markerPosition = LabelVerticalDistance(layerTemp, pntIntersect1, pntIntersect2, dDist, true);
+ feat2.HighLight = true;
+ markerPosition = LabelVerticalDistance(layerTemp, pntIntersect1, pntIntersect2, dDist, true);
- idx = dataGridViewX3.Rows.Add();
- dataGridViewX3.Rows[idx].Cells[0].Value = caption;
- dataGridViewX3.Rows[idx].Cells[1].Value = selectedFeature.Name;
- dataGridViewX3.Rows[idx].Cells[2].Value = layer2.Caption;
- dataGridViewX3.Rows[idx].Cells[3].Value = feat2.Name;
- dataGridViewX3.Rows[idx].Cells[4].Value = dDist.ToString("0.00");
- }
- else if (type == "碰撞分析")
- {
- feat2.HighLight = true;
- markerPosition = LabelVerticalDistance(layerTemp, pntIntersect1, pntIntersect2, dDist, false);
+ idx = dataGridViewX3.Rows.Add();
+ dataGridViewX3.Rows[idx].Cells[0].Value = caption;
+ dataGridViewX3.Rows[idx].Cells[1].Value = selectedFeature.Name;
+ dataGridViewX3.Rows[idx].Cells[2].Value = layer2.Caption;
+ dataGridViewX3.Rows[idx].Cells[3].Value = feat2.Name;
+ dataGridViewX3.Rows[idx].Cells[4].Value = dDist.ToString("0.00");
+ }
+ else if (type == "碰撞分析")
+ {
+ feat2.HighLight = true;
+ markerPosition = LabelVerticalDistance(layerTemp, pntIntersect1, pntIntersect2, dDist, false);
- selectedFeature.HighLight = true;
- idx = dataGridViewX5.Rows.Add();
- dataGridViewX5.Rows[idx].Cells[0].Value = dataGridViewX4.Rows[0].Cells[0].Value.ToString();
- dataGridViewX5.Rows[idx].Cells[1].Value = selectedFeature.Name;
- dataGridViewX5.Rows[idx].Cells[2].Value = layer2.Caption;
- dataGridViewX5.Rows[idx].Cells[3].Value = feat2.Name;
- }
- else if (type == "间距分析")
+ selectedFeature.HighLight = true;
+ idx = dataGridViewX5.Rows.Add();
+ dataGridViewX5.Rows[idx].Cells[0].Value = dataGridViewX4.Rows[0].Cells[0].Value.ToString();
+ dataGridViewX5.Rows[idx].Cells[1].Value = selectedFeature.Name;
+ dataGridViewX5.Rows[idx].Cells[2].Value = layer2.Caption;
+ dataGridViewX5.Rows[idx].Cells[3].Value = feat2.Name;
+ }
+ else if (type == "间距分析")
+ {
+ GSOGeoPolygon3D polygonSpacing = line2.CreateBuffer(horizontalDistance, true, 5, false, false);
+ if (polygonSpacing != null)
{
- GSOGeoPolygon3D polygonSpacing = line2.CreateBuffer(horizontalDistance, true, 5, false, false);
- if (polygonSpacing != null)
+ GSOFeatures horizontalFeatures = layer2.FindFeaturesInPolygon(polygonSpacing, false);
+ if (horizontalFeatures != null)
{
- GSOFeatures horizontalFeatures = layer2.FindFeaturesInPolygon(polygonSpacing, false);
- if (horizontalFeatures != null)
+ for (int m = 0; m < horizontalFeatures.Length; m++)
{
- for (int m = 0; m < horizontalFeatures.Length; m++)
+ GSOFeature horizontalFeature = horizontalFeatures[m];
+ if (horizontalFeature != null && horizontalFeature.ID == feat2.ID)
{
- GSOFeature horizontalFeature = horizontalFeatures[m];
- if (horizontalFeature != null && horizontalFeature.ID == feat2.ID)
- {
- feat2.HighLight = true;
- idx = dataGridViewAnalysisResult.Rows.Add();
- dataGridViewAnalysisResult.Rows[idx].Tag = feat2;
- dataGridViewAnalysisResult.Rows[idx].Cells[0].Value = dataGridViewLineList.Rows[0].Cells[0].Value.ToString();
- dataGridViewAnalysisResult.Rows[idx].Cells[1].Value = selectedFeature.Name;
- dataGridViewAnalysisResult.Rows[idx].Cells[2].Value = layer2.Caption;
- dataGridViewAnalysisResult.Rows[idx].Cells[3].Value = feat2.Name;
- dataGridViewAnalysisResult.Rows[idx].Cells[4].Value = dDist.ToString("0.00");
- dataGridViewAnalysisResult.Rows[idx].Cells[5].Value = horizontalDistance.ToString("0.00");
- break;
- }
+ feat2.HighLight = true;
+ idx = dataGridViewAnalysisResult.Rows.Add();
+ dataGridViewAnalysisResult.Rows[idx].Tag = feat2;
+ dataGridViewAnalysisResult.Rows[idx].Cells[0].Value = dataGridViewLineList.Rows[0].Cells[0].Value.ToString();
+ dataGridViewAnalysisResult.Rows[idx].Cells[1].Value = selectedFeature.Name;
+ dataGridViewAnalysisResult.Rows[idx].Cells[2].Value = layer2.Caption;
+ dataGridViewAnalysisResult.Rows[idx].Cells[3].Value = feat2.Name;
+ dataGridViewAnalysisResult.Rows[idx].Cells[4].Value = dDist.ToString("0.00");
+ dataGridViewAnalysisResult.Rows[idx].Cells[5].Value = horizontalDistance.ToString("0.00");
+ break;
}
}
}
}
+ }
- if (m_FeaturesWithBianhao.ContainsKey(selectedFeature.Name + "-" + feats2[j].Name) == false)
- {
- m_FeaturesWithBianhao.Add(selectedFeature.Name + "-" + feats2[j].Name, markerPosition);//添加飞行位置记录
- }
+ if (m_FeaturesWithBianhao.ContainsKey(selectedFeature.Name + "-" + feats2[j].Name) == false)
+ {
+ m_FeaturesWithBianhao.Add(selectedFeature.Name + "-" + feats2[j].Name, markerPosition);//添加飞行位置记录
+ }
- if (featCount.ContainsKey(layer2.Caption))
- {
- featCount[layer2.Caption] = featCount[layer2.Caption] + 1;
- }
- else
- {
- featCount.Add(layer2.Caption, 1);
- }
- if (featLenth.ContainsKey(layer2.Caption))
- {
- featLenth[layer2.Caption] = featLenth[layer2.Caption] + line2.GetSpaceLength(true, 6378137);
- }
- else
- {
- featLenth.Add(layer2.Caption, line2.GetSpaceLength(true, 6378137));
- }
+ if (featCount.ContainsKey(layer2.Caption))
+ {
+ featCount[layer2.Caption] = featCount[layer2.Caption] + 1;
+ }
+ else
+ {
+ featCount.Add(layer2.Caption, 1);
+ }
+ if (featLenth.ContainsKey(layer2.Caption))
+ {
+ featLenth[layer2.Caption] = featLenth[layer2.Caption] + line2.GetSpaceLength(true, 6378137);
+ }
+ else
+ {
+ featLenth.Add(layer2.Caption, line2.GetSpaceLength(true, 6378137));
}
}
- line2.ReleaseInnerPointer();
- feat2.ReleaseInnerPointer();
}
- feats2.ReleaseInnerPointer();
+ line2.ReleaseInnerPointer();
+ feat2.ReleaseInnerPointer();
}
+ feats2.ReleaseInnerPointer();
}
line1.ReleaseInnerPointer();
selectedFeature.ReleaseInnerPointer();
@@ -4302,7 +3982,7 @@
if (selectedFeature != null)
{
selectState = 1;
- HorizontalDistanceAnalysis(selectedFeature, m_PipelineLayerNames, dJingJuBiaoZhun);
+ HorizontalDistanceAnalysis(selectedFeature, Utility.m_PipelineLayerNames, dJingJuBiaoZhun);
}
}
}
@@ -4317,16 +3997,16 @@
GSOFeatures feats = flayer.GetAllFeatures();
for (int i = 0; i < feats.Length; i++)
{
- HorizontalDistanceAnalysis(feats[i], m_PipelineLayerNames, dJingJuBiaoZhun);
+ HorizontalDistanceAnalysis(feats[i], Utility.m_PipelineLayerNames, dJingJuBiaoZhun);
}
}
if (featCount.Count > 0) //统计结果
{
- for (int i = 0; i < m_PipelineLayerNames.Count; i++)
+ for (int i = 0; i < Utility.m_PipelineLayerNames.Count; i++)
{
- if (featCount.ContainsKey(m_PipelineLayerNames[i]) && featLenth.ContainsKey(m_PipelineLayerNames[i]))
+ if (featCount.ContainsKey(Utility.m_PipelineLayerNames[i]) && featLenth.ContainsKey(Utility.m_PipelineLayerNames[i]))
{
- listBox3.Items.Add(m_PipelineLayerNames[i] + ":" + featCount[m_PipelineLayerNames[i]] + "条,共" + featLenth[m_PipelineLayerNames[i]].ToString("0.00") + "米");
+ listBox3.Items.Add(Utility.m_PipelineLayerNames[i] + ":" + featCount[Utility.m_PipelineLayerNames[i]] + "条,共" + featLenth[Utility.m_PipelineLayerNames[i]].ToString("0.00") + "米");
}
}
}
@@ -4381,51 +4061,49 @@
continue;
}
GSOLayer layer2 = globeControl1.Globe.Layers.GetLayerByCaption(_pipelineLayerNames[i]);
- if (layer2 != null)
+ if (layer2 == null) continue;
+ GSOFeatureLayer flayer2 = layer2 as GSOFeatureLayer;
+ GSOFeatureDataset fdataset2 = flayer2.Dataset as GSOFeatureDataset;
+ GSOFeatures feats2 = Polygon_Contain_PointAnalysis(polygon, _pipelineLayerNames[i]);
+ for (int j = 0; j < feats2.Length; j++)
{
- GSOFeatureLayer flayer2 = layer2 as GSOFeatureLayer;
- GSOFeatureDataset fdataset2 = flayer2.Dataset as GSOFeatureDataset;
- GSOFeatures feats2 = Polygon_Contain_PointAnalysis(polygon, _pipelineLayerNames[i]);
- for (int j = 0; j < feats2.Length; j++)
+ GSOFeature feat2 = feats2[j];
+ GSOGeoPolyline3D line2 = feats2[j].Geometry as GSOGeoPolyline3D;
+ if (line2 == null)
{
- GSOFeature feat2 = feats2[j];
- GSOGeoPolyline3D line2 = feats2[j].Geometry as GSOGeoPolyline3D;
- if (line2 == null)
- {
- continue;
- }
- GSOPipeLineStyle3D pipeStyle1 = line1.Style as GSOPipeLineStyle3D;
- GSOPipeLineStyle3D pipeStyle2 = line2.Style as GSOPipeLineStyle3D;
- if (pipeStyle1 == null || pipeStyle2 == null)
- {
- continue;
- }
+ continue;
+ }
+ GSOPipeLineStyle3D pipeStyle1 = line1.Style as GSOPipeLineStyle3D;
+ GSOPipeLineStyle3D pipeStyle2 = line2.Style as GSOPipeLineStyle3D;
+ if (pipeStyle1 == null || pipeStyle2 == null)
+ {
+ continue;
+ }
- feat2.HighLight = true;
- int idx = dataGridViewX9.Rows.Add();
- dataGridViewX9.Rows[idx].Tag = feat2;
- dataGridViewX9.Rows[idx].Cells[0].Value = caption;
- dataGridViewX9.Rows[idx].Cells[1].Value = selectedFeature.Name;
- dataGridViewX9.Rows[idx].Cells[2].Value = layer2.Caption;
- dataGridViewX9.Rows[idx].Cells[3].Value = feats2[j].Name;
- dataGridViewX9.Rows[idx].Cells[4].Value = dis.ToString("0.00");
+ feat2.HighLight = true;
+ int idx = dataGridViewX9.Rows.Add();
+ dataGridViewX9.Rows[idx].Tag = feat2;
+ dataGridViewX9.Rows[idx].Cells[0].Value = caption;
+ dataGridViewX9.Rows[idx].Cells[1].Value = selectedFeature.Name;
+ dataGridViewX9.Rows[idx].Cells[2].Value = layer2.Caption;
+ dataGridViewX9.Rows[idx].Cells[3].Value = feats2[j].Name;
+ dataGridViewX9.Rows[idx].Cells[4].Value = dis.ToString("0.00");
- if (featCount.ContainsKey(layer2.Caption))
- {
- featCount[layer2.Caption] = featCount[layer2.Caption] + 1;
- }
- else
- {
- featCount.Add(layer2.Caption, 1);
- }
- if (featLenth.ContainsKey(layer2.Caption))
- {
- featLenth[layer2.Caption] = featLenth[layer2.Caption] + line2.GetSpaceLength(true, 6378137);
- }
- else
- {
- featLenth.Add(layer2.Caption, line2.GetSpaceLength(true, 6378137));
- }
+ if (featCount.ContainsKey(layer2.Caption))
+ {
+ featCount[layer2.Caption] = featCount[layer2.Caption] + 1;
+ }
+ else
+ {
+ featCount.Add(layer2.Caption, 1);
+ }
+ if (featLenth.ContainsKey(layer2.Caption))
+ {
+ featLenth[layer2.Caption] = featLenth[layer2.Caption] + line2.GetSpaceLength(true, 6378137);
+ }
+ else
+ {
+ featLenth.Add(layer2.Caption, line2.GetSpaceLength(true, 6378137));
}
}
}
@@ -4437,29 +4115,23 @@
///
private void dataGridViewX9_MouseDoubleClick(object sender, MouseEventArgs e)
{
- if (e.Button == MouseButtons.Left)
+ if (e.Button != MouseButtons.Left) return;
+ DataGridView.HitTestInfo hittestinfo = dataGridViewX9.HitTest(e.X, e.Y);
+ if (hittestinfo.RowIndex <= -1) return;
+ GSOFeature rowFeature = dataGridViewX9.Rows[hittestinfo.RowIndex].Tag as GSOFeature;
+ if (rowFeature == null) return;
+ if (rowFeature.Geometry != null && rowFeature.Geometry.Type == EnumGeometryType.GeoPolyline3D)
{
- DataGridView.HitTestInfo hittestinfo = dataGridViewX9.HitTest(e.X, e.Y);
- if (hittestinfo.RowIndex > -1)
- {
- GSOFeature rowFeature = dataGridViewX9.Rows[hittestinfo.RowIndex].Tag as GSOFeature;
- if (rowFeature != null)
- {
- if (rowFeature.Geometry != null && rowFeature.Geometry.Type == EnumGeometryType.GeoPolyline3D)
- {
- GSOGeoPolyline3D line = rowFeature.Geometry as GSOGeoPolyline3D;
- double length = line.GetSpaceLength(true, 6378137);
- GSOGeoPolyline3D lineLine = line.GetSegment(0, length / 2);
- GSOPoint3d point3d = lineLine[lineLine.PartCount - 1][lineLine[lineLine.PartCount - 1].Count - 1];
+ GSOGeoPolyline3D line = rowFeature.Geometry as GSOGeoPolyline3D;
+ double length = line.GetSpaceLength(true, 6378137);
+ GSOGeoPolyline3D lineLine = line.GetSegment(0, length / 2);
+ GSOPoint3d point3d = lineLine[lineLine.PartCount - 1][lineLine[lineLine.PartCount - 1].Count - 1];
- globeControl1.Globe.JumpToPosition(point3d, EnumAltitudeMode.Absolute, 5);
- }
- else
- {
- globeControl1.Globe.JumpToFeature(rowFeature, 5);
- }
- }
- }
+ globeControl1.Globe.JumpToPosition(point3d, EnumAltitudeMode.Absolute, 5);
+ }
+ else
+ {
+ globeControl1.Globe.JumpToFeature(rowFeature, 5);
}
}
///
@@ -4494,7 +4166,7 @@
if (selectedFeature != null)
{
selectState = 1;
- VerticalDistanceAnalysis("碰撞分析", selectedFeature, m_PipelineLayerNames, 0, 0.0);
+ VerticalDistanceAnalysis("碰撞分析", selectedFeature, Utility.m_PipelineLayerNames, 0, 0.0);
}
}
}
@@ -4510,17 +4182,17 @@
for (int i = 0; i < feats.Length; i++)
{
selectState = 1;
- VerticalDistanceAnalysis("碰撞分析", feats[i], m_PipelineLayerNames, 0, 0.0);
+ VerticalDistanceAnalysis("碰撞分析", feats[i], Utility.m_PipelineLayerNames, 0, 0.0);
}
}
if (featCount.Count > 0)
{
- for (int i = 0; i < m_PipelineLayerNames.Count; i++)
+ for (int i = 0; i < Utility.m_PipelineLayerNames.Count; i++)
{
- if (featCount.ContainsKey(m_PipelineLayerNames[i]) && featLenth.ContainsKey(m_PipelineLayerNames[i]))
+ if (featCount.ContainsKey(Utility.m_PipelineLayerNames[i]) && featLenth.ContainsKey(Utility.m_PipelineLayerNames[i]))
{
- listBox2.Items.Add(m_PipelineLayerNames[i] + ":" + featCount[m_PipelineLayerNames[i]] + "条,共" + featLenth[m_PipelineLayerNames[i]].ToString("0.00") + "米");
+ listBox2.Items.Add(Utility.m_PipelineLayerNames[i] + ":" + featCount[Utility.m_PipelineLayerNames[i]] + "条,共" + featLenth[Utility.m_PipelineLayerNames[i]].ToString("0.00") + "米");
}
}
}
@@ -4543,17 +4215,13 @@
///
private void dataGridViewX5_MouseDoubleClick(object sender, MouseEventArgs e)
{
- if (e.Button == MouseButtons.Left)
+ if (e.Button != MouseButtons.Left) return;
+ DataGridView.HitTestInfo hittestinfo = dataGridViewX5.HitTest(e.X, e.Y);
+ if (hittestinfo.RowIndex <= -1) return;
+ string key = dataGridViewX5.Rows[hittestinfo.RowIndex].Cells[1].Value.ToString().Trim() + "-" + dataGridViewX5.Rows[hittestinfo.RowIndex].Cells[3].Value.ToString().Trim();
+ if (m_FeaturesWithBianhao.ContainsKey(key))
{
- DataGridView.HitTestInfo hittestinfo = dataGridViewX5.HitTest(e.X, e.Y);
- if (hittestinfo.RowIndex > -1)
- {
- string key = dataGridViewX5.Rows[hittestinfo.RowIndex].Cells[1].Value.ToString().Trim() + "-" + dataGridViewX5.Rows[hittestinfo.RowIndex].Cells[3].Value.ToString().Trim();
- if (m_FeaturesWithBianhao.ContainsKey(key))
- {
- globeControl1.Globe.JumpToPosition(m_FeaturesWithBianhao[key], EnumAltitudeMode.Absolute, 5);
- }
- }
+ globeControl1.Globe.JumpToPosition(m_FeaturesWithBianhao[key], EnumAltitudeMode.Absolute, 5);
}
}
///
@@ -4611,25 +4279,23 @@
///
private void comboBoxEx3_SelectedIndexChanged(object sender, EventArgs e)
{
- if (comboBoxEx3.SelectedIndex > -1)
+ if (comboBoxEx3.SelectedIndex <= -1) return;
+ dataGridViewX6.Rows.Clear();
+ dataGridViewX7.Rows.Clear();
+
+ GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(comboBoxEx3.SelectedItem.ToString());
+ if (layer == null)
+ return;
+
+ GSOFeatureLayer flayer = layer as GSOFeatureLayer;
+ GSOFeatureDataset fdataset = flayer.Dataset as GSOFeatureDataset;
+ GSOFeatures feats = flayer.GetAllFeatures();
+
+ for (int i = 0; i < feats.Length; i++)
{
- dataGridViewX6.Rows.Clear();
- dataGridViewX7.Rows.Clear();
-
- GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(comboBoxEx3.SelectedItem.ToString());
- if (layer == null)
- return;
-
- GSOFeatureLayer flayer = layer as GSOFeatureLayer;
- GSOFeatureDataset fdataset = flayer.Dataset as GSOFeatureDataset;
- GSOFeatures feats = flayer.GetAllFeatures();
-
- for (int i = 0; i < feats.Length; i++)
- {
- int idx = dataGridViewX6.Rows.Add();
- dataGridViewX6.Rows[idx].Cells[0].Value = comboBoxEx3.SelectedItem.ToString();
- dataGridViewX6.Rows[idx].Cells[1].Value = feats[i].Name;
- }
+ int idx = dataGridViewX6.Rows.Add();
+ dataGridViewX6.Rows[idx].Cells[0].Value = comboBoxEx3.SelectedItem.ToString();
+ dataGridViewX6.Rows[idx].Cells[1].Value = feats[i].Name;
}
}
///
@@ -4670,51 +4336,47 @@
for (int i = 0; i < dataGridViewX6.Rows.Count; i++)
{
GSOFeature rowFeature = dataGridViewX6.Rows[i].Tag as GSOFeature;
- if (rowFeature != null)
+ if (rowFeature == null) continue;
+ string featureName = "";
+ if (isFeatureContainsBianhao(rowFeature))//判断rowFeature是否包含“编号”字段
{
- string featureName = "";
- if (isFeatureContainsBianhao(rowFeature))//判断rowFeature是否包含“编号”字段
- {
- featureName = rowFeature.GetValue(featureIDFieldName).ToString();
- }
- else
- {
- featureName = rowFeature.Name;
- }
+ featureName = rowFeature.GetValue(featureIDFieldName).ToString();
+ }
+ else
+ {
+ featureName = rowFeature.Name;
+ }
- GSOGeoPolyline3D line = rowFeature.Geometry as GSOGeoPolyline3D;
- if (line == null)
- {
- continue;
- }
- GSOPipeLineStyle3D style = line.Style as GSOPipeLineStyle3D;
- if (style == null)
- {
- continue;
- }
- if (line.PartCount > 0)
- {
- GSOPoint3ds pts = line[0];
- GSOPoint3d pt = new GSOPoint3d();
+ GSOGeoPolyline3D line = rowFeature.Geometry as GSOGeoPolyline3D;
+ if (line == null)
+ {
+ continue;
+ }
+ GSOPipeLineStyle3D style = line.Style as GSOPipeLineStyle3D;
+ if (style == null)
+ {
+ continue;
+ }
+ if (line.PartCount <= 0) continue;
+ GSOPoint3ds pts = line[0];
+ GSOPoint3d pt = new GSOPoint3d();
- for (int m = 0; m < pts.Count; m++)
- {
- if (Math.Abs(pts[m].Z + (style.Radius)) < Convert.ToDouble(textBoxX3.Text.Trim()))
- {
- rowFeature.HighLight = true;
- int idx = dataGridViewX7.Rows.Add();
- dataGridViewX7.Rows[idx].Tag = rowFeature;
- dataGridViewX7.Rows[idx].Cells[0].Value = rowFeature.Dataset.Caption;
- dataGridViewX7.Rows[idx].Cells[1].Value = featureName;
- dataGridViewX7.Rows[idx].Cells[2].Value = Math.Abs((pts[m].Z + (style.Radius))).ToString("0.00");
+ for (int m = 0; m < pts.Count; m++)
+ {
+ if (Math.Abs(pts[m].Z + (style.Radius)) < Convert.ToDouble(textBoxX3.Text.Trim()))
+ {
+ rowFeature.HighLight = true;
+ int idx = dataGridViewX7.Rows.Add();
+ dataGridViewX7.Rows[idx].Tag = rowFeature;
+ dataGridViewX7.Rows[idx].Cells[0].Value = rowFeature.Dataset.Caption;
+ dataGridViewX7.Rows[idx].Cells[1].Value = featureName;
+ dataGridViewX7.Rows[idx].Cells[2].Value = Math.Abs((pts[m].Z + (style.Radius))).ToString("0.00");
- pt.X = pts[m].X;
- pt.Y = pts[m].Y;
- pt.Z = 0;
- markerPosition = LabelVerticalDistance(layerTemp, pts[m], pt, Convert.ToDouble(dataGridViewX7.Rows[idx].Cells[2].Value), true);
- break;
- }
- }
+ pt.X = pts[m].X;
+ pt.Y = pts[m].Y;
+ pt.Z = 0;
+ markerPosition = LabelVerticalDistance(layerTemp, pts[m], pt, Convert.ToDouble(dataGridViewX7.Rows[idx].Cells[2].Value), true);
+ break;
}
}
}
@@ -4743,29 +4405,26 @@
GSOGeoPolyline3D line = f.Geometry as GSOGeoPolyline3D;
if (line == null) continue;
GSOPipeLineStyle3D style = line.Style as GSOPipeLineStyle3D;
- if (style == null) continue;
- if (line.PartCount > 0)
+ if (style == null || line.PartCount <= 0) continue;
+ GSOPoint3ds pts = line[0];
+ GSOPoint3d pt = new GSOPoint3d();
+ for (int m = 0; m < pts.Count; m++)
{
- GSOPoint3ds pts = line[0];
- GSOPoint3d pt = new GSOPoint3d();
- for (int m = 0; m < pts.Count; m++)
+ if (Math.Abs(pts[m].Z + (style.Radius)) < Convert.ToDouble(textBoxX3.Text.Trim()))
{
- if (Math.Abs(pts[m].Z + (style.Radius)) < Convert.ToDouble(textBoxX3.Text.Trim()))
- {
- f.HighLight = true;
- int idx = dataGridViewX7.Rows.Add();
- dataGridViewX7.Rows[idx].Tag = f;
- dataGridViewX7.Rows[idx].Cells[0].Value = layer.Caption;
- dataGridViewX7.Rows[idx].Cells[1].Value = featureName;
- dataGridViewX7.Rows[idx].Cells[2].Value = Math.Abs((pts[m].Z + (style.Radius))).ToString("0.00");
+ f.HighLight = true;
+ int idx = dataGridViewX7.Rows.Add();
+ dataGridViewX7.Rows[idx].Tag = f;
+ dataGridViewX7.Rows[idx].Cells[0].Value = layer.Caption;
+ dataGridViewX7.Rows[idx].Cells[1].Value = featureName;
+ dataGridViewX7.Rows[idx].Cells[2].Value = Math.Abs((pts[m].Z + (style.Radius))).ToString("0.00");
- pt.X = pts[m].X;
- pt.Y = pts[m].Y;
- pt.Z = 0;
- markerPosition = LabelVerticalDistance(layerTemp, pts[m], pt, Convert.ToDouble(dataGridViewX7.Rows[idx].Cells[2].Value), true);
+ pt.X = pts[m].X;
+ pt.Y = pts[m].Y;
+ pt.Z = 0;
+ markerPosition = LabelVerticalDistance(layerTemp, pts[m], pt, Convert.ToDouble(dataGridViewX7.Rows[idx].Cells[2].Value), true);
- break;
- }
+ break;
}
}
}
@@ -4789,29 +4448,23 @@
///
private void dataGridViewX7_MouseDoubleClick(object sender, MouseEventArgs e)
{
- if (e.Button == MouseButtons.Left)
+ if (e.Button != MouseButtons.Left) return;
+ DataGridView.HitTestInfo hittestinfo = dataGridViewX7.HitTest(e.X, e.Y);
+ if (hittestinfo.RowIndex <= -1) return;
+ GSOFeature rowFeature = dataGridViewX7.Rows[hittestinfo.RowIndex].Tag as GSOFeature;
+ if (rowFeature == null) return;
+ if (rowFeature.Geometry != null && rowFeature.Geometry.Type == EnumGeometryType.GeoPolyline3D)
{
- DataGridView.HitTestInfo hittestinfo = dataGridViewX7.HitTest(e.X, e.Y);
- if (hittestinfo.RowIndex > -1)
- {
- GSOFeature rowFeature = dataGridViewX7.Rows[hittestinfo.RowIndex].Tag as GSOFeature;
- if (rowFeature != null)
- {
- if (rowFeature.Geometry != null && rowFeature.Geometry.Type == EnumGeometryType.GeoPolyline3D)
- {
- GSOGeoPolyline3D line = rowFeature.Geometry as GSOGeoPolyline3D;
- double length = line.GetSpaceLength(true, 6378137);
- GSOGeoPolyline3D lineLine = line.GetSegment(0, length / 2);
- GSOPoint3d point3d = lineLine[lineLine.PartCount - 1][lineLine[lineLine.PartCount - 1].Count - 1];
+ GSOGeoPolyline3D line = rowFeature.Geometry as GSOGeoPolyline3D;
+ double length = line.GetSpaceLength(true, 6378137);
+ GSOGeoPolyline3D lineLine = line.GetSegment(0, length / 2);
+ GSOPoint3d point3d = lineLine[lineLine.PartCount - 1][lineLine[lineLine.PartCount - 1].Count - 1];
- globeControl1.Globe.JumpToPosition(point3d, EnumAltitudeMode.Absolute, 5);
- }
- else
- {
- globeControl1.Globe.JumpToFeature(rowFeature, 5);
- }
- }
- }
+ globeControl1.Globe.JumpToPosition(point3d, EnumAltitudeMode.Absolute, 5);
+ }
+ else
+ {
+ globeControl1.Globe.JumpToFeature(rowFeature, 5);
}
}
///
@@ -4972,85 +4625,83 @@
///
private void ExportExcel(string type, DataGridView _dataGridView, ListBox _listBox)
{
- if (_dataGridView.Rows.Count > 0)
+ if (_dataGridView.Rows.Count <= 0) return;
+ SaveFileDialog dlg = new SaveFileDialog();
+ dlg.Filter = "Excel files (*.xls)|*.xls";
+ dlg.FilterIndex = 0;
+ dlg.RestoreDirectory = true;
+ //dlg.CreatePrompt = true;
+ dlg.Title = "保存为Excel文件";
+ dlg.FileName = type + "-" + DateTime.Now.ToString("yyyyMMdd") + ".xls";
+ if (dlg.ShowDialog() == DialogResult.OK)
{
- SaveFileDialog dlg = new SaveFileDialog();
- dlg.Filter = "Excel files (*.xls)|*.xls";
- dlg.FilterIndex = 0;
- dlg.RestoreDirectory = true;
- //dlg.CreatePrompt = true;
- dlg.Title = "保存为Excel文件";
- dlg.FileName = type + "-" + DateTime.Now.ToString("yyyyMMdd") + ".xls";
- if (dlg.ShowDialog() == DialogResult.OK)
+ Stream myStream;
+ myStream = dlg.OpenFile();
+ StreamWriter sw = new StreamWriter(myStream, Encoding.GetEncoding(-0));
+ string columnTitle = "";
+ try
{
- Stream myStream;
- myStream = dlg.OpenFile();
- StreamWriter sw = new StreamWriter(myStream, Encoding.GetEncoding(-0));
- string columnTitle = "";
- try
+ if (_listBox != null)
{
- if (_listBox != null)
+ string strList = "";
+ for (int i = 0; i < _listBox.Items.Count; i++)
{
- string strList = "";
- for (int i = 0; i < _listBox.Items.Count; i++)
- {
- strList += _listBox.Items[i] + @"/";
- }
- sw.WriteLine("内容:" + type + " 日期:" + DateTime.Now.ToString("yyyy-MM-dd") + " 结果:" + strList);
+ strList += _listBox.Items[i] + @"/";
}
- else
+ sw.WriteLine("内容:" + type + " 日期:" + DateTime.Now.ToString("yyyy-MM-dd") + " 结果:" + strList);
+ }
+ else
+ {
+ sw.WriteLine("内容:" + type + " 日期:" + DateTime.Now.ToString("yyyy-MM-dd"));
+ }
+ //写入列标题
+ for (int i = 0; i < _dataGridView.ColumnCount; i++)
+ {
+ if (i > 0)
{
- sw.WriteLine("内容:" + type + " 日期:" + DateTime.Now.ToString("yyyy-MM-dd"));
+ columnTitle += "\t";
}
- //写入列标题
- for (int i = 0; i < _dataGridView.ColumnCount; i++)
- {
- if (i > 0)
- {
- columnTitle += "\t";
- }
- columnTitle += _dataGridView.Columns[i].HeaderText;
- }
- sw.WriteLine(columnTitle);
+ columnTitle += _dataGridView.Columns[i].HeaderText;
+ }
+ sw.WriteLine(columnTitle);
- //写入列内容
- for (int j = 0; j < _dataGridView.Rows.Count; j++)
+ //写入列内容
+ for (int j = 0; j < _dataGridView.Rows.Count; j++)
+ {
+ string columnValue = "";
+ for (int k = 0; k < _dataGridView.Columns.Count; k++)
{
- string columnValue = "";
- for (int k = 0; k < _dataGridView.Columns.Count; k++)
+ if (k > 0)
{
- if (k > 0)
- {
- columnValue += "\t";
- }
- if (_dataGridView.Rows[j].Cells[k].Value == null)
- {
- columnValue += "";
- }
- else
- {
- columnValue += _dataGridView.Rows[j].Cells[k].Value.ToString().Trim();
- }
+ columnValue += "\t";
}
+ if (_dataGridView.Rows[j].Cells[k].Value == null)
+ {
+ columnValue += "";
+ }
+ else
+ {
+ columnValue += _dataGridView.Rows[j].Cells[k].Value.ToString().Trim();
+ }
+ }
- sw.WriteLine(columnValue);
- }
- sw.Close();
- myStream.Close();
- if (MessageBox.Show("导出Excel文件成功!是否打开?", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
- {
- Process.Start(dlg.FileName);
- }
+ sw.WriteLine(columnValue);
}
- catch (Exception ex)
+ sw.Close();
+ myStream.Close();
+ if (MessageBox.Show("导出Excel文件成功!是否打开?", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
{
- //MessageBox.Show(ex.ToString());
+ Process.Start(dlg.FileName);
}
- finally
- {
- sw.Close();
- myStream.Close();
- }
+ }
+ catch (Exception ex)
+ {
+ //MessageBox.Show(ex.ToString());
+ }
+ finally
+ {
+ sw.Close();
+ myStream.Close();
}
}
}
@@ -5141,24 +4792,22 @@
///
private void comboBoxEx2_SelectedIndexChanged(object sender, EventArgs e)
{
- if (comboBoxEx2.SelectedIndex > -1)
- {
- listBox2.Items.Clear();
- dataGridViewX4.Rows.Clear();
- dataGridViewX5.Rows.Clear();
- GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(comboBoxEx2.SelectedItem.ToString());
- if (layer == null)
- return;
+ if (comboBoxEx2.SelectedIndex <= -1) return;
+ listBox2.Items.Clear();
+ dataGridViewX4.Rows.Clear();
+ dataGridViewX5.Rows.Clear();
+ GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(comboBoxEx2.SelectedItem.ToString());
+ if (layer == null)
+ return;
- GSOFeatureLayer flayer = layer as GSOFeatureLayer;
- GSOFeatureDataset fdataset = flayer.Dataset as GSOFeatureDataset;
- GSOFeatures feats = flayer.GetAllFeatures();
- for (int i = 0; i < feats.Length; i++)
- {
- int idx = dataGridViewX4.Rows.Add();
- dataGridViewX4.Rows[idx].Cells[0].Value = comboBoxEx2.SelectedItem.ToString();
- dataGridViewX4.Rows[idx].Cells[1].Value = feats[i].Name;
- }
+ GSOFeatureLayer flayer = layer as GSOFeatureLayer;
+ GSOFeatureDataset fdataset = flayer.Dataset as GSOFeatureDataset;
+ GSOFeatures feats = flayer.GetAllFeatures();
+ for (int i = 0; i < feats.Length; i++)
+ {
+ int idx = dataGridViewX4.Rows.Add();
+ dataGridViewX4.Rows[idx].Cells[0].Value = comboBoxEx2.SelectedItem.ToString();
+ dataGridViewX4.Rows[idx].Cells[1].Value = feats[i].Name;
}
}
///
@@ -5343,7 +4992,7 @@
if (selectedFeature != null)
{
selectState = 1;
- VerticalDistanceAnalysis("间距分析", selectedFeature, m_PipelineLayerNames, dVerticalJingJuBiaoZhun, dHorizontalJingJuBiaoZhun);//分析
+ VerticalDistanceAnalysis("间距分析", selectedFeature, Utility.m_PipelineLayerNames, dVerticalJingJuBiaoZhun, dHorizontalJingJuBiaoZhun);//分析
}
}
}
@@ -5374,16 +5023,16 @@
for (int i = 0; i < feats.Length; i++)
{
selectState = 1;
- VerticalDistanceAnalysis("间距分析", feats[i], m_PipelineLayerNames, dVerticalJingJuBiaoZhun, dHorizontalJingJuBiaoZhun);//分析
+ VerticalDistanceAnalysis("间距分析", feats[i], Utility.m_PipelineLayerNames, dVerticalJingJuBiaoZhun, dHorizontalJingJuBiaoZhun);//分析
}
}
if (featCount.Count > 0)
{
- for (int i = 0; i < m_PipelineLayerNames.Count; i++)
+ for (int i = 0; i < Utility.m_PipelineLayerNames.Count; i++)
{
- if (featCount.ContainsKey(m_PipelineLayerNames[i]) && featLenth.ContainsKey(m_PipelineLayerNames[i]))
+ if (featCount.ContainsKey(Utility.m_PipelineLayerNames[i]) && featLenth.ContainsKey(Utility.m_PipelineLayerNames[i]))
{
- listBoxStasticsResult.Items.Add(m_PipelineLayerNames[i] + ":" + featCount[m_PipelineLayerNames[i]] + "条,共" + featLenth[m_PipelineLayerNames[i]].ToString("0.00") + "米");
+ listBoxStasticsResult.Items.Add(Utility.m_PipelineLayerNames[i] + ":" + featCount[Utility.m_PipelineLayerNames[i]] + "条,共" + featLenth[Utility.m_PipelineLayerNames[i]].ToString("0.00") + "米");
}
}
}
@@ -5948,24 +5597,20 @@
///
private void addNodeToLayerManagerNode(GSOLayer layer)
{
- if (layer != null)
- {
- GSODataset dataset = layer.Dataset;
- CheckDatasetGeoReference(layer.Dataset, "");
+ if (layer == null) return;
+ GSODataset dataset = layer.Dataset;
+ CheckDatasetGeoReference(layer.Dataset, "");
- TreeNode node = new TreeNode();
- node.Tag = layer;
- node.Text = layer.Dataset.Caption;
- node.ImageIndex = 0;
- node.SelectedImageIndex = 0;
- node.Checked = layer.Visible;
+ TreeNode node = new TreeNode();
+ node.Tag = layer;
+ node.Text = layer.Dataset.Caption;
+ node.ImageIndex = 0;
+ node.SelectedImageIndex = 0;
+ node.Checked = layer.Visible;
- if (!layerManagerNode.Nodes.Contains(node))
- {
- layerManagerNode.Nodes.Insert(0, node);
- layerManagerNode.Expand();
- }
- }
+ if (layerManagerNode.Nodes.Contains(node)) return;
+ layerManagerNode.Nodes.Insert(0, node);
+ layerManagerNode.Expand();
}
///
/// 获取指定图层中最后一个feature对象的名称对应的整数
@@ -6008,31 +5653,29 @@
for (int i = 0; i < markerStrs.Length; i++)
{
GSOLayer markerLayer = globeControl1.Globe.Layers.GetLayerByCaption(markerStrs[i]);
- if (markerLayer != null)
+ if (markerLayer == null) continue;
+ if (markerStrs[i] != layerName)
{
- if (markerStrs[i] != layerName)
+ markerLayer.Visible = false;
+ if (layerMarkerTree.Nodes[0].Nodes.Count > i)
{
- markerLayer.Visible = false;
- if (layerMarkerTree.Nodes[0].Nodes.Count > i)
+ layerMarkerTree.Nodes[0].Nodes[i].Checked = false;
+ }
+ }
+ else
+ {
+ markerLayer.Visible = true;
+ for (int j = 0; j < markerLayer.GetAllFeatures().Length; j++)
+ {
+ GSOFeature markerFeature = markerLayer.GetAt(j);
+ if (markerFeature != null)
{
- layerMarkerTree.Nodes[0].Nodes[i].Checked = false;
+ markerFeature.Visible = false;
}
}
- else
+ if (layerMarkerTree.Nodes[0].Nodes.Count > i)
{
- markerLayer.Visible = true;
- for (int j = 0; j < markerLayer.GetAllFeatures().Length; j++)
- {
- GSOFeature markerFeature = markerLayer.GetAt(j);
- if (markerFeature != null)
- {
- markerFeature.Visible = false;
- }
- }
- if (layerMarkerTree.Nodes[0].Nodes.Count > i)
- {
- layerMarkerTree.Nodes[0].Nodes[i].Checked = true;
- }
+ layerMarkerTree.Nodes[0].Nodes[i].Checked = true;
}
}
}
@@ -6138,15 +5781,12 @@
private void toolStripMenuItem2_Click(object sender, EventArgs e)
{
TreeNode node = contextMenuStrip3.Tag as TreeNode;
+ if (node == null) return;
GSOFeature feature3d = node.Tag as GSOFeature;
- if (node == null)
- return;
- if (feature3d != null)
- {
- feature3d.Delete();
- globeControl1.Globe.Refresh();
- node.Remove();
- }
+ if (feature3d == null) return;
+ feature3d.Delete();
+ globeControl1.Globe.Refresh();
+ node.Remove();
}
///
/// 图层目录树的 节点对应的复选框选中状态改变事件处理
@@ -6213,12 +5853,10 @@
{
TreeNode node = contextMenuStrip2.Tag as TreeNode;
GSOLayer l = globeControl1.Globe.Layers.GetLayerByCaption(node.Text);
- if (l != null)
- {
- l.RemoveAllFeature();
- node.Nodes.Clear();
- globeControl1.Refresh();
- }
+ if (l == null) return;
+ l.RemoveAllFeature();
+ node.Nodes.Clear();
+ globeControl1.Refresh();
}
//定时检查传感器的状态
public Timer timerOfSensor = null;
@@ -6375,7 +6013,7 @@
}
frmShResult = new FrmShResult(dVerticalJingJuBiaoZhun, dHorizontalJingJuBiaoZhun, shlayername, globeControl1,
- m_PipelineLayerNames);
+ Utility.m_PipelineLayerNames);
if (boolfrmShResult) return;
@@ -6482,13 +6120,11 @@
frmModify = new FrmMnModify(globeControl1, shlayername, shresultLists);
- if (boolfrmModify == false)
- {
- frmModify.Owner = this;
- frmModify.Location = new Point(Width - frmModify.Width - 10, Height - frmModify.Height - 50);
- frmModify.Show();
- boolfrmModify = true;
- }
+ if (boolfrmModify != false) return;
+ frmModify.Owner = this;
+ frmModify.Location = new Point(Width - frmModify.Width - 10, Height - frmModify.Height - 50);
+ frmModify.Show();
+ boolfrmModify = true;
}
///
/// 一键审核中调节透明度
@@ -6500,7 +6136,7 @@
LogManager.saveLog(Utility.userName, sliderItem1.Text);
globeControl1.Globe.GroundOpaque = 100 - sliderItem1.Value;
- GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(roadLayerName); //("180fd");
+ GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(Utility.roadLayerName); //("180fd");
if (layer != null)
layer.Opaque = 100 - sliderItem1.Value;
@@ -6516,7 +6152,7 @@
LogManager.saveLog(Utility.userName, sliderItem3.Text);
globeControl1.Globe.GroundOpaque = 100 - sliderItem3.Value;
- GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(roadLayerName); //("180fd");
+ GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(Utility.roadLayerName); //("180fd");
if (layer != null)
layer.Opaque = 100 - sliderItem3.Value;
optiValue = sliderItem3.Value;
@@ -6647,7 +6283,7 @@
{
LogManager.saveLog(Utility.userName, buttonItemSearch9.Text);
- FrmKeywordQuery.ShowForm(globeControl1, m_PipelineLayerNames, InitDataGridViewX1);
+ FrmKeywordQuery.ShowForm(globeControl1, Utility.m_PipelineLayerNames, InitDataGridViewX1);
}
///
/// 编号查询
@@ -6658,7 +6294,7 @@
{
LogManager.saveLog(Utility.userName, buttonItemSearch2.Text);
- FrmCodingQuery.ShowForm(globeControl1, m_PipelineLayerNames, InitDataGridViewX1);
+ FrmCodingQuery.ShowForm(globeControl1, Utility.m_PipelineLayerNames, InitDataGridViewX1);
}
///
/// 坐标查询
@@ -6680,7 +6316,7 @@
{
LogManager.saveLog(Utility.userName, buttonItemSearch10.Text);
- FrmFittingQuery.ShowForm(globeControl1, instrumenLayerNames, InitDataGridViewX1);
+ FrmFittingQuery.ShowForm(globeControl1, Utility.instrumenLayerNames, InitDataGridViewX1);
}
///
/// 管径查询
@@ -6691,7 +6327,7 @@
{
LogManager.saveLog(Utility.userName, buttonItemSearch4.Text);
- FrmDiameterQuery.ShowForm(globeControl1, m_PipelineLayerNames, InitDataGridViewX1);
+ FrmDiameterQuery.ShowForm(globeControl1, Utility.m_PipelineLayerNames, InitDataGridViewX1);
}
///
/// 材质查询
@@ -6702,7 +6338,7 @@
{
LogManager.saveLog(Utility.userName, buttonItemSearch5.Text);
- FrmMaterialSel.ShowForm(globeControl1, m_PipelineLayerNames, InitDataGridViewX1);
+ FrmMaterialSel.ShowForm(globeControl1, Utility.m_PipelineLayerNames, InitDataGridViewX1);
}
///
/// 基本查询
@@ -6751,8 +6387,8 @@
if (feature == null && feature.Geometry == null || (feature.Geometry.Type == EnumGeometryType.GeoPolygon3D
|| feature.Geometry.Type == EnumGeometryType.GeoWater))
return;
- ClassSearchAnalysis.ResultRelationAnalysis(globeControl1, feature, valueLayerNames, workwellLayerNames,
- instrumenLayerNames, pipefittingLayerNames, m_PipelineLayerNames, valueAllowance);
+ ClassSearchAnalysis.ResultRelationAnalysis(globeControl1, feature, Utility.valueLayerNames, Utility.workwellLayerNames,
+ Utility.instrumenLayerNames, Utility.pipefittingLayerNames, Utility.m_PipelineLayerNames, valueAllowance);
}
}
#endregion
@@ -6789,20 +6425,20 @@
// ClearCloseValvesAnalysis();//清除阀门分析
//清除管线间距分析
- if (disFeature != null)
- {
- if (disFeature.ID != 0)
- {
- globeControl1.Globe.MemoryLayer.RemoveFeatureByID(disFeature.ID);
- }
- }
- if (featureDis != null)
- {
- if (featureDis.ID != 0)
- {
- globeControl1.Globe.MemoryLayer.RemoveFeatureByID(featureDis.ID);
- }
- }
+ //if (disFeature != null)
+ //{
+ // if (disFeature.ID != 0)
+ // {
+ // globeControl1.Globe.MemoryLayer.RemoveFeatureByID(disFeature.ID);
+ // }
+ //}
+ //if (featureDis != null)
+ //{
+ // if (featureDis.ID != 0)
+ // {
+ // globeControl1.Globe.MemoryLayer.RemoveFeatureByID(featureDis.ID);
+ // }
+ //}
GSOFeatures feats = globeControl1.Globe.MemoryLayer.GetFeatureByName("粒子要素", true);
if (feats.Length > 0)
@@ -6838,7 +6474,7 @@
clearFeatureHighLight();//取消管线高亮
- GSOLayer layerGround = globeControl1.Globe.Layers.GetLayerByCaption(roadLayerName);//("180fd");
+ GSOLayer layerGround = globeControl1.Globe.Layers.GetLayerByCaption(Utility.roadLayerName);//("180fd");
if (layerGround != null)
{
layerGround.Visible = true;
@@ -6856,7 +6492,7 @@
private void buttonItemTJ1_ALL_Click(object sender, EventArgs e)
{
LogManager.saveLog(Utility.userName, "管线长度统计");
- FrmAllPipelineStatis frm = new FrmAllPipelineStatis(globeControl1, null, InitDataGridViewX1, m_PipelineLayerNames);
+ FrmAllPipelineStatis frm = new FrmAllPipelineStatis(globeControl1, null, InitDataGridViewX1, Utility.m_PipelineLayerNames);
frm.Show(this);
}
///
@@ -6930,7 +6566,7 @@
{
LogManager.saveLog(Utility.userName, "管径分段统计");
- Frmpipediameterstatis.ShowForm(globeControl1, m_PipelineLayerNames, 0);
+ Frmpipediameterstatis.ShowForm(globeControl1, Utility.m_PipelineLayerNames, 0);
}
///
/// 管径分段统计绘制区域统计
@@ -6942,7 +6578,7 @@
LogManager.saveLog(Utility.userName, "管径分段统计");
trackflag = null;
- Frmpipediameterstatis.ShowForm(globeControl1, m_PipelineLayerNames, 1);
+ Frmpipediameterstatis.ShowForm(globeControl1, Utility.m_PipelineLayerNames, 1);
}
///
/// 埋深分段统计全区域统计
@@ -6952,7 +6588,7 @@
private void buttonItemTJ5_ALL_Click(object sender, EventArgs e)
{
LogManager.saveLog(Utility.userName, "埋深分段统计");
- FrmpipeDeepstatis.ShowForm(globeControl1, m_PipelineLayerNames, 0);
+ FrmpipeDeepstatis.ShowForm(globeControl1, Utility.m_PipelineLayerNames, 0);
}
///
/// 埋深分段统计绘制区域统计
@@ -6963,7 +6599,7 @@
{
LogManager.saveLog(Utility.userName, "埋深分段统计");
trackflag = null;
- FrmpipeDeepstatis.ShowForm(globeControl1, m_PipelineLayerNames, 1);
+ FrmpipeDeepstatis.ShowForm(globeControl1, Utility.m_PipelineLayerNames, 1);
}
///
/// 管径分类统计全区域统计
@@ -6974,7 +6610,7 @@
{
LogManager.saveLog(Utility.userName, "管径分类汇总");
- FrmpipeDiametergather.ShowForm(globeControl1, m_PipelineLayerNames, 0);
+ FrmpipeDiametergather.ShowForm(globeControl1, Utility.m_PipelineLayerNames, 0);
}
///
/// 管径分类统计绘制区域统计
@@ -6986,7 +6622,7 @@
LogManager.saveLog(Utility.userName, "管径分类汇总");
trackflag = null;
- FrmpipeDiametergather.ShowForm(globeControl1, m_PipelineLayerNames, 1);
+ FrmpipeDiametergather.ShowForm(globeControl1, Utility.m_PipelineLayerNames, 1);
}
///
/// 材质分类统计全区域统计
@@ -6997,7 +6633,7 @@
{
LogManager.saveLog(Utility.userName, "材质分类汇总");
- FrmpipeMaterialGather.ShowForm(globeControl1, m_PipelineLayerNames, 0);
+ FrmpipeMaterialGather.ShowForm(globeControl1, Utility.m_PipelineLayerNames, 0);
}
///
/// 材质分类统计绘制区域统计
@@ -7009,7 +6645,7 @@
LogManager.saveLog(Utility.userName, "材质分类汇总");
trackflag = null;
- FrmpipeMaterialGather.ShowForm(globeControl1, m_PipelineLayerNames, 1);
+ FrmpipeMaterialGather.ShowForm(globeControl1, Utility.m_PipelineLayerNames, 1);
}
///
/// 附属物分类统计全区域统计
@@ -7020,7 +6656,7 @@
{
LogManager.saveLog(Utility.userName, "附属物分类汇总");
- FrmAccessoriesgather.ShowForm(globeControl1, instrumenLayerNames, 0);
+ FrmAccessoriesgather.ShowForm(globeControl1, Utility.instrumenLayerNames, 0);
}
///
/// 附属物分类统计绘制区域统计
@@ -7032,7 +6668,7 @@
LogManager.saveLog(Utility.userName, "附属物分类汇总");
trackflag = null;
- FrmAccessoriesgather.ShowForm(globeControl1, instrumenLayerNames, 1);
+ FrmAccessoriesgather.ShowForm(globeControl1, Utility.instrumenLayerNames, 1);
}
#region Predaotr,断面分析
///
@@ -7113,7 +6749,7 @@
//日志记录
LogManager.saveLog(Utility.userName, buttonItemFX3_1.Text);
- FrmGenAndFaMenTopu frm = new FrmGenAndFaMenTopu(globeControl1, m_PipelineLayerNames, valueLayerNames);
+ FrmGenAndFaMenTopu frm = new FrmGenAndFaMenTopu(globeControl1, Utility.m_PipelineLayerNames, Utility.valueLayerNames);
frm.Show(this);
}
#region Predator :拓扑分析
@@ -7166,7 +6802,7 @@
//日志记录
LogManager.saveLog(Utility.userName, buttonItemFX3_4.Text);
- FrmFlow frm = new FrmFlow(globeControl1, m_PipelineLayerNames);
+ FrmFlow frm = new FrmFlow(globeControl1, Utility.m_PipelineLayerNames);
frm.Show(this);
}
///
@@ -7369,16 +7005,14 @@
GSOFeature f = null;
GSOLayer layer = null;
globeControl1.Globe.GetSelectObject(i, out f, out layer);
- if (f != null && f.Dataset.Caption == "隧道")
+ if (f == null || f.Dataset.Caption != "隧道") continue;
+ tunnelCount++;
+ f.Delete();
+ if (layer != null)
{
- tunnelCount++;
- f.Delete();
- if (layer != null)
- {
- globeControl1.Globe.AddToEditHistroy(layer, f, EnumEditType.Delete);
- }
- globeControl1.Refresh();
+ globeControl1.Globe.AddToEditHistroy(layer, f, EnumEditType.Delete);
}
+ globeControl1.Refresh();
}
if (tunnelCount == 0)
{
@@ -7620,7 +7254,7 @@
return;
}
GSOGeoPolyline3D selLine = resFeature.Geometry as GSOGeoPolyline3D;
- if (selLine[0].Count <= 1)
+ if (selLine==null||selLine[0].Count <= 1)//wxl增加为空判断,下面方法同理
{
return;
}
@@ -7763,14 +7397,12 @@
LogManager.saveLog(Utility.userName, buttonItemBZ10.Text);
setMarkerLayerUnVisible("红线工具");
GSOLayer l = globeControl1.Globe.Layers.GetLayerByCaption("红线工具");
- if (l != null)
- {
- l.Visible = true;
- globeControl1.Globe.DestLayerFeatureAdd = l;
- l.Editable = true;
- globeControl1.Globe.Action = EnumAction3D.DrawPolygon;
- m_isDrawRedPology = true;
- }
+ if (l == null) return;
+ l.Visible = true;
+ globeControl1.Globe.DestLayerFeatureAdd = l;
+ l.Editable = true;
+ globeControl1.Globe.Action = EnumAction3D.DrawPolygon;
+ m_isDrawRedPology = true;
}
///
/// 标注管理
@@ -8100,7 +7732,7 @@
{
//日志记录
LogManager.saveLog(Utility.userName, buttonItemSH5.Text);
- FrmCityServerLineAnalysis frm = new FrmCityServerLineAnalysis(globeControl1, m_PipelineLayerNames);
+ FrmCityServerLineAnalysis frm = new FrmCityServerLineAnalysis(globeControl1, Utility.m_PipelineLayerNames);
frm.Show(this);
}
@@ -8287,7 +7919,7 @@
//日志记录
LogManager.saveLog(Utility.userName, buttonItemBJ1.Text);
- frmPipeSetEdit frm = new frmPipeSetEdit(globeControl1, m_PipelineLayerNames);
+ frmPipeSetEdit frm = new frmPipeSetEdit(globeControl1, Utility.m_PipelineLayerNames);
if (frm.ShowDialog() == DialogResult.OK)
{
m_AddPipeLine = true;
@@ -8306,7 +7938,7 @@
//日志记录
LogManager.saveLog(Utility.userName, buttonItemBJ2.Text);
- FrmSetGoalLayer frm = new FrmSetGoalLayer(globeControl1, instrumenLayerNames, "附属物");
+ FrmSetGoalLayer frm = new FrmSetGoalLayer(globeControl1, Utility.instrumenLayerNames, "附属物");
if (frm.ShowDialog() == DialogResult.OK)
{
GSOLayer featureAddLayer = TreeNodeFeatureLayer();
@@ -8327,15 +7959,13 @@
//日志记录
LogManager.saveLog(Utility.userName, buttonItemBJ3.Text);
- FrmSetGoalLayer frm = new FrmSetGoalLayer(globeControl1, pipefittingLayerNames, "管点");
+ FrmSetGoalLayer frm = new FrmSetGoalLayer(globeControl1, Utility.pipefittingLayerNames, "管点");
if (frm.ShowDialog() == DialogResult.OK)
{
GSOLayer featureAddLayer = TreeNodeFeatureLayer();
- if (featureAddLayer != null)
- {
- FrmAddPipeFitting dlg = new FrmAddPipeFitting(globeControl1, featureAddLayer);
- dlg.Show(this);
- }
+ if (featureAddLayer == null) return;
+ FrmAddPipeFitting dlg = new FrmAddPipeFitting(globeControl1, featureAddLayer);
+ dlg.Show(this);
}
}
///
@@ -8516,50 +8146,50 @@
#region 导出成dxf格式
List listVectorNames = new List();
- for (int i = 0; i < m_PipelineLayerNames.Count; i++)
+ for (int i = 0; i < Utility.m_PipelineLayerNames.Count; i++)
{
- if (m_PipelineLayerNames[i] == "移动" || m_PipelineLayerNames[i] == "联通"
- || m_PipelineLayerNames[i] == "电信" || m_PipelineLayerNames[i] == "共通"
- || m_PipelineLayerNames[i] == "有线电视" || m_PipelineLayerNames[i] == "交通信号"
- || m_PipelineLayerNames[i] == "供电")
+ if (Utility.m_PipelineLayerNames[i] == "移动" || Utility.m_PipelineLayerNames[i] == "联通"
+ || Utility.m_PipelineLayerNames[i] == "电信" || Utility.m_PipelineLayerNames[i] == "共通"
+ || Utility.m_PipelineLayerNames[i] == "有线电视" || Utility.m_PipelineLayerNames[i] == "交通信号"
+ || Utility.m_PipelineLayerNames[i] == "供电")
{
continue;
}
- if (listVectorNames.Contains(m_PipelineLayerNames[i]) == false)
+ if (!listVectorNames.Contains(Utility.m_PipelineLayerNames[i]))
{
- listVectorNames.Add(m_PipelineLayerNames[i]);
+ listVectorNames.Add(Utility.m_PipelineLayerNames[i]);
}
}
- for (int i = 0; i < valueLayerNames.Count; i++)
+ for (int i = 0; i < Utility.valueLayerNames.Count; i++)
{
- if (listVectorNames.Contains(valueLayerNames[i]) == false)
+ if (!listVectorNames.Contains(Utility.valueLayerNames[i]))
{
- listVectorNames.Add(valueLayerNames[i]);
+ listVectorNames.Add(Utility.valueLayerNames[i]);
}
}
- for (int i = 0; i < workwellLayerNames.Count; i++)
+ for (int i = 0; i < Utility.workwellLayerNames.Count; i++)
{
- if (listVectorNames.Contains(workwellLayerNames[i]) == false)
+ if (!listVectorNames.Contains(Utility.workwellLayerNames[i]))
{
- listVectorNames.Add(workwellLayerNames[i]);
+ listVectorNames.Add(Utility.workwellLayerNames[i]);
}
}
- for (int i = 0; i < instrumenLayerNames.Count; i++)
+ for (int i = 0; i < Utility.instrumenLayerNames.Count; i++)
{
- if (listVectorNames.Contains(instrumenLayerNames[i]) == false)
+ if (!listVectorNames.Contains(Utility.instrumenLayerNames[i]))
{
- listVectorNames.Add(instrumenLayerNames[i]);
+ listVectorNames.Add(Utility.instrumenLayerNames[i]);
}
}
- for (int i = 0; i < pipefittingLayerNames.Count; i++)
+ for (int i = 0; i < Utility.pipefittingLayerNames.Count; i++)
{
- if (listVectorNames.Contains(pipefittingLayerNames[i]) == false)
+ if (!listVectorNames.Contains(Utility.pipefittingLayerNames[i]))
{
- listVectorNames.Add(pipefittingLayerNames[i]);
+ listVectorNames.Add(Utility.pipefittingLayerNames[i]);
}
}
- FrmExportCADS frm = new FrmExportCADS(globeControl1, listVectorNames);//m_PipelineLayerNames);
+ FrmExportCADS frm = new FrmExportCADS(globeControl1, listVectorNames);//Utility.m_PipelineLayerNames);
frm.ShowDialog();
#endregion
}
@@ -8574,39 +8204,39 @@
LogManager.saveLog(Utility.userName, buttonItemBJ10_2.Text);
List listVectorNames = new List();
- for (int i = 0; i < m_PipelineLayerNames.Count; i++)
+ for (int i = 0; i < Utility.m_PipelineLayerNames.Count; i++)
{
- if (listVectorNames.Contains(m_PipelineLayerNames[i]) == false)
+ if (!listVectorNames.Contains(Utility.m_PipelineLayerNames[i]))
{
- listVectorNames.Add(m_PipelineLayerNames[i]);
+ listVectorNames.Add(Utility.m_PipelineLayerNames[i]);
}
}
- for (int i = 0; i < valueLayerNames.Count; i++)
+ for (int i = 0; i < Utility.valueLayerNames.Count; i++)
{
- if (listVectorNames.Contains(valueLayerNames[i]) == false)
+ if (!listVectorNames.Contains(Utility.valueLayerNames[i]))
{
- listVectorNames.Add(valueLayerNames[i]);
+ listVectorNames.Add(Utility.valueLayerNames[i]);
}
}
- for (int i = 0; i < workwellLayerNames.Count; i++)
+ for (int i = 0; i < Utility.workwellLayerNames.Count; i++)
{
- if (listVectorNames.Contains(workwellLayerNames[i]) == false)
+ if (!listVectorNames.Contains(Utility.workwellLayerNames[i]))
{
- listVectorNames.Add(workwellLayerNames[i]);
+ listVectorNames.Add(Utility.workwellLayerNames[i]);
}
}
- for (int i = 0; i < instrumenLayerNames.Count; i++)
+ for (int i = 0; i < Utility.instrumenLayerNames.Count; i++)
{
- if (listVectorNames.Contains(instrumenLayerNames[i]) == false)
+ if (!listVectorNames.Contains(Utility.instrumenLayerNames[i]))
{
- listVectorNames.Add(instrumenLayerNames[i]);
+ listVectorNames.Add(Utility.instrumenLayerNames[i]);
}
}
- for (int i = 0; i < pipefittingLayerNames.Count; i++)
+ for (int i = 0; i < Utility.pipefittingLayerNames.Count; i++)
{
- if (listVectorNames.Contains(pipefittingLayerNames[i]) == false)
+ if (!listVectorNames.Contains(Utility.pipefittingLayerNames[i]))
{
- listVectorNames.Add(pipefittingLayerNames[i]);
+ listVectorNames.Add(Utility.pipefittingLayerNames[i]);
}
}
FrmExportVector frm = new FrmExportVector(globeControl1, listVectorNames);
@@ -8668,9 +8298,9 @@
List listPipelineLayers = new List();
GSOLayer layer = null;
- for (int i = 0; i < m_PipelineLayerNames.Count; i++)
+ for (int i = 0; i < Utility.m_PipelineLayerNames.Count; i++)
{
- layer = globeControl1.Globe.Layers.GetLayerByCaption(m_PipelineLayerNames[i]);
+ layer = globeControl1.Globe.Layers.GetLayerByCaption(Utility.m_PipelineLayerNames[i]);
if (layer == null) continue;
listPipelineLayers.Add(layer);
}
@@ -8737,7 +8367,7 @@
LogManager.saveLog(Utility.userName, sliderItem2.Text);
globeControl1.Globe.GroundOpaque = 100 - sliderItem2.Value;
- GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(roadLayerName);//("180fd");
+ GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(Utility.roadLayerName);//("180fd");
if (layer != null)
{
layer.Opaque = 100 - sliderItem2.Value;
@@ -8876,7 +8506,7 @@
globeControl1.Globe.GroundOpaque = 100 - sliderGroundTransSet1.Value;
- layer = globeControl1.Globe.Layers.GetLayerByCaption(roadLayerName);//("180fd");
+ layer = globeControl1.Globe.Layers.GetLayerByCaption(Utility.roadLayerName);//("180fd");
if (layer != null)
{
layer.Opaque = 100 - sliderGroundTransSet1.Value;
@@ -9145,7 +8775,7 @@
LogManager.saveLog(Utility.userName, buttonItem8.Text);
int width = Width;
- FrmCompareFeature.ShowForm(globeControl1, globeControl2, layerTemp, layerTemp2, m_PipelineLayerNames, sgPipeLayersNames, width);
+ FrmCompareFeature.ShowForm(globeControl1, globeControl2, layerTemp, layerTemp2, Utility.m_PipelineLayerNames, Utility.sgPipeLayersNames, width);
}
///
/// 红线审核导出图片
diff --git a/MarkInfo.cs b/MarkInfo.cs
index 44e630b..68ab5bd 100644
--- a/MarkInfo.cs
+++ b/MarkInfo.cs
@@ -182,7 +182,7 @@
public void showMarker(List marks, GSOLayer layer)
{
layer.Visible = true;
- MessageBox.Show(layer.GetAllFeatures().Length + "");
+ //MessageBox.Show(layer.GetAllFeatures().Length + "");
foreach(MarkInfo mark in marks)
{
addLabel(mark,layer);
diff --git a/Cyberpipe.csproj b/Cyberpipe.csproj
index 6e90a6e..8f4424d 100644
--- a/Cyberpipe.csproj
+++ b/Cyberpipe.csproj
@@ -187,11 +187,6 @@
False
bin\x86\Debug\WHC.Pager.WinControl.dll
-
- False
- .exe
- bin\x86\Debug\WinFormsExtendedViewExample.exe
-
False
bin\x86\Debug\WW.dll
diff --git a/Cyberpipe.suo b/Cyberpipe.suo
index 0a403c8..eac4ecb 100644
--- a/Cyberpipe.suo
+++ b/Cyberpipe.suo
Binary files differ
diff --git a/MainFrm.cs b/MainFrm.cs
index 6e94648..7c574c1 100644
--- a/MainFrm.cs
+++ b/MainFrm.cs
@@ -27,7 +27,6 @@
public partial class MainFrm : Office2007Form
{
TreeNode layerManagerNode;
- TreeNode myPlaceNode = null;
bool m_bFullScreen;
GSOGlobeControl globeControl1;
@@ -45,24 +44,14 @@
GSOLayer layerTemp;
GSOLayer layerTemp2;
- FrmShResult frmShResult = null;
FrmRedlineResult frmredResult = null;
FrmMnModify frmModify;
public bool frmRedlineResult = false;
public bool boolfrmShResult;
public bool boolfrmModify;
- List m_PipelineLayerNames = new List();//线图层名称
- List workwellLayerNames = new List();//工井图层名称
- List valueLayerNames = new List();//阀门图层名称
- List instrumenLayerNames = new List();//附属物图层名称
- List pipefittingLayerNames = new List();//管件图层名称
- List sgPipeLayersNames = new List();//施工管线图层名称
- string roadLayerName = "";
public static string m_CurrentQueryLayer;//定义当前查询的图层
//定位和闪烁初始化定义
- int count = 0;
- private string flashflag = "single";
public bool m_AddPipeLine;//bool添加管线
bool m_isDrawTunnel;//bool创建隧道
@@ -71,10 +60,6 @@
private string trackflag;//定义阀门查询个数
- //管线间距分析
- private GSOFeature disFeature = new GSOFeature();
- private GSOFeature featureDis = new GSOFeature();
-
//记录沿线飞行设置
//int m_nFlyMode = 2;
double m_dFlyAboveLine = 1;
@@ -86,7 +71,7 @@
Boolean m_bDigPitByDepth = true;
//选择管线
int selectState;
- private OracleConnection connBackup = null;
+ //private OracleConnection connBackup = null;
//数据集合
public static GSODataSource ds;
@@ -182,7 +167,7 @@
RigthMenuSet();
MenuSet();
-
+
}
///
/// 右屏中添加管纵图片
@@ -906,13 +891,13 @@
comboBoxEx3.Items.Clear();
comboBoxEx4.Items.Clear();
comboBoxLayer.Items.Clear();
- for (int i = 0; i < m_PipelineLayerNames.Count; i++)
+ foreach (string t1 in Utility.m_PipelineLayerNames)
{
- comboBoxEx1.Items.Add(m_PipelineLayerNames[i]);
- comboBoxEx2.Items.Add(m_PipelineLayerNames[i]);
- comboBoxEx3.Items.Add(m_PipelineLayerNames[i]);
- comboBoxEx4.Items.Add(m_PipelineLayerNames[i]);
- comboBoxLayer.Items.Add(m_PipelineLayerNames[i]);
+ comboBoxEx1.Items.Add(t1);
+ comboBoxEx2.Items.Add(t1);
+ comboBoxEx3.Items.Add(t1);
+ comboBoxEx4.Items.Add(t1);
+ comboBoxLayer.Items.Add(t1);
}
splitContainer1.Panel2Collapsed = true;
@@ -1132,7 +1117,7 @@
}
- delegate void LoadDataForGlobalControl();
+ //delegate void LoadDataForGlobalControl();
private void connectServer()
{
@@ -1142,19 +1127,15 @@
// 勾选实测图层
foreach (TreeNode tn in layerTree.Nodes)
{
- if (tn.Nodes.Count > 0)
+ if (tn.Nodes.Count <= 0) continue;
+ if (tn.Text != "实测数据") continue;
+ tn.Checked = true;
+ foreach (TreeNode tnChild in tn.Nodes)
{
- if (tn.Text == "实测数据")
+ tnChild.Checked = true;
+ foreach (TreeNode tnGrandChild in tnChild.Nodes)
{
- tn.Checked = true;
- foreach (TreeNode tnChild in tn.Nodes)
- {
- tnChild.Checked = true;
- foreach (TreeNode tnGrandChild in tnChild.Nodes)
- {
- tnGrandChild.Checked = true;
- }
- }
+ tnGrandChild.Checked = true;
}
}
}
@@ -1174,7 +1155,7 @@
for (int j = 0; j < Utility.dataSource.DatasetCount; j++)
{
GSODataset dataset = Utility.dataSource.GetDatasetAt(j);
- if (dataset != null && dictionaryNetLayerNameAndCaption.ContainsKey(dataset.Caption))
+ if (dataset != null && Utility.dictionaryNetLayerNameAndCaption.ContainsKey(dataset.Caption))
{
dataset.Caption = dataset.Name;
globeControl1.Globe.Layers.Add(dataset);
@@ -1191,7 +1172,7 @@
for (int j = 0; j < ghDS.DatasetCount; j++)
{
GSODataset dataset = ghDS.GetDatasetAt(j);
- if (dataset != null && dictionaryNetLayerNameAndCaption.ContainsKey(dataset.Caption))
+ if (dataset != null && Utility.dictionaryNetLayerNameAndCaption.ContainsKey(dataset.Caption))
{
dataset.Caption = dataset.Name;
globeControl1.Globe.Layers.Add(dataset);
@@ -1207,7 +1188,7 @@
for (int m = 0; m < sgDS.DatasetCount; m++)
{
GSODataset dataset = sgDS.GetDatasetAt(m);
- if (dataset != null && !dataset.Caption.Contains("SH") && dictionaryNetLayerNameAndCaption.ContainsKey(dataset.Caption))
+ if (dataset != null && !dataset.Caption.Contains("SH") && Utility.dictionaryNetLayerNameAndCaption.ContainsKey(dataset.Caption))
{
dataset.Caption = dataset.Name;
globeControl1.Globe.Layers.Add(dataset);
@@ -1219,8 +1200,14 @@
}
}
- LoadDataForGlobalControl ss = connectServer;
- ss();
+// LoadDataForGlobalControl ss = connectServer;
+// ss();
+
+ this.Invoke((EventHandler) delegate
+ {
+ connectServer();
+ });
+
}
catch (Exception ex)
@@ -1240,7 +1227,7 @@
layerTree.Nodes.Add(layerManagerNode);
XmlDocument doc = new XmlDocument();
- doc.Load(filename);
+ doc.Load(Utility.filename);
XmlNodeList xmlLayerNodes = doc.SelectNodes("//layer");
foreach (XmlNode xmlLayerNode in xmlLayerNodes)
@@ -1295,70 +1282,6 @@
}
- /**
- * 读取Config.xml文件,初始化以下全局Map
- * m_PipelineLayerNames:管线
- * workwellLayerNames:工井
- * valueLayerNames:阀门
- * instrumenLayerNames:附属物
- * pipefittingLayerNames:特征管点
- * sgPipeLayersNames:施工管线
- **/
- private void initGlobalMap()
- {
- XmlDocument doc = new XmlDocument();
- doc.Load(filename);
- XmlNodeList xmlLayerNodes = doc.SelectNodes("//layerchild");
-
- foreach (XmlNode xmlLayerNode in xmlLayerNodes)
- {
- string layerType = xmlLayerNode.Attributes["type"].Value;
- string layerName1 = xmlLayerNode.Attributes["layer"].Value;
- string layerchildName = xmlLayerNode.Attributes["label"].Value;
-
- dictionaryNetLayerNameAndCaption.Add(layerName1, layerchildName);
-
- if (layerType != "db")
- {
- if (xmlLayerNode.Attributes["isRoad"] != null)
- {
- roadLayerName = layerchildName;
- }
- }
- else if (xmlLayerNode.Attributes["isPipeLine"] != null)
- {
- m_PipelineLayerNames.Add(layerchildName);
- g1layername.Add(layerName1);
- }
- else if (xmlLayerNode.Attributes["isWorkWell"] != null)
- {
- workwellLayerNames.Add(layerchildName);
- g1layername.Add(layerName1);
- }
- else if (xmlLayerNode.Attributes["isValve"] != null)
- {
- valueLayerNames.Add(layerchildName);
- g1layername.Add(layerName1);
- }
- else if (xmlLayerNode.Attributes["isAccess"] != null)
- {
- instrumenLayerNames.Add(layerchildName);
- g1layername.Add(layerName1);
- }
- else if (xmlLayerNode.Attributes["isCharacter"] != null)
- {
- pipefittingLayerNames.Add(layerchildName);
- g1layername.Add(layerName1);
- }
- else if (xmlLayerNode.Attributes["isSgData"] != null)
- {
- sgPipeLayersNames.Add(layerchildName);
- g1layername.Add(layerName1);
- }
-
- }
- }
-
private void initMarkerTree()
{
TreeNode node = new TreeNode();
@@ -1380,32 +1303,29 @@
for (int i = 0; i < markerStrs.Length; i++)
{
- if (File.Exists(Application.StartupPath + "\\标注管理\\" + markerStrs[i] + ".lgd"))
- {
- GSOLayer markerLayer = globeControl1.Globe.Layers.Add(Application.StartupPath + "\\标注管理\\" + markerStrs[i] + ".lgd");
- if (markerLayer != null)
- {
- TreeNode node1 = new TreeNode();
- node1.Text = markerLayer.Caption;
- node1.ImageIndex = 0;
- node1.SelectedImageIndex = 0;
- node1.Checked = markerLayer.Visible;
- node1.Tag = markerLayer;
- layerMarkerTree.Nodes[0].Nodes.Add(node1);
- }
- }
+ if (!File.Exists(Application.StartupPath + "\\标注管理\\" + markerStrs[i] + ".lgd")) continue;
+ GSOLayer markerLayer = globeControl1.Globe.Layers.Add(Application.StartupPath + "\\标注管理\\" + markerStrs[i] + ".lgd");
+ if (markerLayer == null) continue;
+ TreeNode node1 = new TreeNode();
+ node1.Text = markerLayer.Caption;
+ node1.ImageIndex = 0;
+ node1.SelectedImageIndex = 0;
+ node1.Checked = markerLayer.Visible;
+ node1.Tag = markerLayer;
+ layerMarkerTree.Nodes[0].Nodes.Add(node1);
}
}
private void MainFrm_Load(object sender, EventArgs e)
{
initGlobalControl();
- initGlobalMap();
+ //initGlobalMap();
initLayerTree();
initMarkerTree();
initLayout();
loadData();
+
double x = Convert.ToDouble(Utility.Query_Roads["绿岛"].ToString().Split(',')[0]);
double y = Convert.ToDouble(Utility.Query_Roads["绿岛"].ToString().Split(',')[1]);
double z = Convert.ToDouble(Utility.Query_Roads["绿岛"].ToString().Split(',')[2]);
@@ -1415,12 +1335,12 @@
#endregion
- Dictionary dictionaryNetLayerNameAndCaption = new Dictionary();
+ //Dictionary Utility.dictionaryNetLayerNameAndCaption = new Dictionary();
void globeControl1_AfterNetLayerAddEvent(object sender, AfterNetLayerAddEventArgs e)
{
- if (e.Layer != null && dictionaryNetLayerNameAndCaption.ContainsKey(e.Layer.Caption))
+ if (e.Layer != null && Utility.dictionaryNetLayerNameAndCaption.ContainsKey(e.Layer.Caption))
{
- e.Layer.Caption = dictionaryNetLayerNameAndCaption[e.Layer.Caption];
+ e.Layer.Caption = Utility.dictionaryNetLayerNameAndCaption[e.Layer.Caption];
}
}
@@ -1530,37 +1450,30 @@
///
Boolean CheckDatasetGeoReference(GSODataset dataset, string strDataPath)
{
+
+ if (dataset.GeoReferenceType != EnumGeoReferenceType.Flat) return true;
Boolean bSuccess = false;
- if (dataset.GeoReferenceType == EnumGeoReferenceType.Flat)
- {
- if (MessageBox.Show("数据没有空间参考信息,请设置空间参考信息!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) == DialogResult.OK)
- {
- String strPath = Application.StartupPath + "\\Coordinate Systems";
- OpenFileDialog dlg = new OpenFileDialog();
+ if (MessageBox.Show("数据没有空间参考信息,请设置空间参考信息!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) !=
+ DialogResult.OK) return bSuccess;
+ String strPath = Application.StartupPath + "\\Coordinate Systems";
+ OpenFileDialog dlg = new OpenFileDialog();
- dlg.InitialDirectory = strPath;
- dlg.RestoreDirectory = true;
+ dlg.InitialDirectory = strPath;
+ dlg.RestoreDirectory = true;
- dlg.Filter = "投影文件|*.prj||";
- if (dlg.ShowDialog() == DialogResult.OK)
- {
- string lprjStr = GSODataEngineUtility.ConvertEsriPrjFileToProj4(dlg.FileName);
- string lprjFileContent = "0prj4" + lprjStr + "";
+ dlg.Filter = "投影文件|*.prj||";
+ if (dlg.ShowDialog() != DialogResult.OK) return bSuccess;
+ string lprjStr = GSODataEngineUtility.ConvertEsriPrjFileToProj4(dlg.FileName);
+ string lprjFileContent = "0prj4" + lprjStr +
+ "";
- bSuccess = dataset.LoadProjectionFromESRIFile(dlg.FileName);
+ bSuccess = dataset.LoadProjectionFromESRIFile(dlg.FileName);
- string lprjFileName = strDataPath.Substring(0, strDataPath.LastIndexOf(".")) + ".lprj";
- StreamWriter writer = new StreamWriter(lprjFileName, false);
- writer.Write(lprjFileContent);
- writer.Close();
+ string lprjFileName = strDataPath.Substring(0, strDataPath.LastIndexOf(".")) + ".lprj";
+ StreamWriter writer = new StreamWriter(lprjFileName, false);
+ writer.Write(lprjFileContent);
+ writer.Close();
- }
- }
- }
- else
- {
- return true;
- }
return bSuccess;
}
@@ -1571,49 +1484,47 @@
///
void globeControl1_TrackRectEndEvent(object sender, TrackRectEndEventArgs e)
{
- if (e.Polygon != null)
+ if (e.Polygon == null) return;
+ globeControl1.Globe.TrackRectTool.Clear();
+ globeControl1.ImmediatelyRefresh();
+ globeControl1.SwapBuffer();
+ Point pt1 = new Point(Convert.ToInt32(e.StartPos.X), Convert.ToInt32(e.StartPos.Y));
+ Point pt2 = new Point(Convert.ToInt32(e.EndPos.X), Convert.ToInt32(e.EndPos.Y));
+
+ int mapWidth = 0;
+ int mapHeight = 0;
+ Point pt = getUpperLeftPoint(pt1, pt2, out mapWidth, out mapHeight);
+ int rightBottomX = pt.X + mapWidth;
+ int rightBottomY = pt.Y + mapHeight;
+ Image myImg = new Bitmap(mapWidth, mapHeight);
+ Graphics g = Graphics.FromImage(myImg);
+ g.CopyFromScreen(pt, new Point(0, 0), new Size(rightBottomX, rightBottomY));
+
+ SaveFileDialog dlg = new SaveFileDialog();
+ dlg.Filter = "输出JPEG(*.jpg)|*.jpg|输出PNG(*.png)|*.png|输出BMP(*.bmp)|*.bmp|输出BMP(*.gif)|*.gif";
+ if (dlg.ShowDialog() == DialogResult.OK)
{
- globeControl1.Globe.TrackRectTool.Clear();
- globeControl1.ImmediatelyRefresh();
- globeControl1.SwapBuffer();
- Point pt1 = new Point(Convert.ToInt32(e.StartPos.X), Convert.ToInt32(e.StartPos.Y));
- Point pt2 = new Point(Convert.ToInt32(e.EndPos.X), Convert.ToInt32(e.EndPos.Y));
-
- int mapWidth = 0;
- int mapHeight = 0;
- Point pt = getUpperLeftPoint(pt1, pt2, out mapWidth, out mapHeight);
- int rightBottomX = pt.X + mapWidth;
- int rightBottomY = pt.Y + mapHeight;
- Image myImg = new Bitmap(mapWidth, mapHeight);
- Graphics g = Graphics.FromImage(myImg);
- g.CopyFromScreen(pt, new Point(0, 0), new Size(rightBottomX, rightBottomY));
-
- SaveFileDialog dlg = new SaveFileDialog();
- dlg.Filter = "输出JPEG(*.jpg)|*.jpg|输出PNG(*.png)|*.png|输出BMP(*.bmp)|*.bmp|输出BMP(*.gif)|*.gif";
- if (dlg.ShowDialog() == DialogResult.OK)
+ string extension = Path.GetExtension(dlg.FileName);//扩展名
+ switch (extension)
{
- string extension = Path.GetExtension(dlg.FileName);//扩展名
- switch (extension)
- {
- case ".jpg":
- myImg.Save(dlg.FileName, ImageFormat.Jpeg);
- break;
- case ".png":
- myImg.Save(dlg.FileName, ImageFormat.Png);
- break;
- case ".bmp":
- myImg.Save(dlg.FileName, ImageFormat.Bmp);
- break;
- case ".gif":
- myImg.Save(dlg.FileName, ImageFormat.Gif);
- break;
- default:
- break;
- }
+ case ".jpg":
+ myImg.Save(dlg.FileName, ImageFormat.Jpeg);
+ break;
+ case ".png":
+ myImg.Save(dlg.FileName, ImageFormat.Png);
+ break;
+ case ".bmp":
+ myImg.Save(dlg.FileName, ImageFormat.Bmp);
+ break;
+ case ".gif":
+ myImg.Save(dlg.FileName, ImageFormat.Gif);
+ break;
+ default:
+ break;
}
- globeControl1.Globe.Action = EnumAction3D.ActionNull;
- globeControl1.Globe.MouseRoamingEnable = true;
}
+ globeControl1.Globe.Action = EnumAction3D.ActionNull;
+ globeControl1.Globe.MouseRoamingEnable = true;
}
///
/// 定位正北正90度俯视
@@ -1711,18 +1622,12 @@
///
private void CheckControl(TreeViewEventArgs e)
{
- if (e.Action != TreeViewAction.Unknown)
+ if (e.Action == TreeViewAction.Unknown||e.Node == null || Convert.IsDBNull(e.Node)) return;
+ CheckParentNode(e.Node);
+ if (e.Node.Nodes.Count > 0)
{
- if (e.Node != null && !Convert.IsDBNull(e.Node))
- {
- CheckParentNode(e.Node);
- if (e.Node.Nodes.Count > 0)
- {
- CheckAllChildNodes(e.Node, e.Node.Checked);
- }
- }
+ CheckAllChildNodes(e.Node, e.Node.Checked);
}
-
}
///
/// 改变所有子节点的状态
@@ -1747,94 +1652,88 @@
{
bool bChecked = false;
- if (curNode.Parent != null)
+ if (curNode.Parent == null) return;
+ foreach (TreeNode node in curNode.Parent.Nodes)
{
- foreach (TreeNode node in curNode.Parent.Nodes)
+ if (node.Checked)
{
- if (node.Checked)
- {
- bChecked = true;
- break;
- }
+ bChecked = true;
+ break;
}
+ }
- if (bChecked)
- {
- curNode.Parent.Checked = true;
- CheckParentNode(curNode.Parent);
- }
- else
- {
- curNode.Parent.Checked = false;
- CheckParentNode(curNode.Parent);
- }
+ if (bChecked)
+ {
+ curNode.Parent.Checked = true;
+ CheckParentNode(curNode.Parent);
+ }
+ else
+ {
+ curNode.Parent.Checked = false;
+ CheckParentNode(curNode.Parent);
}
}
private void layerTree_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
{
- if (e.Button == MouseButtons.Right)
+ if (e.Button != MouseButtons.Right) return;
+ layerTree.SelectedNode = e.Node;
+ if (e.Node.Tag == null) return;
+ if (e.Button == MouseButtons.Right && e.Node.Tag.ToString().Contains("|"))
{
- layerTree.SelectedNode = e.Node;
- if (e.Node.Tag != null)
+
+ if (e.Node.Tag.ToString().Split('|')[0] == "locaserver")
{
- if (e.Button == MouseButtons.Right && e.Node.Tag.ToString().Contains("|"))
+
+ foreach (ToolStripItem item in layerNodeContexMenu.Items)
{
-
- if (e.Node.Tag.ToString().Split('|')[0] == "locaserver")
- {
-
- foreach (ToolStripItem item in layerNodeContexMenu.Items)
- {
- item.Visible = false;
- }
- return;
-
- }
-
- if (e.Node.Tag.ToString().Split('|')[0] == "new")
- {
- LayerEditableMenuItem.Enabled = true;
- foreach (ToolStripItem item in layerNodeContexMenu.Items)
- {
- item.Visible = false;
- }
- LayerSelectableMenuItem.Visible = true;
- LayerEditableMenuItem.Visible = true;
- RemoveLayer.Visible = true;
- RefreshLayerFeatureListMenuItem.Visible = true;
- SaveLayerMenuItem.Visible = true;
- LayerFlyMenuItem.Visible = true;
- }
-
- LayerSelectableMenuItem.Visible = true;
- LayerEditableMenuItem.Visible = true;
- SaveLayerMenuItem.Visible = true;
- LayerFlyMenuItem.Visible = true;
- 导出CADToolStripMenuItem1.Visible = true;
-
- layerNodeContexMenu.Show(layerTree, e.X, e.Y);
- layerNodeContexMenu.Tag = e.Node;
- GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(e.Node.Tag.ToString().Split('|')[1]);
- if (layer != null)
- {
- LayerSelectableMenuItem.Checked = layer.Selectable;
- LayerEditableMenuItem.Checked = layer.Editable;
- }
+ item.Visible = false;
}
- else
+ return;
+
+ }
+
+ if (e.Node.Tag.ToString().Split('|')[0] == "new")
+ {
+ LayerEditableMenuItem.Enabled = true;
+ foreach (ToolStripItem item in layerNodeContexMenu.Items)
{
- if (e.Node.Tag is GSOLayer && e.Node.Parent != null && e.Node.Parent.Text.Trim() == "临时图层")
- {
- contextMenuStripDeleteLayerNode.Show(layerTree, e.X, e.Y);
- contextMenuStripDeleteLayerNode.Tag = e.Node;
- }
- if (e.Node.Tag is GSOFeature && e.Node.Parent != null && e.Node.Parent.Text.Trim() == "我的地标")
- {
- contextMenuStripDeleteLayerNode.Show(layerTree, e.X, e.Y);
- contextMenuStripDeleteLayerNode.Tag = e.Node;
- }
+ item.Visible = false;
}
+ //LayerSelectableMenuItem.Visible = true;
+ //LayerEditableMenuItem.Visible = true;
+ RemoveLayer.Visible = true;
+ RefreshLayerFeatureListMenuItem.Visible = true;
+ //SaveLayerMenuItem.Visible = true;
+ //LayerFlyMenuItem.Visible = true;
+ }
+
+ LayerSelectableMenuItem.Visible = true;
+ LayerEditableMenuItem.Visible = true;
+ SaveLayerMenuItem.Visible = true;
+ LayerFlyMenuItem.Visible = true;
+ 导出CADToolStripMenuItem1.Visible = true;
+
+ layerNodeContexMenu.Show(layerTree, e.X, e.Y);
+ layerNodeContexMenu.Tag = e.Node;
+ GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(e.Node.Tag.ToString().Split('|')[1]);
+ if (layer != null)
+ {
+ LayerSelectableMenuItem.Checked = layer.Selectable;
+ LayerEditableMenuItem.Checked = layer.Editable;
+ }
+ }
+ else
+ {
+ if (e.Node.Tag is GSOLayer && e.Node.Parent != null && e.Node.Parent.Text.Trim() == "临时图层")
+ {
+ contextMenuStripDeleteLayerNode.Show(layerTree, e.X, e.Y);
+ contextMenuStripDeleteLayerNode.Tag = e.Node;
+ }
+ else if (e.Node.Tag is GSOFeature && e.Node.Parent != null && e.Node.Parent.Text.Trim() == "我的地标")
+ {
+ contextMenuStripDeleteLayerNode.Show(layerTree, e.X, e.Y);
+ contextMenuStripDeleteLayerNode.Tag = e.Node;
}
}
}
@@ -1909,110 +1808,103 @@
{
TreeNode node = layerTree.SelectedNode;
- if (node != null)
+ if (node == null) return;
+ if (node.Parent.Text.Trim() == "临时图层")
{
- if (node.Parent.Text.Trim() == "临时图层")
+ GSOLayer lsLayer = globeControl1.Globe.Layers.GetLayerByCaption(node.Text);
+ double x = lsLayer.LatLonBounds.Center.X;
+ double y = lsLayer.LatLonBounds.Center.Y;
+ if (x == 0 && y == 0)
{
- GSOLayer lsLayer = globeControl1.Globe.Layers.GetLayerByCaption(node.Text);
- double x = lsLayer.LatLonBounds.Center.X;
- double y = lsLayer.LatLonBounds.Center.Y;
- if (x == 0 && y == 0)
- {
- x = lsLayer.Bounds.Center.X;
- y = lsLayer.Bounds.Center.Y;
- }
+ x = lsLayer.Bounds.Center.X;
+ y = lsLayer.Bounds.Center.Y;
+ }
- globeControl1.Globe.FlyToPosition(new GSOPoint3d(x, y, 10), EnumAltitudeMode.Absolute);
+ globeControl1.Globe.FlyToPosition(new GSOPoint3d(x, y, 10), EnumAltitudeMode.Absolute);
+ }
+ else
+ {
+ GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(node.Tag.ToString().Split('|')[1]);
+
+ if (layer == null) return;
+ if (layer.Caption == "红线")
+ {
+ globeControl1.Globe.FlyToPosition(new GSOPoint3d(120.610963, 31.188121, 50), EnumAltitudeMode.Absolute, -4, 50, 1000);
+ globeControl1.Globe.FlyToPointSpeed = 10000000;
+ globeControl1.Globe.Action = EnumAction3D.SelectObject;
+
+ GSOLayer redLayer = globeControl1.Globe.Layers.GetLayerByCaption("红线");
+ if (redLayer != null)
+ {
+ redLayer.Visible = true;
+ }
+ globeControl1.Refresh();
}
else
{
- GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(node.Tag.ToString().Split('|')[1]);
-
- if (layer != null)
- {
- if (layer.Caption == "红线")
- {
- globeControl1.Globe.FlyToPosition(new GSOPoint3d(120.610963, 31.188121, 50), EnumAltitudeMode.Absolute, -4, 50, 1000);
- globeControl1.Globe.FlyToPointSpeed = 10000000;
- globeControl1.Globe.Action = EnumAction3D.SelectObject;
-
- GSOLayer redLayer = globeControl1.Globe.Layers.GetLayerByCaption("红线");
- if (redLayer != null)
- {
- redLayer.Visible = true;
- }
- globeControl1.Refresh();
- }
- else
- {
- double x = layer.LatLonBounds.Center.X;
- double y = layer.LatLonBounds.Center.Y;
- globeControl1.Globe.FlyToPosition(new GSOPoint3d(x, y, 100), EnumAltitudeMode.Absolute);
- }
- }
+ double x = layer.LatLonBounds.Center.X;
+ double y = layer.LatLonBounds.Center.Y;
+ globeControl1.Globe.FlyToPosition(new GSOPoint3d(x, y, 100), EnumAltitudeMode.Absolute);
}
}
}
private void layerTree_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e)
{
- if (layerTree.SelectedNode != null)
+ if (layerTree.SelectedNode == null) return;
+ if (layerTree.SelectedNode.Tag.ToString().Contains("|"))
{
- if (layerTree.SelectedNode.Tag.ToString().Contains("|"))
+ string nodeTag = layerTree.SelectedNode.Tag.ToString().Split('|')[1];
+ GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(nodeTag);
+ if (layer != null)
{
- string nodeTag = layerTree.SelectedNode.Tag.ToString().Split('|')[1];
- GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(nodeTag);
- if (layer != null)
+ if (layer.Caption == "红线")
{
- if (layer.Caption == "红线")
- {
- globeControl1.Globe.FlyToPosition(new GSOPoint3d(120.610963, 31.188121, 50), EnumAltitudeMode.Absolute, -4, 50, 1000);
- globeControl1.Globe.FlyToPointSpeed = 10000000;
- globeControl1.Globe.Action = EnumAction3D.SelectObject;
+ globeControl1.Globe.FlyToPosition(new GSOPoint3d(120.610963, 31.188121, 50), EnumAltitudeMode.Absolute, -4, 50, 1000);
+ globeControl1.Globe.FlyToPointSpeed = 10000000;
+ globeControl1.Globe.Action = EnumAction3D.SelectObject;
- GSOLayer redLayer = globeControl1.Globe.Layers.GetLayerByCaption("红线");
- if (redLayer != null)
- {
- redLayer.Visible = true;
- }
- globeControl1.Refresh();
- }
- else
+ GSOLayer redLayer = globeControl1.Globe.Layers.GetLayerByCaption("红线");
+ if (redLayer != null)
{
- double x = layer.LatLonBounds.Center.X;
- double y = layer.LatLonBounds.Center.Y;
- globeControl1.Globe.FlyToPosition(new GSOPoint3d(x, y, 0), EnumAltitudeMode.Absolute);
+ redLayer.Visible = true;
}
+ globeControl1.Refresh();
+ }
+ else
+ {
+ double x = layer.LatLonBounds.Center.X;
+ double y = layer.LatLonBounds.Center.Y;
+ globeControl1.Globe.FlyToPosition(new GSOPoint3d(x, y, 0), EnumAltitudeMode.Absolute);
}
}
- if (layerTree.SelectedNode.Tag is GSOLayer)
+ }
+ if (layerTree.SelectedNode.Tag is GSOLayer)
+ {
+ GSOLayer layer = layerTree.SelectedNode.Tag as GSOLayer;
+ if (layer.GetAllFeatures().Length > 0)
{
- GSOLayer layer = layerTree.SelectedNode.Tag as GSOLayer;
- if (layer.GetAllFeatures().Length > 0)
+ GSOFeature feature = layer.GetAt(0);
+ if (feature != null && feature.Geometry != null)
{
- GSOFeature feature = layer.GetAt(0);
- if (feature != null && feature.Geometry != null)
- {
- globeControl1.Globe.FlyToPosition(feature.Geometry.GeoCenterPoint, EnumAltitudeMode.Absolute);//, 0, 0, 1000);
- }
- else
- {
- globeControl1.Globe.FlyToFeature(feature);
- }
- }
- }
- if (layerTree.SelectedNode.Tag is GSOFeature)
- {
- GSOFeature feature = layerTree.SelectedNode.Tag as GSOFeature;
- if (feature.Geometry != null)
- {
- globeControl1.Globe.FlyToPosition(feature.Geometry.GeoCenterPoint, EnumAltitudeMode.Absolute, 0, 0, 10);
+ globeControl1.Globe.FlyToPosition(feature.Geometry.GeoCenterPoint, EnumAltitudeMode.Absolute);//, 0, 0, 1000);
}
else
{
globeControl1.Globe.FlyToFeature(feature);
}
}
+ } else if (layerTree.SelectedNode.Tag is GSOFeature)
+ {
+ GSOFeature feature = layerTree.SelectedNode.Tag as GSOFeature;
+ if (feature.Geometry != null)
+ {
+ globeControl1.Globe.FlyToPosition(feature.Geometry.GeoCenterPoint, EnumAltitudeMode.Absolute, 0, 0, 10);
+ }
+ else
+ {
+ globeControl1.Globe.FlyToFeature(feature);
+ }
}
}
@@ -2086,7 +1978,7 @@
trackPolylineEndMode == EnumTrackPolylineEndMode.DLDM_Analysis)
{
Dictionary hdmDic = SectionAnalysisTool.HDMAnalysis(globeControl1,
- e.Polyline, m_PipelineLayerNames);
+ e.Polyline, Utility.m_PipelineLayerNames);
FrmHDMAnalysis3 frm = new FrmHDMAnalysis3(hdmDic, globeControl1,
trackPolylineEndMode);
frm.Show(this);
@@ -2103,185 +1995,6 @@
* **/
}
trackPolylineEndMode = EnumTrackPolylineEndMode.Default_Analysis;
- /*
- ArrayList arraylistPoint = new ArrayList();
- ArrayList arraylistLine = new ArrayList();
-
- // globeControl1.Globe.ClearLastTrackPolyline();
-
- if (e.Polyline != null)
- {
- //横断面分析
- if (buttonItemFX2_1.Checked || buttonItemFX2_3.Checked)
- {
- if (m_PipelineLayerNames != null)
- {
- GSOGeoPolygon3D polygon = e.Polyline.CreateBuffer(0.1, true, 5, true, false);
- for (int i = 0; i < m_PipelineLayerNames.Count; i++)
- {
- if (m_PipelineLayerNames[i] != null)
- {
- GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(m_PipelineLayerNames[i]);
- if (layer == null)
- {
- continue;
- }
- if (layer.Visible == false)
- {
- continue;
- }
- GSOFeatureLayer featurelayer = layer as GSOFeatureLayer;
- if (featurelayer != null)
- {
- GSOFeatures feats = featurelayer.FindFeaturesInPolygon(polygon, false); //featurelayer.GetAllFeatures();
- if (feats != null)
- {
- for (int j = 0; j < feats.Length; j++)
- {
- GSOFeature feateline = feats[j];
- GSOGeoPolyline3D geoline = feateline.Geometry as GSOGeoPolyline3D;
-
- if (geoline != null)
- {
- if (geoline.Style != null)
- {
- if (geoline.Style.GetType() == typeof(GSOPipeLineStyle3D))
- {
- GSOPoint3d pntIntersect1 = new GSOPoint3d();
- GSOPoint3d pntIntersect2 = new GSOPoint3d();
-
- double honLen;
- double verLen;
- double dDist = globeControl1.Globe.Analysis3D.ComputeTwoGeoPolylineDistance(e.Polyline, geoline, out pntIntersect1, out pntIntersect2, out honLen, out verLen, false, false, 0);
-
- globeControl1.Globe.Action = EnumAction3D.ActionNull;
- if (dDist > -1)
- {
- arraylistPoint.Add(pntIntersect2);
- arraylistLine.Add(feateline);
- }
- }
- }
- }
- }
- }
- else
- {
- MessageBox.Show("请重新绘制断面");
- return;
- }
-
- }
- }
- }
- }
- if (buttonItemFX2_1.Checked)
- {
- FrmHDMAnalysis3 frm = FrmHDMAnalysis3.GetForm(arraylistPoint, arraylistLine, e.Polyline, globeControl1);
- if (!frm.isShowFirst)
- {
- frm.Show(this);
- }
- frm.LoadChartEvent();
- }
- else
- {
- FrmRoadHDM frm = FrmRoadHDM.GetForm(arraylistPoint, arraylistLine, e.Polyline, globeControl1);
- if (!frm.isShowFirst)
- {
- frm.Show(this);
- }
- frm.LoadChartEvent();
- }
- globeControl1.Globe.ClearLastTrackPolyline();
- }
- else if (buttonItemFX2_4.Checked)
- {
- FrmBaseLineProfillAnalysis dlg = new FrmBaseLineProfillAnalysis(globeControl1.Globe, e.Polyline);
- dlg.Show(this);
- globeControl1.Globe.ClearLastTrackPolyline();
- }
- else if (buttonItemFX4_3.Checked)
- {
- GSOGeoPolygon3D resPolygon = e.Polyline.CreateBuffer(m_dDigPitWidthAlongLine, false, 0, false, false);
-
- GSOGeoPit geoPit = new GSOGeoPit();
- geoPit.PitPolygon = resPolygon;
- if (m_bDigPitByDepth)
- {
- geoPit.PitDepth = m_dDigPitValue;
- geoPit.PitDepthUsing = true;
- }
- else
- {
- geoPit.PitBottomAlt = m_dDigPitValue;
- geoPit.PitDepthUsing = false;
- }
-
- globeControl1.Globe.AddPit("", geoPit);
- GSOLayer layerGround = globeControl1.Globe.Layers.GetLayerByCaption(roadLayerName);// ("180fd");
- if (layerGround != null)
- {
- layerGround.Visible = false;
- }
- // 清除当前TrackPolygonAnalysis的痕迹
- globeControl1.Globe.ClearLastTrackPolyline();
- }
- else if (distanceMarker)
- {
- setMarkerLayerUnVisible("距离标注");
- GSOLayer l = globeControl1.Globe.Layers.GetLayerByCaption("距离标注");
- if (l != null)
- {
- l.Visible = true;
- if (getLabelName(l) != -1)
- {
- GSOGeoPolyline3D line = e.Polyline;
- if (line.PartCount > 0)
- {
- double length = line.GetSpaceLength(true, 6378137);//线的长度
- if (length == 0)
- {
- return;
- }
- else
- {
-
- GSOGeoPoint3D pt = new GSOGeoPoint3D();
- GSOGeoPolyline3D lineLine = line.GetSegment(0, length / 2);
- GSOPoint3d point3d = lineLine[lineLine.PartCount - 1][lineLine[lineLine.PartCount - 1].Count - 1];
- pt.X = point3d.X;
- pt.Y = point3d.Y;
- pt.Z = point3d.Z;
-
- string Twodecimalplaces = string.Format("{0:F}", length);
- string radiusLabelName = "" + Twodecimalplaces + "米";
- //string radiusLabelName = "" + length + "米";//标注名称
-
- GSOPoint2d point2d = new GSOPoint2d(0, 30);//标注位置
-
- int labelText = getLabelName(l);
-
- GSOFeature newFeatureLine = new GSOFeature();
- newFeatureLine.Geometry = line;
- newFeatureLine.Name = (labelText + 1).ToString() + "-line";
- l.AddFeature(newFeatureLine);
- globeControl1.Globe.ClearLastTrackPolyline();
-
- GSOFeature newFeature = new GSOFeature();
- newFeature = createLabel(l, newFeature, pt, radiusLabelName, (labelText + 1).ToString(), point2d);
- l.AddFeature(newFeature);
-
- globeControl1.Refresh();
- }
- }
- }
- }
- }
- }
- globeControl1.Globe.Action = EnumAction3D.ActionNull;
- ActionToolMenuChecked();
- * **/
}
#endregion
@@ -2292,83 +2005,81 @@
///
void globeControl1_TrackPolygonEndEvent(object sender, TrackPolygonEndEventArgs e)
{
- if (globeControl1.Globe.Action == EnumAction3D.TrackPolygon && e.Polygon != null)
+ if (globeControl1.Globe.Action != EnumAction3D.TrackPolygon || e.Polygon == null) return;
+ GSOGeoPolygon3D polygon = e.Polygon;
+
+ switch (trackflag)
{
- GSOGeoPolygon3D polygon = e.Polygon;
+ case "valvequery":
+ FrmValveStatistics frm = new FrmValveStatistics(globeControl1, polygon, InitDataGridViewX1);
+ frm.Show(this);
+ globeControl1.Globe.Action = EnumAction3D.ActionNull;
+ break;
- switch (trackflag)
- {
- case "valvequery":
- FrmValveStatistics frm = new FrmValveStatistics(globeControl1, polygon, InitDataGridViewX1);
- frm.Show(this);
- globeControl1.Globe.Action = EnumAction3D.ActionNull;
- break;
+ case "PipelineDistanceStatistics":
- case "PipelineDistanceStatistics":
+ FrmAllPipelineStatis frm1 = new FrmAllPipelineStatis(globeControl1, polygon, InitDataGridViewX1, Utility.m_PipelineLayerNames);
+ frm1.Show(this);
+ globeControl1.Globe.Action = EnumAction3D.ActionNull;
- FrmAllPipelineStatis frm1 = new FrmAllPipelineStatis(globeControl1, polygon, InitDataGridViewX1, m_PipelineLayerNames);
- frm1.Show(this);
- globeControl1.Globe.Action = EnumAction3D.ActionNull;
+ break;
+ case "PipelineSpatialQuery":
- break;
- case "PipelineSpatialQuery":
+ FrmAllPipelineStatis.ShowForm(globeControl1, polygon, InitDataGridViewX1, Utility.m_PipelineLayerNames);
+ globeControl1.Globe.ClearAnalysis();
+ globeControl1.Globe.Action = EnumAction3D.ActionNull;
- FrmAllPipelineStatis.ShowForm(globeControl1, polygon, InitDataGridViewX1, m_PipelineLayerNames);
- globeControl1.Globe.ClearAnalysis();
- globeControl1.Globe.Action = EnumAction3D.ActionNull;
+ break;
+ case "workwellquery":
+ FrmAllWorkWellStatis frmWell = new FrmAllWorkWellStatis(globeControl1, polygon, InitDataGridViewX1);
+ frmWell.Show(this);
- break;
- case "workwellquery":
- FrmAllWorkWellStatis frmWell = new FrmAllWorkWellStatis(globeControl1, polygon, InitDataGridViewX1);
- frmWell.Show(this);
+ globeControl1.Globe.Action = EnumAction3D.ActionNull;
- globeControl1.Globe.Action = EnumAction3D.ActionNull;
+ break;
- break;
-
- case "pit":
- double depth;
- FrmTackPolygonDlg dlg = new FrmTackPolygonDlg();
- if (dlg.ShowDialog() == DialogResult.OK)
+ case "pit":
+ double depth;
+ FrmTackPolygonDlg dlg = new FrmTackPolygonDlg();
+ if (dlg.ShowDialog() == DialogResult.OK)
+ {
+ depth = dlg.depth;
+ GSOGeoPit geoPit = new GSOGeoPit();
+ geoPit.PitPolygon = polygon;
+ geoPit.PitDepth = depth;
+ geoPit.PitDepthUsing = true;
+ globeControl1.Globe.AddPit("", geoPit);
+ GSOLayer layerGround = globeControl1.Globe.Layers.GetLayerByCaption(Utility.roadLayerName);//("180fd");
+ if (layerGround != null)
{
- depth = dlg.depth;
- GSOGeoPit geoPit = new GSOGeoPit();
- geoPit.PitPolygon = polygon;
- geoPit.PitDepth = depth;
- geoPit.PitDepthUsing = true;
- globeControl1.Globe.AddPit("", geoPit);
- GSOLayer layerGround = globeControl1.Globe.Layers.GetLayerByCaption(roadLayerName);//("180fd");
- if (layerGround != null)
- {
- layerGround.Visible = false;
- }
+ layerGround.Visible = false;
}
- globeControl1.Globe.ClearLastTrackPolygon();
- globeControl1.Globe.Action = EnumAction3D.ActionNull;
- break;
- case "digFillAnalysis":
- DigFillAnalysisDlg dlg1 = new DigFillAnalysisDlg();
- dlg1.m_globe = globeControl1.Globe;
- dlg1.m_polygon3D = polygon;
- globeControl1.Globe.Action = EnumAction3D.ActionNull;
- dlg1.Show(this);
- break;
- case "FloodAnalysis":
- FrmFloodAnalysis frmFloodAnalysis = new FrmFloodAnalysis(globeControl1.Globe, polygon);
- frmFloodAnalysis.Show(this);
- globeControl1.Globe.Action = EnumAction3D.ActionNull;
- break;
- case "BSQDuoBianXiangStatis":
- FrmBSQStatis bsqFrm = new FrmBSQStatis(globeControl1, e.Polygon);
- bsqFrm.Show(this);
- globeControl1.Globe.Action = EnumAction3D.ActionNull;
- break;
+ }
+ globeControl1.Globe.ClearLastTrackPolygon();
+ globeControl1.Globe.Action = EnumAction3D.ActionNull;
+ break;
+ case "digFillAnalysis":
+ DigFillAnalysisDlg dlg1 = new DigFillAnalysisDlg();
+ dlg1.m_globe = globeControl1.Globe;
+ dlg1.m_polygon3D = polygon;
+ globeControl1.Globe.Action = EnumAction3D.ActionNull;
+ dlg1.Show(this);
+ break;
+ case "FloodAnalysis":
+ FrmFloodAnalysis frmFloodAnalysis = new FrmFloodAnalysis(globeControl1.Globe, polygon);
+ frmFloodAnalysis.Show(this);
+ globeControl1.Globe.Action = EnumAction3D.ActionNull;
+ break;
+ case "BSQDuoBianXiangStatis":
+ FrmBSQStatis bsqFrm = new FrmBSQStatis(globeControl1, e.Polygon);
+ bsqFrm.Show(this);
+ globeControl1.Globe.Action = EnumAction3D.ActionNull;
+ break;
- case "":
- break;
- default:
- break;
- }
+ case "":
+ break;
+ default:
+ break;
}
}
///
@@ -2380,16 +2091,14 @@
{
try
{
- if (e.Feature != null)
+ if (e.Feature == null) return;
+ if (isFeatureContainsBianhao(e.Feature))
{
- if (isFeatureContainsBianhao(e.Feature))
- {
- featureTooltip.ShowBalloon((int)e.MousePos.X, (int)e.MousePos.Y, e.Feature.GetValue(featureIDFieldName).ToString());
- }
- else if (e.Feature.Name != "")
- {
- featureTooltip.ShowBalloon((int)e.MousePos.X, (int)e.MousePos.Y, e.Feature.Name);
- }
+ featureTooltip.ShowBalloon((int)e.MousePos.X, (int)e.MousePos.Y, e.Feature.GetValue(featureIDFieldName).ToString());
+ }
+ else if (e.Feature.Name != "")
+ {
+ featureTooltip.ShowBalloon((int)e.MousePos.X, (int)e.MousePos.Y, e.Feature.Name);
}
}
catch (Exception ex)
@@ -2405,192 +2114,188 @@
/// (完善)
void globeControl1_MouseDoubleClick(object sender, MouseEventArgs e)
{
- if (e.Button == MouseButtons.Left)
+ if (e.Button != MouseButtons.Left) return;
+ if (m_AddPipeLine && globeControl1.Globe.Action == EnumAction3D.DrawPolyline)//添加管线
{
- if (m_AddPipeLine && globeControl1.Globe.Action == EnumAction3D.DrawPolyline)//添加管线
+ GSOLayer layerDest = globeControl1.Globe.DestLayerFeatureAdd;
+ if (layerDest != null)
{
- GSOLayer layerDest = globeControl1.Globe.DestLayerFeatureAdd;
- if (layerDest != null)
+ GSOFeatures features = layerDest.GetAllFeatures();
+ GSOFeature f = features[features.Length - 1];
+ GSOGeoPolyline3D line = f.Geometry as GSOGeoPolyline3D;
+ globeControl1.Globe.Action = EnumAction3D.ActionNull;
+ if (f != null && f.Geometry.Type == EnumGeometryType.GeoPolyline3D)
{
- GSOFeatures features = layerDest.GetAllFeatures();
- GSOFeature f = features[features.Length - 1];
- GSOGeoPolyline3D line = f.Geometry as GSOGeoPolyline3D;
- globeControl1.Globe.Action = EnumAction3D.ActionNull;
- if (f != null && f.Geometry.Type == EnumGeometryType.GeoPolyline3D)
- {
- FrmLineCoordinate lineCoordiante = new FrmLineCoordinate(f, globeControl1, layerDest.Caption);
- lineCoordiante.Show(this);
- }
- globeControl1.Refresh();
- }
- }
- if (m_isDrawTunnel && globeControl1.Globe.Action == EnumAction3D.DrawPolyline)//创建隧道
- {
- GSOLayer tunnel = globeControl1.Globe.Layers.GetLayerByCaption("隧道");
- if (tunnel != null && tunnel.GetAllFeatures().Length > 0)
- {
- GSOFeature feature = tunnel.GetAt(tunnel.GetAllFeatures().Length - 1);
- FrmCreateTunnel frm = new FrmCreateTunnel(globeControl1, feature);
- if (frm.ShowDialog() == DialogResult.OK)
- {
- //tunnel.Save();
- }
+ FrmLineCoordinate lineCoordiante = new FrmLineCoordinate(f, globeControl1, layerDest.Caption);
+ lineCoordiante.Show(this);
}
globeControl1.Refresh();
}
- if (m_isDrawCitySevenLine && globeControl1.Globe.Action == EnumAction3D.DrawPolyline)//绘制城市七线
+ }
+ if (m_isDrawTunnel && globeControl1.Globe.Action == EnumAction3D.DrawPolyline)//创建隧道
+ {
+ GSOLayer tunnel = globeControl1.Globe.Layers.GetLayerByCaption("隧道");
+ if (tunnel != null && tunnel.GetAllFeatures().Length > 0)
{
- string lineType = citySevenLineType;
- string lineName = cityServerLineName;
- GSOFeature feature = null;
- switch (lineType)
+ GSOFeature feature = tunnel.GetAt(tunnel.GetAllFeatures().Length - 1);
+ FrmCreateTunnel frm = new FrmCreateTunnel(globeControl1, feature);
+ if (frm.ShowDialog() == DialogResult.OK)
{
- case "城市红线":
- GSOLayer layerRed = globeControl1.Globe.Layers.GetLayerByCaption(lineType);
- if (layerRed != null && layerRed.GetAllFeatures().Length > 0)
- {
- feature = layerRed.GetAt(layerRed.GetAllFeatures().Length - 1);
- if (feature != null)
- {
- feature.Name = lineName;
- GSOSimpleLineStyle3D style = new GSOSimpleLineStyle3D();
- style.LineColor = Color.Red; //改变绘制的线的颜色
- style.LineWidth = 1; //改变绘制的线的宽度
- feature.Geometry.Style = style;
- //layerRed.Save();
- }
- }
- break;
- case "城市橙线":
- GSOLayer layerOrange = globeControl1.Globe.Layers.GetLayerByCaption(lineType);
- if (layerOrange != null && layerOrange.GetAllFeatures().Length > 0)
- {
- feature = layerOrange.GetAt(layerOrange.GetAllFeatures().Length - 1);
- if (feature != null)
- {
- feature.Name = lineName;
- GSOSimpleLineStyle3D style = new GSOSimpleLineStyle3D();
- style.LineColor = Color.Orange;
- feature.Geometry.Style = style;
- //layerOrange.Save();
- }
- }
- break;
- case "城市黄线":
- GSOLayer layerYellow = globeControl1.Globe.Layers.GetLayerByCaption(lineType);
- if (layerYellow != null && layerYellow.GetAllFeatures().Length > 0)
- {
- feature = layerYellow.GetAt(layerYellow.GetAllFeatures().Length - 1);
- if (feature != null)
- {
- feature.Name = lineName;
- GSOSimpleLineStyle3D style = new GSOSimpleLineStyle3D();
- style.LineColor = Color.Yellow;
- feature.Geometry.Style = style;
- //layerYellow.Save();
- }
- }
- break;
- case "城市绿线":
- GSOLayer layerGreen = globeControl1.Globe.Layers.GetLayerByCaption(lineType);
- if (layerGreen != null && layerGreen.GetAllFeatures().Length > 0)
- {
- feature = layerGreen.GetAt(layerGreen.GetAllFeatures().Length - 1);
- if (feature != null)
- {
- feature.Name = lineName;
- GSOSimpleLineStyle3D style = new GSOSimpleLineStyle3D();
- style.LineColor = Color.Green;
- feature.Geometry.Style = style;
- //layerGreen.Save();
- }
- }
- break;
- case "城市蓝线":
- GSOLayer layerBlue = globeControl1.Globe.Layers.GetLayerByCaption(lineType);
- if (layerBlue != null && layerBlue.GetAllFeatures().Length > 0)
- {
- feature = layerBlue.GetAt(layerBlue.GetAllFeatures().Length - 1);
- if (feature != null)
- {
- feature.Name = lineName;
- GSOSimpleLineStyle3D style = new GSOSimpleLineStyle3D();
- style.LineColor = Color.Blue;
- feature.Geometry.Style = style;
- //layerBlue.Save();
- }
- }
- break;
- case "城市紫线":
- GSOLayer layerPurple = globeControl1.Globe.Layers.GetLayerByCaption(lineType);
- if (layerPurple != null && layerPurple.GetAllFeatures().Length > 0)
- {
- feature = layerPurple.GetAt(layerPurple.GetAllFeatures().Length - 1);
- if (feature != null)
- {
- feature.Name = lineName;
- GSOSimpleLineStyle3D style = new GSOSimpleLineStyle3D();
- style.LineColor = Color.Purple;
- feature.Geometry.Style = style;
- //layerPurple.Save();
- }
- }
- break;
- case "城市黑线":
- GSOLayer layerBlack = globeControl1.Globe.Layers.GetLayerByCaption(lineType);
- if (layerBlack != null && layerBlack.GetAllFeatures().Length > 0)
- {
- feature = layerBlack.GetAt(layerBlack.GetAllFeatures().Length - 1);
- if (feature != null)
- {
- feature.Name = lineName;
- GSOSimpleLineStyle3D style = new GSOSimpleLineStyle3D();
- style.LineColor = Color.Black;
- feature.Geometry.Style = style;
- //layerBlack.Save();
- }
- }
- break;
+ //tunnel.Save();
}
-
- globeControl1.Globe.DestLayerFeatureAdd = null;
}
- m_AddPipeLine = false;
- m_isDrawTunnel = false;
- m_isDrawCitySevenLine = false;
- if (m_isDrawRedPology && globeControl1.Globe.Action == EnumAction3D.DrawPolygon)//红线工具
+ globeControl1.Refresh();
+ }
+ if (m_isDrawCitySevenLine && globeControl1.Globe.Action == EnumAction3D.DrawPolyline)//绘制城市七线
+ {
+ string lineType = citySevenLineType;
+ string lineName = cityServerLineName;
+ GSOFeature feature = null;
+ switch (lineType)
{
- GSOLayer layerDest = globeControl1.Globe.DestLayerFeatureAdd;
- if (layerDest != null)
- {
- GSOFeatures features = layerDest.GetAllFeatures();
- //GSOFeatures features = globeControl1.Globe.MemoryLayer.GetAllFeatures();
- GSOFeature f = features[features.Length - 1];
- if (f != null)
+ case "城市红线":
+ GSOLayer layerRed = globeControl1.Globe.Layers.GetLayerByCaption(lineType);
+ if (layerRed != null && layerRed.GetAllFeatures().Length > 0)
{
- GSOGeoPolygon3D polygon = f.Geometry as GSOGeoPolygon3D;
- if (polygon != null)
+ feature = layerRed.GetAt(layerRed.GetAllFeatures().Length - 1);
+ if (feature != null)
{
- GSOSimplePolygonStyle3D geoStyle3d = new GSOSimplePolygonStyle3D();
- f.Name = (getLabelName(layerDest) + 1).ToString();
- geoStyle3d.FillColor = Color.Red;
- polygon.Style = geoStyle3d;
- GSOLabel label = new GSOLabel();
- label.Text = "此区域正在施工中!";
- label.Style = new GSOLabelStyle();
- label.Style.HasTracktionLine = false;
- polygon.Label = label;
-
- globeControl1.Refresh();
+ feature.Name = lineName;
+ GSOSimpleLineStyle3D style = new GSOSimpleLineStyle3D();
+ style.LineColor = Color.Red; //改变绘制的线的颜色
+ style.LineWidth = 1; //改变绘制的线的宽度
+ feature.Geometry.Style = style;
+ //layerRed.Save();
}
}
+ break;
+ case "城市橙线":
+ GSOLayer layerOrange = globeControl1.Globe.Layers.GetLayerByCaption(lineType);
+ if (layerOrange != null && layerOrange.GetAllFeatures().Length > 0)
+ {
+ feature = layerOrange.GetAt(layerOrange.GetAllFeatures().Length - 1);
+ if (feature != null)
+ {
+ feature.Name = lineName;
+ GSOSimpleLineStyle3D style = new GSOSimpleLineStyle3D();
+ style.LineColor = Color.Orange;
+ feature.Geometry.Style = style;
+ //layerOrange.Save();
+ }
+ }
+ break;
+ case "城市黄线":
+ GSOLayer layerYellow = globeControl1.Globe.Layers.GetLayerByCaption(lineType);
+ if (layerYellow != null && layerYellow.GetAllFeatures().Length > 0)
+ {
+ feature = layerYellow.GetAt(layerYellow.GetAllFeatures().Length - 1);
+ if (feature != null)
+ {
+ feature.Name = lineName;
+ GSOSimpleLineStyle3D style = new GSOSimpleLineStyle3D();
+ style.LineColor = Color.Yellow;
+ feature.Geometry.Style = style;
+ //layerYellow.Save();
+ }
+ }
+ break;
+ case "城市绿线":
+ GSOLayer layerGreen = globeControl1.Globe.Layers.GetLayerByCaption(lineType);
+ if (layerGreen != null && layerGreen.GetAllFeatures().Length > 0)
+ {
+ feature = layerGreen.GetAt(layerGreen.GetAllFeatures().Length - 1);
+ if (feature != null)
+ {
+ feature.Name = lineName;
+ GSOSimpleLineStyle3D style = new GSOSimpleLineStyle3D();
+ style.LineColor = Color.Green;
+ feature.Geometry.Style = style;
+ //layerGreen.Save();
+ }
+ }
+ break;
+ case "城市蓝线":
+ GSOLayer layerBlue = globeControl1.Globe.Layers.GetLayerByCaption(lineType);
+ if (layerBlue != null && layerBlue.GetAllFeatures().Length > 0)
+ {
+ feature = layerBlue.GetAt(layerBlue.GetAllFeatures().Length - 1);
+ if (feature != null)
+ {
+ feature.Name = lineName;
+ GSOSimpleLineStyle3D style = new GSOSimpleLineStyle3D();
+ style.LineColor = Color.Blue;
+ feature.Geometry.Style = style;
+ //layerBlue.Save();
+ }
+ }
+ break;
+ case "城市紫线":
+ GSOLayer layerPurple = globeControl1.Globe.Layers.GetLayerByCaption(lineType);
+ if (layerPurple != null && layerPurple.GetAllFeatures().Length > 0)
+ {
+ feature = layerPurple.GetAt(layerPurple.GetAllFeatures().Length - 1);
+ if (feature != null)
+ {
+ feature.Name = lineName;
+ GSOSimpleLineStyle3D style = new GSOSimpleLineStyle3D();
+ style.LineColor = Color.Purple;
+ feature.Geometry.Style = style;
+ //layerPurple.Save();
+ }
+ }
+ break;
+ case "城市黑线":
+ GSOLayer layerBlack = globeControl1.Globe.Layers.GetLayerByCaption(lineType);
+ if (layerBlack != null && layerBlack.GetAllFeatures().Length > 0)
+ {
+ feature = layerBlack.GetAt(layerBlack.GetAllFeatures().Length - 1);
+ if (feature != null)
+ {
+ feature.Name = lineName;
+ GSOSimpleLineStyle3D style = new GSOSimpleLineStyle3D();
+ style.LineColor = Color.Black;
+ feature.Geometry.Style = style;
+ //layerBlack.Save();
+ }
+ }
+ break;
+ }
+
+ globeControl1.Globe.DestLayerFeatureAdd = null;
+ }
+ m_AddPipeLine = false;
+ m_isDrawTunnel = false;
+ m_isDrawCitySevenLine = false;
+ if (m_isDrawRedPology && globeControl1.Globe.Action == EnumAction3D.DrawPolygon)//红线工具
+ {
+ GSOLayer layerDest = globeControl1.Globe.DestLayerFeatureAdd;
+ if (layerDest != null)
+ {
+ GSOFeatures features = layerDest.GetAllFeatures();
+ //GSOFeatures features = globeControl1.Globe.MemoryLayer.GetAllFeatures();
+ GSOFeature f = features[features.Length - 1];
+ if (f != null)
+ {
+ GSOGeoPolygon3D polygon = f.Geometry as GSOGeoPolygon3D;
+ if (polygon != null)
+ {
+ GSOSimplePolygonStyle3D geoStyle3d = new GSOSimplePolygonStyle3D();
+ f.Name = (getLabelName(layerDest) + 1).ToString();
+ geoStyle3d.FillColor = Color.Red;
+ polygon.Style = geoStyle3d;
+ GSOLabel label = new GSOLabel();
+ label.Text = "此区域正在施工中!";
+ label.Style = new GSOLabelStyle();
+ label.Style.HasTracktionLine = false;
+ polygon.Label = label;
+
+ globeControl1.Refresh();
+ }
}
}
- m_isDrawRedPology = false;
- globeControl1.Globe.Action = EnumAction3D.ActionNull;
-
-
}
+ m_isDrawRedPology = false;
+ globeControl1.Globe.Action = EnumAction3D.ActionNull;
}
///
@@ -2627,7 +2332,7 @@
}
}
///
- /// (完善)
+ /// (完善)#wxl 待整理
///
///
///
@@ -2907,7 +2612,7 @@
}
///
- /// 鼠标点击, 弹出气泡功能globeControl1
+ /// 鼠标点击, 弹出气泡功能globeControl1 wxl待整理
///
///
///
@@ -2916,34 +2621,30 @@
GSOFeature feature = e.Feature;
string str1 = "";
- if (feature != null)
+ if (feature == null) return;
+ if (feature.GetFieldDefn("图片编码") != null)//
{
- if (feature.GetFieldDefn("图片编码") != null)//
+ str1 = GetBubbleInfo(feature, globeControl1);
+ if (RemoteFileExists(Utility.PicRootURL + feature.GetValue("图片编码")))
{
- str1 = GetBubbleInfo(feature, globeControl1);
- if (RemoteFileExists(Utility.PicRootURL + feature.GetValue("图片编码")))
- {
- str1 += "
";
- }
- else if (RemoteFileExists(Utility.PicDefaultURL))
- {
- str1 += "
";
- }
+ str1 += "
";
}
- else if (isFeatureContainsBianhao(feature)) //管线模型图层
+ else if (RemoteFileExists(Utility.PicDefaultURL))
{
- str1 = GetBubbleInfo(feature, globeControl1);
- }
-
- if (str1 != "")
- {
- featureTooltip.HideBalloon();
- balloonEx.HideBalloon();
- balloonEx.SetSize(EnumSizeIndexEx.CONTENT_CX, 480);
- balloonEx.SetSize(EnumSizeIndexEx.CONTENT_CY, 420);
- balloonEx.ShowBalloon((int)e.MousePos.X, (int)e.MousePos.Y, str1);
+ str1 += "
";
}
}
+ else if (isFeatureContainsBianhao(feature)) //管线模型图层
+ {
+ str1 = GetBubbleInfo(feature, globeControl1);
+ }
+
+ if (str1 == "") return;
+ featureTooltip.HideBalloon();
+ balloonEx.HideBalloon();
+ balloonEx.SetSize(EnumSizeIndexEx.CONTENT_CX, 480);
+ balloonEx.SetSize(EnumSizeIndexEx.CONTENT_CY, 420);
+ balloonEx.ShowBalloon((int)e.MousePos.X, (int)e.MousePos.Y, str1);
}
///
@@ -2956,35 +2657,30 @@
GSOFeature feature = e.Feature;
string str1 = "";
- if (feature != null)
+ if (feature == null) return;
+ if (feature.GetFieldDefn("图片编码") != null) //
{
- if (feature.GetFieldDefn("图片编码") != null) //
+ str1 = GetBubbleInfo(feature, globeControl2);
+ if (RemoteFileExists(Utility.PicRootURL + feature.GetValue("图片编码")))
{
- str1 = GetBubbleInfo(feature, globeControl2);
- if (RemoteFileExists(Utility.PicRootURL + feature.GetValue("图片编码")))
- {
- str1 += "
";
- }
- else if (RemoteFileExists(Utility.PicDefaultURL))
- {
- str1 += "
";
- }
+ str1 += "
";
}
- else if (isFeatureContainsBianhao(feature)) //管线模型图层
+ else if (RemoteFileExists(Utility.PicDefaultURL))
{
- str1 = GetBubbleInfo(feature, globeControl2);
- }
-
- if (str1 != "")
- {
-
- featureTooltip2.HideBalloon();
- balloonEx2.HideBalloon();
- balloonEx2.SetSize(EnumSizeIndexEx.CONTENT_CX, 480);
- balloonEx2.SetSize(EnumSizeIndexEx.CONTENT_CY, 420);
- balloonEx2.ShowBalloon((int)e.MousePos.X, (int)e.MousePos.Y, str1);
+ str1 += "
";
}
}
+ else if (isFeatureContainsBianhao(feature)) //管线模型图层
+ {
+ str1 = GetBubbleInfo(feature, globeControl2);
+ }
+
+ if (str1 == "") return;
+ featureTooltip2.HideBalloon();
+ balloonEx2.HideBalloon();
+ balloonEx2.SetSize(EnumSizeIndexEx.CONTENT_CX, 480);
+ balloonEx2.SetSize(EnumSizeIndexEx.CONTENT_CY, 420);
+ balloonEx2.ShowBalloon((int)e.MousePos.X, (int)e.MousePos.Y, str1);
}
///
@@ -3011,15 +2707,13 @@
for (int i = 0; i < Utility.listPipelineType.Count; i++)
{
PipelineType pipelineType = Utility.listPipelineType[i];
- if (pipelineType != null && pipelineType.code.Trim() == pipelinecode.Trim())
+ if (pipelineType == null || pipelineType.code.Trim() != pipelinecode.Trim()) continue;
+ title = pipelineType.type + " " + pipelineType.name;
+ if (pipelineType.type == pipelineType.name)
{
- title = pipelineType.type + " " + pipelineType.name;
- if (pipelineType.type == pipelineType.name)
- {
- title = pipelineType.type;
- }
- break;
+ title = pipelineType.type;
}
+ break;
}
}
}
@@ -3172,8 +2866,8 @@
return str;
}
- string filename = Utility.filename;
- List g1layername = new List();
+ //string filename = Utility.filename;
+ //List g1layername = new List();
///
/// 获取目标图层
@@ -3229,17 +2923,15 @@
for (int n = 0; n < tempChildNode1.Nodes.Count; n++)
{
TreeNode tempChildNode2 = tempChildNode1.Nodes[n];
- if (tempChildNode2.Tag.ToString().Split('|').Length > 1)
+ if (tempChildNode2.Tag.ToString().Split('|').Length <= 1) continue;
+ GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(tempChildNode2.Tag.ToString().Split('|')[1]);
+ if (layer == null)
{
- GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(tempChildNode2.Tag.ToString().Split('|')[1]);
- if (layer == null)
- {
- continue;
- }
- if (tempChildNode2.Tag != null && layer.IsDestLayerFeatureAdd())
- {
- return tempChildNode2;
- }
+ continue;
+ }
+ if (tempChildNode2.Tag != null && layer.IsDestLayerFeatureAdd())
+ {
+ return tempChildNode2;
}
}
}
@@ -3260,35 +2952,33 @@
//日志记录
LogManager.saveLog(Utility.userName, buttonItem87.Text);
- if (!buttonItem87.Checked)
- {
- buttonItem87.Checked = true;
- buttonItem88.Checked = false;
- buttonItem27.Checked = false;
+ if (buttonItem87.Checked) return;
+ buttonItem87.Checked = true;
+ buttonItem88.Checked = false;
+ buttonItem27.Checked = false;
- switch (globeControl1.Globe.CameraMode)
- {
- case EnumCameraMode.UnderGround:
- globeControl1.Globe.CameraMode = EnumCameraMode.Navigation;
- GSOCameraState state = new GSOCameraState();
- state.AltitudeMode = globeControl1.Globe.CameraState.AltitudeMode;
- state.Altitude = globeControl1.Globe.CameraState.Altitude;
- state.Distance = globeControl1.Globe.CameraState.Distance;
- state.Heading = globeControl1.Globe.CameraState.Heading;
- state.Latitude = globeControl1.Globe.CameraState.Latitude;
- state.Longitude = globeControl1.Globe.CameraState.Longitude;
- if (globeControl1.Globe.CameraState.Tilt < 95 && globeControl1.Globe.CameraState.Tilt > 85)
- state.Tilt = 85;
- else
- state.Tilt = 180 - globeControl1.Globe.CameraState.Tilt;
- globeControl1.Globe.JumpToCameraState(state);
- break;
- case EnumCameraMode.Walk:
- globeControl1.Globe.CameraMode = EnumCameraMode.Navigation;
- break;
- }
- globeControl1.Globe.Refresh();
+ switch (globeControl1.Globe.CameraMode)
+ {
+ case EnumCameraMode.UnderGround:
+ globeControl1.Globe.CameraMode = EnumCameraMode.Navigation;
+ GSOCameraState state = new GSOCameraState();
+ state.AltitudeMode = globeControl1.Globe.CameraState.AltitudeMode;
+ state.Altitude = globeControl1.Globe.CameraState.Altitude;
+ state.Distance = globeControl1.Globe.CameraState.Distance;
+ state.Heading = globeControl1.Globe.CameraState.Heading;
+ state.Latitude = globeControl1.Globe.CameraState.Latitude;
+ state.Longitude = globeControl1.Globe.CameraState.Longitude;
+ if (globeControl1.Globe.CameraState.Tilt < 95 && globeControl1.Globe.CameraState.Tilt > 85)
+ state.Tilt = 85;
+ else
+ state.Tilt = 180 - globeControl1.Globe.CameraState.Tilt;
+ globeControl1.Globe.JumpToCameraState(state);
+ break;
+ case EnumCameraMode.Walk:
+ globeControl1.Globe.CameraMode = EnumCameraMode.Navigation;
+ break;
}
+ globeControl1.Globe.Refresh();
}
///
/// 地下模式 菜单按钮
@@ -3300,33 +2990,31 @@
//日志记录
LogManager.saveLog(Utility.userName, buttonItem88.Text);
- if (!buttonItem88.Checked)
- {
- buttonItem88.Checked = true;
- buttonItem27.Checked = false;
- buttonItem87.Checked = false;
+ if (buttonItem88.Checked) return;
+ buttonItem88.Checked = true;
+ buttonItem27.Checked = false;
+ buttonItem87.Checked = false;
- switch (globeControl1.Globe.CameraMode)
- {
- case EnumCameraMode.Navigation:
- case EnumCameraMode.Walk:
- globeControl1.Globe.CameraMode = EnumCameraMode.UnderGround;
- GSOCameraState state = new GSOCameraState();
- state.AltitudeMode = globeControl1.Globe.CameraState.AltitudeMode;
- state.Altitude = globeControl1.Globe.CameraState.Altitude;
- state.Distance = globeControl1.Globe.CameraState.Distance;
- state.Heading = globeControl1.Globe.CameraState.Heading;
- state.Latitude = globeControl1.Globe.CameraState.Latitude;
- state.Longitude = globeControl1.Globe.CameraState.Longitude;
- if (globeControl1.Globe.CameraState.Tilt < 95 && globeControl1.Globe.CameraState.Tilt > 85)
- state.Tilt = 95;
- else
- state.Tilt = 180 - globeControl1.Globe.CameraState.Tilt;
- globeControl1.Globe.JumpToCameraState(state);
- break;
- }
- globeControl1.Globe.Refresh();
+ switch (globeControl1.Globe.CameraMode)
+ {
+ case EnumCameraMode.Navigation:
+ case EnumCameraMode.Walk:
+ globeControl1.Globe.CameraMode = EnumCameraMode.UnderGround;
+ GSOCameraState state = new GSOCameraState();
+ state.AltitudeMode = globeControl1.Globe.CameraState.AltitudeMode;
+ state.Altitude = globeControl1.Globe.CameraState.Altitude;
+ state.Distance = globeControl1.Globe.CameraState.Distance;
+ state.Heading = globeControl1.Globe.CameraState.Heading;
+ state.Latitude = globeControl1.Globe.CameraState.Latitude;
+ state.Longitude = globeControl1.Globe.CameraState.Longitude;
+ if (globeControl1.Globe.CameraState.Tilt < 95 && globeControl1.Globe.CameraState.Tilt > 85)
+ state.Tilt = 95;
+ else
+ state.Tilt = 180 - globeControl1.Globe.CameraState.Tilt;
+ globeControl1.Globe.JumpToCameraState(state);
+ break;
}
+ globeControl1.Globe.Refresh();
}
///
/// 行走模式 菜单按钮
@@ -3338,14 +3026,12 @@
//日志记录
LogManager.saveLog(Utility.userName, buttonItem27.Text);
- if (!buttonItem27.Checked)
- {
- buttonItem27.Checked = true;
- buttonItem87.Checked = false;
- buttonItem88.Checked = false;
+ if (buttonItem27.Checked) return;
+ buttonItem27.Checked = true;
+ buttonItem87.Checked = false;
+ buttonItem88.Checked = false;
- globeControl1.Globe.CameraMode = EnumCameraMode.Walk;
- }
+ globeControl1.Globe.CameraMode = EnumCameraMode.Walk;
}
///
/// 地面透明度设置 菜单
@@ -3357,7 +3043,7 @@
LogManager.saveLog(Utility.userName, sliderGroundTransSet1.Text);
globeControl1.Globe.GroundOpaque = 100 - sliderGroundTransSet1.Value;
- GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(roadLayerName);//("180fd");
+ GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(Utility.roadLayerName);//("180fd");
if (layer != null)
layer.Opaque = 100 - sliderGroundTransSet1.Value;
optiValue = sliderGroundTransSet1.Value;
@@ -3890,24 +3576,22 @@
///
private void comboBoxEx1_SelectedIndexChanged(object sender, EventArgs e)
{
- if (comboBoxEx1.SelectedIndex > -1)
- {
- dataGridViewX2.Rows.Clear();
- dataGridViewX3.Rows.Clear();
- listBox1.Items.Clear();
- GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(comboBoxEx1.SelectedItem.ToString());
- if (layer == null)
- return;
+ if (comboBoxEx1.SelectedIndex <= -1) return;
+ dataGridViewX2.Rows.Clear();
+ dataGridViewX3.Rows.Clear();
+ listBox1.Items.Clear();
+ GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(comboBoxEx1.SelectedItem.ToString());
+ if (layer == null)
+ return;
- GSOFeatureLayer flayer = layer as GSOFeatureLayer;
- GSOFeatureDataset fdataset = flayer.Dataset as GSOFeatureDataset;
- GSOFeatures feats = flayer.GetAllFeatures();
- for (int i = 0; i < feats.Length; i++)
- {
- int idx = dataGridViewX2.Rows.Add();
- dataGridViewX2.Rows[idx].Cells[0].Value = comboBoxEx1.SelectedItem.ToString();
- dataGridViewX2.Rows[idx].Cells[1].Value = feats[i].Name;
- }
+ GSOFeatureLayer flayer = layer as GSOFeatureLayer;
+ GSOFeatureDataset fdataset = flayer.Dataset as GSOFeatureDataset;
+ GSOFeatures feats = flayer.GetAllFeatures();
+ for (int i = 0; i < feats.Length; i++)
+ {
+ int idx = dataGridViewX2.Rows.Add();
+ dataGridViewX2.Rows[idx].Cells[0].Value = comboBoxEx1.SelectedItem.ToString();
+ dataGridViewX2.Rows[idx].Cells[1].Value = feats[i].Name;
}
}
///
@@ -3917,24 +3601,22 @@
///
private void comboBoxEx1_SelectedIndexChanged_shuiping(object sender, EventArgs e)
{
- if (comboBoxEx4.SelectedIndex > -1)
- {
- dataGridViewX8.Rows.Clear();
- dataGridViewX9.Rows.Clear();
- listBox3.Items.Clear();
- GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(comboBoxEx4.SelectedItem.ToString());
- if (layer == null)
- return;
+ if (comboBoxEx4.SelectedIndex <= -1) return;
+ dataGridViewX8.Rows.Clear();
+ dataGridViewX9.Rows.Clear();
+ listBox3.Items.Clear();
+ GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(comboBoxEx4.SelectedItem.ToString());
+ if (layer == null)
+ return;
- GSOFeatureLayer flayer = layer as GSOFeatureLayer;
- GSOFeatureDataset fdataset = flayer.Dataset as GSOFeatureDataset;
- GSOFeatures feats = flayer.GetAllFeatures();
- for (int i = 0; i < feats.Length; i++)
- {
- int idx = dataGridViewX8.Rows.Add();
- dataGridViewX8.Rows[idx].Cells[0].Value = comboBoxEx4.SelectedItem.ToString();
- dataGridViewX8.Rows[idx].Cells[1].Value = feats[i].Name;
- }
+ GSOFeatureLayer flayer = layer as GSOFeatureLayer;
+ GSOFeatureDataset fdataset = flayer.Dataset as GSOFeatureDataset;
+ GSOFeatures feats = flayer.GetAllFeatures();
+ for (int i = 0; i < feats.Length; i++)
+ {
+ int idx = dataGridViewX8.Rows.Add();
+ dataGridViewX8.Rows[idx].Cells[0].Value = comboBoxEx4.SelectedItem.ToString();
+ dataGridViewX8.Rows[idx].Cells[1].Value = feats[i].Name;
}
}
Dictionary featCount = new Dictionary();
@@ -3984,7 +3666,7 @@
if (selectedFeature != null)
{
selectState = 1;
- VerticalDistanceAnalysis("垂直净距分析", selectedFeature, m_PipelineLayerNames, dJingJuBiaoZhun, 0.0);
+ VerticalDistanceAnalysis("垂直净距分析", selectedFeature, Utility.m_PipelineLayerNames, dJingJuBiaoZhun, 0.0);
}
}
}
@@ -4005,16 +3687,16 @@
for (int i = 0; i < feats.Length; i++)
{
selectState = 1;
- VerticalDistanceAnalysis("垂直净距分析", feats[i], m_PipelineLayerNames, dJingJuBiaoZhun, 0.0);
+ VerticalDistanceAnalysis("垂直净距分析", feats[i], Utility.m_PipelineLayerNames, dJingJuBiaoZhun, 0.0);
}
}
if (featCount.Count > 0)
{
- for (int i = 0; i < m_PipelineLayerNames.Count; i++)
+ for (int i = 0; i < Utility.m_PipelineLayerNames.Count; i++)
{
- if (featCount.ContainsKey(m_PipelineLayerNames[i]) && featLenth.ContainsKey(m_PipelineLayerNames[i]))
+ if (featCount.ContainsKey(Utility.m_PipelineLayerNames[i]) && featLenth.ContainsKey(Utility.m_PipelineLayerNames[i]))
{
- listBox1.Items.Add(m_PipelineLayerNames[i] + ":" + featCount[m_PipelineLayerNames[i]] + "条,共" + featLenth[m_PipelineLayerNames[i]].ToString("0.00") + "米");
+ listBox1.Items.Add(Utility.m_PipelineLayerNames[i] + ":" + featCount[Utility.m_PipelineLayerNames[i]] + "条,共" + featLenth[Utility.m_PipelineLayerNames[i]].ToString("0.00") + "米");
}
}
}
@@ -4130,112 +3812,110 @@
continue;
}
GSOLayer layer2 = globeControl1.Globe.Layers.GetLayerByCaption(_pipelineLayerNames[i]);
- if (layer2 != null)
+ if (layer2 == null) continue;
+ GSOFeatureLayer flayer2 = layer2 as GSOFeatureLayer;
+ GSOFeatureDataset fdataset2 = flayer2.Dataset as GSOFeatureDataset;
+ GSOFeatures feats2 = Polygon_Contain_PointAnalysis(polygon, _pipelineLayerNames[i]);
+ for (int j = 0; j < feats2.Length; j++)
{
- GSOFeatureLayer flayer2 = layer2 as GSOFeatureLayer;
- GSOFeatureDataset fdataset2 = flayer2.Dataset as GSOFeatureDataset;
- GSOFeatures feats2 = Polygon_Contain_PointAnalysis(polygon, _pipelineLayerNames[i]);
- for (int j = 0; j < feats2.Length; j++)
- {
- GSOFeature feat2 = feats2[j];
- GSOGeoPolyline3D line2 = feats2[j].Geometry as GSOGeoPolyline3D;
- if (line2 == null) continue;
- GSOPipeLineStyle3D pipeStyle1 = line1.Style as GSOPipeLineStyle3D;
- GSOPipeLineStyle3D pipeStyle2 = line2.Style as GSOPipeLineStyle3D;
- if (pipeStyle1 == null || pipeStyle2 == null) continue;
+ GSOFeature feat2 = feats2[j];
+ GSOGeoPolyline3D line2 = feats2[j].Geometry as GSOGeoPolyline3D;
+ if (line2 == null) continue;
+ GSOPipeLineStyle3D pipeStyle1 = line1.Style as GSOPipeLineStyle3D;
+ GSOPipeLineStyle3D pipeStyle2 = line2.Style as GSOPipeLineStyle3D;
+ if (pipeStyle1 == null || pipeStyle2 == null) continue;
- double dDist = -1;
- dDist = globeControl1.Globe.Analysis3D.ComputeHorizonDistance(line1, line2, out pntIntersect1, out pntIntersect2, out pntProIntersect1, out pntProIntersect2, false);
+ double dDist = -1;
+ dDist = globeControl1.Globe.Analysis3D.ComputeHorizonDistance(line1, line2, out pntIntersect1, out pntIntersect2, out pntProIntersect1, out pntProIntersect2, false);
- if (dDist > -1)
+ if (dDist > -1)
+ {
+ dDist = Math.Abs(pntIntersect1.Z - pntIntersect2.Z) - pipeStyle1.Radius - pipeStyle2.Radius;//获得净距值
+
+ if (dDist < verticalDistance)
{
- dDist = Math.Abs(pntIntersect1.Z - pntIntersect2.Z) - pipeStyle1.Radius - pipeStyle2.Radius;//获得净距值
-
- if (dDist < verticalDistance)
+ int idx = -1;
+ GSOPoint3d markerPosition = new GSOPoint3d();
+ if (type == "垂直净距分析")
{
- int idx = -1;
- GSOPoint3d markerPosition = new GSOPoint3d();
- if (type == "垂直净距分析")
- {
- feat2.HighLight = true;
- markerPosition = LabelVerticalDistance(layerTemp, pntIntersect1, pntIntersect2, dDist, true);
+ feat2.HighLight = true;
+ markerPosition = LabelVerticalDistance(layerTemp, pntIntersect1, pntIntersect2, dDist, true);
- idx = dataGridViewX3.Rows.Add();
- dataGridViewX3.Rows[idx].Cells[0].Value = caption;
- dataGridViewX3.Rows[idx].Cells[1].Value = selectedFeature.Name;
- dataGridViewX3.Rows[idx].Cells[2].Value = layer2.Caption;
- dataGridViewX3.Rows[idx].Cells[3].Value = feat2.Name;
- dataGridViewX3.Rows[idx].Cells[4].Value = dDist.ToString("0.00");
- }
- else if (type == "碰撞分析")
- {
- feat2.HighLight = true;
- markerPosition = LabelVerticalDistance(layerTemp, pntIntersect1, pntIntersect2, dDist, false);
+ idx = dataGridViewX3.Rows.Add();
+ dataGridViewX3.Rows[idx].Cells[0].Value = caption;
+ dataGridViewX3.Rows[idx].Cells[1].Value = selectedFeature.Name;
+ dataGridViewX3.Rows[idx].Cells[2].Value = layer2.Caption;
+ dataGridViewX3.Rows[idx].Cells[3].Value = feat2.Name;
+ dataGridViewX3.Rows[idx].Cells[4].Value = dDist.ToString("0.00");
+ }
+ else if (type == "碰撞分析")
+ {
+ feat2.HighLight = true;
+ markerPosition = LabelVerticalDistance(layerTemp, pntIntersect1, pntIntersect2, dDist, false);
- selectedFeature.HighLight = true;
- idx = dataGridViewX5.Rows.Add();
- dataGridViewX5.Rows[idx].Cells[0].Value = dataGridViewX4.Rows[0].Cells[0].Value.ToString();
- dataGridViewX5.Rows[idx].Cells[1].Value = selectedFeature.Name;
- dataGridViewX5.Rows[idx].Cells[2].Value = layer2.Caption;
- dataGridViewX5.Rows[idx].Cells[3].Value = feat2.Name;
- }
- else if (type == "间距分析")
+ selectedFeature.HighLight = true;
+ idx = dataGridViewX5.Rows.Add();
+ dataGridViewX5.Rows[idx].Cells[0].Value = dataGridViewX4.Rows[0].Cells[0].Value.ToString();
+ dataGridViewX5.Rows[idx].Cells[1].Value = selectedFeature.Name;
+ dataGridViewX5.Rows[idx].Cells[2].Value = layer2.Caption;
+ dataGridViewX5.Rows[idx].Cells[3].Value = feat2.Name;
+ }
+ else if (type == "间距分析")
+ {
+ GSOGeoPolygon3D polygonSpacing = line2.CreateBuffer(horizontalDistance, true, 5, false, false);
+ if (polygonSpacing != null)
{
- GSOGeoPolygon3D polygonSpacing = line2.CreateBuffer(horizontalDistance, true, 5, false, false);
- if (polygonSpacing != null)
+ GSOFeatures horizontalFeatures = layer2.FindFeaturesInPolygon(polygonSpacing, false);
+ if (horizontalFeatures != null)
{
- GSOFeatures horizontalFeatures = layer2.FindFeaturesInPolygon(polygonSpacing, false);
- if (horizontalFeatures != null)
+ for (int m = 0; m < horizontalFeatures.Length; m++)
{
- for (int m = 0; m < horizontalFeatures.Length; m++)
+ GSOFeature horizontalFeature = horizontalFeatures[m];
+ if (horizontalFeature != null && horizontalFeature.ID == feat2.ID)
{
- GSOFeature horizontalFeature = horizontalFeatures[m];
- if (horizontalFeature != null && horizontalFeature.ID == feat2.ID)
- {
- feat2.HighLight = true;
- idx = dataGridViewAnalysisResult.Rows.Add();
- dataGridViewAnalysisResult.Rows[idx].Tag = feat2;
- dataGridViewAnalysisResult.Rows[idx].Cells[0].Value = dataGridViewLineList.Rows[0].Cells[0].Value.ToString();
- dataGridViewAnalysisResult.Rows[idx].Cells[1].Value = selectedFeature.Name;
- dataGridViewAnalysisResult.Rows[idx].Cells[2].Value = layer2.Caption;
- dataGridViewAnalysisResult.Rows[idx].Cells[3].Value = feat2.Name;
- dataGridViewAnalysisResult.Rows[idx].Cells[4].Value = dDist.ToString("0.00");
- dataGridViewAnalysisResult.Rows[idx].Cells[5].Value = horizontalDistance.ToString("0.00");
- break;
- }
+ feat2.HighLight = true;
+ idx = dataGridViewAnalysisResult.Rows.Add();
+ dataGridViewAnalysisResult.Rows[idx].Tag = feat2;
+ dataGridViewAnalysisResult.Rows[idx].Cells[0].Value = dataGridViewLineList.Rows[0].Cells[0].Value.ToString();
+ dataGridViewAnalysisResult.Rows[idx].Cells[1].Value = selectedFeature.Name;
+ dataGridViewAnalysisResult.Rows[idx].Cells[2].Value = layer2.Caption;
+ dataGridViewAnalysisResult.Rows[idx].Cells[3].Value = feat2.Name;
+ dataGridViewAnalysisResult.Rows[idx].Cells[4].Value = dDist.ToString("0.00");
+ dataGridViewAnalysisResult.Rows[idx].Cells[5].Value = horizontalDistance.ToString("0.00");
+ break;
}
}
}
}
+ }
- if (m_FeaturesWithBianhao.ContainsKey(selectedFeature.Name + "-" + feats2[j].Name) == false)
- {
- m_FeaturesWithBianhao.Add(selectedFeature.Name + "-" + feats2[j].Name, markerPosition);//添加飞行位置记录
- }
+ if (m_FeaturesWithBianhao.ContainsKey(selectedFeature.Name + "-" + feats2[j].Name) == false)
+ {
+ m_FeaturesWithBianhao.Add(selectedFeature.Name + "-" + feats2[j].Name, markerPosition);//添加飞行位置记录
+ }
- if (featCount.ContainsKey(layer2.Caption))
- {
- featCount[layer2.Caption] = featCount[layer2.Caption] + 1;
- }
- else
- {
- featCount.Add(layer2.Caption, 1);
- }
- if (featLenth.ContainsKey(layer2.Caption))
- {
- featLenth[layer2.Caption] = featLenth[layer2.Caption] + line2.GetSpaceLength(true, 6378137);
- }
- else
- {
- featLenth.Add(layer2.Caption, line2.GetSpaceLength(true, 6378137));
- }
+ if (featCount.ContainsKey(layer2.Caption))
+ {
+ featCount[layer2.Caption] = featCount[layer2.Caption] + 1;
+ }
+ else
+ {
+ featCount.Add(layer2.Caption, 1);
+ }
+ if (featLenth.ContainsKey(layer2.Caption))
+ {
+ featLenth[layer2.Caption] = featLenth[layer2.Caption] + line2.GetSpaceLength(true, 6378137);
+ }
+ else
+ {
+ featLenth.Add(layer2.Caption, line2.GetSpaceLength(true, 6378137));
}
}
- line2.ReleaseInnerPointer();
- feat2.ReleaseInnerPointer();
}
- feats2.ReleaseInnerPointer();
+ line2.ReleaseInnerPointer();
+ feat2.ReleaseInnerPointer();
}
+ feats2.ReleaseInnerPointer();
}
line1.ReleaseInnerPointer();
selectedFeature.ReleaseInnerPointer();
@@ -4302,7 +3982,7 @@
if (selectedFeature != null)
{
selectState = 1;
- HorizontalDistanceAnalysis(selectedFeature, m_PipelineLayerNames, dJingJuBiaoZhun);
+ HorizontalDistanceAnalysis(selectedFeature, Utility.m_PipelineLayerNames, dJingJuBiaoZhun);
}
}
}
@@ -4317,16 +3997,16 @@
GSOFeatures feats = flayer.GetAllFeatures();
for (int i = 0; i < feats.Length; i++)
{
- HorizontalDistanceAnalysis(feats[i], m_PipelineLayerNames, dJingJuBiaoZhun);
+ HorizontalDistanceAnalysis(feats[i], Utility.m_PipelineLayerNames, dJingJuBiaoZhun);
}
}
if (featCount.Count > 0) //统计结果
{
- for (int i = 0; i < m_PipelineLayerNames.Count; i++)
+ for (int i = 0; i < Utility.m_PipelineLayerNames.Count; i++)
{
- if (featCount.ContainsKey(m_PipelineLayerNames[i]) && featLenth.ContainsKey(m_PipelineLayerNames[i]))
+ if (featCount.ContainsKey(Utility.m_PipelineLayerNames[i]) && featLenth.ContainsKey(Utility.m_PipelineLayerNames[i]))
{
- listBox3.Items.Add(m_PipelineLayerNames[i] + ":" + featCount[m_PipelineLayerNames[i]] + "条,共" + featLenth[m_PipelineLayerNames[i]].ToString("0.00") + "米");
+ listBox3.Items.Add(Utility.m_PipelineLayerNames[i] + ":" + featCount[Utility.m_PipelineLayerNames[i]] + "条,共" + featLenth[Utility.m_PipelineLayerNames[i]].ToString("0.00") + "米");
}
}
}
@@ -4381,51 +4061,49 @@
continue;
}
GSOLayer layer2 = globeControl1.Globe.Layers.GetLayerByCaption(_pipelineLayerNames[i]);
- if (layer2 != null)
+ if (layer2 == null) continue;
+ GSOFeatureLayer flayer2 = layer2 as GSOFeatureLayer;
+ GSOFeatureDataset fdataset2 = flayer2.Dataset as GSOFeatureDataset;
+ GSOFeatures feats2 = Polygon_Contain_PointAnalysis(polygon, _pipelineLayerNames[i]);
+ for (int j = 0; j < feats2.Length; j++)
{
- GSOFeatureLayer flayer2 = layer2 as GSOFeatureLayer;
- GSOFeatureDataset fdataset2 = flayer2.Dataset as GSOFeatureDataset;
- GSOFeatures feats2 = Polygon_Contain_PointAnalysis(polygon, _pipelineLayerNames[i]);
- for (int j = 0; j < feats2.Length; j++)
+ GSOFeature feat2 = feats2[j];
+ GSOGeoPolyline3D line2 = feats2[j].Geometry as GSOGeoPolyline3D;
+ if (line2 == null)
{
- GSOFeature feat2 = feats2[j];
- GSOGeoPolyline3D line2 = feats2[j].Geometry as GSOGeoPolyline3D;
- if (line2 == null)
- {
- continue;
- }
- GSOPipeLineStyle3D pipeStyle1 = line1.Style as GSOPipeLineStyle3D;
- GSOPipeLineStyle3D pipeStyle2 = line2.Style as GSOPipeLineStyle3D;
- if (pipeStyle1 == null || pipeStyle2 == null)
- {
- continue;
- }
+ continue;
+ }
+ GSOPipeLineStyle3D pipeStyle1 = line1.Style as GSOPipeLineStyle3D;
+ GSOPipeLineStyle3D pipeStyle2 = line2.Style as GSOPipeLineStyle3D;
+ if (pipeStyle1 == null || pipeStyle2 == null)
+ {
+ continue;
+ }
- feat2.HighLight = true;
- int idx = dataGridViewX9.Rows.Add();
- dataGridViewX9.Rows[idx].Tag = feat2;
- dataGridViewX9.Rows[idx].Cells[0].Value = caption;
- dataGridViewX9.Rows[idx].Cells[1].Value = selectedFeature.Name;
- dataGridViewX9.Rows[idx].Cells[2].Value = layer2.Caption;
- dataGridViewX9.Rows[idx].Cells[3].Value = feats2[j].Name;
- dataGridViewX9.Rows[idx].Cells[4].Value = dis.ToString("0.00");
+ feat2.HighLight = true;
+ int idx = dataGridViewX9.Rows.Add();
+ dataGridViewX9.Rows[idx].Tag = feat2;
+ dataGridViewX9.Rows[idx].Cells[0].Value = caption;
+ dataGridViewX9.Rows[idx].Cells[1].Value = selectedFeature.Name;
+ dataGridViewX9.Rows[idx].Cells[2].Value = layer2.Caption;
+ dataGridViewX9.Rows[idx].Cells[3].Value = feats2[j].Name;
+ dataGridViewX9.Rows[idx].Cells[4].Value = dis.ToString("0.00");
- if (featCount.ContainsKey(layer2.Caption))
- {
- featCount[layer2.Caption] = featCount[layer2.Caption] + 1;
- }
- else
- {
- featCount.Add(layer2.Caption, 1);
- }
- if (featLenth.ContainsKey(layer2.Caption))
- {
- featLenth[layer2.Caption] = featLenth[layer2.Caption] + line2.GetSpaceLength(true, 6378137);
- }
- else
- {
- featLenth.Add(layer2.Caption, line2.GetSpaceLength(true, 6378137));
- }
+ if (featCount.ContainsKey(layer2.Caption))
+ {
+ featCount[layer2.Caption] = featCount[layer2.Caption] + 1;
+ }
+ else
+ {
+ featCount.Add(layer2.Caption, 1);
+ }
+ if (featLenth.ContainsKey(layer2.Caption))
+ {
+ featLenth[layer2.Caption] = featLenth[layer2.Caption] + line2.GetSpaceLength(true, 6378137);
+ }
+ else
+ {
+ featLenth.Add(layer2.Caption, line2.GetSpaceLength(true, 6378137));
}
}
}
@@ -4437,29 +4115,23 @@
///
private void dataGridViewX9_MouseDoubleClick(object sender, MouseEventArgs e)
{
- if (e.Button == MouseButtons.Left)
+ if (e.Button != MouseButtons.Left) return;
+ DataGridView.HitTestInfo hittestinfo = dataGridViewX9.HitTest(e.X, e.Y);
+ if (hittestinfo.RowIndex <= -1) return;
+ GSOFeature rowFeature = dataGridViewX9.Rows[hittestinfo.RowIndex].Tag as GSOFeature;
+ if (rowFeature == null) return;
+ if (rowFeature.Geometry != null && rowFeature.Geometry.Type == EnumGeometryType.GeoPolyline3D)
{
- DataGridView.HitTestInfo hittestinfo = dataGridViewX9.HitTest(e.X, e.Y);
- if (hittestinfo.RowIndex > -1)
- {
- GSOFeature rowFeature = dataGridViewX9.Rows[hittestinfo.RowIndex].Tag as GSOFeature;
- if (rowFeature != null)
- {
- if (rowFeature.Geometry != null && rowFeature.Geometry.Type == EnumGeometryType.GeoPolyline3D)
- {
- GSOGeoPolyline3D line = rowFeature.Geometry as GSOGeoPolyline3D;
- double length = line.GetSpaceLength(true, 6378137);
- GSOGeoPolyline3D lineLine = line.GetSegment(0, length / 2);
- GSOPoint3d point3d = lineLine[lineLine.PartCount - 1][lineLine[lineLine.PartCount - 1].Count - 1];
+ GSOGeoPolyline3D line = rowFeature.Geometry as GSOGeoPolyline3D;
+ double length = line.GetSpaceLength(true, 6378137);
+ GSOGeoPolyline3D lineLine = line.GetSegment(0, length / 2);
+ GSOPoint3d point3d = lineLine[lineLine.PartCount - 1][lineLine[lineLine.PartCount - 1].Count - 1];
- globeControl1.Globe.JumpToPosition(point3d, EnumAltitudeMode.Absolute, 5);
- }
- else
- {
- globeControl1.Globe.JumpToFeature(rowFeature, 5);
- }
- }
- }
+ globeControl1.Globe.JumpToPosition(point3d, EnumAltitudeMode.Absolute, 5);
+ }
+ else
+ {
+ globeControl1.Globe.JumpToFeature(rowFeature, 5);
}
}
///
@@ -4494,7 +4166,7 @@
if (selectedFeature != null)
{
selectState = 1;
- VerticalDistanceAnalysis("碰撞分析", selectedFeature, m_PipelineLayerNames, 0, 0.0);
+ VerticalDistanceAnalysis("碰撞分析", selectedFeature, Utility.m_PipelineLayerNames, 0, 0.0);
}
}
}
@@ -4510,17 +4182,17 @@
for (int i = 0; i < feats.Length; i++)
{
selectState = 1;
- VerticalDistanceAnalysis("碰撞分析", feats[i], m_PipelineLayerNames, 0, 0.0);
+ VerticalDistanceAnalysis("碰撞分析", feats[i], Utility.m_PipelineLayerNames, 0, 0.0);
}
}
if (featCount.Count > 0)
{
- for (int i = 0; i < m_PipelineLayerNames.Count; i++)
+ for (int i = 0; i < Utility.m_PipelineLayerNames.Count; i++)
{
- if (featCount.ContainsKey(m_PipelineLayerNames[i]) && featLenth.ContainsKey(m_PipelineLayerNames[i]))
+ if (featCount.ContainsKey(Utility.m_PipelineLayerNames[i]) && featLenth.ContainsKey(Utility.m_PipelineLayerNames[i]))
{
- listBox2.Items.Add(m_PipelineLayerNames[i] + ":" + featCount[m_PipelineLayerNames[i]] + "条,共" + featLenth[m_PipelineLayerNames[i]].ToString("0.00") + "米");
+ listBox2.Items.Add(Utility.m_PipelineLayerNames[i] + ":" + featCount[Utility.m_PipelineLayerNames[i]] + "条,共" + featLenth[Utility.m_PipelineLayerNames[i]].ToString("0.00") + "米");
}
}
}
@@ -4543,17 +4215,13 @@
///
private void dataGridViewX5_MouseDoubleClick(object sender, MouseEventArgs e)
{
- if (e.Button == MouseButtons.Left)
+ if (e.Button != MouseButtons.Left) return;
+ DataGridView.HitTestInfo hittestinfo = dataGridViewX5.HitTest(e.X, e.Y);
+ if (hittestinfo.RowIndex <= -1) return;
+ string key = dataGridViewX5.Rows[hittestinfo.RowIndex].Cells[1].Value.ToString().Trim() + "-" + dataGridViewX5.Rows[hittestinfo.RowIndex].Cells[3].Value.ToString().Trim();
+ if (m_FeaturesWithBianhao.ContainsKey(key))
{
- DataGridView.HitTestInfo hittestinfo = dataGridViewX5.HitTest(e.X, e.Y);
- if (hittestinfo.RowIndex > -1)
- {
- string key = dataGridViewX5.Rows[hittestinfo.RowIndex].Cells[1].Value.ToString().Trim() + "-" + dataGridViewX5.Rows[hittestinfo.RowIndex].Cells[3].Value.ToString().Trim();
- if (m_FeaturesWithBianhao.ContainsKey(key))
- {
- globeControl1.Globe.JumpToPosition(m_FeaturesWithBianhao[key], EnumAltitudeMode.Absolute, 5);
- }
- }
+ globeControl1.Globe.JumpToPosition(m_FeaturesWithBianhao[key], EnumAltitudeMode.Absolute, 5);
}
}
///
@@ -4611,25 +4279,23 @@
///
private void comboBoxEx3_SelectedIndexChanged(object sender, EventArgs e)
{
- if (comboBoxEx3.SelectedIndex > -1)
+ if (comboBoxEx3.SelectedIndex <= -1) return;
+ dataGridViewX6.Rows.Clear();
+ dataGridViewX7.Rows.Clear();
+
+ GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(comboBoxEx3.SelectedItem.ToString());
+ if (layer == null)
+ return;
+
+ GSOFeatureLayer flayer = layer as GSOFeatureLayer;
+ GSOFeatureDataset fdataset = flayer.Dataset as GSOFeatureDataset;
+ GSOFeatures feats = flayer.GetAllFeatures();
+
+ for (int i = 0; i < feats.Length; i++)
{
- dataGridViewX6.Rows.Clear();
- dataGridViewX7.Rows.Clear();
-
- GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(comboBoxEx3.SelectedItem.ToString());
- if (layer == null)
- return;
-
- GSOFeatureLayer flayer = layer as GSOFeatureLayer;
- GSOFeatureDataset fdataset = flayer.Dataset as GSOFeatureDataset;
- GSOFeatures feats = flayer.GetAllFeatures();
-
- for (int i = 0; i < feats.Length; i++)
- {
- int idx = dataGridViewX6.Rows.Add();
- dataGridViewX6.Rows[idx].Cells[0].Value = comboBoxEx3.SelectedItem.ToString();
- dataGridViewX6.Rows[idx].Cells[1].Value = feats[i].Name;
- }
+ int idx = dataGridViewX6.Rows.Add();
+ dataGridViewX6.Rows[idx].Cells[0].Value = comboBoxEx3.SelectedItem.ToString();
+ dataGridViewX6.Rows[idx].Cells[1].Value = feats[i].Name;
}
}
///
@@ -4670,51 +4336,47 @@
for (int i = 0; i < dataGridViewX6.Rows.Count; i++)
{
GSOFeature rowFeature = dataGridViewX6.Rows[i].Tag as GSOFeature;
- if (rowFeature != null)
+ if (rowFeature == null) continue;
+ string featureName = "";
+ if (isFeatureContainsBianhao(rowFeature))//判断rowFeature是否包含“编号”字段
{
- string featureName = "";
- if (isFeatureContainsBianhao(rowFeature))//判断rowFeature是否包含“编号”字段
- {
- featureName = rowFeature.GetValue(featureIDFieldName).ToString();
- }
- else
- {
- featureName = rowFeature.Name;
- }
+ featureName = rowFeature.GetValue(featureIDFieldName).ToString();
+ }
+ else
+ {
+ featureName = rowFeature.Name;
+ }
- GSOGeoPolyline3D line = rowFeature.Geometry as GSOGeoPolyline3D;
- if (line == null)
- {
- continue;
- }
- GSOPipeLineStyle3D style = line.Style as GSOPipeLineStyle3D;
- if (style == null)
- {
- continue;
- }
- if (line.PartCount > 0)
- {
- GSOPoint3ds pts = line[0];
- GSOPoint3d pt = new GSOPoint3d();
+ GSOGeoPolyline3D line = rowFeature.Geometry as GSOGeoPolyline3D;
+ if (line == null)
+ {
+ continue;
+ }
+ GSOPipeLineStyle3D style = line.Style as GSOPipeLineStyle3D;
+ if (style == null)
+ {
+ continue;
+ }
+ if (line.PartCount <= 0) continue;
+ GSOPoint3ds pts = line[0];
+ GSOPoint3d pt = new GSOPoint3d();
- for (int m = 0; m < pts.Count; m++)
- {
- if (Math.Abs(pts[m].Z + (style.Radius)) < Convert.ToDouble(textBoxX3.Text.Trim()))
- {
- rowFeature.HighLight = true;
- int idx = dataGridViewX7.Rows.Add();
- dataGridViewX7.Rows[idx].Tag = rowFeature;
- dataGridViewX7.Rows[idx].Cells[0].Value = rowFeature.Dataset.Caption;
- dataGridViewX7.Rows[idx].Cells[1].Value = featureName;
- dataGridViewX7.Rows[idx].Cells[2].Value = Math.Abs((pts[m].Z + (style.Radius))).ToString("0.00");
+ for (int m = 0; m < pts.Count; m++)
+ {
+ if (Math.Abs(pts[m].Z + (style.Radius)) < Convert.ToDouble(textBoxX3.Text.Trim()))
+ {
+ rowFeature.HighLight = true;
+ int idx = dataGridViewX7.Rows.Add();
+ dataGridViewX7.Rows[idx].Tag = rowFeature;
+ dataGridViewX7.Rows[idx].Cells[0].Value = rowFeature.Dataset.Caption;
+ dataGridViewX7.Rows[idx].Cells[1].Value = featureName;
+ dataGridViewX7.Rows[idx].Cells[2].Value = Math.Abs((pts[m].Z + (style.Radius))).ToString("0.00");
- pt.X = pts[m].X;
- pt.Y = pts[m].Y;
- pt.Z = 0;
- markerPosition = LabelVerticalDistance(layerTemp, pts[m], pt, Convert.ToDouble(dataGridViewX7.Rows[idx].Cells[2].Value), true);
- break;
- }
- }
+ pt.X = pts[m].X;
+ pt.Y = pts[m].Y;
+ pt.Z = 0;
+ markerPosition = LabelVerticalDistance(layerTemp, pts[m], pt, Convert.ToDouble(dataGridViewX7.Rows[idx].Cells[2].Value), true);
+ break;
}
}
}
@@ -4743,29 +4405,26 @@
GSOGeoPolyline3D line = f.Geometry as GSOGeoPolyline3D;
if (line == null) continue;
GSOPipeLineStyle3D style = line.Style as GSOPipeLineStyle3D;
- if (style == null) continue;
- if (line.PartCount > 0)
+ if (style == null || line.PartCount <= 0) continue;
+ GSOPoint3ds pts = line[0];
+ GSOPoint3d pt = new GSOPoint3d();
+ for (int m = 0; m < pts.Count; m++)
{
- GSOPoint3ds pts = line[0];
- GSOPoint3d pt = new GSOPoint3d();
- for (int m = 0; m < pts.Count; m++)
+ if (Math.Abs(pts[m].Z + (style.Radius)) < Convert.ToDouble(textBoxX3.Text.Trim()))
{
- if (Math.Abs(pts[m].Z + (style.Radius)) < Convert.ToDouble(textBoxX3.Text.Trim()))
- {
- f.HighLight = true;
- int idx = dataGridViewX7.Rows.Add();
- dataGridViewX7.Rows[idx].Tag = f;
- dataGridViewX7.Rows[idx].Cells[0].Value = layer.Caption;
- dataGridViewX7.Rows[idx].Cells[1].Value = featureName;
- dataGridViewX7.Rows[idx].Cells[2].Value = Math.Abs((pts[m].Z + (style.Radius))).ToString("0.00");
+ f.HighLight = true;
+ int idx = dataGridViewX7.Rows.Add();
+ dataGridViewX7.Rows[idx].Tag = f;
+ dataGridViewX7.Rows[idx].Cells[0].Value = layer.Caption;
+ dataGridViewX7.Rows[idx].Cells[1].Value = featureName;
+ dataGridViewX7.Rows[idx].Cells[2].Value = Math.Abs((pts[m].Z + (style.Radius))).ToString("0.00");
- pt.X = pts[m].X;
- pt.Y = pts[m].Y;
- pt.Z = 0;
- markerPosition = LabelVerticalDistance(layerTemp, pts[m], pt, Convert.ToDouble(dataGridViewX7.Rows[idx].Cells[2].Value), true);
+ pt.X = pts[m].X;
+ pt.Y = pts[m].Y;
+ pt.Z = 0;
+ markerPosition = LabelVerticalDistance(layerTemp, pts[m], pt, Convert.ToDouble(dataGridViewX7.Rows[idx].Cells[2].Value), true);
- break;
- }
+ break;
}
}
}
@@ -4789,29 +4448,23 @@
///
private void dataGridViewX7_MouseDoubleClick(object sender, MouseEventArgs e)
{
- if (e.Button == MouseButtons.Left)
+ if (e.Button != MouseButtons.Left) return;
+ DataGridView.HitTestInfo hittestinfo = dataGridViewX7.HitTest(e.X, e.Y);
+ if (hittestinfo.RowIndex <= -1) return;
+ GSOFeature rowFeature = dataGridViewX7.Rows[hittestinfo.RowIndex].Tag as GSOFeature;
+ if (rowFeature == null) return;
+ if (rowFeature.Geometry != null && rowFeature.Geometry.Type == EnumGeometryType.GeoPolyline3D)
{
- DataGridView.HitTestInfo hittestinfo = dataGridViewX7.HitTest(e.X, e.Y);
- if (hittestinfo.RowIndex > -1)
- {
- GSOFeature rowFeature = dataGridViewX7.Rows[hittestinfo.RowIndex].Tag as GSOFeature;
- if (rowFeature != null)
- {
- if (rowFeature.Geometry != null && rowFeature.Geometry.Type == EnumGeometryType.GeoPolyline3D)
- {
- GSOGeoPolyline3D line = rowFeature.Geometry as GSOGeoPolyline3D;
- double length = line.GetSpaceLength(true, 6378137);
- GSOGeoPolyline3D lineLine = line.GetSegment(0, length / 2);
- GSOPoint3d point3d = lineLine[lineLine.PartCount - 1][lineLine[lineLine.PartCount - 1].Count - 1];
+ GSOGeoPolyline3D line = rowFeature.Geometry as GSOGeoPolyline3D;
+ double length = line.GetSpaceLength(true, 6378137);
+ GSOGeoPolyline3D lineLine = line.GetSegment(0, length / 2);
+ GSOPoint3d point3d = lineLine[lineLine.PartCount - 1][lineLine[lineLine.PartCount - 1].Count - 1];
- globeControl1.Globe.JumpToPosition(point3d, EnumAltitudeMode.Absolute, 5);
- }
- else
- {
- globeControl1.Globe.JumpToFeature(rowFeature, 5);
- }
- }
- }
+ globeControl1.Globe.JumpToPosition(point3d, EnumAltitudeMode.Absolute, 5);
+ }
+ else
+ {
+ globeControl1.Globe.JumpToFeature(rowFeature, 5);
}
}
///
@@ -4972,85 +4625,83 @@
///
private void ExportExcel(string type, DataGridView _dataGridView, ListBox _listBox)
{
- if (_dataGridView.Rows.Count > 0)
+ if (_dataGridView.Rows.Count <= 0) return;
+ SaveFileDialog dlg = new SaveFileDialog();
+ dlg.Filter = "Excel files (*.xls)|*.xls";
+ dlg.FilterIndex = 0;
+ dlg.RestoreDirectory = true;
+ //dlg.CreatePrompt = true;
+ dlg.Title = "保存为Excel文件";
+ dlg.FileName = type + "-" + DateTime.Now.ToString("yyyyMMdd") + ".xls";
+ if (dlg.ShowDialog() == DialogResult.OK)
{
- SaveFileDialog dlg = new SaveFileDialog();
- dlg.Filter = "Excel files (*.xls)|*.xls";
- dlg.FilterIndex = 0;
- dlg.RestoreDirectory = true;
- //dlg.CreatePrompt = true;
- dlg.Title = "保存为Excel文件";
- dlg.FileName = type + "-" + DateTime.Now.ToString("yyyyMMdd") + ".xls";
- if (dlg.ShowDialog() == DialogResult.OK)
+ Stream myStream;
+ myStream = dlg.OpenFile();
+ StreamWriter sw = new StreamWriter(myStream, Encoding.GetEncoding(-0));
+ string columnTitle = "";
+ try
{
- Stream myStream;
- myStream = dlg.OpenFile();
- StreamWriter sw = new StreamWriter(myStream, Encoding.GetEncoding(-0));
- string columnTitle = "";
- try
+ if (_listBox != null)
{
- if (_listBox != null)
+ string strList = "";
+ for (int i = 0; i < _listBox.Items.Count; i++)
{
- string strList = "";
- for (int i = 0; i < _listBox.Items.Count; i++)
- {
- strList += _listBox.Items[i] + @"/";
- }
- sw.WriteLine("内容:" + type + " 日期:" + DateTime.Now.ToString("yyyy-MM-dd") + " 结果:" + strList);
+ strList += _listBox.Items[i] + @"/";
}
- else
+ sw.WriteLine("内容:" + type + " 日期:" + DateTime.Now.ToString("yyyy-MM-dd") + " 结果:" + strList);
+ }
+ else
+ {
+ sw.WriteLine("内容:" + type + " 日期:" + DateTime.Now.ToString("yyyy-MM-dd"));
+ }
+ //写入列标题
+ for (int i = 0; i < _dataGridView.ColumnCount; i++)
+ {
+ if (i > 0)
{
- sw.WriteLine("内容:" + type + " 日期:" + DateTime.Now.ToString("yyyy-MM-dd"));
+ columnTitle += "\t";
}
- //写入列标题
- for (int i = 0; i < _dataGridView.ColumnCount; i++)
- {
- if (i > 0)
- {
- columnTitle += "\t";
- }
- columnTitle += _dataGridView.Columns[i].HeaderText;
- }
- sw.WriteLine(columnTitle);
+ columnTitle += _dataGridView.Columns[i].HeaderText;
+ }
+ sw.WriteLine(columnTitle);
- //写入列内容
- for (int j = 0; j < _dataGridView.Rows.Count; j++)
+ //写入列内容
+ for (int j = 0; j < _dataGridView.Rows.Count; j++)
+ {
+ string columnValue = "";
+ for (int k = 0; k < _dataGridView.Columns.Count; k++)
{
- string columnValue = "";
- for (int k = 0; k < _dataGridView.Columns.Count; k++)
+ if (k > 0)
{
- if (k > 0)
- {
- columnValue += "\t";
- }
- if (_dataGridView.Rows[j].Cells[k].Value == null)
- {
- columnValue += "";
- }
- else
- {
- columnValue += _dataGridView.Rows[j].Cells[k].Value.ToString().Trim();
- }
+ columnValue += "\t";
}
+ if (_dataGridView.Rows[j].Cells[k].Value == null)
+ {
+ columnValue += "";
+ }
+ else
+ {
+ columnValue += _dataGridView.Rows[j].Cells[k].Value.ToString().Trim();
+ }
+ }
- sw.WriteLine(columnValue);
- }
- sw.Close();
- myStream.Close();
- if (MessageBox.Show("导出Excel文件成功!是否打开?", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
- {
- Process.Start(dlg.FileName);
- }
+ sw.WriteLine(columnValue);
}
- catch (Exception ex)
+ sw.Close();
+ myStream.Close();
+ if (MessageBox.Show("导出Excel文件成功!是否打开?", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
{
- //MessageBox.Show(ex.ToString());
+ Process.Start(dlg.FileName);
}
- finally
- {
- sw.Close();
- myStream.Close();
- }
+ }
+ catch (Exception ex)
+ {
+ //MessageBox.Show(ex.ToString());
+ }
+ finally
+ {
+ sw.Close();
+ myStream.Close();
}
}
}
@@ -5141,24 +4792,22 @@
///
private void comboBoxEx2_SelectedIndexChanged(object sender, EventArgs e)
{
- if (comboBoxEx2.SelectedIndex > -1)
- {
- listBox2.Items.Clear();
- dataGridViewX4.Rows.Clear();
- dataGridViewX5.Rows.Clear();
- GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(comboBoxEx2.SelectedItem.ToString());
- if (layer == null)
- return;
+ if (comboBoxEx2.SelectedIndex <= -1) return;
+ listBox2.Items.Clear();
+ dataGridViewX4.Rows.Clear();
+ dataGridViewX5.Rows.Clear();
+ GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(comboBoxEx2.SelectedItem.ToString());
+ if (layer == null)
+ return;
- GSOFeatureLayer flayer = layer as GSOFeatureLayer;
- GSOFeatureDataset fdataset = flayer.Dataset as GSOFeatureDataset;
- GSOFeatures feats = flayer.GetAllFeatures();
- for (int i = 0; i < feats.Length; i++)
- {
- int idx = dataGridViewX4.Rows.Add();
- dataGridViewX4.Rows[idx].Cells[0].Value = comboBoxEx2.SelectedItem.ToString();
- dataGridViewX4.Rows[idx].Cells[1].Value = feats[i].Name;
- }
+ GSOFeatureLayer flayer = layer as GSOFeatureLayer;
+ GSOFeatureDataset fdataset = flayer.Dataset as GSOFeatureDataset;
+ GSOFeatures feats = flayer.GetAllFeatures();
+ for (int i = 0; i < feats.Length; i++)
+ {
+ int idx = dataGridViewX4.Rows.Add();
+ dataGridViewX4.Rows[idx].Cells[0].Value = comboBoxEx2.SelectedItem.ToString();
+ dataGridViewX4.Rows[idx].Cells[1].Value = feats[i].Name;
}
}
///
@@ -5343,7 +4992,7 @@
if (selectedFeature != null)
{
selectState = 1;
- VerticalDistanceAnalysis("间距分析", selectedFeature, m_PipelineLayerNames, dVerticalJingJuBiaoZhun, dHorizontalJingJuBiaoZhun);//分析
+ VerticalDistanceAnalysis("间距分析", selectedFeature, Utility.m_PipelineLayerNames, dVerticalJingJuBiaoZhun, dHorizontalJingJuBiaoZhun);//分析
}
}
}
@@ -5374,16 +5023,16 @@
for (int i = 0; i < feats.Length; i++)
{
selectState = 1;
- VerticalDistanceAnalysis("间距分析", feats[i], m_PipelineLayerNames, dVerticalJingJuBiaoZhun, dHorizontalJingJuBiaoZhun);//分析
+ VerticalDistanceAnalysis("间距分析", feats[i], Utility.m_PipelineLayerNames, dVerticalJingJuBiaoZhun, dHorizontalJingJuBiaoZhun);//分析
}
}
if (featCount.Count > 0)
{
- for (int i = 0; i < m_PipelineLayerNames.Count; i++)
+ for (int i = 0; i < Utility.m_PipelineLayerNames.Count; i++)
{
- if (featCount.ContainsKey(m_PipelineLayerNames[i]) && featLenth.ContainsKey(m_PipelineLayerNames[i]))
+ if (featCount.ContainsKey(Utility.m_PipelineLayerNames[i]) && featLenth.ContainsKey(Utility.m_PipelineLayerNames[i]))
{
- listBoxStasticsResult.Items.Add(m_PipelineLayerNames[i] + ":" + featCount[m_PipelineLayerNames[i]] + "条,共" + featLenth[m_PipelineLayerNames[i]].ToString("0.00") + "米");
+ listBoxStasticsResult.Items.Add(Utility.m_PipelineLayerNames[i] + ":" + featCount[Utility.m_PipelineLayerNames[i]] + "条,共" + featLenth[Utility.m_PipelineLayerNames[i]].ToString("0.00") + "米");
}
}
}
@@ -5948,24 +5597,20 @@
///
private void addNodeToLayerManagerNode(GSOLayer layer)
{
- if (layer != null)
- {
- GSODataset dataset = layer.Dataset;
- CheckDatasetGeoReference(layer.Dataset, "");
+ if (layer == null) return;
+ GSODataset dataset = layer.Dataset;
+ CheckDatasetGeoReference(layer.Dataset, "");
- TreeNode node = new TreeNode();
- node.Tag = layer;
- node.Text = layer.Dataset.Caption;
- node.ImageIndex = 0;
- node.SelectedImageIndex = 0;
- node.Checked = layer.Visible;
+ TreeNode node = new TreeNode();
+ node.Tag = layer;
+ node.Text = layer.Dataset.Caption;
+ node.ImageIndex = 0;
+ node.SelectedImageIndex = 0;
+ node.Checked = layer.Visible;
- if (!layerManagerNode.Nodes.Contains(node))
- {
- layerManagerNode.Nodes.Insert(0, node);
- layerManagerNode.Expand();
- }
- }
+ if (layerManagerNode.Nodes.Contains(node)) return;
+ layerManagerNode.Nodes.Insert(0, node);
+ layerManagerNode.Expand();
}
///
/// 获取指定图层中最后一个feature对象的名称对应的整数
@@ -6008,31 +5653,29 @@
for (int i = 0; i < markerStrs.Length; i++)
{
GSOLayer markerLayer = globeControl1.Globe.Layers.GetLayerByCaption(markerStrs[i]);
- if (markerLayer != null)
+ if (markerLayer == null) continue;
+ if (markerStrs[i] != layerName)
{
- if (markerStrs[i] != layerName)
+ markerLayer.Visible = false;
+ if (layerMarkerTree.Nodes[0].Nodes.Count > i)
{
- markerLayer.Visible = false;
- if (layerMarkerTree.Nodes[0].Nodes.Count > i)
+ layerMarkerTree.Nodes[0].Nodes[i].Checked = false;
+ }
+ }
+ else
+ {
+ markerLayer.Visible = true;
+ for (int j = 0; j < markerLayer.GetAllFeatures().Length; j++)
+ {
+ GSOFeature markerFeature = markerLayer.GetAt(j);
+ if (markerFeature != null)
{
- layerMarkerTree.Nodes[0].Nodes[i].Checked = false;
+ markerFeature.Visible = false;
}
}
- else
+ if (layerMarkerTree.Nodes[0].Nodes.Count > i)
{
- markerLayer.Visible = true;
- for (int j = 0; j < markerLayer.GetAllFeatures().Length; j++)
- {
- GSOFeature markerFeature = markerLayer.GetAt(j);
- if (markerFeature != null)
- {
- markerFeature.Visible = false;
- }
- }
- if (layerMarkerTree.Nodes[0].Nodes.Count > i)
- {
- layerMarkerTree.Nodes[0].Nodes[i].Checked = true;
- }
+ layerMarkerTree.Nodes[0].Nodes[i].Checked = true;
}
}
}
@@ -6138,15 +5781,12 @@
private void toolStripMenuItem2_Click(object sender, EventArgs e)
{
TreeNode node = contextMenuStrip3.Tag as TreeNode;
+ if (node == null) return;
GSOFeature feature3d = node.Tag as GSOFeature;
- if (node == null)
- return;
- if (feature3d != null)
- {
- feature3d.Delete();
- globeControl1.Globe.Refresh();
- node.Remove();
- }
+ if (feature3d == null) return;
+ feature3d.Delete();
+ globeControl1.Globe.Refresh();
+ node.Remove();
}
///
/// 图层目录树的 节点对应的复选框选中状态改变事件处理
@@ -6213,12 +5853,10 @@
{
TreeNode node = contextMenuStrip2.Tag as TreeNode;
GSOLayer l = globeControl1.Globe.Layers.GetLayerByCaption(node.Text);
- if (l != null)
- {
- l.RemoveAllFeature();
- node.Nodes.Clear();
- globeControl1.Refresh();
- }
+ if (l == null) return;
+ l.RemoveAllFeature();
+ node.Nodes.Clear();
+ globeControl1.Refresh();
}
//定时检查传感器的状态
public Timer timerOfSensor = null;
@@ -6375,7 +6013,7 @@
}
frmShResult = new FrmShResult(dVerticalJingJuBiaoZhun, dHorizontalJingJuBiaoZhun, shlayername, globeControl1,
- m_PipelineLayerNames);
+ Utility.m_PipelineLayerNames);
if (boolfrmShResult) return;
@@ -6482,13 +6120,11 @@
frmModify = new FrmMnModify(globeControl1, shlayername, shresultLists);
- if (boolfrmModify == false)
- {
- frmModify.Owner = this;
- frmModify.Location = new Point(Width - frmModify.Width - 10, Height - frmModify.Height - 50);
- frmModify.Show();
- boolfrmModify = true;
- }
+ if (boolfrmModify != false) return;
+ frmModify.Owner = this;
+ frmModify.Location = new Point(Width - frmModify.Width - 10, Height - frmModify.Height - 50);
+ frmModify.Show();
+ boolfrmModify = true;
}
///
/// 一键审核中调节透明度
@@ -6500,7 +6136,7 @@
LogManager.saveLog(Utility.userName, sliderItem1.Text);
globeControl1.Globe.GroundOpaque = 100 - sliderItem1.Value;
- GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(roadLayerName); //("180fd");
+ GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(Utility.roadLayerName); //("180fd");
if (layer != null)
layer.Opaque = 100 - sliderItem1.Value;
@@ -6516,7 +6152,7 @@
LogManager.saveLog(Utility.userName, sliderItem3.Text);
globeControl1.Globe.GroundOpaque = 100 - sliderItem3.Value;
- GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(roadLayerName); //("180fd");
+ GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(Utility.roadLayerName); //("180fd");
if (layer != null)
layer.Opaque = 100 - sliderItem3.Value;
optiValue = sliderItem3.Value;
@@ -6647,7 +6283,7 @@
{
LogManager.saveLog(Utility.userName, buttonItemSearch9.Text);
- FrmKeywordQuery.ShowForm(globeControl1, m_PipelineLayerNames, InitDataGridViewX1);
+ FrmKeywordQuery.ShowForm(globeControl1, Utility.m_PipelineLayerNames, InitDataGridViewX1);
}
///
/// 编号查询
@@ -6658,7 +6294,7 @@
{
LogManager.saveLog(Utility.userName, buttonItemSearch2.Text);
- FrmCodingQuery.ShowForm(globeControl1, m_PipelineLayerNames, InitDataGridViewX1);
+ FrmCodingQuery.ShowForm(globeControl1, Utility.m_PipelineLayerNames, InitDataGridViewX1);
}
///
/// 坐标查询
@@ -6680,7 +6316,7 @@
{
LogManager.saveLog(Utility.userName, buttonItemSearch10.Text);
- FrmFittingQuery.ShowForm(globeControl1, instrumenLayerNames, InitDataGridViewX1);
+ FrmFittingQuery.ShowForm(globeControl1, Utility.instrumenLayerNames, InitDataGridViewX1);
}
///
/// 管径查询
@@ -6691,7 +6327,7 @@
{
LogManager.saveLog(Utility.userName, buttonItemSearch4.Text);
- FrmDiameterQuery.ShowForm(globeControl1, m_PipelineLayerNames, InitDataGridViewX1);
+ FrmDiameterQuery.ShowForm(globeControl1, Utility.m_PipelineLayerNames, InitDataGridViewX1);
}
///
/// 材质查询
@@ -6702,7 +6338,7 @@
{
LogManager.saveLog(Utility.userName, buttonItemSearch5.Text);
- FrmMaterialSel.ShowForm(globeControl1, m_PipelineLayerNames, InitDataGridViewX1);
+ FrmMaterialSel.ShowForm(globeControl1, Utility.m_PipelineLayerNames, InitDataGridViewX1);
}
///
/// 基本查询
@@ -6751,8 +6387,8 @@
if (feature == null && feature.Geometry == null || (feature.Geometry.Type == EnumGeometryType.GeoPolygon3D
|| feature.Geometry.Type == EnumGeometryType.GeoWater))
return;
- ClassSearchAnalysis.ResultRelationAnalysis(globeControl1, feature, valueLayerNames, workwellLayerNames,
- instrumenLayerNames, pipefittingLayerNames, m_PipelineLayerNames, valueAllowance);
+ ClassSearchAnalysis.ResultRelationAnalysis(globeControl1, feature, Utility.valueLayerNames, Utility.workwellLayerNames,
+ Utility.instrumenLayerNames, Utility.pipefittingLayerNames, Utility.m_PipelineLayerNames, valueAllowance);
}
}
#endregion
@@ -6789,20 +6425,20 @@
// ClearCloseValvesAnalysis();//清除阀门分析
//清除管线间距分析
- if (disFeature != null)
- {
- if (disFeature.ID != 0)
- {
- globeControl1.Globe.MemoryLayer.RemoveFeatureByID(disFeature.ID);
- }
- }
- if (featureDis != null)
- {
- if (featureDis.ID != 0)
- {
- globeControl1.Globe.MemoryLayer.RemoveFeatureByID(featureDis.ID);
- }
- }
+ //if (disFeature != null)
+ //{
+ // if (disFeature.ID != 0)
+ // {
+ // globeControl1.Globe.MemoryLayer.RemoveFeatureByID(disFeature.ID);
+ // }
+ //}
+ //if (featureDis != null)
+ //{
+ // if (featureDis.ID != 0)
+ // {
+ // globeControl1.Globe.MemoryLayer.RemoveFeatureByID(featureDis.ID);
+ // }
+ //}
GSOFeatures feats = globeControl1.Globe.MemoryLayer.GetFeatureByName("粒子要素", true);
if (feats.Length > 0)
@@ -6838,7 +6474,7 @@
clearFeatureHighLight();//取消管线高亮
- GSOLayer layerGround = globeControl1.Globe.Layers.GetLayerByCaption(roadLayerName);//("180fd");
+ GSOLayer layerGround = globeControl1.Globe.Layers.GetLayerByCaption(Utility.roadLayerName);//("180fd");
if (layerGround != null)
{
layerGround.Visible = true;
@@ -6856,7 +6492,7 @@
private void buttonItemTJ1_ALL_Click(object sender, EventArgs e)
{
LogManager.saveLog(Utility.userName, "管线长度统计");
- FrmAllPipelineStatis frm = new FrmAllPipelineStatis(globeControl1, null, InitDataGridViewX1, m_PipelineLayerNames);
+ FrmAllPipelineStatis frm = new FrmAllPipelineStatis(globeControl1, null, InitDataGridViewX1, Utility.m_PipelineLayerNames);
frm.Show(this);
}
///
@@ -6930,7 +6566,7 @@
{
LogManager.saveLog(Utility.userName, "管径分段统计");
- Frmpipediameterstatis.ShowForm(globeControl1, m_PipelineLayerNames, 0);
+ Frmpipediameterstatis.ShowForm(globeControl1, Utility.m_PipelineLayerNames, 0);
}
///
/// 管径分段统计绘制区域统计
@@ -6942,7 +6578,7 @@
LogManager.saveLog(Utility.userName, "管径分段统计");
trackflag = null;
- Frmpipediameterstatis.ShowForm(globeControl1, m_PipelineLayerNames, 1);
+ Frmpipediameterstatis.ShowForm(globeControl1, Utility.m_PipelineLayerNames, 1);
}
///
/// 埋深分段统计全区域统计
@@ -6952,7 +6588,7 @@
private void buttonItemTJ5_ALL_Click(object sender, EventArgs e)
{
LogManager.saveLog(Utility.userName, "埋深分段统计");
- FrmpipeDeepstatis.ShowForm(globeControl1, m_PipelineLayerNames, 0);
+ FrmpipeDeepstatis.ShowForm(globeControl1, Utility.m_PipelineLayerNames, 0);
}
///
/// 埋深分段统计绘制区域统计
@@ -6963,7 +6599,7 @@
{
LogManager.saveLog(Utility.userName, "埋深分段统计");
trackflag = null;
- FrmpipeDeepstatis.ShowForm(globeControl1, m_PipelineLayerNames, 1);
+ FrmpipeDeepstatis.ShowForm(globeControl1, Utility.m_PipelineLayerNames, 1);
}
///
/// 管径分类统计全区域统计
@@ -6974,7 +6610,7 @@
{
LogManager.saveLog(Utility.userName, "管径分类汇总");
- FrmpipeDiametergather.ShowForm(globeControl1, m_PipelineLayerNames, 0);
+ FrmpipeDiametergather.ShowForm(globeControl1, Utility.m_PipelineLayerNames, 0);
}
///
/// 管径分类统计绘制区域统计
@@ -6986,7 +6622,7 @@
LogManager.saveLog(Utility.userName, "管径分类汇总");
trackflag = null;
- FrmpipeDiametergather.ShowForm(globeControl1, m_PipelineLayerNames, 1);
+ FrmpipeDiametergather.ShowForm(globeControl1, Utility.m_PipelineLayerNames, 1);
}
///
/// 材质分类统计全区域统计
@@ -6997,7 +6633,7 @@
{
LogManager.saveLog(Utility.userName, "材质分类汇总");
- FrmpipeMaterialGather.ShowForm(globeControl1, m_PipelineLayerNames, 0);
+ FrmpipeMaterialGather.ShowForm(globeControl1, Utility.m_PipelineLayerNames, 0);
}
///
/// 材质分类统计绘制区域统计
@@ -7009,7 +6645,7 @@
LogManager.saveLog(Utility.userName, "材质分类汇总");
trackflag = null;
- FrmpipeMaterialGather.ShowForm(globeControl1, m_PipelineLayerNames, 1);
+ FrmpipeMaterialGather.ShowForm(globeControl1, Utility.m_PipelineLayerNames, 1);
}
///
/// 附属物分类统计全区域统计
@@ -7020,7 +6656,7 @@
{
LogManager.saveLog(Utility.userName, "附属物分类汇总");
- FrmAccessoriesgather.ShowForm(globeControl1, instrumenLayerNames, 0);
+ FrmAccessoriesgather.ShowForm(globeControl1, Utility.instrumenLayerNames, 0);
}
///
/// 附属物分类统计绘制区域统计
@@ -7032,7 +6668,7 @@
LogManager.saveLog(Utility.userName, "附属物分类汇总");
trackflag = null;
- FrmAccessoriesgather.ShowForm(globeControl1, instrumenLayerNames, 1);
+ FrmAccessoriesgather.ShowForm(globeControl1, Utility.instrumenLayerNames, 1);
}
#region Predaotr,断面分析
///
@@ -7113,7 +6749,7 @@
//日志记录
LogManager.saveLog(Utility.userName, buttonItemFX3_1.Text);
- FrmGenAndFaMenTopu frm = new FrmGenAndFaMenTopu(globeControl1, m_PipelineLayerNames, valueLayerNames);
+ FrmGenAndFaMenTopu frm = new FrmGenAndFaMenTopu(globeControl1, Utility.m_PipelineLayerNames, Utility.valueLayerNames);
frm.Show(this);
}
#region Predator :拓扑分析
@@ -7166,7 +6802,7 @@
//日志记录
LogManager.saveLog(Utility.userName, buttonItemFX3_4.Text);
- FrmFlow frm = new FrmFlow(globeControl1, m_PipelineLayerNames);
+ FrmFlow frm = new FrmFlow(globeControl1, Utility.m_PipelineLayerNames);
frm.Show(this);
}
///
@@ -7369,16 +7005,14 @@
GSOFeature f = null;
GSOLayer layer = null;
globeControl1.Globe.GetSelectObject(i, out f, out layer);
- if (f != null && f.Dataset.Caption == "隧道")
+ if (f == null || f.Dataset.Caption != "隧道") continue;
+ tunnelCount++;
+ f.Delete();
+ if (layer != null)
{
- tunnelCount++;
- f.Delete();
- if (layer != null)
- {
- globeControl1.Globe.AddToEditHistroy(layer, f, EnumEditType.Delete);
- }
- globeControl1.Refresh();
+ globeControl1.Globe.AddToEditHistroy(layer, f, EnumEditType.Delete);
}
+ globeControl1.Refresh();
}
if (tunnelCount == 0)
{
@@ -7620,7 +7254,7 @@
return;
}
GSOGeoPolyline3D selLine = resFeature.Geometry as GSOGeoPolyline3D;
- if (selLine[0].Count <= 1)
+ if (selLine==null||selLine[0].Count <= 1)//wxl增加为空判断,下面方法同理
{
return;
}
@@ -7763,14 +7397,12 @@
LogManager.saveLog(Utility.userName, buttonItemBZ10.Text);
setMarkerLayerUnVisible("红线工具");
GSOLayer l = globeControl1.Globe.Layers.GetLayerByCaption("红线工具");
- if (l != null)
- {
- l.Visible = true;
- globeControl1.Globe.DestLayerFeatureAdd = l;
- l.Editable = true;
- globeControl1.Globe.Action = EnumAction3D.DrawPolygon;
- m_isDrawRedPology = true;
- }
+ if (l == null) return;
+ l.Visible = true;
+ globeControl1.Globe.DestLayerFeatureAdd = l;
+ l.Editable = true;
+ globeControl1.Globe.Action = EnumAction3D.DrawPolygon;
+ m_isDrawRedPology = true;
}
///
/// 标注管理
@@ -8100,7 +7732,7 @@
{
//日志记录
LogManager.saveLog(Utility.userName, buttonItemSH5.Text);
- FrmCityServerLineAnalysis frm = new FrmCityServerLineAnalysis(globeControl1, m_PipelineLayerNames);
+ FrmCityServerLineAnalysis frm = new FrmCityServerLineAnalysis(globeControl1, Utility.m_PipelineLayerNames);
frm.Show(this);
}
@@ -8287,7 +7919,7 @@
//日志记录
LogManager.saveLog(Utility.userName, buttonItemBJ1.Text);
- frmPipeSetEdit frm = new frmPipeSetEdit(globeControl1, m_PipelineLayerNames);
+ frmPipeSetEdit frm = new frmPipeSetEdit(globeControl1, Utility.m_PipelineLayerNames);
if (frm.ShowDialog() == DialogResult.OK)
{
m_AddPipeLine = true;
@@ -8306,7 +7938,7 @@
//日志记录
LogManager.saveLog(Utility.userName, buttonItemBJ2.Text);
- FrmSetGoalLayer frm = new FrmSetGoalLayer(globeControl1, instrumenLayerNames, "附属物");
+ FrmSetGoalLayer frm = new FrmSetGoalLayer(globeControl1, Utility.instrumenLayerNames, "附属物");
if (frm.ShowDialog() == DialogResult.OK)
{
GSOLayer featureAddLayer = TreeNodeFeatureLayer();
@@ -8327,15 +7959,13 @@
//日志记录
LogManager.saveLog(Utility.userName, buttonItemBJ3.Text);
- FrmSetGoalLayer frm = new FrmSetGoalLayer(globeControl1, pipefittingLayerNames, "管点");
+ FrmSetGoalLayer frm = new FrmSetGoalLayer(globeControl1, Utility.pipefittingLayerNames, "管点");
if (frm.ShowDialog() == DialogResult.OK)
{
GSOLayer featureAddLayer = TreeNodeFeatureLayer();
- if (featureAddLayer != null)
- {
- FrmAddPipeFitting dlg = new FrmAddPipeFitting(globeControl1, featureAddLayer);
- dlg.Show(this);
- }
+ if (featureAddLayer == null) return;
+ FrmAddPipeFitting dlg = new FrmAddPipeFitting(globeControl1, featureAddLayer);
+ dlg.Show(this);
}
}
///
@@ -8516,50 +8146,50 @@
#region 导出成dxf格式
List listVectorNames = new List();
- for (int i = 0; i < m_PipelineLayerNames.Count; i++)
+ for (int i = 0; i < Utility.m_PipelineLayerNames.Count; i++)
{
- if (m_PipelineLayerNames[i] == "移动" || m_PipelineLayerNames[i] == "联通"
- || m_PipelineLayerNames[i] == "电信" || m_PipelineLayerNames[i] == "共通"
- || m_PipelineLayerNames[i] == "有线电视" || m_PipelineLayerNames[i] == "交通信号"
- || m_PipelineLayerNames[i] == "供电")
+ if (Utility.m_PipelineLayerNames[i] == "移动" || Utility.m_PipelineLayerNames[i] == "联通"
+ || Utility.m_PipelineLayerNames[i] == "电信" || Utility.m_PipelineLayerNames[i] == "共通"
+ || Utility.m_PipelineLayerNames[i] == "有线电视" || Utility.m_PipelineLayerNames[i] == "交通信号"
+ || Utility.m_PipelineLayerNames[i] == "供电")
{
continue;
}
- if (listVectorNames.Contains(m_PipelineLayerNames[i]) == false)
+ if (!listVectorNames.Contains(Utility.m_PipelineLayerNames[i]))
{
- listVectorNames.Add(m_PipelineLayerNames[i]);
+ listVectorNames.Add(Utility.m_PipelineLayerNames[i]);
}
}
- for (int i = 0; i < valueLayerNames.Count; i++)
+ for (int i = 0; i < Utility.valueLayerNames.Count; i++)
{
- if (listVectorNames.Contains(valueLayerNames[i]) == false)
+ if (!listVectorNames.Contains(Utility.valueLayerNames[i]))
{
- listVectorNames.Add(valueLayerNames[i]);
+ listVectorNames.Add(Utility.valueLayerNames[i]);
}
}
- for (int i = 0; i < workwellLayerNames.Count; i++)
+ for (int i = 0; i < Utility.workwellLayerNames.Count; i++)
{
- if (listVectorNames.Contains(workwellLayerNames[i]) == false)
+ if (!listVectorNames.Contains(Utility.workwellLayerNames[i]))
{
- listVectorNames.Add(workwellLayerNames[i]);
+ listVectorNames.Add(Utility.workwellLayerNames[i]);
}
}
- for (int i = 0; i < instrumenLayerNames.Count; i++)
+ for (int i = 0; i < Utility.instrumenLayerNames.Count; i++)
{
- if (listVectorNames.Contains(instrumenLayerNames[i]) == false)
+ if (!listVectorNames.Contains(Utility.instrumenLayerNames[i]))
{
- listVectorNames.Add(instrumenLayerNames[i]);
+ listVectorNames.Add(Utility.instrumenLayerNames[i]);
}
}
- for (int i = 0; i < pipefittingLayerNames.Count; i++)
+ for (int i = 0; i < Utility.pipefittingLayerNames.Count; i++)
{
- if (listVectorNames.Contains(pipefittingLayerNames[i]) == false)
+ if (!listVectorNames.Contains(Utility.pipefittingLayerNames[i]))
{
- listVectorNames.Add(pipefittingLayerNames[i]);
+ listVectorNames.Add(Utility.pipefittingLayerNames[i]);
}
}
- FrmExportCADS frm = new FrmExportCADS(globeControl1, listVectorNames);//m_PipelineLayerNames);
+ FrmExportCADS frm = new FrmExportCADS(globeControl1, listVectorNames);//Utility.m_PipelineLayerNames);
frm.ShowDialog();
#endregion
}
@@ -8574,39 +8204,39 @@
LogManager.saveLog(Utility.userName, buttonItemBJ10_2.Text);
List listVectorNames = new List();
- for (int i = 0; i < m_PipelineLayerNames.Count; i++)
+ for (int i = 0; i < Utility.m_PipelineLayerNames.Count; i++)
{
- if (listVectorNames.Contains(m_PipelineLayerNames[i]) == false)
+ if (!listVectorNames.Contains(Utility.m_PipelineLayerNames[i]))
{
- listVectorNames.Add(m_PipelineLayerNames[i]);
+ listVectorNames.Add(Utility.m_PipelineLayerNames[i]);
}
}
- for (int i = 0; i < valueLayerNames.Count; i++)
+ for (int i = 0; i < Utility.valueLayerNames.Count; i++)
{
- if (listVectorNames.Contains(valueLayerNames[i]) == false)
+ if (!listVectorNames.Contains(Utility.valueLayerNames[i]))
{
- listVectorNames.Add(valueLayerNames[i]);
+ listVectorNames.Add(Utility.valueLayerNames[i]);
}
}
- for (int i = 0; i < workwellLayerNames.Count; i++)
+ for (int i = 0; i < Utility.workwellLayerNames.Count; i++)
{
- if (listVectorNames.Contains(workwellLayerNames[i]) == false)
+ if (!listVectorNames.Contains(Utility.workwellLayerNames[i]))
{
- listVectorNames.Add(workwellLayerNames[i]);
+ listVectorNames.Add(Utility.workwellLayerNames[i]);
}
}
- for (int i = 0; i < instrumenLayerNames.Count; i++)
+ for (int i = 0; i < Utility.instrumenLayerNames.Count; i++)
{
- if (listVectorNames.Contains(instrumenLayerNames[i]) == false)
+ if (!listVectorNames.Contains(Utility.instrumenLayerNames[i]))
{
- listVectorNames.Add(instrumenLayerNames[i]);
+ listVectorNames.Add(Utility.instrumenLayerNames[i]);
}
}
- for (int i = 0; i < pipefittingLayerNames.Count; i++)
+ for (int i = 0; i < Utility.pipefittingLayerNames.Count; i++)
{
- if (listVectorNames.Contains(pipefittingLayerNames[i]) == false)
+ if (!listVectorNames.Contains(Utility.pipefittingLayerNames[i]))
{
- listVectorNames.Add(pipefittingLayerNames[i]);
+ listVectorNames.Add(Utility.pipefittingLayerNames[i]);
}
}
FrmExportVector frm = new FrmExportVector(globeControl1, listVectorNames);
@@ -8668,9 +8298,9 @@
List listPipelineLayers = new List();
GSOLayer layer = null;
- for (int i = 0; i < m_PipelineLayerNames.Count; i++)
+ for (int i = 0; i < Utility.m_PipelineLayerNames.Count; i++)
{
- layer = globeControl1.Globe.Layers.GetLayerByCaption(m_PipelineLayerNames[i]);
+ layer = globeControl1.Globe.Layers.GetLayerByCaption(Utility.m_PipelineLayerNames[i]);
if (layer == null) continue;
listPipelineLayers.Add(layer);
}
@@ -8737,7 +8367,7 @@
LogManager.saveLog(Utility.userName, sliderItem2.Text);
globeControl1.Globe.GroundOpaque = 100 - sliderItem2.Value;
- GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(roadLayerName);//("180fd");
+ GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(Utility.roadLayerName);//("180fd");
if (layer != null)
{
layer.Opaque = 100 - sliderItem2.Value;
@@ -8876,7 +8506,7 @@
globeControl1.Globe.GroundOpaque = 100 - sliderGroundTransSet1.Value;
- layer = globeControl1.Globe.Layers.GetLayerByCaption(roadLayerName);//("180fd");
+ layer = globeControl1.Globe.Layers.GetLayerByCaption(Utility.roadLayerName);//("180fd");
if (layer != null)
{
layer.Opaque = 100 - sliderGroundTransSet1.Value;
@@ -9145,7 +8775,7 @@
LogManager.saveLog(Utility.userName, buttonItem8.Text);
int width = Width;
- FrmCompareFeature.ShowForm(globeControl1, globeControl2, layerTemp, layerTemp2, m_PipelineLayerNames, sgPipeLayersNames, width);
+ FrmCompareFeature.ShowForm(globeControl1, globeControl2, layerTemp, layerTemp2, Utility.m_PipelineLayerNames, Utility.sgPipeLayersNames, width);
}
///
/// 红线审核导出图片
diff --git a/MarkInfo.cs b/MarkInfo.cs
index 44e630b..68ab5bd 100644
--- a/MarkInfo.cs
+++ b/MarkInfo.cs
@@ -182,7 +182,7 @@
public void showMarker(List marks, GSOLayer layer)
{
layer.Visible = true;
- MessageBox.Show(layer.GetAllFeatures().Length + "");
+ //MessageBox.Show(layer.GetAllFeatures().Length + "");
foreach(MarkInfo mark in marks)
{
addLabel(mark,layer);
diff --git a/NewFunction/FrmExportVector.cs b/NewFunction/FrmExportVector.cs
index 9e68b54..c85a9b9 100644
--- a/NewFunction/FrmExportVector.cs
+++ b/NewFunction/FrmExportVector.cs
@@ -10,8 +10,8 @@
{
public partial class FrmExportVector :Office2007Form
{
- GSOGlobeControl globeControl1;
- List pipeLineNames = new List();
+ private GSOGlobeControl globeControl1;
+ private List pipeLineNames;
public FrmExportVector(GSOGlobeControl globeControl, List listPipelineNames)
{
InitializeComponent();
diff --git a/Cyberpipe.csproj b/Cyberpipe.csproj
index 6e90a6e..8f4424d 100644
--- a/Cyberpipe.csproj
+++ b/Cyberpipe.csproj
@@ -187,11 +187,6 @@
False
bin\x86\Debug\WHC.Pager.WinControl.dll
-
- False
- .exe
- bin\x86\Debug\WinFormsExtendedViewExample.exe
-
False
bin\x86\Debug\WW.dll
diff --git a/Cyberpipe.suo b/Cyberpipe.suo
index 0a403c8..eac4ecb 100644
--- a/Cyberpipe.suo
+++ b/Cyberpipe.suo
Binary files differ
diff --git a/MainFrm.cs b/MainFrm.cs
index 6e94648..7c574c1 100644
--- a/MainFrm.cs
+++ b/MainFrm.cs
@@ -27,7 +27,6 @@
public partial class MainFrm : Office2007Form
{
TreeNode layerManagerNode;
- TreeNode myPlaceNode = null;
bool m_bFullScreen;
GSOGlobeControl globeControl1;
@@ -45,24 +44,14 @@
GSOLayer layerTemp;
GSOLayer layerTemp2;
- FrmShResult frmShResult = null;
FrmRedlineResult frmredResult = null;
FrmMnModify frmModify;
public bool frmRedlineResult = false;
public bool boolfrmShResult;
public bool boolfrmModify;
- List m_PipelineLayerNames = new List();//线图层名称
- List workwellLayerNames = new List();//工井图层名称
- List valueLayerNames = new List();//阀门图层名称
- List instrumenLayerNames = new List();//附属物图层名称
- List pipefittingLayerNames = new List();//管件图层名称
- List sgPipeLayersNames = new List();//施工管线图层名称
- string roadLayerName = "";
public static string m_CurrentQueryLayer;//定义当前查询的图层
//定位和闪烁初始化定义
- int count = 0;
- private string flashflag = "single";
public bool m_AddPipeLine;//bool添加管线
bool m_isDrawTunnel;//bool创建隧道
@@ -71,10 +60,6 @@
private string trackflag;//定义阀门查询个数
- //管线间距分析
- private GSOFeature disFeature = new GSOFeature();
- private GSOFeature featureDis = new GSOFeature();
-
//记录沿线飞行设置
//int m_nFlyMode = 2;
double m_dFlyAboveLine = 1;
@@ -86,7 +71,7 @@
Boolean m_bDigPitByDepth = true;
//选择管线
int selectState;
- private OracleConnection connBackup = null;
+ //private OracleConnection connBackup = null;
//数据集合
public static GSODataSource ds;
@@ -182,7 +167,7 @@
RigthMenuSet();
MenuSet();
-
+
}
///
/// 右屏中添加管纵图片
@@ -906,13 +891,13 @@
comboBoxEx3.Items.Clear();
comboBoxEx4.Items.Clear();
comboBoxLayer.Items.Clear();
- for (int i = 0; i < m_PipelineLayerNames.Count; i++)
+ foreach (string t1 in Utility.m_PipelineLayerNames)
{
- comboBoxEx1.Items.Add(m_PipelineLayerNames[i]);
- comboBoxEx2.Items.Add(m_PipelineLayerNames[i]);
- comboBoxEx3.Items.Add(m_PipelineLayerNames[i]);
- comboBoxEx4.Items.Add(m_PipelineLayerNames[i]);
- comboBoxLayer.Items.Add(m_PipelineLayerNames[i]);
+ comboBoxEx1.Items.Add(t1);
+ comboBoxEx2.Items.Add(t1);
+ comboBoxEx3.Items.Add(t1);
+ comboBoxEx4.Items.Add(t1);
+ comboBoxLayer.Items.Add(t1);
}
splitContainer1.Panel2Collapsed = true;
@@ -1132,7 +1117,7 @@
}
- delegate void LoadDataForGlobalControl();
+ //delegate void LoadDataForGlobalControl();
private void connectServer()
{
@@ -1142,19 +1127,15 @@
// 勾选实测图层
foreach (TreeNode tn in layerTree.Nodes)
{
- if (tn.Nodes.Count > 0)
+ if (tn.Nodes.Count <= 0) continue;
+ if (tn.Text != "实测数据") continue;
+ tn.Checked = true;
+ foreach (TreeNode tnChild in tn.Nodes)
{
- if (tn.Text == "实测数据")
+ tnChild.Checked = true;
+ foreach (TreeNode tnGrandChild in tnChild.Nodes)
{
- tn.Checked = true;
- foreach (TreeNode tnChild in tn.Nodes)
- {
- tnChild.Checked = true;
- foreach (TreeNode tnGrandChild in tnChild.Nodes)
- {
- tnGrandChild.Checked = true;
- }
- }
+ tnGrandChild.Checked = true;
}
}
}
@@ -1174,7 +1155,7 @@
for (int j = 0; j < Utility.dataSource.DatasetCount; j++)
{
GSODataset dataset = Utility.dataSource.GetDatasetAt(j);
- if (dataset != null && dictionaryNetLayerNameAndCaption.ContainsKey(dataset.Caption))
+ if (dataset != null && Utility.dictionaryNetLayerNameAndCaption.ContainsKey(dataset.Caption))
{
dataset.Caption = dataset.Name;
globeControl1.Globe.Layers.Add(dataset);
@@ -1191,7 +1172,7 @@
for (int j = 0; j < ghDS.DatasetCount; j++)
{
GSODataset dataset = ghDS.GetDatasetAt(j);
- if (dataset != null && dictionaryNetLayerNameAndCaption.ContainsKey(dataset.Caption))
+ if (dataset != null && Utility.dictionaryNetLayerNameAndCaption.ContainsKey(dataset.Caption))
{
dataset.Caption = dataset.Name;
globeControl1.Globe.Layers.Add(dataset);
@@ -1207,7 +1188,7 @@
for (int m = 0; m < sgDS.DatasetCount; m++)
{
GSODataset dataset = sgDS.GetDatasetAt(m);
- if (dataset != null && !dataset.Caption.Contains("SH") && dictionaryNetLayerNameAndCaption.ContainsKey(dataset.Caption))
+ if (dataset != null && !dataset.Caption.Contains("SH") && Utility.dictionaryNetLayerNameAndCaption.ContainsKey(dataset.Caption))
{
dataset.Caption = dataset.Name;
globeControl1.Globe.Layers.Add(dataset);
@@ -1219,8 +1200,14 @@
}
}
- LoadDataForGlobalControl ss = connectServer;
- ss();
+// LoadDataForGlobalControl ss = connectServer;
+// ss();
+
+ this.Invoke((EventHandler) delegate
+ {
+ connectServer();
+ });
+
}
catch (Exception ex)
@@ -1240,7 +1227,7 @@
layerTree.Nodes.Add(layerManagerNode);
XmlDocument doc = new XmlDocument();
- doc.Load(filename);
+ doc.Load(Utility.filename);
XmlNodeList xmlLayerNodes = doc.SelectNodes("//layer");
foreach (XmlNode xmlLayerNode in xmlLayerNodes)
@@ -1295,70 +1282,6 @@
}
- /**
- * 读取Config.xml文件,初始化以下全局Map
- * m_PipelineLayerNames:管线
- * workwellLayerNames:工井
- * valueLayerNames:阀门
- * instrumenLayerNames:附属物
- * pipefittingLayerNames:特征管点
- * sgPipeLayersNames:施工管线
- **/
- private void initGlobalMap()
- {
- XmlDocument doc = new XmlDocument();
- doc.Load(filename);
- XmlNodeList xmlLayerNodes = doc.SelectNodes("//layerchild");
-
- foreach (XmlNode xmlLayerNode in xmlLayerNodes)
- {
- string layerType = xmlLayerNode.Attributes["type"].Value;
- string layerName1 = xmlLayerNode.Attributes["layer"].Value;
- string layerchildName = xmlLayerNode.Attributes["label"].Value;
-
- dictionaryNetLayerNameAndCaption.Add(layerName1, layerchildName);
-
- if (layerType != "db")
- {
- if (xmlLayerNode.Attributes["isRoad"] != null)
- {
- roadLayerName = layerchildName;
- }
- }
- else if (xmlLayerNode.Attributes["isPipeLine"] != null)
- {
- m_PipelineLayerNames.Add(layerchildName);
- g1layername.Add(layerName1);
- }
- else if (xmlLayerNode.Attributes["isWorkWell"] != null)
- {
- workwellLayerNames.Add(layerchildName);
- g1layername.Add(layerName1);
- }
- else if (xmlLayerNode.Attributes["isValve"] != null)
- {
- valueLayerNames.Add(layerchildName);
- g1layername.Add(layerName1);
- }
- else if (xmlLayerNode.Attributes["isAccess"] != null)
- {
- instrumenLayerNames.Add(layerchildName);
- g1layername.Add(layerName1);
- }
- else if (xmlLayerNode.Attributes["isCharacter"] != null)
- {
- pipefittingLayerNames.Add(layerchildName);
- g1layername.Add(layerName1);
- }
- else if (xmlLayerNode.Attributes["isSgData"] != null)
- {
- sgPipeLayersNames.Add(layerchildName);
- g1layername.Add(layerName1);
- }
-
- }
- }
-
private void initMarkerTree()
{
TreeNode node = new TreeNode();
@@ -1380,32 +1303,29 @@
for (int i = 0; i < markerStrs.Length; i++)
{
- if (File.Exists(Application.StartupPath + "\\标注管理\\" + markerStrs[i] + ".lgd"))
- {
- GSOLayer markerLayer = globeControl1.Globe.Layers.Add(Application.StartupPath + "\\标注管理\\" + markerStrs[i] + ".lgd");
- if (markerLayer != null)
- {
- TreeNode node1 = new TreeNode();
- node1.Text = markerLayer.Caption;
- node1.ImageIndex = 0;
- node1.SelectedImageIndex = 0;
- node1.Checked = markerLayer.Visible;
- node1.Tag = markerLayer;
- layerMarkerTree.Nodes[0].Nodes.Add(node1);
- }
- }
+ if (!File.Exists(Application.StartupPath + "\\标注管理\\" + markerStrs[i] + ".lgd")) continue;
+ GSOLayer markerLayer = globeControl1.Globe.Layers.Add(Application.StartupPath + "\\标注管理\\" + markerStrs[i] + ".lgd");
+ if (markerLayer == null) continue;
+ TreeNode node1 = new TreeNode();
+ node1.Text = markerLayer.Caption;
+ node1.ImageIndex = 0;
+ node1.SelectedImageIndex = 0;
+ node1.Checked = markerLayer.Visible;
+ node1.Tag = markerLayer;
+ layerMarkerTree.Nodes[0].Nodes.Add(node1);
}
}
private void MainFrm_Load(object sender, EventArgs e)
{
initGlobalControl();
- initGlobalMap();
+ //initGlobalMap();
initLayerTree();
initMarkerTree();
initLayout();
loadData();
+
double x = Convert.ToDouble(Utility.Query_Roads["绿岛"].ToString().Split(',')[0]);
double y = Convert.ToDouble(Utility.Query_Roads["绿岛"].ToString().Split(',')[1]);
double z = Convert.ToDouble(Utility.Query_Roads["绿岛"].ToString().Split(',')[2]);
@@ -1415,12 +1335,12 @@
#endregion
- Dictionary dictionaryNetLayerNameAndCaption = new Dictionary();
+ //Dictionary Utility.dictionaryNetLayerNameAndCaption = new Dictionary();
void globeControl1_AfterNetLayerAddEvent(object sender, AfterNetLayerAddEventArgs e)
{
- if (e.Layer != null && dictionaryNetLayerNameAndCaption.ContainsKey(e.Layer.Caption))
+ if (e.Layer != null && Utility.dictionaryNetLayerNameAndCaption.ContainsKey(e.Layer.Caption))
{
- e.Layer.Caption = dictionaryNetLayerNameAndCaption[e.Layer.Caption];
+ e.Layer.Caption = Utility.dictionaryNetLayerNameAndCaption[e.Layer.Caption];
}
}
@@ -1530,37 +1450,30 @@
///
Boolean CheckDatasetGeoReference(GSODataset dataset, string strDataPath)
{
+
+ if (dataset.GeoReferenceType != EnumGeoReferenceType.Flat) return true;
Boolean bSuccess = false;
- if (dataset.GeoReferenceType == EnumGeoReferenceType.Flat)
- {
- if (MessageBox.Show("数据没有空间参考信息,请设置空间参考信息!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) == DialogResult.OK)
- {
- String strPath = Application.StartupPath + "\\Coordinate Systems";
- OpenFileDialog dlg = new OpenFileDialog();
+ if (MessageBox.Show("数据没有空间参考信息,请设置空间参考信息!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) !=
+ DialogResult.OK) return bSuccess;
+ String strPath = Application.StartupPath + "\\Coordinate Systems";
+ OpenFileDialog dlg = new OpenFileDialog();
- dlg.InitialDirectory = strPath;
- dlg.RestoreDirectory = true;
+ dlg.InitialDirectory = strPath;
+ dlg.RestoreDirectory = true;
- dlg.Filter = "投影文件|*.prj||";
- if (dlg.ShowDialog() == DialogResult.OK)
- {
- string lprjStr = GSODataEngineUtility.ConvertEsriPrjFileToProj4(dlg.FileName);
- string lprjFileContent = "0prj4" + lprjStr + "";
+ dlg.Filter = "投影文件|*.prj||";
+ if (dlg.ShowDialog() != DialogResult.OK) return bSuccess;
+ string lprjStr = GSODataEngineUtility.ConvertEsriPrjFileToProj4(dlg.FileName);
+ string lprjFileContent = "0prj4" + lprjStr +
+ "";
- bSuccess = dataset.LoadProjectionFromESRIFile(dlg.FileName);
+ bSuccess = dataset.LoadProjectionFromESRIFile(dlg.FileName);
- string lprjFileName = strDataPath.Substring(0, strDataPath.LastIndexOf(".")) + ".lprj";
- StreamWriter writer = new StreamWriter(lprjFileName, false);
- writer.Write(lprjFileContent);
- writer.Close();
+ string lprjFileName = strDataPath.Substring(0, strDataPath.LastIndexOf(".")) + ".lprj";
+ StreamWriter writer = new StreamWriter(lprjFileName, false);
+ writer.Write(lprjFileContent);
+ writer.Close();
- }
- }
- }
- else
- {
- return true;
- }
return bSuccess;
}
@@ -1571,49 +1484,47 @@
///
void globeControl1_TrackRectEndEvent(object sender, TrackRectEndEventArgs e)
{
- if (e.Polygon != null)
+ if (e.Polygon == null) return;
+ globeControl1.Globe.TrackRectTool.Clear();
+ globeControl1.ImmediatelyRefresh();
+ globeControl1.SwapBuffer();
+ Point pt1 = new Point(Convert.ToInt32(e.StartPos.X), Convert.ToInt32(e.StartPos.Y));
+ Point pt2 = new Point(Convert.ToInt32(e.EndPos.X), Convert.ToInt32(e.EndPos.Y));
+
+ int mapWidth = 0;
+ int mapHeight = 0;
+ Point pt = getUpperLeftPoint(pt1, pt2, out mapWidth, out mapHeight);
+ int rightBottomX = pt.X + mapWidth;
+ int rightBottomY = pt.Y + mapHeight;
+ Image myImg = new Bitmap(mapWidth, mapHeight);
+ Graphics g = Graphics.FromImage(myImg);
+ g.CopyFromScreen(pt, new Point(0, 0), new Size(rightBottomX, rightBottomY));
+
+ SaveFileDialog dlg = new SaveFileDialog();
+ dlg.Filter = "输出JPEG(*.jpg)|*.jpg|输出PNG(*.png)|*.png|输出BMP(*.bmp)|*.bmp|输出BMP(*.gif)|*.gif";
+ if (dlg.ShowDialog() == DialogResult.OK)
{
- globeControl1.Globe.TrackRectTool.Clear();
- globeControl1.ImmediatelyRefresh();
- globeControl1.SwapBuffer();
- Point pt1 = new Point(Convert.ToInt32(e.StartPos.X), Convert.ToInt32(e.StartPos.Y));
- Point pt2 = new Point(Convert.ToInt32(e.EndPos.X), Convert.ToInt32(e.EndPos.Y));
-
- int mapWidth = 0;
- int mapHeight = 0;
- Point pt = getUpperLeftPoint(pt1, pt2, out mapWidth, out mapHeight);
- int rightBottomX = pt.X + mapWidth;
- int rightBottomY = pt.Y + mapHeight;
- Image myImg = new Bitmap(mapWidth, mapHeight);
- Graphics g = Graphics.FromImage(myImg);
- g.CopyFromScreen(pt, new Point(0, 0), new Size(rightBottomX, rightBottomY));
-
- SaveFileDialog dlg = new SaveFileDialog();
- dlg.Filter = "输出JPEG(*.jpg)|*.jpg|输出PNG(*.png)|*.png|输出BMP(*.bmp)|*.bmp|输出BMP(*.gif)|*.gif";
- if (dlg.ShowDialog() == DialogResult.OK)
+ string extension = Path.GetExtension(dlg.FileName);//扩展名
+ switch (extension)
{
- string extension = Path.GetExtension(dlg.FileName);//扩展名
- switch (extension)
- {
- case ".jpg":
- myImg.Save(dlg.FileName, ImageFormat.Jpeg);
- break;
- case ".png":
- myImg.Save(dlg.FileName, ImageFormat.Png);
- break;
- case ".bmp":
- myImg.Save(dlg.FileName, ImageFormat.Bmp);
- break;
- case ".gif":
- myImg.Save(dlg.FileName, ImageFormat.Gif);
- break;
- default:
- break;
- }
+ case ".jpg":
+ myImg.Save(dlg.FileName, ImageFormat.Jpeg);
+ break;
+ case ".png":
+ myImg.Save(dlg.FileName, ImageFormat.Png);
+ break;
+ case ".bmp":
+ myImg.Save(dlg.FileName, ImageFormat.Bmp);
+ break;
+ case ".gif":
+ myImg.Save(dlg.FileName, ImageFormat.Gif);
+ break;
+ default:
+ break;
}
- globeControl1.Globe.Action = EnumAction3D.ActionNull;
- globeControl1.Globe.MouseRoamingEnable = true;
}
+ globeControl1.Globe.Action = EnumAction3D.ActionNull;
+ globeControl1.Globe.MouseRoamingEnable = true;
}
///
/// 定位正北正90度俯视
@@ -1711,18 +1622,12 @@
///
private void CheckControl(TreeViewEventArgs e)
{
- if (e.Action != TreeViewAction.Unknown)
+ if (e.Action == TreeViewAction.Unknown||e.Node == null || Convert.IsDBNull(e.Node)) return;
+ CheckParentNode(e.Node);
+ if (e.Node.Nodes.Count > 0)
{
- if (e.Node != null && !Convert.IsDBNull(e.Node))
- {
- CheckParentNode(e.Node);
- if (e.Node.Nodes.Count > 0)
- {
- CheckAllChildNodes(e.Node, e.Node.Checked);
- }
- }
+ CheckAllChildNodes(e.Node, e.Node.Checked);
}
-
}
///
/// 改变所有子节点的状态
@@ -1747,94 +1652,88 @@
{
bool bChecked = false;
- if (curNode.Parent != null)
+ if (curNode.Parent == null) return;
+ foreach (TreeNode node in curNode.Parent.Nodes)
{
- foreach (TreeNode node in curNode.Parent.Nodes)
+ if (node.Checked)
{
- if (node.Checked)
- {
- bChecked = true;
- break;
- }
+ bChecked = true;
+ break;
}
+ }
- if (bChecked)
- {
- curNode.Parent.Checked = true;
- CheckParentNode(curNode.Parent);
- }
- else
- {
- curNode.Parent.Checked = false;
- CheckParentNode(curNode.Parent);
- }
+ if (bChecked)
+ {
+ curNode.Parent.Checked = true;
+ CheckParentNode(curNode.Parent);
+ }
+ else
+ {
+ curNode.Parent.Checked = false;
+ CheckParentNode(curNode.Parent);
}
}
private void layerTree_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
{
- if (e.Button == MouseButtons.Right)
+ if (e.Button != MouseButtons.Right) return;
+ layerTree.SelectedNode = e.Node;
+ if (e.Node.Tag == null) return;
+ if (e.Button == MouseButtons.Right && e.Node.Tag.ToString().Contains("|"))
{
- layerTree.SelectedNode = e.Node;
- if (e.Node.Tag != null)
+
+ if (e.Node.Tag.ToString().Split('|')[0] == "locaserver")
{
- if (e.Button == MouseButtons.Right && e.Node.Tag.ToString().Contains("|"))
+
+ foreach (ToolStripItem item in layerNodeContexMenu.Items)
{
-
- if (e.Node.Tag.ToString().Split('|')[0] == "locaserver")
- {
-
- foreach (ToolStripItem item in layerNodeContexMenu.Items)
- {
- item.Visible = false;
- }
- return;
-
- }
-
- if (e.Node.Tag.ToString().Split('|')[0] == "new")
- {
- LayerEditableMenuItem.Enabled = true;
- foreach (ToolStripItem item in layerNodeContexMenu.Items)
- {
- item.Visible = false;
- }
- LayerSelectableMenuItem.Visible = true;
- LayerEditableMenuItem.Visible = true;
- RemoveLayer.Visible = true;
- RefreshLayerFeatureListMenuItem.Visible = true;
- SaveLayerMenuItem.Visible = true;
- LayerFlyMenuItem.Visible = true;
- }
-
- LayerSelectableMenuItem.Visible = true;
- LayerEditableMenuItem.Visible = true;
- SaveLayerMenuItem.Visible = true;
- LayerFlyMenuItem.Visible = true;
- 导出CADToolStripMenuItem1.Visible = true;
-
- layerNodeContexMenu.Show(layerTree, e.X, e.Y);
- layerNodeContexMenu.Tag = e.Node;
- GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(e.Node.Tag.ToString().Split('|')[1]);
- if (layer != null)
- {
- LayerSelectableMenuItem.Checked = layer.Selectable;
- LayerEditableMenuItem.Checked = layer.Editable;
- }
+ item.Visible = false;
}
- else
+ return;
+
+ }
+
+ if (e.Node.Tag.ToString().Split('|')[0] == "new")
+ {
+ LayerEditableMenuItem.Enabled = true;
+ foreach (ToolStripItem item in layerNodeContexMenu.Items)
{
- if (e.Node.Tag is GSOLayer && e.Node.Parent != null && e.Node.Parent.Text.Trim() == "临时图层")
- {
- contextMenuStripDeleteLayerNode.Show(layerTree, e.X, e.Y);
- contextMenuStripDeleteLayerNode.Tag = e.Node;
- }
- if (e.Node.Tag is GSOFeature && e.Node.Parent != null && e.Node.Parent.Text.Trim() == "我的地标")
- {
- contextMenuStripDeleteLayerNode.Show(layerTree, e.X, e.Y);
- contextMenuStripDeleteLayerNode.Tag = e.Node;
- }
+ item.Visible = false;
}
+ //LayerSelectableMenuItem.Visible = true;
+ //LayerEditableMenuItem.Visible = true;
+ RemoveLayer.Visible = true;
+ RefreshLayerFeatureListMenuItem.Visible = true;
+ //SaveLayerMenuItem.Visible = true;
+ //LayerFlyMenuItem.Visible = true;
+ }
+
+ LayerSelectableMenuItem.Visible = true;
+ LayerEditableMenuItem.Visible = true;
+ SaveLayerMenuItem.Visible = true;
+ LayerFlyMenuItem.Visible = true;
+ 导出CADToolStripMenuItem1.Visible = true;
+
+ layerNodeContexMenu.Show(layerTree, e.X, e.Y);
+ layerNodeContexMenu.Tag = e.Node;
+ GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(e.Node.Tag.ToString().Split('|')[1]);
+ if (layer != null)
+ {
+ LayerSelectableMenuItem.Checked = layer.Selectable;
+ LayerEditableMenuItem.Checked = layer.Editable;
+ }
+ }
+ else
+ {
+ if (e.Node.Tag is GSOLayer && e.Node.Parent != null && e.Node.Parent.Text.Trim() == "临时图层")
+ {
+ contextMenuStripDeleteLayerNode.Show(layerTree, e.X, e.Y);
+ contextMenuStripDeleteLayerNode.Tag = e.Node;
+ }
+ else if (e.Node.Tag is GSOFeature && e.Node.Parent != null && e.Node.Parent.Text.Trim() == "我的地标")
+ {
+ contextMenuStripDeleteLayerNode.Show(layerTree, e.X, e.Y);
+ contextMenuStripDeleteLayerNode.Tag = e.Node;
}
}
}
@@ -1909,110 +1808,103 @@
{
TreeNode node = layerTree.SelectedNode;
- if (node != null)
+ if (node == null) return;
+ if (node.Parent.Text.Trim() == "临时图层")
{
- if (node.Parent.Text.Trim() == "临时图层")
+ GSOLayer lsLayer = globeControl1.Globe.Layers.GetLayerByCaption(node.Text);
+ double x = lsLayer.LatLonBounds.Center.X;
+ double y = lsLayer.LatLonBounds.Center.Y;
+ if (x == 0 && y == 0)
{
- GSOLayer lsLayer = globeControl1.Globe.Layers.GetLayerByCaption(node.Text);
- double x = lsLayer.LatLonBounds.Center.X;
- double y = lsLayer.LatLonBounds.Center.Y;
- if (x == 0 && y == 0)
- {
- x = lsLayer.Bounds.Center.X;
- y = lsLayer.Bounds.Center.Y;
- }
+ x = lsLayer.Bounds.Center.X;
+ y = lsLayer.Bounds.Center.Y;
+ }
- globeControl1.Globe.FlyToPosition(new GSOPoint3d(x, y, 10), EnumAltitudeMode.Absolute);
+ globeControl1.Globe.FlyToPosition(new GSOPoint3d(x, y, 10), EnumAltitudeMode.Absolute);
+ }
+ else
+ {
+ GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(node.Tag.ToString().Split('|')[1]);
+
+ if (layer == null) return;
+ if (layer.Caption == "红线")
+ {
+ globeControl1.Globe.FlyToPosition(new GSOPoint3d(120.610963, 31.188121, 50), EnumAltitudeMode.Absolute, -4, 50, 1000);
+ globeControl1.Globe.FlyToPointSpeed = 10000000;
+ globeControl1.Globe.Action = EnumAction3D.SelectObject;
+
+ GSOLayer redLayer = globeControl1.Globe.Layers.GetLayerByCaption("红线");
+ if (redLayer != null)
+ {
+ redLayer.Visible = true;
+ }
+ globeControl1.Refresh();
}
else
{
- GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(node.Tag.ToString().Split('|')[1]);
-
- if (layer != null)
- {
- if (layer.Caption == "红线")
- {
- globeControl1.Globe.FlyToPosition(new GSOPoint3d(120.610963, 31.188121, 50), EnumAltitudeMode.Absolute, -4, 50, 1000);
- globeControl1.Globe.FlyToPointSpeed = 10000000;
- globeControl1.Globe.Action = EnumAction3D.SelectObject;
-
- GSOLayer redLayer = globeControl1.Globe.Layers.GetLayerByCaption("红线");
- if (redLayer != null)
- {
- redLayer.Visible = true;
- }
- globeControl1.Refresh();
- }
- else
- {
- double x = layer.LatLonBounds.Center.X;
- double y = layer.LatLonBounds.Center.Y;
- globeControl1.Globe.FlyToPosition(new GSOPoint3d(x, y, 100), EnumAltitudeMode.Absolute);
- }
- }
+ double x = layer.LatLonBounds.Center.X;
+ double y = layer.LatLonBounds.Center.Y;
+ globeControl1.Globe.FlyToPosition(new GSOPoint3d(x, y, 100), EnumAltitudeMode.Absolute);
}
}
}
private void layerTree_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e)
{
- if (layerTree.SelectedNode != null)
+ if (layerTree.SelectedNode == null) return;
+ if (layerTree.SelectedNode.Tag.ToString().Contains("|"))
{
- if (layerTree.SelectedNode.Tag.ToString().Contains("|"))
+ string nodeTag = layerTree.SelectedNode.Tag.ToString().Split('|')[1];
+ GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(nodeTag);
+ if (layer != null)
{
- string nodeTag = layerTree.SelectedNode.Tag.ToString().Split('|')[1];
- GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(nodeTag);
- if (layer != null)
+ if (layer.Caption == "红线")
{
- if (layer.Caption == "红线")
- {
- globeControl1.Globe.FlyToPosition(new GSOPoint3d(120.610963, 31.188121, 50), EnumAltitudeMode.Absolute, -4, 50, 1000);
- globeControl1.Globe.FlyToPointSpeed = 10000000;
- globeControl1.Globe.Action = EnumAction3D.SelectObject;
+ globeControl1.Globe.FlyToPosition(new GSOPoint3d(120.610963, 31.188121, 50), EnumAltitudeMode.Absolute, -4, 50, 1000);
+ globeControl1.Globe.FlyToPointSpeed = 10000000;
+ globeControl1.Globe.Action = EnumAction3D.SelectObject;
- GSOLayer redLayer = globeControl1.Globe.Layers.GetLayerByCaption("红线");
- if (redLayer != null)
- {
- redLayer.Visible = true;
- }
- globeControl1.Refresh();
- }
- else
+ GSOLayer redLayer = globeControl1.Globe.Layers.GetLayerByCaption("红线");
+ if (redLayer != null)
{
- double x = layer.LatLonBounds.Center.X;
- double y = layer.LatLonBounds.Center.Y;
- globeControl1.Globe.FlyToPosition(new GSOPoint3d(x, y, 0), EnumAltitudeMode.Absolute);
+ redLayer.Visible = true;
}
+ globeControl1.Refresh();
+ }
+ else
+ {
+ double x = layer.LatLonBounds.Center.X;
+ double y = layer.LatLonBounds.Center.Y;
+ globeControl1.Globe.FlyToPosition(new GSOPoint3d(x, y, 0), EnumAltitudeMode.Absolute);
}
}
- if (layerTree.SelectedNode.Tag is GSOLayer)
+ }
+ if (layerTree.SelectedNode.Tag is GSOLayer)
+ {
+ GSOLayer layer = layerTree.SelectedNode.Tag as GSOLayer;
+ if (layer.GetAllFeatures().Length > 0)
{
- GSOLayer layer = layerTree.SelectedNode.Tag as GSOLayer;
- if (layer.GetAllFeatures().Length > 0)
+ GSOFeature feature = layer.GetAt(0);
+ if (feature != null && feature.Geometry != null)
{
- GSOFeature feature = layer.GetAt(0);
- if (feature != null && feature.Geometry != null)
- {
- globeControl1.Globe.FlyToPosition(feature.Geometry.GeoCenterPoint, EnumAltitudeMode.Absolute);//, 0, 0, 1000);
- }
- else
- {
- globeControl1.Globe.FlyToFeature(feature);
- }
- }
- }
- if (layerTree.SelectedNode.Tag is GSOFeature)
- {
- GSOFeature feature = layerTree.SelectedNode.Tag as GSOFeature;
- if (feature.Geometry != null)
- {
- globeControl1.Globe.FlyToPosition(feature.Geometry.GeoCenterPoint, EnumAltitudeMode.Absolute, 0, 0, 10);
+ globeControl1.Globe.FlyToPosition(feature.Geometry.GeoCenterPoint, EnumAltitudeMode.Absolute);//, 0, 0, 1000);
}
else
{
globeControl1.Globe.FlyToFeature(feature);
}
}
+ } else if (layerTree.SelectedNode.Tag is GSOFeature)
+ {
+ GSOFeature feature = layerTree.SelectedNode.Tag as GSOFeature;
+ if (feature.Geometry != null)
+ {
+ globeControl1.Globe.FlyToPosition(feature.Geometry.GeoCenterPoint, EnumAltitudeMode.Absolute, 0, 0, 10);
+ }
+ else
+ {
+ globeControl1.Globe.FlyToFeature(feature);
+ }
}
}
@@ -2086,7 +1978,7 @@
trackPolylineEndMode == EnumTrackPolylineEndMode.DLDM_Analysis)
{
Dictionary hdmDic = SectionAnalysisTool.HDMAnalysis(globeControl1,
- e.Polyline, m_PipelineLayerNames);
+ e.Polyline, Utility.m_PipelineLayerNames);
FrmHDMAnalysis3 frm = new FrmHDMAnalysis3(hdmDic, globeControl1,
trackPolylineEndMode);
frm.Show(this);
@@ -2103,185 +1995,6 @@
* **/
}
trackPolylineEndMode = EnumTrackPolylineEndMode.Default_Analysis;
- /*
- ArrayList arraylistPoint = new ArrayList();
- ArrayList arraylistLine = new ArrayList();
-
- // globeControl1.Globe.ClearLastTrackPolyline();
-
- if (e.Polyline != null)
- {
- //横断面分析
- if (buttonItemFX2_1.Checked || buttonItemFX2_3.Checked)
- {
- if (m_PipelineLayerNames != null)
- {
- GSOGeoPolygon3D polygon = e.Polyline.CreateBuffer(0.1, true, 5, true, false);
- for (int i = 0; i < m_PipelineLayerNames.Count; i++)
- {
- if (m_PipelineLayerNames[i] != null)
- {
- GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(m_PipelineLayerNames[i]);
- if (layer == null)
- {
- continue;
- }
- if (layer.Visible == false)
- {
- continue;
- }
- GSOFeatureLayer featurelayer = layer as GSOFeatureLayer;
- if (featurelayer != null)
- {
- GSOFeatures feats = featurelayer.FindFeaturesInPolygon(polygon, false); //featurelayer.GetAllFeatures();
- if (feats != null)
- {
- for (int j = 0; j < feats.Length; j++)
- {
- GSOFeature feateline = feats[j];
- GSOGeoPolyline3D geoline = feateline.Geometry as GSOGeoPolyline3D;
-
- if (geoline != null)
- {
- if (geoline.Style != null)
- {
- if (geoline.Style.GetType() == typeof(GSOPipeLineStyle3D))
- {
- GSOPoint3d pntIntersect1 = new GSOPoint3d();
- GSOPoint3d pntIntersect2 = new GSOPoint3d();
-
- double honLen;
- double verLen;
- double dDist = globeControl1.Globe.Analysis3D.ComputeTwoGeoPolylineDistance(e.Polyline, geoline, out pntIntersect1, out pntIntersect2, out honLen, out verLen, false, false, 0);
-
- globeControl1.Globe.Action = EnumAction3D.ActionNull;
- if (dDist > -1)
- {
- arraylistPoint.Add(pntIntersect2);
- arraylistLine.Add(feateline);
- }
- }
- }
- }
- }
- }
- else
- {
- MessageBox.Show("请重新绘制断面");
- return;
- }
-
- }
- }
- }
- }
- if (buttonItemFX2_1.Checked)
- {
- FrmHDMAnalysis3 frm = FrmHDMAnalysis3.GetForm(arraylistPoint, arraylistLine, e.Polyline, globeControl1);
- if (!frm.isShowFirst)
- {
- frm.Show(this);
- }
- frm.LoadChartEvent();
- }
- else
- {
- FrmRoadHDM frm = FrmRoadHDM.GetForm(arraylistPoint, arraylistLine, e.Polyline, globeControl1);
- if (!frm.isShowFirst)
- {
- frm.Show(this);
- }
- frm.LoadChartEvent();
- }
- globeControl1.Globe.ClearLastTrackPolyline();
- }
- else if (buttonItemFX2_4.Checked)
- {
- FrmBaseLineProfillAnalysis dlg = new FrmBaseLineProfillAnalysis(globeControl1.Globe, e.Polyline);
- dlg.Show(this);
- globeControl1.Globe.ClearLastTrackPolyline();
- }
- else if (buttonItemFX4_3.Checked)
- {
- GSOGeoPolygon3D resPolygon = e.Polyline.CreateBuffer(m_dDigPitWidthAlongLine, false, 0, false, false);
-
- GSOGeoPit geoPit = new GSOGeoPit();
- geoPit.PitPolygon = resPolygon;
- if (m_bDigPitByDepth)
- {
- geoPit.PitDepth = m_dDigPitValue;
- geoPit.PitDepthUsing = true;
- }
- else
- {
- geoPit.PitBottomAlt = m_dDigPitValue;
- geoPit.PitDepthUsing = false;
- }
-
- globeControl1.Globe.AddPit("", geoPit);
- GSOLayer layerGround = globeControl1.Globe.Layers.GetLayerByCaption(roadLayerName);// ("180fd");
- if (layerGround != null)
- {
- layerGround.Visible = false;
- }
- // 清除当前TrackPolygonAnalysis的痕迹
- globeControl1.Globe.ClearLastTrackPolyline();
- }
- else if (distanceMarker)
- {
- setMarkerLayerUnVisible("距离标注");
- GSOLayer l = globeControl1.Globe.Layers.GetLayerByCaption("距离标注");
- if (l != null)
- {
- l.Visible = true;
- if (getLabelName(l) != -1)
- {
- GSOGeoPolyline3D line = e.Polyline;
- if (line.PartCount > 0)
- {
- double length = line.GetSpaceLength(true, 6378137);//线的长度
- if (length == 0)
- {
- return;
- }
- else
- {
-
- GSOGeoPoint3D pt = new GSOGeoPoint3D();
- GSOGeoPolyline3D lineLine = line.GetSegment(0, length / 2);
- GSOPoint3d point3d = lineLine[lineLine.PartCount - 1][lineLine[lineLine.PartCount - 1].Count - 1];
- pt.X = point3d.X;
- pt.Y = point3d.Y;
- pt.Z = point3d.Z;
-
- string Twodecimalplaces = string.Format("{0:F}", length);
- string radiusLabelName = "" + Twodecimalplaces + "米";
- //string radiusLabelName = "" + length + "米";//标注名称
-
- GSOPoint2d point2d = new GSOPoint2d(0, 30);//标注位置
-
- int labelText = getLabelName(l);
-
- GSOFeature newFeatureLine = new GSOFeature();
- newFeatureLine.Geometry = line;
- newFeatureLine.Name = (labelText + 1).ToString() + "-line";
- l.AddFeature(newFeatureLine);
- globeControl1.Globe.ClearLastTrackPolyline();
-
- GSOFeature newFeature = new GSOFeature();
- newFeature = createLabel(l, newFeature, pt, radiusLabelName, (labelText + 1).ToString(), point2d);
- l.AddFeature(newFeature);
-
- globeControl1.Refresh();
- }
- }
- }
- }
- }
- }
- globeControl1.Globe.Action = EnumAction3D.ActionNull;
- ActionToolMenuChecked();
- * **/
}
#endregion
@@ -2292,83 +2005,81 @@
///
void globeControl1_TrackPolygonEndEvent(object sender, TrackPolygonEndEventArgs e)
{
- if (globeControl1.Globe.Action == EnumAction3D.TrackPolygon && e.Polygon != null)
+ if (globeControl1.Globe.Action != EnumAction3D.TrackPolygon || e.Polygon == null) return;
+ GSOGeoPolygon3D polygon = e.Polygon;
+
+ switch (trackflag)
{
- GSOGeoPolygon3D polygon = e.Polygon;
+ case "valvequery":
+ FrmValveStatistics frm = new FrmValveStatistics(globeControl1, polygon, InitDataGridViewX1);
+ frm.Show(this);
+ globeControl1.Globe.Action = EnumAction3D.ActionNull;
+ break;
- switch (trackflag)
- {
- case "valvequery":
- FrmValveStatistics frm = new FrmValveStatistics(globeControl1, polygon, InitDataGridViewX1);
- frm.Show(this);
- globeControl1.Globe.Action = EnumAction3D.ActionNull;
- break;
+ case "PipelineDistanceStatistics":
- case "PipelineDistanceStatistics":
+ FrmAllPipelineStatis frm1 = new FrmAllPipelineStatis(globeControl1, polygon, InitDataGridViewX1, Utility.m_PipelineLayerNames);
+ frm1.Show(this);
+ globeControl1.Globe.Action = EnumAction3D.ActionNull;
- FrmAllPipelineStatis frm1 = new FrmAllPipelineStatis(globeControl1, polygon, InitDataGridViewX1, m_PipelineLayerNames);
- frm1.Show(this);
- globeControl1.Globe.Action = EnumAction3D.ActionNull;
+ break;
+ case "PipelineSpatialQuery":
- break;
- case "PipelineSpatialQuery":
+ FrmAllPipelineStatis.ShowForm(globeControl1, polygon, InitDataGridViewX1, Utility.m_PipelineLayerNames);
+ globeControl1.Globe.ClearAnalysis();
+ globeControl1.Globe.Action = EnumAction3D.ActionNull;
- FrmAllPipelineStatis.ShowForm(globeControl1, polygon, InitDataGridViewX1, m_PipelineLayerNames);
- globeControl1.Globe.ClearAnalysis();
- globeControl1.Globe.Action = EnumAction3D.ActionNull;
+ break;
+ case "workwellquery":
+ FrmAllWorkWellStatis frmWell = new FrmAllWorkWellStatis(globeControl1, polygon, InitDataGridViewX1);
+ frmWell.Show(this);
- break;
- case "workwellquery":
- FrmAllWorkWellStatis frmWell = new FrmAllWorkWellStatis(globeControl1, polygon, InitDataGridViewX1);
- frmWell.Show(this);
+ globeControl1.Globe.Action = EnumAction3D.ActionNull;
- globeControl1.Globe.Action = EnumAction3D.ActionNull;
+ break;
- break;
-
- case "pit":
- double depth;
- FrmTackPolygonDlg dlg = new FrmTackPolygonDlg();
- if (dlg.ShowDialog() == DialogResult.OK)
+ case "pit":
+ double depth;
+ FrmTackPolygonDlg dlg = new FrmTackPolygonDlg();
+ if (dlg.ShowDialog() == DialogResult.OK)
+ {
+ depth = dlg.depth;
+ GSOGeoPit geoPit = new GSOGeoPit();
+ geoPit.PitPolygon = polygon;
+ geoPit.PitDepth = depth;
+ geoPit.PitDepthUsing = true;
+ globeControl1.Globe.AddPit("", geoPit);
+ GSOLayer layerGround = globeControl1.Globe.Layers.GetLayerByCaption(Utility.roadLayerName);//("180fd");
+ if (layerGround != null)
{
- depth = dlg.depth;
- GSOGeoPit geoPit = new GSOGeoPit();
- geoPit.PitPolygon = polygon;
- geoPit.PitDepth = depth;
- geoPit.PitDepthUsing = true;
- globeControl1.Globe.AddPit("", geoPit);
- GSOLayer layerGround = globeControl1.Globe.Layers.GetLayerByCaption(roadLayerName);//("180fd");
- if (layerGround != null)
- {
- layerGround.Visible = false;
- }
+ layerGround.Visible = false;
}
- globeControl1.Globe.ClearLastTrackPolygon();
- globeControl1.Globe.Action = EnumAction3D.ActionNull;
- break;
- case "digFillAnalysis":
- DigFillAnalysisDlg dlg1 = new DigFillAnalysisDlg();
- dlg1.m_globe = globeControl1.Globe;
- dlg1.m_polygon3D = polygon;
- globeControl1.Globe.Action = EnumAction3D.ActionNull;
- dlg1.Show(this);
- break;
- case "FloodAnalysis":
- FrmFloodAnalysis frmFloodAnalysis = new FrmFloodAnalysis(globeControl1.Globe, polygon);
- frmFloodAnalysis.Show(this);
- globeControl1.Globe.Action = EnumAction3D.ActionNull;
- break;
- case "BSQDuoBianXiangStatis":
- FrmBSQStatis bsqFrm = new FrmBSQStatis(globeControl1, e.Polygon);
- bsqFrm.Show(this);
- globeControl1.Globe.Action = EnumAction3D.ActionNull;
- break;
+ }
+ globeControl1.Globe.ClearLastTrackPolygon();
+ globeControl1.Globe.Action = EnumAction3D.ActionNull;
+ break;
+ case "digFillAnalysis":
+ DigFillAnalysisDlg dlg1 = new DigFillAnalysisDlg();
+ dlg1.m_globe = globeControl1.Globe;
+ dlg1.m_polygon3D = polygon;
+ globeControl1.Globe.Action = EnumAction3D.ActionNull;
+ dlg1.Show(this);
+ break;
+ case "FloodAnalysis":
+ FrmFloodAnalysis frmFloodAnalysis = new FrmFloodAnalysis(globeControl1.Globe, polygon);
+ frmFloodAnalysis.Show(this);
+ globeControl1.Globe.Action = EnumAction3D.ActionNull;
+ break;
+ case "BSQDuoBianXiangStatis":
+ FrmBSQStatis bsqFrm = new FrmBSQStatis(globeControl1, e.Polygon);
+ bsqFrm.Show(this);
+ globeControl1.Globe.Action = EnumAction3D.ActionNull;
+ break;
- case "":
- break;
- default:
- break;
- }
+ case "":
+ break;
+ default:
+ break;
}
}
///
@@ -2380,16 +2091,14 @@
{
try
{
- if (e.Feature != null)
+ if (e.Feature == null) return;
+ if (isFeatureContainsBianhao(e.Feature))
{
- if (isFeatureContainsBianhao(e.Feature))
- {
- featureTooltip.ShowBalloon((int)e.MousePos.X, (int)e.MousePos.Y, e.Feature.GetValue(featureIDFieldName).ToString());
- }
- else if (e.Feature.Name != "")
- {
- featureTooltip.ShowBalloon((int)e.MousePos.X, (int)e.MousePos.Y, e.Feature.Name);
- }
+ featureTooltip.ShowBalloon((int)e.MousePos.X, (int)e.MousePos.Y, e.Feature.GetValue(featureIDFieldName).ToString());
+ }
+ else if (e.Feature.Name != "")
+ {
+ featureTooltip.ShowBalloon((int)e.MousePos.X, (int)e.MousePos.Y, e.Feature.Name);
}
}
catch (Exception ex)
@@ -2405,192 +2114,188 @@
/// (完善)
void globeControl1_MouseDoubleClick(object sender, MouseEventArgs e)
{
- if (e.Button == MouseButtons.Left)
+ if (e.Button != MouseButtons.Left) return;
+ if (m_AddPipeLine && globeControl1.Globe.Action == EnumAction3D.DrawPolyline)//添加管线
{
- if (m_AddPipeLine && globeControl1.Globe.Action == EnumAction3D.DrawPolyline)//添加管线
+ GSOLayer layerDest = globeControl1.Globe.DestLayerFeatureAdd;
+ if (layerDest != null)
{
- GSOLayer layerDest = globeControl1.Globe.DestLayerFeatureAdd;
- if (layerDest != null)
+ GSOFeatures features = layerDest.GetAllFeatures();
+ GSOFeature f = features[features.Length - 1];
+ GSOGeoPolyline3D line = f.Geometry as GSOGeoPolyline3D;
+ globeControl1.Globe.Action = EnumAction3D.ActionNull;
+ if (f != null && f.Geometry.Type == EnumGeometryType.GeoPolyline3D)
{
- GSOFeatures features = layerDest.GetAllFeatures();
- GSOFeature f = features[features.Length - 1];
- GSOGeoPolyline3D line = f.Geometry as GSOGeoPolyline3D;
- globeControl1.Globe.Action = EnumAction3D.ActionNull;
- if (f != null && f.Geometry.Type == EnumGeometryType.GeoPolyline3D)
- {
- FrmLineCoordinate lineCoordiante = new FrmLineCoordinate(f, globeControl1, layerDest.Caption);
- lineCoordiante.Show(this);
- }
- globeControl1.Refresh();
- }
- }
- if (m_isDrawTunnel && globeControl1.Globe.Action == EnumAction3D.DrawPolyline)//创建隧道
- {
- GSOLayer tunnel = globeControl1.Globe.Layers.GetLayerByCaption("隧道");
- if (tunnel != null && tunnel.GetAllFeatures().Length > 0)
- {
- GSOFeature feature = tunnel.GetAt(tunnel.GetAllFeatures().Length - 1);
- FrmCreateTunnel frm = new FrmCreateTunnel(globeControl1, feature);
- if (frm.ShowDialog() == DialogResult.OK)
- {
- //tunnel.Save();
- }
+ FrmLineCoordinate lineCoordiante = new FrmLineCoordinate(f, globeControl1, layerDest.Caption);
+ lineCoordiante.Show(this);
}
globeControl1.Refresh();
}
- if (m_isDrawCitySevenLine && globeControl1.Globe.Action == EnumAction3D.DrawPolyline)//绘制城市七线
+ }
+ if (m_isDrawTunnel && globeControl1.Globe.Action == EnumAction3D.DrawPolyline)//创建隧道
+ {
+ GSOLayer tunnel = globeControl1.Globe.Layers.GetLayerByCaption("隧道");
+ if (tunnel != null && tunnel.GetAllFeatures().Length > 0)
{
- string lineType = citySevenLineType;
- string lineName = cityServerLineName;
- GSOFeature feature = null;
- switch (lineType)
+ GSOFeature feature = tunnel.GetAt(tunnel.GetAllFeatures().Length - 1);
+ FrmCreateTunnel frm = new FrmCreateTunnel(globeControl1, feature);
+ if (frm.ShowDialog() == DialogResult.OK)
{
- case "城市红线":
- GSOLayer layerRed = globeControl1.Globe.Layers.GetLayerByCaption(lineType);
- if (layerRed != null && layerRed.GetAllFeatures().Length > 0)
- {
- feature = layerRed.GetAt(layerRed.GetAllFeatures().Length - 1);
- if (feature != null)
- {
- feature.Name = lineName;
- GSOSimpleLineStyle3D style = new GSOSimpleLineStyle3D();
- style.LineColor = Color.Red; //改变绘制的线的颜色
- style.LineWidth = 1; //改变绘制的线的宽度
- feature.Geometry.Style = style;
- //layerRed.Save();
- }
- }
- break;
- case "城市橙线":
- GSOLayer layerOrange = globeControl1.Globe.Layers.GetLayerByCaption(lineType);
- if (layerOrange != null && layerOrange.GetAllFeatures().Length > 0)
- {
- feature = layerOrange.GetAt(layerOrange.GetAllFeatures().Length - 1);
- if (feature != null)
- {
- feature.Name = lineName;
- GSOSimpleLineStyle3D style = new GSOSimpleLineStyle3D();
- style.LineColor = Color.Orange;
- feature.Geometry.Style = style;
- //layerOrange.Save();
- }
- }
- break;
- case "城市黄线":
- GSOLayer layerYellow = globeControl1.Globe.Layers.GetLayerByCaption(lineType);
- if (layerYellow != null && layerYellow.GetAllFeatures().Length > 0)
- {
- feature = layerYellow.GetAt(layerYellow.GetAllFeatures().Length - 1);
- if (feature != null)
- {
- feature.Name = lineName;
- GSOSimpleLineStyle3D style = new GSOSimpleLineStyle3D();
- style.LineColor = Color.Yellow;
- feature.Geometry.Style = style;
- //layerYellow.Save();
- }
- }
- break;
- case "城市绿线":
- GSOLayer layerGreen = globeControl1.Globe.Layers.GetLayerByCaption(lineType);
- if (layerGreen != null && layerGreen.GetAllFeatures().Length > 0)
- {
- feature = layerGreen.GetAt(layerGreen.GetAllFeatures().Length - 1);
- if (feature != null)
- {
- feature.Name = lineName;
- GSOSimpleLineStyle3D style = new GSOSimpleLineStyle3D();
- style.LineColor = Color.Green;
- feature.Geometry.Style = style;
- //layerGreen.Save();
- }
- }
- break;
- case "城市蓝线":
- GSOLayer layerBlue = globeControl1.Globe.Layers.GetLayerByCaption(lineType);
- if (layerBlue != null && layerBlue.GetAllFeatures().Length > 0)
- {
- feature = layerBlue.GetAt(layerBlue.GetAllFeatures().Length - 1);
- if (feature != null)
- {
- feature.Name = lineName;
- GSOSimpleLineStyle3D style = new GSOSimpleLineStyle3D();
- style.LineColor = Color.Blue;
- feature.Geometry.Style = style;
- //layerBlue.Save();
- }
- }
- break;
- case "城市紫线":
- GSOLayer layerPurple = globeControl1.Globe.Layers.GetLayerByCaption(lineType);
- if (layerPurple != null && layerPurple.GetAllFeatures().Length > 0)
- {
- feature = layerPurple.GetAt(layerPurple.GetAllFeatures().Length - 1);
- if (feature != null)
- {
- feature.Name = lineName;
- GSOSimpleLineStyle3D style = new GSOSimpleLineStyle3D();
- style.LineColor = Color.Purple;
- feature.Geometry.Style = style;
- //layerPurple.Save();
- }
- }
- break;
- case "城市黑线":
- GSOLayer layerBlack = globeControl1.Globe.Layers.GetLayerByCaption(lineType);
- if (layerBlack != null && layerBlack.GetAllFeatures().Length > 0)
- {
- feature = layerBlack.GetAt(layerBlack.GetAllFeatures().Length - 1);
- if (feature != null)
- {
- feature.Name = lineName;
- GSOSimpleLineStyle3D style = new GSOSimpleLineStyle3D();
- style.LineColor = Color.Black;
- feature.Geometry.Style = style;
- //layerBlack.Save();
- }
- }
- break;
+ //tunnel.Save();
}
-
- globeControl1.Globe.DestLayerFeatureAdd = null;
}
- m_AddPipeLine = false;
- m_isDrawTunnel = false;
- m_isDrawCitySevenLine = false;
- if (m_isDrawRedPology && globeControl1.Globe.Action == EnumAction3D.DrawPolygon)//红线工具
+ globeControl1.Refresh();
+ }
+ if (m_isDrawCitySevenLine && globeControl1.Globe.Action == EnumAction3D.DrawPolyline)//绘制城市七线
+ {
+ string lineType = citySevenLineType;
+ string lineName = cityServerLineName;
+ GSOFeature feature = null;
+ switch (lineType)
{
- GSOLayer layerDest = globeControl1.Globe.DestLayerFeatureAdd;
- if (layerDest != null)
- {
- GSOFeatures features = layerDest.GetAllFeatures();
- //GSOFeatures features = globeControl1.Globe.MemoryLayer.GetAllFeatures();
- GSOFeature f = features[features.Length - 1];
- if (f != null)
+ case "城市红线":
+ GSOLayer layerRed = globeControl1.Globe.Layers.GetLayerByCaption(lineType);
+ if (layerRed != null && layerRed.GetAllFeatures().Length > 0)
{
- GSOGeoPolygon3D polygon = f.Geometry as GSOGeoPolygon3D;
- if (polygon != null)
+ feature = layerRed.GetAt(layerRed.GetAllFeatures().Length - 1);
+ if (feature != null)
{
- GSOSimplePolygonStyle3D geoStyle3d = new GSOSimplePolygonStyle3D();
- f.Name = (getLabelName(layerDest) + 1).ToString();
- geoStyle3d.FillColor = Color.Red;
- polygon.Style = geoStyle3d;
- GSOLabel label = new GSOLabel();
- label.Text = "此区域正在施工中!";
- label.Style = new GSOLabelStyle();
- label.Style.HasTracktionLine = false;
- polygon.Label = label;
-
- globeControl1.Refresh();
+ feature.Name = lineName;
+ GSOSimpleLineStyle3D style = new GSOSimpleLineStyle3D();
+ style.LineColor = Color.Red; //改变绘制的线的颜色
+ style.LineWidth = 1; //改变绘制的线的宽度
+ feature.Geometry.Style = style;
+ //layerRed.Save();
}
}
+ break;
+ case "城市橙线":
+ GSOLayer layerOrange = globeControl1.Globe.Layers.GetLayerByCaption(lineType);
+ if (layerOrange != null && layerOrange.GetAllFeatures().Length > 0)
+ {
+ feature = layerOrange.GetAt(layerOrange.GetAllFeatures().Length - 1);
+ if (feature != null)
+ {
+ feature.Name = lineName;
+ GSOSimpleLineStyle3D style = new GSOSimpleLineStyle3D();
+ style.LineColor = Color.Orange;
+ feature.Geometry.Style = style;
+ //layerOrange.Save();
+ }
+ }
+ break;
+ case "城市黄线":
+ GSOLayer layerYellow = globeControl1.Globe.Layers.GetLayerByCaption(lineType);
+ if (layerYellow != null && layerYellow.GetAllFeatures().Length > 0)
+ {
+ feature = layerYellow.GetAt(layerYellow.GetAllFeatures().Length - 1);
+ if (feature != null)
+ {
+ feature.Name = lineName;
+ GSOSimpleLineStyle3D style = new GSOSimpleLineStyle3D();
+ style.LineColor = Color.Yellow;
+ feature.Geometry.Style = style;
+ //layerYellow.Save();
+ }
+ }
+ break;
+ case "城市绿线":
+ GSOLayer layerGreen = globeControl1.Globe.Layers.GetLayerByCaption(lineType);
+ if (layerGreen != null && layerGreen.GetAllFeatures().Length > 0)
+ {
+ feature = layerGreen.GetAt(layerGreen.GetAllFeatures().Length - 1);
+ if (feature != null)
+ {
+ feature.Name = lineName;
+ GSOSimpleLineStyle3D style = new GSOSimpleLineStyle3D();
+ style.LineColor = Color.Green;
+ feature.Geometry.Style = style;
+ //layerGreen.Save();
+ }
+ }
+ break;
+ case "城市蓝线":
+ GSOLayer layerBlue = globeControl1.Globe.Layers.GetLayerByCaption(lineType);
+ if (layerBlue != null && layerBlue.GetAllFeatures().Length > 0)
+ {
+ feature = layerBlue.GetAt(layerBlue.GetAllFeatures().Length - 1);
+ if (feature != null)
+ {
+ feature.Name = lineName;
+ GSOSimpleLineStyle3D style = new GSOSimpleLineStyle3D();
+ style.LineColor = Color.Blue;
+ feature.Geometry.Style = style;
+ //layerBlue.Save();
+ }
+ }
+ break;
+ case "城市紫线":
+ GSOLayer layerPurple = globeControl1.Globe.Layers.GetLayerByCaption(lineType);
+ if (layerPurple != null && layerPurple.GetAllFeatures().Length > 0)
+ {
+ feature = layerPurple.GetAt(layerPurple.GetAllFeatures().Length - 1);
+ if (feature != null)
+ {
+ feature.Name = lineName;
+ GSOSimpleLineStyle3D style = new GSOSimpleLineStyle3D();
+ style.LineColor = Color.Purple;
+ feature.Geometry.Style = style;
+ //layerPurple.Save();
+ }
+ }
+ break;
+ case "城市黑线":
+ GSOLayer layerBlack = globeControl1.Globe.Layers.GetLayerByCaption(lineType);
+ if (layerBlack != null && layerBlack.GetAllFeatures().Length > 0)
+ {
+ feature = layerBlack.GetAt(layerBlack.GetAllFeatures().Length - 1);
+ if (feature != null)
+ {
+ feature.Name = lineName;
+ GSOSimpleLineStyle3D style = new GSOSimpleLineStyle3D();
+ style.LineColor = Color.Black;
+ feature.Geometry.Style = style;
+ //layerBlack.Save();
+ }
+ }
+ break;
+ }
+
+ globeControl1.Globe.DestLayerFeatureAdd = null;
+ }
+ m_AddPipeLine = false;
+ m_isDrawTunnel = false;
+ m_isDrawCitySevenLine = false;
+ if (m_isDrawRedPology && globeControl1.Globe.Action == EnumAction3D.DrawPolygon)//红线工具
+ {
+ GSOLayer layerDest = globeControl1.Globe.DestLayerFeatureAdd;
+ if (layerDest != null)
+ {
+ GSOFeatures features = layerDest.GetAllFeatures();
+ //GSOFeatures features = globeControl1.Globe.MemoryLayer.GetAllFeatures();
+ GSOFeature f = features[features.Length - 1];
+ if (f != null)
+ {
+ GSOGeoPolygon3D polygon = f.Geometry as GSOGeoPolygon3D;
+ if (polygon != null)
+ {
+ GSOSimplePolygonStyle3D geoStyle3d = new GSOSimplePolygonStyle3D();
+ f.Name = (getLabelName(layerDest) + 1).ToString();
+ geoStyle3d.FillColor = Color.Red;
+ polygon.Style = geoStyle3d;
+ GSOLabel label = new GSOLabel();
+ label.Text = "此区域正在施工中!";
+ label.Style = new GSOLabelStyle();
+ label.Style.HasTracktionLine = false;
+ polygon.Label = label;
+
+ globeControl1.Refresh();
+ }
}
}
- m_isDrawRedPology = false;
- globeControl1.Globe.Action = EnumAction3D.ActionNull;
-
-
}
+ m_isDrawRedPology = false;
+ globeControl1.Globe.Action = EnumAction3D.ActionNull;
}
///
@@ -2627,7 +2332,7 @@
}
}
///
- /// (完善)
+ /// (完善)#wxl 待整理
///
///
///
@@ -2907,7 +2612,7 @@
}
///
- /// 鼠标点击, 弹出气泡功能globeControl1
+ /// 鼠标点击, 弹出气泡功能globeControl1 wxl待整理
///
///
///
@@ -2916,34 +2621,30 @@
GSOFeature feature = e.Feature;
string str1 = "";
- if (feature != null)
+ if (feature == null) return;
+ if (feature.GetFieldDefn("图片编码") != null)//
{
- if (feature.GetFieldDefn("图片编码") != null)//
+ str1 = GetBubbleInfo(feature, globeControl1);
+ if (RemoteFileExists(Utility.PicRootURL + feature.GetValue("图片编码")))
{
- str1 = GetBubbleInfo(feature, globeControl1);
- if (RemoteFileExists(Utility.PicRootURL + feature.GetValue("图片编码")))
- {
- str1 += "
";
- }
- else if (RemoteFileExists(Utility.PicDefaultURL))
- {
- str1 += "
";
- }
+ str1 += "
";
}
- else if (isFeatureContainsBianhao(feature)) //管线模型图层
+ else if (RemoteFileExists(Utility.PicDefaultURL))
{
- str1 = GetBubbleInfo(feature, globeControl1);
- }
-
- if (str1 != "")
- {
- featureTooltip.HideBalloon();
- balloonEx.HideBalloon();
- balloonEx.SetSize(EnumSizeIndexEx.CONTENT_CX, 480);
- balloonEx.SetSize(EnumSizeIndexEx.CONTENT_CY, 420);
- balloonEx.ShowBalloon((int)e.MousePos.X, (int)e.MousePos.Y, str1);
+ str1 += "
";
}
}
+ else if (isFeatureContainsBianhao(feature)) //管线模型图层
+ {
+ str1 = GetBubbleInfo(feature, globeControl1);
+ }
+
+ if (str1 == "") return;
+ featureTooltip.HideBalloon();
+ balloonEx.HideBalloon();
+ balloonEx.SetSize(EnumSizeIndexEx.CONTENT_CX, 480);
+ balloonEx.SetSize(EnumSizeIndexEx.CONTENT_CY, 420);
+ balloonEx.ShowBalloon((int)e.MousePos.X, (int)e.MousePos.Y, str1);
}
///
@@ -2956,35 +2657,30 @@
GSOFeature feature = e.Feature;
string str1 = "";
- if (feature != null)
+ if (feature == null) return;
+ if (feature.GetFieldDefn("图片编码") != null) //
{
- if (feature.GetFieldDefn("图片编码") != null) //
+ str1 = GetBubbleInfo(feature, globeControl2);
+ if (RemoteFileExists(Utility.PicRootURL + feature.GetValue("图片编码")))
{
- str1 = GetBubbleInfo(feature, globeControl2);
- if (RemoteFileExists(Utility.PicRootURL + feature.GetValue("图片编码")))
- {
- str1 += "
";
- }
- else if (RemoteFileExists(Utility.PicDefaultURL))
- {
- str1 += "
";
- }
+ str1 += "
";
}
- else if (isFeatureContainsBianhao(feature)) //管线模型图层
+ else if (RemoteFileExists(Utility.PicDefaultURL))
{
- str1 = GetBubbleInfo(feature, globeControl2);
- }
-
- if (str1 != "")
- {
-
- featureTooltip2.HideBalloon();
- balloonEx2.HideBalloon();
- balloonEx2.SetSize(EnumSizeIndexEx.CONTENT_CX, 480);
- balloonEx2.SetSize(EnumSizeIndexEx.CONTENT_CY, 420);
- balloonEx2.ShowBalloon((int)e.MousePos.X, (int)e.MousePos.Y, str1);
+ str1 += "
";
}
}
+ else if (isFeatureContainsBianhao(feature)) //管线模型图层
+ {
+ str1 = GetBubbleInfo(feature, globeControl2);
+ }
+
+ if (str1 == "") return;
+ featureTooltip2.HideBalloon();
+ balloonEx2.HideBalloon();
+ balloonEx2.SetSize(EnumSizeIndexEx.CONTENT_CX, 480);
+ balloonEx2.SetSize(EnumSizeIndexEx.CONTENT_CY, 420);
+ balloonEx2.ShowBalloon((int)e.MousePos.X, (int)e.MousePos.Y, str1);
}
///
@@ -3011,15 +2707,13 @@
for (int i = 0; i < Utility.listPipelineType.Count; i++)
{
PipelineType pipelineType = Utility.listPipelineType[i];
- if (pipelineType != null && pipelineType.code.Trim() == pipelinecode.Trim())
+ if (pipelineType == null || pipelineType.code.Trim() != pipelinecode.Trim()) continue;
+ title = pipelineType.type + " " + pipelineType.name;
+ if (pipelineType.type == pipelineType.name)
{
- title = pipelineType.type + " " + pipelineType.name;
- if (pipelineType.type == pipelineType.name)
- {
- title = pipelineType.type;
- }
- break;
+ title = pipelineType.type;
}
+ break;
}
}
}
@@ -3172,8 +2866,8 @@
return str;
}
- string filename = Utility.filename;
- List g1layername = new List();
+ //string filename = Utility.filename;
+ //List g1layername = new List();
///
/// 获取目标图层
@@ -3229,17 +2923,15 @@
for (int n = 0; n < tempChildNode1.Nodes.Count; n++)
{
TreeNode tempChildNode2 = tempChildNode1.Nodes[n];
- if (tempChildNode2.Tag.ToString().Split('|').Length > 1)
+ if (tempChildNode2.Tag.ToString().Split('|').Length <= 1) continue;
+ GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(tempChildNode2.Tag.ToString().Split('|')[1]);
+ if (layer == null)
{
- GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(tempChildNode2.Tag.ToString().Split('|')[1]);
- if (layer == null)
- {
- continue;
- }
- if (tempChildNode2.Tag != null && layer.IsDestLayerFeatureAdd())
- {
- return tempChildNode2;
- }
+ continue;
+ }
+ if (tempChildNode2.Tag != null && layer.IsDestLayerFeatureAdd())
+ {
+ return tempChildNode2;
}
}
}
@@ -3260,35 +2952,33 @@
//日志记录
LogManager.saveLog(Utility.userName, buttonItem87.Text);
- if (!buttonItem87.Checked)
- {
- buttonItem87.Checked = true;
- buttonItem88.Checked = false;
- buttonItem27.Checked = false;
+ if (buttonItem87.Checked) return;
+ buttonItem87.Checked = true;
+ buttonItem88.Checked = false;
+ buttonItem27.Checked = false;
- switch (globeControl1.Globe.CameraMode)
- {
- case EnumCameraMode.UnderGround:
- globeControl1.Globe.CameraMode = EnumCameraMode.Navigation;
- GSOCameraState state = new GSOCameraState();
- state.AltitudeMode = globeControl1.Globe.CameraState.AltitudeMode;
- state.Altitude = globeControl1.Globe.CameraState.Altitude;
- state.Distance = globeControl1.Globe.CameraState.Distance;
- state.Heading = globeControl1.Globe.CameraState.Heading;
- state.Latitude = globeControl1.Globe.CameraState.Latitude;
- state.Longitude = globeControl1.Globe.CameraState.Longitude;
- if (globeControl1.Globe.CameraState.Tilt < 95 && globeControl1.Globe.CameraState.Tilt > 85)
- state.Tilt = 85;
- else
- state.Tilt = 180 - globeControl1.Globe.CameraState.Tilt;
- globeControl1.Globe.JumpToCameraState(state);
- break;
- case EnumCameraMode.Walk:
- globeControl1.Globe.CameraMode = EnumCameraMode.Navigation;
- break;
- }
- globeControl1.Globe.Refresh();
+ switch (globeControl1.Globe.CameraMode)
+ {
+ case EnumCameraMode.UnderGround:
+ globeControl1.Globe.CameraMode = EnumCameraMode.Navigation;
+ GSOCameraState state = new GSOCameraState();
+ state.AltitudeMode = globeControl1.Globe.CameraState.AltitudeMode;
+ state.Altitude = globeControl1.Globe.CameraState.Altitude;
+ state.Distance = globeControl1.Globe.CameraState.Distance;
+ state.Heading = globeControl1.Globe.CameraState.Heading;
+ state.Latitude = globeControl1.Globe.CameraState.Latitude;
+ state.Longitude = globeControl1.Globe.CameraState.Longitude;
+ if (globeControl1.Globe.CameraState.Tilt < 95 && globeControl1.Globe.CameraState.Tilt > 85)
+ state.Tilt = 85;
+ else
+ state.Tilt = 180 - globeControl1.Globe.CameraState.Tilt;
+ globeControl1.Globe.JumpToCameraState(state);
+ break;
+ case EnumCameraMode.Walk:
+ globeControl1.Globe.CameraMode = EnumCameraMode.Navigation;
+ break;
}
+ globeControl1.Globe.Refresh();
}
///
/// 地下模式 菜单按钮
@@ -3300,33 +2990,31 @@
//日志记录
LogManager.saveLog(Utility.userName, buttonItem88.Text);
- if (!buttonItem88.Checked)
- {
- buttonItem88.Checked = true;
- buttonItem27.Checked = false;
- buttonItem87.Checked = false;
+ if (buttonItem88.Checked) return;
+ buttonItem88.Checked = true;
+ buttonItem27.Checked = false;
+ buttonItem87.Checked = false;
- switch (globeControl1.Globe.CameraMode)
- {
- case EnumCameraMode.Navigation:
- case EnumCameraMode.Walk:
- globeControl1.Globe.CameraMode = EnumCameraMode.UnderGround;
- GSOCameraState state = new GSOCameraState();
- state.AltitudeMode = globeControl1.Globe.CameraState.AltitudeMode;
- state.Altitude = globeControl1.Globe.CameraState.Altitude;
- state.Distance = globeControl1.Globe.CameraState.Distance;
- state.Heading = globeControl1.Globe.CameraState.Heading;
- state.Latitude = globeControl1.Globe.CameraState.Latitude;
- state.Longitude = globeControl1.Globe.CameraState.Longitude;
- if (globeControl1.Globe.CameraState.Tilt < 95 && globeControl1.Globe.CameraState.Tilt > 85)
- state.Tilt = 95;
- else
- state.Tilt = 180 - globeControl1.Globe.CameraState.Tilt;
- globeControl1.Globe.JumpToCameraState(state);
- break;
- }
- globeControl1.Globe.Refresh();
+ switch (globeControl1.Globe.CameraMode)
+ {
+ case EnumCameraMode.Navigation:
+ case EnumCameraMode.Walk:
+ globeControl1.Globe.CameraMode = EnumCameraMode.UnderGround;
+ GSOCameraState state = new GSOCameraState();
+ state.AltitudeMode = globeControl1.Globe.CameraState.AltitudeMode;
+ state.Altitude = globeControl1.Globe.CameraState.Altitude;
+ state.Distance = globeControl1.Globe.CameraState.Distance;
+ state.Heading = globeControl1.Globe.CameraState.Heading;
+ state.Latitude = globeControl1.Globe.CameraState.Latitude;
+ state.Longitude = globeControl1.Globe.CameraState.Longitude;
+ if (globeControl1.Globe.CameraState.Tilt < 95 && globeControl1.Globe.CameraState.Tilt > 85)
+ state.Tilt = 95;
+ else
+ state.Tilt = 180 - globeControl1.Globe.CameraState.Tilt;
+ globeControl1.Globe.JumpToCameraState(state);
+ break;
}
+ globeControl1.Globe.Refresh();
}
///
/// 行走模式 菜单按钮
@@ -3338,14 +3026,12 @@
//日志记录
LogManager.saveLog(Utility.userName, buttonItem27.Text);
- if (!buttonItem27.Checked)
- {
- buttonItem27.Checked = true;
- buttonItem87.Checked = false;
- buttonItem88.Checked = false;
+ if (buttonItem27.Checked) return;
+ buttonItem27.Checked = true;
+ buttonItem87.Checked = false;
+ buttonItem88.Checked = false;
- globeControl1.Globe.CameraMode = EnumCameraMode.Walk;
- }
+ globeControl1.Globe.CameraMode = EnumCameraMode.Walk;
}
///
/// 地面透明度设置 菜单
@@ -3357,7 +3043,7 @@
LogManager.saveLog(Utility.userName, sliderGroundTransSet1.Text);
globeControl1.Globe.GroundOpaque = 100 - sliderGroundTransSet1.Value;
- GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(roadLayerName);//("180fd");
+ GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(Utility.roadLayerName);//("180fd");
if (layer != null)
layer.Opaque = 100 - sliderGroundTransSet1.Value;
optiValue = sliderGroundTransSet1.Value;
@@ -3890,24 +3576,22 @@
///
private void comboBoxEx1_SelectedIndexChanged(object sender, EventArgs e)
{
- if (comboBoxEx1.SelectedIndex > -1)
- {
- dataGridViewX2.Rows.Clear();
- dataGridViewX3.Rows.Clear();
- listBox1.Items.Clear();
- GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(comboBoxEx1.SelectedItem.ToString());
- if (layer == null)
- return;
+ if (comboBoxEx1.SelectedIndex <= -1) return;
+ dataGridViewX2.Rows.Clear();
+ dataGridViewX3.Rows.Clear();
+ listBox1.Items.Clear();
+ GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(comboBoxEx1.SelectedItem.ToString());
+ if (layer == null)
+ return;
- GSOFeatureLayer flayer = layer as GSOFeatureLayer;
- GSOFeatureDataset fdataset = flayer.Dataset as GSOFeatureDataset;
- GSOFeatures feats = flayer.GetAllFeatures();
- for (int i = 0; i < feats.Length; i++)
- {
- int idx = dataGridViewX2.Rows.Add();
- dataGridViewX2.Rows[idx].Cells[0].Value = comboBoxEx1.SelectedItem.ToString();
- dataGridViewX2.Rows[idx].Cells[1].Value = feats[i].Name;
- }
+ GSOFeatureLayer flayer = layer as GSOFeatureLayer;
+ GSOFeatureDataset fdataset = flayer.Dataset as GSOFeatureDataset;
+ GSOFeatures feats = flayer.GetAllFeatures();
+ for (int i = 0; i < feats.Length; i++)
+ {
+ int idx = dataGridViewX2.Rows.Add();
+ dataGridViewX2.Rows[idx].Cells[0].Value = comboBoxEx1.SelectedItem.ToString();
+ dataGridViewX2.Rows[idx].Cells[1].Value = feats[i].Name;
}
}
///
@@ -3917,24 +3601,22 @@
///
private void comboBoxEx1_SelectedIndexChanged_shuiping(object sender, EventArgs e)
{
- if (comboBoxEx4.SelectedIndex > -1)
- {
- dataGridViewX8.Rows.Clear();
- dataGridViewX9.Rows.Clear();
- listBox3.Items.Clear();
- GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(comboBoxEx4.SelectedItem.ToString());
- if (layer == null)
- return;
+ if (comboBoxEx4.SelectedIndex <= -1) return;
+ dataGridViewX8.Rows.Clear();
+ dataGridViewX9.Rows.Clear();
+ listBox3.Items.Clear();
+ GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(comboBoxEx4.SelectedItem.ToString());
+ if (layer == null)
+ return;
- GSOFeatureLayer flayer = layer as GSOFeatureLayer;
- GSOFeatureDataset fdataset = flayer.Dataset as GSOFeatureDataset;
- GSOFeatures feats = flayer.GetAllFeatures();
- for (int i = 0; i < feats.Length; i++)
- {
- int idx = dataGridViewX8.Rows.Add();
- dataGridViewX8.Rows[idx].Cells[0].Value = comboBoxEx4.SelectedItem.ToString();
- dataGridViewX8.Rows[idx].Cells[1].Value = feats[i].Name;
- }
+ GSOFeatureLayer flayer = layer as GSOFeatureLayer;
+ GSOFeatureDataset fdataset = flayer.Dataset as GSOFeatureDataset;
+ GSOFeatures feats = flayer.GetAllFeatures();
+ for (int i = 0; i < feats.Length; i++)
+ {
+ int idx = dataGridViewX8.Rows.Add();
+ dataGridViewX8.Rows[idx].Cells[0].Value = comboBoxEx4.SelectedItem.ToString();
+ dataGridViewX8.Rows[idx].Cells[1].Value = feats[i].Name;
}
}
Dictionary featCount = new Dictionary();
@@ -3984,7 +3666,7 @@
if (selectedFeature != null)
{
selectState = 1;
- VerticalDistanceAnalysis("垂直净距分析", selectedFeature, m_PipelineLayerNames, dJingJuBiaoZhun, 0.0);
+ VerticalDistanceAnalysis("垂直净距分析", selectedFeature, Utility.m_PipelineLayerNames, dJingJuBiaoZhun, 0.0);
}
}
}
@@ -4005,16 +3687,16 @@
for (int i = 0; i < feats.Length; i++)
{
selectState = 1;
- VerticalDistanceAnalysis("垂直净距分析", feats[i], m_PipelineLayerNames, dJingJuBiaoZhun, 0.0);
+ VerticalDistanceAnalysis("垂直净距分析", feats[i], Utility.m_PipelineLayerNames, dJingJuBiaoZhun, 0.0);
}
}
if (featCount.Count > 0)
{
- for (int i = 0; i < m_PipelineLayerNames.Count; i++)
+ for (int i = 0; i < Utility.m_PipelineLayerNames.Count; i++)
{
- if (featCount.ContainsKey(m_PipelineLayerNames[i]) && featLenth.ContainsKey(m_PipelineLayerNames[i]))
+ if (featCount.ContainsKey(Utility.m_PipelineLayerNames[i]) && featLenth.ContainsKey(Utility.m_PipelineLayerNames[i]))
{
- listBox1.Items.Add(m_PipelineLayerNames[i] + ":" + featCount[m_PipelineLayerNames[i]] + "条,共" + featLenth[m_PipelineLayerNames[i]].ToString("0.00") + "米");
+ listBox1.Items.Add(Utility.m_PipelineLayerNames[i] + ":" + featCount[Utility.m_PipelineLayerNames[i]] + "条,共" + featLenth[Utility.m_PipelineLayerNames[i]].ToString("0.00") + "米");
}
}
}
@@ -4130,112 +3812,110 @@
continue;
}
GSOLayer layer2 = globeControl1.Globe.Layers.GetLayerByCaption(_pipelineLayerNames[i]);
- if (layer2 != null)
+ if (layer2 == null) continue;
+ GSOFeatureLayer flayer2 = layer2 as GSOFeatureLayer;
+ GSOFeatureDataset fdataset2 = flayer2.Dataset as GSOFeatureDataset;
+ GSOFeatures feats2 = Polygon_Contain_PointAnalysis(polygon, _pipelineLayerNames[i]);
+ for (int j = 0; j < feats2.Length; j++)
{
- GSOFeatureLayer flayer2 = layer2 as GSOFeatureLayer;
- GSOFeatureDataset fdataset2 = flayer2.Dataset as GSOFeatureDataset;
- GSOFeatures feats2 = Polygon_Contain_PointAnalysis(polygon, _pipelineLayerNames[i]);
- for (int j = 0; j < feats2.Length; j++)
- {
- GSOFeature feat2 = feats2[j];
- GSOGeoPolyline3D line2 = feats2[j].Geometry as GSOGeoPolyline3D;
- if (line2 == null) continue;
- GSOPipeLineStyle3D pipeStyle1 = line1.Style as GSOPipeLineStyle3D;
- GSOPipeLineStyle3D pipeStyle2 = line2.Style as GSOPipeLineStyle3D;
- if (pipeStyle1 == null || pipeStyle2 == null) continue;
+ GSOFeature feat2 = feats2[j];
+ GSOGeoPolyline3D line2 = feats2[j].Geometry as GSOGeoPolyline3D;
+ if (line2 == null) continue;
+ GSOPipeLineStyle3D pipeStyle1 = line1.Style as GSOPipeLineStyle3D;
+ GSOPipeLineStyle3D pipeStyle2 = line2.Style as GSOPipeLineStyle3D;
+ if (pipeStyle1 == null || pipeStyle2 == null) continue;
- double dDist = -1;
- dDist = globeControl1.Globe.Analysis3D.ComputeHorizonDistance(line1, line2, out pntIntersect1, out pntIntersect2, out pntProIntersect1, out pntProIntersect2, false);
+ double dDist = -1;
+ dDist = globeControl1.Globe.Analysis3D.ComputeHorizonDistance(line1, line2, out pntIntersect1, out pntIntersect2, out pntProIntersect1, out pntProIntersect2, false);
- if (dDist > -1)
+ if (dDist > -1)
+ {
+ dDist = Math.Abs(pntIntersect1.Z - pntIntersect2.Z) - pipeStyle1.Radius - pipeStyle2.Radius;//获得净距值
+
+ if (dDist < verticalDistance)
{
- dDist = Math.Abs(pntIntersect1.Z - pntIntersect2.Z) - pipeStyle1.Radius - pipeStyle2.Radius;//获得净距值
-
- if (dDist < verticalDistance)
+ int idx = -1;
+ GSOPoint3d markerPosition = new GSOPoint3d();
+ if (type == "垂直净距分析")
{
- int idx = -1;
- GSOPoint3d markerPosition = new GSOPoint3d();
- if (type == "垂直净距分析")
- {
- feat2.HighLight = true;
- markerPosition = LabelVerticalDistance(layerTemp, pntIntersect1, pntIntersect2, dDist, true);
+ feat2.HighLight = true;
+ markerPosition = LabelVerticalDistance(layerTemp, pntIntersect1, pntIntersect2, dDist, true);
- idx = dataGridViewX3.Rows.Add();
- dataGridViewX3.Rows[idx].Cells[0].Value = caption;
- dataGridViewX3.Rows[idx].Cells[1].Value = selectedFeature.Name;
- dataGridViewX3.Rows[idx].Cells[2].Value = layer2.Caption;
- dataGridViewX3.Rows[idx].Cells[3].Value = feat2.Name;
- dataGridViewX3.Rows[idx].Cells[4].Value = dDist.ToString("0.00");
- }
- else if (type == "碰撞分析")
- {
- feat2.HighLight = true;
- markerPosition = LabelVerticalDistance(layerTemp, pntIntersect1, pntIntersect2, dDist, false);
+ idx = dataGridViewX3.Rows.Add();
+ dataGridViewX3.Rows[idx].Cells[0].Value = caption;
+ dataGridViewX3.Rows[idx].Cells[1].Value = selectedFeature.Name;
+ dataGridViewX3.Rows[idx].Cells[2].Value = layer2.Caption;
+ dataGridViewX3.Rows[idx].Cells[3].Value = feat2.Name;
+ dataGridViewX3.Rows[idx].Cells[4].Value = dDist.ToString("0.00");
+ }
+ else if (type == "碰撞分析")
+ {
+ feat2.HighLight = true;
+ markerPosition = LabelVerticalDistance(layerTemp, pntIntersect1, pntIntersect2, dDist, false);
- selectedFeature.HighLight = true;
- idx = dataGridViewX5.Rows.Add();
- dataGridViewX5.Rows[idx].Cells[0].Value = dataGridViewX4.Rows[0].Cells[0].Value.ToString();
- dataGridViewX5.Rows[idx].Cells[1].Value = selectedFeature.Name;
- dataGridViewX5.Rows[idx].Cells[2].Value = layer2.Caption;
- dataGridViewX5.Rows[idx].Cells[3].Value = feat2.Name;
- }
- else if (type == "间距分析")
+ selectedFeature.HighLight = true;
+ idx = dataGridViewX5.Rows.Add();
+ dataGridViewX5.Rows[idx].Cells[0].Value = dataGridViewX4.Rows[0].Cells[0].Value.ToString();
+ dataGridViewX5.Rows[idx].Cells[1].Value = selectedFeature.Name;
+ dataGridViewX5.Rows[idx].Cells[2].Value = layer2.Caption;
+ dataGridViewX5.Rows[idx].Cells[3].Value = feat2.Name;
+ }
+ else if (type == "间距分析")
+ {
+ GSOGeoPolygon3D polygonSpacing = line2.CreateBuffer(horizontalDistance, true, 5, false, false);
+ if (polygonSpacing != null)
{
- GSOGeoPolygon3D polygonSpacing = line2.CreateBuffer(horizontalDistance, true, 5, false, false);
- if (polygonSpacing != null)
+ GSOFeatures horizontalFeatures = layer2.FindFeaturesInPolygon(polygonSpacing, false);
+ if (horizontalFeatures != null)
{
- GSOFeatures horizontalFeatures = layer2.FindFeaturesInPolygon(polygonSpacing, false);
- if (horizontalFeatures != null)
+ for (int m = 0; m < horizontalFeatures.Length; m++)
{
- for (int m = 0; m < horizontalFeatures.Length; m++)
+ GSOFeature horizontalFeature = horizontalFeatures[m];
+ if (horizontalFeature != null && horizontalFeature.ID == feat2.ID)
{
- GSOFeature horizontalFeature = horizontalFeatures[m];
- if (horizontalFeature != null && horizontalFeature.ID == feat2.ID)
- {
- feat2.HighLight = true;
- idx = dataGridViewAnalysisResult.Rows.Add();
- dataGridViewAnalysisResult.Rows[idx].Tag = feat2;
- dataGridViewAnalysisResult.Rows[idx].Cells[0].Value = dataGridViewLineList.Rows[0].Cells[0].Value.ToString();
- dataGridViewAnalysisResult.Rows[idx].Cells[1].Value = selectedFeature.Name;
- dataGridViewAnalysisResult.Rows[idx].Cells[2].Value = layer2.Caption;
- dataGridViewAnalysisResult.Rows[idx].Cells[3].Value = feat2.Name;
- dataGridViewAnalysisResult.Rows[idx].Cells[4].Value = dDist.ToString("0.00");
- dataGridViewAnalysisResult.Rows[idx].Cells[5].Value = horizontalDistance.ToString("0.00");
- break;
- }
+ feat2.HighLight = true;
+ idx = dataGridViewAnalysisResult.Rows.Add();
+ dataGridViewAnalysisResult.Rows[idx].Tag = feat2;
+ dataGridViewAnalysisResult.Rows[idx].Cells[0].Value = dataGridViewLineList.Rows[0].Cells[0].Value.ToString();
+ dataGridViewAnalysisResult.Rows[idx].Cells[1].Value = selectedFeature.Name;
+ dataGridViewAnalysisResult.Rows[idx].Cells[2].Value = layer2.Caption;
+ dataGridViewAnalysisResult.Rows[idx].Cells[3].Value = feat2.Name;
+ dataGridViewAnalysisResult.Rows[idx].Cells[4].Value = dDist.ToString("0.00");
+ dataGridViewAnalysisResult.Rows[idx].Cells[5].Value = horizontalDistance.ToString("0.00");
+ break;
}
}
}
}
+ }
- if (m_FeaturesWithBianhao.ContainsKey(selectedFeature.Name + "-" + feats2[j].Name) == false)
- {
- m_FeaturesWithBianhao.Add(selectedFeature.Name + "-" + feats2[j].Name, markerPosition);//添加飞行位置记录
- }
+ if (m_FeaturesWithBianhao.ContainsKey(selectedFeature.Name + "-" + feats2[j].Name) == false)
+ {
+ m_FeaturesWithBianhao.Add(selectedFeature.Name + "-" + feats2[j].Name, markerPosition);//添加飞行位置记录
+ }
- if (featCount.ContainsKey(layer2.Caption))
- {
- featCount[layer2.Caption] = featCount[layer2.Caption] + 1;
- }
- else
- {
- featCount.Add(layer2.Caption, 1);
- }
- if (featLenth.ContainsKey(layer2.Caption))
- {
- featLenth[layer2.Caption] = featLenth[layer2.Caption] + line2.GetSpaceLength(true, 6378137);
- }
- else
- {
- featLenth.Add(layer2.Caption, line2.GetSpaceLength(true, 6378137));
- }
+ if (featCount.ContainsKey(layer2.Caption))
+ {
+ featCount[layer2.Caption] = featCount[layer2.Caption] + 1;
+ }
+ else
+ {
+ featCount.Add(layer2.Caption, 1);
+ }
+ if (featLenth.ContainsKey(layer2.Caption))
+ {
+ featLenth[layer2.Caption] = featLenth[layer2.Caption] + line2.GetSpaceLength(true, 6378137);
+ }
+ else
+ {
+ featLenth.Add(layer2.Caption, line2.GetSpaceLength(true, 6378137));
}
}
- line2.ReleaseInnerPointer();
- feat2.ReleaseInnerPointer();
}
- feats2.ReleaseInnerPointer();
+ line2.ReleaseInnerPointer();
+ feat2.ReleaseInnerPointer();
}
+ feats2.ReleaseInnerPointer();
}
line1.ReleaseInnerPointer();
selectedFeature.ReleaseInnerPointer();
@@ -4302,7 +3982,7 @@
if (selectedFeature != null)
{
selectState = 1;
- HorizontalDistanceAnalysis(selectedFeature, m_PipelineLayerNames, dJingJuBiaoZhun);
+ HorizontalDistanceAnalysis(selectedFeature, Utility.m_PipelineLayerNames, dJingJuBiaoZhun);
}
}
}
@@ -4317,16 +3997,16 @@
GSOFeatures feats = flayer.GetAllFeatures();
for (int i = 0; i < feats.Length; i++)
{
- HorizontalDistanceAnalysis(feats[i], m_PipelineLayerNames, dJingJuBiaoZhun);
+ HorizontalDistanceAnalysis(feats[i], Utility.m_PipelineLayerNames, dJingJuBiaoZhun);
}
}
if (featCount.Count > 0) //统计结果
{
- for (int i = 0; i < m_PipelineLayerNames.Count; i++)
+ for (int i = 0; i < Utility.m_PipelineLayerNames.Count; i++)
{
- if (featCount.ContainsKey(m_PipelineLayerNames[i]) && featLenth.ContainsKey(m_PipelineLayerNames[i]))
+ if (featCount.ContainsKey(Utility.m_PipelineLayerNames[i]) && featLenth.ContainsKey(Utility.m_PipelineLayerNames[i]))
{
- listBox3.Items.Add(m_PipelineLayerNames[i] + ":" + featCount[m_PipelineLayerNames[i]] + "条,共" + featLenth[m_PipelineLayerNames[i]].ToString("0.00") + "米");
+ listBox3.Items.Add(Utility.m_PipelineLayerNames[i] + ":" + featCount[Utility.m_PipelineLayerNames[i]] + "条,共" + featLenth[Utility.m_PipelineLayerNames[i]].ToString("0.00") + "米");
}
}
}
@@ -4381,51 +4061,49 @@
continue;
}
GSOLayer layer2 = globeControl1.Globe.Layers.GetLayerByCaption(_pipelineLayerNames[i]);
- if (layer2 != null)
+ if (layer2 == null) continue;
+ GSOFeatureLayer flayer2 = layer2 as GSOFeatureLayer;
+ GSOFeatureDataset fdataset2 = flayer2.Dataset as GSOFeatureDataset;
+ GSOFeatures feats2 = Polygon_Contain_PointAnalysis(polygon, _pipelineLayerNames[i]);
+ for (int j = 0; j < feats2.Length; j++)
{
- GSOFeatureLayer flayer2 = layer2 as GSOFeatureLayer;
- GSOFeatureDataset fdataset2 = flayer2.Dataset as GSOFeatureDataset;
- GSOFeatures feats2 = Polygon_Contain_PointAnalysis(polygon, _pipelineLayerNames[i]);
- for (int j = 0; j < feats2.Length; j++)
+ GSOFeature feat2 = feats2[j];
+ GSOGeoPolyline3D line2 = feats2[j].Geometry as GSOGeoPolyline3D;
+ if (line2 == null)
{
- GSOFeature feat2 = feats2[j];
- GSOGeoPolyline3D line2 = feats2[j].Geometry as GSOGeoPolyline3D;
- if (line2 == null)
- {
- continue;
- }
- GSOPipeLineStyle3D pipeStyle1 = line1.Style as GSOPipeLineStyle3D;
- GSOPipeLineStyle3D pipeStyle2 = line2.Style as GSOPipeLineStyle3D;
- if (pipeStyle1 == null || pipeStyle2 == null)
- {
- continue;
- }
+ continue;
+ }
+ GSOPipeLineStyle3D pipeStyle1 = line1.Style as GSOPipeLineStyle3D;
+ GSOPipeLineStyle3D pipeStyle2 = line2.Style as GSOPipeLineStyle3D;
+ if (pipeStyle1 == null || pipeStyle2 == null)
+ {
+ continue;
+ }
- feat2.HighLight = true;
- int idx = dataGridViewX9.Rows.Add();
- dataGridViewX9.Rows[idx].Tag = feat2;
- dataGridViewX9.Rows[idx].Cells[0].Value = caption;
- dataGridViewX9.Rows[idx].Cells[1].Value = selectedFeature.Name;
- dataGridViewX9.Rows[idx].Cells[2].Value = layer2.Caption;
- dataGridViewX9.Rows[idx].Cells[3].Value = feats2[j].Name;
- dataGridViewX9.Rows[idx].Cells[4].Value = dis.ToString("0.00");
+ feat2.HighLight = true;
+ int idx = dataGridViewX9.Rows.Add();
+ dataGridViewX9.Rows[idx].Tag = feat2;
+ dataGridViewX9.Rows[idx].Cells[0].Value = caption;
+ dataGridViewX9.Rows[idx].Cells[1].Value = selectedFeature.Name;
+ dataGridViewX9.Rows[idx].Cells[2].Value = layer2.Caption;
+ dataGridViewX9.Rows[idx].Cells[3].Value = feats2[j].Name;
+ dataGridViewX9.Rows[idx].Cells[4].Value = dis.ToString("0.00");
- if (featCount.ContainsKey(layer2.Caption))
- {
- featCount[layer2.Caption] = featCount[layer2.Caption] + 1;
- }
- else
- {
- featCount.Add(layer2.Caption, 1);
- }
- if (featLenth.ContainsKey(layer2.Caption))
- {
- featLenth[layer2.Caption] = featLenth[layer2.Caption] + line2.GetSpaceLength(true, 6378137);
- }
- else
- {
- featLenth.Add(layer2.Caption, line2.GetSpaceLength(true, 6378137));
- }
+ if (featCount.ContainsKey(layer2.Caption))
+ {
+ featCount[layer2.Caption] = featCount[layer2.Caption] + 1;
+ }
+ else
+ {
+ featCount.Add(layer2.Caption, 1);
+ }
+ if (featLenth.ContainsKey(layer2.Caption))
+ {
+ featLenth[layer2.Caption] = featLenth[layer2.Caption] + line2.GetSpaceLength(true, 6378137);
+ }
+ else
+ {
+ featLenth.Add(layer2.Caption, line2.GetSpaceLength(true, 6378137));
}
}
}
@@ -4437,29 +4115,23 @@
///
private void dataGridViewX9_MouseDoubleClick(object sender, MouseEventArgs e)
{
- if (e.Button == MouseButtons.Left)
+ if (e.Button != MouseButtons.Left) return;
+ DataGridView.HitTestInfo hittestinfo = dataGridViewX9.HitTest(e.X, e.Y);
+ if (hittestinfo.RowIndex <= -1) return;
+ GSOFeature rowFeature = dataGridViewX9.Rows[hittestinfo.RowIndex].Tag as GSOFeature;
+ if (rowFeature == null) return;
+ if (rowFeature.Geometry != null && rowFeature.Geometry.Type == EnumGeometryType.GeoPolyline3D)
{
- DataGridView.HitTestInfo hittestinfo = dataGridViewX9.HitTest(e.X, e.Y);
- if (hittestinfo.RowIndex > -1)
- {
- GSOFeature rowFeature = dataGridViewX9.Rows[hittestinfo.RowIndex].Tag as GSOFeature;
- if (rowFeature != null)
- {
- if (rowFeature.Geometry != null && rowFeature.Geometry.Type == EnumGeometryType.GeoPolyline3D)
- {
- GSOGeoPolyline3D line = rowFeature.Geometry as GSOGeoPolyline3D;
- double length = line.GetSpaceLength(true, 6378137);
- GSOGeoPolyline3D lineLine = line.GetSegment(0, length / 2);
- GSOPoint3d point3d = lineLine[lineLine.PartCount - 1][lineLine[lineLine.PartCount - 1].Count - 1];
+ GSOGeoPolyline3D line = rowFeature.Geometry as GSOGeoPolyline3D;
+ double length = line.GetSpaceLength(true, 6378137);
+ GSOGeoPolyline3D lineLine = line.GetSegment(0, length / 2);
+ GSOPoint3d point3d = lineLine[lineLine.PartCount - 1][lineLine[lineLine.PartCount - 1].Count - 1];
- globeControl1.Globe.JumpToPosition(point3d, EnumAltitudeMode.Absolute, 5);
- }
- else
- {
- globeControl1.Globe.JumpToFeature(rowFeature, 5);
- }
- }
- }
+ globeControl1.Globe.JumpToPosition(point3d, EnumAltitudeMode.Absolute, 5);
+ }
+ else
+ {
+ globeControl1.Globe.JumpToFeature(rowFeature, 5);
}
}
///
@@ -4494,7 +4166,7 @@
if (selectedFeature != null)
{
selectState = 1;
- VerticalDistanceAnalysis("碰撞分析", selectedFeature, m_PipelineLayerNames, 0, 0.0);
+ VerticalDistanceAnalysis("碰撞分析", selectedFeature, Utility.m_PipelineLayerNames, 0, 0.0);
}
}
}
@@ -4510,17 +4182,17 @@
for (int i = 0; i < feats.Length; i++)
{
selectState = 1;
- VerticalDistanceAnalysis("碰撞分析", feats[i], m_PipelineLayerNames, 0, 0.0);
+ VerticalDistanceAnalysis("碰撞分析", feats[i], Utility.m_PipelineLayerNames, 0, 0.0);
}
}
if (featCount.Count > 0)
{
- for (int i = 0; i < m_PipelineLayerNames.Count; i++)
+ for (int i = 0; i < Utility.m_PipelineLayerNames.Count; i++)
{
- if (featCount.ContainsKey(m_PipelineLayerNames[i]) && featLenth.ContainsKey(m_PipelineLayerNames[i]))
+ if (featCount.ContainsKey(Utility.m_PipelineLayerNames[i]) && featLenth.ContainsKey(Utility.m_PipelineLayerNames[i]))
{
- listBox2.Items.Add(m_PipelineLayerNames[i] + ":" + featCount[m_PipelineLayerNames[i]] + "条,共" + featLenth[m_PipelineLayerNames[i]].ToString("0.00") + "米");
+ listBox2.Items.Add(Utility.m_PipelineLayerNames[i] + ":" + featCount[Utility.m_PipelineLayerNames[i]] + "条,共" + featLenth[Utility.m_PipelineLayerNames[i]].ToString("0.00") + "米");
}
}
}
@@ -4543,17 +4215,13 @@
///
private void dataGridViewX5_MouseDoubleClick(object sender, MouseEventArgs e)
{
- if (e.Button == MouseButtons.Left)
+ if (e.Button != MouseButtons.Left) return;
+ DataGridView.HitTestInfo hittestinfo = dataGridViewX5.HitTest(e.X, e.Y);
+ if (hittestinfo.RowIndex <= -1) return;
+ string key = dataGridViewX5.Rows[hittestinfo.RowIndex].Cells[1].Value.ToString().Trim() + "-" + dataGridViewX5.Rows[hittestinfo.RowIndex].Cells[3].Value.ToString().Trim();
+ if (m_FeaturesWithBianhao.ContainsKey(key))
{
- DataGridView.HitTestInfo hittestinfo = dataGridViewX5.HitTest(e.X, e.Y);
- if (hittestinfo.RowIndex > -1)
- {
- string key = dataGridViewX5.Rows[hittestinfo.RowIndex].Cells[1].Value.ToString().Trim() + "-" + dataGridViewX5.Rows[hittestinfo.RowIndex].Cells[3].Value.ToString().Trim();
- if (m_FeaturesWithBianhao.ContainsKey(key))
- {
- globeControl1.Globe.JumpToPosition(m_FeaturesWithBianhao[key], EnumAltitudeMode.Absolute, 5);
- }
- }
+ globeControl1.Globe.JumpToPosition(m_FeaturesWithBianhao[key], EnumAltitudeMode.Absolute, 5);
}
}
///
@@ -4611,25 +4279,23 @@
///
private void comboBoxEx3_SelectedIndexChanged(object sender, EventArgs e)
{
- if (comboBoxEx3.SelectedIndex > -1)
+ if (comboBoxEx3.SelectedIndex <= -1) return;
+ dataGridViewX6.Rows.Clear();
+ dataGridViewX7.Rows.Clear();
+
+ GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(comboBoxEx3.SelectedItem.ToString());
+ if (layer == null)
+ return;
+
+ GSOFeatureLayer flayer = layer as GSOFeatureLayer;
+ GSOFeatureDataset fdataset = flayer.Dataset as GSOFeatureDataset;
+ GSOFeatures feats = flayer.GetAllFeatures();
+
+ for (int i = 0; i < feats.Length; i++)
{
- dataGridViewX6.Rows.Clear();
- dataGridViewX7.Rows.Clear();
-
- GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(comboBoxEx3.SelectedItem.ToString());
- if (layer == null)
- return;
-
- GSOFeatureLayer flayer = layer as GSOFeatureLayer;
- GSOFeatureDataset fdataset = flayer.Dataset as GSOFeatureDataset;
- GSOFeatures feats = flayer.GetAllFeatures();
-
- for (int i = 0; i < feats.Length; i++)
- {
- int idx = dataGridViewX6.Rows.Add();
- dataGridViewX6.Rows[idx].Cells[0].Value = comboBoxEx3.SelectedItem.ToString();
- dataGridViewX6.Rows[idx].Cells[1].Value = feats[i].Name;
- }
+ int idx = dataGridViewX6.Rows.Add();
+ dataGridViewX6.Rows[idx].Cells[0].Value = comboBoxEx3.SelectedItem.ToString();
+ dataGridViewX6.Rows[idx].Cells[1].Value = feats[i].Name;
}
}
///
@@ -4670,51 +4336,47 @@
for (int i = 0; i < dataGridViewX6.Rows.Count; i++)
{
GSOFeature rowFeature = dataGridViewX6.Rows[i].Tag as GSOFeature;
- if (rowFeature != null)
+ if (rowFeature == null) continue;
+ string featureName = "";
+ if (isFeatureContainsBianhao(rowFeature))//判断rowFeature是否包含“编号”字段
{
- string featureName = "";
- if (isFeatureContainsBianhao(rowFeature))//判断rowFeature是否包含“编号”字段
- {
- featureName = rowFeature.GetValue(featureIDFieldName).ToString();
- }
- else
- {
- featureName = rowFeature.Name;
- }
+ featureName = rowFeature.GetValue(featureIDFieldName).ToString();
+ }
+ else
+ {
+ featureName = rowFeature.Name;
+ }
- GSOGeoPolyline3D line = rowFeature.Geometry as GSOGeoPolyline3D;
- if (line == null)
- {
- continue;
- }
- GSOPipeLineStyle3D style = line.Style as GSOPipeLineStyle3D;
- if (style == null)
- {
- continue;
- }
- if (line.PartCount > 0)
- {
- GSOPoint3ds pts = line[0];
- GSOPoint3d pt = new GSOPoint3d();
+ GSOGeoPolyline3D line = rowFeature.Geometry as GSOGeoPolyline3D;
+ if (line == null)
+ {
+ continue;
+ }
+ GSOPipeLineStyle3D style = line.Style as GSOPipeLineStyle3D;
+ if (style == null)
+ {
+ continue;
+ }
+ if (line.PartCount <= 0) continue;
+ GSOPoint3ds pts = line[0];
+ GSOPoint3d pt = new GSOPoint3d();
- for (int m = 0; m < pts.Count; m++)
- {
- if (Math.Abs(pts[m].Z + (style.Radius)) < Convert.ToDouble(textBoxX3.Text.Trim()))
- {
- rowFeature.HighLight = true;
- int idx = dataGridViewX7.Rows.Add();
- dataGridViewX7.Rows[idx].Tag = rowFeature;
- dataGridViewX7.Rows[idx].Cells[0].Value = rowFeature.Dataset.Caption;
- dataGridViewX7.Rows[idx].Cells[1].Value = featureName;
- dataGridViewX7.Rows[idx].Cells[2].Value = Math.Abs((pts[m].Z + (style.Radius))).ToString("0.00");
+ for (int m = 0; m < pts.Count; m++)
+ {
+ if (Math.Abs(pts[m].Z + (style.Radius)) < Convert.ToDouble(textBoxX3.Text.Trim()))
+ {
+ rowFeature.HighLight = true;
+ int idx = dataGridViewX7.Rows.Add();
+ dataGridViewX7.Rows[idx].Tag = rowFeature;
+ dataGridViewX7.Rows[idx].Cells[0].Value = rowFeature.Dataset.Caption;
+ dataGridViewX7.Rows[idx].Cells[1].Value = featureName;
+ dataGridViewX7.Rows[idx].Cells[2].Value = Math.Abs((pts[m].Z + (style.Radius))).ToString("0.00");
- pt.X = pts[m].X;
- pt.Y = pts[m].Y;
- pt.Z = 0;
- markerPosition = LabelVerticalDistance(layerTemp, pts[m], pt, Convert.ToDouble(dataGridViewX7.Rows[idx].Cells[2].Value), true);
- break;
- }
- }
+ pt.X = pts[m].X;
+ pt.Y = pts[m].Y;
+ pt.Z = 0;
+ markerPosition = LabelVerticalDistance(layerTemp, pts[m], pt, Convert.ToDouble(dataGridViewX7.Rows[idx].Cells[2].Value), true);
+ break;
}
}
}
@@ -4743,29 +4405,26 @@
GSOGeoPolyline3D line = f.Geometry as GSOGeoPolyline3D;
if (line == null) continue;
GSOPipeLineStyle3D style = line.Style as GSOPipeLineStyle3D;
- if (style == null) continue;
- if (line.PartCount > 0)
+ if (style == null || line.PartCount <= 0) continue;
+ GSOPoint3ds pts = line[0];
+ GSOPoint3d pt = new GSOPoint3d();
+ for (int m = 0; m < pts.Count; m++)
{
- GSOPoint3ds pts = line[0];
- GSOPoint3d pt = new GSOPoint3d();
- for (int m = 0; m < pts.Count; m++)
+ if (Math.Abs(pts[m].Z + (style.Radius)) < Convert.ToDouble(textBoxX3.Text.Trim()))
{
- if (Math.Abs(pts[m].Z + (style.Radius)) < Convert.ToDouble(textBoxX3.Text.Trim()))
- {
- f.HighLight = true;
- int idx = dataGridViewX7.Rows.Add();
- dataGridViewX7.Rows[idx].Tag = f;
- dataGridViewX7.Rows[idx].Cells[0].Value = layer.Caption;
- dataGridViewX7.Rows[idx].Cells[1].Value = featureName;
- dataGridViewX7.Rows[idx].Cells[2].Value = Math.Abs((pts[m].Z + (style.Radius))).ToString("0.00");
+ f.HighLight = true;
+ int idx = dataGridViewX7.Rows.Add();
+ dataGridViewX7.Rows[idx].Tag = f;
+ dataGridViewX7.Rows[idx].Cells[0].Value = layer.Caption;
+ dataGridViewX7.Rows[idx].Cells[1].Value = featureName;
+ dataGridViewX7.Rows[idx].Cells[2].Value = Math.Abs((pts[m].Z + (style.Radius))).ToString("0.00");
- pt.X = pts[m].X;
- pt.Y = pts[m].Y;
- pt.Z = 0;
- markerPosition = LabelVerticalDistance(layerTemp, pts[m], pt, Convert.ToDouble(dataGridViewX7.Rows[idx].Cells[2].Value), true);
+ pt.X = pts[m].X;
+ pt.Y = pts[m].Y;
+ pt.Z = 0;
+ markerPosition = LabelVerticalDistance(layerTemp, pts[m], pt, Convert.ToDouble(dataGridViewX7.Rows[idx].Cells[2].Value), true);
- break;
- }
+ break;
}
}
}
@@ -4789,29 +4448,23 @@
///
private void dataGridViewX7_MouseDoubleClick(object sender, MouseEventArgs e)
{
- if (e.Button == MouseButtons.Left)
+ if (e.Button != MouseButtons.Left) return;
+ DataGridView.HitTestInfo hittestinfo = dataGridViewX7.HitTest(e.X, e.Y);
+ if (hittestinfo.RowIndex <= -1) return;
+ GSOFeature rowFeature = dataGridViewX7.Rows[hittestinfo.RowIndex].Tag as GSOFeature;
+ if (rowFeature == null) return;
+ if (rowFeature.Geometry != null && rowFeature.Geometry.Type == EnumGeometryType.GeoPolyline3D)
{
- DataGridView.HitTestInfo hittestinfo = dataGridViewX7.HitTest(e.X, e.Y);
- if (hittestinfo.RowIndex > -1)
- {
- GSOFeature rowFeature = dataGridViewX7.Rows[hittestinfo.RowIndex].Tag as GSOFeature;
- if (rowFeature != null)
- {
- if (rowFeature.Geometry != null && rowFeature.Geometry.Type == EnumGeometryType.GeoPolyline3D)
- {
- GSOGeoPolyline3D line = rowFeature.Geometry as GSOGeoPolyline3D;
- double length = line.GetSpaceLength(true, 6378137);
- GSOGeoPolyline3D lineLine = line.GetSegment(0, length / 2);
- GSOPoint3d point3d = lineLine[lineLine.PartCount - 1][lineLine[lineLine.PartCount - 1].Count - 1];
+ GSOGeoPolyline3D line = rowFeature.Geometry as GSOGeoPolyline3D;
+ double length = line.GetSpaceLength(true, 6378137);
+ GSOGeoPolyline3D lineLine = line.GetSegment(0, length / 2);
+ GSOPoint3d point3d = lineLine[lineLine.PartCount - 1][lineLine[lineLine.PartCount - 1].Count - 1];
- globeControl1.Globe.JumpToPosition(point3d, EnumAltitudeMode.Absolute, 5);
- }
- else
- {
- globeControl1.Globe.JumpToFeature(rowFeature, 5);
- }
- }
- }
+ globeControl1.Globe.JumpToPosition(point3d, EnumAltitudeMode.Absolute, 5);
+ }
+ else
+ {
+ globeControl1.Globe.JumpToFeature(rowFeature, 5);
}
}
///
@@ -4972,85 +4625,83 @@
///
private void ExportExcel(string type, DataGridView _dataGridView, ListBox _listBox)
{
- if (_dataGridView.Rows.Count > 0)
+ if (_dataGridView.Rows.Count <= 0) return;
+ SaveFileDialog dlg = new SaveFileDialog();
+ dlg.Filter = "Excel files (*.xls)|*.xls";
+ dlg.FilterIndex = 0;
+ dlg.RestoreDirectory = true;
+ //dlg.CreatePrompt = true;
+ dlg.Title = "保存为Excel文件";
+ dlg.FileName = type + "-" + DateTime.Now.ToString("yyyyMMdd") + ".xls";
+ if (dlg.ShowDialog() == DialogResult.OK)
{
- SaveFileDialog dlg = new SaveFileDialog();
- dlg.Filter = "Excel files (*.xls)|*.xls";
- dlg.FilterIndex = 0;
- dlg.RestoreDirectory = true;
- //dlg.CreatePrompt = true;
- dlg.Title = "保存为Excel文件";
- dlg.FileName = type + "-" + DateTime.Now.ToString("yyyyMMdd") + ".xls";
- if (dlg.ShowDialog() == DialogResult.OK)
+ Stream myStream;
+ myStream = dlg.OpenFile();
+ StreamWriter sw = new StreamWriter(myStream, Encoding.GetEncoding(-0));
+ string columnTitle = "";
+ try
{
- Stream myStream;
- myStream = dlg.OpenFile();
- StreamWriter sw = new StreamWriter(myStream, Encoding.GetEncoding(-0));
- string columnTitle = "";
- try
+ if (_listBox != null)
{
- if (_listBox != null)
+ string strList = "";
+ for (int i = 0; i < _listBox.Items.Count; i++)
{
- string strList = "";
- for (int i = 0; i < _listBox.Items.Count; i++)
- {
- strList += _listBox.Items[i] + @"/";
- }
- sw.WriteLine("内容:" + type + " 日期:" + DateTime.Now.ToString("yyyy-MM-dd") + " 结果:" + strList);
+ strList += _listBox.Items[i] + @"/";
}
- else
+ sw.WriteLine("内容:" + type + " 日期:" + DateTime.Now.ToString("yyyy-MM-dd") + " 结果:" + strList);
+ }
+ else
+ {
+ sw.WriteLine("内容:" + type + " 日期:" + DateTime.Now.ToString("yyyy-MM-dd"));
+ }
+ //写入列标题
+ for (int i = 0; i < _dataGridView.ColumnCount; i++)
+ {
+ if (i > 0)
{
- sw.WriteLine("内容:" + type + " 日期:" + DateTime.Now.ToString("yyyy-MM-dd"));
+ columnTitle += "\t";
}
- //写入列标题
- for (int i = 0; i < _dataGridView.ColumnCount; i++)
- {
- if (i > 0)
- {
- columnTitle += "\t";
- }
- columnTitle += _dataGridView.Columns[i].HeaderText;
- }
- sw.WriteLine(columnTitle);
+ columnTitle += _dataGridView.Columns[i].HeaderText;
+ }
+ sw.WriteLine(columnTitle);
- //写入列内容
- for (int j = 0; j < _dataGridView.Rows.Count; j++)
+ //写入列内容
+ for (int j = 0; j < _dataGridView.Rows.Count; j++)
+ {
+ string columnValue = "";
+ for (int k = 0; k < _dataGridView.Columns.Count; k++)
{
- string columnValue = "";
- for (int k = 0; k < _dataGridView.Columns.Count; k++)
+ if (k > 0)
{
- if (k > 0)
- {
- columnValue += "\t";
- }
- if (_dataGridView.Rows[j].Cells[k].Value == null)
- {
- columnValue += "";
- }
- else
- {
- columnValue += _dataGridView.Rows[j].Cells[k].Value.ToString().Trim();
- }
+ columnValue += "\t";
}
+ if (_dataGridView.Rows[j].Cells[k].Value == null)
+ {
+ columnValue += "";
+ }
+ else
+ {
+ columnValue += _dataGridView.Rows[j].Cells[k].Value.ToString().Trim();
+ }
+ }
- sw.WriteLine(columnValue);
- }
- sw.Close();
- myStream.Close();
- if (MessageBox.Show("导出Excel文件成功!是否打开?", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
- {
- Process.Start(dlg.FileName);
- }
+ sw.WriteLine(columnValue);
}
- catch (Exception ex)
+ sw.Close();
+ myStream.Close();
+ if (MessageBox.Show("导出Excel文件成功!是否打开?", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
{
- //MessageBox.Show(ex.ToString());
+ Process.Start(dlg.FileName);
}
- finally
- {
- sw.Close();
- myStream.Close();
- }
+ }
+ catch (Exception ex)
+ {
+ //MessageBox.Show(ex.ToString());
+ }
+ finally
+ {
+ sw.Close();
+ myStream.Close();
}
}
}
@@ -5141,24 +4792,22 @@
///
private void comboBoxEx2_SelectedIndexChanged(object sender, EventArgs e)
{
- if (comboBoxEx2.SelectedIndex > -1)
- {
- listBox2.Items.Clear();
- dataGridViewX4.Rows.Clear();
- dataGridViewX5.Rows.Clear();
- GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(comboBoxEx2.SelectedItem.ToString());
- if (layer == null)
- return;
+ if (comboBoxEx2.SelectedIndex <= -1) return;
+ listBox2.Items.Clear();
+ dataGridViewX4.Rows.Clear();
+ dataGridViewX5.Rows.Clear();
+ GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(comboBoxEx2.SelectedItem.ToString());
+ if (layer == null)
+ return;
- GSOFeatureLayer flayer = layer as GSOFeatureLayer;
- GSOFeatureDataset fdataset = flayer.Dataset as GSOFeatureDataset;
- GSOFeatures feats = flayer.GetAllFeatures();
- for (int i = 0; i < feats.Length; i++)
- {
- int idx = dataGridViewX4.Rows.Add();
- dataGridViewX4.Rows[idx].Cells[0].Value = comboBoxEx2.SelectedItem.ToString();
- dataGridViewX4.Rows[idx].Cells[1].Value = feats[i].Name;
- }
+ GSOFeatureLayer flayer = layer as GSOFeatureLayer;
+ GSOFeatureDataset fdataset = flayer.Dataset as GSOFeatureDataset;
+ GSOFeatures feats = flayer.GetAllFeatures();
+ for (int i = 0; i < feats.Length; i++)
+ {
+ int idx = dataGridViewX4.Rows.Add();
+ dataGridViewX4.Rows[idx].Cells[0].Value = comboBoxEx2.SelectedItem.ToString();
+ dataGridViewX4.Rows[idx].Cells[1].Value = feats[i].Name;
}
}
///
@@ -5343,7 +4992,7 @@
if (selectedFeature != null)
{
selectState = 1;
- VerticalDistanceAnalysis("间距分析", selectedFeature, m_PipelineLayerNames, dVerticalJingJuBiaoZhun, dHorizontalJingJuBiaoZhun);//分析
+ VerticalDistanceAnalysis("间距分析", selectedFeature, Utility.m_PipelineLayerNames, dVerticalJingJuBiaoZhun, dHorizontalJingJuBiaoZhun);//分析
}
}
}
@@ -5374,16 +5023,16 @@
for (int i = 0; i < feats.Length; i++)
{
selectState = 1;
- VerticalDistanceAnalysis("间距分析", feats[i], m_PipelineLayerNames, dVerticalJingJuBiaoZhun, dHorizontalJingJuBiaoZhun);//分析
+ VerticalDistanceAnalysis("间距分析", feats[i], Utility.m_PipelineLayerNames, dVerticalJingJuBiaoZhun, dHorizontalJingJuBiaoZhun);//分析
}
}
if (featCount.Count > 0)
{
- for (int i = 0; i < m_PipelineLayerNames.Count; i++)
+ for (int i = 0; i < Utility.m_PipelineLayerNames.Count; i++)
{
- if (featCount.ContainsKey(m_PipelineLayerNames[i]) && featLenth.ContainsKey(m_PipelineLayerNames[i]))
+ if (featCount.ContainsKey(Utility.m_PipelineLayerNames[i]) && featLenth.ContainsKey(Utility.m_PipelineLayerNames[i]))
{
- listBoxStasticsResult.Items.Add(m_PipelineLayerNames[i] + ":" + featCount[m_PipelineLayerNames[i]] + "条,共" + featLenth[m_PipelineLayerNames[i]].ToString("0.00") + "米");
+ listBoxStasticsResult.Items.Add(Utility.m_PipelineLayerNames[i] + ":" + featCount[Utility.m_PipelineLayerNames[i]] + "条,共" + featLenth[Utility.m_PipelineLayerNames[i]].ToString("0.00") + "米");
}
}
}
@@ -5948,24 +5597,20 @@
///
private void addNodeToLayerManagerNode(GSOLayer layer)
{
- if (layer != null)
- {
- GSODataset dataset = layer.Dataset;
- CheckDatasetGeoReference(layer.Dataset, "");
+ if (layer == null) return;
+ GSODataset dataset = layer.Dataset;
+ CheckDatasetGeoReference(layer.Dataset, "");
- TreeNode node = new TreeNode();
- node.Tag = layer;
- node.Text = layer.Dataset.Caption;
- node.ImageIndex = 0;
- node.SelectedImageIndex = 0;
- node.Checked = layer.Visible;
+ TreeNode node = new TreeNode();
+ node.Tag = layer;
+ node.Text = layer.Dataset.Caption;
+ node.ImageIndex = 0;
+ node.SelectedImageIndex = 0;
+ node.Checked = layer.Visible;
- if (!layerManagerNode.Nodes.Contains(node))
- {
- layerManagerNode.Nodes.Insert(0, node);
- layerManagerNode.Expand();
- }
- }
+ if (layerManagerNode.Nodes.Contains(node)) return;
+ layerManagerNode.Nodes.Insert(0, node);
+ layerManagerNode.Expand();
}
///
/// 获取指定图层中最后一个feature对象的名称对应的整数
@@ -6008,31 +5653,29 @@
for (int i = 0; i < markerStrs.Length; i++)
{
GSOLayer markerLayer = globeControl1.Globe.Layers.GetLayerByCaption(markerStrs[i]);
- if (markerLayer != null)
+ if (markerLayer == null) continue;
+ if (markerStrs[i] != layerName)
{
- if (markerStrs[i] != layerName)
+ markerLayer.Visible = false;
+ if (layerMarkerTree.Nodes[0].Nodes.Count > i)
{
- markerLayer.Visible = false;
- if (layerMarkerTree.Nodes[0].Nodes.Count > i)
+ layerMarkerTree.Nodes[0].Nodes[i].Checked = false;
+ }
+ }
+ else
+ {
+ markerLayer.Visible = true;
+ for (int j = 0; j < markerLayer.GetAllFeatures().Length; j++)
+ {
+ GSOFeature markerFeature = markerLayer.GetAt(j);
+ if (markerFeature != null)
{
- layerMarkerTree.Nodes[0].Nodes[i].Checked = false;
+ markerFeature.Visible = false;
}
}
- else
+ if (layerMarkerTree.Nodes[0].Nodes.Count > i)
{
- markerLayer.Visible = true;
- for (int j = 0; j < markerLayer.GetAllFeatures().Length; j++)
- {
- GSOFeature markerFeature = markerLayer.GetAt(j);
- if (markerFeature != null)
- {
- markerFeature.Visible = false;
- }
- }
- if (layerMarkerTree.Nodes[0].Nodes.Count > i)
- {
- layerMarkerTree.Nodes[0].Nodes[i].Checked = true;
- }
+ layerMarkerTree.Nodes[0].Nodes[i].Checked = true;
}
}
}
@@ -6138,15 +5781,12 @@
private void toolStripMenuItem2_Click(object sender, EventArgs e)
{
TreeNode node = contextMenuStrip3.Tag as TreeNode;
+ if (node == null) return;
GSOFeature feature3d = node.Tag as GSOFeature;
- if (node == null)
- return;
- if (feature3d != null)
- {
- feature3d.Delete();
- globeControl1.Globe.Refresh();
- node.Remove();
- }
+ if (feature3d == null) return;
+ feature3d.Delete();
+ globeControl1.Globe.Refresh();
+ node.Remove();
}
///
/// 图层目录树的 节点对应的复选框选中状态改变事件处理
@@ -6213,12 +5853,10 @@
{
TreeNode node = contextMenuStrip2.Tag as TreeNode;
GSOLayer l = globeControl1.Globe.Layers.GetLayerByCaption(node.Text);
- if (l != null)
- {
- l.RemoveAllFeature();
- node.Nodes.Clear();
- globeControl1.Refresh();
- }
+ if (l == null) return;
+ l.RemoveAllFeature();
+ node.Nodes.Clear();
+ globeControl1.Refresh();
}
//定时检查传感器的状态
public Timer timerOfSensor = null;
@@ -6375,7 +6013,7 @@
}
frmShResult = new FrmShResult(dVerticalJingJuBiaoZhun, dHorizontalJingJuBiaoZhun, shlayername, globeControl1,
- m_PipelineLayerNames);
+ Utility.m_PipelineLayerNames);
if (boolfrmShResult) return;
@@ -6482,13 +6120,11 @@
frmModify = new FrmMnModify(globeControl1, shlayername, shresultLists);
- if (boolfrmModify == false)
- {
- frmModify.Owner = this;
- frmModify.Location = new Point(Width - frmModify.Width - 10, Height - frmModify.Height - 50);
- frmModify.Show();
- boolfrmModify = true;
- }
+ if (boolfrmModify != false) return;
+ frmModify.Owner = this;
+ frmModify.Location = new Point(Width - frmModify.Width - 10, Height - frmModify.Height - 50);
+ frmModify.Show();
+ boolfrmModify = true;
}
///
/// 一键审核中调节透明度
@@ -6500,7 +6136,7 @@
LogManager.saveLog(Utility.userName, sliderItem1.Text);
globeControl1.Globe.GroundOpaque = 100 - sliderItem1.Value;
- GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(roadLayerName); //("180fd");
+ GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(Utility.roadLayerName); //("180fd");
if (layer != null)
layer.Opaque = 100 - sliderItem1.Value;
@@ -6516,7 +6152,7 @@
LogManager.saveLog(Utility.userName, sliderItem3.Text);
globeControl1.Globe.GroundOpaque = 100 - sliderItem3.Value;
- GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(roadLayerName); //("180fd");
+ GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(Utility.roadLayerName); //("180fd");
if (layer != null)
layer.Opaque = 100 - sliderItem3.Value;
optiValue = sliderItem3.Value;
@@ -6647,7 +6283,7 @@
{
LogManager.saveLog(Utility.userName, buttonItemSearch9.Text);
- FrmKeywordQuery.ShowForm(globeControl1, m_PipelineLayerNames, InitDataGridViewX1);
+ FrmKeywordQuery.ShowForm(globeControl1, Utility.m_PipelineLayerNames, InitDataGridViewX1);
}
///
/// 编号查询
@@ -6658,7 +6294,7 @@
{
LogManager.saveLog(Utility.userName, buttonItemSearch2.Text);
- FrmCodingQuery.ShowForm(globeControl1, m_PipelineLayerNames, InitDataGridViewX1);
+ FrmCodingQuery.ShowForm(globeControl1, Utility.m_PipelineLayerNames, InitDataGridViewX1);
}
///
/// 坐标查询
@@ -6680,7 +6316,7 @@
{
LogManager.saveLog(Utility.userName, buttonItemSearch10.Text);
- FrmFittingQuery.ShowForm(globeControl1, instrumenLayerNames, InitDataGridViewX1);
+ FrmFittingQuery.ShowForm(globeControl1, Utility.instrumenLayerNames, InitDataGridViewX1);
}
///
/// 管径查询
@@ -6691,7 +6327,7 @@
{
LogManager.saveLog(Utility.userName, buttonItemSearch4.Text);
- FrmDiameterQuery.ShowForm(globeControl1, m_PipelineLayerNames, InitDataGridViewX1);
+ FrmDiameterQuery.ShowForm(globeControl1, Utility.m_PipelineLayerNames, InitDataGridViewX1);
}
///
/// 材质查询
@@ -6702,7 +6338,7 @@
{
LogManager.saveLog(Utility.userName, buttonItemSearch5.Text);
- FrmMaterialSel.ShowForm(globeControl1, m_PipelineLayerNames, InitDataGridViewX1);
+ FrmMaterialSel.ShowForm(globeControl1, Utility.m_PipelineLayerNames, InitDataGridViewX1);
}
///
/// 基本查询
@@ -6751,8 +6387,8 @@
if (feature == null && feature.Geometry == null || (feature.Geometry.Type == EnumGeometryType.GeoPolygon3D
|| feature.Geometry.Type == EnumGeometryType.GeoWater))
return;
- ClassSearchAnalysis.ResultRelationAnalysis(globeControl1, feature, valueLayerNames, workwellLayerNames,
- instrumenLayerNames, pipefittingLayerNames, m_PipelineLayerNames, valueAllowance);
+ ClassSearchAnalysis.ResultRelationAnalysis(globeControl1, feature, Utility.valueLayerNames, Utility.workwellLayerNames,
+ Utility.instrumenLayerNames, Utility.pipefittingLayerNames, Utility.m_PipelineLayerNames, valueAllowance);
}
}
#endregion
@@ -6789,20 +6425,20 @@
// ClearCloseValvesAnalysis();//清除阀门分析
//清除管线间距分析
- if (disFeature != null)
- {
- if (disFeature.ID != 0)
- {
- globeControl1.Globe.MemoryLayer.RemoveFeatureByID(disFeature.ID);
- }
- }
- if (featureDis != null)
- {
- if (featureDis.ID != 0)
- {
- globeControl1.Globe.MemoryLayer.RemoveFeatureByID(featureDis.ID);
- }
- }
+ //if (disFeature != null)
+ //{
+ // if (disFeature.ID != 0)
+ // {
+ // globeControl1.Globe.MemoryLayer.RemoveFeatureByID(disFeature.ID);
+ // }
+ //}
+ //if (featureDis != null)
+ //{
+ // if (featureDis.ID != 0)
+ // {
+ // globeControl1.Globe.MemoryLayer.RemoveFeatureByID(featureDis.ID);
+ // }
+ //}
GSOFeatures feats = globeControl1.Globe.MemoryLayer.GetFeatureByName("粒子要素", true);
if (feats.Length > 0)
@@ -6838,7 +6474,7 @@
clearFeatureHighLight();//取消管线高亮
- GSOLayer layerGround = globeControl1.Globe.Layers.GetLayerByCaption(roadLayerName);//("180fd");
+ GSOLayer layerGround = globeControl1.Globe.Layers.GetLayerByCaption(Utility.roadLayerName);//("180fd");
if (layerGround != null)
{
layerGround.Visible = true;
@@ -6856,7 +6492,7 @@
private void buttonItemTJ1_ALL_Click(object sender, EventArgs e)
{
LogManager.saveLog(Utility.userName, "管线长度统计");
- FrmAllPipelineStatis frm = new FrmAllPipelineStatis(globeControl1, null, InitDataGridViewX1, m_PipelineLayerNames);
+ FrmAllPipelineStatis frm = new FrmAllPipelineStatis(globeControl1, null, InitDataGridViewX1, Utility.m_PipelineLayerNames);
frm.Show(this);
}
///
@@ -6930,7 +6566,7 @@
{
LogManager.saveLog(Utility.userName, "管径分段统计");
- Frmpipediameterstatis.ShowForm(globeControl1, m_PipelineLayerNames, 0);
+ Frmpipediameterstatis.ShowForm(globeControl1, Utility.m_PipelineLayerNames, 0);
}
///
/// 管径分段统计绘制区域统计
@@ -6942,7 +6578,7 @@
LogManager.saveLog(Utility.userName, "管径分段统计");
trackflag = null;
- Frmpipediameterstatis.ShowForm(globeControl1, m_PipelineLayerNames, 1);
+ Frmpipediameterstatis.ShowForm(globeControl1, Utility.m_PipelineLayerNames, 1);
}
///
/// 埋深分段统计全区域统计
@@ -6952,7 +6588,7 @@
private void buttonItemTJ5_ALL_Click(object sender, EventArgs e)
{
LogManager.saveLog(Utility.userName, "埋深分段统计");
- FrmpipeDeepstatis.ShowForm(globeControl1, m_PipelineLayerNames, 0);
+ FrmpipeDeepstatis.ShowForm(globeControl1, Utility.m_PipelineLayerNames, 0);
}
///
/// 埋深分段统计绘制区域统计
@@ -6963,7 +6599,7 @@
{
LogManager.saveLog(Utility.userName, "埋深分段统计");
trackflag = null;
- FrmpipeDeepstatis.ShowForm(globeControl1, m_PipelineLayerNames, 1);
+ FrmpipeDeepstatis.ShowForm(globeControl1, Utility.m_PipelineLayerNames, 1);
}
///
/// 管径分类统计全区域统计
@@ -6974,7 +6610,7 @@
{
LogManager.saveLog(Utility.userName, "管径分类汇总");
- FrmpipeDiametergather.ShowForm(globeControl1, m_PipelineLayerNames, 0);
+ FrmpipeDiametergather.ShowForm(globeControl1, Utility.m_PipelineLayerNames, 0);
}
///
/// 管径分类统计绘制区域统计
@@ -6986,7 +6622,7 @@
LogManager.saveLog(Utility.userName, "管径分类汇总");
trackflag = null;
- FrmpipeDiametergather.ShowForm(globeControl1, m_PipelineLayerNames, 1);
+ FrmpipeDiametergather.ShowForm(globeControl1, Utility.m_PipelineLayerNames, 1);
}
///
/// 材质分类统计全区域统计
@@ -6997,7 +6633,7 @@
{
LogManager.saveLog(Utility.userName, "材质分类汇总");
- FrmpipeMaterialGather.ShowForm(globeControl1, m_PipelineLayerNames, 0);
+ FrmpipeMaterialGather.ShowForm(globeControl1, Utility.m_PipelineLayerNames, 0);
}
///
/// 材质分类统计绘制区域统计
@@ -7009,7 +6645,7 @@
LogManager.saveLog(Utility.userName, "材质分类汇总");
trackflag = null;
- FrmpipeMaterialGather.ShowForm(globeControl1, m_PipelineLayerNames, 1);
+ FrmpipeMaterialGather.ShowForm(globeControl1, Utility.m_PipelineLayerNames, 1);
}
///
/// 附属物分类统计全区域统计
@@ -7020,7 +6656,7 @@
{
LogManager.saveLog(Utility.userName, "附属物分类汇总");
- FrmAccessoriesgather.ShowForm(globeControl1, instrumenLayerNames, 0);
+ FrmAccessoriesgather.ShowForm(globeControl1, Utility.instrumenLayerNames, 0);
}
///
/// 附属物分类统计绘制区域统计
@@ -7032,7 +6668,7 @@
LogManager.saveLog(Utility.userName, "附属物分类汇总");
trackflag = null;
- FrmAccessoriesgather.ShowForm(globeControl1, instrumenLayerNames, 1);
+ FrmAccessoriesgather.ShowForm(globeControl1, Utility.instrumenLayerNames, 1);
}
#region Predaotr,断面分析
///
@@ -7113,7 +6749,7 @@
//日志记录
LogManager.saveLog(Utility.userName, buttonItemFX3_1.Text);
- FrmGenAndFaMenTopu frm = new FrmGenAndFaMenTopu(globeControl1, m_PipelineLayerNames, valueLayerNames);
+ FrmGenAndFaMenTopu frm = new FrmGenAndFaMenTopu(globeControl1, Utility.m_PipelineLayerNames, Utility.valueLayerNames);
frm.Show(this);
}
#region Predator :拓扑分析
@@ -7166,7 +6802,7 @@
//日志记录
LogManager.saveLog(Utility.userName, buttonItemFX3_4.Text);
- FrmFlow frm = new FrmFlow(globeControl1, m_PipelineLayerNames);
+ FrmFlow frm = new FrmFlow(globeControl1, Utility.m_PipelineLayerNames);
frm.Show(this);
}
///
@@ -7369,16 +7005,14 @@
GSOFeature f = null;
GSOLayer layer = null;
globeControl1.Globe.GetSelectObject(i, out f, out layer);
- if (f != null && f.Dataset.Caption == "隧道")
+ if (f == null || f.Dataset.Caption != "隧道") continue;
+ tunnelCount++;
+ f.Delete();
+ if (layer != null)
{
- tunnelCount++;
- f.Delete();
- if (layer != null)
- {
- globeControl1.Globe.AddToEditHistroy(layer, f, EnumEditType.Delete);
- }
- globeControl1.Refresh();
+ globeControl1.Globe.AddToEditHistroy(layer, f, EnumEditType.Delete);
}
+ globeControl1.Refresh();
}
if (tunnelCount == 0)
{
@@ -7620,7 +7254,7 @@
return;
}
GSOGeoPolyline3D selLine = resFeature.Geometry as GSOGeoPolyline3D;
- if (selLine[0].Count <= 1)
+ if (selLine==null||selLine[0].Count <= 1)//wxl增加为空判断,下面方法同理
{
return;
}
@@ -7763,14 +7397,12 @@
LogManager.saveLog(Utility.userName, buttonItemBZ10.Text);
setMarkerLayerUnVisible("红线工具");
GSOLayer l = globeControl1.Globe.Layers.GetLayerByCaption("红线工具");
- if (l != null)
- {
- l.Visible = true;
- globeControl1.Globe.DestLayerFeatureAdd = l;
- l.Editable = true;
- globeControl1.Globe.Action = EnumAction3D.DrawPolygon;
- m_isDrawRedPology = true;
- }
+ if (l == null) return;
+ l.Visible = true;
+ globeControl1.Globe.DestLayerFeatureAdd = l;
+ l.Editable = true;
+ globeControl1.Globe.Action = EnumAction3D.DrawPolygon;
+ m_isDrawRedPology = true;
}
///
/// 标注管理
@@ -8100,7 +7732,7 @@
{
//日志记录
LogManager.saveLog(Utility.userName, buttonItemSH5.Text);
- FrmCityServerLineAnalysis frm = new FrmCityServerLineAnalysis(globeControl1, m_PipelineLayerNames);
+ FrmCityServerLineAnalysis frm = new FrmCityServerLineAnalysis(globeControl1, Utility.m_PipelineLayerNames);
frm.Show(this);
}
@@ -8287,7 +7919,7 @@
//日志记录
LogManager.saveLog(Utility.userName, buttonItemBJ1.Text);
- frmPipeSetEdit frm = new frmPipeSetEdit(globeControl1, m_PipelineLayerNames);
+ frmPipeSetEdit frm = new frmPipeSetEdit(globeControl1, Utility.m_PipelineLayerNames);
if (frm.ShowDialog() == DialogResult.OK)
{
m_AddPipeLine = true;
@@ -8306,7 +7938,7 @@
//日志记录
LogManager.saveLog(Utility.userName, buttonItemBJ2.Text);
- FrmSetGoalLayer frm = new FrmSetGoalLayer(globeControl1, instrumenLayerNames, "附属物");
+ FrmSetGoalLayer frm = new FrmSetGoalLayer(globeControl1, Utility.instrumenLayerNames, "附属物");
if (frm.ShowDialog() == DialogResult.OK)
{
GSOLayer featureAddLayer = TreeNodeFeatureLayer();
@@ -8327,15 +7959,13 @@
//日志记录
LogManager.saveLog(Utility.userName, buttonItemBJ3.Text);
- FrmSetGoalLayer frm = new FrmSetGoalLayer(globeControl1, pipefittingLayerNames, "管点");
+ FrmSetGoalLayer frm = new FrmSetGoalLayer(globeControl1, Utility.pipefittingLayerNames, "管点");
if (frm.ShowDialog() == DialogResult.OK)
{
GSOLayer featureAddLayer = TreeNodeFeatureLayer();
- if (featureAddLayer != null)
- {
- FrmAddPipeFitting dlg = new FrmAddPipeFitting(globeControl1, featureAddLayer);
- dlg.Show(this);
- }
+ if (featureAddLayer == null) return;
+ FrmAddPipeFitting dlg = new FrmAddPipeFitting(globeControl1, featureAddLayer);
+ dlg.Show(this);
}
}
///
@@ -8516,50 +8146,50 @@
#region 导出成dxf格式
List listVectorNames = new List();
- for (int i = 0; i < m_PipelineLayerNames.Count; i++)
+ for (int i = 0; i < Utility.m_PipelineLayerNames.Count; i++)
{
- if (m_PipelineLayerNames[i] == "移动" || m_PipelineLayerNames[i] == "联通"
- || m_PipelineLayerNames[i] == "电信" || m_PipelineLayerNames[i] == "共通"
- || m_PipelineLayerNames[i] == "有线电视" || m_PipelineLayerNames[i] == "交通信号"
- || m_PipelineLayerNames[i] == "供电")
+ if (Utility.m_PipelineLayerNames[i] == "移动" || Utility.m_PipelineLayerNames[i] == "联通"
+ || Utility.m_PipelineLayerNames[i] == "电信" || Utility.m_PipelineLayerNames[i] == "共通"
+ || Utility.m_PipelineLayerNames[i] == "有线电视" || Utility.m_PipelineLayerNames[i] == "交通信号"
+ || Utility.m_PipelineLayerNames[i] == "供电")
{
continue;
}
- if (listVectorNames.Contains(m_PipelineLayerNames[i]) == false)
+ if (!listVectorNames.Contains(Utility.m_PipelineLayerNames[i]))
{
- listVectorNames.Add(m_PipelineLayerNames[i]);
+ listVectorNames.Add(Utility.m_PipelineLayerNames[i]);
}
}
- for (int i = 0; i < valueLayerNames.Count; i++)
+ for (int i = 0; i < Utility.valueLayerNames.Count; i++)
{
- if (listVectorNames.Contains(valueLayerNames[i]) == false)
+ if (!listVectorNames.Contains(Utility.valueLayerNames[i]))
{
- listVectorNames.Add(valueLayerNames[i]);
+ listVectorNames.Add(Utility.valueLayerNames[i]);
}
}
- for (int i = 0; i < workwellLayerNames.Count; i++)
+ for (int i = 0; i < Utility.workwellLayerNames.Count; i++)
{
- if (listVectorNames.Contains(workwellLayerNames[i]) == false)
+ if (!listVectorNames.Contains(Utility.workwellLayerNames[i]))
{
- listVectorNames.Add(workwellLayerNames[i]);
+ listVectorNames.Add(Utility.workwellLayerNames[i]);
}
}
- for (int i = 0; i < instrumenLayerNames.Count; i++)
+ for (int i = 0; i < Utility.instrumenLayerNames.Count; i++)
{
- if (listVectorNames.Contains(instrumenLayerNames[i]) == false)
+ if (!listVectorNames.Contains(Utility.instrumenLayerNames[i]))
{
- listVectorNames.Add(instrumenLayerNames[i]);
+ listVectorNames.Add(Utility.instrumenLayerNames[i]);
}
}
- for (int i = 0; i < pipefittingLayerNames.Count; i++)
+ for (int i = 0; i < Utility.pipefittingLayerNames.Count; i++)
{
- if (listVectorNames.Contains(pipefittingLayerNames[i]) == false)
+ if (!listVectorNames.Contains(Utility.pipefittingLayerNames[i]))
{
- listVectorNames.Add(pipefittingLayerNames[i]);
+ listVectorNames.Add(Utility.pipefittingLayerNames[i]);
}
}
- FrmExportCADS frm = new FrmExportCADS(globeControl1, listVectorNames);//m_PipelineLayerNames);
+ FrmExportCADS frm = new FrmExportCADS(globeControl1, listVectorNames);//Utility.m_PipelineLayerNames);
frm.ShowDialog();
#endregion
}
@@ -8574,39 +8204,39 @@
LogManager.saveLog(Utility.userName, buttonItemBJ10_2.Text);
List listVectorNames = new List();
- for (int i = 0; i < m_PipelineLayerNames.Count; i++)
+ for (int i = 0; i < Utility.m_PipelineLayerNames.Count; i++)
{
- if (listVectorNames.Contains(m_PipelineLayerNames[i]) == false)
+ if (!listVectorNames.Contains(Utility.m_PipelineLayerNames[i]))
{
- listVectorNames.Add(m_PipelineLayerNames[i]);
+ listVectorNames.Add(Utility.m_PipelineLayerNames[i]);
}
}
- for (int i = 0; i < valueLayerNames.Count; i++)
+ for (int i = 0; i < Utility.valueLayerNames.Count; i++)
{
- if (listVectorNames.Contains(valueLayerNames[i]) == false)
+ if (!listVectorNames.Contains(Utility.valueLayerNames[i]))
{
- listVectorNames.Add(valueLayerNames[i]);
+ listVectorNames.Add(Utility.valueLayerNames[i]);
}
}
- for (int i = 0; i < workwellLayerNames.Count; i++)
+ for (int i = 0; i < Utility.workwellLayerNames.Count; i++)
{
- if (listVectorNames.Contains(workwellLayerNames[i]) == false)
+ if (!listVectorNames.Contains(Utility.workwellLayerNames[i]))
{
- listVectorNames.Add(workwellLayerNames[i]);
+ listVectorNames.Add(Utility.workwellLayerNames[i]);
}
}
- for (int i = 0; i < instrumenLayerNames.Count; i++)
+ for (int i = 0; i < Utility.instrumenLayerNames.Count; i++)
{
- if (listVectorNames.Contains(instrumenLayerNames[i]) == false)
+ if (!listVectorNames.Contains(Utility.instrumenLayerNames[i]))
{
- listVectorNames.Add(instrumenLayerNames[i]);
+ listVectorNames.Add(Utility.instrumenLayerNames[i]);
}
}
- for (int i = 0; i < pipefittingLayerNames.Count; i++)
+ for (int i = 0; i < Utility.pipefittingLayerNames.Count; i++)
{
- if (listVectorNames.Contains(pipefittingLayerNames[i]) == false)
+ if (!listVectorNames.Contains(Utility.pipefittingLayerNames[i]))
{
- listVectorNames.Add(pipefittingLayerNames[i]);
+ listVectorNames.Add(Utility.pipefittingLayerNames[i]);
}
}
FrmExportVector frm = new FrmExportVector(globeControl1, listVectorNames);
@@ -8668,9 +8298,9 @@
List listPipelineLayers = new List();
GSOLayer layer = null;
- for (int i = 0; i < m_PipelineLayerNames.Count; i++)
+ for (int i = 0; i < Utility.m_PipelineLayerNames.Count; i++)
{
- layer = globeControl1.Globe.Layers.GetLayerByCaption(m_PipelineLayerNames[i]);
+ layer = globeControl1.Globe.Layers.GetLayerByCaption(Utility.m_PipelineLayerNames[i]);
if (layer == null) continue;
listPipelineLayers.Add(layer);
}
@@ -8737,7 +8367,7 @@
LogManager.saveLog(Utility.userName, sliderItem2.Text);
globeControl1.Globe.GroundOpaque = 100 - sliderItem2.Value;
- GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(roadLayerName);//("180fd");
+ GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(Utility.roadLayerName);//("180fd");
if (layer != null)
{
layer.Opaque = 100 - sliderItem2.Value;
@@ -8876,7 +8506,7 @@
globeControl1.Globe.GroundOpaque = 100 - sliderGroundTransSet1.Value;
- layer = globeControl1.Globe.Layers.GetLayerByCaption(roadLayerName);//("180fd");
+ layer = globeControl1.Globe.Layers.GetLayerByCaption(Utility.roadLayerName);//("180fd");
if (layer != null)
{
layer.Opaque = 100 - sliderGroundTransSet1.Value;
@@ -9145,7 +8775,7 @@
LogManager.saveLog(Utility.userName, buttonItem8.Text);
int width = Width;
- FrmCompareFeature.ShowForm(globeControl1, globeControl2, layerTemp, layerTemp2, m_PipelineLayerNames, sgPipeLayersNames, width);
+ FrmCompareFeature.ShowForm(globeControl1, globeControl2, layerTemp, layerTemp2, Utility.m_PipelineLayerNames, Utility.sgPipeLayersNames, width);
}
///
/// 红线审核导出图片
diff --git a/MarkInfo.cs b/MarkInfo.cs
index 44e630b..68ab5bd 100644
--- a/MarkInfo.cs
+++ b/MarkInfo.cs
@@ -182,7 +182,7 @@
public void showMarker(List marks, GSOLayer layer)
{
layer.Visible = true;
- MessageBox.Show(layer.GetAllFeatures().Length + "");
+ //MessageBox.Show(layer.GetAllFeatures().Length + "");
foreach(MarkInfo mark in marks)
{
addLabel(mark,layer);
diff --git a/NewFunction/FrmExportVector.cs b/NewFunction/FrmExportVector.cs
index 9e68b54..c85a9b9 100644
--- a/NewFunction/FrmExportVector.cs
+++ b/NewFunction/FrmExportVector.cs
@@ -10,8 +10,8 @@
{
public partial class FrmExportVector :Office2007Form
{
- GSOGlobeControl globeControl1;
- List pipeLineNames = new List();
+ private GSOGlobeControl globeControl1;
+ private List pipeLineNames;
public FrmExportVector(GSOGlobeControl globeControl, List listPipelineNames)
{
InitializeComponent();
diff --git a/Utility.cs b/Utility.cs
index add8556..d6b89cd 100644
--- a/Utility.cs
+++ b/Utility.cs
@@ -74,6 +74,23 @@
public static string ghdbpwd;
public static List locationList;
+ public static string filename = Application.StartupPath + "\\Config.xml";
+ public static string filenameSensor = Application.StartupPath + "\\sensorConfig.xml";
+ public static string filenamePipelineType = Application.StartupPath + "\\PipelineType.xml";
+ public static string filenameDbconfig = Application.StartupPath + "\\databaseConfig.xml";
+ public static string filenameLocation = Application.StartupPath + "\\Location.xml";
+ #region wxl 从MainFrm重构来,读取一遍config.xml
+ public static List m_PipelineLayerNames = new List();//线图层名称
+ public static List workwellLayerNames = new List();//工井图层名称
+ public static List valueLayerNames = new List();//阀门图层名称
+ public static List instrumenLayerNames = new List();//附属物图层名称
+ public static List pipefittingLayerNames = new List();//管件图层名称
+ public static List sgPipeLayersNames = new List();//施工管线图层名称
+
+ public static Dictionary dictionaryNetLayerNameAndCaption = new Dictionary();
+
+ public static string roadLayerName = "";
+ #endregion wxl
public static void SetBallons(GSOBalloon featureTooltip, GSOBalloonEx balloonEx)
{
featureTooltip.CacheFilePath = Application.StartupPath + "/GeoScene/Globe/Temp";
@@ -102,19 +119,19 @@
balloonEx.SetColorBkType(EnumBkColorTypeEx.SKY);
}
- public static GSOFeature FindFeatureByUserID(GSOFeatureDataset featdataset, string fieldname, string value)
- {
- GSOFeatures feats = featdataset.GetAllFeatures();
- for (int i = 0; i < feats.Length; i++)
- {
- GSOFeature feat = feats[i];
- if (feat.GetFieldAsString(fieldname) == value)
- {
- return feat;
- }
- }
- return null;
- }
+ //public static GSOFeature FindFeatureByUserID(GSOFeatureDataset featdataset, string fieldname, string value)
+ //{
+ // GSOFeatures feats = featdataset.GetAllFeatures();
+ // for (int i = 0; i < feats.Length; i++)
+ // {
+ // GSOFeature feat = feats[i];
+ // if (feat.GetFieldAsString(fieldname) == value)
+ // {
+ // return feat;
+ // }
+ // }
+ // return null;
+ //}
public static GSOPoint2d XYZ_2_Latlon(double x, double y)
{
@@ -156,7 +173,7 @@
{
ret.AppendFormat("{0:X2}", b);
}
- ret.ToString();
+ //ret.ToString();
return ret.ToString();
}
//
@@ -195,11 +212,7 @@
return features;
}
- public static string filename = Application.StartupPath + "\\Config.xml";
- public static string filenameSensor = Application.StartupPath + "\\sensorConfig.xml";
- public static string filenamePipelineType = Application.StartupPath + "\\PipelineType.xml";
- public static string filenameDbconfig = Application.StartupPath + "\\databaseConfig.xml";
- public static string filenameLocation = Application.StartupPath + "\\Location.xml";
+
//程序启动的时候读取配置文件
public static void SetParams()
{
@@ -251,19 +264,54 @@
}
else if (XmlReader.Name == "layerchild")
{
- LayerChild child = new LayerChild();
- child.attriLabel = XmlReader["label"].Trim();
- child.attriLayer = XmlReader["layer"].Trim();
- child.attriType = XmlReader["type"].Trim();
- LayerChilds.Add(child);
- LayerLabels.Add(XmlReader["label"].Trim());
- LayerNames.Add(XmlReader["layer"].Trim());
+ var layername = XmlReader["layer"].Trim();
+ var label = XmlReader["label"].Trim();
+ var type = XmlReader["type"].Trim();
- string layername = XmlReader["layer"].Trim();
+ LayerChild child = new LayerChild();
+ child.attriLabel = label;
+ child.attriLayer =layername;
+ child.attriType = type;
+ LayerChilds.Add(child);
+ LayerLabels.Add(label);
+ LayerNames.Add(layername);
+
+ dictionaryNetLayerNameAndCaption.Add(layername, label);
+
if (layername.EndsWith("管线"))
{
LayerNamesList.Add(layername.Substring(0, layername.Length - 2));
}
+ if (!type.Equals("db"))
+ {
+ if (XmlReader["isRoad"] != null)
+ {
+ roadLayerName = label;
+ }
+ }else if (XmlReader["isPipeLine"] != null)
+ {
+ m_PipelineLayerNames.Add(label);
+ }
+ else if (XmlReader["isWorkWell"] != null)
+ {
+ workwellLayerNames.Add(label);
+ }
+ else if (XmlReader["isValve"] != null)
+ {
+ valueLayerNames.Add(label);
+ }
+ else if (XmlReader["isAccess"] != null)
+ {
+ instrumenLayerNames.Add(label);
+ }
+ else if (XmlReader["isCharacter"] != null)
+ {
+ pipefittingLayerNames.Add(label);
+ }
+ else if (XmlReader["isSgData"] != null)
+ {
+ sgPipeLayersNames.Add(label);
+ }
}
else if (XmlReader.Name == "Terrain")
@@ -591,41 +639,37 @@
}
*/
- ////根据图层中的对象特征来划分内容
- public static string getCodeByName(string name)
- {
- string code = "";
- if (listPipelineType != null)
- {
- List list = listPipelineType;
+ //////根据图层中的对象特征来划分内容
+ //public static string getCodeByName(string name)
+ //{
+ // string code = "";
+ // if (listPipelineType != null)
+ // {
+ // List list = listPipelineType;
- for (int i = 0; i < list.Count; i++)
- {
- PipelineType pipelineType = listPipelineType[i];
- if (name == pipelineType.name)
- {
- code = pipelineType.code;
- break;
- }
- }
- }
- return code;
- }
+ // for (int i = 0; i < list.Count; i++)
+ // {
+ // PipelineType pipelineType = listPipelineType[i];
+ // if (name == pipelineType.name)
+ // {
+ // code = pipelineType.code;
+ // break;
+ // }
+ // }
+ // }
+ // return code;
+ //}
//根据附属物图层名字得到里面含有的附属物
public static string[] getAccStrsByLayer(string layername)
{
string[] accStrs = null;
string sql = "select 附属物名称 from " + layername + " group by 附属物名称";
- //DataTable table = OledbHelper.QueryTable(sql);
DataSet dataset = OledbHelper.getDataSet(sql, layername);
- if (dataset != null)
+ if (dataset == null) return null;
+ accStrs = new string[dataset.Tables[0].Rows.Count];
+ for (int i = 0; i < dataset.Tables[0].Rows.Count; i++)
{
- accStrs = new string[dataset.Tables[0].Rows.Count];
- for (int i = 0; i < dataset.Tables[0].Rows.Count; i++)
- {
- accStrs[i] = dataset.Tables[0].Rows[i][0].ToString();
- }
- return accStrs;
+ accStrs[i] = dataset.Tables[0].Rows[i][0].ToString();
}
return accStrs;
}
diff --git a/Cyberpipe.csproj b/Cyberpipe.csproj
index 6e90a6e..8f4424d 100644
--- a/Cyberpipe.csproj
+++ b/Cyberpipe.csproj
@@ -187,11 +187,6 @@
False
bin\x86\Debug\WHC.Pager.WinControl.dll
-
- False
- .exe
- bin\x86\Debug\WinFormsExtendedViewExample.exe
-
False
bin\x86\Debug\WW.dll
diff --git a/Cyberpipe.suo b/Cyberpipe.suo
index 0a403c8..eac4ecb 100644
--- a/Cyberpipe.suo
+++ b/Cyberpipe.suo
Binary files differ
diff --git a/MainFrm.cs b/MainFrm.cs
index 6e94648..7c574c1 100644
--- a/MainFrm.cs
+++ b/MainFrm.cs
@@ -27,7 +27,6 @@
public partial class MainFrm : Office2007Form
{
TreeNode layerManagerNode;
- TreeNode myPlaceNode = null;
bool m_bFullScreen;
GSOGlobeControl globeControl1;
@@ -45,24 +44,14 @@
GSOLayer layerTemp;
GSOLayer layerTemp2;
- FrmShResult frmShResult = null;
FrmRedlineResult frmredResult = null;
FrmMnModify frmModify;
public bool frmRedlineResult = false;
public bool boolfrmShResult;
public bool boolfrmModify;
- List m_PipelineLayerNames = new List();//线图层名称
- List workwellLayerNames = new List();//工井图层名称
- List valueLayerNames = new List();//阀门图层名称
- List instrumenLayerNames = new List();//附属物图层名称
- List pipefittingLayerNames = new List();//管件图层名称
- List sgPipeLayersNames = new List();//施工管线图层名称
- string roadLayerName = "";
public static string m_CurrentQueryLayer;//定义当前查询的图层
//定位和闪烁初始化定义
- int count = 0;
- private string flashflag = "single";
public bool m_AddPipeLine;//bool添加管线
bool m_isDrawTunnel;//bool创建隧道
@@ -71,10 +60,6 @@
private string trackflag;//定义阀门查询个数
- //管线间距分析
- private GSOFeature disFeature = new GSOFeature();
- private GSOFeature featureDis = new GSOFeature();
-
//记录沿线飞行设置
//int m_nFlyMode = 2;
double m_dFlyAboveLine = 1;
@@ -86,7 +71,7 @@
Boolean m_bDigPitByDepth = true;
//选择管线
int selectState;
- private OracleConnection connBackup = null;
+ //private OracleConnection connBackup = null;
//数据集合
public static GSODataSource ds;
@@ -182,7 +167,7 @@
RigthMenuSet();
MenuSet();
-
+
}
///
/// 右屏中添加管纵图片
@@ -906,13 +891,13 @@
comboBoxEx3.Items.Clear();
comboBoxEx4.Items.Clear();
comboBoxLayer.Items.Clear();
- for (int i = 0; i < m_PipelineLayerNames.Count; i++)
+ foreach (string t1 in Utility.m_PipelineLayerNames)
{
- comboBoxEx1.Items.Add(m_PipelineLayerNames[i]);
- comboBoxEx2.Items.Add(m_PipelineLayerNames[i]);
- comboBoxEx3.Items.Add(m_PipelineLayerNames[i]);
- comboBoxEx4.Items.Add(m_PipelineLayerNames[i]);
- comboBoxLayer.Items.Add(m_PipelineLayerNames[i]);
+ comboBoxEx1.Items.Add(t1);
+ comboBoxEx2.Items.Add(t1);
+ comboBoxEx3.Items.Add(t1);
+ comboBoxEx4.Items.Add(t1);
+ comboBoxLayer.Items.Add(t1);
}
splitContainer1.Panel2Collapsed = true;
@@ -1132,7 +1117,7 @@
}
- delegate void LoadDataForGlobalControl();
+ //delegate void LoadDataForGlobalControl();
private void connectServer()
{
@@ -1142,19 +1127,15 @@
// 勾选实测图层
foreach (TreeNode tn in layerTree.Nodes)
{
- if (tn.Nodes.Count > 0)
+ if (tn.Nodes.Count <= 0) continue;
+ if (tn.Text != "实测数据") continue;
+ tn.Checked = true;
+ foreach (TreeNode tnChild in tn.Nodes)
{
- if (tn.Text == "实测数据")
+ tnChild.Checked = true;
+ foreach (TreeNode tnGrandChild in tnChild.Nodes)
{
- tn.Checked = true;
- foreach (TreeNode tnChild in tn.Nodes)
- {
- tnChild.Checked = true;
- foreach (TreeNode tnGrandChild in tnChild.Nodes)
- {
- tnGrandChild.Checked = true;
- }
- }
+ tnGrandChild.Checked = true;
}
}
}
@@ -1174,7 +1155,7 @@
for (int j = 0; j < Utility.dataSource.DatasetCount; j++)
{
GSODataset dataset = Utility.dataSource.GetDatasetAt(j);
- if (dataset != null && dictionaryNetLayerNameAndCaption.ContainsKey(dataset.Caption))
+ if (dataset != null && Utility.dictionaryNetLayerNameAndCaption.ContainsKey(dataset.Caption))
{
dataset.Caption = dataset.Name;
globeControl1.Globe.Layers.Add(dataset);
@@ -1191,7 +1172,7 @@
for (int j = 0; j < ghDS.DatasetCount; j++)
{
GSODataset dataset = ghDS.GetDatasetAt(j);
- if (dataset != null && dictionaryNetLayerNameAndCaption.ContainsKey(dataset.Caption))
+ if (dataset != null && Utility.dictionaryNetLayerNameAndCaption.ContainsKey(dataset.Caption))
{
dataset.Caption = dataset.Name;
globeControl1.Globe.Layers.Add(dataset);
@@ -1207,7 +1188,7 @@
for (int m = 0; m < sgDS.DatasetCount; m++)
{
GSODataset dataset = sgDS.GetDatasetAt(m);
- if (dataset != null && !dataset.Caption.Contains("SH") && dictionaryNetLayerNameAndCaption.ContainsKey(dataset.Caption))
+ if (dataset != null && !dataset.Caption.Contains("SH") && Utility.dictionaryNetLayerNameAndCaption.ContainsKey(dataset.Caption))
{
dataset.Caption = dataset.Name;
globeControl1.Globe.Layers.Add(dataset);
@@ -1219,8 +1200,14 @@
}
}
- LoadDataForGlobalControl ss = connectServer;
- ss();
+// LoadDataForGlobalControl ss = connectServer;
+// ss();
+
+ this.Invoke((EventHandler) delegate
+ {
+ connectServer();
+ });
+
}
catch (Exception ex)
@@ -1240,7 +1227,7 @@
layerTree.Nodes.Add(layerManagerNode);
XmlDocument doc = new XmlDocument();
- doc.Load(filename);
+ doc.Load(Utility.filename);
XmlNodeList xmlLayerNodes = doc.SelectNodes("//layer");
foreach (XmlNode xmlLayerNode in xmlLayerNodes)
@@ -1295,70 +1282,6 @@
}
- /**
- * 读取Config.xml文件,初始化以下全局Map
- * m_PipelineLayerNames:管线
- * workwellLayerNames:工井
- * valueLayerNames:阀门
- * instrumenLayerNames:附属物
- * pipefittingLayerNames:特征管点
- * sgPipeLayersNames:施工管线
- **/
- private void initGlobalMap()
- {
- XmlDocument doc = new XmlDocument();
- doc.Load(filename);
- XmlNodeList xmlLayerNodes = doc.SelectNodes("//layerchild");
-
- foreach (XmlNode xmlLayerNode in xmlLayerNodes)
- {
- string layerType = xmlLayerNode.Attributes["type"].Value;
- string layerName1 = xmlLayerNode.Attributes["layer"].Value;
- string layerchildName = xmlLayerNode.Attributes["label"].Value;
-
- dictionaryNetLayerNameAndCaption.Add(layerName1, layerchildName);
-
- if (layerType != "db")
- {
- if (xmlLayerNode.Attributes["isRoad"] != null)
- {
- roadLayerName = layerchildName;
- }
- }
- else if (xmlLayerNode.Attributes["isPipeLine"] != null)
- {
- m_PipelineLayerNames.Add(layerchildName);
- g1layername.Add(layerName1);
- }
- else if (xmlLayerNode.Attributes["isWorkWell"] != null)
- {
- workwellLayerNames.Add(layerchildName);
- g1layername.Add(layerName1);
- }
- else if (xmlLayerNode.Attributes["isValve"] != null)
- {
- valueLayerNames.Add(layerchildName);
- g1layername.Add(layerName1);
- }
- else if (xmlLayerNode.Attributes["isAccess"] != null)
- {
- instrumenLayerNames.Add(layerchildName);
- g1layername.Add(layerName1);
- }
- else if (xmlLayerNode.Attributes["isCharacter"] != null)
- {
- pipefittingLayerNames.Add(layerchildName);
- g1layername.Add(layerName1);
- }
- else if (xmlLayerNode.Attributes["isSgData"] != null)
- {
- sgPipeLayersNames.Add(layerchildName);
- g1layername.Add(layerName1);
- }
-
- }
- }
-
private void initMarkerTree()
{
TreeNode node = new TreeNode();
@@ -1380,32 +1303,29 @@
for (int i = 0; i < markerStrs.Length; i++)
{
- if (File.Exists(Application.StartupPath + "\\标注管理\\" + markerStrs[i] + ".lgd"))
- {
- GSOLayer markerLayer = globeControl1.Globe.Layers.Add(Application.StartupPath + "\\标注管理\\" + markerStrs[i] + ".lgd");
- if (markerLayer != null)
- {
- TreeNode node1 = new TreeNode();
- node1.Text = markerLayer.Caption;
- node1.ImageIndex = 0;
- node1.SelectedImageIndex = 0;
- node1.Checked = markerLayer.Visible;
- node1.Tag = markerLayer;
- layerMarkerTree.Nodes[0].Nodes.Add(node1);
- }
- }
+ if (!File.Exists(Application.StartupPath + "\\标注管理\\" + markerStrs[i] + ".lgd")) continue;
+ GSOLayer markerLayer = globeControl1.Globe.Layers.Add(Application.StartupPath + "\\标注管理\\" + markerStrs[i] + ".lgd");
+ if (markerLayer == null) continue;
+ TreeNode node1 = new TreeNode();
+ node1.Text = markerLayer.Caption;
+ node1.ImageIndex = 0;
+ node1.SelectedImageIndex = 0;
+ node1.Checked = markerLayer.Visible;
+ node1.Tag = markerLayer;
+ layerMarkerTree.Nodes[0].Nodes.Add(node1);
}
}
private void MainFrm_Load(object sender, EventArgs e)
{
initGlobalControl();
- initGlobalMap();
+ //initGlobalMap();
initLayerTree();
initMarkerTree();
initLayout();
loadData();
+
double x = Convert.ToDouble(Utility.Query_Roads["绿岛"].ToString().Split(',')[0]);
double y = Convert.ToDouble(Utility.Query_Roads["绿岛"].ToString().Split(',')[1]);
double z = Convert.ToDouble(Utility.Query_Roads["绿岛"].ToString().Split(',')[2]);
@@ -1415,12 +1335,12 @@
#endregion
- Dictionary dictionaryNetLayerNameAndCaption = new Dictionary();
+ //Dictionary Utility.dictionaryNetLayerNameAndCaption = new Dictionary();
void globeControl1_AfterNetLayerAddEvent(object sender, AfterNetLayerAddEventArgs e)
{
- if (e.Layer != null && dictionaryNetLayerNameAndCaption.ContainsKey(e.Layer.Caption))
+ if (e.Layer != null && Utility.dictionaryNetLayerNameAndCaption.ContainsKey(e.Layer.Caption))
{
- e.Layer.Caption = dictionaryNetLayerNameAndCaption[e.Layer.Caption];
+ e.Layer.Caption = Utility.dictionaryNetLayerNameAndCaption[e.Layer.Caption];
}
}
@@ -1530,37 +1450,30 @@
///
Boolean CheckDatasetGeoReference(GSODataset dataset, string strDataPath)
{
+
+ if (dataset.GeoReferenceType != EnumGeoReferenceType.Flat) return true;
Boolean bSuccess = false;
- if (dataset.GeoReferenceType == EnumGeoReferenceType.Flat)
- {
- if (MessageBox.Show("数据没有空间参考信息,请设置空间参考信息!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) == DialogResult.OK)
- {
- String strPath = Application.StartupPath + "\\Coordinate Systems";
- OpenFileDialog dlg = new OpenFileDialog();
+ if (MessageBox.Show("数据没有空间参考信息,请设置空间参考信息!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) !=
+ DialogResult.OK) return bSuccess;
+ String strPath = Application.StartupPath + "\\Coordinate Systems";
+ OpenFileDialog dlg = new OpenFileDialog();
- dlg.InitialDirectory = strPath;
- dlg.RestoreDirectory = true;
+ dlg.InitialDirectory = strPath;
+ dlg.RestoreDirectory = true;
- dlg.Filter = "投影文件|*.prj||";
- if (dlg.ShowDialog() == DialogResult.OK)
- {
- string lprjStr = GSODataEngineUtility.ConvertEsriPrjFileToProj4(dlg.FileName);
- string lprjFileContent = "0prj4" + lprjStr + "";
+ dlg.Filter = "投影文件|*.prj||";
+ if (dlg.ShowDialog() != DialogResult.OK) return bSuccess;
+ string lprjStr = GSODataEngineUtility.ConvertEsriPrjFileToProj4(dlg.FileName);
+ string lprjFileContent = "0prj4" + lprjStr +
+ "";
- bSuccess = dataset.LoadProjectionFromESRIFile(dlg.FileName);
+ bSuccess = dataset.LoadProjectionFromESRIFile(dlg.FileName);
- string lprjFileName = strDataPath.Substring(0, strDataPath.LastIndexOf(".")) + ".lprj";
- StreamWriter writer = new StreamWriter(lprjFileName, false);
- writer.Write(lprjFileContent);
- writer.Close();
+ string lprjFileName = strDataPath.Substring(0, strDataPath.LastIndexOf(".")) + ".lprj";
+ StreamWriter writer = new StreamWriter(lprjFileName, false);
+ writer.Write(lprjFileContent);
+ writer.Close();
- }
- }
- }
- else
- {
- return true;
- }
return bSuccess;
}
@@ -1571,49 +1484,47 @@
///
void globeControl1_TrackRectEndEvent(object sender, TrackRectEndEventArgs e)
{
- if (e.Polygon != null)
+ if (e.Polygon == null) return;
+ globeControl1.Globe.TrackRectTool.Clear();
+ globeControl1.ImmediatelyRefresh();
+ globeControl1.SwapBuffer();
+ Point pt1 = new Point(Convert.ToInt32(e.StartPos.X), Convert.ToInt32(e.StartPos.Y));
+ Point pt2 = new Point(Convert.ToInt32(e.EndPos.X), Convert.ToInt32(e.EndPos.Y));
+
+ int mapWidth = 0;
+ int mapHeight = 0;
+ Point pt = getUpperLeftPoint(pt1, pt2, out mapWidth, out mapHeight);
+ int rightBottomX = pt.X + mapWidth;
+ int rightBottomY = pt.Y + mapHeight;
+ Image myImg = new Bitmap(mapWidth, mapHeight);
+ Graphics g = Graphics.FromImage(myImg);
+ g.CopyFromScreen(pt, new Point(0, 0), new Size(rightBottomX, rightBottomY));
+
+ SaveFileDialog dlg = new SaveFileDialog();
+ dlg.Filter = "输出JPEG(*.jpg)|*.jpg|输出PNG(*.png)|*.png|输出BMP(*.bmp)|*.bmp|输出BMP(*.gif)|*.gif";
+ if (dlg.ShowDialog() == DialogResult.OK)
{
- globeControl1.Globe.TrackRectTool.Clear();
- globeControl1.ImmediatelyRefresh();
- globeControl1.SwapBuffer();
- Point pt1 = new Point(Convert.ToInt32(e.StartPos.X), Convert.ToInt32(e.StartPos.Y));
- Point pt2 = new Point(Convert.ToInt32(e.EndPos.X), Convert.ToInt32(e.EndPos.Y));
-
- int mapWidth = 0;
- int mapHeight = 0;
- Point pt = getUpperLeftPoint(pt1, pt2, out mapWidth, out mapHeight);
- int rightBottomX = pt.X + mapWidth;
- int rightBottomY = pt.Y + mapHeight;
- Image myImg = new Bitmap(mapWidth, mapHeight);
- Graphics g = Graphics.FromImage(myImg);
- g.CopyFromScreen(pt, new Point(0, 0), new Size(rightBottomX, rightBottomY));
-
- SaveFileDialog dlg = new SaveFileDialog();
- dlg.Filter = "输出JPEG(*.jpg)|*.jpg|输出PNG(*.png)|*.png|输出BMP(*.bmp)|*.bmp|输出BMP(*.gif)|*.gif";
- if (dlg.ShowDialog() == DialogResult.OK)
+ string extension = Path.GetExtension(dlg.FileName);//扩展名
+ switch (extension)
{
- string extension = Path.GetExtension(dlg.FileName);//扩展名
- switch (extension)
- {
- case ".jpg":
- myImg.Save(dlg.FileName, ImageFormat.Jpeg);
- break;
- case ".png":
- myImg.Save(dlg.FileName, ImageFormat.Png);
- break;
- case ".bmp":
- myImg.Save(dlg.FileName, ImageFormat.Bmp);
- break;
- case ".gif":
- myImg.Save(dlg.FileName, ImageFormat.Gif);
- break;
- default:
- break;
- }
+ case ".jpg":
+ myImg.Save(dlg.FileName, ImageFormat.Jpeg);
+ break;
+ case ".png":
+ myImg.Save(dlg.FileName, ImageFormat.Png);
+ break;
+ case ".bmp":
+ myImg.Save(dlg.FileName, ImageFormat.Bmp);
+ break;
+ case ".gif":
+ myImg.Save(dlg.FileName, ImageFormat.Gif);
+ break;
+ default:
+ break;
}
- globeControl1.Globe.Action = EnumAction3D.ActionNull;
- globeControl1.Globe.MouseRoamingEnable = true;
}
+ globeControl1.Globe.Action = EnumAction3D.ActionNull;
+ globeControl1.Globe.MouseRoamingEnable = true;
}
///
/// 定位正北正90度俯视
@@ -1711,18 +1622,12 @@
///
private void CheckControl(TreeViewEventArgs e)
{
- if (e.Action != TreeViewAction.Unknown)
+ if (e.Action == TreeViewAction.Unknown||e.Node == null || Convert.IsDBNull(e.Node)) return;
+ CheckParentNode(e.Node);
+ if (e.Node.Nodes.Count > 0)
{
- if (e.Node != null && !Convert.IsDBNull(e.Node))
- {
- CheckParentNode(e.Node);
- if (e.Node.Nodes.Count > 0)
- {
- CheckAllChildNodes(e.Node, e.Node.Checked);
- }
- }
+ CheckAllChildNodes(e.Node, e.Node.Checked);
}
-
}
///
/// 改变所有子节点的状态
@@ -1747,94 +1652,88 @@
{
bool bChecked = false;
- if (curNode.Parent != null)
+ if (curNode.Parent == null) return;
+ foreach (TreeNode node in curNode.Parent.Nodes)
{
- foreach (TreeNode node in curNode.Parent.Nodes)
+ if (node.Checked)
{
- if (node.Checked)
- {
- bChecked = true;
- break;
- }
+ bChecked = true;
+ break;
}
+ }
- if (bChecked)
- {
- curNode.Parent.Checked = true;
- CheckParentNode(curNode.Parent);
- }
- else
- {
- curNode.Parent.Checked = false;
- CheckParentNode(curNode.Parent);
- }
+ if (bChecked)
+ {
+ curNode.Parent.Checked = true;
+ CheckParentNode(curNode.Parent);
+ }
+ else
+ {
+ curNode.Parent.Checked = false;
+ CheckParentNode(curNode.Parent);
}
}
private void layerTree_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
{
- if (e.Button == MouseButtons.Right)
+ if (e.Button != MouseButtons.Right) return;
+ layerTree.SelectedNode = e.Node;
+ if (e.Node.Tag == null) return;
+ if (e.Button == MouseButtons.Right && e.Node.Tag.ToString().Contains("|"))
{
- layerTree.SelectedNode = e.Node;
- if (e.Node.Tag != null)
+
+ if (e.Node.Tag.ToString().Split('|')[0] == "locaserver")
{
- if (e.Button == MouseButtons.Right && e.Node.Tag.ToString().Contains("|"))
+
+ foreach (ToolStripItem item in layerNodeContexMenu.Items)
{
-
- if (e.Node.Tag.ToString().Split('|')[0] == "locaserver")
- {
-
- foreach (ToolStripItem item in layerNodeContexMenu.Items)
- {
- item.Visible = false;
- }
- return;
-
- }
-
- if (e.Node.Tag.ToString().Split('|')[0] == "new")
- {
- LayerEditableMenuItem.Enabled = true;
- foreach (ToolStripItem item in layerNodeContexMenu.Items)
- {
- item.Visible = false;
- }
- LayerSelectableMenuItem.Visible = true;
- LayerEditableMenuItem.Visible = true;
- RemoveLayer.Visible = true;
- RefreshLayerFeatureListMenuItem.Visible = true;
- SaveLayerMenuItem.Visible = true;
- LayerFlyMenuItem.Visible = true;
- }
-
- LayerSelectableMenuItem.Visible = true;
- LayerEditableMenuItem.Visible = true;
- SaveLayerMenuItem.Visible = true;
- LayerFlyMenuItem.Visible = true;
- 导出CADToolStripMenuItem1.Visible = true;
-
- layerNodeContexMenu.Show(layerTree, e.X, e.Y);
- layerNodeContexMenu.Tag = e.Node;
- GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(e.Node.Tag.ToString().Split('|')[1]);
- if (layer != null)
- {
- LayerSelectableMenuItem.Checked = layer.Selectable;
- LayerEditableMenuItem.Checked = layer.Editable;
- }
+ item.Visible = false;
}
- else
+ return;
+
+ }
+
+ if (e.Node.Tag.ToString().Split('|')[0] == "new")
+ {
+ LayerEditableMenuItem.Enabled = true;
+ foreach (ToolStripItem item in layerNodeContexMenu.Items)
{
- if (e.Node.Tag is GSOLayer && e.Node.Parent != null && e.Node.Parent.Text.Trim() == "临时图层")
- {
- contextMenuStripDeleteLayerNode.Show(layerTree, e.X, e.Y);
- contextMenuStripDeleteLayerNode.Tag = e.Node;
- }
- if (e.Node.Tag is GSOFeature && e.Node.Parent != null && e.Node.Parent.Text.Trim() == "我的地标")
- {
- contextMenuStripDeleteLayerNode.Show(layerTree, e.X, e.Y);
- contextMenuStripDeleteLayerNode.Tag = e.Node;
- }
+ item.Visible = false;
}
+ //LayerSelectableMenuItem.Visible = true;
+ //LayerEditableMenuItem.Visible = true;
+ RemoveLayer.Visible = true;
+ RefreshLayerFeatureListMenuItem.Visible = true;
+ //SaveLayerMenuItem.Visible = true;
+ //LayerFlyMenuItem.Visible = true;
+ }
+
+ LayerSelectableMenuItem.Visible = true;
+ LayerEditableMenuItem.Visible = true;
+ SaveLayerMenuItem.Visible = true;
+ LayerFlyMenuItem.Visible = true;
+ 导出CADToolStripMenuItem1.Visible = true;
+
+ layerNodeContexMenu.Show(layerTree, e.X, e.Y);
+ layerNodeContexMenu.Tag = e.Node;
+ GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(e.Node.Tag.ToString().Split('|')[1]);
+ if (layer != null)
+ {
+ LayerSelectableMenuItem.Checked = layer.Selectable;
+ LayerEditableMenuItem.Checked = layer.Editable;
+ }
+ }
+ else
+ {
+ if (e.Node.Tag is GSOLayer && e.Node.Parent != null && e.Node.Parent.Text.Trim() == "临时图层")
+ {
+ contextMenuStripDeleteLayerNode.Show(layerTree, e.X, e.Y);
+ contextMenuStripDeleteLayerNode.Tag = e.Node;
+ }
+ else if (e.Node.Tag is GSOFeature && e.Node.Parent != null && e.Node.Parent.Text.Trim() == "我的地标")
+ {
+ contextMenuStripDeleteLayerNode.Show(layerTree, e.X, e.Y);
+ contextMenuStripDeleteLayerNode.Tag = e.Node;
}
}
}
@@ -1909,110 +1808,103 @@
{
TreeNode node = layerTree.SelectedNode;
- if (node != null)
+ if (node == null) return;
+ if (node.Parent.Text.Trim() == "临时图层")
{
- if (node.Parent.Text.Trim() == "临时图层")
+ GSOLayer lsLayer = globeControl1.Globe.Layers.GetLayerByCaption(node.Text);
+ double x = lsLayer.LatLonBounds.Center.X;
+ double y = lsLayer.LatLonBounds.Center.Y;
+ if (x == 0 && y == 0)
{
- GSOLayer lsLayer = globeControl1.Globe.Layers.GetLayerByCaption(node.Text);
- double x = lsLayer.LatLonBounds.Center.X;
- double y = lsLayer.LatLonBounds.Center.Y;
- if (x == 0 && y == 0)
- {
- x = lsLayer.Bounds.Center.X;
- y = lsLayer.Bounds.Center.Y;
- }
+ x = lsLayer.Bounds.Center.X;
+ y = lsLayer.Bounds.Center.Y;
+ }
- globeControl1.Globe.FlyToPosition(new GSOPoint3d(x, y, 10), EnumAltitudeMode.Absolute);
+ globeControl1.Globe.FlyToPosition(new GSOPoint3d(x, y, 10), EnumAltitudeMode.Absolute);
+ }
+ else
+ {
+ GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(node.Tag.ToString().Split('|')[1]);
+
+ if (layer == null) return;
+ if (layer.Caption == "红线")
+ {
+ globeControl1.Globe.FlyToPosition(new GSOPoint3d(120.610963, 31.188121, 50), EnumAltitudeMode.Absolute, -4, 50, 1000);
+ globeControl1.Globe.FlyToPointSpeed = 10000000;
+ globeControl1.Globe.Action = EnumAction3D.SelectObject;
+
+ GSOLayer redLayer = globeControl1.Globe.Layers.GetLayerByCaption("红线");
+ if (redLayer != null)
+ {
+ redLayer.Visible = true;
+ }
+ globeControl1.Refresh();
}
else
{
- GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(node.Tag.ToString().Split('|')[1]);
-
- if (layer != null)
- {
- if (layer.Caption == "红线")
- {
- globeControl1.Globe.FlyToPosition(new GSOPoint3d(120.610963, 31.188121, 50), EnumAltitudeMode.Absolute, -4, 50, 1000);
- globeControl1.Globe.FlyToPointSpeed = 10000000;
- globeControl1.Globe.Action = EnumAction3D.SelectObject;
-
- GSOLayer redLayer = globeControl1.Globe.Layers.GetLayerByCaption("红线");
- if (redLayer != null)
- {
- redLayer.Visible = true;
- }
- globeControl1.Refresh();
- }
- else
- {
- double x = layer.LatLonBounds.Center.X;
- double y = layer.LatLonBounds.Center.Y;
- globeControl1.Globe.FlyToPosition(new GSOPoint3d(x, y, 100), EnumAltitudeMode.Absolute);
- }
- }
+ double x = layer.LatLonBounds.Center.X;
+ double y = layer.LatLonBounds.Center.Y;
+ globeControl1.Globe.FlyToPosition(new GSOPoint3d(x, y, 100), EnumAltitudeMode.Absolute);
}
}
}
private void layerTree_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e)
{
- if (layerTree.SelectedNode != null)
+ if (layerTree.SelectedNode == null) return;
+ if (layerTree.SelectedNode.Tag.ToString().Contains("|"))
{
- if (layerTree.SelectedNode.Tag.ToString().Contains("|"))
+ string nodeTag = layerTree.SelectedNode.Tag.ToString().Split('|')[1];
+ GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(nodeTag);
+ if (layer != null)
{
- string nodeTag = layerTree.SelectedNode.Tag.ToString().Split('|')[1];
- GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(nodeTag);
- if (layer != null)
+ if (layer.Caption == "红线")
{
- if (layer.Caption == "红线")
- {
- globeControl1.Globe.FlyToPosition(new GSOPoint3d(120.610963, 31.188121, 50), EnumAltitudeMode.Absolute, -4, 50, 1000);
- globeControl1.Globe.FlyToPointSpeed = 10000000;
- globeControl1.Globe.Action = EnumAction3D.SelectObject;
+ globeControl1.Globe.FlyToPosition(new GSOPoint3d(120.610963, 31.188121, 50), EnumAltitudeMode.Absolute, -4, 50, 1000);
+ globeControl1.Globe.FlyToPointSpeed = 10000000;
+ globeControl1.Globe.Action = EnumAction3D.SelectObject;
- GSOLayer redLayer = globeControl1.Globe.Layers.GetLayerByCaption("红线");
- if (redLayer != null)
- {
- redLayer.Visible = true;
- }
- globeControl1.Refresh();
- }
- else
+ GSOLayer redLayer = globeControl1.Globe.Layers.GetLayerByCaption("红线");
+ if (redLayer != null)
{
- double x = layer.LatLonBounds.Center.X;
- double y = layer.LatLonBounds.Center.Y;
- globeControl1.Globe.FlyToPosition(new GSOPoint3d(x, y, 0), EnumAltitudeMode.Absolute);
+ redLayer.Visible = true;
}
+ globeControl1.Refresh();
+ }
+ else
+ {
+ double x = layer.LatLonBounds.Center.X;
+ double y = layer.LatLonBounds.Center.Y;
+ globeControl1.Globe.FlyToPosition(new GSOPoint3d(x, y, 0), EnumAltitudeMode.Absolute);
}
}
- if (layerTree.SelectedNode.Tag is GSOLayer)
+ }
+ if (layerTree.SelectedNode.Tag is GSOLayer)
+ {
+ GSOLayer layer = layerTree.SelectedNode.Tag as GSOLayer;
+ if (layer.GetAllFeatures().Length > 0)
{
- GSOLayer layer = layerTree.SelectedNode.Tag as GSOLayer;
- if (layer.GetAllFeatures().Length > 0)
+ GSOFeature feature = layer.GetAt(0);
+ if (feature != null && feature.Geometry != null)
{
- GSOFeature feature = layer.GetAt(0);
- if (feature != null && feature.Geometry != null)
- {
- globeControl1.Globe.FlyToPosition(feature.Geometry.GeoCenterPoint, EnumAltitudeMode.Absolute);//, 0, 0, 1000);
- }
- else
- {
- globeControl1.Globe.FlyToFeature(feature);
- }
- }
- }
- if (layerTree.SelectedNode.Tag is GSOFeature)
- {
- GSOFeature feature = layerTree.SelectedNode.Tag as GSOFeature;
- if (feature.Geometry != null)
- {
- globeControl1.Globe.FlyToPosition(feature.Geometry.GeoCenterPoint, EnumAltitudeMode.Absolute, 0, 0, 10);
+ globeControl1.Globe.FlyToPosition(feature.Geometry.GeoCenterPoint, EnumAltitudeMode.Absolute);//, 0, 0, 1000);
}
else
{
globeControl1.Globe.FlyToFeature(feature);
}
}
+ } else if (layerTree.SelectedNode.Tag is GSOFeature)
+ {
+ GSOFeature feature = layerTree.SelectedNode.Tag as GSOFeature;
+ if (feature.Geometry != null)
+ {
+ globeControl1.Globe.FlyToPosition(feature.Geometry.GeoCenterPoint, EnumAltitudeMode.Absolute, 0, 0, 10);
+ }
+ else
+ {
+ globeControl1.Globe.FlyToFeature(feature);
+ }
}
}
@@ -2086,7 +1978,7 @@
trackPolylineEndMode == EnumTrackPolylineEndMode.DLDM_Analysis)
{
Dictionary hdmDic = SectionAnalysisTool.HDMAnalysis(globeControl1,
- e.Polyline, m_PipelineLayerNames);
+ e.Polyline, Utility.m_PipelineLayerNames);
FrmHDMAnalysis3 frm = new FrmHDMAnalysis3(hdmDic, globeControl1,
trackPolylineEndMode);
frm.Show(this);
@@ -2103,185 +1995,6 @@
* **/
}
trackPolylineEndMode = EnumTrackPolylineEndMode.Default_Analysis;
- /*
- ArrayList arraylistPoint = new ArrayList();
- ArrayList arraylistLine = new ArrayList();
-
- // globeControl1.Globe.ClearLastTrackPolyline();
-
- if (e.Polyline != null)
- {
- //横断面分析
- if (buttonItemFX2_1.Checked || buttonItemFX2_3.Checked)
- {
- if (m_PipelineLayerNames != null)
- {
- GSOGeoPolygon3D polygon = e.Polyline.CreateBuffer(0.1, true, 5, true, false);
- for (int i = 0; i < m_PipelineLayerNames.Count; i++)
- {
- if (m_PipelineLayerNames[i] != null)
- {
- GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(m_PipelineLayerNames[i]);
- if (layer == null)
- {
- continue;
- }
- if (layer.Visible == false)
- {
- continue;
- }
- GSOFeatureLayer featurelayer = layer as GSOFeatureLayer;
- if (featurelayer != null)
- {
- GSOFeatures feats = featurelayer.FindFeaturesInPolygon(polygon, false); //featurelayer.GetAllFeatures();
- if (feats != null)
- {
- for (int j = 0; j < feats.Length; j++)
- {
- GSOFeature feateline = feats[j];
- GSOGeoPolyline3D geoline = feateline.Geometry as GSOGeoPolyline3D;
-
- if (geoline != null)
- {
- if (geoline.Style != null)
- {
- if (geoline.Style.GetType() == typeof(GSOPipeLineStyle3D))
- {
- GSOPoint3d pntIntersect1 = new GSOPoint3d();
- GSOPoint3d pntIntersect2 = new GSOPoint3d();
-
- double honLen;
- double verLen;
- double dDist = globeControl1.Globe.Analysis3D.ComputeTwoGeoPolylineDistance(e.Polyline, geoline, out pntIntersect1, out pntIntersect2, out honLen, out verLen, false, false, 0);
-
- globeControl1.Globe.Action = EnumAction3D.ActionNull;
- if (dDist > -1)
- {
- arraylistPoint.Add(pntIntersect2);
- arraylistLine.Add(feateline);
- }
- }
- }
- }
- }
- }
- else
- {
- MessageBox.Show("请重新绘制断面");
- return;
- }
-
- }
- }
- }
- }
- if (buttonItemFX2_1.Checked)
- {
- FrmHDMAnalysis3 frm = FrmHDMAnalysis3.GetForm(arraylistPoint, arraylistLine, e.Polyline, globeControl1);
- if (!frm.isShowFirst)
- {
- frm.Show(this);
- }
- frm.LoadChartEvent();
- }
- else
- {
- FrmRoadHDM frm = FrmRoadHDM.GetForm(arraylistPoint, arraylistLine, e.Polyline, globeControl1);
- if (!frm.isShowFirst)
- {
- frm.Show(this);
- }
- frm.LoadChartEvent();
- }
- globeControl1.Globe.ClearLastTrackPolyline();
- }
- else if (buttonItemFX2_4.Checked)
- {
- FrmBaseLineProfillAnalysis dlg = new FrmBaseLineProfillAnalysis(globeControl1.Globe, e.Polyline);
- dlg.Show(this);
- globeControl1.Globe.ClearLastTrackPolyline();
- }
- else if (buttonItemFX4_3.Checked)
- {
- GSOGeoPolygon3D resPolygon = e.Polyline.CreateBuffer(m_dDigPitWidthAlongLine, false, 0, false, false);
-
- GSOGeoPit geoPit = new GSOGeoPit();
- geoPit.PitPolygon = resPolygon;
- if (m_bDigPitByDepth)
- {
- geoPit.PitDepth = m_dDigPitValue;
- geoPit.PitDepthUsing = true;
- }
- else
- {
- geoPit.PitBottomAlt = m_dDigPitValue;
- geoPit.PitDepthUsing = false;
- }
-
- globeControl1.Globe.AddPit("", geoPit);
- GSOLayer layerGround = globeControl1.Globe.Layers.GetLayerByCaption(roadLayerName);// ("180fd");
- if (layerGround != null)
- {
- layerGround.Visible = false;
- }
- // 清除当前TrackPolygonAnalysis的痕迹
- globeControl1.Globe.ClearLastTrackPolyline();
- }
- else if (distanceMarker)
- {
- setMarkerLayerUnVisible("距离标注");
- GSOLayer l = globeControl1.Globe.Layers.GetLayerByCaption("距离标注");
- if (l != null)
- {
- l.Visible = true;
- if (getLabelName(l) != -1)
- {
- GSOGeoPolyline3D line = e.Polyline;
- if (line.PartCount > 0)
- {
- double length = line.GetSpaceLength(true, 6378137);//线的长度
- if (length == 0)
- {
- return;
- }
- else
- {
-
- GSOGeoPoint3D pt = new GSOGeoPoint3D();
- GSOGeoPolyline3D lineLine = line.GetSegment(0, length / 2);
- GSOPoint3d point3d = lineLine[lineLine.PartCount - 1][lineLine[lineLine.PartCount - 1].Count - 1];
- pt.X = point3d.X;
- pt.Y = point3d.Y;
- pt.Z = point3d.Z;
-
- string Twodecimalplaces = string.Format("{0:F}", length);
- string radiusLabelName = "" + Twodecimalplaces + "米";
- //string radiusLabelName = "" + length + "米";//标注名称
-
- GSOPoint2d point2d = new GSOPoint2d(0, 30);//标注位置
-
- int labelText = getLabelName(l);
-
- GSOFeature newFeatureLine = new GSOFeature();
- newFeatureLine.Geometry = line;
- newFeatureLine.Name = (labelText + 1).ToString() + "-line";
- l.AddFeature(newFeatureLine);
- globeControl1.Globe.ClearLastTrackPolyline();
-
- GSOFeature newFeature = new GSOFeature();
- newFeature = createLabel(l, newFeature, pt, radiusLabelName, (labelText + 1).ToString(), point2d);
- l.AddFeature(newFeature);
-
- globeControl1.Refresh();
- }
- }
- }
- }
- }
- }
- globeControl1.Globe.Action = EnumAction3D.ActionNull;
- ActionToolMenuChecked();
- * **/
}
#endregion
@@ -2292,83 +2005,81 @@
///
void globeControl1_TrackPolygonEndEvent(object sender, TrackPolygonEndEventArgs e)
{
- if (globeControl1.Globe.Action == EnumAction3D.TrackPolygon && e.Polygon != null)
+ if (globeControl1.Globe.Action != EnumAction3D.TrackPolygon || e.Polygon == null) return;
+ GSOGeoPolygon3D polygon = e.Polygon;
+
+ switch (trackflag)
{
- GSOGeoPolygon3D polygon = e.Polygon;
+ case "valvequery":
+ FrmValveStatistics frm = new FrmValveStatistics(globeControl1, polygon, InitDataGridViewX1);
+ frm.Show(this);
+ globeControl1.Globe.Action = EnumAction3D.ActionNull;
+ break;
- switch (trackflag)
- {
- case "valvequery":
- FrmValveStatistics frm = new FrmValveStatistics(globeControl1, polygon, InitDataGridViewX1);
- frm.Show(this);
- globeControl1.Globe.Action = EnumAction3D.ActionNull;
- break;
+ case "PipelineDistanceStatistics":
- case "PipelineDistanceStatistics":
+ FrmAllPipelineStatis frm1 = new FrmAllPipelineStatis(globeControl1, polygon, InitDataGridViewX1, Utility.m_PipelineLayerNames);
+ frm1.Show(this);
+ globeControl1.Globe.Action = EnumAction3D.ActionNull;
- FrmAllPipelineStatis frm1 = new FrmAllPipelineStatis(globeControl1, polygon, InitDataGridViewX1, m_PipelineLayerNames);
- frm1.Show(this);
- globeControl1.Globe.Action = EnumAction3D.ActionNull;
+ break;
+ case "PipelineSpatialQuery":
- break;
- case "PipelineSpatialQuery":
+ FrmAllPipelineStatis.ShowForm(globeControl1, polygon, InitDataGridViewX1, Utility.m_PipelineLayerNames);
+ globeControl1.Globe.ClearAnalysis();
+ globeControl1.Globe.Action = EnumAction3D.ActionNull;
- FrmAllPipelineStatis.ShowForm(globeControl1, polygon, InitDataGridViewX1, m_PipelineLayerNames);
- globeControl1.Globe.ClearAnalysis();
- globeControl1.Globe.Action = EnumAction3D.ActionNull;
+ break;
+ case "workwellquery":
+ FrmAllWorkWellStatis frmWell = new FrmAllWorkWellStatis(globeControl1, polygon, InitDataGridViewX1);
+ frmWell.Show(this);
- break;
- case "workwellquery":
- FrmAllWorkWellStatis frmWell = new FrmAllWorkWellStatis(globeControl1, polygon, InitDataGridViewX1);
- frmWell.Show(this);
+ globeControl1.Globe.Action = EnumAction3D.ActionNull;
- globeControl1.Globe.Action = EnumAction3D.ActionNull;
+ break;
- break;
-
- case "pit":
- double depth;
- FrmTackPolygonDlg dlg = new FrmTackPolygonDlg();
- if (dlg.ShowDialog() == DialogResult.OK)
+ case "pit":
+ double depth;
+ FrmTackPolygonDlg dlg = new FrmTackPolygonDlg();
+ if (dlg.ShowDialog() == DialogResult.OK)
+ {
+ depth = dlg.depth;
+ GSOGeoPit geoPit = new GSOGeoPit();
+ geoPit.PitPolygon = polygon;
+ geoPit.PitDepth = depth;
+ geoPit.PitDepthUsing = true;
+ globeControl1.Globe.AddPit("", geoPit);
+ GSOLayer layerGround = globeControl1.Globe.Layers.GetLayerByCaption(Utility.roadLayerName);//("180fd");
+ if (layerGround != null)
{
- depth = dlg.depth;
- GSOGeoPit geoPit = new GSOGeoPit();
- geoPit.PitPolygon = polygon;
- geoPit.PitDepth = depth;
- geoPit.PitDepthUsing = true;
- globeControl1.Globe.AddPit("", geoPit);
- GSOLayer layerGround = globeControl1.Globe.Layers.GetLayerByCaption(roadLayerName);//("180fd");
- if (layerGround != null)
- {
- layerGround.Visible = false;
- }
+ layerGround.Visible = false;
}
- globeControl1.Globe.ClearLastTrackPolygon();
- globeControl1.Globe.Action = EnumAction3D.ActionNull;
- break;
- case "digFillAnalysis":
- DigFillAnalysisDlg dlg1 = new DigFillAnalysisDlg();
- dlg1.m_globe = globeControl1.Globe;
- dlg1.m_polygon3D = polygon;
- globeControl1.Globe.Action = EnumAction3D.ActionNull;
- dlg1.Show(this);
- break;
- case "FloodAnalysis":
- FrmFloodAnalysis frmFloodAnalysis = new FrmFloodAnalysis(globeControl1.Globe, polygon);
- frmFloodAnalysis.Show(this);
- globeControl1.Globe.Action = EnumAction3D.ActionNull;
- break;
- case "BSQDuoBianXiangStatis":
- FrmBSQStatis bsqFrm = new FrmBSQStatis(globeControl1, e.Polygon);
- bsqFrm.Show(this);
- globeControl1.Globe.Action = EnumAction3D.ActionNull;
- break;
+ }
+ globeControl1.Globe.ClearLastTrackPolygon();
+ globeControl1.Globe.Action = EnumAction3D.ActionNull;
+ break;
+ case "digFillAnalysis":
+ DigFillAnalysisDlg dlg1 = new DigFillAnalysisDlg();
+ dlg1.m_globe = globeControl1.Globe;
+ dlg1.m_polygon3D = polygon;
+ globeControl1.Globe.Action = EnumAction3D.ActionNull;
+ dlg1.Show(this);
+ break;
+ case "FloodAnalysis":
+ FrmFloodAnalysis frmFloodAnalysis = new FrmFloodAnalysis(globeControl1.Globe, polygon);
+ frmFloodAnalysis.Show(this);
+ globeControl1.Globe.Action = EnumAction3D.ActionNull;
+ break;
+ case "BSQDuoBianXiangStatis":
+ FrmBSQStatis bsqFrm = new FrmBSQStatis(globeControl1, e.Polygon);
+ bsqFrm.Show(this);
+ globeControl1.Globe.Action = EnumAction3D.ActionNull;
+ break;
- case "":
- break;
- default:
- break;
- }
+ case "":
+ break;
+ default:
+ break;
}
}
///
@@ -2380,16 +2091,14 @@
{
try
{
- if (e.Feature != null)
+ if (e.Feature == null) return;
+ if (isFeatureContainsBianhao(e.Feature))
{
- if (isFeatureContainsBianhao(e.Feature))
- {
- featureTooltip.ShowBalloon((int)e.MousePos.X, (int)e.MousePos.Y, e.Feature.GetValue(featureIDFieldName).ToString());
- }
- else if (e.Feature.Name != "")
- {
- featureTooltip.ShowBalloon((int)e.MousePos.X, (int)e.MousePos.Y, e.Feature.Name);
- }
+ featureTooltip.ShowBalloon((int)e.MousePos.X, (int)e.MousePos.Y, e.Feature.GetValue(featureIDFieldName).ToString());
+ }
+ else if (e.Feature.Name != "")
+ {
+ featureTooltip.ShowBalloon((int)e.MousePos.X, (int)e.MousePos.Y, e.Feature.Name);
}
}
catch (Exception ex)
@@ -2405,192 +2114,188 @@
/// (完善)
void globeControl1_MouseDoubleClick(object sender, MouseEventArgs e)
{
- if (e.Button == MouseButtons.Left)
+ if (e.Button != MouseButtons.Left) return;
+ if (m_AddPipeLine && globeControl1.Globe.Action == EnumAction3D.DrawPolyline)//添加管线
{
- if (m_AddPipeLine && globeControl1.Globe.Action == EnumAction3D.DrawPolyline)//添加管线
+ GSOLayer layerDest = globeControl1.Globe.DestLayerFeatureAdd;
+ if (layerDest != null)
{
- GSOLayer layerDest = globeControl1.Globe.DestLayerFeatureAdd;
- if (layerDest != null)
+ GSOFeatures features = layerDest.GetAllFeatures();
+ GSOFeature f = features[features.Length - 1];
+ GSOGeoPolyline3D line = f.Geometry as GSOGeoPolyline3D;
+ globeControl1.Globe.Action = EnumAction3D.ActionNull;
+ if (f != null && f.Geometry.Type == EnumGeometryType.GeoPolyline3D)
{
- GSOFeatures features = layerDest.GetAllFeatures();
- GSOFeature f = features[features.Length - 1];
- GSOGeoPolyline3D line = f.Geometry as GSOGeoPolyline3D;
- globeControl1.Globe.Action = EnumAction3D.ActionNull;
- if (f != null && f.Geometry.Type == EnumGeometryType.GeoPolyline3D)
- {
- FrmLineCoordinate lineCoordiante = new FrmLineCoordinate(f, globeControl1, layerDest.Caption);
- lineCoordiante.Show(this);
- }
- globeControl1.Refresh();
- }
- }
- if (m_isDrawTunnel && globeControl1.Globe.Action == EnumAction3D.DrawPolyline)//创建隧道
- {
- GSOLayer tunnel = globeControl1.Globe.Layers.GetLayerByCaption("隧道");
- if (tunnel != null && tunnel.GetAllFeatures().Length > 0)
- {
- GSOFeature feature = tunnel.GetAt(tunnel.GetAllFeatures().Length - 1);
- FrmCreateTunnel frm = new FrmCreateTunnel(globeControl1, feature);
- if (frm.ShowDialog() == DialogResult.OK)
- {
- //tunnel.Save();
- }
+ FrmLineCoordinate lineCoordiante = new FrmLineCoordinate(f, globeControl1, layerDest.Caption);
+ lineCoordiante.Show(this);
}
globeControl1.Refresh();
}
- if (m_isDrawCitySevenLine && globeControl1.Globe.Action == EnumAction3D.DrawPolyline)//绘制城市七线
+ }
+ if (m_isDrawTunnel && globeControl1.Globe.Action == EnumAction3D.DrawPolyline)//创建隧道
+ {
+ GSOLayer tunnel = globeControl1.Globe.Layers.GetLayerByCaption("隧道");
+ if (tunnel != null && tunnel.GetAllFeatures().Length > 0)
{
- string lineType = citySevenLineType;
- string lineName = cityServerLineName;
- GSOFeature feature = null;
- switch (lineType)
+ GSOFeature feature = tunnel.GetAt(tunnel.GetAllFeatures().Length - 1);
+ FrmCreateTunnel frm = new FrmCreateTunnel(globeControl1, feature);
+ if (frm.ShowDialog() == DialogResult.OK)
{
- case "城市红线":
- GSOLayer layerRed = globeControl1.Globe.Layers.GetLayerByCaption(lineType);
- if (layerRed != null && layerRed.GetAllFeatures().Length > 0)
- {
- feature = layerRed.GetAt(layerRed.GetAllFeatures().Length - 1);
- if (feature != null)
- {
- feature.Name = lineName;
- GSOSimpleLineStyle3D style = new GSOSimpleLineStyle3D();
- style.LineColor = Color.Red; //改变绘制的线的颜色
- style.LineWidth = 1; //改变绘制的线的宽度
- feature.Geometry.Style = style;
- //layerRed.Save();
- }
- }
- break;
- case "城市橙线":
- GSOLayer layerOrange = globeControl1.Globe.Layers.GetLayerByCaption(lineType);
- if (layerOrange != null && layerOrange.GetAllFeatures().Length > 0)
- {
- feature = layerOrange.GetAt(layerOrange.GetAllFeatures().Length - 1);
- if (feature != null)
- {
- feature.Name = lineName;
- GSOSimpleLineStyle3D style = new GSOSimpleLineStyle3D();
- style.LineColor = Color.Orange;
- feature.Geometry.Style = style;
- //layerOrange.Save();
- }
- }
- break;
- case "城市黄线":
- GSOLayer layerYellow = globeControl1.Globe.Layers.GetLayerByCaption(lineType);
- if (layerYellow != null && layerYellow.GetAllFeatures().Length > 0)
- {
- feature = layerYellow.GetAt(layerYellow.GetAllFeatures().Length - 1);
- if (feature != null)
- {
- feature.Name = lineName;
- GSOSimpleLineStyle3D style = new GSOSimpleLineStyle3D();
- style.LineColor = Color.Yellow;
- feature.Geometry.Style = style;
- //layerYellow.Save();
- }
- }
- break;
- case "城市绿线":
- GSOLayer layerGreen = globeControl1.Globe.Layers.GetLayerByCaption(lineType);
- if (layerGreen != null && layerGreen.GetAllFeatures().Length > 0)
- {
- feature = layerGreen.GetAt(layerGreen.GetAllFeatures().Length - 1);
- if (feature != null)
- {
- feature.Name = lineName;
- GSOSimpleLineStyle3D style = new GSOSimpleLineStyle3D();
- style.LineColor = Color.Green;
- feature.Geometry.Style = style;
- //layerGreen.Save();
- }
- }
- break;
- case "城市蓝线":
- GSOLayer layerBlue = globeControl1.Globe.Layers.GetLayerByCaption(lineType);
- if (layerBlue != null && layerBlue.GetAllFeatures().Length > 0)
- {
- feature = layerBlue.GetAt(layerBlue.GetAllFeatures().Length - 1);
- if (feature != null)
- {
- feature.Name = lineName;
- GSOSimpleLineStyle3D style = new GSOSimpleLineStyle3D();
- style.LineColor = Color.Blue;
- feature.Geometry.Style = style;
- //layerBlue.Save();
- }
- }
- break;
- case "城市紫线":
- GSOLayer layerPurple = globeControl1.Globe.Layers.GetLayerByCaption(lineType);
- if (layerPurple != null && layerPurple.GetAllFeatures().Length > 0)
- {
- feature = layerPurple.GetAt(layerPurple.GetAllFeatures().Length - 1);
- if (feature != null)
- {
- feature.Name = lineName;
- GSOSimpleLineStyle3D style = new GSOSimpleLineStyle3D();
- style.LineColor = Color.Purple;
- feature.Geometry.Style = style;
- //layerPurple.Save();
- }
- }
- break;
- case "城市黑线":
- GSOLayer layerBlack = globeControl1.Globe.Layers.GetLayerByCaption(lineType);
- if (layerBlack != null && layerBlack.GetAllFeatures().Length > 0)
- {
- feature = layerBlack.GetAt(layerBlack.GetAllFeatures().Length - 1);
- if (feature != null)
- {
- feature.Name = lineName;
- GSOSimpleLineStyle3D style = new GSOSimpleLineStyle3D();
- style.LineColor = Color.Black;
- feature.Geometry.Style = style;
- //layerBlack.Save();
- }
- }
- break;
+ //tunnel.Save();
}
-
- globeControl1.Globe.DestLayerFeatureAdd = null;
}
- m_AddPipeLine = false;
- m_isDrawTunnel = false;
- m_isDrawCitySevenLine = false;
- if (m_isDrawRedPology && globeControl1.Globe.Action == EnumAction3D.DrawPolygon)//红线工具
+ globeControl1.Refresh();
+ }
+ if (m_isDrawCitySevenLine && globeControl1.Globe.Action == EnumAction3D.DrawPolyline)//绘制城市七线
+ {
+ string lineType = citySevenLineType;
+ string lineName = cityServerLineName;
+ GSOFeature feature = null;
+ switch (lineType)
{
- GSOLayer layerDest = globeControl1.Globe.DestLayerFeatureAdd;
- if (layerDest != null)
- {
- GSOFeatures features = layerDest.GetAllFeatures();
- //GSOFeatures features = globeControl1.Globe.MemoryLayer.GetAllFeatures();
- GSOFeature f = features[features.Length - 1];
- if (f != null)
+ case "城市红线":
+ GSOLayer layerRed = globeControl1.Globe.Layers.GetLayerByCaption(lineType);
+ if (layerRed != null && layerRed.GetAllFeatures().Length > 0)
{
- GSOGeoPolygon3D polygon = f.Geometry as GSOGeoPolygon3D;
- if (polygon != null)
+ feature = layerRed.GetAt(layerRed.GetAllFeatures().Length - 1);
+ if (feature != null)
{
- GSOSimplePolygonStyle3D geoStyle3d = new GSOSimplePolygonStyle3D();
- f.Name = (getLabelName(layerDest) + 1).ToString();
- geoStyle3d.FillColor = Color.Red;
- polygon.Style = geoStyle3d;
- GSOLabel label = new GSOLabel();
- label.Text = "此区域正在施工中!";
- label.Style = new GSOLabelStyle();
- label.Style.HasTracktionLine = false;
- polygon.Label = label;
-
- globeControl1.Refresh();
+ feature.Name = lineName;
+ GSOSimpleLineStyle3D style = new GSOSimpleLineStyle3D();
+ style.LineColor = Color.Red; //改变绘制的线的颜色
+ style.LineWidth = 1; //改变绘制的线的宽度
+ feature.Geometry.Style = style;
+ //layerRed.Save();
}
}
+ break;
+ case "城市橙线":
+ GSOLayer layerOrange = globeControl1.Globe.Layers.GetLayerByCaption(lineType);
+ if (layerOrange != null && layerOrange.GetAllFeatures().Length > 0)
+ {
+ feature = layerOrange.GetAt(layerOrange.GetAllFeatures().Length - 1);
+ if (feature != null)
+ {
+ feature.Name = lineName;
+ GSOSimpleLineStyle3D style = new GSOSimpleLineStyle3D();
+ style.LineColor = Color.Orange;
+ feature.Geometry.Style = style;
+ //layerOrange.Save();
+ }
+ }
+ break;
+ case "城市黄线":
+ GSOLayer layerYellow = globeControl1.Globe.Layers.GetLayerByCaption(lineType);
+ if (layerYellow != null && layerYellow.GetAllFeatures().Length > 0)
+ {
+ feature = layerYellow.GetAt(layerYellow.GetAllFeatures().Length - 1);
+ if (feature != null)
+ {
+ feature.Name = lineName;
+ GSOSimpleLineStyle3D style = new GSOSimpleLineStyle3D();
+ style.LineColor = Color.Yellow;
+ feature.Geometry.Style = style;
+ //layerYellow.Save();
+ }
+ }
+ break;
+ case "城市绿线":
+ GSOLayer layerGreen = globeControl1.Globe.Layers.GetLayerByCaption(lineType);
+ if (layerGreen != null && layerGreen.GetAllFeatures().Length > 0)
+ {
+ feature = layerGreen.GetAt(layerGreen.GetAllFeatures().Length - 1);
+ if (feature != null)
+ {
+ feature.Name = lineName;
+ GSOSimpleLineStyle3D style = new GSOSimpleLineStyle3D();
+ style.LineColor = Color.Green;
+ feature.Geometry.Style = style;
+ //layerGreen.Save();
+ }
+ }
+ break;
+ case "城市蓝线":
+ GSOLayer layerBlue = globeControl1.Globe.Layers.GetLayerByCaption(lineType);
+ if (layerBlue != null && layerBlue.GetAllFeatures().Length > 0)
+ {
+ feature = layerBlue.GetAt(layerBlue.GetAllFeatures().Length - 1);
+ if (feature != null)
+ {
+ feature.Name = lineName;
+ GSOSimpleLineStyle3D style = new GSOSimpleLineStyle3D();
+ style.LineColor = Color.Blue;
+ feature.Geometry.Style = style;
+ //layerBlue.Save();
+ }
+ }
+ break;
+ case "城市紫线":
+ GSOLayer layerPurple = globeControl1.Globe.Layers.GetLayerByCaption(lineType);
+ if (layerPurple != null && layerPurple.GetAllFeatures().Length > 0)
+ {
+ feature = layerPurple.GetAt(layerPurple.GetAllFeatures().Length - 1);
+ if (feature != null)
+ {
+ feature.Name = lineName;
+ GSOSimpleLineStyle3D style = new GSOSimpleLineStyle3D();
+ style.LineColor = Color.Purple;
+ feature.Geometry.Style = style;
+ //layerPurple.Save();
+ }
+ }
+ break;
+ case "城市黑线":
+ GSOLayer layerBlack = globeControl1.Globe.Layers.GetLayerByCaption(lineType);
+ if (layerBlack != null && layerBlack.GetAllFeatures().Length > 0)
+ {
+ feature = layerBlack.GetAt(layerBlack.GetAllFeatures().Length - 1);
+ if (feature != null)
+ {
+ feature.Name = lineName;
+ GSOSimpleLineStyle3D style = new GSOSimpleLineStyle3D();
+ style.LineColor = Color.Black;
+ feature.Geometry.Style = style;
+ //layerBlack.Save();
+ }
+ }
+ break;
+ }
+
+ globeControl1.Globe.DestLayerFeatureAdd = null;
+ }
+ m_AddPipeLine = false;
+ m_isDrawTunnel = false;
+ m_isDrawCitySevenLine = false;
+ if (m_isDrawRedPology && globeControl1.Globe.Action == EnumAction3D.DrawPolygon)//红线工具
+ {
+ GSOLayer layerDest = globeControl1.Globe.DestLayerFeatureAdd;
+ if (layerDest != null)
+ {
+ GSOFeatures features = layerDest.GetAllFeatures();
+ //GSOFeatures features = globeControl1.Globe.MemoryLayer.GetAllFeatures();
+ GSOFeature f = features[features.Length - 1];
+ if (f != null)
+ {
+ GSOGeoPolygon3D polygon = f.Geometry as GSOGeoPolygon3D;
+ if (polygon != null)
+ {
+ GSOSimplePolygonStyle3D geoStyle3d = new GSOSimplePolygonStyle3D();
+ f.Name = (getLabelName(layerDest) + 1).ToString();
+ geoStyle3d.FillColor = Color.Red;
+ polygon.Style = geoStyle3d;
+ GSOLabel label = new GSOLabel();
+ label.Text = "此区域正在施工中!";
+ label.Style = new GSOLabelStyle();
+ label.Style.HasTracktionLine = false;
+ polygon.Label = label;
+
+ globeControl1.Refresh();
+ }
}
}
- m_isDrawRedPology = false;
- globeControl1.Globe.Action = EnumAction3D.ActionNull;
-
-
}
+ m_isDrawRedPology = false;
+ globeControl1.Globe.Action = EnumAction3D.ActionNull;
}
///
@@ -2627,7 +2332,7 @@
}
}
///
- /// (完善)
+ /// (完善)#wxl 待整理
///
///
///
@@ -2907,7 +2612,7 @@
}
///
- /// 鼠标点击, 弹出气泡功能globeControl1
+ /// 鼠标点击, 弹出气泡功能globeControl1 wxl待整理
///
///
///
@@ -2916,34 +2621,30 @@
GSOFeature feature = e.Feature;
string str1 = "";
- if (feature != null)
+ if (feature == null) return;
+ if (feature.GetFieldDefn("图片编码") != null)//
{
- if (feature.GetFieldDefn("图片编码") != null)//
+ str1 = GetBubbleInfo(feature, globeControl1);
+ if (RemoteFileExists(Utility.PicRootURL + feature.GetValue("图片编码")))
{
- str1 = GetBubbleInfo(feature, globeControl1);
- if (RemoteFileExists(Utility.PicRootURL + feature.GetValue("图片编码")))
- {
- str1 += "
";
- }
- else if (RemoteFileExists(Utility.PicDefaultURL))
- {
- str1 += "
";
- }
+ str1 += "
";
}
- else if (isFeatureContainsBianhao(feature)) //管线模型图层
+ else if (RemoteFileExists(Utility.PicDefaultURL))
{
- str1 = GetBubbleInfo(feature, globeControl1);
- }
-
- if (str1 != "")
- {
- featureTooltip.HideBalloon();
- balloonEx.HideBalloon();
- balloonEx.SetSize(EnumSizeIndexEx.CONTENT_CX, 480);
- balloonEx.SetSize(EnumSizeIndexEx.CONTENT_CY, 420);
- balloonEx.ShowBalloon((int)e.MousePos.X, (int)e.MousePos.Y, str1);
+ str1 += "
";
}
}
+ else if (isFeatureContainsBianhao(feature)) //管线模型图层
+ {
+ str1 = GetBubbleInfo(feature, globeControl1);
+ }
+
+ if (str1 == "") return;
+ featureTooltip.HideBalloon();
+ balloonEx.HideBalloon();
+ balloonEx.SetSize(EnumSizeIndexEx.CONTENT_CX, 480);
+ balloonEx.SetSize(EnumSizeIndexEx.CONTENT_CY, 420);
+ balloonEx.ShowBalloon((int)e.MousePos.X, (int)e.MousePos.Y, str1);
}
///
@@ -2956,35 +2657,30 @@
GSOFeature feature = e.Feature;
string str1 = "";
- if (feature != null)
+ if (feature == null) return;
+ if (feature.GetFieldDefn("图片编码") != null) //
{
- if (feature.GetFieldDefn("图片编码") != null) //
+ str1 = GetBubbleInfo(feature, globeControl2);
+ if (RemoteFileExists(Utility.PicRootURL + feature.GetValue("图片编码")))
{
- str1 = GetBubbleInfo(feature, globeControl2);
- if (RemoteFileExists(Utility.PicRootURL + feature.GetValue("图片编码")))
- {
- str1 += "
";
- }
- else if (RemoteFileExists(Utility.PicDefaultURL))
- {
- str1 += "
";
- }
+ str1 += "
";
}
- else if (isFeatureContainsBianhao(feature)) //管线模型图层
+ else if (RemoteFileExists(Utility.PicDefaultURL))
{
- str1 = GetBubbleInfo(feature, globeControl2);
- }
-
- if (str1 != "")
- {
-
- featureTooltip2.HideBalloon();
- balloonEx2.HideBalloon();
- balloonEx2.SetSize(EnumSizeIndexEx.CONTENT_CX, 480);
- balloonEx2.SetSize(EnumSizeIndexEx.CONTENT_CY, 420);
- balloonEx2.ShowBalloon((int)e.MousePos.X, (int)e.MousePos.Y, str1);
+ str1 += "
";
}
}
+ else if (isFeatureContainsBianhao(feature)) //管线模型图层
+ {
+ str1 = GetBubbleInfo(feature, globeControl2);
+ }
+
+ if (str1 == "") return;
+ featureTooltip2.HideBalloon();
+ balloonEx2.HideBalloon();
+ balloonEx2.SetSize(EnumSizeIndexEx.CONTENT_CX, 480);
+ balloonEx2.SetSize(EnumSizeIndexEx.CONTENT_CY, 420);
+ balloonEx2.ShowBalloon((int)e.MousePos.X, (int)e.MousePos.Y, str1);
}
///
@@ -3011,15 +2707,13 @@
for (int i = 0; i < Utility.listPipelineType.Count; i++)
{
PipelineType pipelineType = Utility.listPipelineType[i];
- if (pipelineType != null && pipelineType.code.Trim() == pipelinecode.Trim())
+ if (pipelineType == null || pipelineType.code.Trim() != pipelinecode.Trim()) continue;
+ title = pipelineType.type + " " + pipelineType.name;
+ if (pipelineType.type == pipelineType.name)
{
- title = pipelineType.type + " " + pipelineType.name;
- if (pipelineType.type == pipelineType.name)
- {
- title = pipelineType.type;
- }
- break;
+ title = pipelineType.type;
}
+ break;
}
}
}
@@ -3172,8 +2866,8 @@
return str;
}
- string filename = Utility.filename;
- List g1layername = new List();
+ //string filename = Utility.filename;
+ //List g1layername = new List();
///
/// 获取目标图层
@@ -3229,17 +2923,15 @@
for (int n = 0; n < tempChildNode1.Nodes.Count; n++)
{
TreeNode tempChildNode2 = tempChildNode1.Nodes[n];
- if (tempChildNode2.Tag.ToString().Split('|').Length > 1)
+ if (tempChildNode2.Tag.ToString().Split('|').Length <= 1) continue;
+ GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(tempChildNode2.Tag.ToString().Split('|')[1]);
+ if (layer == null)
{
- GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(tempChildNode2.Tag.ToString().Split('|')[1]);
- if (layer == null)
- {
- continue;
- }
- if (tempChildNode2.Tag != null && layer.IsDestLayerFeatureAdd())
- {
- return tempChildNode2;
- }
+ continue;
+ }
+ if (tempChildNode2.Tag != null && layer.IsDestLayerFeatureAdd())
+ {
+ return tempChildNode2;
}
}
}
@@ -3260,35 +2952,33 @@
//日志记录
LogManager.saveLog(Utility.userName, buttonItem87.Text);
- if (!buttonItem87.Checked)
- {
- buttonItem87.Checked = true;
- buttonItem88.Checked = false;
- buttonItem27.Checked = false;
+ if (buttonItem87.Checked) return;
+ buttonItem87.Checked = true;
+ buttonItem88.Checked = false;
+ buttonItem27.Checked = false;
- switch (globeControl1.Globe.CameraMode)
- {
- case EnumCameraMode.UnderGround:
- globeControl1.Globe.CameraMode = EnumCameraMode.Navigation;
- GSOCameraState state = new GSOCameraState();
- state.AltitudeMode = globeControl1.Globe.CameraState.AltitudeMode;
- state.Altitude = globeControl1.Globe.CameraState.Altitude;
- state.Distance = globeControl1.Globe.CameraState.Distance;
- state.Heading = globeControl1.Globe.CameraState.Heading;
- state.Latitude = globeControl1.Globe.CameraState.Latitude;
- state.Longitude = globeControl1.Globe.CameraState.Longitude;
- if (globeControl1.Globe.CameraState.Tilt < 95 && globeControl1.Globe.CameraState.Tilt > 85)
- state.Tilt = 85;
- else
- state.Tilt = 180 - globeControl1.Globe.CameraState.Tilt;
- globeControl1.Globe.JumpToCameraState(state);
- break;
- case EnumCameraMode.Walk:
- globeControl1.Globe.CameraMode = EnumCameraMode.Navigation;
- break;
- }
- globeControl1.Globe.Refresh();
+ switch (globeControl1.Globe.CameraMode)
+ {
+ case EnumCameraMode.UnderGround:
+ globeControl1.Globe.CameraMode = EnumCameraMode.Navigation;
+ GSOCameraState state = new GSOCameraState();
+ state.AltitudeMode = globeControl1.Globe.CameraState.AltitudeMode;
+ state.Altitude = globeControl1.Globe.CameraState.Altitude;
+ state.Distance = globeControl1.Globe.CameraState.Distance;
+ state.Heading = globeControl1.Globe.CameraState.Heading;
+ state.Latitude = globeControl1.Globe.CameraState.Latitude;
+ state.Longitude = globeControl1.Globe.CameraState.Longitude;
+ if (globeControl1.Globe.CameraState.Tilt < 95 && globeControl1.Globe.CameraState.Tilt > 85)
+ state.Tilt = 85;
+ else
+ state.Tilt = 180 - globeControl1.Globe.CameraState.Tilt;
+ globeControl1.Globe.JumpToCameraState(state);
+ break;
+ case EnumCameraMode.Walk:
+ globeControl1.Globe.CameraMode = EnumCameraMode.Navigation;
+ break;
}
+ globeControl1.Globe.Refresh();
}
///
/// 地下模式 菜单按钮
@@ -3300,33 +2990,31 @@
//日志记录
LogManager.saveLog(Utility.userName, buttonItem88.Text);
- if (!buttonItem88.Checked)
- {
- buttonItem88.Checked = true;
- buttonItem27.Checked = false;
- buttonItem87.Checked = false;
+ if (buttonItem88.Checked) return;
+ buttonItem88.Checked = true;
+ buttonItem27.Checked = false;
+ buttonItem87.Checked = false;
- switch (globeControl1.Globe.CameraMode)
- {
- case EnumCameraMode.Navigation:
- case EnumCameraMode.Walk:
- globeControl1.Globe.CameraMode = EnumCameraMode.UnderGround;
- GSOCameraState state = new GSOCameraState();
- state.AltitudeMode = globeControl1.Globe.CameraState.AltitudeMode;
- state.Altitude = globeControl1.Globe.CameraState.Altitude;
- state.Distance = globeControl1.Globe.CameraState.Distance;
- state.Heading = globeControl1.Globe.CameraState.Heading;
- state.Latitude = globeControl1.Globe.CameraState.Latitude;
- state.Longitude = globeControl1.Globe.CameraState.Longitude;
- if (globeControl1.Globe.CameraState.Tilt < 95 && globeControl1.Globe.CameraState.Tilt > 85)
- state.Tilt = 95;
- else
- state.Tilt = 180 - globeControl1.Globe.CameraState.Tilt;
- globeControl1.Globe.JumpToCameraState(state);
- break;
- }
- globeControl1.Globe.Refresh();
+ switch (globeControl1.Globe.CameraMode)
+ {
+ case EnumCameraMode.Navigation:
+ case EnumCameraMode.Walk:
+ globeControl1.Globe.CameraMode = EnumCameraMode.UnderGround;
+ GSOCameraState state = new GSOCameraState();
+ state.AltitudeMode = globeControl1.Globe.CameraState.AltitudeMode;
+ state.Altitude = globeControl1.Globe.CameraState.Altitude;
+ state.Distance = globeControl1.Globe.CameraState.Distance;
+ state.Heading = globeControl1.Globe.CameraState.Heading;
+ state.Latitude = globeControl1.Globe.CameraState.Latitude;
+ state.Longitude = globeControl1.Globe.CameraState.Longitude;
+ if (globeControl1.Globe.CameraState.Tilt < 95 && globeControl1.Globe.CameraState.Tilt > 85)
+ state.Tilt = 95;
+ else
+ state.Tilt = 180 - globeControl1.Globe.CameraState.Tilt;
+ globeControl1.Globe.JumpToCameraState(state);
+ break;
}
+ globeControl1.Globe.Refresh();
}
///
/// 行走模式 菜单按钮
@@ -3338,14 +3026,12 @@
//日志记录
LogManager.saveLog(Utility.userName, buttonItem27.Text);
- if (!buttonItem27.Checked)
- {
- buttonItem27.Checked = true;
- buttonItem87.Checked = false;
- buttonItem88.Checked = false;
+ if (buttonItem27.Checked) return;
+ buttonItem27.Checked = true;
+ buttonItem87.Checked = false;
+ buttonItem88.Checked = false;
- globeControl1.Globe.CameraMode = EnumCameraMode.Walk;
- }
+ globeControl1.Globe.CameraMode = EnumCameraMode.Walk;
}
///
/// 地面透明度设置 菜单
@@ -3357,7 +3043,7 @@
LogManager.saveLog(Utility.userName, sliderGroundTransSet1.Text);
globeControl1.Globe.GroundOpaque = 100 - sliderGroundTransSet1.Value;
- GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(roadLayerName);//("180fd");
+ GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(Utility.roadLayerName);//("180fd");
if (layer != null)
layer.Opaque = 100 - sliderGroundTransSet1.Value;
optiValue = sliderGroundTransSet1.Value;
@@ -3890,24 +3576,22 @@
///
private void comboBoxEx1_SelectedIndexChanged(object sender, EventArgs e)
{
- if (comboBoxEx1.SelectedIndex > -1)
- {
- dataGridViewX2.Rows.Clear();
- dataGridViewX3.Rows.Clear();
- listBox1.Items.Clear();
- GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(comboBoxEx1.SelectedItem.ToString());
- if (layer == null)
- return;
+ if (comboBoxEx1.SelectedIndex <= -1) return;
+ dataGridViewX2.Rows.Clear();
+ dataGridViewX3.Rows.Clear();
+ listBox1.Items.Clear();
+ GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(comboBoxEx1.SelectedItem.ToString());
+ if (layer == null)
+ return;
- GSOFeatureLayer flayer = layer as GSOFeatureLayer;
- GSOFeatureDataset fdataset = flayer.Dataset as GSOFeatureDataset;
- GSOFeatures feats = flayer.GetAllFeatures();
- for (int i = 0; i < feats.Length; i++)
- {
- int idx = dataGridViewX2.Rows.Add();
- dataGridViewX2.Rows[idx].Cells[0].Value = comboBoxEx1.SelectedItem.ToString();
- dataGridViewX2.Rows[idx].Cells[1].Value = feats[i].Name;
- }
+ GSOFeatureLayer flayer = layer as GSOFeatureLayer;
+ GSOFeatureDataset fdataset = flayer.Dataset as GSOFeatureDataset;
+ GSOFeatures feats = flayer.GetAllFeatures();
+ for (int i = 0; i < feats.Length; i++)
+ {
+ int idx = dataGridViewX2.Rows.Add();
+ dataGridViewX2.Rows[idx].Cells[0].Value = comboBoxEx1.SelectedItem.ToString();
+ dataGridViewX2.Rows[idx].Cells[1].Value = feats[i].Name;
}
}
///
@@ -3917,24 +3601,22 @@
///
private void comboBoxEx1_SelectedIndexChanged_shuiping(object sender, EventArgs e)
{
- if (comboBoxEx4.SelectedIndex > -1)
- {
- dataGridViewX8.Rows.Clear();
- dataGridViewX9.Rows.Clear();
- listBox3.Items.Clear();
- GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(comboBoxEx4.SelectedItem.ToString());
- if (layer == null)
- return;
+ if (comboBoxEx4.SelectedIndex <= -1) return;
+ dataGridViewX8.Rows.Clear();
+ dataGridViewX9.Rows.Clear();
+ listBox3.Items.Clear();
+ GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(comboBoxEx4.SelectedItem.ToString());
+ if (layer == null)
+ return;
- GSOFeatureLayer flayer = layer as GSOFeatureLayer;
- GSOFeatureDataset fdataset = flayer.Dataset as GSOFeatureDataset;
- GSOFeatures feats = flayer.GetAllFeatures();
- for (int i = 0; i < feats.Length; i++)
- {
- int idx = dataGridViewX8.Rows.Add();
- dataGridViewX8.Rows[idx].Cells[0].Value = comboBoxEx4.SelectedItem.ToString();
- dataGridViewX8.Rows[idx].Cells[1].Value = feats[i].Name;
- }
+ GSOFeatureLayer flayer = layer as GSOFeatureLayer;
+ GSOFeatureDataset fdataset = flayer.Dataset as GSOFeatureDataset;
+ GSOFeatures feats = flayer.GetAllFeatures();
+ for (int i = 0; i < feats.Length; i++)
+ {
+ int idx = dataGridViewX8.Rows.Add();
+ dataGridViewX8.Rows[idx].Cells[0].Value = comboBoxEx4.SelectedItem.ToString();
+ dataGridViewX8.Rows[idx].Cells[1].Value = feats[i].Name;
}
}
Dictionary featCount = new Dictionary();
@@ -3984,7 +3666,7 @@
if (selectedFeature != null)
{
selectState = 1;
- VerticalDistanceAnalysis("垂直净距分析", selectedFeature, m_PipelineLayerNames, dJingJuBiaoZhun, 0.0);
+ VerticalDistanceAnalysis("垂直净距分析", selectedFeature, Utility.m_PipelineLayerNames, dJingJuBiaoZhun, 0.0);
}
}
}
@@ -4005,16 +3687,16 @@
for (int i = 0; i < feats.Length; i++)
{
selectState = 1;
- VerticalDistanceAnalysis("垂直净距分析", feats[i], m_PipelineLayerNames, dJingJuBiaoZhun, 0.0);
+ VerticalDistanceAnalysis("垂直净距分析", feats[i], Utility.m_PipelineLayerNames, dJingJuBiaoZhun, 0.0);
}
}
if (featCount.Count > 0)
{
- for (int i = 0; i < m_PipelineLayerNames.Count; i++)
+ for (int i = 0; i < Utility.m_PipelineLayerNames.Count; i++)
{
- if (featCount.ContainsKey(m_PipelineLayerNames[i]) && featLenth.ContainsKey(m_PipelineLayerNames[i]))
+ if (featCount.ContainsKey(Utility.m_PipelineLayerNames[i]) && featLenth.ContainsKey(Utility.m_PipelineLayerNames[i]))
{
- listBox1.Items.Add(m_PipelineLayerNames[i] + ":" + featCount[m_PipelineLayerNames[i]] + "条,共" + featLenth[m_PipelineLayerNames[i]].ToString("0.00") + "米");
+ listBox1.Items.Add(Utility.m_PipelineLayerNames[i] + ":" + featCount[Utility.m_PipelineLayerNames[i]] + "条,共" + featLenth[Utility.m_PipelineLayerNames[i]].ToString("0.00") + "米");
}
}
}
@@ -4130,112 +3812,110 @@
continue;
}
GSOLayer layer2 = globeControl1.Globe.Layers.GetLayerByCaption(_pipelineLayerNames[i]);
- if (layer2 != null)
+ if (layer2 == null) continue;
+ GSOFeatureLayer flayer2 = layer2 as GSOFeatureLayer;
+ GSOFeatureDataset fdataset2 = flayer2.Dataset as GSOFeatureDataset;
+ GSOFeatures feats2 = Polygon_Contain_PointAnalysis(polygon, _pipelineLayerNames[i]);
+ for (int j = 0; j < feats2.Length; j++)
{
- GSOFeatureLayer flayer2 = layer2 as GSOFeatureLayer;
- GSOFeatureDataset fdataset2 = flayer2.Dataset as GSOFeatureDataset;
- GSOFeatures feats2 = Polygon_Contain_PointAnalysis(polygon, _pipelineLayerNames[i]);
- for (int j = 0; j < feats2.Length; j++)
- {
- GSOFeature feat2 = feats2[j];
- GSOGeoPolyline3D line2 = feats2[j].Geometry as GSOGeoPolyline3D;
- if (line2 == null) continue;
- GSOPipeLineStyle3D pipeStyle1 = line1.Style as GSOPipeLineStyle3D;
- GSOPipeLineStyle3D pipeStyle2 = line2.Style as GSOPipeLineStyle3D;
- if (pipeStyle1 == null || pipeStyle2 == null) continue;
+ GSOFeature feat2 = feats2[j];
+ GSOGeoPolyline3D line2 = feats2[j].Geometry as GSOGeoPolyline3D;
+ if (line2 == null) continue;
+ GSOPipeLineStyle3D pipeStyle1 = line1.Style as GSOPipeLineStyle3D;
+ GSOPipeLineStyle3D pipeStyle2 = line2.Style as GSOPipeLineStyle3D;
+ if (pipeStyle1 == null || pipeStyle2 == null) continue;
- double dDist = -1;
- dDist = globeControl1.Globe.Analysis3D.ComputeHorizonDistance(line1, line2, out pntIntersect1, out pntIntersect2, out pntProIntersect1, out pntProIntersect2, false);
+ double dDist = -1;
+ dDist = globeControl1.Globe.Analysis3D.ComputeHorizonDistance(line1, line2, out pntIntersect1, out pntIntersect2, out pntProIntersect1, out pntProIntersect2, false);
- if (dDist > -1)
+ if (dDist > -1)
+ {
+ dDist = Math.Abs(pntIntersect1.Z - pntIntersect2.Z) - pipeStyle1.Radius - pipeStyle2.Radius;//获得净距值
+
+ if (dDist < verticalDistance)
{
- dDist = Math.Abs(pntIntersect1.Z - pntIntersect2.Z) - pipeStyle1.Radius - pipeStyle2.Radius;//获得净距值
-
- if (dDist < verticalDistance)
+ int idx = -1;
+ GSOPoint3d markerPosition = new GSOPoint3d();
+ if (type == "垂直净距分析")
{
- int idx = -1;
- GSOPoint3d markerPosition = new GSOPoint3d();
- if (type == "垂直净距分析")
- {
- feat2.HighLight = true;
- markerPosition = LabelVerticalDistance(layerTemp, pntIntersect1, pntIntersect2, dDist, true);
+ feat2.HighLight = true;
+ markerPosition = LabelVerticalDistance(layerTemp, pntIntersect1, pntIntersect2, dDist, true);
- idx = dataGridViewX3.Rows.Add();
- dataGridViewX3.Rows[idx].Cells[0].Value = caption;
- dataGridViewX3.Rows[idx].Cells[1].Value = selectedFeature.Name;
- dataGridViewX3.Rows[idx].Cells[2].Value = layer2.Caption;
- dataGridViewX3.Rows[idx].Cells[3].Value = feat2.Name;
- dataGridViewX3.Rows[idx].Cells[4].Value = dDist.ToString("0.00");
- }
- else if (type == "碰撞分析")
- {
- feat2.HighLight = true;
- markerPosition = LabelVerticalDistance(layerTemp, pntIntersect1, pntIntersect2, dDist, false);
+ idx = dataGridViewX3.Rows.Add();
+ dataGridViewX3.Rows[idx].Cells[0].Value = caption;
+ dataGridViewX3.Rows[idx].Cells[1].Value = selectedFeature.Name;
+ dataGridViewX3.Rows[idx].Cells[2].Value = layer2.Caption;
+ dataGridViewX3.Rows[idx].Cells[3].Value = feat2.Name;
+ dataGridViewX3.Rows[idx].Cells[4].Value = dDist.ToString("0.00");
+ }
+ else if (type == "碰撞分析")
+ {
+ feat2.HighLight = true;
+ markerPosition = LabelVerticalDistance(layerTemp, pntIntersect1, pntIntersect2, dDist, false);
- selectedFeature.HighLight = true;
- idx = dataGridViewX5.Rows.Add();
- dataGridViewX5.Rows[idx].Cells[0].Value = dataGridViewX4.Rows[0].Cells[0].Value.ToString();
- dataGridViewX5.Rows[idx].Cells[1].Value = selectedFeature.Name;
- dataGridViewX5.Rows[idx].Cells[2].Value = layer2.Caption;
- dataGridViewX5.Rows[idx].Cells[3].Value = feat2.Name;
- }
- else if (type == "间距分析")
+ selectedFeature.HighLight = true;
+ idx = dataGridViewX5.Rows.Add();
+ dataGridViewX5.Rows[idx].Cells[0].Value = dataGridViewX4.Rows[0].Cells[0].Value.ToString();
+ dataGridViewX5.Rows[idx].Cells[1].Value = selectedFeature.Name;
+ dataGridViewX5.Rows[idx].Cells[2].Value = layer2.Caption;
+ dataGridViewX5.Rows[idx].Cells[3].Value = feat2.Name;
+ }
+ else if (type == "间距分析")
+ {
+ GSOGeoPolygon3D polygonSpacing = line2.CreateBuffer(horizontalDistance, true, 5, false, false);
+ if (polygonSpacing != null)
{
- GSOGeoPolygon3D polygonSpacing = line2.CreateBuffer(horizontalDistance, true, 5, false, false);
- if (polygonSpacing != null)
+ GSOFeatures horizontalFeatures = layer2.FindFeaturesInPolygon(polygonSpacing, false);
+ if (horizontalFeatures != null)
{
- GSOFeatures horizontalFeatures = layer2.FindFeaturesInPolygon(polygonSpacing, false);
- if (horizontalFeatures != null)
+ for (int m = 0; m < horizontalFeatures.Length; m++)
{
- for (int m = 0; m < horizontalFeatures.Length; m++)
+ GSOFeature horizontalFeature = horizontalFeatures[m];
+ if (horizontalFeature != null && horizontalFeature.ID == feat2.ID)
{
- GSOFeature horizontalFeature = horizontalFeatures[m];
- if (horizontalFeature != null && horizontalFeature.ID == feat2.ID)
- {
- feat2.HighLight = true;
- idx = dataGridViewAnalysisResult.Rows.Add();
- dataGridViewAnalysisResult.Rows[idx].Tag = feat2;
- dataGridViewAnalysisResult.Rows[idx].Cells[0].Value = dataGridViewLineList.Rows[0].Cells[0].Value.ToString();
- dataGridViewAnalysisResult.Rows[idx].Cells[1].Value = selectedFeature.Name;
- dataGridViewAnalysisResult.Rows[idx].Cells[2].Value = layer2.Caption;
- dataGridViewAnalysisResult.Rows[idx].Cells[3].Value = feat2.Name;
- dataGridViewAnalysisResult.Rows[idx].Cells[4].Value = dDist.ToString("0.00");
- dataGridViewAnalysisResult.Rows[idx].Cells[5].Value = horizontalDistance.ToString("0.00");
- break;
- }
+ feat2.HighLight = true;
+ idx = dataGridViewAnalysisResult.Rows.Add();
+ dataGridViewAnalysisResult.Rows[idx].Tag = feat2;
+ dataGridViewAnalysisResult.Rows[idx].Cells[0].Value = dataGridViewLineList.Rows[0].Cells[0].Value.ToString();
+ dataGridViewAnalysisResult.Rows[idx].Cells[1].Value = selectedFeature.Name;
+ dataGridViewAnalysisResult.Rows[idx].Cells[2].Value = layer2.Caption;
+ dataGridViewAnalysisResult.Rows[idx].Cells[3].Value = feat2.Name;
+ dataGridViewAnalysisResult.Rows[idx].Cells[4].Value = dDist.ToString("0.00");
+ dataGridViewAnalysisResult.Rows[idx].Cells[5].Value = horizontalDistance.ToString("0.00");
+ break;
}
}
}
}
+ }
- if (m_FeaturesWithBianhao.ContainsKey(selectedFeature.Name + "-" + feats2[j].Name) == false)
- {
- m_FeaturesWithBianhao.Add(selectedFeature.Name + "-" + feats2[j].Name, markerPosition);//添加飞行位置记录
- }
+ if (m_FeaturesWithBianhao.ContainsKey(selectedFeature.Name + "-" + feats2[j].Name) == false)
+ {
+ m_FeaturesWithBianhao.Add(selectedFeature.Name + "-" + feats2[j].Name, markerPosition);//添加飞行位置记录
+ }
- if (featCount.ContainsKey(layer2.Caption))
- {
- featCount[layer2.Caption] = featCount[layer2.Caption] + 1;
- }
- else
- {
- featCount.Add(layer2.Caption, 1);
- }
- if (featLenth.ContainsKey(layer2.Caption))
- {
- featLenth[layer2.Caption] = featLenth[layer2.Caption] + line2.GetSpaceLength(true, 6378137);
- }
- else
- {
- featLenth.Add(layer2.Caption, line2.GetSpaceLength(true, 6378137));
- }
+ if (featCount.ContainsKey(layer2.Caption))
+ {
+ featCount[layer2.Caption] = featCount[layer2.Caption] + 1;
+ }
+ else
+ {
+ featCount.Add(layer2.Caption, 1);
+ }
+ if (featLenth.ContainsKey(layer2.Caption))
+ {
+ featLenth[layer2.Caption] = featLenth[layer2.Caption] + line2.GetSpaceLength(true, 6378137);
+ }
+ else
+ {
+ featLenth.Add(layer2.Caption, line2.GetSpaceLength(true, 6378137));
}
}
- line2.ReleaseInnerPointer();
- feat2.ReleaseInnerPointer();
}
- feats2.ReleaseInnerPointer();
+ line2.ReleaseInnerPointer();
+ feat2.ReleaseInnerPointer();
}
+ feats2.ReleaseInnerPointer();
}
line1.ReleaseInnerPointer();
selectedFeature.ReleaseInnerPointer();
@@ -4302,7 +3982,7 @@
if (selectedFeature != null)
{
selectState = 1;
- HorizontalDistanceAnalysis(selectedFeature, m_PipelineLayerNames, dJingJuBiaoZhun);
+ HorizontalDistanceAnalysis(selectedFeature, Utility.m_PipelineLayerNames, dJingJuBiaoZhun);
}
}
}
@@ -4317,16 +3997,16 @@
GSOFeatures feats = flayer.GetAllFeatures();
for (int i = 0; i < feats.Length; i++)
{
- HorizontalDistanceAnalysis(feats[i], m_PipelineLayerNames, dJingJuBiaoZhun);
+ HorizontalDistanceAnalysis(feats[i], Utility.m_PipelineLayerNames, dJingJuBiaoZhun);
}
}
if (featCount.Count > 0) //统计结果
{
- for (int i = 0; i < m_PipelineLayerNames.Count; i++)
+ for (int i = 0; i < Utility.m_PipelineLayerNames.Count; i++)
{
- if (featCount.ContainsKey(m_PipelineLayerNames[i]) && featLenth.ContainsKey(m_PipelineLayerNames[i]))
+ if (featCount.ContainsKey(Utility.m_PipelineLayerNames[i]) && featLenth.ContainsKey(Utility.m_PipelineLayerNames[i]))
{
- listBox3.Items.Add(m_PipelineLayerNames[i] + ":" + featCount[m_PipelineLayerNames[i]] + "条,共" + featLenth[m_PipelineLayerNames[i]].ToString("0.00") + "米");
+ listBox3.Items.Add(Utility.m_PipelineLayerNames[i] + ":" + featCount[Utility.m_PipelineLayerNames[i]] + "条,共" + featLenth[Utility.m_PipelineLayerNames[i]].ToString("0.00") + "米");
}
}
}
@@ -4381,51 +4061,49 @@
continue;
}
GSOLayer layer2 = globeControl1.Globe.Layers.GetLayerByCaption(_pipelineLayerNames[i]);
- if (layer2 != null)
+ if (layer2 == null) continue;
+ GSOFeatureLayer flayer2 = layer2 as GSOFeatureLayer;
+ GSOFeatureDataset fdataset2 = flayer2.Dataset as GSOFeatureDataset;
+ GSOFeatures feats2 = Polygon_Contain_PointAnalysis(polygon, _pipelineLayerNames[i]);
+ for (int j = 0; j < feats2.Length; j++)
{
- GSOFeatureLayer flayer2 = layer2 as GSOFeatureLayer;
- GSOFeatureDataset fdataset2 = flayer2.Dataset as GSOFeatureDataset;
- GSOFeatures feats2 = Polygon_Contain_PointAnalysis(polygon, _pipelineLayerNames[i]);
- for (int j = 0; j < feats2.Length; j++)
+ GSOFeature feat2 = feats2[j];
+ GSOGeoPolyline3D line2 = feats2[j].Geometry as GSOGeoPolyline3D;
+ if (line2 == null)
{
- GSOFeature feat2 = feats2[j];
- GSOGeoPolyline3D line2 = feats2[j].Geometry as GSOGeoPolyline3D;
- if (line2 == null)
- {
- continue;
- }
- GSOPipeLineStyle3D pipeStyle1 = line1.Style as GSOPipeLineStyle3D;
- GSOPipeLineStyle3D pipeStyle2 = line2.Style as GSOPipeLineStyle3D;
- if (pipeStyle1 == null || pipeStyle2 == null)
- {
- continue;
- }
+ continue;
+ }
+ GSOPipeLineStyle3D pipeStyle1 = line1.Style as GSOPipeLineStyle3D;
+ GSOPipeLineStyle3D pipeStyle2 = line2.Style as GSOPipeLineStyle3D;
+ if (pipeStyle1 == null || pipeStyle2 == null)
+ {
+ continue;
+ }
- feat2.HighLight = true;
- int idx = dataGridViewX9.Rows.Add();
- dataGridViewX9.Rows[idx].Tag = feat2;
- dataGridViewX9.Rows[idx].Cells[0].Value = caption;
- dataGridViewX9.Rows[idx].Cells[1].Value = selectedFeature.Name;
- dataGridViewX9.Rows[idx].Cells[2].Value = layer2.Caption;
- dataGridViewX9.Rows[idx].Cells[3].Value = feats2[j].Name;
- dataGridViewX9.Rows[idx].Cells[4].Value = dis.ToString("0.00");
+ feat2.HighLight = true;
+ int idx = dataGridViewX9.Rows.Add();
+ dataGridViewX9.Rows[idx].Tag = feat2;
+ dataGridViewX9.Rows[idx].Cells[0].Value = caption;
+ dataGridViewX9.Rows[idx].Cells[1].Value = selectedFeature.Name;
+ dataGridViewX9.Rows[idx].Cells[2].Value = layer2.Caption;
+ dataGridViewX9.Rows[idx].Cells[3].Value = feats2[j].Name;
+ dataGridViewX9.Rows[idx].Cells[4].Value = dis.ToString("0.00");
- if (featCount.ContainsKey(layer2.Caption))
- {
- featCount[layer2.Caption] = featCount[layer2.Caption] + 1;
- }
- else
- {
- featCount.Add(layer2.Caption, 1);
- }
- if (featLenth.ContainsKey(layer2.Caption))
- {
- featLenth[layer2.Caption] = featLenth[layer2.Caption] + line2.GetSpaceLength(true, 6378137);
- }
- else
- {
- featLenth.Add(layer2.Caption, line2.GetSpaceLength(true, 6378137));
- }
+ if (featCount.ContainsKey(layer2.Caption))
+ {
+ featCount[layer2.Caption] = featCount[layer2.Caption] + 1;
+ }
+ else
+ {
+ featCount.Add(layer2.Caption, 1);
+ }
+ if (featLenth.ContainsKey(layer2.Caption))
+ {
+ featLenth[layer2.Caption] = featLenth[layer2.Caption] + line2.GetSpaceLength(true, 6378137);
+ }
+ else
+ {
+ featLenth.Add(layer2.Caption, line2.GetSpaceLength(true, 6378137));
}
}
}
@@ -4437,29 +4115,23 @@
///
private void dataGridViewX9_MouseDoubleClick(object sender, MouseEventArgs e)
{
- if (e.Button == MouseButtons.Left)
+ if (e.Button != MouseButtons.Left) return;
+ DataGridView.HitTestInfo hittestinfo = dataGridViewX9.HitTest(e.X, e.Y);
+ if (hittestinfo.RowIndex <= -1) return;
+ GSOFeature rowFeature = dataGridViewX9.Rows[hittestinfo.RowIndex].Tag as GSOFeature;
+ if (rowFeature == null) return;
+ if (rowFeature.Geometry != null && rowFeature.Geometry.Type == EnumGeometryType.GeoPolyline3D)
{
- DataGridView.HitTestInfo hittestinfo = dataGridViewX9.HitTest(e.X, e.Y);
- if (hittestinfo.RowIndex > -1)
- {
- GSOFeature rowFeature = dataGridViewX9.Rows[hittestinfo.RowIndex].Tag as GSOFeature;
- if (rowFeature != null)
- {
- if (rowFeature.Geometry != null && rowFeature.Geometry.Type == EnumGeometryType.GeoPolyline3D)
- {
- GSOGeoPolyline3D line = rowFeature.Geometry as GSOGeoPolyline3D;
- double length = line.GetSpaceLength(true, 6378137);
- GSOGeoPolyline3D lineLine = line.GetSegment(0, length / 2);
- GSOPoint3d point3d = lineLine[lineLine.PartCount - 1][lineLine[lineLine.PartCount - 1].Count - 1];
+ GSOGeoPolyline3D line = rowFeature.Geometry as GSOGeoPolyline3D;
+ double length = line.GetSpaceLength(true, 6378137);
+ GSOGeoPolyline3D lineLine = line.GetSegment(0, length / 2);
+ GSOPoint3d point3d = lineLine[lineLine.PartCount - 1][lineLine[lineLine.PartCount - 1].Count - 1];
- globeControl1.Globe.JumpToPosition(point3d, EnumAltitudeMode.Absolute, 5);
- }
- else
- {
- globeControl1.Globe.JumpToFeature(rowFeature, 5);
- }
- }
- }
+ globeControl1.Globe.JumpToPosition(point3d, EnumAltitudeMode.Absolute, 5);
+ }
+ else
+ {
+ globeControl1.Globe.JumpToFeature(rowFeature, 5);
}
}
///
@@ -4494,7 +4166,7 @@
if (selectedFeature != null)
{
selectState = 1;
- VerticalDistanceAnalysis("碰撞分析", selectedFeature, m_PipelineLayerNames, 0, 0.0);
+ VerticalDistanceAnalysis("碰撞分析", selectedFeature, Utility.m_PipelineLayerNames, 0, 0.0);
}
}
}
@@ -4510,17 +4182,17 @@
for (int i = 0; i < feats.Length; i++)
{
selectState = 1;
- VerticalDistanceAnalysis("碰撞分析", feats[i], m_PipelineLayerNames, 0, 0.0);
+ VerticalDistanceAnalysis("碰撞分析", feats[i], Utility.m_PipelineLayerNames, 0, 0.0);
}
}
if (featCount.Count > 0)
{
- for (int i = 0; i < m_PipelineLayerNames.Count; i++)
+ for (int i = 0; i < Utility.m_PipelineLayerNames.Count; i++)
{
- if (featCount.ContainsKey(m_PipelineLayerNames[i]) && featLenth.ContainsKey(m_PipelineLayerNames[i]))
+ if (featCount.ContainsKey(Utility.m_PipelineLayerNames[i]) && featLenth.ContainsKey(Utility.m_PipelineLayerNames[i]))
{
- listBox2.Items.Add(m_PipelineLayerNames[i] + ":" + featCount[m_PipelineLayerNames[i]] + "条,共" + featLenth[m_PipelineLayerNames[i]].ToString("0.00") + "米");
+ listBox2.Items.Add(Utility.m_PipelineLayerNames[i] + ":" + featCount[Utility.m_PipelineLayerNames[i]] + "条,共" + featLenth[Utility.m_PipelineLayerNames[i]].ToString("0.00") + "米");
}
}
}
@@ -4543,17 +4215,13 @@
///
private void dataGridViewX5_MouseDoubleClick(object sender, MouseEventArgs e)
{
- if (e.Button == MouseButtons.Left)
+ if (e.Button != MouseButtons.Left) return;
+ DataGridView.HitTestInfo hittestinfo = dataGridViewX5.HitTest(e.X, e.Y);
+ if (hittestinfo.RowIndex <= -1) return;
+ string key = dataGridViewX5.Rows[hittestinfo.RowIndex].Cells[1].Value.ToString().Trim() + "-" + dataGridViewX5.Rows[hittestinfo.RowIndex].Cells[3].Value.ToString().Trim();
+ if (m_FeaturesWithBianhao.ContainsKey(key))
{
- DataGridView.HitTestInfo hittestinfo = dataGridViewX5.HitTest(e.X, e.Y);
- if (hittestinfo.RowIndex > -1)
- {
- string key = dataGridViewX5.Rows[hittestinfo.RowIndex].Cells[1].Value.ToString().Trim() + "-" + dataGridViewX5.Rows[hittestinfo.RowIndex].Cells[3].Value.ToString().Trim();
- if (m_FeaturesWithBianhao.ContainsKey(key))
- {
- globeControl1.Globe.JumpToPosition(m_FeaturesWithBianhao[key], EnumAltitudeMode.Absolute, 5);
- }
- }
+ globeControl1.Globe.JumpToPosition(m_FeaturesWithBianhao[key], EnumAltitudeMode.Absolute, 5);
}
}
///
@@ -4611,25 +4279,23 @@
///
private void comboBoxEx3_SelectedIndexChanged(object sender, EventArgs e)
{
- if (comboBoxEx3.SelectedIndex > -1)
+ if (comboBoxEx3.SelectedIndex <= -1) return;
+ dataGridViewX6.Rows.Clear();
+ dataGridViewX7.Rows.Clear();
+
+ GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(comboBoxEx3.SelectedItem.ToString());
+ if (layer == null)
+ return;
+
+ GSOFeatureLayer flayer = layer as GSOFeatureLayer;
+ GSOFeatureDataset fdataset = flayer.Dataset as GSOFeatureDataset;
+ GSOFeatures feats = flayer.GetAllFeatures();
+
+ for (int i = 0; i < feats.Length; i++)
{
- dataGridViewX6.Rows.Clear();
- dataGridViewX7.Rows.Clear();
-
- GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(comboBoxEx3.SelectedItem.ToString());
- if (layer == null)
- return;
-
- GSOFeatureLayer flayer = layer as GSOFeatureLayer;
- GSOFeatureDataset fdataset = flayer.Dataset as GSOFeatureDataset;
- GSOFeatures feats = flayer.GetAllFeatures();
-
- for (int i = 0; i < feats.Length; i++)
- {
- int idx = dataGridViewX6.Rows.Add();
- dataGridViewX6.Rows[idx].Cells[0].Value = comboBoxEx3.SelectedItem.ToString();
- dataGridViewX6.Rows[idx].Cells[1].Value = feats[i].Name;
- }
+ int idx = dataGridViewX6.Rows.Add();
+ dataGridViewX6.Rows[idx].Cells[0].Value = comboBoxEx3.SelectedItem.ToString();
+ dataGridViewX6.Rows[idx].Cells[1].Value = feats[i].Name;
}
}
///
@@ -4670,51 +4336,47 @@
for (int i = 0; i < dataGridViewX6.Rows.Count; i++)
{
GSOFeature rowFeature = dataGridViewX6.Rows[i].Tag as GSOFeature;
- if (rowFeature != null)
+ if (rowFeature == null) continue;
+ string featureName = "";
+ if (isFeatureContainsBianhao(rowFeature))//判断rowFeature是否包含“编号”字段
{
- string featureName = "";
- if (isFeatureContainsBianhao(rowFeature))//判断rowFeature是否包含“编号”字段
- {
- featureName = rowFeature.GetValue(featureIDFieldName).ToString();
- }
- else
- {
- featureName = rowFeature.Name;
- }
+ featureName = rowFeature.GetValue(featureIDFieldName).ToString();
+ }
+ else
+ {
+ featureName = rowFeature.Name;
+ }
- GSOGeoPolyline3D line = rowFeature.Geometry as GSOGeoPolyline3D;
- if (line == null)
- {
- continue;
- }
- GSOPipeLineStyle3D style = line.Style as GSOPipeLineStyle3D;
- if (style == null)
- {
- continue;
- }
- if (line.PartCount > 0)
- {
- GSOPoint3ds pts = line[0];
- GSOPoint3d pt = new GSOPoint3d();
+ GSOGeoPolyline3D line = rowFeature.Geometry as GSOGeoPolyline3D;
+ if (line == null)
+ {
+ continue;
+ }
+ GSOPipeLineStyle3D style = line.Style as GSOPipeLineStyle3D;
+ if (style == null)
+ {
+ continue;
+ }
+ if (line.PartCount <= 0) continue;
+ GSOPoint3ds pts = line[0];
+ GSOPoint3d pt = new GSOPoint3d();
- for (int m = 0; m < pts.Count; m++)
- {
- if (Math.Abs(pts[m].Z + (style.Radius)) < Convert.ToDouble(textBoxX3.Text.Trim()))
- {
- rowFeature.HighLight = true;
- int idx = dataGridViewX7.Rows.Add();
- dataGridViewX7.Rows[idx].Tag = rowFeature;
- dataGridViewX7.Rows[idx].Cells[0].Value = rowFeature.Dataset.Caption;
- dataGridViewX7.Rows[idx].Cells[1].Value = featureName;
- dataGridViewX7.Rows[idx].Cells[2].Value = Math.Abs((pts[m].Z + (style.Radius))).ToString("0.00");
+ for (int m = 0; m < pts.Count; m++)
+ {
+ if (Math.Abs(pts[m].Z + (style.Radius)) < Convert.ToDouble(textBoxX3.Text.Trim()))
+ {
+ rowFeature.HighLight = true;
+ int idx = dataGridViewX7.Rows.Add();
+ dataGridViewX7.Rows[idx].Tag = rowFeature;
+ dataGridViewX7.Rows[idx].Cells[0].Value = rowFeature.Dataset.Caption;
+ dataGridViewX7.Rows[idx].Cells[1].Value = featureName;
+ dataGridViewX7.Rows[idx].Cells[2].Value = Math.Abs((pts[m].Z + (style.Radius))).ToString("0.00");
- pt.X = pts[m].X;
- pt.Y = pts[m].Y;
- pt.Z = 0;
- markerPosition = LabelVerticalDistance(layerTemp, pts[m], pt, Convert.ToDouble(dataGridViewX7.Rows[idx].Cells[2].Value), true);
- break;
- }
- }
+ pt.X = pts[m].X;
+ pt.Y = pts[m].Y;
+ pt.Z = 0;
+ markerPosition = LabelVerticalDistance(layerTemp, pts[m], pt, Convert.ToDouble(dataGridViewX7.Rows[idx].Cells[2].Value), true);
+ break;
}
}
}
@@ -4743,29 +4405,26 @@
GSOGeoPolyline3D line = f.Geometry as GSOGeoPolyline3D;
if (line == null) continue;
GSOPipeLineStyle3D style = line.Style as GSOPipeLineStyle3D;
- if (style == null) continue;
- if (line.PartCount > 0)
+ if (style == null || line.PartCount <= 0) continue;
+ GSOPoint3ds pts = line[0];
+ GSOPoint3d pt = new GSOPoint3d();
+ for (int m = 0; m < pts.Count; m++)
{
- GSOPoint3ds pts = line[0];
- GSOPoint3d pt = new GSOPoint3d();
- for (int m = 0; m < pts.Count; m++)
+ if (Math.Abs(pts[m].Z + (style.Radius)) < Convert.ToDouble(textBoxX3.Text.Trim()))
{
- if (Math.Abs(pts[m].Z + (style.Radius)) < Convert.ToDouble(textBoxX3.Text.Trim()))
- {
- f.HighLight = true;
- int idx = dataGridViewX7.Rows.Add();
- dataGridViewX7.Rows[idx].Tag = f;
- dataGridViewX7.Rows[idx].Cells[0].Value = layer.Caption;
- dataGridViewX7.Rows[idx].Cells[1].Value = featureName;
- dataGridViewX7.Rows[idx].Cells[2].Value = Math.Abs((pts[m].Z + (style.Radius))).ToString("0.00");
+ f.HighLight = true;
+ int idx = dataGridViewX7.Rows.Add();
+ dataGridViewX7.Rows[idx].Tag = f;
+ dataGridViewX7.Rows[idx].Cells[0].Value = layer.Caption;
+ dataGridViewX7.Rows[idx].Cells[1].Value = featureName;
+ dataGridViewX7.Rows[idx].Cells[2].Value = Math.Abs((pts[m].Z + (style.Radius))).ToString("0.00");
- pt.X = pts[m].X;
- pt.Y = pts[m].Y;
- pt.Z = 0;
- markerPosition = LabelVerticalDistance(layerTemp, pts[m], pt, Convert.ToDouble(dataGridViewX7.Rows[idx].Cells[2].Value), true);
+ pt.X = pts[m].X;
+ pt.Y = pts[m].Y;
+ pt.Z = 0;
+ markerPosition = LabelVerticalDistance(layerTemp, pts[m], pt, Convert.ToDouble(dataGridViewX7.Rows[idx].Cells[2].Value), true);
- break;
- }
+ break;
}
}
}
@@ -4789,29 +4448,23 @@
///
private void dataGridViewX7_MouseDoubleClick(object sender, MouseEventArgs e)
{
- if (e.Button == MouseButtons.Left)
+ if (e.Button != MouseButtons.Left) return;
+ DataGridView.HitTestInfo hittestinfo = dataGridViewX7.HitTest(e.X, e.Y);
+ if (hittestinfo.RowIndex <= -1) return;
+ GSOFeature rowFeature = dataGridViewX7.Rows[hittestinfo.RowIndex].Tag as GSOFeature;
+ if (rowFeature == null) return;
+ if (rowFeature.Geometry != null && rowFeature.Geometry.Type == EnumGeometryType.GeoPolyline3D)
{
- DataGridView.HitTestInfo hittestinfo = dataGridViewX7.HitTest(e.X, e.Y);
- if (hittestinfo.RowIndex > -1)
- {
- GSOFeature rowFeature = dataGridViewX7.Rows[hittestinfo.RowIndex].Tag as GSOFeature;
- if (rowFeature != null)
- {
- if (rowFeature.Geometry != null && rowFeature.Geometry.Type == EnumGeometryType.GeoPolyline3D)
- {
- GSOGeoPolyline3D line = rowFeature.Geometry as GSOGeoPolyline3D;
- double length = line.GetSpaceLength(true, 6378137);
- GSOGeoPolyline3D lineLine = line.GetSegment(0, length / 2);
- GSOPoint3d point3d = lineLine[lineLine.PartCount - 1][lineLine[lineLine.PartCount - 1].Count - 1];
+ GSOGeoPolyline3D line = rowFeature.Geometry as GSOGeoPolyline3D;
+ double length = line.GetSpaceLength(true, 6378137);
+ GSOGeoPolyline3D lineLine = line.GetSegment(0, length / 2);
+ GSOPoint3d point3d = lineLine[lineLine.PartCount - 1][lineLine[lineLine.PartCount - 1].Count - 1];
- globeControl1.Globe.JumpToPosition(point3d, EnumAltitudeMode.Absolute, 5);
- }
- else
- {
- globeControl1.Globe.JumpToFeature(rowFeature, 5);
- }
- }
- }
+ globeControl1.Globe.JumpToPosition(point3d, EnumAltitudeMode.Absolute, 5);
+ }
+ else
+ {
+ globeControl1.Globe.JumpToFeature(rowFeature, 5);
}
}
///
@@ -4972,85 +4625,83 @@
///
private void ExportExcel(string type, DataGridView _dataGridView, ListBox _listBox)
{
- if (_dataGridView.Rows.Count > 0)
+ if (_dataGridView.Rows.Count <= 0) return;
+ SaveFileDialog dlg = new SaveFileDialog();
+ dlg.Filter = "Excel files (*.xls)|*.xls";
+ dlg.FilterIndex = 0;
+ dlg.RestoreDirectory = true;
+ //dlg.CreatePrompt = true;
+ dlg.Title = "保存为Excel文件";
+ dlg.FileName = type + "-" + DateTime.Now.ToString("yyyyMMdd") + ".xls";
+ if (dlg.ShowDialog() == DialogResult.OK)
{
- SaveFileDialog dlg = new SaveFileDialog();
- dlg.Filter = "Excel files (*.xls)|*.xls";
- dlg.FilterIndex = 0;
- dlg.RestoreDirectory = true;
- //dlg.CreatePrompt = true;
- dlg.Title = "保存为Excel文件";
- dlg.FileName = type + "-" + DateTime.Now.ToString("yyyyMMdd") + ".xls";
- if (dlg.ShowDialog() == DialogResult.OK)
+ Stream myStream;
+ myStream = dlg.OpenFile();
+ StreamWriter sw = new StreamWriter(myStream, Encoding.GetEncoding(-0));
+ string columnTitle = "";
+ try
{
- Stream myStream;
- myStream = dlg.OpenFile();
- StreamWriter sw = new StreamWriter(myStream, Encoding.GetEncoding(-0));
- string columnTitle = "";
- try
+ if (_listBox != null)
{
- if (_listBox != null)
+ string strList = "";
+ for (int i = 0; i < _listBox.Items.Count; i++)
{
- string strList = "";
- for (int i = 0; i < _listBox.Items.Count; i++)
- {
- strList += _listBox.Items[i] + @"/";
- }
- sw.WriteLine("内容:" + type + " 日期:" + DateTime.Now.ToString("yyyy-MM-dd") + " 结果:" + strList);
+ strList += _listBox.Items[i] + @"/";
}
- else
+ sw.WriteLine("内容:" + type + " 日期:" + DateTime.Now.ToString("yyyy-MM-dd") + " 结果:" + strList);
+ }
+ else
+ {
+ sw.WriteLine("内容:" + type + " 日期:" + DateTime.Now.ToString("yyyy-MM-dd"));
+ }
+ //写入列标题
+ for (int i = 0; i < _dataGridView.ColumnCount; i++)
+ {
+ if (i > 0)
{
- sw.WriteLine("内容:" + type + " 日期:" + DateTime.Now.ToString("yyyy-MM-dd"));
+ columnTitle += "\t";
}
- //写入列标题
- for (int i = 0; i < _dataGridView.ColumnCount; i++)
- {
- if (i > 0)
- {
- columnTitle += "\t";
- }
- columnTitle += _dataGridView.Columns[i].HeaderText;
- }
- sw.WriteLine(columnTitle);
+ columnTitle += _dataGridView.Columns[i].HeaderText;
+ }
+ sw.WriteLine(columnTitle);
- //写入列内容
- for (int j = 0; j < _dataGridView.Rows.Count; j++)
+ //写入列内容
+ for (int j = 0; j < _dataGridView.Rows.Count; j++)
+ {
+ string columnValue = "";
+ for (int k = 0; k < _dataGridView.Columns.Count; k++)
{
- string columnValue = "";
- for (int k = 0; k < _dataGridView.Columns.Count; k++)
+ if (k > 0)
{
- if (k > 0)
- {
- columnValue += "\t";
- }
- if (_dataGridView.Rows[j].Cells[k].Value == null)
- {
- columnValue += "";
- }
- else
- {
- columnValue += _dataGridView.Rows[j].Cells[k].Value.ToString().Trim();
- }
+ columnValue += "\t";
}
+ if (_dataGridView.Rows[j].Cells[k].Value == null)
+ {
+ columnValue += "";
+ }
+ else
+ {
+ columnValue += _dataGridView.Rows[j].Cells[k].Value.ToString().Trim();
+ }
+ }
- sw.WriteLine(columnValue);
- }
- sw.Close();
- myStream.Close();
- if (MessageBox.Show("导出Excel文件成功!是否打开?", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
- {
- Process.Start(dlg.FileName);
- }
+ sw.WriteLine(columnValue);
}
- catch (Exception ex)
+ sw.Close();
+ myStream.Close();
+ if (MessageBox.Show("导出Excel文件成功!是否打开?", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
{
- //MessageBox.Show(ex.ToString());
+ Process.Start(dlg.FileName);
}
- finally
- {
- sw.Close();
- myStream.Close();
- }
+ }
+ catch (Exception ex)
+ {
+ //MessageBox.Show(ex.ToString());
+ }
+ finally
+ {
+ sw.Close();
+ myStream.Close();
}
}
}
@@ -5141,24 +4792,22 @@
///
private void comboBoxEx2_SelectedIndexChanged(object sender, EventArgs e)
{
- if (comboBoxEx2.SelectedIndex > -1)
- {
- listBox2.Items.Clear();
- dataGridViewX4.Rows.Clear();
- dataGridViewX5.Rows.Clear();
- GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(comboBoxEx2.SelectedItem.ToString());
- if (layer == null)
- return;
+ if (comboBoxEx2.SelectedIndex <= -1) return;
+ listBox2.Items.Clear();
+ dataGridViewX4.Rows.Clear();
+ dataGridViewX5.Rows.Clear();
+ GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(comboBoxEx2.SelectedItem.ToString());
+ if (layer == null)
+ return;
- GSOFeatureLayer flayer = layer as GSOFeatureLayer;
- GSOFeatureDataset fdataset = flayer.Dataset as GSOFeatureDataset;
- GSOFeatures feats = flayer.GetAllFeatures();
- for (int i = 0; i < feats.Length; i++)
- {
- int idx = dataGridViewX4.Rows.Add();
- dataGridViewX4.Rows[idx].Cells[0].Value = comboBoxEx2.SelectedItem.ToString();
- dataGridViewX4.Rows[idx].Cells[1].Value = feats[i].Name;
- }
+ GSOFeatureLayer flayer = layer as GSOFeatureLayer;
+ GSOFeatureDataset fdataset = flayer.Dataset as GSOFeatureDataset;
+ GSOFeatures feats = flayer.GetAllFeatures();
+ for (int i = 0; i < feats.Length; i++)
+ {
+ int idx = dataGridViewX4.Rows.Add();
+ dataGridViewX4.Rows[idx].Cells[0].Value = comboBoxEx2.SelectedItem.ToString();
+ dataGridViewX4.Rows[idx].Cells[1].Value = feats[i].Name;
}
}
///
@@ -5343,7 +4992,7 @@
if (selectedFeature != null)
{
selectState = 1;
- VerticalDistanceAnalysis("间距分析", selectedFeature, m_PipelineLayerNames, dVerticalJingJuBiaoZhun, dHorizontalJingJuBiaoZhun);//分析
+ VerticalDistanceAnalysis("间距分析", selectedFeature, Utility.m_PipelineLayerNames, dVerticalJingJuBiaoZhun, dHorizontalJingJuBiaoZhun);//分析
}
}
}
@@ -5374,16 +5023,16 @@
for (int i = 0; i < feats.Length; i++)
{
selectState = 1;
- VerticalDistanceAnalysis("间距分析", feats[i], m_PipelineLayerNames, dVerticalJingJuBiaoZhun, dHorizontalJingJuBiaoZhun);//分析
+ VerticalDistanceAnalysis("间距分析", feats[i], Utility.m_PipelineLayerNames, dVerticalJingJuBiaoZhun, dHorizontalJingJuBiaoZhun);//分析
}
}
if (featCount.Count > 0)
{
- for (int i = 0; i < m_PipelineLayerNames.Count; i++)
+ for (int i = 0; i < Utility.m_PipelineLayerNames.Count; i++)
{
- if (featCount.ContainsKey(m_PipelineLayerNames[i]) && featLenth.ContainsKey(m_PipelineLayerNames[i]))
+ if (featCount.ContainsKey(Utility.m_PipelineLayerNames[i]) && featLenth.ContainsKey(Utility.m_PipelineLayerNames[i]))
{
- listBoxStasticsResult.Items.Add(m_PipelineLayerNames[i] + ":" + featCount[m_PipelineLayerNames[i]] + "条,共" + featLenth[m_PipelineLayerNames[i]].ToString("0.00") + "米");
+ listBoxStasticsResult.Items.Add(Utility.m_PipelineLayerNames[i] + ":" + featCount[Utility.m_PipelineLayerNames[i]] + "条,共" + featLenth[Utility.m_PipelineLayerNames[i]].ToString("0.00") + "米");
}
}
}
@@ -5948,24 +5597,20 @@
///
private void addNodeToLayerManagerNode(GSOLayer layer)
{
- if (layer != null)
- {
- GSODataset dataset = layer.Dataset;
- CheckDatasetGeoReference(layer.Dataset, "");
+ if (layer == null) return;
+ GSODataset dataset = layer.Dataset;
+ CheckDatasetGeoReference(layer.Dataset, "");
- TreeNode node = new TreeNode();
- node.Tag = layer;
- node.Text = layer.Dataset.Caption;
- node.ImageIndex = 0;
- node.SelectedImageIndex = 0;
- node.Checked = layer.Visible;
+ TreeNode node = new TreeNode();
+ node.Tag = layer;
+ node.Text = layer.Dataset.Caption;
+ node.ImageIndex = 0;
+ node.SelectedImageIndex = 0;
+ node.Checked = layer.Visible;
- if (!layerManagerNode.Nodes.Contains(node))
- {
- layerManagerNode.Nodes.Insert(0, node);
- layerManagerNode.Expand();
- }
- }
+ if (layerManagerNode.Nodes.Contains(node)) return;
+ layerManagerNode.Nodes.Insert(0, node);
+ layerManagerNode.Expand();
}
///
/// 获取指定图层中最后一个feature对象的名称对应的整数
@@ -6008,31 +5653,29 @@
for (int i = 0; i < markerStrs.Length; i++)
{
GSOLayer markerLayer = globeControl1.Globe.Layers.GetLayerByCaption(markerStrs[i]);
- if (markerLayer != null)
+ if (markerLayer == null) continue;
+ if (markerStrs[i] != layerName)
{
- if (markerStrs[i] != layerName)
+ markerLayer.Visible = false;
+ if (layerMarkerTree.Nodes[0].Nodes.Count > i)
{
- markerLayer.Visible = false;
- if (layerMarkerTree.Nodes[0].Nodes.Count > i)
+ layerMarkerTree.Nodes[0].Nodes[i].Checked = false;
+ }
+ }
+ else
+ {
+ markerLayer.Visible = true;
+ for (int j = 0; j < markerLayer.GetAllFeatures().Length; j++)
+ {
+ GSOFeature markerFeature = markerLayer.GetAt(j);
+ if (markerFeature != null)
{
- layerMarkerTree.Nodes[0].Nodes[i].Checked = false;
+ markerFeature.Visible = false;
}
}
- else
+ if (layerMarkerTree.Nodes[0].Nodes.Count > i)
{
- markerLayer.Visible = true;
- for (int j = 0; j < markerLayer.GetAllFeatures().Length; j++)
- {
- GSOFeature markerFeature = markerLayer.GetAt(j);
- if (markerFeature != null)
- {
- markerFeature.Visible = false;
- }
- }
- if (layerMarkerTree.Nodes[0].Nodes.Count > i)
- {
- layerMarkerTree.Nodes[0].Nodes[i].Checked = true;
- }
+ layerMarkerTree.Nodes[0].Nodes[i].Checked = true;
}
}
}
@@ -6138,15 +5781,12 @@
private void toolStripMenuItem2_Click(object sender, EventArgs e)
{
TreeNode node = contextMenuStrip3.Tag as TreeNode;
+ if (node == null) return;
GSOFeature feature3d = node.Tag as GSOFeature;
- if (node == null)
- return;
- if (feature3d != null)
- {
- feature3d.Delete();
- globeControl1.Globe.Refresh();
- node.Remove();
- }
+ if (feature3d == null) return;
+ feature3d.Delete();
+ globeControl1.Globe.Refresh();
+ node.Remove();
}
///
/// 图层目录树的 节点对应的复选框选中状态改变事件处理
@@ -6213,12 +5853,10 @@
{
TreeNode node = contextMenuStrip2.Tag as TreeNode;
GSOLayer l = globeControl1.Globe.Layers.GetLayerByCaption(node.Text);
- if (l != null)
- {
- l.RemoveAllFeature();
- node.Nodes.Clear();
- globeControl1.Refresh();
- }
+ if (l == null) return;
+ l.RemoveAllFeature();
+ node.Nodes.Clear();
+ globeControl1.Refresh();
}
//定时检查传感器的状态
public Timer timerOfSensor = null;
@@ -6375,7 +6013,7 @@
}
frmShResult = new FrmShResult(dVerticalJingJuBiaoZhun, dHorizontalJingJuBiaoZhun, shlayername, globeControl1,
- m_PipelineLayerNames);
+ Utility.m_PipelineLayerNames);
if (boolfrmShResult) return;
@@ -6482,13 +6120,11 @@
frmModify = new FrmMnModify(globeControl1, shlayername, shresultLists);
- if (boolfrmModify == false)
- {
- frmModify.Owner = this;
- frmModify.Location = new Point(Width - frmModify.Width - 10, Height - frmModify.Height - 50);
- frmModify.Show();
- boolfrmModify = true;
- }
+ if (boolfrmModify != false) return;
+ frmModify.Owner = this;
+ frmModify.Location = new Point(Width - frmModify.Width - 10, Height - frmModify.Height - 50);
+ frmModify.Show();
+ boolfrmModify = true;
}
///
/// 一键审核中调节透明度
@@ -6500,7 +6136,7 @@
LogManager.saveLog(Utility.userName, sliderItem1.Text);
globeControl1.Globe.GroundOpaque = 100 - sliderItem1.Value;
- GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(roadLayerName); //("180fd");
+ GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(Utility.roadLayerName); //("180fd");
if (layer != null)
layer.Opaque = 100 - sliderItem1.Value;
@@ -6516,7 +6152,7 @@
LogManager.saveLog(Utility.userName, sliderItem3.Text);
globeControl1.Globe.GroundOpaque = 100 - sliderItem3.Value;
- GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(roadLayerName); //("180fd");
+ GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(Utility.roadLayerName); //("180fd");
if (layer != null)
layer.Opaque = 100 - sliderItem3.Value;
optiValue = sliderItem3.Value;
@@ -6647,7 +6283,7 @@
{
LogManager.saveLog(Utility.userName, buttonItemSearch9.Text);
- FrmKeywordQuery.ShowForm(globeControl1, m_PipelineLayerNames, InitDataGridViewX1);
+ FrmKeywordQuery.ShowForm(globeControl1, Utility.m_PipelineLayerNames, InitDataGridViewX1);
}
///
/// 编号查询
@@ -6658,7 +6294,7 @@
{
LogManager.saveLog(Utility.userName, buttonItemSearch2.Text);
- FrmCodingQuery.ShowForm(globeControl1, m_PipelineLayerNames, InitDataGridViewX1);
+ FrmCodingQuery.ShowForm(globeControl1, Utility.m_PipelineLayerNames, InitDataGridViewX1);
}
///
/// 坐标查询
@@ -6680,7 +6316,7 @@
{
LogManager.saveLog(Utility.userName, buttonItemSearch10.Text);
- FrmFittingQuery.ShowForm(globeControl1, instrumenLayerNames, InitDataGridViewX1);
+ FrmFittingQuery.ShowForm(globeControl1, Utility.instrumenLayerNames, InitDataGridViewX1);
}
///
/// 管径查询
@@ -6691,7 +6327,7 @@
{
LogManager.saveLog(Utility.userName, buttonItemSearch4.Text);
- FrmDiameterQuery.ShowForm(globeControl1, m_PipelineLayerNames, InitDataGridViewX1);
+ FrmDiameterQuery.ShowForm(globeControl1, Utility.m_PipelineLayerNames, InitDataGridViewX1);
}
///
/// 材质查询
@@ -6702,7 +6338,7 @@
{
LogManager.saveLog(Utility.userName, buttonItemSearch5.Text);
- FrmMaterialSel.ShowForm(globeControl1, m_PipelineLayerNames, InitDataGridViewX1);
+ FrmMaterialSel.ShowForm(globeControl1, Utility.m_PipelineLayerNames, InitDataGridViewX1);
}
///
/// 基本查询
@@ -6751,8 +6387,8 @@
if (feature == null && feature.Geometry == null || (feature.Geometry.Type == EnumGeometryType.GeoPolygon3D
|| feature.Geometry.Type == EnumGeometryType.GeoWater))
return;
- ClassSearchAnalysis.ResultRelationAnalysis(globeControl1, feature, valueLayerNames, workwellLayerNames,
- instrumenLayerNames, pipefittingLayerNames, m_PipelineLayerNames, valueAllowance);
+ ClassSearchAnalysis.ResultRelationAnalysis(globeControl1, feature, Utility.valueLayerNames, Utility.workwellLayerNames,
+ Utility.instrumenLayerNames, Utility.pipefittingLayerNames, Utility.m_PipelineLayerNames, valueAllowance);
}
}
#endregion
@@ -6789,20 +6425,20 @@
// ClearCloseValvesAnalysis();//清除阀门分析
//清除管线间距分析
- if (disFeature != null)
- {
- if (disFeature.ID != 0)
- {
- globeControl1.Globe.MemoryLayer.RemoveFeatureByID(disFeature.ID);
- }
- }
- if (featureDis != null)
- {
- if (featureDis.ID != 0)
- {
- globeControl1.Globe.MemoryLayer.RemoveFeatureByID(featureDis.ID);
- }
- }
+ //if (disFeature != null)
+ //{
+ // if (disFeature.ID != 0)
+ // {
+ // globeControl1.Globe.MemoryLayer.RemoveFeatureByID(disFeature.ID);
+ // }
+ //}
+ //if (featureDis != null)
+ //{
+ // if (featureDis.ID != 0)
+ // {
+ // globeControl1.Globe.MemoryLayer.RemoveFeatureByID(featureDis.ID);
+ // }
+ //}
GSOFeatures feats = globeControl1.Globe.MemoryLayer.GetFeatureByName("粒子要素", true);
if (feats.Length > 0)
@@ -6838,7 +6474,7 @@
clearFeatureHighLight();//取消管线高亮
- GSOLayer layerGround = globeControl1.Globe.Layers.GetLayerByCaption(roadLayerName);//("180fd");
+ GSOLayer layerGround = globeControl1.Globe.Layers.GetLayerByCaption(Utility.roadLayerName);//("180fd");
if (layerGround != null)
{
layerGround.Visible = true;
@@ -6856,7 +6492,7 @@
private void buttonItemTJ1_ALL_Click(object sender, EventArgs e)
{
LogManager.saveLog(Utility.userName, "管线长度统计");
- FrmAllPipelineStatis frm = new FrmAllPipelineStatis(globeControl1, null, InitDataGridViewX1, m_PipelineLayerNames);
+ FrmAllPipelineStatis frm = new FrmAllPipelineStatis(globeControl1, null, InitDataGridViewX1, Utility.m_PipelineLayerNames);
frm.Show(this);
}
///
@@ -6930,7 +6566,7 @@
{
LogManager.saveLog(Utility.userName, "管径分段统计");
- Frmpipediameterstatis.ShowForm(globeControl1, m_PipelineLayerNames, 0);
+ Frmpipediameterstatis.ShowForm(globeControl1, Utility.m_PipelineLayerNames, 0);
}
///
/// 管径分段统计绘制区域统计
@@ -6942,7 +6578,7 @@
LogManager.saveLog(Utility.userName, "管径分段统计");
trackflag = null;
- Frmpipediameterstatis.ShowForm(globeControl1, m_PipelineLayerNames, 1);
+ Frmpipediameterstatis.ShowForm(globeControl1, Utility.m_PipelineLayerNames, 1);
}
///
/// 埋深分段统计全区域统计
@@ -6952,7 +6588,7 @@
private void buttonItemTJ5_ALL_Click(object sender, EventArgs e)
{
LogManager.saveLog(Utility.userName, "埋深分段统计");
- FrmpipeDeepstatis.ShowForm(globeControl1, m_PipelineLayerNames, 0);
+ FrmpipeDeepstatis.ShowForm(globeControl1, Utility.m_PipelineLayerNames, 0);
}
///
/// 埋深分段统计绘制区域统计
@@ -6963,7 +6599,7 @@
{
LogManager.saveLog(Utility.userName, "埋深分段统计");
trackflag = null;
- FrmpipeDeepstatis.ShowForm(globeControl1, m_PipelineLayerNames, 1);
+ FrmpipeDeepstatis.ShowForm(globeControl1, Utility.m_PipelineLayerNames, 1);
}
///
/// 管径分类统计全区域统计
@@ -6974,7 +6610,7 @@
{
LogManager.saveLog(Utility.userName, "管径分类汇总");
- FrmpipeDiametergather.ShowForm(globeControl1, m_PipelineLayerNames, 0);
+ FrmpipeDiametergather.ShowForm(globeControl1, Utility.m_PipelineLayerNames, 0);
}
///
/// 管径分类统计绘制区域统计
@@ -6986,7 +6622,7 @@
LogManager.saveLog(Utility.userName, "管径分类汇总");
trackflag = null;
- FrmpipeDiametergather.ShowForm(globeControl1, m_PipelineLayerNames, 1);
+ FrmpipeDiametergather.ShowForm(globeControl1, Utility.m_PipelineLayerNames, 1);
}
///
/// 材质分类统计全区域统计
@@ -6997,7 +6633,7 @@
{
LogManager.saveLog(Utility.userName, "材质分类汇总");
- FrmpipeMaterialGather.ShowForm(globeControl1, m_PipelineLayerNames, 0);
+ FrmpipeMaterialGather.ShowForm(globeControl1, Utility.m_PipelineLayerNames, 0);
}
///
/// 材质分类统计绘制区域统计
@@ -7009,7 +6645,7 @@
LogManager.saveLog(Utility.userName, "材质分类汇总");
trackflag = null;
- FrmpipeMaterialGather.ShowForm(globeControl1, m_PipelineLayerNames, 1);
+ FrmpipeMaterialGather.ShowForm(globeControl1, Utility.m_PipelineLayerNames, 1);
}
///
/// 附属物分类统计全区域统计
@@ -7020,7 +6656,7 @@
{
LogManager.saveLog(Utility.userName, "附属物分类汇总");
- FrmAccessoriesgather.ShowForm(globeControl1, instrumenLayerNames, 0);
+ FrmAccessoriesgather.ShowForm(globeControl1, Utility.instrumenLayerNames, 0);
}
///
/// 附属物分类统计绘制区域统计
@@ -7032,7 +6668,7 @@
LogManager.saveLog(Utility.userName, "附属物分类汇总");
trackflag = null;
- FrmAccessoriesgather.ShowForm(globeControl1, instrumenLayerNames, 1);
+ FrmAccessoriesgather.ShowForm(globeControl1, Utility.instrumenLayerNames, 1);
}
#region Predaotr,断面分析
///
@@ -7113,7 +6749,7 @@
//日志记录
LogManager.saveLog(Utility.userName, buttonItemFX3_1.Text);
- FrmGenAndFaMenTopu frm = new FrmGenAndFaMenTopu(globeControl1, m_PipelineLayerNames, valueLayerNames);
+ FrmGenAndFaMenTopu frm = new FrmGenAndFaMenTopu(globeControl1, Utility.m_PipelineLayerNames, Utility.valueLayerNames);
frm.Show(this);
}
#region Predator :拓扑分析
@@ -7166,7 +6802,7 @@
//日志记录
LogManager.saveLog(Utility.userName, buttonItemFX3_4.Text);
- FrmFlow frm = new FrmFlow(globeControl1, m_PipelineLayerNames);
+ FrmFlow frm = new FrmFlow(globeControl1, Utility.m_PipelineLayerNames);
frm.Show(this);
}
///
@@ -7369,16 +7005,14 @@
GSOFeature f = null;
GSOLayer layer = null;
globeControl1.Globe.GetSelectObject(i, out f, out layer);
- if (f != null && f.Dataset.Caption == "隧道")
+ if (f == null || f.Dataset.Caption != "隧道") continue;
+ tunnelCount++;
+ f.Delete();
+ if (layer != null)
{
- tunnelCount++;
- f.Delete();
- if (layer != null)
- {
- globeControl1.Globe.AddToEditHistroy(layer, f, EnumEditType.Delete);
- }
- globeControl1.Refresh();
+ globeControl1.Globe.AddToEditHistroy(layer, f, EnumEditType.Delete);
}
+ globeControl1.Refresh();
}
if (tunnelCount == 0)
{
@@ -7620,7 +7254,7 @@
return;
}
GSOGeoPolyline3D selLine = resFeature.Geometry as GSOGeoPolyline3D;
- if (selLine[0].Count <= 1)
+ if (selLine==null||selLine[0].Count <= 1)//wxl增加为空判断,下面方法同理
{
return;
}
@@ -7763,14 +7397,12 @@
LogManager.saveLog(Utility.userName, buttonItemBZ10.Text);
setMarkerLayerUnVisible("红线工具");
GSOLayer l = globeControl1.Globe.Layers.GetLayerByCaption("红线工具");
- if (l != null)
- {
- l.Visible = true;
- globeControl1.Globe.DestLayerFeatureAdd = l;
- l.Editable = true;
- globeControl1.Globe.Action = EnumAction3D.DrawPolygon;
- m_isDrawRedPology = true;
- }
+ if (l == null) return;
+ l.Visible = true;
+ globeControl1.Globe.DestLayerFeatureAdd = l;
+ l.Editable = true;
+ globeControl1.Globe.Action = EnumAction3D.DrawPolygon;
+ m_isDrawRedPology = true;
}
///
/// 标注管理
@@ -8100,7 +7732,7 @@
{
//日志记录
LogManager.saveLog(Utility.userName, buttonItemSH5.Text);
- FrmCityServerLineAnalysis frm = new FrmCityServerLineAnalysis(globeControl1, m_PipelineLayerNames);
+ FrmCityServerLineAnalysis frm = new FrmCityServerLineAnalysis(globeControl1, Utility.m_PipelineLayerNames);
frm.Show(this);
}
@@ -8287,7 +7919,7 @@
//日志记录
LogManager.saveLog(Utility.userName, buttonItemBJ1.Text);
- frmPipeSetEdit frm = new frmPipeSetEdit(globeControl1, m_PipelineLayerNames);
+ frmPipeSetEdit frm = new frmPipeSetEdit(globeControl1, Utility.m_PipelineLayerNames);
if (frm.ShowDialog() == DialogResult.OK)
{
m_AddPipeLine = true;
@@ -8306,7 +7938,7 @@
//日志记录
LogManager.saveLog(Utility.userName, buttonItemBJ2.Text);
- FrmSetGoalLayer frm = new FrmSetGoalLayer(globeControl1, instrumenLayerNames, "附属物");
+ FrmSetGoalLayer frm = new FrmSetGoalLayer(globeControl1, Utility.instrumenLayerNames, "附属物");
if (frm.ShowDialog() == DialogResult.OK)
{
GSOLayer featureAddLayer = TreeNodeFeatureLayer();
@@ -8327,15 +7959,13 @@
//日志记录
LogManager.saveLog(Utility.userName, buttonItemBJ3.Text);
- FrmSetGoalLayer frm = new FrmSetGoalLayer(globeControl1, pipefittingLayerNames, "管点");
+ FrmSetGoalLayer frm = new FrmSetGoalLayer(globeControl1, Utility.pipefittingLayerNames, "管点");
if (frm.ShowDialog() == DialogResult.OK)
{
GSOLayer featureAddLayer = TreeNodeFeatureLayer();
- if (featureAddLayer != null)
- {
- FrmAddPipeFitting dlg = new FrmAddPipeFitting(globeControl1, featureAddLayer);
- dlg.Show(this);
- }
+ if (featureAddLayer == null) return;
+ FrmAddPipeFitting dlg = new FrmAddPipeFitting(globeControl1, featureAddLayer);
+ dlg.Show(this);
}
}
///
@@ -8516,50 +8146,50 @@
#region 导出成dxf格式
List listVectorNames = new List();
- for (int i = 0; i < m_PipelineLayerNames.Count; i++)
+ for (int i = 0; i < Utility.m_PipelineLayerNames.Count; i++)
{
- if (m_PipelineLayerNames[i] == "移动" || m_PipelineLayerNames[i] == "联通"
- || m_PipelineLayerNames[i] == "电信" || m_PipelineLayerNames[i] == "共通"
- || m_PipelineLayerNames[i] == "有线电视" || m_PipelineLayerNames[i] == "交通信号"
- || m_PipelineLayerNames[i] == "供电")
+ if (Utility.m_PipelineLayerNames[i] == "移动" || Utility.m_PipelineLayerNames[i] == "联通"
+ || Utility.m_PipelineLayerNames[i] == "电信" || Utility.m_PipelineLayerNames[i] == "共通"
+ || Utility.m_PipelineLayerNames[i] == "有线电视" || Utility.m_PipelineLayerNames[i] == "交通信号"
+ || Utility.m_PipelineLayerNames[i] == "供电")
{
continue;
}
- if (listVectorNames.Contains(m_PipelineLayerNames[i]) == false)
+ if (!listVectorNames.Contains(Utility.m_PipelineLayerNames[i]))
{
- listVectorNames.Add(m_PipelineLayerNames[i]);
+ listVectorNames.Add(Utility.m_PipelineLayerNames[i]);
}
}
- for (int i = 0; i < valueLayerNames.Count; i++)
+ for (int i = 0; i < Utility.valueLayerNames.Count; i++)
{
- if (listVectorNames.Contains(valueLayerNames[i]) == false)
+ if (!listVectorNames.Contains(Utility.valueLayerNames[i]))
{
- listVectorNames.Add(valueLayerNames[i]);
+ listVectorNames.Add(Utility.valueLayerNames[i]);
}
}
- for (int i = 0; i < workwellLayerNames.Count; i++)
+ for (int i = 0; i < Utility.workwellLayerNames.Count; i++)
{
- if (listVectorNames.Contains(workwellLayerNames[i]) == false)
+ if (!listVectorNames.Contains(Utility.workwellLayerNames[i]))
{
- listVectorNames.Add(workwellLayerNames[i]);
+ listVectorNames.Add(Utility.workwellLayerNames[i]);
}
}
- for (int i = 0; i < instrumenLayerNames.Count; i++)
+ for (int i = 0; i < Utility.instrumenLayerNames.Count; i++)
{
- if (listVectorNames.Contains(instrumenLayerNames[i]) == false)
+ if (!listVectorNames.Contains(Utility.instrumenLayerNames[i]))
{
- listVectorNames.Add(instrumenLayerNames[i]);
+ listVectorNames.Add(Utility.instrumenLayerNames[i]);
}
}
- for (int i = 0; i < pipefittingLayerNames.Count; i++)
+ for (int i = 0; i < Utility.pipefittingLayerNames.Count; i++)
{
- if (listVectorNames.Contains(pipefittingLayerNames[i]) == false)
+ if (!listVectorNames.Contains(Utility.pipefittingLayerNames[i]))
{
- listVectorNames.Add(pipefittingLayerNames[i]);
+ listVectorNames.Add(Utility.pipefittingLayerNames[i]);
}
}
- FrmExportCADS frm = new FrmExportCADS(globeControl1, listVectorNames);//m_PipelineLayerNames);
+ FrmExportCADS frm = new FrmExportCADS(globeControl1, listVectorNames);//Utility.m_PipelineLayerNames);
frm.ShowDialog();
#endregion
}
@@ -8574,39 +8204,39 @@
LogManager.saveLog(Utility.userName, buttonItemBJ10_2.Text);
List listVectorNames = new List();
- for (int i = 0; i < m_PipelineLayerNames.Count; i++)
+ for (int i = 0; i < Utility.m_PipelineLayerNames.Count; i++)
{
- if (listVectorNames.Contains(m_PipelineLayerNames[i]) == false)
+ if (!listVectorNames.Contains(Utility.m_PipelineLayerNames[i]))
{
- listVectorNames.Add(m_PipelineLayerNames[i]);
+ listVectorNames.Add(Utility.m_PipelineLayerNames[i]);
}
}
- for (int i = 0; i < valueLayerNames.Count; i++)
+ for (int i = 0; i < Utility.valueLayerNames.Count; i++)
{
- if (listVectorNames.Contains(valueLayerNames[i]) == false)
+ if (!listVectorNames.Contains(Utility.valueLayerNames[i]))
{
- listVectorNames.Add(valueLayerNames[i]);
+ listVectorNames.Add(Utility.valueLayerNames[i]);
}
}
- for (int i = 0; i < workwellLayerNames.Count; i++)
+ for (int i = 0; i < Utility.workwellLayerNames.Count; i++)
{
- if (listVectorNames.Contains(workwellLayerNames[i]) == false)
+ if (!listVectorNames.Contains(Utility.workwellLayerNames[i]))
{
- listVectorNames.Add(workwellLayerNames[i]);
+ listVectorNames.Add(Utility.workwellLayerNames[i]);
}
}
- for (int i = 0; i < instrumenLayerNames.Count; i++)
+ for (int i = 0; i < Utility.instrumenLayerNames.Count; i++)
{
- if (listVectorNames.Contains(instrumenLayerNames[i]) == false)
+ if (!listVectorNames.Contains(Utility.instrumenLayerNames[i]))
{
- listVectorNames.Add(instrumenLayerNames[i]);
+ listVectorNames.Add(Utility.instrumenLayerNames[i]);
}
}
- for (int i = 0; i < pipefittingLayerNames.Count; i++)
+ for (int i = 0; i < Utility.pipefittingLayerNames.Count; i++)
{
- if (listVectorNames.Contains(pipefittingLayerNames[i]) == false)
+ if (!listVectorNames.Contains(Utility.pipefittingLayerNames[i]))
{
- listVectorNames.Add(pipefittingLayerNames[i]);
+ listVectorNames.Add(Utility.pipefittingLayerNames[i]);
}
}
FrmExportVector frm = new FrmExportVector(globeControl1, listVectorNames);
@@ -8668,9 +8298,9 @@
List listPipelineLayers = new List();
GSOLayer layer = null;
- for (int i = 0; i < m_PipelineLayerNames.Count; i++)
+ for (int i = 0; i < Utility.m_PipelineLayerNames.Count; i++)
{
- layer = globeControl1.Globe.Layers.GetLayerByCaption(m_PipelineLayerNames[i]);
+ layer = globeControl1.Globe.Layers.GetLayerByCaption(Utility.m_PipelineLayerNames[i]);
if (layer == null) continue;
listPipelineLayers.Add(layer);
}
@@ -8737,7 +8367,7 @@
LogManager.saveLog(Utility.userName, sliderItem2.Text);
globeControl1.Globe.GroundOpaque = 100 - sliderItem2.Value;
- GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(roadLayerName);//("180fd");
+ GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(Utility.roadLayerName);//("180fd");
if (layer != null)
{
layer.Opaque = 100 - sliderItem2.Value;
@@ -8876,7 +8506,7 @@
globeControl1.Globe.GroundOpaque = 100 - sliderGroundTransSet1.Value;
- layer = globeControl1.Globe.Layers.GetLayerByCaption(roadLayerName);//("180fd");
+ layer = globeControl1.Globe.Layers.GetLayerByCaption(Utility.roadLayerName);//("180fd");
if (layer != null)
{
layer.Opaque = 100 - sliderGroundTransSet1.Value;
@@ -9145,7 +8775,7 @@
LogManager.saveLog(Utility.userName, buttonItem8.Text);
int width = Width;
- FrmCompareFeature.ShowForm(globeControl1, globeControl2, layerTemp, layerTemp2, m_PipelineLayerNames, sgPipeLayersNames, width);
+ FrmCompareFeature.ShowForm(globeControl1, globeControl2, layerTemp, layerTemp2, Utility.m_PipelineLayerNames, Utility.sgPipeLayersNames, width);
}
///
/// 红线审核导出图片
diff --git a/MarkInfo.cs b/MarkInfo.cs
index 44e630b..68ab5bd 100644
--- a/MarkInfo.cs
+++ b/MarkInfo.cs
@@ -182,7 +182,7 @@
public void showMarker(List marks, GSOLayer layer)
{
layer.Visible = true;
- MessageBox.Show(layer.GetAllFeatures().Length + "");
+ //MessageBox.Show(layer.GetAllFeatures().Length + "");
foreach(MarkInfo mark in marks)
{
addLabel(mark,layer);
diff --git a/NewFunction/FrmExportVector.cs b/NewFunction/FrmExportVector.cs
index 9e68b54..c85a9b9 100644
--- a/NewFunction/FrmExportVector.cs
+++ b/NewFunction/FrmExportVector.cs
@@ -10,8 +10,8 @@
{
public partial class FrmExportVector :Office2007Form
{
- GSOGlobeControl globeControl1;
- List pipeLineNames = new List();
+ private GSOGlobeControl globeControl1;
+ private List pipeLineNames;
public FrmExportVector(GSOGlobeControl globeControl, List listPipelineNames)
{
InitializeComponent();
diff --git a/Utility.cs b/Utility.cs
index add8556..d6b89cd 100644
--- a/Utility.cs
+++ b/Utility.cs
@@ -74,6 +74,23 @@
public static string ghdbpwd;
public static List locationList;
+ public static string filename = Application.StartupPath + "\\Config.xml";
+ public static string filenameSensor = Application.StartupPath + "\\sensorConfig.xml";
+ public static string filenamePipelineType = Application.StartupPath + "\\PipelineType.xml";
+ public static string filenameDbconfig = Application.StartupPath + "\\databaseConfig.xml";
+ public static string filenameLocation = Application.StartupPath + "\\Location.xml";
+ #region wxl 从MainFrm重构来,读取一遍config.xml
+ public static List m_PipelineLayerNames = new List();//线图层名称
+ public static List workwellLayerNames = new List();//工井图层名称
+ public static List valueLayerNames = new List();//阀门图层名称
+ public static List instrumenLayerNames = new List();//附属物图层名称
+ public static List pipefittingLayerNames = new List();//管件图层名称
+ public static List sgPipeLayersNames = new List();//施工管线图层名称
+
+ public static Dictionary dictionaryNetLayerNameAndCaption = new Dictionary();
+
+ public static string roadLayerName = "";
+ #endregion wxl
public static void SetBallons(GSOBalloon featureTooltip, GSOBalloonEx balloonEx)
{
featureTooltip.CacheFilePath = Application.StartupPath + "/GeoScene/Globe/Temp";
@@ -102,19 +119,19 @@
balloonEx.SetColorBkType(EnumBkColorTypeEx.SKY);
}
- public static GSOFeature FindFeatureByUserID(GSOFeatureDataset featdataset, string fieldname, string value)
- {
- GSOFeatures feats = featdataset.GetAllFeatures();
- for (int i = 0; i < feats.Length; i++)
- {
- GSOFeature feat = feats[i];
- if (feat.GetFieldAsString(fieldname) == value)
- {
- return feat;
- }
- }
- return null;
- }
+ //public static GSOFeature FindFeatureByUserID(GSOFeatureDataset featdataset, string fieldname, string value)
+ //{
+ // GSOFeatures feats = featdataset.GetAllFeatures();
+ // for (int i = 0; i < feats.Length; i++)
+ // {
+ // GSOFeature feat = feats[i];
+ // if (feat.GetFieldAsString(fieldname) == value)
+ // {
+ // return feat;
+ // }
+ // }
+ // return null;
+ //}
public static GSOPoint2d XYZ_2_Latlon(double x, double y)
{
@@ -156,7 +173,7 @@
{
ret.AppendFormat("{0:X2}", b);
}
- ret.ToString();
+ //ret.ToString();
return ret.ToString();
}
//
@@ -195,11 +212,7 @@
return features;
}
- public static string filename = Application.StartupPath + "\\Config.xml";
- public static string filenameSensor = Application.StartupPath + "\\sensorConfig.xml";
- public static string filenamePipelineType = Application.StartupPath + "\\PipelineType.xml";
- public static string filenameDbconfig = Application.StartupPath + "\\databaseConfig.xml";
- public static string filenameLocation = Application.StartupPath + "\\Location.xml";
+
//程序启动的时候读取配置文件
public static void SetParams()
{
@@ -251,19 +264,54 @@
}
else if (XmlReader.Name == "layerchild")
{
- LayerChild child = new LayerChild();
- child.attriLabel = XmlReader["label"].Trim();
- child.attriLayer = XmlReader["layer"].Trim();
- child.attriType = XmlReader["type"].Trim();
- LayerChilds.Add(child);
- LayerLabels.Add(XmlReader["label"].Trim());
- LayerNames.Add(XmlReader["layer"].Trim());
+ var layername = XmlReader["layer"].Trim();
+ var label = XmlReader["label"].Trim();
+ var type = XmlReader["type"].Trim();
- string layername = XmlReader["layer"].Trim();
+ LayerChild child = new LayerChild();
+ child.attriLabel = label;
+ child.attriLayer =layername;
+ child.attriType = type;
+ LayerChilds.Add(child);
+ LayerLabels.Add(label);
+ LayerNames.Add(layername);
+
+ dictionaryNetLayerNameAndCaption.Add(layername, label);
+
if (layername.EndsWith("管线"))
{
LayerNamesList.Add(layername.Substring(0, layername.Length - 2));
}
+ if (!type.Equals("db"))
+ {
+ if (XmlReader["isRoad"] != null)
+ {
+ roadLayerName = label;
+ }
+ }else if (XmlReader["isPipeLine"] != null)
+ {
+ m_PipelineLayerNames.Add(label);
+ }
+ else if (XmlReader["isWorkWell"] != null)
+ {
+ workwellLayerNames.Add(label);
+ }
+ else if (XmlReader["isValve"] != null)
+ {
+ valueLayerNames.Add(label);
+ }
+ else if (XmlReader["isAccess"] != null)
+ {
+ instrumenLayerNames.Add(label);
+ }
+ else if (XmlReader["isCharacter"] != null)
+ {
+ pipefittingLayerNames.Add(label);
+ }
+ else if (XmlReader["isSgData"] != null)
+ {
+ sgPipeLayersNames.Add(label);
+ }
}
else if (XmlReader.Name == "Terrain")
@@ -591,41 +639,37 @@
}
*/
- ////根据图层中的对象特征来划分内容
- public static string getCodeByName(string name)
- {
- string code = "";
- if (listPipelineType != null)
- {
- List list = listPipelineType;
+ //////根据图层中的对象特征来划分内容
+ //public static string getCodeByName(string name)
+ //{
+ // string code = "";
+ // if (listPipelineType != null)
+ // {
+ // List list = listPipelineType;
- for (int i = 0; i < list.Count; i++)
- {
- PipelineType pipelineType = listPipelineType[i];
- if (name == pipelineType.name)
- {
- code = pipelineType.code;
- break;
- }
- }
- }
- return code;
- }
+ // for (int i = 0; i < list.Count; i++)
+ // {
+ // PipelineType pipelineType = listPipelineType[i];
+ // if (name == pipelineType.name)
+ // {
+ // code = pipelineType.code;
+ // break;
+ // }
+ // }
+ // }
+ // return code;
+ //}
//根据附属物图层名字得到里面含有的附属物
public static string[] getAccStrsByLayer(string layername)
{
string[] accStrs = null;
string sql = "select 附属物名称 from " + layername + " group by 附属物名称";
- //DataTable table = OledbHelper.QueryTable(sql);
DataSet dataset = OledbHelper.getDataSet(sql, layername);
- if (dataset != null)
+ if (dataset == null) return null;
+ accStrs = new string[dataset.Tables[0].Rows.Count];
+ for (int i = 0; i < dataset.Tables[0].Rows.Count; i++)
{
- accStrs = new string[dataset.Tables[0].Rows.Count];
- for (int i = 0; i < dataset.Tables[0].Rows.Count; i++)
- {
- accStrs[i] = dataset.Tables[0].Rows[i][0].ToString();
- }
- return accStrs;
+ accStrs[i] = dataset.Tables[0].Rows[i][0].ToString();
}
return accStrs;
}
diff --git a/bin/x86/Debug/Cyberpipe.exe b/bin/x86/Debug/Cyberpipe.exe
index 8ed566e..b41a66f 100644
--- a/bin/x86/Debug/Cyberpipe.exe
+++ b/bin/x86/Debug/Cyberpipe.exe
Binary files differ
diff --git a/Cyberpipe.csproj b/Cyberpipe.csproj
index 6e90a6e..8f4424d 100644
--- a/Cyberpipe.csproj
+++ b/Cyberpipe.csproj
@@ -187,11 +187,6 @@
False
bin\x86\Debug\WHC.Pager.WinControl.dll
-
- False
- .exe
- bin\x86\Debug\WinFormsExtendedViewExample.exe
-
False
bin\x86\Debug\WW.dll
diff --git a/Cyberpipe.suo b/Cyberpipe.suo
index 0a403c8..eac4ecb 100644
--- a/Cyberpipe.suo
+++ b/Cyberpipe.suo
Binary files differ
diff --git a/MainFrm.cs b/MainFrm.cs
index 6e94648..7c574c1 100644
--- a/MainFrm.cs
+++ b/MainFrm.cs
@@ -27,7 +27,6 @@
public partial class MainFrm : Office2007Form
{
TreeNode layerManagerNode;
- TreeNode myPlaceNode = null;
bool m_bFullScreen;
GSOGlobeControl globeControl1;
@@ -45,24 +44,14 @@
GSOLayer layerTemp;
GSOLayer layerTemp2;
- FrmShResult frmShResult = null;
FrmRedlineResult frmredResult = null;
FrmMnModify frmModify;
public bool frmRedlineResult = false;
public bool boolfrmShResult;
public bool boolfrmModify;
- List m_PipelineLayerNames = new List();//线图层名称
- List workwellLayerNames = new List();//工井图层名称
- List valueLayerNames = new List();//阀门图层名称
- List instrumenLayerNames = new List();//附属物图层名称
- List pipefittingLayerNames = new List();//管件图层名称
- List sgPipeLayersNames = new List();//施工管线图层名称
- string roadLayerName = "";
public static string m_CurrentQueryLayer;//定义当前查询的图层
//定位和闪烁初始化定义
- int count = 0;
- private string flashflag = "single";
public bool m_AddPipeLine;//bool添加管线
bool m_isDrawTunnel;//bool创建隧道
@@ -71,10 +60,6 @@
private string trackflag;//定义阀门查询个数
- //管线间距分析
- private GSOFeature disFeature = new GSOFeature();
- private GSOFeature featureDis = new GSOFeature();
-
//记录沿线飞行设置
//int m_nFlyMode = 2;
double m_dFlyAboveLine = 1;
@@ -86,7 +71,7 @@
Boolean m_bDigPitByDepth = true;
//选择管线
int selectState;
- private OracleConnection connBackup = null;
+ //private OracleConnection connBackup = null;
//数据集合
public static GSODataSource ds;
@@ -182,7 +167,7 @@
RigthMenuSet();
MenuSet();
-
+
}
///
/// 右屏中添加管纵图片
@@ -906,13 +891,13 @@
comboBoxEx3.Items.Clear();
comboBoxEx4.Items.Clear();
comboBoxLayer.Items.Clear();
- for (int i = 0; i < m_PipelineLayerNames.Count; i++)
+ foreach (string t1 in Utility.m_PipelineLayerNames)
{
- comboBoxEx1.Items.Add(m_PipelineLayerNames[i]);
- comboBoxEx2.Items.Add(m_PipelineLayerNames[i]);
- comboBoxEx3.Items.Add(m_PipelineLayerNames[i]);
- comboBoxEx4.Items.Add(m_PipelineLayerNames[i]);
- comboBoxLayer.Items.Add(m_PipelineLayerNames[i]);
+ comboBoxEx1.Items.Add(t1);
+ comboBoxEx2.Items.Add(t1);
+ comboBoxEx3.Items.Add(t1);
+ comboBoxEx4.Items.Add(t1);
+ comboBoxLayer.Items.Add(t1);
}
splitContainer1.Panel2Collapsed = true;
@@ -1132,7 +1117,7 @@
}
- delegate void LoadDataForGlobalControl();
+ //delegate void LoadDataForGlobalControl();
private void connectServer()
{
@@ -1142,19 +1127,15 @@
// 勾选实测图层
foreach (TreeNode tn in layerTree.Nodes)
{
- if (tn.Nodes.Count > 0)
+ if (tn.Nodes.Count <= 0) continue;
+ if (tn.Text != "实测数据") continue;
+ tn.Checked = true;
+ foreach (TreeNode tnChild in tn.Nodes)
{
- if (tn.Text == "实测数据")
+ tnChild.Checked = true;
+ foreach (TreeNode tnGrandChild in tnChild.Nodes)
{
- tn.Checked = true;
- foreach (TreeNode tnChild in tn.Nodes)
- {
- tnChild.Checked = true;
- foreach (TreeNode tnGrandChild in tnChild.Nodes)
- {
- tnGrandChild.Checked = true;
- }
- }
+ tnGrandChild.Checked = true;
}
}
}
@@ -1174,7 +1155,7 @@
for (int j = 0; j < Utility.dataSource.DatasetCount; j++)
{
GSODataset dataset = Utility.dataSource.GetDatasetAt(j);
- if (dataset != null && dictionaryNetLayerNameAndCaption.ContainsKey(dataset.Caption))
+ if (dataset != null && Utility.dictionaryNetLayerNameAndCaption.ContainsKey(dataset.Caption))
{
dataset.Caption = dataset.Name;
globeControl1.Globe.Layers.Add(dataset);
@@ -1191,7 +1172,7 @@
for (int j = 0; j < ghDS.DatasetCount; j++)
{
GSODataset dataset = ghDS.GetDatasetAt(j);
- if (dataset != null && dictionaryNetLayerNameAndCaption.ContainsKey(dataset.Caption))
+ if (dataset != null && Utility.dictionaryNetLayerNameAndCaption.ContainsKey(dataset.Caption))
{
dataset.Caption = dataset.Name;
globeControl1.Globe.Layers.Add(dataset);
@@ -1207,7 +1188,7 @@
for (int m = 0; m < sgDS.DatasetCount; m++)
{
GSODataset dataset = sgDS.GetDatasetAt(m);
- if (dataset != null && !dataset.Caption.Contains("SH") && dictionaryNetLayerNameAndCaption.ContainsKey(dataset.Caption))
+ if (dataset != null && !dataset.Caption.Contains("SH") && Utility.dictionaryNetLayerNameAndCaption.ContainsKey(dataset.Caption))
{
dataset.Caption = dataset.Name;
globeControl1.Globe.Layers.Add(dataset);
@@ -1219,8 +1200,14 @@
}
}
- LoadDataForGlobalControl ss = connectServer;
- ss();
+// LoadDataForGlobalControl ss = connectServer;
+// ss();
+
+ this.Invoke((EventHandler) delegate
+ {
+ connectServer();
+ });
+
}
catch (Exception ex)
@@ -1240,7 +1227,7 @@
layerTree.Nodes.Add(layerManagerNode);
XmlDocument doc = new XmlDocument();
- doc.Load(filename);
+ doc.Load(Utility.filename);
XmlNodeList xmlLayerNodes = doc.SelectNodes("//layer");
foreach (XmlNode xmlLayerNode in xmlLayerNodes)
@@ -1295,70 +1282,6 @@
}
- /**
- * 读取Config.xml文件,初始化以下全局Map
- * m_PipelineLayerNames:管线
- * workwellLayerNames:工井
- * valueLayerNames:阀门
- * instrumenLayerNames:附属物
- * pipefittingLayerNames:特征管点
- * sgPipeLayersNames:施工管线
- **/
- private void initGlobalMap()
- {
- XmlDocument doc = new XmlDocument();
- doc.Load(filename);
- XmlNodeList xmlLayerNodes = doc.SelectNodes("//layerchild");
-
- foreach (XmlNode xmlLayerNode in xmlLayerNodes)
- {
- string layerType = xmlLayerNode.Attributes["type"].Value;
- string layerName1 = xmlLayerNode.Attributes["layer"].Value;
- string layerchildName = xmlLayerNode.Attributes["label"].Value;
-
- dictionaryNetLayerNameAndCaption.Add(layerName1, layerchildName);
-
- if (layerType != "db")
- {
- if (xmlLayerNode.Attributes["isRoad"] != null)
- {
- roadLayerName = layerchildName;
- }
- }
- else if (xmlLayerNode.Attributes["isPipeLine"] != null)
- {
- m_PipelineLayerNames.Add(layerchildName);
- g1layername.Add(layerName1);
- }
- else if (xmlLayerNode.Attributes["isWorkWell"] != null)
- {
- workwellLayerNames.Add(layerchildName);
- g1layername.Add(layerName1);
- }
- else if (xmlLayerNode.Attributes["isValve"] != null)
- {
- valueLayerNames.Add(layerchildName);
- g1layername.Add(layerName1);
- }
- else if (xmlLayerNode.Attributes["isAccess"] != null)
- {
- instrumenLayerNames.Add(layerchildName);
- g1layername.Add(layerName1);
- }
- else if (xmlLayerNode.Attributes["isCharacter"] != null)
- {
- pipefittingLayerNames.Add(layerchildName);
- g1layername.Add(layerName1);
- }
- else if (xmlLayerNode.Attributes["isSgData"] != null)
- {
- sgPipeLayersNames.Add(layerchildName);
- g1layername.Add(layerName1);
- }
-
- }
- }
-
private void initMarkerTree()
{
TreeNode node = new TreeNode();
@@ -1380,32 +1303,29 @@
for (int i = 0; i < markerStrs.Length; i++)
{
- if (File.Exists(Application.StartupPath + "\\标注管理\\" + markerStrs[i] + ".lgd"))
- {
- GSOLayer markerLayer = globeControl1.Globe.Layers.Add(Application.StartupPath + "\\标注管理\\" + markerStrs[i] + ".lgd");
- if (markerLayer != null)
- {
- TreeNode node1 = new TreeNode();
- node1.Text = markerLayer.Caption;
- node1.ImageIndex = 0;
- node1.SelectedImageIndex = 0;
- node1.Checked = markerLayer.Visible;
- node1.Tag = markerLayer;
- layerMarkerTree.Nodes[0].Nodes.Add(node1);
- }
- }
+ if (!File.Exists(Application.StartupPath + "\\标注管理\\" + markerStrs[i] + ".lgd")) continue;
+ GSOLayer markerLayer = globeControl1.Globe.Layers.Add(Application.StartupPath + "\\标注管理\\" + markerStrs[i] + ".lgd");
+ if (markerLayer == null) continue;
+ TreeNode node1 = new TreeNode();
+ node1.Text = markerLayer.Caption;
+ node1.ImageIndex = 0;
+ node1.SelectedImageIndex = 0;
+ node1.Checked = markerLayer.Visible;
+ node1.Tag = markerLayer;
+ layerMarkerTree.Nodes[0].Nodes.Add(node1);
}
}
private void MainFrm_Load(object sender, EventArgs e)
{
initGlobalControl();
- initGlobalMap();
+ //initGlobalMap();
initLayerTree();
initMarkerTree();
initLayout();
loadData();
+
double x = Convert.ToDouble(Utility.Query_Roads["绿岛"].ToString().Split(',')[0]);
double y = Convert.ToDouble(Utility.Query_Roads["绿岛"].ToString().Split(',')[1]);
double z = Convert.ToDouble(Utility.Query_Roads["绿岛"].ToString().Split(',')[2]);
@@ -1415,12 +1335,12 @@
#endregion
- Dictionary dictionaryNetLayerNameAndCaption = new Dictionary();
+ //Dictionary Utility.dictionaryNetLayerNameAndCaption = new Dictionary();
void globeControl1_AfterNetLayerAddEvent(object sender, AfterNetLayerAddEventArgs e)
{
- if (e.Layer != null && dictionaryNetLayerNameAndCaption.ContainsKey(e.Layer.Caption))
+ if (e.Layer != null && Utility.dictionaryNetLayerNameAndCaption.ContainsKey(e.Layer.Caption))
{
- e.Layer.Caption = dictionaryNetLayerNameAndCaption[e.Layer.Caption];
+ e.Layer.Caption = Utility.dictionaryNetLayerNameAndCaption[e.Layer.Caption];
}
}
@@ -1530,37 +1450,30 @@
///
Boolean CheckDatasetGeoReference(GSODataset dataset, string strDataPath)
{
+
+ if (dataset.GeoReferenceType != EnumGeoReferenceType.Flat) return true;
Boolean bSuccess = false;
- if (dataset.GeoReferenceType == EnumGeoReferenceType.Flat)
- {
- if (MessageBox.Show("数据没有空间参考信息,请设置空间参考信息!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) == DialogResult.OK)
- {
- String strPath = Application.StartupPath + "\\Coordinate Systems";
- OpenFileDialog dlg = new OpenFileDialog();
+ if (MessageBox.Show("数据没有空间参考信息,请设置空间参考信息!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) !=
+ DialogResult.OK) return bSuccess;
+ String strPath = Application.StartupPath + "\\Coordinate Systems";
+ OpenFileDialog dlg = new OpenFileDialog();
- dlg.InitialDirectory = strPath;
- dlg.RestoreDirectory = true;
+ dlg.InitialDirectory = strPath;
+ dlg.RestoreDirectory = true;
- dlg.Filter = "投影文件|*.prj||";
- if (dlg.ShowDialog() == DialogResult.OK)
- {
- string lprjStr = GSODataEngineUtility.ConvertEsriPrjFileToProj4(dlg.FileName);
- string lprjFileContent = "0prj4" + lprjStr + "";
+ dlg.Filter = "投影文件|*.prj||";
+ if (dlg.ShowDialog() != DialogResult.OK) return bSuccess;
+ string lprjStr = GSODataEngineUtility.ConvertEsriPrjFileToProj4(dlg.FileName);
+ string lprjFileContent = "0prj4" + lprjStr +
+ "";
- bSuccess = dataset.LoadProjectionFromESRIFile(dlg.FileName);
+ bSuccess = dataset.LoadProjectionFromESRIFile(dlg.FileName);
- string lprjFileName = strDataPath.Substring(0, strDataPath.LastIndexOf(".")) + ".lprj";
- StreamWriter writer = new StreamWriter(lprjFileName, false);
- writer.Write(lprjFileContent);
- writer.Close();
+ string lprjFileName = strDataPath.Substring(0, strDataPath.LastIndexOf(".")) + ".lprj";
+ StreamWriter writer = new StreamWriter(lprjFileName, false);
+ writer.Write(lprjFileContent);
+ writer.Close();
- }
- }
- }
- else
- {
- return true;
- }
return bSuccess;
}
@@ -1571,49 +1484,47 @@
///
void globeControl1_TrackRectEndEvent(object sender, TrackRectEndEventArgs e)
{
- if (e.Polygon != null)
+ if (e.Polygon == null) return;
+ globeControl1.Globe.TrackRectTool.Clear();
+ globeControl1.ImmediatelyRefresh();
+ globeControl1.SwapBuffer();
+ Point pt1 = new Point(Convert.ToInt32(e.StartPos.X), Convert.ToInt32(e.StartPos.Y));
+ Point pt2 = new Point(Convert.ToInt32(e.EndPos.X), Convert.ToInt32(e.EndPos.Y));
+
+ int mapWidth = 0;
+ int mapHeight = 0;
+ Point pt = getUpperLeftPoint(pt1, pt2, out mapWidth, out mapHeight);
+ int rightBottomX = pt.X + mapWidth;
+ int rightBottomY = pt.Y + mapHeight;
+ Image myImg = new Bitmap(mapWidth, mapHeight);
+ Graphics g = Graphics.FromImage(myImg);
+ g.CopyFromScreen(pt, new Point(0, 0), new Size(rightBottomX, rightBottomY));
+
+ SaveFileDialog dlg = new SaveFileDialog();
+ dlg.Filter = "输出JPEG(*.jpg)|*.jpg|输出PNG(*.png)|*.png|输出BMP(*.bmp)|*.bmp|输出BMP(*.gif)|*.gif";
+ if (dlg.ShowDialog() == DialogResult.OK)
{
- globeControl1.Globe.TrackRectTool.Clear();
- globeControl1.ImmediatelyRefresh();
- globeControl1.SwapBuffer();
- Point pt1 = new Point(Convert.ToInt32(e.StartPos.X), Convert.ToInt32(e.StartPos.Y));
- Point pt2 = new Point(Convert.ToInt32(e.EndPos.X), Convert.ToInt32(e.EndPos.Y));
-
- int mapWidth = 0;
- int mapHeight = 0;
- Point pt = getUpperLeftPoint(pt1, pt2, out mapWidth, out mapHeight);
- int rightBottomX = pt.X + mapWidth;
- int rightBottomY = pt.Y + mapHeight;
- Image myImg = new Bitmap(mapWidth, mapHeight);
- Graphics g = Graphics.FromImage(myImg);
- g.CopyFromScreen(pt, new Point(0, 0), new Size(rightBottomX, rightBottomY));
-
- SaveFileDialog dlg = new SaveFileDialog();
- dlg.Filter = "输出JPEG(*.jpg)|*.jpg|输出PNG(*.png)|*.png|输出BMP(*.bmp)|*.bmp|输出BMP(*.gif)|*.gif";
- if (dlg.ShowDialog() == DialogResult.OK)
+ string extension = Path.GetExtension(dlg.FileName);//扩展名
+ switch (extension)
{
- string extension = Path.GetExtension(dlg.FileName);//扩展名
- switch (extension)
- {
- case ".jpg":
- myImg.Save(dlg.FileName, ImageFormat.Jpeg);
- break;
- case ".png":
- myImg.Save(dlg.FileName, ImageFormat.Png);
- break;
- case ".bmp":
- myImg.Save(dlg.FileName, ImageFormat.Bmp);
- break;
- case ".gif":
- myImg.Save(dlg.FileName, ImageFormat.Gif);
- break;
- default:
- break;
- }
+ case ".jpg":
+ myImg.Save(dlg.FileName, ImageFormat.Jpeg);
+ break;
+ case ".png":
+ myImg.Save(dlg.FileName, ImageFormat.Png);
+ break;
+ case ".bmp":
+ myImg.Save(dlg.FileName, ImageFormat.Bmp);
+ break;
+ case ".gif":
+ myImg.Save(dlg.FileName, ImageFormat.Gif);
+ break;
+ default:
+ break;
}
- globeControl1.Globe.Action = EnumAction3D.ActionNull;
- globeControl1.Globe.MouseRoamingEnable = true;
}
+ globeControl1.Globe.Action = EnumAction3D.ActionNull;
+ globeControl1.Globe.MouseRoamingEnable = true;
}
///
/// 定位正北正90度俯视
@@ -1711,18 +1622,12 @@
///
private void CheckControl(TreeViewEventArgs e)
{
- if (e.Action != TreeViewAction.Unknown)
+ if (e.Action == TreeViewAction.Unknown||e.Node == null || Convert.IsDBNull(e.Node)) return;
+ CheckParentNode(e.Node);
+ if (e.Node.Nodes.Count > 0)
{
- if (e.Node != null && !Convert.IsDBNull(e.Node))
- {
- CheckParentNode(e.Node);
- if (e.Node.Nodes.Count > 0)
- {
- CheckAllChildNodes(e.Node, e.Node.Checked);
- }
- }
+ CheckAllChildNodes(e.Node, e.Node.Checked);
}
-
}
///
/// 改变所有子节点的状态
@@ -1747,94 +1652,88 @@
{
bool bChecked = false;
- if (curNode.Parent != null)
+ if (curNode.Parent == null) return;
+ foreach (TreeNode node in curNode.Parent.Nodes)
{
- foreach (TreeNode node in curNode.Parent.Nodes)
+ if (node.Checked)
{
- if (node.Checked)
- {
- bChecked = true;
- break;
- }
+ bChecked = true;
+ break;
}
+ }
- if (bChecked)
- {
- curNode.Parent.Checked = true;
- CheckParentNode(curNode.Parent);
- }
- else
- {
- curNode.Parent.Checked = false;
- CheckParentNode(curNode.Parent);
- }
+ if (bChecked)
+ {
+ curNode.Parent.Checked = true;
+ CheckParentNode(curNode.Parent);
+ }
+ else
+ {
+ curNode.Parent.Checked = false;
+ CheckParentNode(curNode.Parent);
}
}
private void layerTree_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
{
- if (e.Button == MouseButtons.Right)
+ if (e.Button != MouseButtons.Right) return;
+ layerTree.SelectedNode = e.Node;
+ if (e.Node.Tag == null) return;
+ if (e.Button == MouseButtons.Right && e.Node.Tag.ToString().Contains("|"))
{
- layerTree.SelectedNode = e.Node;
- if (e.Node.Tag != null)
+
+ if (e.Node.Tag.ToString().Split('|')[0] == "locaserver")
{
- if (e.Button == MouseButtons.Right && e.Node.Tag.ToString().Contains("|"))
+
+ foreach (ToolStripItem item in layerNodeContexMenu.Items)
{
-
- if (e.Node.Tag.ToString().Split('|')[0] == "locaserver")
- {
-
- foreach (ToolStripItem item in layerNodeContexMenu.Items)
- {
- item.Visible = false;
- }
- return;
-
- }
-
- if (e.Node.Tag.ToString().Split('|')[0] == "new")
- {
- LayerEditableMenuItem.Enabled = true;
- foreach (ToolStripItem item in layerNodeContexMenu.Items)
- {
- item.Visible = false;
- }
- LayerSelectableMenuItem.Visible = true;
- LayerEditableMenuItem.Visible = true;
- RemoveLayer.Visible = true;
- RefreshLayerFeatureListMenuItem.Visible = true;
- SaveLayerMenuItem.Visible = true;
- LayerFlyMenuItem.Visible = true;
- }
-
- LayerSelectableMenuItem.Visible = true;
- LayerEditableMenuItem.Visible = true;
- SaveLayerMenuItem.Visible = true;
- LayerFlyMenuItem.Visible = true;
- 导出CADToolStripMenuItem1.Visible = true;
-
- layerNodeContexMenu.Show(layerTree, e.X, e.Y);
- layerNodeContexMenu.Tag = e.Node;
- GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(e.Node.Tag.ToString().Split('|')[1]);
- if (layer != null)
- {
- LayerSelectableMenuItem.Checked = layer.Selectable;
- LayerEditableMenuItem.Checked = layer.Editable;
- }
+ item.Visible = false;
}
- else
+ return;
+
+ }
+
+ if (e.Node.Tag.ToString().Split('|')[0] == "new")
+ {
+ LayerEditableMenuItem.Enabled = true;
+ foreach (ToolStripItem item in layerNodeContexMenu.Items)
{
- if (e.Node.Tag is GSOLayer && e.Node.Parent != null && e.Node.Parent.Text.Trim() == "临时图层")
- {
- contextMenuStripDeleteLayerNode.Show(layerTree, e.X, e.Y);
- contextMenuStripDeleteLayerNode.Tag = e.Node;
- }
- if (e.Node.Tag is GSOFeature && e.Node.Parent != null && e.Node.Parent.Text.Trim() == "我的地标")
- {
- contextMenuStripDeleteLayerNode.Show(layerTree, e.X, e.Y);
- contextMenuStripDeleteLayerNode.Tag = e.Node;
- }
+ item.Visible = false;
}
+ //LayerSelectableMenuItem.Visible = true;
+ //LayerEditableMenuItem.Visible = true;
+ RemoveLayer.Visible = true;
+ RefreshLayerFeatureListMenuItem.Visible = true;
+ //SaveLayerMenuItem.Visible = true;
+ //LayerFlyMenuItem.Visible = true;
+ }
+
+ LayerSelectableMenuItem.Visible = true;
+ LayerEditableMenuItem.Visible = true;
+ SaveLayerMenuItem.Visible = true;
+ LayerFlyMenuItem.Visible = true;
+ 导出CADToolStripMenuItem1.Visible = true;
+
+ layerNodeContexMenu.Show(layerTree, e.X, e.Y);
+ layerNodeContexMenu.Tag = e.Node;
+ GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(e.Node.Tag.ToString().Split('|')[1]);
+ if (layer != null)
+ {
+ LayerSelectableMenuItem.Checked = layer.Selectable;
+ LayerEditableMenuItem.Checked = layer.Editable;
+ }
+ }
+ else
+ {
+ if (e.Node.Tag is GSOLayer && e.Node.Parent != null && e.Node.Parent.Text.Trim() == "临时图层")
+ {
+ contextMenuStripDeleteLayerNode.Show(layerTree, e.X, e.Y);
+ contextMenuStripDeleteLayerNode.Tag = e.Node;
+ }
+ else if (e.Node.Tag is GSOFeature && e.Node.Parent != null && e.Node.Parent.Text.Trim() == "我的地标")
+ {
+ contextMenuStripDeleteLayerNode.Show(layerTree, e.X, e.Y);
+ contextMenuStripDeleteLayerNode.Tag = e.Node;
}
}
}
@@ -1909,110 +1808,103 @@
{
TreeNode node = layerTree.SelectedNode;
- if (node != null)
+ if (node == null) return;
+ if (node.Parent.Text.Trim() == "临时图层")
{
- if (node.Parent.Text.Trim() == "临时图层")
+ GSOLayer lsLayer = globeControl1.Globe.Layers.GetLayerByCaption(node.Text);
+ double x = lsLayer.LatLonBounds.Center.X;
+ double y = lsLayer.LatLonBounds.Center.Y;
+ if (x == 0 && y == 0)
{
- GSOLayer lsLayer = globeControl1.Globe.Layers.GetLayerByCaption(node.Text);
- double x = lsLayer.LatLonBounds.Center.X;
- double y = lsLayer.LatLonBounds.Center.Y;
- if (x == 0 && y == 0)
- {
- x = lsLayer.Bounds.Center.X;
- y = lsLayer.Bounds.Center.Y;
- }
+ x = lsLayer.Bounds.Center.X;
+ y = lsLayer.Bounds.Center.Y;
+ }
- globeControl1.Globe.FlyToPosition(new GSOPoint3d(x, y, 10), EnumAltitudeMode.Absolute);
+ globeControl1.Globe.FlyToPosition(new GSOPoint3d(x, y, 10), EnumAltitudeMode.Absolute);
+ }
+ else
+ {
+ GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(node.Tag.ToString().Split('|')[1]);
+
+ if (layer == null) return;
+ if (layer.Caption == "红线")
+ {
+ globeControl1.Globe.FlyToPosition(new GSOPoint3d(120.610963, 31.188121, 50), EnumAltitudeMode.Absolute, -4, 50, 1000);
+ globeControl1.Globe.FlyToPointSpeed = 10000000;
+ globeControl1.Globe.Action = EnumAction3D.SelectObject;
+
+ GSOLayer redLayer = globeControl1.Globe.Layers.GetLayerByCaption("红线");
+ if (redLayer != null)
+ {
+ redLayer.Visible = true;
+ }
+ globeControl1.Refresh();
}
else
{
- GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(node.Tag.ToString().Split('|')[1]);
-
- if (layer != null)
- {
- if (layer.Caption == "红线")
- {
- globeControl1.Globe.FlyToPosition(new GSOPoint3d(120.610963, 31.188121, 50), EnumAltitudeMode.Absolute, -4, 50, 1000);
- globeControl1.Globe.FlyToPointSpeed = 10000000;
- globeControl1.Globe.Action = EnumAction3D.SelectObject;
-
- GSOLayer redLayer = globeControl1.Globe.Layers.GetLayerByCaption("红线");
- if (redLayer != null)
- {
- redLayer.Visible = true;
- }
- globeControl1.Refresh();
- }
- else
- {
- double x = layer.LatLonBounds.Center.X;
- double y = layer.LatLonBounds.Center.Y;
- globeControl1.Globe.FlyToPosition(new GSOPoint3d(x, y, 100), EnumAltitudeMode.Absolute);
- }
- }
+ double x = layer.LatLonBounds.Center.X;
+ double y = layer.LatLonBounds.Center.Y;
+ globeControl1.Globe.FlyToPosition(new GSOPoint3d(x, y, 100), EnumAltitudeMode.Absolute);
}
}
}
private void layerTree_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e)
{
- if (layerTree.SelectedNode != null)
+ if (layerTree.SelectedNode == null) return;
+ if (layerTree.SelectedNode.Tag.ToString().Contains("|"))
{
- if (layerTree.SelectedNode.Tag.ToString().Contains("|"))
+ string nodeTag = layerTree.SelectedNode.Tag.ToString().Split('|')[1];
+ GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(nodeTag);
+ if (layer != null)
{
- string nodeTag = layerTree.SelectedNode.Tag.ToString().Split('|')[1];
- GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(nodeTag);
- if (layer != null)
+ if (layer.Caption == "红线")
{
- if (layer.Caption == "红线")
- {
- globeControl1.Globe.FlyToPosition(new GSOPoint3d(120.610963, 31.188121, 50), EnumAltitudeMode.Absolute, -4, 50, 1000);
- globeControl1.Globe.FlyToPointSpeed = 10000000;
- globeControl1.Globe.Action = EnumAction3D.SelectObject;
+ globeControl1.Globe.FlyToPosition(new GSOPoint3d(120.610963, 31.188121, 50), EnumAltitudeMode.Absolute, -4, 50, 1000);
+ globeControl1.Globe.FlyToPointSpeed = 10000000;
+ globeControl1.Globe.Action = EnumAction3D.SelectObject;
- GSOLayer redLayer = globeControl1.Globe.Layers.GetLayerByCaption("红线");
- if (redLayer != null)
- {
- redLayer.Visible = true;
- }
- globeControl1.Refresh();
- }
- else
+ GSOLayer redLayer = globeControl1.Globe.Layers.GetLayerByCaption("红线");
+ if (redLayer != null)
{
- double x = layer.LatLonBounds.Center.X;
- double y = layer.LatLonBounds.Center.Y;
- globeControl1.Globe.FlyToPosition(new GSOPoint3d(x, y, 0), EnumAltitudeMode.Absolute);
+ redLayer.Visible = true;
}
+ globeControl1.Refresh();
+ }
+ else
+ {
+ double x = layer.LatLonBounds.Center.X;
+ double y = layer.LatLonBounds.Center.Y;
+ globeControl1.Globe.FlyToPosition(new GSOPoint3d(x, y, 0), EnumAltitudeMode.Absolute);
}
}
- if (layerTree.SelectedNode.Tag is GSOLayer)
+ }
+ if (layerTree.SelectedNode.Tag is GSOLayer)
+ {
+ GSOLayer layer = layerTree.SelectedNode.Tag as GSOLayer;
+ if (layer.GetAllFeatures().Length > 0)
{
- GSOLayer layer = layerTree.SelectedNode.Tag as GSOLayer;
- if (layer.GetAllFeatures().Length > 0)
+ GSOFeature feature = layer.GetAt(0);
+ if (feature != null && feature.Geometry != null)
{
- GSOFeature feature = layer.GetAt(0);
- if (feature != null && feature.Geometry != null)
- {
- globeControl1.Globe.FlyToPosition(feature.Geometry.GeoCenterPoint, EnumAltitudeMode.Absolute);//, 0, 0, 1000);
- }
- else
- {
- globeControl1.Globe.FlyToFeature(feature);
- }
- }
- }
- if (layerTree.SelectedNode.Tag is GSOFeature)
- {
- GSOFeature feature = layerTree.SelectedNode.Tag as GSOFeature;
- if (feature.Geometry != null)
- {
- globeControl1.Globe.FlyToPosition(feature.Geometry.GeoCenterPoint, EnumAltitudeMode.Absolute, 0, 0, 10);
+ globeControl1.Globe.FlyToPosition(feature.Geometry.GeoCenterPoint, EnumAltitudeMode.Absolute);//, 0, 0, 1000);
}
else
{
globeControl1.Globe.FlyToFeature(feature);
}
}
+ } else if (layerTree.SelectedNode.Tag is GSOFeature)
+ {
+ GSOFeature feature = layerTree.SelectedNode.Tag as GSOFeature;
+ if (feature.Geometry != null)
+ {
+ globeControl1.Globe.FlyToPosition(feature.Geometry.GeoCenterPoint, EnumAltitudeMode.Absolute, 0, 0, 10);
+ }
+ else
+ {
+ globeControl1.Globe.FlyToFeature(feature);
+ }
}
}
@@ -2086,7 +1978,7 @@
trackPolylineEndMode == EnumTrackPolylineEndMode.DLDM_Analysis)
{
Dictionary hdmDic = SectionAnalysisTool.HDMAnalysis(globeControl1,
- e.Polyline, m_PipelineLayerNames);
+ e.Polyline, Utility.m_PipelineLayerNames);
FrmHDMAnalysis3 frm = new FrmHDMAnalysis3(hdmDic, globeControl1,
trackPolylineEndMode);
frm.Show(this);
@@ -2103,185 +1995,6 @@
* **/
}
trackPolylineEndMode = EnumTrackPolylineEndMode.Default_Analysis;
- /*
- ArrayList arraylistPoint = new ArrayList();
- ArrayList arraylistLine = new ArrayList();
-
- // globeControl1.Globe.ClearLastTrackPolyline();
-
- if (e.Polyline != null)
- {
- //横断面分析
- if (buttonItemFX2_1.Checked || buttonItemFX2_3.Checked)
- {
- if (m_PipelineLayerNames != null)
- {
- GSOGeoPolygon3D polygon = e.Polyline.CreateBuffer(0.1, true, 5, true, false);
- for (int i = 0; i < m_PipelineLayerNames.Count; i++)
- {
- if (m_PipelineLayerNames[i] != null)
- {
- GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(m_PipelineLayerNames[i]);
- if (layer == null)
- {
- continue;
- }
- if (layer.Visible == false)
- {
- continue;
- }
- GSOFeatureLayer featurelayer = layer as GSOFeatureLayer;
- if (featurelayer != null)
- {
- GSOFeatures feats = featurelayer.FindFeaturesInPolygon(polygon, false); //featurelayer.GetAllFeatures();
- if (feats != null)
- {
- for (int j = 0; j < feats.Length; j++)
- {
- GSOFeature feateline = feats[j];
- GSOGeoPolyline3D geoline = feateline.Geometry as GSOGeoPolyline3D;
-
- if (geoline != null)
- {
- if (geoline.Style != null)
- {
- if (geoline.Style.GetType() == typeof(GSOPipeLineStyle3D))
- {
- GSOPoint3d pntIntersect1 = new GSOPoint3d();
- GSOPoint3d pntIntersect2 = new GSOPoint3d();
-
- double honLen;
- double verLen;
- double dDist = globeControl1.Globe.Analysis3D.ComputeTwoGeoPolylineDistance(e.Polyline, geoline, out pntIntersect1, out pntIntersect2, out honLen, out verLen, false, false, 0);
-
- globeControl1.Globe.Action = EnumAction3D.ActionNull;
- if (dDist > -1)
- {
- arraylistPoint.Add(pntIntersect2);
- arraylistLine.Add(feateline);
- }
- }
- }
- }
- }
- }
- else
- {
- MessageBox.Show("请重新绘制断面");
- return;
- }
-
- }
- }
- }
- }
- if (buttonItemFX2_1.Checked)
- {
- FrmHDMAnalysis3 frm = FrmHDMAnalysis3.GetForm(arraylistPoint, arraylistLine, e.Polyline, globeControl1);
- if (!frm.isShowFirst)
- {
- frm.Show(this);
- }
- frm.LoadChartEvent();
- }
- else
- {
- FrmRoadHDM frm = FrmRoadHDM.GetForm(arraylistPoint, arraylistLine, e.Polyline, globeControl1);
- if (!frm.isShowFirst)
- {
- frm.Show(this);
- }
- frm.LoadChartEvent();
- }
- globeControl1.Globe.ClearLastTrackPolyline();
- }
- else if (buttonItemFX2_4.Checked)
- {
- FrmBaseLineProfillAnalysis dlg = new FrmBaseLineProfillAnalysis(globeControl1.Globe, e.Polyline);
- dlg.Show(this);
- globeControl1.Globe.ClearLastTrackPolyline();
- }
- else if (buttonItemFX4_3.Checked)
- {
- GSOGeoPolygon3D resPolygon = e.Polyline.CreateBuffer(m_dDigPitWidthAlongLine, false, 0, false, false);
-
- GSOGeoPit geoPit = new GSOGeoPit();
- geoPit.PitPolygon = resPolygon;
- if (m_bDigPitByDepth)
- {
- geoPit.PitDepth = m_dDigPitValue;
- geoPit.PitDepthUsing = true;
- }
- else
- {
- geoPit.PitBottomAlt = m_dDigPitValue;
- geoPit.PitDepthUsing = false;
- }
-
- globeControl1.Globe.AddPit("", geoPit);
- GSOLayer layerGround = globeControl1.Globe.Layers.GetLayerByCaption(roadLayerName);// ("180fd");
- if (layerGround != null)
- {
- layerGround.Visible = false;
- }
- // 清除当前TrackPolygonAnalysis的痕迹
- globeControl1.Globe.ClearLastTrackPolyline();
- }
- else if (distanceMarker)
- {
- setMarkerLayerUnVisible("距离标注");
- GSOLayer l = globeControl1.Globe.Layers.GetLayerByCaption("距离标注");
- if (l != null)
- {
- l.Visible = true;
- if (getLabelName(l) != -1)
- {
- GSOGeoPolyline3D line = e.Polyline;
- if (line.PartCount > 0)
- {
- double length = line.GetSpaceLength(true, 6378137);//线的长度
- if (length == 0)
- {
- return;
- }
- else
- {
-
- GSOGeoPoint3D pt = new GSOGeoPoint3D();
- GSOGeoPolyline3D lineLine = line.GetSegment(0, length / 2);
- GSOPoint3d point3d = lineLine[lineLine.PartCount - 1][lineLine[lineLine.PartCount - 1].Count - 1];
- pt.X = point3d.X;
- pt.Y = point3d.Y;
- pt.Z = point3d.Z;
-
- string Twodecimalplaces = string.Format("{0:F}", length);
- string radiusLabelName = "" + Twodecimalplaces + "米";
- //string radiusLabelName = "" + length + "米";//标注名称
-
- GSOPoint2d point2d = new GSOPoint2d(0, 30);//标注位置
-
- int labelText = getLabelName(l);
-
- GSOFeature newFeatureLine = new GSOFeature();
- newFeatureLine.Geometry = line;
- newFeatureLine.Name = (labelText + 1).ToString() + "-line";
- l.AddFeature(newFeatureLine);
- globeControl1.Globe.ClearLastTrackPolyline();
-
- GSOFeature newFeature = new GSOFeature();
- newFeature = createLabel(l, newFeature, pt, radiusLabelName, (labelText + 1).ToString(), point2d);
- l.AddFeature(newFeature);
-
- globeControl1.Refresh();
- }
- }
- }
- }
- }
- }
- globeControl1.Globe.Action = EnumAction3D.ActionNull;
- ActionToolMenuChecked();
- * **/
}
#endregion
@@ -2292,83 +2005,81 @@
///
void globeControl1_TrackPolygonEndEvent(object sender, TrackPolygonEndEventArgs e)
{
- if (globeControl1.Globe.Action == EnumAction3D.TrackPolygon && e.Polygon != null)
+ if (globeControl1.Globe.Action != EnumAction3D.TrackPolygon || e.Polygon == null) return;
+ GSOGeoPolygon3D polygon = e.Polygon;
+
+ switch (trackflag)
{
- GSOGeoPolygon3D polygon = e.Polygon;
+ case "valvequery":
+ FrmValveStatistics frm = new FrmValveStatistics(globeControl1, polygon, InitDataGridViewX1);
+ frm.Show(this);
+ globeControl1.Globe.Action = EnumAction3D.ActionNull;
+ break;
- switch (trackflag)
- {
- case "valvequery":
- FrmValveStatistics frm = new FrmValveStatistics(globeControl1, polygon, InitDataGridViewX1);
- frm.Show(this);
- globeControl1.Globe.Action = EnumAction3D.ActionNull;
- break;
+ case "PipelineDistanceStatistics":
- case "PipelineDistanceStatistics":
+ FrmAllPipelineStatis frm1 = new FrmAllPipelineStatis(globeControl1, polygon, InitDataGridViewX1, Utility.m_PipelineLayerNames);
+ frm1.Show(this);
+ globeControl1.Globe.Action = EnumAction3D.ActionNull;
- FrmAllPipelineStatis frm1 = new FrmAllPipelineStatis(globeControl1, polygon, InitDataGridViewX1, m_PipelineLayerNames);
- frm1.Show(this);
- globeControl1.Globe.Action = EnumAction3D.ActionNull;
+ break;
+ case "PipelineSpatialQuery":
- break;
- case "PipelineSpatialQuery":
+ FrmAllPipelineStatis.ShowForm(globeControl1, polygon, InitDataGridViewX1, Utility.m_PipelineLayerNames);
+ globeControl1.Globe.ClearAnalysis();
+ globeControl1.Globe.Action = EnumAction3D.ActionNull;
- FrmAllPipelineStatis.ShowForm(globeControl1, polygon, InitDataGridViewX1, m_PipelineLayerNames);
- globeControl1.Globe.ClearAnalysis();
- globeControl1.Globe.Action = EnumAction3D.ActionNull;
+ break;
+ case "workwellquery":
+ FrmAllWorkWellStatis frmWell = new FrmAllWorkWellStatis(globeControl1, polygon, InitDataGridViewX1);
+ frmWell.Show(this);
- break;
- case "workwellquery":
- FrmAllWorkWellStatis frmWell = new FrmAllWorkWellStatis(globeControl1, polygon, InitDataGridViewX1);
- frmWell.Show(this);
+ globeControl1.Globe.Action = EnumAction3D.ActionNull;
- globeControl1.Globe.Action = EnumAction3D.ActionNull;
+ break;
- break;
-
- case "pit":
- double depth;
- FrmTackPolygonDlg dlg = new FrmTackPolygonDlg();
- if (dlg.ShowDialog() == DialogResult.OK)
+ case "pit":
+ double depth;
+ FrmTackPolygonDlg dlg = new FrmTackPolygonDlg();
+ if (dlg.ShowDialog() == DialogResult.OK)
+ {
+ depth = dlg.depth;
+ GSOGeoPit geoPit = new GSOGeoPit();
+ geoPit.PitPolygon = polygon;
+ geoPit.PitDepth = depth;
+ geoPit.PitDepthUsing = true;
+ globeControl1.Globe.AddPit("", geoPit);
+ GSOLayer layerGround = globeControl1.Globe.Layers.GetLayerByCaption(Utility.roadLayerName);//("180fd");
+ if (layerGround != null)
{
- depth = dlg.depth;
- GSOGeoPit geoPit = new GSOGeoPit();
- geoPit.PitPolygon = polygon;
- geoPit.PitDepth = depth;
- geoPit.PitDepthUsing = true;
- globeControl1.Globe.AddPit("", geoPit);
- GSOLayer layerGround = globeControl1.Globe.Layers.GetLayerByCaption(roadLayerName);//("180fd");
- if (layerGround != null)
- {
- layerGround.Visible = false;
- }
+ layerGround.Visible = false;
}
- globeControl1.Globe.ClearLastTrackPolygon();
- globeControl1.Globe.Action = EnumAction3D.ActionNull;
- break;
- case "digFillAnalysis":
- DigFillAnalysisDlg dlg1 = new DigFillAnalysisDlg();
- dlg1.m_globe = globeControl1.Globe;
- dlg1.m_polygon3D = polygon;
- globeControl1.Globe.Action = EnumAction3D.ActionNull;
- dlg1.Show(this);
- break;
- case "FloodAnalysis":
- FrmFloodAnalysis frmFloodAnalysis = new FrmFloodAnalysis(globeControl1.Globe, polygon);
- frmFloodAnalysis.Show(this);
- globeControl1.Globe.Action = EnumAction3D.ActionNull;
- break;
- case "BSQDuoBianXiangStatis":
- FrmBSQStatis bsqFrm = new FrmBSQStatis(globeControl1, e.Polygon);
- bsqFrm.Show(this);
- globeControl1.Globe.Action = EnumAction3D.ActionNull;
- break;
+ }
+ globeControl1.Globe.ClearLastTrackPolygon();
+ globeControl1.Globe.Action = EnumAction3D.ActionNull;
+ break;
+ case "digFillAnalysis":
+ DigFillAnalysisDlg dlg1 = new DigFillAnalysisDlg();
+ dlg1.m_globe = globeControl1.Globe;
+ dlg1.m_polygon3D = polygon;
+ globeControl1.Globe.Action = EnumAction3D.ActionNull;
+ dlg1.Show(this);
+ break;
+ case "FloodAnalysis":
+ FrmFloodAnalysis frmFloodAnalysis = new FrmFloodAnalysis(globeControl1.Globe, polygon);
+ frmFloodAnalysis.Show(this);
+ globeControl1.Globe.Action = EnumAction3D.ActionNull;
+ break;
+ case "BSQDuoBianXiangStatis":
+ FrmBSQStatis bsqFrm = new FrmBSQStatis(globeControl1, e.Polygon);
+ bsqFrm.Show(this);
+ globeControl1.Globe.Action = EnumAction3D.ActionNull;
+ break;
- case "":
- break;
- default:
- break;
- }
+ case "":
+ break;
+ default:
+ break;
}
}
///
@@ -2380,16 +2091,14 @@
{
try
{
- if (e.Feature != null)
+ if (e.Feature == null) return;
+ if (isFeatureContainsBianhao(e.Feature))
{
- if (isFeatureContainsBianhao(e.Feature))
- {
- featureTooltip.ShowBalloon((int)e.MousePos.X, (int)e.MousePos.Y, e.Feature.GetValue(featureIDFieldName).ToString());
- }
- else if (e.Feature.Name != "")
- {
- featureTooltip.ShowBalloon((int)e.MousePos.X, (int)e.MousePos.Y, e.Feature.Name);
- }
+ featureTooltip.ShowBalloon((int)e.MousePos.X, (int)e.MousePos.Y, e.Feature.GetValue(featureIDFieldName).ToString());
+ }
+ else if (e.Feature.Name != "")
+ {
+ featureTooltip.ShowBalloon((int)e.MousePos.X, (int)e.MousePos.Y, e.Feature.Name);
}
}
catch (Exception ex)
@@ -2405,192 +2114,188 @@
/// (完善)
void globeControl1_MouseDoubleClick(object sender, MouseEventArgs e)
{
- if (e.Button == MouseButtons.Left)
+ if (e.Button != MouseButtons.Left) return;
+ if (m_AddPipeLine && globeControl1.Globe.Action == EnumAction3D.DrawPolyline)//添加管线
{
- if (m_AddPipeLine && globeControl1.Globe.Action == EnumAction3D.DrawPolyline)//添加管线
+ GSOLayer layerDest = globeControl1.Globe.DestLayerFeatureAdd;
+ if (layerDest != null)
{
- GSOLayer layerDest = globeControl1.Globe.DestLayerFeatureAdd;
- if (layerDest != null)
+ GSOFeatures features = layerDest.GetAllFeatures();
+ GSOFeature f = features[features.Length - 1];
+ GSOGeoPolyline3D line = f.Geometry as GSOGeoPolyline3D;
+ globeControl1.Globe.Action = EnumAction3D.ActionNull;
+ if (f != null && f.Geometry.Type == EnumGeometryType.GeoPolyline3D)
{
- GSOFeatures features = layerDest.GetAllFeatures();
- GSOFeature f = features[features.Length - 1];
- GSOGeoPolyline3D line = f.Geometry as GSOGeoPolyline3D;
- globeControl1.Globe.Action = EnumAction3D.ActionNull;
- if (f != null && f.Geometry.Type == EnumGeometryType.GeoPolyline3D)
- {
- FrmLineCoordinate lineCoordiante = new FrmLineCoordinate(f, globeControl1, layerDest.Caption);
- lineCoordiante.Show(this);
- }
- globeControl1.Refresh();
- }
- }
- if (m_isDrawTunnel && globeControl1.Globe.Action == EnumAction3D.DrawPolyline)//创建隧道
- {
- GSOLayer tunnel = globeControl1.Globe.Layers.GetLayerByCaption("隧道");
- if (tunnel != null && tunnel.GetAllFeatures().Length > 0)
- {
- GSOFeature feature = tunnel.GetAt(tunnel.GetAllFeatures().Length - 1);
- FrmCreateTunnel frm = new FrmCreateTunnel(globeControl1, feature);
- if (frm.ShowDialog() == DialogResult.OK)
- {
- //tunnel.Save();
- }
+ FrmLineCoordinate lineCoordiante = new FrmLineCoordinate(f, globeControl1, layerDest.Caption);
+ lineCoordiante.Show(this);
}
globeControl1.Refresh();
}
- if (m_isDrawCitySevenLine && globeControl1.Globe.Action == EnumAction3D.DrawPolyline)//绘制城市七线
+ }
+ if (m_isDrawTunnel && globeControl1.Globe.Action == EnumAction3D.DrawPolyline)//创建隧道
+ {
+ GSOLayer tunnel = globeControl1.Globe.Layers.GetLayerByCaption("隧道");
+ if (tunnel != null && tunnel.GetAllFeatures().Length > 0)
{
- string lineType = citySevenLineType;
- string lineName = cityServerLineName;
- GSOFeature feature = null;
- switch (lineType)
+ GSOFeature feature = tunnel.GetAt(tunnel.GetAllFeatures().Length - 1);
+ FrmCreateTunnel frm = new FrmCreateTunnel(globeControl1, feature);
+ if (frm.ShowDialog() == DialogResult.OK)
{
- case "城市红线":
- GSOLayer layerRed = globeControl1.Globe.Layers.GetLayerByCaption(lineType);
- if (layerRed != null && layerRed.GetAllFeatures().Length > 0)
- {
- feature = layerRed.GetAt(layerRed.GetAllFeatures().Length - 1);
- if (feature != null)
- {
- feature.Name = lineName;
- GSOSimpleLineStyle3D style = new GSOSimpleLineStyle3D();
- style.LineColor = Color.Red; //改变绘制的线的颜色
- style.LineWidth = 1; //改变绘制的线的宽度
- feature.Geometry.Style = style;
- //layerRed.Save();
- }
- }
- break;
- case "城市橙线":
- GSOLayer layerOrange = globeControl1.Globe.Layers.GetLayerByCaption(lineType);
- if (layerOrange != null && layerOrange.GetAllFeatures().Length > 0)
- {
- feature = layerOrange.GetAt(layerOrange.GetAllFeatures().Length - 1);
- if (feature != null)
- {
- feature.Name = lineName;
- GSOSimpleLineStyle3D style = new GSOSimpleLineStyle3D();
- style.LineColor = Color.Orange;
- feature.Geometry.Style = style;
- //layerOrange.Save();
- }
- }
- break;
- case "城市黄线":
- GSOLayer layerYellow = globeControl1.Globe.Layers.GetLayerByCaption(lineType);
- if (layerYellow != null && layerYellow.GetAllFeatures().Length > 0)
- {
- feature = layerYellow.GetAt(layerYellow.GetAllFeatures().Length - 1);
- if (feature != null)
- {
- feature.Name = lineName;
- GSOSimpleLineStyle3D style = new GSOSimpleLineStyle3D();
- style.LineColor = Color.Yellow;
- feature.Geometry.Style = style;
- //layerYellow.Save();
- }
- }
- break;
- case "城市绿线":
- GSOLayer layerGreen = globeControl1.Globe.Layers.GetLayerByCaption(lineType);
- if (layerGreen != null && layerGreen.GetAllFeatures().Length > 0)
- {
- feature = layerGreen.GetAt(layerGreen.GetAllFeatures().Length - 1);
- if (feature != null)
- {
- feature.Name = lineName;
- GSOSimpleLineStyle3D style = new GSOSimpleLineStyle3D();
- style.LineColor = Color.Green;
- feature.Geometry.Style = style;
- //layerGreen.Save();
- }
- }
- break;
- case "城市蓝线":
- GSOLayer layerBlue = globeControl1.Globe.Layers.GetLayerByCaption(lineType);
- if (layerBlue != null && layerBlue.GetAllFeatures().Length > 0)
- {
- feature = layerBlue.GetAt(layerBlue.GetAllFeatures().Length - 1);
- if (feature != null)
- {
- feature.Name = lineName;
- GSOSimpleLineStyle3D style = new GSOSimpleLineStyle3D();
- style.LineColor = Color.Blue;
- feature.Geometry.Style = style;
- //layerBlue.Save();
- }
- }
- break;
- case "城市紫线":
- GSOLayer layerPurple = globeControl1.Globe.Layers.GetLayerByCaption(lineType);
- if (layerPurple != null && layerPurple.GetAllFeatures().Length > 0)
- {
- feature = layerPurple.GetAt(layerPurple.GetAllFeatures().Length - 1);
- if (feature != null)
- {
- feature.Name = lineName;
- GSOSimpleLineStyle3D style = new GSOSimpleLineStyle3D();
- style.LineColor = Color.Purple;
- feature.Geometry.Style = style;
- //layerPurple.Save();
- }
- }
- break;
- case "城市黑线":
- GSOLayer layerBlack = globeControl1.Globe.Layers.GetLayerByCaption(lineType);
- if (layerBlack != null && layerBlack.GetAllFeatures().Length > 0)
- {
- feature = layerBlack.GetAt(layerBlack.GetAllFeatures().Length - 1);
- if (feature != null)
- {
- feature.Name = lineName;
- GSOSimpleLineStyle3D style = new GSOSimpleLineStyle3D();
- style.LineColor = Color.Black;
- feature.Geometry.Style = style;
- //layerBlack.Save();
- }
- }
- break;
+ //tunnel.Save();
}
-
- globeControl1.Globe.DestLayerFeatureAdd = null;
}
- m_AddPipeLine = false;
- m_isDrawTunnel = false;
- m_isDrawCitySevenLine = false;
- if (m_isDrawRedPology && globeControl1.Globe.Action == EnumAction3D.DrawPolygon)//红线工具
+ globeControl1.Refresh();
+ }
+ if (m_isDrawCitySevenLine && globeControl1.Globe.Action == EnumAction3D.DrawPolyline)//绘制城市七线
+ {
+ string lineType = citySevenLineType;
+ string lineName = cityServerLineName;
+ GSOFeature feature = null;
+ switch (lineType)
{
- GSOLayer layerDest = globeControl1.Globe.DestLayerFeatureAdd;
- if (layerDest != null)
- {
- GSOFeatures features = layerDest.GetAllFeatures();
- //GSOFeatures features = globeControl1.Globe.MemoryLayer.GetAllFeatures();
- GSOFeature f = features[features.Length - 1];
- if (f != null)
+ case "城市红线":
+ GSOLayer layerRed = globeControl1.Globe.Layers.GetLayerByCaption(lineType);
+ if (layerRed != null && layerRed.GetAllFeatures().Length > 0)
{
- GSOGeoPolygon3D polygon = f.Geometry as GSOGeoPolygon3D;
- if (polygon != null)
+ feature = layerRed.GetAt(layerRed.GetAllFeatures().Length - 1);
+ if (feature != null)
{
- GSOSimplePolygonStyle3D geoStyle3d = new GSOSimplePolygonStyle3D();
- f.Name = (getLabelName(layerDest) + 1).ToString();
- geoStyle3d.FillColor = Color.Red;
- polygon.Style = geoStyle3d;
- GSOLabel label = new GSOLabel();
- label.Text = "此区域正在施工中!";
- label.Style = new GSOLabelStyle();
- label.Style.HasTracktionLine = false;
- polygon.Label = label;
-
- globeControl1.Refresh();
+ feature.Name = lineName;
+ GSOSimpleLineStyle3D style = new GSOSimpleLineStyle3D();
+ style.LineColor = Color.Red; //改变绘制的线的颜色
+ style.LineWidth = 1; //改变绘制的线的宽度
+ feature.Geometry.Style = style;
+ //layerRed.Save();
}
}
+ break;
+ case "城市橙线":
+ GSOLayer layerOrange = globeControl1.Globe.Layers.GetLayerByCaption(lineType);
+ if (layerOrange != null && layerOrange.GetAllFeatures().Length > 0)
+ {
+ feature = layerOrange.GetAt(layerOrange.GetAllFeatures().Length - 1);
+ if (feature != null)
+ {
+ feature.Name = lineName;
+ GSOSimpleLineStyle3D style = new GSOSimpleLineStyle3D();
+ style.LineColor = Color.Orange;
+ feature.Geometry.Style = style;
+ //layerOrange.Save();
+ }
+ }
+ break;
+ case "城市黄线":
+ GSOLayer layerYellow = globeControl1.Globe.Layers.GetLayerByCaption(lineType);
+ if (layerYellow != null && layerYellow.GetAllFeatures().Length > 0)
+ {
+ feature = layerYellow.GetAt(layerYellow.GetAllFeatures().Length - 1);
+ if (feature != null)
+ {
+ feature.Name = lineName;
+ GSOSimpleLineStyle3D style = new GSOSimpleLineStyle3D();
+ style.LineColor = Color.Yellow;
+ feature.Geometry.Style = style;
+ //layerYellow.Save();
+ }
+ }
+ break;
+ case "城市绿线":
+ GSOLayer layerGreen = globeControl1.Globe.Layers.GetLayerByCaption(lineType);
+ if (layerGreen != null && layerGreen.GetAllFeatures().Length > 0)
+ {
+ feature = layerGreen.GetAt(layerGreen.GetAllFeatures().Length - 1);
+ if (feature != null)
+ {
+ feature.Name = lineName;
+ GSOSimpleLineStyle3D style = new GSOSimpleLineStyle3D();
+ style.LineColor = Color.Green;
+ feature.Geometry.Style = style;
+ //layerGreen.Save();
+ }
+ }
+ break;
+ case "城市蓝线":
+ GSOLayer layerBlue = globeControl1.Globe.Layers.GetLayerByCaption(lineType);
+ if (layerBlue != null && layerBlue.GetAllFeatures().Length > 0)
+ {
+ feature = layerBlue.GetAt(layerBlue.GetAllFeatures().Length - 1);
+ if (feature != null)
+ {
+ feature.Name = lineName;
+ GSOSimpleLineStyle3D style = new GSOSimpleLineStyle3D();
+ style.LineColor = Color.Blue;
+ feature.Geometry.Style = style;
+ //layerBlue.Save();
+ }
+ }
+ break;
+ case "城市紫线":
+ GSOLayer layerPurple = globeControl1.Globe.Layers.GetLayerByCaption(lineType);
+ if (layerPurple != null && layerPurple.GetAllFeatures().Length > 0)
+ {
+ feature = layerPurple.GetAt(layerPurple.GetAllFeatures().Length - 1);
+ if (feature != null)
+ {
+ feature.Name = lineName;
+ GSOSimpleLineStyle3D style = new GSOSimpleLineStyle3D();
+ style.LineColor = Color.Purple;
+ feature.Geometry.Style = style;
+ //layerPurple.Save();
+ }
+ }
+ break;
+ case "城市黑线":
+ GSOLayer layerBlack = globeControl1.Globe.Layers.GetLayerByCaption(lineType);
+ if (layerBlack != null && layerBlack.GetAllFeatures().Length > 0)
+ {
+ feature = layerBlack.GetAt(layerBlack.GetAllFeatures().Length - 1);
+ if (feature != null)
+ {
+ feature.Name = lineName;
+ GSOSimpleLineStyle3D style = new GSOSimpleLineStyle3D();
+ style.LineColor = Color.Black;
+ feature.Geometry.Style = style;
+ //layerBlack.Save();
+ }
+ }
+ break;
+ }
+
+ globeControl1.Globe.DestLayerFeatureAdd = null;
+ }
+ m_AddPipeLine = false;
+ m_isDrawTunnel = false;
+ m_isDrawCitySevenLine = false;
+ if (m_isDrawRedPology && globeControl1.Globe.Action == EnumAction3D.DrawPolygon)//红线工具
+ {
+ GSOLayer layerDest = globeControl1.Globe.DestLayerFeatureAdd;
+ if (layerDest != null)
+ {
+ GSOFeatures features = layerDest.GetAllFeatures();
+ //GSOFeatures features = globeControl1.Globe.MemoryLayer.GetAllFeatures();
+ GSOFeature f = features[features.Length - 1];
+ if (f != null)
+ {
+ GSOGeoPolygon3D polygon = f.Geometry as GSOGeoPolygon3D;
+ if (polygon != null)
+ {
+ GSOSimplePolygonStyle3D geoStyle3d = new GSOSimplePolygonStyle3D();
+ f.Name = (getLabelName(layerDest) + 1).ToString();
+ geoStyle3d.FillColor = Color.Red;
+ polygon.Style = geoStyle3d;
+ GSOLabel label = new GSOLabel();
+ label.Text = "此区域正在施工中!";
+ label.Style = new GSOLabelStyle();
+ label.Style.HasTracktionLine = false;
+ polygon.Label = label;
+
+ globeControl1.Refresh();
+ }
}
}
- m_isDrawRedPology = false;
- globeControl1.Globe.Action = EnumAction3D.ActionNull;
-
-
}
+ m_isDrawRedPology = false;
+ globeControl1.Globe.Action = EnumAction3D.ActionNull;
}
///
@@ -2627,7 +2332,7 @@
}
}
///
- /// (完善)
+ /// (完善)#wxl 待整理
///
///
///
@@ -2907,7 +2612,7 @@
}
///
- /// 鼠标点击, 弹出气泡功能globeControl1
+ /// 鼠标点击, 弹出气泡功能globeControl1 wxl待整理
///
///
///
@@ -2916,34 +2621,30 @@
GSOFeature feature = e.Feature;
string str1 = "";
- if (feature != null)
+ if (feature == null) return;
+ if (feature.GetFieldDefn("图片编码") != null)//
{
- if (feature.GetFieldDefn("图片编码") != null)//
+ str1 = GetBubbleInfo(feature, globeControl1);
+ if (RemoteFileExists(Utility.PicRootURL + feature.GetValue("图片编码")))
{
- str1 = GetBubbleInfo(feature, globeControl1);
- if (RemoteFileExists(Utility.PicRootURL + feature.GetValue("图片编码")))
- {
- str1 += "
";
- }
- else if (RemoteFileExists(Utility.PicDefaultURL))
- {
- str1 += "
";
- }
+ str1 += "
";
}
- else if (isFeatureContainsBianhao(feature)) //管线模型图层
+ else if (RemoteFileExists(Utility.PicDefaultURL))
{
- str1 = GetBubbleInfo(feature, globeControl1);
- }
-
- if (str1 != "")
- {
- featureTooltip.HideBalloon();
- balloonEx.HideBalloon();
- balloonEx.SetSize(EnumSizeIndexEx.CONTENT_CX, 480);
- balloonEx.SetSize(EnumSizeIndexEx.CONTENT_CY, 420);
- balloonEx.ShowBalloon((int)e.MousePos.X, (int)e.MousePos.Y, str1);
+ str1 += "
";
}
}
+ else if (isFeatureContainsBianhao(feature)) //管线模型图层
+ {
+ str1 = GetBubbleInfo(feature, globeControl1);
+ }
+
+ if (str1 == "") return;
+ featureTooltip.HideBalloon();
+ balloonEx.HideBalloon();
+ balloonEx.SetSize(EnumSizeIndexEx.CONTENT_CX, 480);
+ balloonEx.SetSize(EnumSizeIndexEx.CONTENT_CY, 420);
+ balloonEx.ShowBalloon((int)e.MousePos.X, (int)e.MousePos.Y, str1);
}
///
@@ -2956,35 +2657,30 @@
GSOFeature feature = e.Feature;
string str1 = "";
- if (feature != null)
+ if (feature == null) return;
+ if (feature.GetFieldDefn("图片编码") != null) //
{
- if (feature.GetFieldDefn("图片编码") != null) //
+ str1 = GetBubbleInfo(feature, globeControl2);
+ if (RemoteFileExists(Utility.PicRootURL + feature.GetValue("图片编码")))
{
- str1 = GetBubbleInfo(feature, globeControl2);
- if (RemoteFileExists(Utility.PicRootURL + feature.GetValue("图片编码")))
- {
- str1 += "
";
- }
- else if (RemoteFileExists(Utility.PicDefaultURL))
- {
- str1 += "
";
- }
+ str1 += "
";
}
- else if (isFeatureContainsBianhao(feature)) //管线模型图层
+ else if (RemoteFileExists(Utility.PicDefaultURL))
{
- str1 = GetBubbleInfo(feature, globeControl2);
- }
-
- if (str1 != "")
- {
-
- featureTooltip2.HideBalloon();
- balloonEx2.HideBalloon();
- balloonEx2.SetSize(EnumSizeIndexEx.CONTENT_CX, 480);
- balloonEx2.SetSize(EnumSizeIndexEx.CONTENT_CY, 420);
- balloonEx2.ShowBalloon((int)e.MousePos.X, (int)e.MousePos.Y, str1);
+ str1 += "
";
}
}
+ else if (isFeatureContainsBianhao(feature)) //管线模型图层
+ {
+ str1 = GetBubbleInfo(feature, globeControl2);
+ }
+
+ if (str1 == "") return;
+ featureTooltip2.HideBalloon();
+ balloonEx2.HideBalloon();
+ balloonEx2.SetSize(EnumSizeIndexEx.CONTENT_CX, 480);
+ balloonEx2.SetSize(EnumSizeIndexEx.CONTENT_CY, 420);
+ balloonEx2.ShowBalloon((int)e.MousePos.X, (int)e.MousePos.Y, str1);
}
///
@@ -3011,15 +2707,13 @@
for (int i = 0; i < Utility.listPipelineType.Count; i++)
{
PipelineType pipelineType = Utility.listPipelineType[i];
- if (pipelineType != null && pipelineType.code.Trim() == pipelinecode.Trim())
+ if (pipelineType == null || pipelineType.code.Trim() != pipelinecode.Trim()) continue;
+ title = pipelineType.type + " " + pipelineType.name;
+ if (pipelineType.type == pipelineType.name)
{
- title = pipelineType.type + " " + pipelineType.name;
- if (pipelineType.type == pipelineType.name)
- {
- title = pipelineType.type;
- }
- break;
+ title = pipelineType.type;
}
+ break;
}
}
}
@@ -3172,8 +2866,8 @@
return str;
}
- string filename = Utility.filename;
- List g1layername = new List();
+ //string filename = Utility.filename;
+ //List g1layername = new List();
///
/// 获取目标图层
@@ -3229,17 +2923,15 @@
for (int n = 0; n < tempChildNode1.Nodes.Count; n++)
{
TreeNode tempChildNode2 = tempChildNode1.Nodes[n];
- if (tempChildNode2.Tag.ToString().Split('|').Length > 1)
+ if (tempChildNode2.Tag.ToString().Split('|').Length <= 1) continue;
+ GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(tempChildNode2.Tag.ToString().Split('|')[1]);
+ if (layer == null)
{
- GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(tempChildNode2.Tag.ToString().Split('|')[1]);
- if (layer == null)
- {
- continue;
- }
- if (tempChildNode2.Tag != null && layer.IsDestLayerFeatureAdd())
- {
- return tempChildNode2;
- }
+ continue;
+ }
+ if (tempChildNode2.Tag != null && layer.IsDestLayerFeatureAdd())
+ {
+ return tempChildNode2;
}
}
}
@@ -3260,35 +2952,33 @@
//日志记录
LogManager.saveLog(Utility.userName, buttonItem87.Text);
- if (!buttonItem87.Checked)
- {
- buttonItem87.Checked = true;
- buttonItem88.Checked = false;
- buttonItem27.Checked = false;
+ if (buttonItem87.Checked) return;
+ buttonItem87.Checked = true;
+ buttonItem88.Checked = false;
+ buttonItem27.Checked = false;
- switch (globeControl1.Globe.CameraMode)
- {
- case EnumCameraMode.UnderGround:
- globeControl1.Globe.CameraMode = EnumCameraMode.Navigation;
- GSOCameraState state = new GSOCameraState();
- state.AltitudeMode = globeControl1.Globe.CameraState.AltitudeMode;
- state.Altitude = globeControl1.Globe.CameraState.Altitude;
- state.Distance = globeControl1.Globe.CameraState.Distance;
- state.Heading = globeControl1.Globe.CameraState.Heading;
- state.Latitude = globeControl1.Globe.CameraState.Latitude;
- state.Longitude = globeControl1.Globe.CameraState.Longitude;
- if (globeControl1.Globe.CameraState.Tilt < 95 && globeControl1.Globe.CameraState.Tilt > 85)
- state.Tilt = 85;
- else
- state.Tilt = 180 - globeControl1.Globe.CameraState.Tilt;
- globeControl1.Globe.JumpToCameraState(state);
- break;
- case EnumCameraMode.Walk:
- globeControl1.Globe.CameraMode = EnumCameraMode.Navigation;
- break;
- }
- globeControl1.Globe.Refresh();
+ switch (globeControl1.Globe.CameraMode)
+ {
+ case EnumCameraMode.UnderGround:
+ globeControl1.Globe.CameraMode = EnumCameraMode.Navigation;
+ GSOCameraState state = new GSOCameraState();
+ state.AltitudeMode = globeControl1.Globe.CameraState.AltitudeMode;
+ state.Altitude = globeControl1.Globe.CameraState.Altitude;
+ state.Distance = globeControl1.Globe.CameraState.Distance;
+ state.Heading = globeControl1.Globe.CameraState.Heading;
+ state.Latitude = globeControl1.Globe.CameraState.Latitude;
+ state.Longitude = globeControl1.Globe.CameraState.Longitude;
+ if (globeControl1.Globe.CameraState.Tilt < 95 && globeControl1.Globe.CameraState.Tilt > 85)
+ state.Tilt = 85;
+ else
+ state.Tilt = 180 - globeControl1.Globe.CameraState.Tilt;
+ globeControl1.Globe.JumpToCameraState(state);
+ break;
+ case EnumCameraMode.Walk:
+ globeControl1.Globe.CameraMode = EnumCameraMode.Navigation;
+ break;
}
+ globeControl1.Globe.Refresh();
}
///
/// 地下模式 菜单按钮
@@ -3300,33 +2990,31 @@
//日志记录
LogManager.saveLog(Utility.userName, buttonItem88.Text);
- if (!buttonItem88.Checked)
- {
- buttonItem88.Checked = true;
- buttonItem27.Checked = false;
- buttonItem87.Checked = false;
+ if (buttonItem88.Checked) return;
+ buttonItem88.Checked = true;
+ buttonItem27.Checked = false;
+ buttonItem87.Checked = false;
- switch (globeControl1.Globe.CameraMode)
- {
- case EnumCameraMode.Navigation:
- case EnumCameraMode.Walk:
- globeControl1.Globe.CameraMode = EnumCameraMode.UnderGround;
- GSOCameraState state = new GSOCameraState();
- state.AltitudeMode = globeControl1.Globe.CameraState.AltitudeMode;
- state.Altitude = globeControl1.Globe.CameraState.Altitude;
- state.Distance = globeControl1.Globe.CameraState.Distance;
- state.Heading = globeControl1.Globe.CameraState.Heading;
- state.Latitude = globeControl1.Globe.CameraState.Latitude;
- state.Longitude = globeControl1.Globe.CameraState.Longitude;
- if (globeControl1.Globe.CameraState.Tilt < 95 && globeControl1.Globe.CameraState.Tilt > 85)
- state.Tilt = 95;
- else
- state.Tilt = 180 - globeControl1.Globe.CameraState.Tilt;
- globeControl1.Globe.JumpToCameraState(state);
- break;
- }
- globeControl1.Globe.Refresh();
+ switch (globeControl1.Globe.CameraMode)
+ {
+ case EnumCameraMode.Navigation:
+ case EnumCameraMode.Walk:
+ globeControl1.Globe.CameraMode = EnumCameraMode.UnderGround;
+ GSOCameraState state = new GSOCameraState();
+ state.AltitudeMode = globeControl1.Globe.CameraState.AltitudeMode;
+ state.Altitude = globeControl1.Globe.CameraState.Altitude;
+ state.Distance = globeControl1.Globe.CameraState.Distance;
+ state.Heading = globeControl1.Globe.CameraState.Heading;
+ state.Latitude = globeControl1.Globe.CameraState.Latitude;
+ state.Longitude = globeControl1.Globe.CameraState.Longitude;
+ if (globeControl1.Globe.CameraState.Tilt < 95 && globeControl1.Globe.CameraState.Tilt > 85)
+ state.Tilt = 95;
+ else
+ state.Tilt = 180 - globeControl1.Globe.CameraState.Tilt;
+ globeControl1.Globe.JumpToCameraState(state);
+ break;
}
+ globeControl1.Globe.Refresh();
}
///
/// 行走模式 菜单按钮
@@ -3338,14 +3026,12 @@
//日志记录
LogManager.saveLog(Utility.userName, buttonItem27.Text);
- if (!buttonItem27.Checked)
- {
- buttonItem27.Checked = true;
- buttonItem87.Checked = false;
- buttonItem88.Checked = false;
+ if (buttonItem27.Checked) return;
+ buttonItem27.Checked = true;
+ buttonItem87.Checked = false;
+ buttonItem88.Checked = false;
- globeControl1.Globe.CameraMode = EnumCameraMode.Walk;
- }
+ globeControl1.Globe.CameraMode = EnumCameraMode.Walk;
}
///
/// 地面透明度设置 菜单
@@ -3357,7 +3043,7 @@
LogManager.saveLog(Utility.userName, sliderGroundTransSet1.Text);
globeControl1.Globe.GroundOpaque = 100 - sliderGroundTransSet1.Value;
- GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(roadLayerName);//("180fd");
+ GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(Utility.roadLayerName);//("180fd");
if (layer != null)
layer.Opaque = 100 - sliderGroundTransSet1.Value;
optiValue = sliderGroundTransSet1.Value;
@@ -3890,24 +3576,22 @@
///
private void comboBoxEx1_SelectedIndexChanged(object sender, EventArgs e)
{
- if (comboBoxEx1.SelectedIndex > -1)
- {
- dataGridViewX2.Rows.Clear();
- dataGridViewX3.Rows.Clear();
- listBox1.Items.Clear();
- GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(comboBoxEx1.SelectedItem.ToString());
- if (layer == null)
- return;
+ if (comboBoxEx1.SelectedIndex <= -1) return;
+ dataGridViewX2.Rows.Clear();
+ dataGridViewX3.Rows.Clear();
+ listBox1.Items.Clear();
+ GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(comboBoxEx1.SelectedItem.ToString());
+ if (layer == null)
+ return;
- GSOFeatureLayer flayer = layer as GSOFeatureLayer;
- GSOFeatureDataset fdataset = flayer.Dataset as GSOFeatureDataset;
- GSOFeatures feats = flayer.GetAllFeatures();
- for (int i = 0; i < feats.Length; i++)
- {
- int idx = dataGridViewX2.Rows.Add();
- dataGridViewX2.Rows[idx].Cells[0].Value = comboBoxEx1.SelectedItem.ToString();
- dataGridViewX2.Rows[idx].Cells[1].Value = feats[i].Name;
- }
+ GSOFeatureLayer flayer = layer as GSOFeatureLayer;
+ GSOFeatureDataset fdataset = flayer.Dataset as GSOFeatureDataset;
+ GSOFeatures feats = flayer.GetAllFeatures();
+ for (int i = 0; i < feats.Length; i++)
+ {
+ int idx = dataGridViewX2.Rows.Add();
+ dataGridViewX2.Rows[idx].Cells[0].Value = comboBoxEx1.SelectedItem.ToString();
+ dataGridViewX2.Rows[idx].Cells[1].Value = feats[i].Name;
}
}
///
@@ -3917,24 +3601,22 @@
///
private void comboBoxEx1_SelectedIndexChanged_shuiping(object sender, EventArgs e)
{
- if (comboBoxEx4.SelectedIndex > -1)
- {
- dataGridViewX8.Rows.Clear();
- dataGridViewX9.Rows.Clear();
- listBox3.Items.Clear();
- GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(comboBoxEx4.SelectedItem.ToString());
- if (layer == null)
- return;
+ if (comboBoxEx4.SelectedIndex <= -1) return;
+ dataGridViewX8.Rows.Clear();
+ dataGridViewX9.Rows.Clear();
+ listBox3.Items.Clear();
+ GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(comboBoxEx4.SelectedItem.ToString());
+ if (layer == null)
+ return;
- GSOFeatureLayer flayer = layer as GSOFeatureLayer;
- GSOFeatureDataset fdataset = flayer.Dataset as GSOFeatureDataset;
- GSOFeatures feats = flayer.GetAllFeatures();
- for (int i = 0; i < feats.Length; i++)
- {
- int idx = dataGridViewX8.Rows.Add();
- dataGridViewX8.Rows[idx].Cells[0].Value = comboBoxEx4.SelectedItem.ToString();
- dataGridViewX8.Rows[idx].Cells[1].Value = feats[i].Name;
- }
+ GSOFeatureLayer flayer = layer as GSOFeatureLayer;
+ GSOFeatureDataset fdataset = flayer.Dataset as GSOFeatureDataset;
+ GSOFeatures feats = flayer.GetAllFeatures();
+ for (int i = 0; i < feats.Length; i++)
+ {
+ int idx = dataGridViewX8.Rows.Add();
+ dataGridViewX8.Rows[idx].Cells[0].Value = comboBoxEx4.SelectedItem.ToString();
+ dataGridViewX8.Rows[idx].Cells[1].Value = feats[i].Name;
}
}
Dictionary featCount = new Dictionary();
@@ -3984,7 +3666,7 @@
if (selectedFeature != null)
{
selectState = 1;
- VerticalDistanceAnalysis("垂直净距分析", selectedFeature, m_PipelineLayerNames, dJingJuBiaoZhun, 0.0);
+ VerticalDistanceAnalysis("垂直净距分析", selectedFeature, Utility.m_PipelineLayerNames, dJingJuBiaoZhun, 0.0);
}
}
}
@@ -4005,16 +3687,16 @@
for (int i = 0; i < feats.Length; i++)
{
selectState = 1;
- VerticalDistanceAnalysis("垂直净距分析", feats[i], m_PipelineLayerNames, dJingJuBiaoZhun, 0.0);
+ VerticalDistanceAnalysis("垂直净距分析", feats[i], Utility.m_PipelineLayerNames, dJingJuBiaoZhun, 0.0);
}
}
if (featCount.Count > 0)
{
- for (int i = 0; i < m_PipelineLayerNames.Count; i++)
+ for (int i = 0; i < Utility.m_PipelineLayerNames.Count; i++)
{
- if (featCount.ContainsKey(m_PipelineLayerNames[i]) && featLenth.ContainsKey(m_PipelineLayerNames[i]))
+ if (featCount.ContainsKey(Utility.m_PipelineLayerNames[i]) && featLenth.ContainsKey(Utility.m_PipelineLayerNames[i]))
{
- listBox1.Items.Add(m_PipelineLayerNames[i] + ":" + featCount[m_PipelineLayerNames[i]] + "条,共" + featLenth[m_PipelineLayerNames[i]].ToString("0.00") + "米");
+ listBox1.Items.Add(Utility.m_PipelineLayerNames[i] + ":" + featCount[Utility.m_PipelineLayerNames[i]] + "条,共" + featLenth[Utility.m_PipelineLayerNames[i]].ToString("0.00") + "米");
}
}
}
@@ -4130,112 +3812,110 @@
continue;
}
GSOLayer layer2 = globeControl1.Globe.Layers.GetLayerByCaption(_pipelineLayerNames[i]);
- if (layer2 != null)
+ if (layer2 == null) continue;
+ GSOFeatureLayer flayer2 = layer2 as GSOFeatureLayer;
+ GSOFeatureDataset fdataset2 = flayer2.Dataset as GSOFeatureDataset;
+ GSOFeatures feats2 = Polygon_Contain_PointAnalysis(polygon, _pipelineLayerNames[i]);
+ for (int j = 0; j < feats2.Length; j++)
{
- GSOFeatureLayer flayer2 = layer2 as GSOFeatureLayer;
- GSOFeatureDataset fdataset2 = flayer2.Dataset as GSOFeatureDataset;
- GSOFeatures feats2 = Polygon_Contain_PointAnalysis(polygon, _pipelineLayerNames[i]);
- for (int j = 0; j < feats2.Length; j++)
- {
- GSOFeature feat2 = feats2[j];
- GSOGeoPolyline3D line2 = feats2[j].Geometry as GSOGeoPolyline3D;
- if (line2 == null) continue;
- GSOPipeLineStyle3D pipeStyle1 = line1.Style as GSOPipeLineStyle3D;
- GSOPipeLineStyle3D pipeStyle2 = line2.Style as GSOPipeLineStyle3D;
- if (pipeStyle1 == null || pipeStyle2 == null) continue;
+ GSOFeature feat2 = feats2[j];
+ GSOGeoPolyline3D line2 = feats2[j].Geometry as GSOGeoPolyline3D;
+ if (line2 == null) continue;
+ GSOPipeLineStyle3D pipeStyle1 = line1.Style as GSOPipeLineStyle3D;
+ GSOPipeLineStyle3D pipeStyle2 = line2.Style as GSOPipeLineStyle3D;
+ if (pipeStyle1 == null || pipeStyle2 == null) continue;
- double dDist = -1;
- dDist = globeControl1.Globe.Analysis3D.ComputeHorizonDistance(line1, line2, out pntIntersect1, out pntIntersect2, out pntProIntersect1, out pntProIntersect2, false);
+ double dDist = -1;
+ dDist = globeControl1.Globe.Analysis3D.ComputeHorizonDistance(line1, line2, out pntIntersect1, out pntIntersect2, out pntProIntersect1, out pntProIntersect2, false);
- if (dDist > -1)
+ if (dDist > -1)
+ {
+ dDist = Math.Abs(pntIntersect1.Z - pntIntersect2.Z) - pipeStyle1.Radius - pipeStyle2.Radius;//获得净距值
+
+ if (dDist < verticalDistance)
{
- dDist = Math.Abs(pntIntersect1.Z - pntIntersect2.Z) - pipeStyle1.Radius - pipeStyle2.Radius;//获得净距值
-
- if (dDist < verticalDistance)
+ int idx = -1;
+ GSOPoint3d markerPosition = new GSOPoint3d();
+ if (type == "垂直净距分析")
{
- int idx = -1;
- GSOPoint3d markerPosition = new GSOPoint3d();
- if (type == "垂直净距分析")
- {
- feat2.HighLight = true;
- markerPosition = LabelVerticalDistance(layerTemp, pntIntersect1, pntIntersect2, dDist, true);
+ feat2.HighLight = true;
+ markerPosition = LabelVerticalDistance(layerTemp, pntIntersect1, pntIntersect2, dDist, true);
- idx = dataGridViewX3.Rows.Add();
- dataGridViewX3.Rows[idx].Cells[0].Value = caption;
- dataGridViewX3.Rows[idx].Cells[1].Value = selectedFeature.Name;
- dataGridViewX3.Rows[idx].Cells[2].Value = layer2.Caption;
- dataGridViewX3.Rows[idx].Cells[3].Value = feat2.Name;
- dataGridViewX3.Rows[idx].Cells[4].Value = dDist.ToString("0.00");
- }
- else if (type == "碰撞分析")
- {
- feat2.HighLight = true;
- markerPosition = LabelVerticalDistance(layerTemp, pntIntersect1, pntIntersect2, dDist, false);
+ idx = dataGridViewX3.Rows.Add();
+ dataGridViewX3.Rows[idx].Cells[0].Value = caption;
+ dataGridViewX3.Rows[idx].Cells[1].Value = selectedFeature.Name;
+ dataGridViewX3.Rows[idx].Cells[2].Value = layer2.Caption;
+ dataGridViewX3.Rows[idx].Cells[3].Value = feat2.Name;
+ dataGridViewX3.Rows[idx].Cells[4].Value = dDist.ToString("0.00");
+ }
+ else if (type == "碰撞分析")
+ {
+ feat2.HighLight = true;
+ markerPosition = LabelVerticalDistance(layerTemp, pntIntersect1, pntIntersect2, dDist, false);
- selectedFeature.HighLight = true;
- idx = dataGridViewX5.Rows.Add();
- dataGridViewX5.Rows[idx].Cells[0].Value = dataGridViewX4.Rows[0].Cells[0].Value.ToString();
- dataGridViewX5.Rows[idx].Cells[1].Value = selectedFeature.Name;
- dataGridViewX5.Rows[idx].Cells[2].Value = layer2.Caption;
- dataGridViewX5.Rows[idx].Cells[3].Value = feat2.Name;
- }
- else if (type == "间距分析")
+ selectedFeature.HighLight = true;
+ idx = dataGridViewX5.Rows.Add();
+ dataGridViewX5.Rows[idx].Cells[0].Value = dataGridViewX4.Rows[0].Cells[0].Value.ToString();
+ dataGridViewX5.Rows[idx].Cells[1].Value = selectedFeature.Name;
+ dataGridViewX5.Rows[idx].Cells[2].Value = layer2.Caption;
+ dataGridViewX5.Rows[idx].Cells[3].Value = feat2.Name;
+ }
+ else if (type == "间距分析")
+ {
+ GSOGeoPolygon3D polygonSpacing = line2.CreateBuffer(horizontalDistance, true, 5, false, false);
+ if (polygonSpacing != null)
{
- GSOGeoPolygon3D polygonSpacing = line2.CreateBuffer(horizontalDistance, true, 5, false, false);
- if (polygonSpacing != null)
+ GSOFeatures horizontalFeatures = layer2.FindFeaturesInPolygon(polygonSpacing, false);
+ if (horizontalFeatures != null)
{
- GSOFeatures horizontalFeatures = layer2.FindFeaturesInPolygon(polygonSpacing, false);
- if (horizontalFeatures != null)
+ for (int m = 0; m < horizontalFeatures.Length; m++)
{
- for (int m = 0; m < horizontalFeatures.Length; m++)
+ GSOFeature horizontalFeature = horizontalFeatures[m];
+ if (horizontalFeature != null && horizontalFeature.ID == feat2.ID)
{
- GSOFeature horizontalFeature = horizontalFeatures[m];
- if (horizontalFeature != null && horizontalFeature.ID == feat2.ID)
- {
- feat2.HighLight = true;
- idx = dataGridViewAnalysisResult.Rows.Add();
- dataGridViewAnalysisResult.Rows[idx].Tag = feat2;
- dataGridViewAnalysisResult.Rows[idx].Cells[0].Value = dataGridViewLineList.Rows[0].Cells[0].Value.ToString();
- dataGridViewAnalysisResult.Rows[idx].Cells[1].Value = selectedFeature.Name;
- dataGridViewAnalysisResult.Rows[idx].Cells[2].Value = layer2.Caption;
- dataGridViewAnalysisResult.Rows[idx].Cells[3].Value = feat2.Name;
- dataGridViewAnalysisResult.Rows[idx].Cells[4].Value = dDist.ToString("0.00");
- dataGridViewAnalysisResult.Rows[idx].Cells[5].Value = horizontalDistance.ToString("0.00");
- break;
- }
+ feat2.HighLight = true;
+ idx = dataGridViewAnalysisResult.Rows.Add();
+ dataGridViewAnalysisResult.Rows[idx].Tag = feat2;
+ dataGridViewAnalysisResult.Rows[idx].Cells[0].Value = dataGridViewLineList.Rows[0].Cells[0].Value.ToString();
+ dataGridViewAnalysisResult.Rows[idx].Cells[1].Value = selectedFeature.Name;
+ dataGridViewAnalysisResult.Rows[idx].Cells[2].Value = layer2.Caption;
+ dataGridViewAnalysisResult.Rows[idx].Cells[3].Value = feat2.Name;
+ dataGridViewAnalysisResult.Rows[idx].Cells[4].Value = dDist.ToString("0.00");
+ dataGridViewAnalysisResult.Rows[idx].Cells[5].Value = horizontalDistance.ToString("0.00");
+ break;
}
}
}
}
+ }
- if (m_FeaturesWithBianhao.ContainsKey(selectedFeature.Name + "-" + feats2[j].Name) == false)
- {
- m_FeaturesWithBianhao.Add(selectedFeature.Name + "-" + feats2[j].Name, markerPosition);//添加飞行位置记录
- }
+ if (m_FeaturesWithBianhao.ContainsKey(selectedFeature.Name + "-" + feats2[j].Name) == false)
+ {
+ m_FeaturesWithBianhao.Add(selectedFeature.Name + "-" + feats2[j].Name, markerPosition);//添加飞行位置记录
+ }
- if (featCount.ContainsKey(layer2.Caption))
- {
- featCount[layer2.Caption] = featCount[layer2.Caption] + 1;
- }
- else
- {
- featCount.Add(layer2.Caption, 1);
- }
- if (featLenth.ContainsKey(layer2.Caption))
- {
- featLenth[layer2.Caption] = featLenth[layer2.Caption] + line2.GetSpaceLength(true, 6378137);
- }
- else
- {
- featLenth.Add(layer2.Caption, line2.GetSpaceLength(true, 6378137));
- }
+ if (featCount.ContainsKey(layer2.Caption))
+ {
+ featCount[layer2.Caption] = featCount[layer2.Caption] + 1;
+ }
+ else
+ {
+ featCount.Add(layer2.Caption, 1);
+ }
+ if (featLenth.ContainsKey(layer2.Caption))
+ {
+ featLenth[layer2.Caption] = featLenth[layer2.Caption] + line2.GetSpaceLength(true, 6378137);
+ }
+ else
+ {
+ featLenth.Add(layer2.Caption, line2.GetSpaceLength(true, 6378137));
}
}
- line2.ReleaseInnerPointer();
- feat2.ReleaseInnerPointer();
}
- feats2.ReleaseInnerPointer();
+ line2.ReleaseInnerPointer();
+ feat2.ReleaseInnerPointer();
}
+ feats2.ReleaseInnerPointer();
}
line1.ReleaseInnerPointer();
selectedFeature.ReleaseInnerPointer();
@@ -4302,7 +3982,7 @@
if (selectedFeature != null)
{
selectState = 1;
- HorizontalDistanceAnalysis(selectedFeature, m_PipelineLayerNames, dJingJuBiaoZhun);
+ HorizontalDistanceAnalysis(selectedFeature, Utility.m_PipelineLayerNames, dJingJuBiaoZhun);
}
}
}
@@ -4317,16 +3997,16 @@
GSOFeatures feats = flayer.GetAllFeatures();
for (int i = 0; i < feats.Length; i++)
{
- HorizontalDistanceAnalysis(feats[i], m_PipelineLayerNames, dJingJuBiaoZhun);
+ HorizontalDistanceAnalysis(feats[i], Utility.m_PipelineLayerNames, dJingJuBiaoZhun);
}
}
if (featCount.Count > 0) //统计结果
{
- for (int i = 0; i < m_PipelineLayerNames.Count; i++)
+ for (int i = 0; i < Utility.m_PipelineLayerNames.Count; i++)
{
- if (featCount.ContainsKey(m_PipelineLayerNames[i]) && featLenth.ContainsKey(m_PipelineLayerNames[i]))
+ if (featCount.ContainsKey(Utility.m_PipelineLayerNames[i]) && featLenth.ContainsKey(Utility.m_PipelineLayerNames[i]))
{
- listBox3.Items.Add(m_PipelineLayerNames[i] + ":" + featCount[m_PipelineLayerNames[i]] + "条,共" + featLenth[m_PipelineLayerNames[i]].ToString("0.00") + "米");
+ listBox3.Items.Add(Utility.m_PipelineLayerNames[i] + ":" + featCount[Utility.m_PipelineLayerNames[i]] + "条,共" + featLenth[Utility.m_PipelineLayerNames[i]].ToString("0.00") + "米");
}
}
}
@@ -4381,51 +4061,49 @@
continue;
}
GSOLayer layer2 = globeControl1.Globe.Layers.GetLayerByCaption(_pipelineLayerNames[i]);
- if (layer2 != null)
+ if (layer2 == null) continue;
+ GSOFeatureLayer flayer2 = layer2 as GSOFeatureLayer;
+ GSOFeatureDataset fdataset2 = flayer2.Dataset as GSOFeatureDataset;
+ GSOFeatures feats2 = Polygon_Contain_PointAnalysis(polygon, _pipelineLayerNames[i]);
+ for (int j = 0; j < feats2.Length; j++)
{
- GSOFeatureLayer flayer2 = layer2 as GSOFeatureLayer;
- GSOFeatureDataset fdataset2 = flayer2.Dataset as GSOFeatureDataset;
- GSOFeatures feats2 = Polygon_Contain_PointAnalysis(polygon, _pipelineLayerNames[i]);
- for (int j = 0; j < feats2.Length; j++)
+ GSOFeature feat2 = feats2[j];
+ GSOGeoPolyline3D line2 = feats2[j].Geometry as GSOGeoPolyline3D;
+ if (line2 == null)
{
- GSOFeature feat2 = feats2[j];
- GSOGeoPolyline3D line2 = feats2[j].Geometry as GSOGeoPolyline3D;
- if (line2 == null)
- {
- continue;
- }
- GSOPipeLineStyle3D pipeStyle1 = line1.Style as GSOPipeLineStyle3D;
- GSOPipeLineStyle3D pipeStyle2 = line2.Style as GSOPipeLineStyle3D;
- if (pipeStyle1 == null || pipeStyle2 == null)
- {
- continue;
- }
+ continue;
+ }
+ GSOPipeLineStyle3D pipeStyle1 = line1.Style as GSOPipeLineStyle3D;
+ GSOPipeLineStyle3D pipeStyle2 = line2.Style as GSOPipeLineStyle3D;
+ if (pipeStyle1 == null || pipeStyle2 == null)
+ {
+ continue;
+ }
- feat2.HighLight = true;
- int idx = dataGridViewX9.Rows.Add();
- dataGridViewX9.Rows[idx].Tag = feat2;
- dataGridViewX9.Rows[idx].Cells[0].Value = caption;
- dataGridViewX9.Rows[idx].Cells[1].Value = selectedFeature.Name;
- dataGridViewX9.Rows[idx].Cells[2].Value = layer2.Caption;
- dataGridViewX9.Rows[idx].Cells[3].Value = feats2[j].Name;
- dataGridViewX9.Rows[idx].Cells[4].Value = dis.ToString("0.00");
+ feat2.HighLight = true;
+ int idx = dataGridViewX9.Rows.Add();
+ dataGridViewX9.Rows[idx].Tag = feat2;
+ dataGridViewX9.Rows[idx].Cells[0].Value = caption;
+ dataGridViewX9.Rows[idx].Cells[1].Value = selectedFeature.Name;
+ dataGridViewX9.Rows[idx].Cells[2].Value = layer2.Caption;
+ dataGridViewX9.Rows[idx].Cells[3].Value = feats2[j].Name;
+ dataGridViewX9.Rows[idx].Cells[4].Value = dis.ToString("0.00");
- if (featCount.ContainsKey(layer2.Caption))
- {
- featCount[layer2.Caption] = featCount[layer2.Caption] + 1;
- }
- else
- {
- featCount.Add(layer2.Caption, 1);
- }
- if (featLenth.ContainsKey(layer2.Caption))
- {
- featLenth[layer2.Caption] = featLenth[layer2.Caption] + line2.GetSpaceLength(true, 6378137);
- }
- else
- {
- featLenth.Add(layer2.Caption, line2.GetSpaceLength(true, 6378137));
- }
+ if (featCount.ContainsKey(layer2.Caption))
+ {
+ featCount[layer2.Caption] = featCount[layer2.Caption] + 1;
+ }
+ else
+ {
+ featCount.Add(layer2.Caption, 1);
+ }
+ if (featLenth.ContainsKey(layer2.Caption))
+ {
+ featLenth[layer2.Caption] = featLenth[layer2.Caption] + line2.GetSpaceLength(true, 6378137);
+ }
+ else
+ {
+ featLenth.Add(layer2.Caption, line2.GetSpaceLength(true, 6378137));
}
}
}
@@ -4437,29 +4115,23 @@
///
private void dataGridViewX9_MouseDoubleClick(object sender, MouseEventArgs e)
{
- if (e.Button == MouseButtons.Left)
+ if (e.Button != MouseButtons.Left) return;
+ DataGridView.HitTestInfo hittestinfo = dataGridViewX9.HitTest(e.X, e.Y);
+ if (hittestinfo.RowIndex <= -1) return;
+ GSOFeature rowFeature = dataGridViewX9.Rows[hittestinfo.RowIndex].Tag as GSOFeature;
+ if (rowFeature == null) return;
+ if (rowFeature.Geometry != null && rowFeature.Geometry.Type == EnumGeometryType.GeoPolyline3D)
{
- DataGridView.HitTestInfo hittestinfo = dataGridViewX9.HitTest(e.X, e.Y);
- if (hittestinfo.RowIndex > -1)
- {
- GSOFeature rowFeature = dataGridViewX9.Rows[hittestinfo.RowIndex].Tag as GSOFeature;
- if (rowFeature != null)
- {
- if (rowFeature.Geometry != null && rowFeature.Geometry.Type == EnumGeometryType.GeoPolyline3D)
- {
- GSOGeoPolyline3D line = rowFeature.Geometry as GSOGeoPolyline3D;
- double length = line.GetSpaceLength(true, 6378137);
- GSOGeoPolyline3D lineLine = line.GetSegment(0, length / 2);
- GSOPoint3d point3d = lineLine[lineLine.PartCount - 1][lineLine[lineLine.PartCount - 1].Count - 1];
+ GSOGeoPolyline3D line = rowFeature.Geometry as GSOGeoPolyline3D;
+ double length = line.GetSpaceLength(true, 6378137);
+ GSOGeoPolyline3D lineLine = line.GetSegment(0, length / 2);
+ GSOPoint3d point3d = lineLine[lineLine.PartCount - 1][lineLine[lineLine.PartCount - 1].Count - 1];
- globeControl1.Globe.JumpToPosition(point3d, EnumAltitudeMode.Absolute, 5);
- }
- else
- {
- globeControl1.Globe.JumpToFeature(rowFeature, 5);
- }
- }
- }
+ globeControl1.Globe.JumpToPosition(point3d, EnumAltitudeMode.Absolute, 5);
+ }
+ else
+ {
+ globeControl1.Globe.JumpToFeature(rowFeature, 5);
}
}
///
@@ -4494,7 +4166,7 @@
if (selectedFeature != null)
{
selectState = 1;
- VerticalDistanceAnalysis("碰撞分析", selectedFeature, m_PipelineLayerNames, 0, 0.0);
+ VerticalDistanceAnalysis("碰撞分析", selectedFeature, Utility.m_PipelineLayerNames, 0, 0.0);
}
}
}
@@ -4510,17 +4182,17 @@
for (int i = 0; i < feats.Length; i++)
{
selectState = 1;
- VerticalDistanceAnalysis("碰撞分析", feats[i], m_PipelineLayerNames, 0, 0.0);
+ VerticalDistanceAnalysis("碰撞分析", feats[i], Utility.m_PipelineLayerNames, 0, 0.0);
}
}
if (featCount.Count > 0)
{
- for (int i = 0; i < m_PipelineLayerNames.Count; i++)
+ for (int i = 0; i < Utility.m_PipelineLayerNames.Count; i++)
{
- if (featCount.ContainsKey(m_PipelineLayerNames[i]) && featLenth.ContainsKey(m_PipelineLayerNames[i]))
+ if (featCount.ContainsKey(Utility.m_PipelineLayerNames[i]) && featLenth.ContainsKey(Utility.m_PipelineLayerNames[i]))
{
- listBox2.Items.Add(m_PipelineLayerNames[i] + ":" + featCount[m_PipelineLayerNames[i]] + "条,共" + featLenth[m_PipelineLayerNames[i]].ToString("0.00") + "米");
+ listBox2.Items.Add(Utility.m_PipelineLayerNames[i] + ":" + featCount[Utility.m_PipelineLayerNames[i]] + "条,共" + featLenth[Utility.m_PipelineLayerNames[i]].ToString("0.00") + "米");
}
}
}
@@ -4543,17 +4215,13 @@
///
private void dataGridViewX5_MouseDoubleClick(object sender, MouseEventArgs e)
{
- if (e.Button == MouseButtons.Left)
+ if (e.Button != MouseButtons.Left) return;
+ DataGridView.HitTestInfo hittestinfo = dataGridViewX5.HitTest(e.X, e.Y);
+ if (hittestinfo.RowIndex <= -1) return;
+ string key = dataGridViewX5.Rows[hittestinfo.RowIndex].Cells[1].Value.ToString().Trim() + "-" + dataGridViewX5.Rows[hittestinfo.RowIndex].Cells[3].Value.ToString().Trim();
+ if (m_FeaturesWithBianhao.ContainsKey(key))
{
- DataGridView.HitTestInfo hittestinfo = dataGridViewX5.HitTest(e.X, e.Y);
- if (hittestinfo.RowIndex > -1)
- {
- string key = dataGridViewX5.Rows[hittestinfo.RowIndex].Cells[1].Value.ToString().Trim() + "-" + dataGridViewX5.Rows[hittestinfo.RowIndex].Cells[3].Value.ToString().Trim();
- if (m_FeaturesWithBianhao.ContainsKey(key))
- {
- globeControl1.Globe.JumpToPosition(m_FeaturesWithBianhao[key], EnumAltitudeMode.Absolute, 5);
- }
- }
+ globeControl1.Globe.JumpToPosition(m_FeaturesWithBianhao[key], EnumAltitudeMode.Absolute, 5);
}
}
///
@@ -4611,25 +4279,23 @@
///
private void comboBoxEx3_SelectedIndexChanged(object sender, EventArgs e)
{
- if (comboBoxEx3.SelectedIndex > -1)
+ if (comboBoxEx3.SelectedIndex <= -1) return;
+ dataGridViewX6.Rows.Clear();
+ dataGridViewX7.Rows.Clear();
+
+ GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(comboBoxEx3.SelectedItem.ToString());
+ if (layer == null)
+ return;
+
+ GSOFeatureLayer flayer = layer as GSOFeatureLayer;
+ GSOFeatureDataset fdataset = flayer.Dataset as GSOFeatureDataset;
+ GSOFeatures feats = flayer.GetAllFeatures();
+
+ for (int i = 0; i < feats.Length; i++)
{
- dataGridViewX6.Rows.Clear();
- dataGridViewX7.Rows.Clear();
-
- GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(comboBoxEx3.SelectedItem.ToString());
- if (layer == null)
- return;
-
- GSOFeatureLayer flayer = layer as GSOFeatureLayer;
- GSOFeatureDataset fdataset = flayer.Dataset as GSOFeatureDataset;
- GSOFeatures feats = flayer.GetAllFeatures();
-
- for (int i = 0; i < feats.Length; i++)
- {
- int idx = dataGridViewX6.Rows.Add();
- dataGridViewX6.Rows[idx].Cells[0].Value = comboBoxEx3.SelectedItem.ToString();
- dataGridViewX6.Rows[idx].Cells[1].Value = feats[i].Name;
- }
+ int idx = dataGridViewX6.Rows.Add();
+ dataGridViewX6.Rows[idx].Cells[0].Value = comboBoxEx3.SelectedItem.ToString();
+ dataGridViewX6.Rows[idx].Cells[1].Value = feats[i].Name;
}
}
///
@@ -4670,51 +4336,47 @@
for (int i = 0; i < dataGridViewX6.Rows.Count; i++)
{
GSOFeature rowFeature = dataGridViewX6.Rows[i].Tag as GSOFeature;
- if (rowFeature != null)
+ if (rowFeature == null) continue;
+ string featureName = "";
+ if (isFeatureContainsBianhao(rowFeature))//判断rowFeature是否包含“编号”字段
{
- string featureName = "";
- if (isFeatureContainsBianhao(rowFeature))//判断rowFeature是否包含“编号”字段
- {
- featureName = rowFeature.GetValue(featureIDFieldName).ToString();
- }
- else
- {
- featureName = rowFeature.Name;
- }
+ featureName = rowFeature.GetValue(featureIDFieldName).ToString();
+ }
+ else
+ {
+ featureName = rowFeature.Name;
+ }
- GSOGeoPolyline3D line = rowFeature.Geometry as GSOGeoPolyline3D;
- if (line == null)
- {
- continue;
- }
- GSOPipeLineStyle3D style = line.Style as GSOPipeLineStyle3D;
- if (style == null)
- {
- continue;
- }
- if (line.PartCount > 0)
- {
- GSOPoint3ds pts = line[0];
- GSOPoint3d pt = new GSOPoint3d();
+ GSOGeoPolyline3D line = rowFeature.Geometry as GSOGeoPolyline3D;
+ if (line == null)
+ {
+ continue;
+ }
+ GSOPipeLineStyle3D style = line.Style as GSOPipeLineStyle3D;
+ if (style == null)
+ {
+ continue;
+ }
+ if (line.PartCount <= 0) continue;
+ GSOPoint3ds pts = line[0];
+ GSOPoint3d pt = new GSOPoint3d();
- for (int m = 0; m < pts.Count; m++)
- {
- if (Math.Abs(pts[m].Z + (style.Radius)) < Convert.ToDouble(textBoxX3.Text.Trim()))
- {
- rowFeature.HighLight = true;
- int idx = dataGridViewX7.Rows.Add();
- dataGridViewX7.Rows[idx].Tag = rowFeature;
- dataGridViewX7.Rows[idx].Cells[0].Value = rowFeature.Dataset.Caption;
- dataGridViewX7.Rows[idx].Cells[1].Value = featureName;
- dataGridViewX7.Rows[idx].Cells[2].Value = Math.Abs((pts[m].Z + (style.Radius))).ToString("0.00");
+ for (int m = 0; m < pts.Count; m++)
+ {
+ if (Math.Abs(pts[m].Z + (style.Radius)) < Convert.ToDouble(textBoxX3.Text.Trim()))
+ {
+ rowFeature.HighLight = true;
+ int idx = dataGridViewX7.Rows.Add();
+ dataGridViewX7.Rows[idx].Tag = rowFeature;
+ dataGridViewX7.Rows[idx].Cells[0].Value = rowFeature.Dataset.Caption;
+ dataGridViewX7.Rows[idx].Cells[1].Value = featureName;
+ dataGridViewX7.Rows[idx].Cells[2].Value = Math.Abs((pts[m].Z + (style.Radius))).ToString("0.00");
- pt.X = pts[m].X;
- pt.Y = pts[m].Y;
- pt.Z = 0;
- markerPosition = LabelVerticalDistance(layerTemp, pts[m], pt, Convert.ToDouble(dataGridViewX7.Rows[idx].Cells[2].Value), true);
- break;
- }
- }
+ pt.X = pts[m].X;
+ pt.Y = pts[m].Y;
+ pt.Z = 0;
+ markerPosition = LabelVerticalDistance(layerTemp, pts[m], pt, Convert.ToDouble(dataGridViewX7.Rows[idx].Cells[2].Value), true);
+ break;
}
}
}
@@ -4743,29 +4405,26 @@
GSOGeoPolyline3D line = f.Geometry as GSOGeoPolyline3D;
if (line == null) continue;
GSOPipeLineStyle3D style = line.Style as GSOPipeLineStyle3D;
- if (style == null) continue;
- if (line.PartCount > 0)
+ if (style == null || line.PartCount <= 0) continue;
+ GSOPoint3ds pts = line[0];
+ GSOPoint3d pt = new GSOPoint3d();
+ for (int m = 0; m < pts.Count; m++)
{
- GSOPoint3ds pts = line[0];
- GSOPoint3d pt = new GSOPoint3d();
- for (int m = 0; m < pts.Count; m++)
+ if (Math.Abs(pts[m].Z + (style.Radius)) < Convert.ToDouble(textBoxX3.Text.Trim()))
{
- if (Math.Abs(pts[m].Z + (style.Radius)) < Convert.ToDouble(textBoxX3.Text.Trim()))
- {
- f.HighLight = true;
- int idx = dataGridViewX7.Rows.Add();
- dataGridViewX7.Rows[idx].Tag = f;
- dataGridViewX7.Rows[idx].Cells[0].Value = layer.Caption;
- dataGridViewX7.Rows[idx].Cells[1].Value = featureName;
- dataGridViewX7.Rows[idx].Cells[2].Value = Math.Abs((pts[m].Z + (style.Radius))).ToString("0.00");
+ f.HighLight = true;
+ int idx = dataGridViewX7.Rows.Add();
+ dataGridViewX7.Rows[idx].Tag = f;
+ dataGridViewX7.Rows[idx].Cells[0].Value = layer.Caption;
+ dataGridViewX7.Rows[idx].Cells[1].Value = featureName;
+ dataGridViewX7.Rows[idx].Cells[2].Value = Math.Abs((pts[m].Z + (style.Radius))).ToString("0.00");
- pt.X = pts[m].X;
- pt.Y = pts[m].Y;
- pt.Z = 0;
- markerPosition = LabelVerticalDistance(layerTemp, pts[m], pt, Convert.ToDouble(dataGridViewX7.Rows[idx].Cells[2].Value), true);
+ pt.X = pts[m].X;
+ pt.Y = pts[m].Y;
+ pt.Z = 0;
+ markerPosition = LabelVerticalDistance(layerTemp, pts[m], pt, Convert.ToDouble(dataGridViewX7.Rows[idx].Cells[2].Value), true);
- break;
- }
+ break;
}
}
}
@@ -4789,29 +4448,23 @@
///
private void dataGridViewX7_MouseDoubleClick(object sender, MouseEventArgs e)
{
- if (e.Button == MouseButtons.Left)
+ if (e.Button != MouseButtons.Left) return;
+ DataGridView.HitTestInfo hittestinfo = dataGridViewX7.HitTest(e.X, e.Y);
+ if (hittestinfo.RowIndex <= -1) return;
+ GSOFeature rowFeature = dataGridViewX7.Rows[hittestinfo.RowIndex].Tag as GSOFeature;
+ if (rowFeature == null) return;
+ if (rowFeature.Geometry != null && rowFeature.Geometry.Type == EnumGeometryType.GeoPolyline3D)
{
- DataGridView.HitTestInfo hittestinfo = dataGridViewX7.HitTest(e.X, e.Y);
- if (hittestinfo.RowIndex > -1)
- {
- GSOFeature rowFeature = dataGridViewX7.Rows[hittestinfo.RowIndex].Tag as GSOFeature;
- if (rowFeature != null)
- {
- if (rowFeature.Geometry != null && rowFeature.Geometry.Type == EnumGeometryType.GeoPolyline3D)
- {
- GSOGeoPolyline3D line = rowFeature.Geometry as GSOGeoPolyline3D;
- double length = line.GetSpaceLength(true, 6378137);
- GSOGeoPolyline3D lineLine = line.GetSegment(0, length / 2);
- GSOPoint3d point3d = lineLine[lineLine.PartCount - 1][lineLine[lineLine.PartCount - 1].Count - 1];
+ GSOGeoPolyline3D line = rowFeature.Geometry as GSOGeoPolyline3D;
+ double length = line.GetSpaceLength(true, 6378137);
+ GSOGeoPolyline3D lineLine = line.GetSegment(0, length / 2);
+ GSOPoint3d point3d = lineLine[lineLine.PartCount - 1][lineLine[lineLine.PartCount - 1].Count - 1];
- globeControl1.Globe.JumpToPosition(point3d, EnumAltitudeMode.Absolute, 5);
- }
- else
- {
- globeControl1.Globe.JumpToFeature(rowFeature, 5);
- }
- }
- }
+ globeControl1.Globe.JumpToPosition(point3d, EnumAltitudeMode.Absolute, 5);
+ }
+ else
+ {
+ globeControl1.Globe.JumpToFeature(rowFeature, 5);
}
}
///
@@ -4972,85 +4625,83 @@
///
private void ExportExcel(string type, DataGridView _dataGridView, ListBox _listBox)
{
- if (_dataGridView.Rows.Count > 0)
+ if (_dataGridView.Rows.Count <= 0) return;
+ SaveFileDialog dlg = new SaveFileDialog();
+ dlg.Filter = "Excel files (*.xls)|*.xls";
+ dlg.FilterIndex = 0;
+ dlg.RestoreDirectory = true;
+ //dlg.CreatePrompt = true;
+ dlg.Title = "保存为Excel文件";
+ dlg.FileName = type + "-" + DateTime.Now.ToString("yyyyMMdd") + ".xls";
+ if (dlg.ShowDialog() == DialogResult.OK)
{
- SaveFileDialog dlg = new SaveFileDialog();
- dlg.Filter = "Excel files (*.xls)|*.xls";
- dlg.FilterIndex = 0;
- dlg.RestoreDirectory = true;
- //dlg.CreatePrompt = true;
- dlg.Title = "保存为Excel文件";
- dlg.FileName = type + "-" + DateTime.Now.ToString("yyyyMMdd") + ".xls";
- if (dlg.ShowDialog() == DialogResult.OK)
+ Stream myStream;
+ myStream = dlg.OpenFile();
+ StreamWriter sw = new StreamWriter(myStream, Encoding.GetEncoding(-0));
+ string columnTitle = "";
+ try
{
- Stream myStream;
- myStream = dlg.OpenFile();
- StreamWriter sw = new StreamWriter(myStream, Encoding.GetEncoding(-0));
- string columnTitle = "";
- try
+ if (_listBox != null)
{
- if (_listBox != null)
+ string strList = "";
+ for (int i = 0; i < _listBox.Items.Count; i++)
{
- string strList = "";
- for (int i = 0; i < _listBox.Items.Count; i++)
- {
- strList += _listBox.Items[i] + @"/";
- }
- sw.WriteLine("内容:" + type + " 日期:" + DateTime.Now.ToString("yyyy-MM-dd") + " 结果:" + strList);
+ strList += _listBox.Items[i] + @"/";
}
- else
+ sw.WriteLine("内容:" + type + " 日期:" + DateTime.Now.ToString("yyyy-MM-dd") + " 结果:" + strList);
+ }
+ else
+ {
+ sw.WriteLine("内容:" + type + " 日期:" + DateTime.Now.ToString("yyyy-MM-dd"));
+ }
+ //写入列标题
+ for (int i = 0; i < _dataGridView.ColumnCount; i++)
+ {
+ if (i > 0)
{
- sw.WriteLine("内容:" + type + " 日期:" + DateTime.Now.ToString("yyyy-MM-dd"));
+ columnTitle += "\t";
}
- //写入列标题
- for (int i = 0; i < _dataGridView.ColumnCount; i++)
- {
- if (i > 0)
- {
- columnTitle += "\t";
- }
- columnTitle += _dataGridView.Columns[i].HeaderText;
- }
- sw.WriteLine(columnTitle);
+ columnTitle += _dataGridView.Columns[i].HeaderText;
+ }
+ sw.WriteLine(columnTitle);
- //写入列内容
- for (int j = 0; j < _dataGridView.Rows.Count; j++)
+ //写入列内容
+ for (int j = 0; j < _dataGridView.Rows.Count; j++)
+ {
+ string columnValue = "";
+ for (int k = 0; k < _dataGridView.Columns.Count; k++)
{
- string columnValue = "";
- for (int k = 0; k < _dataGridView.Columns.Count; k++)
+ if (k > 0)
{
- if (k > 0)
- {
- columnValue += "\t";
- }
- if (_dataGridView.Rows[j].Cells[k].Value == null)
- {
- columnValue += "";
- }
- else
- {
- columnValue += _dataGridView.Rows[j].Cells[k].Value.ToString().Trim();
- }
+ columnValue += "\t";
}
+ if (_dataGridView.Rows[j].Cells[k].Value == null)
+ {
+ columnValue += "";
+ }
+ else
+ {
+ columnValue += _dataGridView.Rows[j].Cells[k].Value.ToString().Trim();
+ }
+ }
- sw.WriteLine(columnValue);
- }
- sw.Close();
- myStream.Close();
- if (MessageBox.Show("导出Excel文件成功!是否打开?", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
- {
- Process.Start(dlg.FileName);
- }
+ sw.WriteLine(columnValue);
}
- catch (Exception ex)
+ sw.Close();
+ myStream.Close();
+ if (MessageBox.Show("导出Excel文件成功!是否打开?", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
{
- //MessageBox.Show(ex.ToString());
+ Process.Start(dlg.FileName);
}
- finally
- {
- sw.Close();
- myStream.Close();
- }
+ }
+ catch (Exception ex)
+ {
+ //MessageBox.Show(ex.ToString());
+ }
+ finally
+ {
+ sw.Close();
+ myStream.Close();
}
}
}
@@ -5141,24 +4792,22 @@
///
private void comboBoxEx2_SelectedIndexChanged(object sender, EventArgs e)
{
- if (comboBoxEx2.SelectedIndex > -1)
- {
- listBox2.Items.Clear();
- dataGridViewX4.Rows.Clear();
- dataGridViewX5.Rows.Clear();
- GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(comboBoxEx2.SelectedItem.ToString());
- if (layer == null)
- return;
+ if (comboBoxEx2.SelectedIndex <= -1) return;
+ listBox2.Items.Clear();
+ dataGridViewX4.Rows.Clear();
+ dataGridViewX5.Rows.Clear();
+ GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(comboBoxEx2.SelectedItem.ToString());
+ if (layer == null)
+ return;
- GSOFeatureLayer flayer = layer as GSOFeatureLayer;
- GSOFeatureDataset fdataset = flayer.Dataset as GSOFeatureDataset;
- GSOFeatures feats = flayer.GetAllFeatures();
- for (int i = 0; i < feats.Length; i++)
- {
- int idx = dataGridViewX4.Rows.Add();
- dataGridViewX4.Rows[idx].Cells[0].Value = comboBoxEx2.SelectedItem.ToString();
- dataGridViewX4.Rows[idx].Cells[1].Value = feats[i].Name;
- }
+ GSOFeatureLayer flayer = layer as GSOFeatureLayer;
+ GSOFeatureDataset fdataset = flayer.Dataset as GSOFeatureDataset;
+ GSOFeatures feats = flayer.GetAllFeatures();
+ for (int i = 0; i < feats.Length; i++)
+ {
+ int idx = dataGridViewX4.Rows.Add();
+ dataGridViewX4.Rows[idx].Cells[0].Value = comboBoxEx2.SelectedItem.ToString();
+ dataGridViewX4.Rows[idx].Cells[1].Value = feats[i].Name;
}
}
///
@@ -5343,7 +4992,7 @@
if (selectedFeature != null)
{
selectState = 1;
- VerticalDistanceAnalysis("间距分析", selectedFeature, m_PipelineLayerNames, dVerticalJingJuBiaoZhun, dHorizontalJingJuBiaoZhun);//分析
+ VerticalDistanceAnalysis("间距分析", selectedFeature, Utility.m_PipelineLayerNames, dVerticalJingJuBiaoZhun, dHorizontalJingJuBiaoZhun);//分析
}
}
}
@@ -5374,16 +5023,16 @@
for (int i = 0; i < feats.Length; i++)
{
selectState = 1;
- VerticalDistanceAnalysis("间距分析", feats[i], m_PipelineLayerNames, dVerticalJingJuBiaoZhun, dHorizontalJingJuBiaoZhun);//分析
+ VerticalDistanceAnalysis("间距分析", feats[i], Utility.m_PipelineLayerNames, dVerticalJingJuBiaoZhun, dHorizontalJingJuBiaoZhun);//分析
}
}
if (featCount.Count > 0)
{
- for (int i = 0; i < m_PipelineLayerNames.Count; i++)
+ for (int i = 0; i < Utility.m_PipelineLayerNames.Count; i++)
{
- if (featCount.ContainsKey(m_PipelineLayerNames[i]) && featLenth.ContainsKey(m_PipelineLayerNames[i]))
+ if (featCount.ContainsKey(Utility.m_PipelineLayerNames[i]) && featLenth.ContainsKey(Utility.m_PipelineLayerNames[i]))
{
- listBoxStasticsResult.Items.Add(m_PipelineLayerNames[i] + ":" + featCount[m_PipelineLayerNames[i]] + "条,共" + featLenth[m_PipelineLayerNames[i]].ToString("0.00") + "米");
+ listBoxStasticsResult.Items.Add(Utility.m_PipelineLayerNames[i] + ":" + featCount[Utility.m_PipelineLayerNames[i]] + "条,共" + featLenth[Utility.m_PipelineLayerNames[i]].ToString("0.00") + "米");
}
}
}
@@ -5948,24 +5597,20 @@
///
private void addNodeToLayerManagerNode(GSOLayer layer)
{
- if (layer != null)
- {
- GSODataset dataset = layer.Dataset;
- CheckDatasetGeoReference(layer.Dataset, "");
+ if (layer == null) return;
+ GSODataset dataset = layer.Dataset;
+ CheckDatasetGeoReference(layer.Dataset, "");
- TreeNode node = new TreeNode();
- node.Tag = layer;
- node.Text = layer.Dataset.Caption;
- node.ImageIndex = 0;
- node.SelectedImageIndex = 0;
- node.Checked = layer.Visible;
+ TreeNode node = new TreeNode();
+ node.Tag = layer;
+ node.Text = layer.Dataset.Caption;
+ node.ImageIndex = 0;
+ node.SelectedImageIndex = 0;
+ node.Checked = layer.Visible;
- if (!layerManagerNode.Nodes.Contains(node))
- {
- layerManagerNode.Nodes.Insert(0, node);
- layerManagerNode.Expand();
- }
- }
+ if (layerManagerNode.Nodes.Contains(node)) return;
+ layerManagerNode.Nodes.Insert(0, node);
+ layerManagerNode.Expand();
}
///
/// 获取指定图层中最后一个feature对象的名称对应的整数
@@ -6008,31 +5653,29 @@
for (int i = 0; i < markerStrs.Length; i++)
{
GSOLayer markerLayer = globeControl1.Globe.Layers.GetLayerByCaption(markerStrs[i]);
- if (markerLayer != null)
+ if (markerLayer == null) continue;
+ if (markerStrs[i] != layerName)
{
- if (markerStrs[i] != layerName)
+ markerLayer.Visible = false;
+ if (layerMarkerTree.Nodes[0].Nodes.Count > i)
{
- markerLayer.Visible = false;
- if (layerMarkerTree.Nodes[0].Nodes.Count > i)
+ layerMarkerTree.Nodes[0].Nodes[i].Checked = false;
+ }
+ }
+ else
+ {
+ markerLayer.Visible = true;
+ for (int j = 0; j < markerLayer.GetAllFeatures().Length; j++)
+ {
+ GSOFeature markerFeature = markerLayer.GetAt(j);
+ if (markerFeature != null)
{
- layerMarkerTree.Nodes[0].Nodes[i].Checked = false;
+ markerFeature.Visible = false;
}
}
- else
+ if (layerMarkerTree.Nodes[0].Nodes.Count > i)
{
- markerLayer.Visible = true;
- for (int j = 0; j < markerLayer.GetAllFeatures().Length; j++)
- {
- GSOFeature markerFeature = markerLayer.GetAt(j);
- if (markerFeature != null)
- {
- markerFeature.Visible = false;
- }
- }
- if (layerMarkerTree.Nodes[0].Nodes.Count > i)
- {
- layerMarkerTree.Nodes[0].Nodes[i].Checked = true;
- }
+ layerMarkerTree.Nodes[0].Nodes[i].Checked = true;
}
}
}
@@ -6138,15 +5781,12 @@
private void toolStripMenuItem2_Click(object sender, EventArgs e)
{
TreeNode node = contextMenuStrip3.Tag as TreeNode;
+ if (node == null) return;
GSOFeature feature3d = node.Tag as GSOFeature;
- if (node == null)
- return;
- if (feature3d != null)
- {
- feature3d.Delete();
- globeControl1.Globe.Refresh();
- node.Remove();
- }
+ if (feature3d == null) return;
+ feature3d.Delete();
+ globeControl1.Globe.Refresh();
+ node.Remove();
}
///
/// 图层目录树的 节点对应的复选框选中状态改变事件处理
@@ -6213,12 +5853,10 @@
{
TreeNode node = contextMenuStrip2.Tag as TreeNode;
GSOLayer l = globeControl1.Globe.Layers.GetLayerByCaption(node.Text);
- if (l != null)
- {
- l.RemoveAllFeature();
- node.Nodes.Clear();
- globeControl1.Refresh();
- }
+ if (l == null) return;
+ l.RemoveAllFeature();
+ node.Nodes.Clear();
+ globeControl1.Refresh();
}
//定时检查传感器的状态
public Timer timerOfSensor = null;
@@ -6375,7 +6013,7 @@
}
frmShResult = new FrmShResult(dVerticalJingJuBiaoZhun, dHorizontalJingJuBiaoZhun, shlayername, globeControl1,
- m_PipelineLayerNames);
+ Utility.m_PipelineLayerNames);
if (boolfrmShResult) return;
@@ -6482,13 +6120,11 @@
frmModify = new FrmMnModify(globeControl1, shlayername, shresultLists);
- if (boolfrmModify == false)
- {
- frmModify.Owner = this;
- frmModify.Location = new Point(Width - frmModify.Width - 10, Height - frmModify.Height - 50);
- frmModify.Show();
- boolfrmModify = true;
- }
+ if (boolfrmModify != false) return;
+ frmModify.Owner = this;
+ frmModify.Location = new Point(Width - frmModify.Width - 10, Height - frmModify.Height - 50);
+ frmModify.Show();
+ boolfrmModify = true;
}
///
/// 一键审核中调节透明度
@@ -6500,7 +6136,7 @@
LogManager.saveLog(Utility.userName, sliderItem1.Text);
globeControl1.Globe.GroundOpaque = 100 - sliderItem1.Value;
- GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(roadLayerName); //("180fd");
+ GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(Utility.roadLayerName); //("180fd");
if (layer != null)
layer.Opaque = 100 - sliderItem1.Value;
@@ -6516,7 +6152,7 @@
LogManager.saveLog(Utility.userName, sliderItem3.Text);
globeControl1.Globe.GroundOpaque = 100 - sliderItem3.Value;
- GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(roadLayerName); //("180fd");
+ GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(Utility.roadLayerName); //("180fd");
if (layer != null)
layer.Opaque = 100 - sliderItem3.Value;
optiValue = sliderItem3.Value;
@@ -6647,7 +6283,7 @@
{
LogManager.saveLog(Utility.userName, buttonItemSearch9.Text);
- FrmKeywordQuery.ShowForm(globeControl1, m_PipelineLayerNames, InitDataGridViewX1);
+ FrmKeywordQuery.ShowForm(globeControl1, Utility.m_PipelineLayerNames, InitDataGridViewX1);
}
///
/// 编号查询
@@ -6658,7 +6294,7 @@
{
LogManager.saveLog(Utility.userName, buttonItemSearch2.Text);
- FrmCodingQuery.ShowForm(globeControl1, m_PipelineLayerNames, InitDataGridViewX1);
+ FrmCodingQuery.ShowForm(globeControl1, Utility.m_PipelineLayerNames, InitDataGridViewX1);
}
///
/// 坐标查询
@@ -6680,7 +6316,7 @@
{
LogManager.saveLog(Utility.userName, buttonItemSearch10.Text);
- FrmFittingQuery.ShowForm(globeControl1, instrumenLayerNames, InitDataGridViewX1);
+ FrmFittingQuery.ShowForm(globeControl1, Utility.instrumenLayerNames, InitDataGridViewX1);
}
///
/// 管径查询
@@ -6691,7 +6327,7 @@
{
LogManager.saveLog(Utility.userName, buttonItemSearch4.Text);
- FrmDiameterQuery.ShowForm(globeControl1, m_PipelineLayerNames, InitDataGridViewX1);
+ FrmDiameterQuery.ShowForm(globeControl1, Utility.m_PipelineLayerNames, InitDataGridViewX1);
}
///
/// 材质查询
@@ -6702,7 +6338,7 @@
{
LogManager.saveLog(Utility.userName, buttonItemSearch5.Text);
- FrmMaterialSel.ShowForm(globeControl1, m_PipelineLayerNames, InitDataGridViewX1);
+ FrmMaterialSel.ShowForm(globeControl1, Utility.m_PipelineLayerNames, InitDataGridViewX1);
}
///
/// 基本查询
@@ -6751,8 +6387,8 @@
if (feature == null && feature.Geometry == null || (feature.Geometry.Type == EnumGeometryType.GeoPolygon3D
|| feature.Geometry.Type == EnumGeometryType.GeoWater))
return;
- ClassSearchAnalysis.ResultRelationAnalysis(globeControl1, feature, valueLayerNames, workwellLayerNames,
- instrumenLayerNames, pipefittingLayerNames, m_PipelineLayerNames, valueAllowance);
+ ClassSearchAnalysis.ResultRelationAnalysis(globeControl1, feature, Utility.valueLayerNames, Utility.workwellLayerNames,
+ Utility.instrumenLayerNames, Utility.pipefittingLayerNames, Utility.m_PipelineLayerNames, valueAllowance);
}
}
#endregion
@@ -6789,20 +6425,20 @@
// ClearCloseValvesAnalysis();//清除阀门分析
//清除管线间距分析
- if (disFeature != null)
- {
- if (disFeature.ID != 0)
- {
- globeControl1.Globe.MemoryLayer.RemoveFeatureByID(disFeature.ID);
- }
- }
- if (featureDis != null)
- {
- if (featureDis.ID != 0)
- {
- globeControl1.Globe.MemoryLayer.RemoveFeatureByID(featureDis.ID);
- }
- }
+ //if (disFeature != null)
+ //{
+ // if (disFeature.ID != 0)
+ // {
+ // globeControl1.Globe.MemoryLayer.RemoveFeatureByID(disFeature.ID);
+ // }
+ //}
+ //if (featureDis != null)
+ //{
+ // if (featureDis.ID != 0)
+ // {
+ // globeControl1.Globe.MemoryLayer.RemoveFeatureByID(featureDis.ID);
+ // }
+ //}
GSOFeatures feats = globeControl1.Globe.MemoryLayer.GetFeatureByName("粒子要素", true);
if (feats.Length > 0)
@@ -6838,7 +6474,7 @@
clearFeatureHighLight();//取消管线高亮
- GSOLayer layerGround = globeControl1.Globe.Layers.GetLayerByCaption(roadLayerName);//("180fd");
+ GSOLayer layerGround = globeControl1.Globe.Layers.GetLayerByCaption(Utility.roadLayerName);//("180fd");
if (layerGround != null)
{
layerGround.Visible = true;
@@ -6856,7 +6492,7 @@
private void buttonItemTJ1_ALL_Click(object sender, EventArgs e)
{
LogManager.saveLog(Utility.userName, "管线长度统计");
- FrmAllPipelineStatis frm = new FrmAllPipelineStatis(globeControl1, null, InitDataGridViewX1, m_PipelineLayerNames);
+ FrmAllPipelineStatis frm = new FrmAllPipelineStatis(globeControl1, null, InitDataGridViewX1, Utility.m_PipelineLayerNames);
frm.Show(this);
}
///
@@ -6930,7 +6566,7 @@
{
LogManager.saveLog(Utility.userName, "管径分段统计");
- Frmpipediameterstatis.ShowForm(globeControl1, m_PipelineLayerNames, 0);
+ Frmpipediameterstatis.ShowForm(globeControl1, Utility.m_PipelineLayerNames, 0);
}
///
/// 管径分段统计绘制区域统计
@@ -6942,7 +6578,7 @@
LogManager.saveLog(Utility.userName, "管径分段统计");
trackflag = null;
- Frmpipediameterstatis.ShowForm(globeControl1, m_PipelineLayerNames, 1);
+ Frmpipediameterstatis.ShowForm(globeControl1, Utility.m_PipelineLayerNames, 1);
}
///
/// 埋深分段统计全区域统计
@@ -6952,7 +6588,7 @@
private void buttonItemTJ5_ALL_Click(object sender, EventArgs e)
{
LogManager.saveLog(Utility.userName, "埋深分段统计");
- FrmpipeDeepstatis.ShowForm(globeControl1, m_PipelineLayerNames, 0);
+ FrmpipeDeepstatis.ShowForm(globeControl1, Utility.m_PipelineLayerNames, 0);
}
///
/// 埋深分段统计绘制区域统计
@@ -6963,7 +6599,7 @@
{
LogManager.saveLog(Utility.userName, "埋深分段统计");
trackflag = null;
- FrmpipeDeepstatis.ShowForm(globeControl1, m_PipelineLayerNames, 1);
+ FrmpipeDeepstatis.ShowForm(globeControl1, Utility.m_PipelineLayerNames, 1);
}
///
/// 管径分类统计全区域统计
@@ -6974,7 +6610,7 @@
{
LogManager.saveLog(Utility.userName, "管径分类汇总");
- FrmpipeDiametergather.ShowForm(globeControl1, m_PipelineLayerNames, 0);
+ FrmpipeDiametergather.ShowForm(globeControl1, Utility.m_PipelineLayerNames, 0);
}
///
/// 管径分类统计绘制区域统计
@@ -6986,7 +6622,7 @@
LogManager.saveLog(Utility.userName, "管径分类汇总");
trackflag = null;
- FrmpipeDiametergather.ShowForm(globeControl1, m_PipelineLayerNames, 1);
+ FrmpipeDiametergather.ShowForm(globeControl1, Utility.m_PipelineLayerNames, 1);
}
///
/// 材质分类统计全区域统计
@@ -6997,7 +6633,7 @@
{
LogManager.saveLog(Utility.userName, "材质分类汇总");
- FrmpipeMaterialGather.ShowForm(globeControl1, m_PipelineLayerNames, 0);
+ FrmpipeMaterialGather.ShowForm(globeControl1, Utility.m_PipelineLayerNames, 0);
}
///
/// 材质分类统计绘制区域统计
@@ -7009,7 +6645,7 @@
LogManager.saveLog(Utility.userName, "材质分类汇总");
trackflag = null;
- FrmpipeMaterialGather.ShowForm(globeControl1, m_PipelineLayerNames, 1);
+ FrmpipeMaterialGather.ShowForm(globeControl1, Utility.m_PipelineLayerNames, 1);
}
///
/// 附属物分类统计全区域统计
@@ -7020,7 +6656,7 @@
{
LogManager.saveLog(Utility.userName, "附属物分类汇总");
- FrmAccessoriesgather.ShowForm(globeControl1, instrumenLayerNames, 0);
+ FrmAccessoriesgather.ShowForm(globeControl1, Utility.instrumenLayerNames, 0);
}
///
/// 附属物分类统计绘制区域统计
@@ -7032,7 +6668,7 @@
LogManager.saveLog(Utility.userName, "附属物分类汇总");
trackflag = null;
- FrmAccessoriesgather.ShowForm(globeControl1, instrumenLayerNames, 1);
+ FrmAccessoriesgather.ShowForm(globeControl1, Utility.instrumenLayerNames, 1);
}
#region Predaotr,断面分析
///
@@ -7113,7 +6749,7 @@
//日志记录
LogManager.saveLog(Utility.userName, buttonItemFX3_1.Text);
- FrmGenAndFaMenTopu frm = new FrmGenAndFaMenTopu(globeControl1, m_PipelineLayerNames, valueLayerNames);
+ FrmGenAndFaMenTopu frm = new FrmGenAndFaMenTopu(globeControl1, Utility.m_PipelineLayerNames, Utility.valueLayerNames);
frm.Show(this);
}
#region Predator :拓扑分析
@@ -7166,7 +6802,7 @@
//日志记录
LogManager.saveLog(Utility.userName, buttonItemFX3_4.Text);
- FrmFlow frm = new FrmFlow(globeControl1, m_PipelineLayerNames);
+ FrmFlow frm = new FrmFlow(globeControl1, Utility.m_PipelineLayerNames);
frm.Show(this);
}
///
@@ -7369,16 +7005,14 @@
GSOFeature f = null;
GSOLayer layer = null;
globeControl1.Globe.GetSelectObject(i, out f, out layer);
- if (f != null && f.Dataset.Caption == "隧道")
+ if (f == null || f.Dataset.Caption != "隧道") continue;
+ tunnelCount++;
+ f.Delete();
+ if (layer != null)
{
- tunnelCount++;
- f.Delete();
- if (layer != null)
- {
- globeControl1.Globe.AddToEditHistroy(layer, f, EnumEditType.Delete);
- }
- globeControl1.Refresh();
+ globeControl1.Globe.AddToEditHistroy(layer, f, EnumEditType.Delete);
}
+ globeControl1.Refresh();
}
if (tunnelCount == 0)
{
@@ -7620,7 +7254,7 @@
return;
}
GSOGeoPolyline3D selLine = resFeature.Geometry as GSOGeoPolyline3D;
- if (selLine[0].Count <= 1)
+ if (selLine==null||selLine[0].Count <= 1)//wxl增加为空判断,下面方法同理
{
return;
}
@@ -7763,14 +7397,12 @@
LogManager.saveLog(Utility.userName, buttonItemBZ10.Text);
setMarkerLayerUnVisible("红线工具");
GSOLayer l = globeControl1.Globe.Layers.GetLayerByCaption("红线工具");
- if (l != null)
- {
- l.Visible = true;
- globeControl1.Globe.DestLayerFeatureAdd = l;
- l.Editable = true;
- globeControl1.Globe.Action = EnumAction3D.DrawPolygon;
- m_isDrawRedPology = true;
- }
+ if (l == null) return;
+ l.Visible = true;
+ globeControl1.Globe.DestLayerFeatureAdd = l;
+ l.Editable = true;
+ globeControl1.Globe.Action = EnumAction3D.DrawPolygon;
+ m_isDrawRedPology = true;
}
///
/// 标注管理
@@ -8100,7 +7732,7 @@
{
//日志记录
LogManager.saveLog(Utility.userName, buttonItemSH5.Text);
- FrmCityServerLineAnalysis frm = new FrmCityServerLineAnalysis(globeControl1, m_PipelineLayerNames);
+ FrmCityServerLineAnalysis frm = new FrmCityServerLineAnalysis(globeControl1, Utility.m_PipelineLayerNames);
frm.Show(this);
}
@@ -8287,7 +7919,7 @@
//日志记录
LogManager.saveLog(Utility.userName, buttonItemBJ1.Text);
- frmPipeSetEdit frm = new frmPipeSetEdit(globeControl1, m_PipelineLayerNames);
+ frmPipeSetEdit frm = new frmPipeSetEdit(globeControl1, Utility.m_PipelineLayerNames);
if (frm.ShowDialog() == DialogResult.OK)
{
m_AddPipeLine = true;
@@ -8306,7 +7938,7 @@
//日志记录
LogManager.saveLog(Utility.userName, buttonItemBJ2.Text);
- FrmSetGoalLayer frm = new FrmSetGoalLayer(globeControl1, instrumenLayerNames, "附属物");
+ FrmSetGoalLayer frm = new FrmSetGoalLayer(globeControl1, Utility.instrumenLayerNames, "附属物");
if (frm.ShowDialog() == DialogResult.OK)
{
GSOLayer featureAddLayer = TreeNodeFeatureLayer();
@@ -8327,15 +7959,13 @@
//日志记录
LogManager.saveLog(Utility.userName, buttonItemBJ3.Text);
- FrmSetGoalLayer frm = new FrmSetGoalLayer(globeControl1, pipefittingLayerNames, "管点");
+ FrmSetGoalLayer frm = new FrmSetGoalLayer(globeControl1, Utility.pipefittingLayerNames, "管点");
if (frm.ShowDialog() == DialogResult.OK)
{
GSOLayer featureAddLayer = TreeNodeFeatureLayer();
- if (featureAddLayer != null)
- {
- FrmAddPipeFitting dlg = new FrmAddPipeFitting(globeControl1, featureAddLayer);
- dlg.Show(this);
- }
+ if (featureAddLayer == null) return;
+ FrmAddPipeFitting dlg = new FrmAddPipeFitting(globeControl1, featureAddLayer);
+ dlg.Show(this);
}
}
///
@@ -8516,50 +8146,50 @@
#region 导出成dxf格式
List listVectorNames = new List();
- for (int i = 0; i < m_PipelineLayerNames.Count; i++)
+ for (int i = 0; i < Utility.m_PipelineLayerNames.Count; i++)
{
- if (m_PipelineLayerNames[i] == "移动" || m_PipelineLayerNames[i] == "联通"
- || m_PipelineLayerNames[i] == "电信" || m_PipelineLayerNames[i] == "共通"
- || m_PipelineLayerNames[i] == "有线电视" || m_PipelineLayerNames[i] == "交通信号"
- || m_PipelineLayerNames[i] == "供电")
+ if (Utility.m_PipelineLayerNames[i] == "移动" || Utility.m_PipelineLayerNames[i] == "联通"
+ || Utility.m_PipelineLayerNames[i] == "电信" || Utility.m_PipelineLayerNames[i] == "共通"
+ || Utility.m_PipelineLayerNames[i] == "有线电视" || Utility.m_PipelineLayerNames[i] == "交通信号"
+ || Utility.m_PipelineLayerNames[i] == "供电")
{
continue;
}
- if (listVectorNames.Contains(m_PipelineLayerNames[i]) == false)
+ if (!listVectorNames.Contains(Utility.m_PipelineLayerNames[i]))
{
- listVectorNames.Add(m_PipelineLayerNames[i]);
+ listVectorNames.Add(Utility.m_PipelineLayerNames[i]);
}
}
- for (int i = 0; i < valueLayerNames.Count; i++)
+ for (int i = 0; i < Utility.valueLayerNames.Count; i++)
{
- if (listVectorNames.Contains(valueLayerNames[i]) == false)
+ if (!listVectorNames.Contains(Utility.valueLayerNames[i]))
{
- listVectorNames.Add(valueLayerNames[i]);
+ listVectorNames.Add(Utility.valueLayerNames[i]);
}
}
- for (int i = 0; i < workwellLayerNames.Count; i++)
+ for (int i = 0; i < Utility.workwellLayerNames.Count; i++)
{
- if (listVectorNames.Contains(workwellLayerNames[i]) == false)
+ if (!listVectorNames.Contains(Utility.workwellLayerNames[i]))
{
- listVectorNames.Add(workwellLayerNames[i]);
+ listVectorNames.Add(Utility.workwellLayerNames[i]);
}
}
- for (int i = 0; i < instrumenLayerNames.Count; i++)
+ for (int i = 0; i < Utility.instrumenLayerNames.Count; i++)
{
- if (listVectorNames.Contains(instrumenLayerNames[i]) == false)
+ if (!listVectorNames.Contains(Utility.instrumenLayerNames[i]))
{
- listVectorNames.Add(instrumenLayerNames[i]);
+ listVectorNames.Add(Utility.instrumenLayerNames[i]);
}
}
- for (int i = 0; i < pipefittingLayerNames.Count; i++)
+ for (int i = 0; i < Utility.pipefittingLayerNames.Count; i++)
{
- if (listVectorNames.Contains(pipefittingLayerNames[i]) == false)
+ if (!listVectorNames.Contains(Utility.pipefittingLayerNames[i]))
{
- listVectorNames.Add(pipefittingLayerNames[i]);
+ listVectorNames.Add(Utility.pipefittingLayerNames[i]);
}
}
- FrmExportCADS frm = new FrmExportCADS(globeControl1, listVectorNames);//m_PipelineLayerNames);
+ FrmExportCADS frm = new FrmExportCADS(globeControl1, listVectorNames);//Utility.m_PipelineLayerNames);
frm.ShowDialog();
#endregion
}
@@ -8574,39 +8204,39 @@
LogManager.saveLog(Utility.userName, buttonItemBJ10_2.Text);
List listVectorNames = new List();
- for (int i = 0; i < m_PipelineLayerNames.Count; i++)
+ for (int i = 0; i < Utility.m_PipelineLayerNames.Count; i++)
{
- if (listVectorNames.Contains(m_PipelineLayerNames[i]) == false)
+ if (!listVectorNames.Contains(Utility.m_PipelineLayerNames[i]))
{
- listVectorNames.Add(m_PipelineLayerNames[i]);
+ listVectorNames.Add(Utility.m_PipelineLayerNames[i]);
}
}
- for (int i = 0; i < valueLayerNames.Count; i++)
+ for (int i = 0; i < Utility.valueLayerNames.Count; i++)
{
- if (listVectorNames.Contains(valueLayerNames[i]) == false)
+ if (!listVectorNames.Contains(Utility.valueLayerNames[i]))
{
- listVectorNames.Add(valueLayerNames[i]);
+ listVectorNames.Add(Utility.valueLayerNames[i]);
}
}
- for (int i = 0; i < workwellLayerNames.Count; i++)
+ for (int i = 0; i < Utility.workwellLayerNames.Count; i++)
{
- if (listVectorNames.Contains(workwellLayerNames[i]) == false)
+ if (!listVectorNames.Contains(Utility.workwellLayerNames[i]))
{
- listVectorNames.Add(workwellLayerNames[i]);
+ listVectorNames.Add(Utility.workwellLayerNames[i]);
}
}
- for (int i = 0; i < instrumenLayerNames.Count; i++)
+ for (int i = 0; i < Utility.instrumenLayerNames.Count; i++)
{
- if (listVectorNames.Contains(instrumenLayerNames[i]) == false)
+ if (!listVectorNames.Contains(Utility.instrumenLayerNames[i]))
{
- listVectorNames.Add(instrumenLayerNames[i]);
+ listVectorNames.Add(Utility.instrumenLayerNames[i]);
}
}
- for (int i = 0; i < pipefittingLayerNames.Count; i++)
+ for (int i = 0; i < Utility.pipefittingLayerNames.Count; i++)
{
- if (listVectorNames.Contains(pipefittingLayerNames[i]) == false)
+ if (!listVectorNames.Contains(Utility.pipefittingLayerNames[i]))
{
- listVectorNames.Add(pipefittingLayerNames[i]);
+ listVectorNames.Add(Utility.pipefittingLayerNames[i]);
}
}
FrmExportVector frm = new FrmExportVector(globeControl1, listVectorNames);
@@ -8668,9 +8298,9 @@
List listPipelineLayers = new List();
GSOLayer layer = null;
- for (int i = 0; i < m_PipelineLayerNames.Count; i++)
+ for (int i = 0; i < Utility.m_PipelineLayerNames.Count; i++)
{
- layer = globeControl1.Globe.Layers.GetLayerByCaption(m_PipelineLayerNames[i]);
+ layer = globeControl1.Globe.Layers.GetLayerByCaption(Utility.m_PipelineLayerNames[i]);
if (layer == null) continue;
listPipelineLayers.Add(layer);
}
@@ -8737,7 +8367,7 @@
LogManager.saveLog(Utility.userName, sliderItem2.Text);
globeControl1.Globe.GroundOpaque = 100 - sliderItem2.Value;
- GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(roadLayerName);//("180fd");
+ GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(Utility.roadLayerName);//("180fd");
if (layer != null)
{
layer.Opaque = 100 - sliderItem2.Value;
@@ -8876,7 +8506,7 @@
globeControl1.Globe.GroundOpaque = 100 - sliderGroundTransSet1.Value;
- layer = globeControl1.Globe.Layers.GetLayerByCaption(roadLayerName);//("180fd");
+ layer = globeControl1.Globe.Layers.GetLayerByCaption(Utility.roadLayerName);//("180fd");
if (layer != null)
{
layer.Opaque = 100 - sliderGroundTransSet1.Value;
@@ -9145,7 +8775,7 @@
LogManager.saveLog(Utility.userName, buttonItem8.Text);
int width = Width;
- FrmCompareFeature.ShowForm(globeControl1, globeControl2, layerTemp, layerTemp2, m_PipelineLayerNames, sgPipeLayersNames, width);
+ FrmCompareFeature.ShowForm(globeControl1, globeControl2, layerTemp, layerTemp2, Utility.m_PipelineLayerNames, Utility.sgPipeLayersNames, width);
}
///
/// 红线审核导出图片
diff --git a/MarkInfo.cs b/MarkInfo.cs
index 44e630b..68ab5bd 100644
--- a/MarkInfo.cs
+++ b/MarkInfo.cs
@@ -182,7 +182,7 @@
public void showMarker(List marks, GSOLayer layer)
{
layer.Visible = true;
- MessageBox.Show(layer.GetAllFeatures().Length + "");
+ //MessageBox.Show(layer.GetAllFeatures().Length + "");
foreach(MarkInfo mark in marks)
{
addLabel(mark,layer);
diff --git a/NewFunction/FrmExportVector.cs b/NewFunction/FrmExportVector.cs
index 9e68b54..c85a9b9 100644
--- a/NewFunction/FrmExportVector.cs
+++ b/NewFunction/FrmExportVector.cs
@@ -10,8 +10,8 @@
{
public partial class FrmExportVector :Office2007Form
{
- GSOGlobeControl globeControl1;
- List pipeLineNames = new List();
+ private GSOGlobeControl globeControl1;
+ private List pipeLineNames;
public FrmExportVector(GSOGlobeControl globeControl, List listPipelineNames)
{
InitializeComponent();
diff --git a/Utility.cs b/Utility.cs
index add8556..d6b89cd 100644
--- a/Utility.cs
+++ b/Utility.cs
@@ -74,6 +74,23 @@
public static string ghdbpwd;
public static List locationList;
+ public static string filename = Application.StartupPath + "\\Config.xml";
+ public static string filenameSensor = Application.StartupPath + "\\sensorConfig.xml";
+ public static string filenamePipelineType = Application.StartupPath + "\\PipelineType.xml";
+ public static string filenameDbconfig = Application.StartupPath + "\\databaseConfig.xml";
+ public static string filenameLocation = Application.StartupPath + "\\Location.xml";
+ #region wxl 从MainFrm重构来,读取一遍config.xml
+ public static List m_PipelineLayerNames = new List();//线图层名称
+ public static List workwellLayerNames = new List();//工井图层名称
+ public static List valueLayerNames = new List();//阀门图层名称
+ public static List instrumenLayerNames = new List();//附属物图层名称
+ public static List pipefittingLayerNames = new List();//管件图层名称
+ public static List sgPipeLayersNames = new List();//施工管线图层名称
+
+ public static Dictionary dictionaryNetLayerNameAndCaption = new Dictionary();
+
+ public static string roadLayerName = "";
+ #endregion wxl
public static void SetBallons(GSOBalloon featureTooltip, GSOBalloonEx balloonEx)
{
featureTooltip.CacheFilePath = Application.StartupPath + "/GeoScene/Globe/Temp";
@@ -102,19 +119,19 @@
balloonEx.SetColorBkType(EnumBkColorTypeEx.SKY);
}
- public static GSOFeature FindFeatureByUserID(GSOFeatureDataset featdataset, string fieldname, string value)
- {
- GSOFeatures feats = featdataset.GetAllFeatures();
- for (int i = 0; i < feats.Length; i++)
- {
- GSOFeature feat = feats[i];
- if (feat.GetFieldAsString(fieldname) == value)
- {
- return feat;
- }
- }
- return null;
- }
+ //public static GSOFeature FindFeatureByUserID(GSOFeatureDataset featdataset, string fieldname, string value)
+ //{
+ // GSOFeatures feats = featdataset.GetAllFeatures();
+ // for (int i = 0; i < feats.Length; i++)
+ // {
+ // GSOFeature feat = feats[i];
+ // if (feat.GetFieldAsString(fieldname) == value)
+ // {
+ // return feat;
+ // }
+ // }
+ // return null;
+ //}
public static GSOPoint2d XYZ_2_Latlon(double x, double y)
{
@@ -156,7 +173,7 @@
{
ret.AppendFormat("{0:X2}", b);
}
- ret.ToString();
+ //ret.ToString();
return ret.ToString();
}
//
@@ -195,11 +212,7 @@
return features;
}
- public static string filename = Application.StartupPath + "\\Config.xml";
- public static string filenameSensor = Application.StartupPath + "\\sensorConfig.xml";
- public static string filenamePipelineType = Application.StartupPath + "\\PipelineType.xml";
- public static string filenameDbconfig = Application.StartupPath + "\\databaseConfig.xml";
- public static string filenameLocation = Application.StartupPath + "\\Location.xml";
+
//程序启动的时候读取配置文件
public static void SetParams()
{
@@ -251,19 +264,54 @@
}
else if (XmlReader.Name == "layerchild")
{
- LayerChild child = new LayerChild();
- child.attriLabel = XmlReader["label"].Trim();
- child.attriLayer = XmlReader["layer"].Trim();
- child.attriType = XmlReader["type"].Trim();
- LayerChilds.Add(child);
- LayerLabels.Add(XmlReader["label"].Trim());
- LayerNames.Add(XmlReader["layer"].Trim());
+ var layername = XmlReader["layer"].Trim();
+ var label = XmlReader["label"].Trim();
+ var type = XmlReader["type"].Trim();
- string layername = XmlReader["layer"].Trim();
+ LayerChild child = new LayerChild();
+ child.attriLabel = label;
+ child.attriLayer =layername;
+ child.attriType = type;
+ LayerChilds.Add(child);
+ LayerLabels.Add(label);
+ LayerNames.Add(layername);
+
+ dictionaryNetLayerNameAndCaption.Add(layername, label);
+
if (layername.EndsWith("管线"))
{
LayerNamesList.Add(layername.Substring(0, layername.Length - 2));
}
+ if (!type.Equals("db"))
+ {
+ if (XmlReader["isRoad"] != null)
+ {
+ roadLayerName = label;
+ }
+ }else if (XmlReader["isPipeLine"] != null)
+ {
+ m_PipelineLayerNames.Add(label);
+ }
+ else if (XmlReader["isWorkWell"] != null)
+ {
+ workwellLayerNames.Add(label);
+ }
+ else if (XmlReader["isValve"] != null)
+ {
+ valueLayerNames.Add(label);
+ }
+ else if (XmlReader["isAccess"] != null)
+ {
+ instrumenLayerNames.Add(label);
+ }
+ else if (XmlReader["isCharacter"] != null)
+ {
+ pipefittingLayerNames.Add(label);
+ }
+ else if (XmlReader["isSgData"] != null)
+ {
+ sgPipeLayersNames.Add(label);
+ }
}
else if (XmlReader.Name == "Terrain")
@@ -591,41 +639,37 @@
}
*/
- ////根据图层中的对象特征来划分内容
- public static string getCodeByName(string name)
- {
- string code = "";
- if (listPipelineType != null)
- {
- List list = listPipelineType;
+ //////根据图层中的对象特征来划分内容
+ //public static string getCodeByName(string name)
+ //{
+ // string code = "";
+ // if (listPipelineType != null)
+ // {
+ // List list = listPipelineType;
- for (int i = 0; i < list.Count; i++)
- {
- PipelineType pipelineType = listPipelineType[i];
- if (name == pipelineType.name)
- {
- code = pipelineType.code;
- break;
- }
- }
- }
- return code;
- }
+ // for (int i = 0; i < list.Count; i++)
+ // {
+ // PipelineType pipelineType = listPipelineType[i];
+ // if (name == pipelineType.name)
+ // {
+ // code = pipelineType.code;
+ // break;
+ // }
+ // }
+ // }
+ // return code;
+ //}
//根据附属物图层名字得到里面含有的附属物
public static string[] getAccStrsByLayer(string layername)
{
string[] accStrs = null;
string sql = "select 附属物名称 from " + layername + " group by 附属物名称";
- //DataTable table = OledbHelper.QueryTable(sql);
DataSet dataset = OledbHelper.getDataSet(sql, layername);
- if (dataset != null)
+ if (dataset == null) return null;
+ accStrs = new string[dataset.Tables[0].Rows.Count];
+ for (int i = 0; i < dataset.Tables[0].Rows.Count; i++)
{
- accStrs = new string[dataset.Tables[0].Rows.Count];
- for (int i = 0; i < dataset.Tables[0].Rows.Count; i++)
- {
- accStrs[i] = dataset.Tables[0].Rows[i][0].ToString();
- }
- return accStrs;
+ accStrs[i] = dataset.Tables[0].Rows[i][0].ToString();
}
return accStrs;
}
diff --git a/bin/x86/Debug/Cyberpipe.exe b/bin/x86/Debug/Cyberpipe.exe
index 8ed566e..b41a66f 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 f96b262..204ed44 100644
--- a/bin/x86/Debug/Cyberpipe.pdb
+++ b/bin/x86/Debug/Cyberpipe.pdb
Binary files differ