diff --git a/.gitignore b/.gitignore index 873811e..8ee30f6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ Thumbs.db *.obj +*.exe *.user *.aps *.pch diff --git a/.gitignore b/.gitignore index 873811e..8ee30f6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ Thumbs.db *.obj +*.exe *.user *.aps *.pch diff --git a/Cyberpipe.suo b/Cyberpipe.suo index 2c39f54..9fb7248 100644 --- a/Cyberpipe.suo +++ b/Cyberpipe.suo Binary files differ diff --git a/.gitignore b/.gitignore index 873811e..8ee30f6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ Thumbs.db *.obj +*.exe *.user *.aps *.pch diff --git a/Cyberpipe.suo b/Cyberpipe.suo index 2c39f54..9fb7248 100644 --- a/Cyberpipe.suo +++ b/Cyberpipe.suo Binary files differ diff --git a/MainFrm.cs b/MainFrm.cs index 7375063..5822ae8 100644 --- a/MainFrm.cs +++ b/MainFrm.cs @@ -4435,66 +4435,61 @@ /// /// /// - //private void dataGridViewX1_MouseClick(object sender, MouseEventArgs e) - //{ - // if (redSH == false) - // { - // GSOFeature rowFeature = contextMenuStrip1.Tag as GSOFeature; + private void dataGridViewX1_MouseClick(object sender, MouseEventArgs e) + { + + GSOFeature rowFeature = contextMenuStrip1.Tag as GSOFeature; - // if (rowFeature != null && rowFeature.HighLight == true) - // { - // rowFeature.HighLight = false; - // } + if (rowFeature != null && rowFeature.HighLight == true) + { + rowFeature.HighLight = false; + } - // if (e.Button == MouseButtons.Right) - // { - // DataGridView.HitTestInfo hittestinfo = dataGridViewX1.HitTest(e.X, e.Y); - // if (hittestinfo.RowIndex > -1) - // { - // string featureName = ""; - // if (dataGridViewX1.Columns.Contains("编号")) - // { - // featureName = dataGridViewX1.Rows[hittestinfo.RowIndex].Cells["编号"].Value.ToString(); - // } - // else - // { - // featureName = dataGridViewX1.Rows[hittestinfo.RowIndex].Cells["标识器编号"].Value.ToString(); - // } - // contextMenuStrip1.Show(dataGridViewX1, e.X, e.Y); + if (e.Button == MouseButtons.Right) + { + DataGridView.HitTestInfo hittestinfo = dataGridViewX1.HitTest(e.X, e.Y); + if (hittestinfo.RowIndex > -1) + { + string featureName = ""; + if (dataGridViewX1.Columns.Contains("编号")) + { + featureName = dataGridViewX1.Rows[hittestinfo.RowIndex].Cells["编号"].Value.ToString(); + } + else + { + featureName = dataGridViewX1.Rows[hittestinfo.RowIndex].Cells["标识器编号"].Value.ToString(); + } + contextMenuStrip1.Show(dataGridViewX1, e.X, e.Y); - // featureName = featureName.Trim(); + featureName = featureName.Trim(); - // GSOLayer layer = null; - // if (m_CurrentQueryLayer == null) - // { + GSOLayer layer = null; + if (m_CurrentQueryLayer == null) + { - // //layer = globeControl1.Globe.Layers.GetLayerByCaption(dataGridViewX1.Rows[rowIndex].Cells["编号"].Value.ToString()); - // layer = globeControl1.Globe.Layers.GetLayerByCaption(toolStripNumbers.Text); - // } - // else - // { - // layer = globeControl1.Globe.Layers.GetLayerByCaption(m_CurrentQueryLayer); - // } + //layer = globeControl1.Globe.Layers.GetLayerByCaption(dataGridViewX1.Rows[rowIndex].Cells["编号"].Value.ToString()); + layer = globeControl1.Globe.Layers.GetLayerByCaption(toolStripNumbers.Text); + } + else + { + layer = globeControl1.Globe.Layers.GetLayerByCaption(m_CurrentQueryLayer); + } - // if (layer == null) - // return; - // GSOFeatures features = layer.GetFeatureByName(featureName, false); - // for (int j = 0; j < features.Length; j++) - // { - // if (features[j].Name == featureName) - // { - // contextMenuStrip1.Tag = features[j]; - // break; - // } - // } - // } - // } - // } - // else - // { - - // } - //} + if (layer == null) + return; + GSOFeatures features = layer.GetFeatureByName(featureName, false); + for (int j = 0; j < features.Length; j++) + { + if (features[j].Name == featureName) + { + contextMenuStrip1.Tag = features[j]; + break; + } + } + } + } + + } FrmAnalysisGuiHuaResult from; /// @@ -4502,97 +4497,97 @@ /// /// /// - //private void dataGridViewX1_MouseDoubleClick(object sender, MouseEventArgs e) - //{ - // if (redSH == false) - // { - // if (e.Button == MouseButtons.Left) - // { - // DataGridView.HitTestInfo hittestinfo = dataGridViewX1.HitTest(e.X, e.Y); - // if (hittestinfo.RowIndex > -1) - // { - // string featureName = ""; - // if (dataGridViewX1.Columns.Contains("编号")) - // { - // featureName = dataGridViewX1.Rows[hittestinfo.RowIndex].Cells["编号"].Value.ToString(); - // } - // else - // { - // featureName = dataGridViewX1.Rows[hittestinfo.RowIndex].Cells["标识器编号"].Value.ToString(); - // } - // featureName = featureName.Trim(); + private void dataGridViewX1_MouseDoubleClick(object sender, MouseEventArgs e) + { + //if (redSH == false) + //{ + if (e.Button == MouseButtons.Left) + { + DataGridView.HitTestInfo hittestinfo = dataGridViewX1.HitTest(e.X, e.Y); + if (hittestinfo.RowIndex > -1) + { + string featureName = ""; + if (dataGridViewX1.Columns.Contains("编号")) + { + featureName = dataGridViewX1.Rows[hittestinfo.RowIndex].Cells["编号"].Value.ToString(); + } + else + { + featureName = dataGridViewX1.Rows[hittestinfo.RowIndex].Cells["标识器编号"].Value.ToString(); + } + featureName = featureName.Trim(); - // GSOLayer layer = null; - // if (m_CurrentQueryLayer == null) - // { + GSOLayer layer = null; + if (m_CurrentQueryLayer == null) + { - // //layer = globeControl1.Globe.Layers.GetLayerByCaption(dataGridViewX1.Rows[rowIndex].Cells["编号"].Value.ToString()); - // layer = globeControl1.Globe.Layers.GetLayerByCaption(toolStripNumbers.Text); - // } - // else - // { - // layer = globeControl1.Globe.Layers.GetLayerByCaption(m_CurrentQueryLayer); - // } + //layer = globeControl1.Globe.Layers.GetLayerByCaption(dataGridViewX1.Rows[rowIndex].Cells["编号"].Value.ToString()); + layer = globeControl1.Globe.Layers.GetLayerByCaption(toolStripNumbers.Text); + } + else + { + layer = globeControl1.Globe.Layers.GetLayerByCaption(m_CurrentQueryLayer); + } - // if (layer != null) - // { - // GSOFeatures features = layer.GetFeatureByName(featureName, false); - // for (int j = 0; j < features.Length; j++) - // { - // if (features[j].Name == featureName) - // { - // //m_feature = features[j]; - // GSOFeature rowFeature = features[j]; - // if (rowFeature == null) - // continue; - // 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]; - // globeControl1.Globe.FlyToPosition(point3d, EnumAltitudeMode.Absolute, 0, 45, 5); - // LightMenu_Click(sender, e); - // } - // else - // { - // globeControl1.Globe.FlyToFeature(rowFeature, 0, 45, 3); - // } - // } - // } - // } - // } - // } - // } - // else - // { - // if (e.Button == MouseButtons.Left) - // { - // if (from != null && !from.IsDisposed) - // { - // try - // { - // from.Close(); - // } - // catch (Exception ex) - // { } - - // } - // DataGridView.HitTestInfo hittestinfo = dataGridViewX1.HitTest(e.X, e.Y); - // if (hittestinfo.RowIndex >= 0) - // { - // string layer = dataGridViewX1.Rows[hittestinfo.RowIndex].Cells["管线类型"].Value.ToString(); - // string hxName = dataGridViewX1.Rows[hittestinfo.RowIndex].Cells["红线编号"].Value.ToString(); - // FrmAnalysisGuiHuaResult frm = new FrmAnalysisGuiHuaResult(globeControl1, lineStruct, panelOfTable, dataGridViewX1, layer, hxName); - // frm.Location = new Point(this.Width - frm.Width - 10, this.Height - frm.Height-20); - // frm.Show(this); - - // from = frm; - // } - // } - // } - //} + if (layer != null) + { + GSOFeatures features = layer.GetFeatureByName(featureName, false); + for (int j = 0; j < features.Length; j++) + { + if (features[j].Name == featureName) + { + //m_feature = features[j]; + GSOFeature rowFeature = features[j]; + if (rowFeature == null) + continue; + 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]; + globeControl1.Globe.FlyToPosition(point3d, EnumAltitudeMode.Absolute, 0, 45, 5); + LightMenu_Click(sender, e); + } + else + { + globeControl1.Globe.FlyToFeature(rowFeature, 0, 45, 3); + } + } + } + } + } + } + //} + //else + //{ + // if (e.Button == MouseButtons.Left) + // { + // if (from != null && !from.IsDisposed) + // { + // try + // { + // from.Close(); + // } + // catch (Exception ex) + // { } + + // } + // DataGridView.HitTestInfo hittestinfo = dataGridViewX1.HitTest(e.X, e.Y); + // if (hittestinfo.RowIndex >= 0) + // { + // string layer = dataGridViewX1.Rows[hittestinfo.RowIndex].Cells["管线类型"].Value.ToString(); + // string hxName = dataGridViewX1.Rows[hittestinfo.RowIndex].Cells["红线编号"].Value.ToString(); + // FrmAnalysisGuiHuaResult frm = new FrmAnalysisGuiHuaResult(globeControl1, lineStruct, panelOfTable, dataGridViewX1, layer, hxName); + // frm.Location = new Point(this.Width - frm.Width - 10, this.Height - frm.Height - 20); + // frm.Show(this); + + // from = frm; + // } + // } + //} + } /// /// 绘制线 菜单 diff --git a/.gitignore b/.gitignore index 873811e..8ee30f6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ Thumbs.db *.obj +*.exe *.user *.aps *.pch diff --git a/Cyberpipe.suo b/Cyberpipe.suo index 2c39f54..9fb7248 100644 --- a/Cyberpipe.suo +++ b/Cyberpipe.suo Binary files differ diff --git a/MainFrm.cs b/MainFrm.cs index 7375063..5822ae8 100644 --- a/MainFrm.cs +++ b/MainFrm.cs @@ -4435,66 +4435,61 @@ /// /// /// - //private void dataGridViewX1_MouseClick(object sender, MouseEventArgs e) - //{ - // if (redSH == false) - // { - // GSOFeature rowFeature = contextMenuStrip1.Tag as GSOFeature; + private void dataGridViewX1_MouseClick(object sender, MouseEventArgs e) + { + + GSOFeature rowFeature = contextMenuStrip1.Tag as GSOFeature; - // if (rowFeature != null && rowFeature.HighLight == true) - // { - // rowFeature.HighLight = false; - // } + if (rowFeature != null && rowFeature.HighLight == true) + { + rowFeature.HighLight = false; + } - // if (e.Button == MouseButtons.Right) - // { - // DataGridView.HitTestInfo hittestinfo = dataGridViewX1.HitTest(e.X, e.Y); - // if (hittestinfo.RowIndex > -1) - // { - // string featureName = ""; - // if (dataGridViewX1.Columns.Contains("编号")) - // { - // featureName = dataGridViewX1.Rows[hittestinfo.RowIndex].Cells["编号"].Value.ToString(); - // } - // else - // { - // featureName = dataGridViewX1.Rows[hittestinfo.RowIndex].Cells["标识器编号"].Value.ToString(); - // } - // contextMenuStrip1.Show(dataGridViewX1, e.X, e.Y); + if (e.Button == MouseButtons.Right) + { + DataGridView.HitTestInfo hittestinfo = dataGridViewX1.HitTest(e.X, e.Y); + if (hittestinfo.RowIndex > -1) + { + string featureName = ""; + if (dataGridViewX1.Columns.Contains("编号")) + { + featureName = dataGridViewX1.Rows[hittestinfo.RowIndex].Cells["编号"].Value.ToString(); + } + else + { + featureName = dataGridViewX1.Rows[hittestinfo.RowIndex].Cells["标识器编号"].Value.ToString(); + } + contextMenuStrip1.Show(dataGridViewX1, e.X, e.Y); - // featureName = featureName.Trim(); + featureName = featureName.Trim(); - // GSOLayer layer = null; - // if (m_CurrentQueryLayer == null) - // { + GSOLayer layer = null; + if (m_CurrentQueryLayer == null) + { - // //layer = globeControl1.Globe.Layers.GetLayerByCaption(dataGridViewX1.Rows[rowIndex].Cells["编号"].Value.ToString()); - // layer = globeControl1.Globe.Layers.GetLayerByCaption(toolStripNumbers.Text); - // } - // else - // { - // layer = globeControl1.Globe.Layers.GetLayerByCaption(m_CurrentQueryLayer); - // } + //layer = globeControl1.Globe.Layers.GetLayerByCaption(dataGridViewX1.Rows[rowIndex].Cells["编号"].Value.ToString()); + layer = globeControl1.Globe.Layers.GetLayerByCaption(toolStripNumbers.Text); + } + else + { + layer = globeControl1.Globe.Layers.GetLayerByCaption(m_CurrentQueryLayer); + } - // if (layer == null) - // return; - // GSOFeatures features = layer.GetFeatureByName(featureName, false); - // for (int j = 0; j < features.Length; j++) - // { - // if (features[j].Name == featureName) - // { - // contextMenuStrip1.Tag = features[j]; - // break; - // } - // } - // } - // } - // } - // else - // { - - // } - //} + if (layer == null) + return; + GSOFeatures features = layer.GetFeatureByName(featureName, false); + for (int j = 0; j < features.Length; j++) + { + if (features[j].Name == featureName) + { + contextMenuStrip1.Tag = features[j]; + break; + } + } + } + } + + } FrmAnalysisGuiHuaResult from; /// @@ -4502,97 +4497,97 @@ /// /// /// - //private void dataGridViewX1_MouseDoubleClick(object sender, MouseEventArgs e) - //{ - // if (redSH == false) - // { - // if (e.Button == MouseButtons.Left) - // { - // DataGridView.HitTestInfo hittestinfo = dataGridViewX1.HitTest(e.X, e.Y); - // if (hittestinfo.RowIndex > -1) - // { - // string featureName = ""; - // if (dataGridViewX1.Columns.Contains("编号")) - // { - // featureName = dataGridViewX1.Rows[hittestinfo.RowIndex].Cells["编号"].Value.ToString(); - // } - // else - // { - // featureName = dataGridViewX1.Rows[hittestinfo.RowIndex].Cells["标识器编号"].Value.ToString(); - // } - // featureName = featureName.Trim(); + private void dataGridViewX1_MouseDoubleClick(object sender, MouseEventArgs e) + { + //if (redSH == false) + //{ + if (e.Button == MouseButtons.Left) + { + DataGridView.HitTestInfo hittestinfo = dataGridViewX1.HitTest(e.X, e.Y); + if (hittestinfo.RowIndex > -1) + { + string featureName = ""; + if (dataGridViewX1.Columns.Contains("编号")) + { + featureName = dataGridViewX1.Rows[hittestinfo.RowIndex].Cells["编号"].Value.ToString(); + } + else + { + featureName = dataGridViewX1.Rows[hittestinfo.RowIndex].Cells["标识器编号"].Value.ToString(); + } + featureName = featureName.Trim(); - // GSOLayer layer = null; - // if (m_CurrentQueryLayer == null) - // { + GSOLayer layer = null; + if (m_CurrentQueryLayer == null) + { - // //layer = globeControl1.Globe.Layers.GetLayerByCaption(dataGridViewX1.Rows[rowIndex].Cells["编号"].Value.ToString()); - // layer = globeControl1.Globe.Layers.GetLayerByCaption(toolStripNumbers.Text); - // } - // else - // { - // layer = globeControl1.Globe.Layers.GetLayerByCaption(m_CurrentQueryLayer); - // } + //layer = globeControl1.Globe.Layers.GetLayerByCaption(dataGridViewX1.Rows[rowIndex].Cells["编号"].Value.ToString()); + layer = globeControl1.Globe.Layers.GetLayerByCaption(toolStripNumbers.Text); + } + else + { + layer = globeControl1.Globe.Layers.GetLayerByCaption(m_CurrentQueryLayer); + } - // if (layer != null) - // { - // GSOFeatures features = layer.GetFeatureByName(featureName, false); - // for (int j = 0; j < features.Length; j++) - // { - // if (features[j].Name == featureName) - // { - // //m_feature = features[j]; - // GSOFeature rowFeature = features[j]; - // if (rowFeature == null) - // continue; - // 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]; - // globeControl1.Globe.FlyToPosition(point3d, EnumAltitudeMode.Absolute, 0, 45, 5); - // LightMenu_Click(sender, e); - // } - // else - // { - // globeControl1.Globe.FlyToFeature(rowFeature, 0, 45, 3); - // } - // } - // } - // } - // } - // } - // } - // else - // { - // if (e.Button == MouseButtons.Left) - // { - // if (from != null && !from.IsDisposed) - // { - // try - // { - // from.Close(); - // } - // catch (Exception ex) - // { } - - // } - // DataGridView.HitTestInfo hittestinfo = dataGridViewX1.HitTest(e.X, e.Y); - // if (hittestinfo.RowIndex >= 0) - // { - // string layer = dataGridViewX1.Rows[hittestinfo.RowIndex].Cells["管线类型"].Value.ToString(); - // string hxName = dataGridViewX1.Rows[hittestinfo.RowIndex].Cells["红线编号"].Value.ToString(); - // FrmAnalysisGuiHuaResult frm = new FrmAnalysisGuiHuaResult(globeControl1, lineStruct, panelOfTable, dataGridViewX1, layer, hxName); - // frm.Location = new Point(this.Width - frm.Width - 10, this.Height - frm.Height-20); - // frm.Show(this); - - // from = frm; - // } - // } - // } - //} + if (layer != null) + { + GSOFeatures features = layer.GetFeatureByName(featureName, false); + for (int j = 0; j < features.Length; j++) + { + if (features[j].Name == featureName) + { + //m_feature = features[j]; + GSOFeature rowFeature = features[j]; + if (rowFeature == null) + continue; + 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]; + globeControl1.Globe.FlyToPosition(point3d, EnumAltitudeMode.Absolute, 0, 45, 5); + LightMenu_Click(sender, e); + } + else + { + globeControl1.Globe.FlyToFeature(rowFeature, 0, 45, 3); + } + } + } + } + } + } + //} + //else + //{ + // if (e.Button == MouseButtons.Left) + // { + // if (from != null && !from.IsDisposed) + // { + // try + // { + // from.Close(); + // } + // catch (Exception ex) + // { } + + // } + // DataGridView.HitTestInfo hittestinfo = dataGridViewX1.HitTest(e.X, e.Y); + // if (hittestinfo.RowIndex >= 0) + // { + // string layer = dataGridViewX1.Rows[hittestinfo.RowIndex].Cells["管线类型"].Value.ToString(); + // string hxName = dataGridViewX1.Rows[hittestinfo.RowIndex].Cells["红线编号"].Value.ToString(); + // FrmAnalysisGuiHuaResult frm = new FrmAnalysisGuiHuaResult(globeControl1, lineStruct, panelOfTable, dataGridViewX1, layer, hxName); + // frm.Location = new Point(this.Width - frm.Width - 10, this.Height - frm.Height - 20); + // frm.Show(this); + + // from = frm; + // } + // } + //} + } /// /// 绘制线 菜单 diff --git a/MainFrm.designer.cs b/MainFrm.designer.cs index 06700ee..04cb929 100644 --- a/MainFrm.designer.cs +++ b/MainFrm.designer.cs @@ -810,7 +810,7 @@ this.toolStripDropDownButton1.Image = ((System.Drawing.Image)(resources.GetObject("toolStripDropDownButton1.Image"))); this.toolStripDropDownButton1.ImageTransparentColor = System.Drawing.Color.Magenta; this.toolStripDropDownButton1.Name = "toolStripDropDownButton1"; - this.toolStripDropDownButton1.Size = new System.Drawing.Size(45, 20); + this.toolStripDropDownButton1.Size = new System.Drawing.Size(45, 21); this.toolStripDropDownButton1.Text = "帮助"; this.toolStripDropDownButton1.Visible = false; this.toolStripDropDownButton1.Click += new System.EventHandler(this.toolStripDropDownButton1_Click); @@ -3745,6 +3745,8 @@ this.dataGridViewX1.RowTemplate.Height = 23; this.dataGridViewX1.Size = new System.Drawing.Size(1147, 61); this.dataGridViewX1.TabIndex = 13; + this.dataGridViewX1.MouseClick += new System.Windows.Forms.MouseEventHandler(this.dataGridViewX1_MouseClick); + this.dataGridViewX1.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.dataGridViewX1_MouseDoubleClick); // // statusStrip2 // diff --git a/.gitignore b/.gitignore index 873811e..8ee30f6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ Thumbs.db *.obj +*.exe *.user *.aps *.pch diff --git a/Cyberpipe.suo b/Cyberpipe.suo index 2c39f54..9fb7248 100644 --- a/Cyberpipe.suo +++ b/Cyberpipe.suo Binary files differ diff --git a/MainFrm.cs b/MainFrm.cs index 7375063..5822ae8 100644 --- a/MainFrm.cs +++ b/MainFrm.cs @@ -4435,66 +4435,61 @@ /// /// /// - //private void dataGridViewX1_MouseClick(object sender, MouseEventArgs e) - //{ - // if (redSH == false) - // { - // GSOFeature rowFeature = contextMenuStrip1.Tag as GSOFeature; + private void dataGridViewX1_MouseClick(object sender, MouseEventArgs e) + { + + GSOFeature rowFeature = contextMenuStrip1.Tag as GSOFeature; - // if (rowFeature != null && rowFeature.HighLight == true) - // { - // rowFeature.HighLight = false; - // } + if (rowFeature != null && rowFeature.HighLight == true) + { + rowFeature.HighLight = false; + } - // if (e.Button == MouseButtons.Right) - // { - // DataGridView.HitTestInfo hittestinfo = dataGridViewX1.HitTest(e.X, e.Y); - // if (hittestinfo.RowIndex > -1) - // { - // string featureName = ""; - // if (dataGridViewX1.Columns.Contains("编号")) - // { - // featureName = dataGridViewX1.Rows[hittestinfo.RowIndex].Cells["编号"].Value.ToString(); - // } - // else - // { - // featureName = dataGridViewX1.Rows[hittestinfo.RowIndex].Cells["标识器编号"].Value.ToString(); - // } - // contextMenuStrip1.Show(dataGridViewX1, e.X, e.Y); + if (e.Button == MouseButtons.Right) + { + DataGridView.HitTestInfo hittestinfo = dataGridViewX1.HitTest(e.X, e.Y); + if (hittestinfo.RowIndex > -1) + { + string featureName = ""; + if (dataGridViewX1.Columns.Contains("编号")) + { + featureName = dataGridViewX1.Rows[hittestinfo.RowIndex].Cells["编号"].Value.ToString(); + } + else + { + featureName = dataGridViewX1.Rows[hittestinfo.RowIndex].Cells["标识器编号"].Value.ToString(); + } + contextMenuStrip1.Show(dataGridViewX1, e.X, e.Y); - // featureName = featureName.Trim(); + featureName = featureName.Trim(); - // GSOLayer layer = null; - // if (m_CurrentQueryLayer == null) - // { + GSOLayer layer = null; + if (m_CurrentQueryLayer == null) + { - // //layer = globeControl1.Globe.Layers.GetLayerByCaption(dataGridViewX1.Rows[rowIndex].Cells["编号"].Value.ToString()); - // layer = globeControl1.Globe.Layers.GetLayerByCaption(toolStripNumbers.Text); - // } - // else - // { - // layer = globeControl1.Globe.Layers.GetLayerByCaption(m_CurrentQueryLayer); - // } + //layer = globeControl1.Globe.Layers.GetLayerByCaption(dataGridViewX1.Rows[rowIndex].Cells["编号"].Value.ToString()); + layer = globeControl1.Globe.Layers.GetLayerByCaption(toolStripNumbers.Text); + } + else + { + layer = globeControl1.Globe.Layers.GetLayerByCaption(m_CurrentQueryLayer); + } - // if (layer == null) - // return; - // GSOFeatures features = layer.GetFeatureByName(featureName, false); - // for (int j = 0; j < features.Length; j++) - // { - // if (features[j].Name == featureName) - // { - // contextMenuStrip1.Tag = features[j]; - // break; - // } - // } - // } - // } - // } - // else - // { - - // } - //} + if (layer == null) + return; + GSOFeatures features = layer.GetFeatureByName(featureName, false); + for (int j = 0; j < features.Length; j++) + { + if (features[j].Name == featureName) + { + contextMenuStrip1.Tag = features[j]; + break; + } + } + } + } + + } FrmAnalysisGuiHuaResult from; /// @@ -4502,97 +4497,97 @@ /// /// /// - //private void dataGridViewX1_MouseDoubleClick(object sender, MouseEventArgs e) - //{ - // if (redSH == false) - // { - // if (e.Button == MouseButtons.Left) - // { - // DataGridView.HitTestInfo hittestinfo = dataGridViewX1.HitTest(e.X, e.Y); - // if (hittestinfo.RowIndex > -1) - // { - // string featureName = ""; - // if (dataGridViewX1.Columns.Contains("编号")) - // { - // featureName = dataGridViewX1.Rows[hittestinfo.RowIndex].Cells["编号"].Value.ToString(); - // } - // else - // { - // featureName = dataGridViewX1.Rows[hittestinfo.RowIndex].Cells["标识器编号"].Value.ToString(); - // } - // featureName = featureName.Trim(); + private void dataGridViewX1_MouseDoubleClick(object sender, MouseEventArgs e) + { + //if (redSH == false) + //{ + if (e.Button == MouseButtons.Left) + { + DataGridView.HitTestInfo hittestinfo = dataGridViewX1.HitTest(e.X, e.Y); + if (hittestinfo.RowIndex > -1) + { + string featureName = ""; + if (dataGridViewX1.Columns.Contains("编号")) + { + featureName = dataGridViewX1.Rows[hittestinfo.RowIndex].Cells["编号"].Value.ToString(); + } + else + { + featureName = dataGridViewX1.Rows[hittestinfo.RowIndex].Cells["标识器编号"].Value.ToString(); + } + featureName = featureName.Trim(); - // GSOLayer layer = null; - // if (m_CurrentQueryLayer == null) - // { + GSOLayer layer = null; + if (m_CurrentQueryLayer == null) + { - // //layer = globeControl1.Globe.Layers.GetLayerByCaption(dataGridViewX1.Rows[rowIndex].Cells["编号"].Value.ToString()); - // layer = globeControl1.Globe.Layers.GetLayerByCaption(toolStripNumbers.Text); - // } - // else - // { - // layer = globeControl1.Globe.Layers.GetLayerByCaption(m_CurrentQueryLayer); - // } + //layer = globeControl1.Globe.Layers.GetLayerByCaption(dataGridViewX1.Rows[rowIndex].Cells["编号"].Value.ToString()); + layer = globeControl1.Globe.Layers.GetLayerByCaption(toolStripNumbers.Text); + } + else + { + layer = globeControl1.Globe.Layers.GetLayerByCaption(m_CurrentQueryLayer); + } - // if (layer != null) - // { - // GSOFeatures features = layer.GetFeatureByName(featureName, false); - // for (int j = 0; j < features.Length; j++) - // { - // if (features[j].Name == featureName) - // { - // //m_feature = features[j]; - // GSOFeature rowFeature = features[j]; - // if (rowFeature == null) - // continue; - // 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]; - // globeControl1.Globe.FlyToPosition(point3d, EnumAltitudeMode.Absolute, 0, 45, 5); - // LightMenu_Click(sender, e); - // } - // else - // { - // globeControl1.Globe.FlyToFeature(rowFeature, 0, 45, 3); - // } - // } - // } - // } - // } - // } - // } - // else - // { - // if (e.Button == MouseButtons.Left) - // { - // if (from != null && !from.IsDisposed) - // { - // try - // { - // from.Close(); - // } - // catch (Exception ex) - // { } - - // } - // DataGridView.HitTestInfo hittestinfo = dataGridViewX1.HitTest(e.X, e.Y); - // if (hittestinfo.RowIndex >= 0) - // { - // string layer = dataGridViewX1.Rows[hittestinfo.RowIndex].Cells["管线类型"].Value.ToString(); - // string hxName = dataGridViewX1.Rows[hittestinfo.RowIndex].Cells["红线编号"].Value.ToString(); - // FrmAnalysisGuiHuaResult frm = new FrmAnalysisGuiHuaResult(globeControl1, lineStruct, panelOfTable, dataGridViewX1, layer, hxName); - // frm.Location = new Point(this.Width - frm.Width - 10, this.Height - frm.Height-20); - // frm.Show(this); - - // from = frm; - // } - // } - // } - //} + if (layer != null) + { + GSOFeatures features = layer.GetFeatureByName(featureName, false); + for (int j = 0; j < features.Length; j++) + { + if (features[j].Name == featureName) + { + //m_feature = features[j]; + GSOFeature rowFeature = features[j]; + if (rowFeature == null) + continue; + 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]; + globeControl1.Globe.FlyToPosition(point3d, EnumAltitudeMode.Absolute, 0, 45, 5); + LightMenu_Click(sender, e); + } + else + { + globeControl1.Globe.FlyToFeature(rowFeature, 0, 45, 3); + } + } + } + } + } + } + //} + //else + //{ + // if (e.Button == MouseButtons.Left) + // { + // if (from != null && !from.IsDisposed) + // { + // try + // { + // from.Close(); + // } + // catch (Exception ex) + // { } + + // } + // DataGridView.HitTestInfo hittestinfo = dataGridViewX1.HitTest(e.X, e.Y); + // if (hittestinfo.RowIndex >= 0) + // { + // string layer = dataGridViewX1.Rows[hittestinfo.RowIndex].Cells["管线类型"].Value.ToString(); + // string hxName = dataGridViewX1.Rows[hittestinfo.RowIndex].Cells["红线编号"].Value.ToString(); + // FrmAnalysisGuiHuaResult frm = new FrmAnalysisGuiHuaResult(globeControl1, lineStruct, panelOfTable, dataGridViewX1, layer, hxName); + // frm.Location = new Point(this.Width - frm.Width - 10, this.Height - frm.Height - 20); + // frm.Show(this); + + // from = frm; + // } + // } + //} + } /// /// 绘制线 菜单 diff --git a/MainFrm.designer.cs b/MainFrm.designer.cs index 06700ee..04cb929 100644 --- a/MainFrm.designer.cs +++ b/MainFrm.designer.cs @@ -810,7 +810,7 @@ this.toolStripDropDownButton1.Image = ((System.Drawing.Image)(resources.GetObject("toolStripDropDownButton1.Image"))); this.toolStripDropDownButton1.ImageTransparentColor = System.Drawing.Color.Magenta; this.toolStripDropDownButton1.Name = "toolStripDropDownButton1"; - this.toolStripDropDownButton1.Size = new System.Drawing.Size(45, 20); + this.toolStripDropDownButton1.Size = new System.Drawing.Size(45, 21); this.toolStripDropDownButton1.Text = "帮助"; this.toolStripDropDownButton1.Visible = false; this.toolStripDropDownButton1.Click += new System.EventHandler(this.toolStripDropDownButton1_Click); @@ -3745,6 +3745,8 @@ this.dataGridViewX1.RowTemplate.Height = 23; this.dataGridViewX1.Size = new System.Drawing.Size(1147, 61); this.dataGridViewX1.TabIndex = 13; + this.dataGridViewX1.MouseClick += new System.Windows.Forms.MouseEventHandler(this.dataGridViewX1_MouseClick); + this.dataGridViewX1.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.dataGridViewX1_MouseDoubleClick); // // statusStrip2 // diff --git a/bin/x86/Debug/EMSCyberpipe.exe b/bin/x86/Debug/EMSCyberpipe.exe index 40c1911..75ae693 100644 --- a/bin/x86/Debug/EMSCyberpipe.exe +++ b/bin/x86/Debug/EMSCyberpipe.exe Binary files differ diff --git a/.gitignore b/.gitignore index 873811e..8ee30f6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ Thumbs.db *.obj +*.exe *.user *.aps *.pch diff --git a/Cyberpipe.suo b/Cyberpipe.suo index 2c39f54..9fb7248 100644 --- a/Cyberpipe.suo +++ b/Cyberpipe.suo Binary files differ diff --git a/MainFrm.cs b/MainFrm.cs index 7375063..5822ae8 100644 --- a/MainFrm.cs +++ b/MainFrm.cs @@ -4435,66 +4435,61 @@ /// /// /// - //private void dataGridViewX1_MouseClick(object sender, MouseEventArgs e) - //{ - // if (redSH == false) - // { - // GSOFeature rowFeature = contextMenuStrip1.Tag as GSOFeature; + private void dataGridViewX1_MouseClick(object sender, MouseEventArgs e) + { + + GSOFeature rowFeature = contextMenuStrip1.Tag as GSOFeature; - // if (rowFeature != null && rowFeature.HighLight == true) - // { - // rowFeature.HighLight = false; - // } + if (rowFeature != null && rowFeature.HighLight == true) + { + rowFeature.HighLight = false; + } - // if (e.Button == MouseButtons.Right) - // { - // DataGridView.HitTestInfo hittestinfo = dataGridViewX1.HitTest(e.X, e.Y); - // if (hittestinfo.RowIndex > -1) - // { - // string featureName = ""; - // if (dataGridViewX1.Columns.Contains("编号")) - // { - // featureName = dataGridViewX1.Rows[hittestinfo.RowIndex].Cells["编号"].Value.ToString(); - // } - // else - // { - // featureName = dataGridViewX1.Rows[hittestinfo.RowIndex].Cells["标识器编号"].Value.ToString(); - // } - // contextMenuStrip1.Show(dataGridViewX1, e.X, e.Y); + if (e.Button == MouseButtons.Right) + { + DataGridView.HitTestInfo hittestinfo = dataGridViewX1.HitTest(e.X, e.Y); + if (hittestinfo.RowIndex > -1) + { + string featureName = ""; + if (dataGridViewX1.Columns.Contains("编号")) + { + featureName = dataGridViewX1.Rows[hittestinfo.RowIndex].Cells["编号"].Value.ToString(); + } + else + { + featureName = dataGridViewX1.Rows[hittestinfo.RowIndex].Cells["标识器编号"].Value.ToString(); + } + contextMenuStrip1.Show(dataGridViewX1, e.X, e.Y); - // featureName = featureName.Trim(); + featureName = featureName.Trim(); - // GSOLayer layer = null; - // if (m_CurrentQueryLayer == null) - // { + GSOLayer layer = null; + if (m_CurrentQueryLayer == null) + { - // //layer = globeControl1.Globe.Layers.GetLayerByCaption(dataGridViewX1.Rows[rowIndex].Cells["编号"].Value.ToString()); - // layer = globeControl1.Globe.Layers.GetLayerByCaption(toolStripNumbers.Text); - // } - // else - // { - // layer = globeControl1.Globe.Layers.GetLayerByCaption(m_CurrentQueryLayer); - // } + //layer = globeControl1.Globe.Layers.GetLayerByCaption(dataGridViewX1.Rows[rowIndex].Cells["编号"].Value.ToString()); + layer = globeControl1.Globe.Layers.GetLayerByCaption(toolStripNumbers.Text); + } + else + { + layer = globeControl1.Globe.Layers.GetLayerByCaption(m_CurrentQueryLayer); + } - // if (layer == null) - // return; - // GSOFeatures features = layer.GetFeatureByName(featureName, false); - // for (int j = 0; j < features.Length; j++) - // { - // if (features[j].Name == featureName) - // { - // contextMenuStrip1.Tag = features[j]; - // break; - // } - // } - // } - // } - // } - // else - // { - - // } - //} + if (layer == null) + return; + GSOFeatures features = layer.GetFeatureByName(featureName, false); + for (int j = 0; j < features.Length; j++) + { + if (features[j].Name == featureName) + { + contextMenuStrip1.Tag = features[j]; + break; + } + } + } + } + + } FrmAnalysisGuiHuaResult from; /// @@ -4502,97 +4497,97 @@ /// /// /// - //private void dataGridViewX1_MouseDoubleClick(object sender, MouseEventArgs e) - //{ - // if (redSH == false) - // { - // if (e.Button == MouseButtons.Left) - // { - // DataGridView.HitTestInfo hittestinfo = dataGridViewX1.HitTest(e.X, e.Y); - // if (hittestinfo.RowIndex > -1) - // { - // string featureName = ""; - // if (dataGridViewX1.Columns.Contains("编号")) - // { - // featureName = dataGridViewX1.Rows[hittestinfo.RowIndex].Cells["编号"].Value.ToString(); - // } - // else - // { - // featureName = dataGridViewX1.Rows[hittestinfo.RowIndex].Cells["标识器编号"].Value.ToString(); - // } - // featureName = featureName.Trim(); + private void dataGridViewX1_MouseDoubleClick(object sender, MouseEventArgs e) + { + //if (redSH == false) + //{ + if (e.Button == MouseButtons.Left) + { + DataGridView.HitTestInfo hittestinfo = dataGridViewX1.HitTest(e.X, e.Y); + if (hittestinfo.RowIndex > -1) + { + string featureName = ""; + if (dataGridViewX1.Columns.Contains("编号")) + { + featureName = dataGridViewX1.Rows[hittestinfo.RowIndex].Cells["编号"].Value.ToString(); + } + else + { + featureName = dataGridViewX1.Rows[hittestinfo.RowIndex].Cells["标识器编号"].Value.ToString(); + } + featureName = featureName.Trim(); - // GSOLayer layer = null; - // if (m_CurrentQueryLayer == null) - // { + GSOLayer layer = null; + if (m_CurrentQueryLayer == null) + { - // //layer = globeControl1.Globe.Layers.GetLayerByCaption(dataGridViewX1.Rows[rowIndex].Cells["编号"].Value.ToString()); - // layer = globeControl1.Globe.Layers.GetLayerByCaption(toolStripNumbers.Text); - // } - // else - // { - // layer = globeControl1.Globe.Layers.GetLayerByCaption(m_CurrentQueryLayer); - // } + //layer = globeControl1.Globe.Layers.GetLayerByCaption(dataGridViewX1.Rows[rowIndex].Cells["编号"].Value.ToString()); + layer = globeControl1.Globe.Layers.GetLayerByCaption(toolStripNumbers.Text); + } + else + { + layer = globeControl1.Globe.Layers.GetLayerByCaption(m_CurrentQueryLayer); + } - // if (layer != null) - // { - // GSOFeatures features = layer.GetFeatureByName(featureName, false); - // for (int j = 0; j < features.Length; j++) - // { - // if (features[j].Name == featureName) - // { - // //m_feature = features[j]; - // GSOFeature rowFeature = features[j]; - // if (rowFeature == null) - // continue; - // 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]; - // globeControl1.Globe.FlyToPosition(point3d, EnumAltitudeMode.Absolute, 0, 45, 5); - // LightMenu_Click(sender, e); - // } - // else - // { - // globeControl1.Globe.FlyToFeature(rowFeature, 0, 45, 3); - // } - // } - // } - // } - // } - // } - // } - // else - // { - // if (e.Button == MouseButtons.Left) - // { - // if (from != null && !from.IsDisposed) - // { - // try - // { - // from.Close(); - // } - // catch (Exception ex) - // { } - - // } - // DataGridView.HitTestInfo hittestinfo = dataGridViewX1.HitTest(e.X, e.Y); - // if (hittestinfo.RowIndex >= 0) - // { - // string layer = dataGridViewX1.Rows[hittestinfo.RowIndex].Cells["管线类型"].Value.ToString(); - // string hxName = dataGridViewX1.Rows[hittestinfo.RowIndex].Cells["红线编号"].Value.ToString(); - // FrmAnalysisGuiHuaResult frm = new FrmAnalysisGuiHuaResult(globeControl1, lineStruct, panelOfTable, dataGridViewX1, layer, hxName); - // frm.Location = new Point(this.Width - frm.Width - 10, this.Height - frm.Height-20); - // frm.Show(this); - - // from = frm; - // } - // } - // } - //} + if (layer != null) + { + GSOFeatures features = layer.GetFeatureByName(featureName, false); + for (int j = 0; j < features.Length; j++) + { + if (features[j].Name == featureName) + { + //m_feature = features[j]; + GSOFeature rowFeature = features[j]; + if (rowFeature == null) + continue; + 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]; + globeControl1.Globe.FlyToPosition(point3d, EnumAltitudeMode.Absolute, 0, 45, 5); + LightMenu_Click(sender, e); + } + else + { + globeControl1.Globe.FlyToFeature(rowFeature, 0, 45, 3); + } + } + } + } + } + } + //} + //else + //{ + // if (e.Button == MouseButtons.Left) + // { + // if (from != null && !from.IsDisposed) + // { + // try + // { + // from.Close(); + // } + // catch (Exception ex) + // { } + + // } + // DataGridView.HitTestInfo hittestinfo = dataGridViewX1.HitTest(e.X, e.Y); + // if (hittestinfo.RowIndex >= 0) + // { + // string layer = dataGridViewX1.Rows[hittestinfo.RowIndex].Cells["管线类型"].Value.ToString(); + // string hxName = dataGridViewX1.Rows[hittestinfo.RowIndex].Cells["红线编号"].Value.ToString(); + // FrmAnalysisGuiHuaResult frm = new FrmAnalysisGuiHuaResult(globeControl1, lineStruct, panelOfTable, dataGridViewX1, layer, hxName); + // frm.Location = new Point(this.Width - frm.Width - 10, this.Height - frm.Height - 20); + // frm.Show(this); + + // from = frm; + // } + // } + //} + } /// /// 绘制线 菜单 diff --git a/MainFrm.designer.cs b/MainFrm.designer.cs index 06700ee..04cb929 100644 --- a/MainFrm.designer.cs +++ b/MainFrm.designer.cs @@ -810,7 +810,7 @@ this.toolStripDropDownButton1.Image = ((System.Drawing.Image)(resources.GetObject("toolStripDropDownButton1.Image"))); this.toolStripDropDownButton1.ImageTransparentColor = System.Drawing.Color.Magenta; this.toolStripDropDownButton1.Name = "toolStripDropDownButton1"; - this.toolStripDropDownButton1.Size = new System.Drawing.Size(45, 20); + this.toolStripDropDownButton1.Size = new System.Drawing.Size(45, 21); this.toolStripDropDownButton1.Text = "帮助"; this.toolStripDropDownButton1.Visible = false; this.toolStripDropDownButton1.Click += new System.EventHandler(this.toolStripDropDownButton1_Click); @@ -3745,6 +3745,8 @@ this.dataGridViewX1.RowTemplate.Height = 23; this.dataGridViewX1.Size = new System.Drawing.Size(1147, 61); this.dataGridViewX1.TabIndex = 13; + this.dataGridViewX1.MouseClick += new System.Windows.Forms.MouseEventHandler(this.dataGridViewX1_MouseClick); + this.dataGridViewX1.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.dataGridViewX1_MouseDoubleClick); // // statusStrip2 // diff --git a/bin/x86/Debug/EMSCyberpipe.exe b/bin/x86/Debug/EMSCyberpipe.exe index 40c1911..75ae693 100644 --- a/bin/x86/Debug/EMSCyberpipe.exe +++ b/bin/x86/Debug/EMSCyberpipe.exe Binary files differ diff --git a/bin/x86/Debug/EMSCyberpipe.pdb b/bin/x86/Debug/EMSCyberpipe.pdb index aeb901e..44897ee 100644 --- a/bin/x86/Debug/EMSCyberpipe.pdb +++ b/bin/x86/Debug/EMSCyberpipe.pdb Binary files differ