diff --git a/Cyberpipe.suo b/Cyberpipe.suo index ebd45ee..c2c34b1 100644 --- a/Cyberpipe.suo +++ b/Cyberpipe.suo Binary files differ diff --git a/Cyberpipe.suo b/Cyberpipe.suo index ebd45ee..c2c34b1 100644 --- a/Cyberpipe.suo +++ b/Cyberpipe.suo Binary files differ diff --git a/Forms/FrmPipelineModelDataBase.cs b/Forms/FrmPipelineModelDataBase.cs index a060afb..f833db4 100644 --- a/Forms/FrmPipelineModelDataBase.cs +++ b/Forms/FrmPipelineModelDataBase.cs @@ -1,16 +1,10 @@ using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; using System.Drawing; -using System.Text; using System.Windows.Forms; using GeoScene.Globe; using GeoScene.Engine; using GeoScene.Data; using System.IO; -using System.Collections; -using System.Xml; using System.Text.RegularExpressions; using DevComponents.DotNetBar; @@ -39,11 +33,12 @@ /// private void FrmPipelineModel_Load(object sender, EventArgs e) { + buttonOpen.Visible = isSh; string pipelinetype = Utility.pipelinetype; string[] pipelinetypes = pipelinetype.Split(','); for (int i = 0; i < pipelinetypes.Length; i++) { - pipelineTypeCbo.Items.Add(pipelinetypes[i]);//管线类型 + pipelineTypeCbo.Items.Add(pipelinetypes[i]); } comboBoxExLayer.Items.Clear(); diff --git a/Cyberpipe.suo b/Cyberpipe.suo index ebd45ee..c2c34b1 100644 --- a/Cyberpipe.suo +++ b/Cyberpipe.suo Binary files differ diff --git a/Forms/FrmPipelineModelDataBase.cs b/Forms/FrmPipelineModelDataBase.cs index a060afb..f833db4 100644 --- a/Forms/FrmPipelineModelDataBase.cs +++ b/Forms/FrmPipelineModelDataBase.cs @@ -1,16 +1,10 @@ using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; using System.Drawing; -using System.Text; using System.Windows.Forms; using GeoScene.Globe; using GeoScene.Engine; using GeoScene.Data; using System.IO; -using System.Collections; -using System.Xml; using System.Text.RegularExpressions; using DevComponents.DotNetBar; @@ -39,11 +33,12 @@ /// private void FrmPipelineModel_Load(object sender, EventArgs e) { + buttonOpen.Visible = isSh; string pipelinetype = Utility.pipelinetype; string[] pipelinetypes = pipelinetype.Split(','); for (int i = 0; i < pipelinetypes.Length; i++) { - pipelineTypeCbo.Items.Add(pipelinetypes[i]);//管线类型 + pipelineTypeCbo.Items.Add(pipelinetypes[i]); } comboBoxExLayer.Items.Clear(); diff --git a/FrmDatabaseParaSetting.cs b/FrmDatabaseParaSetting.cs index 39a4e4f..e4dfe80 100644 --- a/FrmDatabaseParaSetting.cs +++ b/FrmDatabaseParaSetting.cs @@ -123,7 +123,6 @@ { MessageBox.Show("数据库连接成功!", "提示"); } - } else { diff --git a/Cyberpipe.suo b/Cyberpipe.suo index ebd45ee..c2c34b1 100644 --- a/Cyberpipe.suo +++ b/Cyberpipe.suo Binary files differ diff --git a/Forms/FrmPipelineModelDataBase.cs b/Forms/FrmPipelineModelDataBase.cs index a060afb..f833db4 100644 --- a/Forms/FrmPipelineModelDataBase.cs +++ b/Forms/FrmPipelineModelDataBase.cs @@ -1,16 +1,10 @@ using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; using System.Drawing; -using System.Text; using System.Windows.Forms; using GeoScene.Globe; using GeoScene.Engine; using GeoScene.Data; using System.IO; -using System.Collections; -using System.Xml; using System.Text.RegularExpressions; using DevComponents.DotNetBar; @@ -39,11 +33,12 @@ /// private void FrmPipelineModel_Load(object sender, EventArgs e) { + buttonOpen.Visible = isSh; string pipelinetype = Utility.pipelinetype; string[] pipelinetypes = pipelinetype.Split(','); for (int i = 0; i < pipelinetypes.Length; i++) { - pipelineTypeCbo.Items.Add(pipelinetypes[i]);//管线类型 + pipelineTypeCbo.Items.Add(pipelinetypes[i]); } comboBoxExLayer.Items.Clear(); diff --git a/FrmDatabaseParaSetting.cs b/FrmDatabaseParaSetting.cs index 39a4e4f..e4dfe80 100644 --- a/FrmDatabaseParaSetting.cs +++ b/FrmDatabaseParaSetting.cs @@ -123,7 +123,6 @@ { MessageBox.Show("数据库连接成功!", "提示"); } - } else { diff --git a/FrmShResult.cs b/FrmShResult.cs index d11fd66..50a7d8c 100644 --- a/FrmShResult.cs +++ b/FrmShResult.cs @@ -663,7 +663,6 @@ private void FrmShResult_FormClosed(object sender, FormClosedEventArgs e) { mainfrm.boolfrmShResult = false; - } /// /// 一键审核导出 diff --git a/Cyberpipe.suo b/Cyberpipe.suo index ebd45ee..c2c34b1 100644 --- a/Cyberpipe.suo +++ b/Cyberpipe.suo Binary files differ diff --git a/Forms/FrmPipelineModelDataBase.cs b/Forms/FrmPipelineModelDataBase.cs index a060afb..f833db4 100644 --- a/Forms/FrmPipelineModelDataBase.cs +++ b/Forms/FrmPipelineModelDataBase.cs @@ -1,16 +1,10 @@ using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; using System.Drawing; -using System.Text; using System.Windows.Forms; using GeoScene.Globe; using GeoScene.Engine; using GeoScene.Data; using System.IO; -using System.Collections; -using System.Xml; using System.Text.RegularExpressions; using DevComponents.DotNetBar; @@ -39,11 +33,12 @@ /// private void FrmPipelineModel_Load(object sender, EventArgs e) { + buttonOpen.Visible = isSh; string pipelinetype = Utility.pipelinetype; string[] pipelinetypes = pipelinetype.Split(','); for (int i = 0; i < pipelinetypes.Length; i++) { - pipelineTypeCbo.Items.Add(pipelinetypes[i]);//管线类型 + pipelineTypeCbo.Items.Add(pipelinetypes[i]); } comboBoxExLayer.Items.Clear(); diff --git a/FrmDatabaseParaSetting.cs b/FrmDatabaseParaSetting.cs index 39a4e4f..e4dfe80 100644 --- a/FrmDatabaseParaSetting.cs +++ b/FrmDatabaseParaSetting.cs @@ -123,7 +123,6 @@ { MessageBox.Show("数据库连接成功!", "提示"); } - } else { diff --git a/FrmShResult.cs b/FrmShResult.cs index d11fd66..50a7d8c 100644 --- a/FrmShResult.cs +++ b/FrmShResult.cs @@ -663,7 +663,6 @@ private void FrmShResult_FormClosed(object sender, FormClosedEventArgs e) { mainfrm.boolfrmShResult = false; - } /// /// 一键审核导出 diff --git a/MainFrm.cs b/MainFrm.cs index 2e3ba7f..83acfa1 100644 --- a/MainFrm.cs +++ b/MainFrm.cs @@ -19,7 +19,6 @@ { public partial class MainFrm : Office2007Form { - TreeNode layerManagerNode = null; TreeNode myPlaceNode = null; bool m_bFullScreen = false; @@ -1395,7 +1394,6 @@ private void MainFrm_Load(object sender, EventArgs e) { - this.initGlobalControl(); this.initGlobalMap(); this.initLayerTree(); @@ -1403,13 +1401,11 @@ this.initLayout(); this.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]); jumpToCameraState(x, y, z); - } #endregion @@ -1578,12 +1574,6 @@ 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)); - /*Point pt = getUpperLeftPoint(pt1, pt2); - Image myImg = new Bitmap(Convert.ToInt32(e.Rect.Width), Convert.ToInt32(e.Rect.Height)); - Graphics g = Graphics.FromImage(myImg); - g.CopyFromScreen(pt, new Point(0, 0), new Size(Convert.ToInt32(e.Rect.Width), Convert.ToInt32(e.Rect.Height))); - */ - int mapWidth = 0; int mapHeight = 0; Point pt = getUpperLeftPoint(pt1, pt2, out mapWidth, out mapHeight); @@ -1862,7 +1852,6 @@ { GSOLayer layer = node.Tag as GSOLayer; - //globeControl1.Globe.Layers.Remove(layer); for (int i = globeControl1.Globe.Layers.Count - 1; i >= 0; i--) { if (globeControl1.Globe.Layers[i].Caption == layer.Caption) @@ -2065,7 +2054,6 @@ } } - void globeControl1_MouseWheel(object sender, MouseEventArgs e) { if (globeControl1.Globe.CameraState.Distance > 20000000) @@ -2321,8 +2309,6 @@ case "valvequery": FrmValveStatistics frm = new FrmValveStatistics(globeControl1, polygon, new DataGridViewDelegate(InitDataGridViewX1)); frm.Show(this); - //panelEx6.Visible = true; - //toolStripFeatureLength.Text = ""; globeControl1.Globe.Action = EnumAction3D.ActionNull; break; @@ -2365,7 +2351,6 @@ layerGround.Visible = false; } } - // 清除当前TrackPolygonAnalysis的痕迹 globeControl1.Globe.ClearLastTrackPolygon(); globeControl1.Globe.Action = EnumAction3D.ActionNull; break; @@ -2382,20 +2367,7 @@ globeControl1.Globe.Action = EnumAction3D.ActionNull; break; case "BSQDuoBianXiangStatis": - - //GSOFeature f2 = new GSOFeature(); - //f2.Geometry = e.Polygon; - //f2.Geometry.AltitudeMode = EnumAltitudeMode.Absolute; - //globeControl1.Globe.MemoryLayer.AddFeature(f2); - //f2.Geometry.MoveZ(3); - //workWellLen.Clear(); - //List listBSQ = new List(); - - //GSOFeatures bsqFeatures = PolygonIntersectAnalysis(e.Polygon, "标识器"); - //listBSQ.Add(bsqFeatures); - - //FrmBSQDuoBianXingStatis bsqFrm = new FrmBSQDuoBianXingStatis(workWellLen, globeControl1, listBSQ); - FrmBSQStatis bsqFrm = new FrmBSQStatis(globeControl1, e.Polygon); + FrmBSQStatis bsqFrm = new FrmBSQStatis(globeControl1, e.Polygon); bsqFrm.Show(this); globeControl1.Globe.Action = EnumAction3D.ActionNull; break; @@ -2407,8 +2379,6 @@ } } } - - /// /// 鼠标悬浮提示 /// @@ -2432,20 +2402,19 @@ } catch (Exception ex) { - //LogError.PublishError(ex); + LogError.PublishError(ex); } } - + /// /// 添加管线绘制完成事件, 红线工具绘制完成 /// /// - /// + /// (完善) void globeControl1_MouseDoubleClick(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left) { - if (m_AddPipeLine == true && globeControl1.Globe.Action == EnumAction3D.DrawPolyline)//添加管线 { GSOLayer layerDest = globeControl1.Globe.DestLayerFeatureAdd; @@ -2661,18 +2630,12 @@ { if (e.Button == MouseButtons.Right) { - if (e.X == mouseDownX2 && e.Y == mouseDownY2) - { - RightScreenToolMenu.Show(globeControl2, e.X, e.Y); - } - else - { - return; - } + if (e.X != mouseDownX2 || e.Y != mouseDownY2) return; + RightScreenToolMenu.Show(globeControl2, e.X, e.Y); } } /// - /// + /// (完善) /// /// /// @@ -2912,7 +2875,6 @@ bool result = false; System.Net.WebResponse response = null; - try { System.Net.WebRequest req = System.Net.WebRequest.Create(fileUrl); @@ -3038,7 +3000,7 @@ } /// - /// 拼接气泡表格字符串 + /// 拼接气泡表格字符串(完善) /// /// /// @@ -3233,14 +3195,8 @@ { TreeNode featureAddPipeFitTreenode = GetDestLayerFeatureAddTreeNode(); GSOLayer featureAddLayer = globeControl1.Globe.Layers.GetLayerByCaption(featureAddPipeFitTreenode.Tag.ToString().Split('|')[1]); - if (featureAddLayer != null) - { - return featureAddLayer; - } - else - { - return null; - } + + return featureAddLayer != null ? featureAddLayer : null; } private TreeNode GetDestLayerFeatureAddTreeNode() @@ -3306,7 +3262,6 @@ return null; } - /// /// 地上模式 菜单按钮 /// @@ -3335,22 +3290,16 @@ 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(); - } } /// @@ -3382,13 +3331,9 @@ 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; } @@ -3426,20 +3371,8 @@ globeControl1.Globe.GroundOpaque = 100 - sliderGroundTransSet1.Value; GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(roadLayerName);//("180fd"); if (layer != null) - { layer.Opaque = 100 - sliderGroundTransSet1.Value; - } - //if (buttonItemSPDB.Checked) - //{ - // layer = globeControl2.Globe.Layers.GetLayerByCaption("180fd"); - // if (layer != null) - // { - // layer.Opaque = 100 - sliderGroundTransSet1.Value; - // } - // globeControl2.Globe.GroundOpaque = 100 - sliderGroundTransSet1.Value; - //} optiValue = sliderGroundTransSet1.Value; - //sliderItem1.Value = optiValue; } /// /// 图例 菜单按钮 @@ -3499,21 +3432,7 @@ panel3.Visible = false; sideBar1.ExpandedPanel = sideBarPanelItem3; buttonItemBZ11.Checked = false; - - //20160624 - /* - if (sideBarPanelItem4.Visible == true) - { - sideBar1.Visible = true; - controlContainerItem5.Visible = true; - } - else - { - sideBar1.Visible = false; - } - */ Refresh(); - } } /// @@ -3542,7 +3461,7 @@ int xOld = 0; int yOld = 0; /// - /// 全屏显示功能实现 + /// 全屏显示功能实现(完善) /// private void FullScreen() { @@ -3666,7 +3585,6 @@ FullScreen(); break; case Keys.Escape: - // esc仅仅取消全屏 if (m_bFullScreen) { FullScreen(); @@ -3682,7 +3600,6 @@ } } - private Point getUpperLeftPoint(Point p1, Point p2, out int mapWidth, out int mapHeight) // { Rectangle rc = new Rectangle(); @@ -3695,29 +3612,13 @@ int screenWidth = SystemInformation.WorkingArea.Width; int screenHeight = SystemInformation.WorkingArea.Height; - if (p1.X < x) - rc.X = x; - else - rc.X = p1.X; - - if (p1.Y < y) - rc.Y = y; - else - rc.Y = p1.Y; - + rc.X = p1.X < x ? x : p1.X; + rc.Y = p1.Y < y ? y : p1.Y; p1.X = rc.Left; p1.Y = rc.Top; - if (p2.X > screenWidth) - p2.X = screenWidth; - else - p2.X = p2.X; - - if (p2.Y > screenHeight) - p2.Y = screenHeight; - else - p2.Y = p2.Y; - + p2.X = p2.X > screenWidth ? screenWidth : p2.X; + p2.Y = p2.Y > screenHeight ? screenHeight : p2.Y; rc.Width = p2.X - rc.X; rc.Height = p2.Y - rc.Y; @@ -3728,7 +3629,6 @@ } Image printImage; - private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e) { e.Graphics.DrawImage(printImage, 10, 10); @@ -3742,15 +3642,8 @@ { LogManager.saveLog(Utility.userName, this.btnOutputJPG.Text); - //globeControl1.Globe.Action = EnumAction3D.TrackRect; //绘制矩形模式 - //globeControl1.Globe.TrackRectTool.TrackMode = EnumTrackMode.ScreenTrack; //在屏幕上绘制 Point pt1 = new Point(Convert.ToInt32(0), Convert.ToInt32(0)); Point pt2 = new Point(Convert.ToInt32(panelEx5.Width), Convert.ToInt32(panelEx5.Height)); - /*Point pt = getUpperLeftPoint(pt1, pt2); - Image myImg = new Bitmap(Convert.ToInt32(panelEx5.Width), Convert.ToInt32(panelEx5.Height)); - Graphics g = Graphics.FromImage(myImg); - g.CopyFromScreen(pt, new Point(0, 0), new Size(Convert.ToInt32(panelEx5.Width), Convert.ToInt32(panelEx5.Height))); - */ int mapWidth = 0; int mapHeight = 0; Point pt = getUpperLeftPoint(pt1, pt2, out mapWidth, out mapHeight); @@ -3784,120 +3677,6 @@ } } } - - /// - /// 窗体下方属性表格 右键菜单中的 “定位”菜单 - /// - /// - /// - private void FlyToMenu_Click(object sender, EventArgs e) - { - GSOFeature rowFeature = contextMenuStrip1.Tag as GSOFeature; - if (rowFeature == null) - return; - - - 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); - } - else - { - globeControl1.Globe.FlyToFeature(rowFeature, 0, 45, 3); - } - LightMenu_Click(sender, e); - - } - - /// - /// 表格中右键 “单个闪烁” 菜单 - /// - /// - /// - private void LightMenu_Click(object sender, EventArgs e) - { - flashflag = "single"; - timer1.Start(); - } - /// - /// 表格中右键 “全部闪烁” 菜单 - /// - /// - /// - private void AllLightMenuItem_Click(object sender, EventArgs e) - { - flashflag = "all"; - timer1.Start(); - } - - /// - /// 使用timer实现管线的闪烁效果 - /// - /// - /// - private void timer1_Tick(object sender, EventArgs e) - { - GSOFeature rowFeature = contextMenuStrip1.Tag as GSOFeature; - if (rowFeature == null) - return; - - if (count < 40) - { - count++; - if (flashflag == "single") - { - if (rowFeature != null) - { - if (count % 2 != 0) - { - rowFeature.HighLight = true; - globeControl1.Refresh(); - } - else - { - rowFeature.HighLight = false; - globeControl1.Refresh(); - } - } - } - else if (flashflag == "all") - { - GSOFeatures feats = Utility.Table2Features(dataGridViewX1.DataSource as DataTable, m_CurrentQueryLayer, globeControl1); - if (feats.Length > 0) - { - if (count % 2 != 0) - { - for (int i = 0; i < feats.Length; i++) - { - GSOFeature tempfeat = feats[i]; - tempfeat.HighLight = true; - } - - globeControl1.Refresh(); - } - else - { - for (int i = 0; i < feats.Length; i++) - { - GSOFeature tempfeat = feats[i]; - tempfeat.HighLight = false; - } - globeControl1.Refresh(); - } - } - } - } - else - { - timer1.Stop(); - count = 0; - } - } /// /// 图层目录树 右键菜单中的 目标图层 菜单 /// @@ -3910,7 +3689,6 @@ TreeNode node = layerNodeContexMenu.Tag as TreeNode; FeatureAddLayerMenuItem.Checked = true; GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(node.Tag.ToString().Split('|')[1]); - //GSOLayer layer = globeControl1.Globe.Layers.GetLayerByID((int)node.Tag); globeControl1.Globe.DestLayerFeatureAdd = layer; } } @@ -3954,7 +3732,6 @@ layer.Dataset.Save(); } - #region wxl feature的公共方法 /// /// 查找指定图层中在 指定范围内的feature对象集合 @@ -3966,24 +3743,10 @@ { GSOFeatures feats = new GSOFeatures(); GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(layername); - if (layer == null) - { - return feats; - } + if (layer == null)return feats; GSOFeatureLayer flayer = layer as GSOFeatureLayer; - if (flayer != null) - { - GSOFeatureDataset fdataset = flayer.Dataset as GSOFeatureDataset; - } - - if (polygon == null) - { - feats = flayer.GetAllFeatures(); - } - else - { - feats = flayer.FindFeaturesInPolygon(polygon, false); - } + if (flayer == null) return feats; + feats = polygon == null ? flayer.GetAllFeatures() : flayer.FindFeaturesInPolygon(polygon, false); return feats; } #endregion @@ -4014,10 +3777,7 @@ if (globeControl1.Globe.Action != EnumAction3D.NormalHit) { buttonItemFX3_6.Checked = false; - // ClearConnexityAnalysis(); - buttonItemFX3_5.Checked = false; - // ClearCloseValvesAnalysis(); } if (globeControl1.Globe.Action != EnumAction3D.TrackPolygon) { @@ -4025,7 +3785,6 @@ buttonItemFX4_1.Checked = false; } } - /// /// 主窗体关闭事件处理 /// @@ -4033,21 +3792,13 @@ /// private void MainFrm_FormClosing(object sender, FormClosingEventArgs e) { - if (MessageBox.Show("是否退出系统?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) - { e.Cancel = true; - } else - { globeControl1.Globe.MemoryLayer.SaveAs(Application.StartupPath + "/MyPlace.kml"); - } - - //saveLayerList(layerManagerNode.Nodes); - //注销id号为103的热键设定 - // UnregisterHotKey(Handle, 103); } + #region 完善 /// /// 垂直净距分析 功能界面中的 选择图层复选框 选中状态改变事件处理 /// @@ -4198,12 +3949,10 @@ } } } - Dictionary featCount = new Dictionary(); Dictionary featLenth = new Dictionary(); Dictionary m_FeaturesWithBianhao = new Dictionary();//记录编号和对应的标注点的位置 GSOFeatures polygonJingJuAnalysises = new GSOFeatures(); - /// /// 垂直净距分析 功能界面中的 开始分析按钮 事件处理 /// @@ -4293,7 +4042,6 @@ globeControl1.Refresh(); this.Cursor = Cursors.Default; } - /// /// 在指定的两点组成的线的中间添加一个marker对象,并将marker对象添加到指定的图层中 /// @@ -4357,7 +4105,6 @@ return dismarker.Position; } - /// /// 计算指定feature对象与除了该feature所在图层之外的 所有管线图层中的所有feature对象 的垂直距离 并在表格中记录符合要求的管线 /// @@ -4411,8 +4158,7 @@ double dDist = -1; dDist = globeControl1.Globe.Analysis3D.ComputeHorizonDistance(line1, line2, out pntIntersect1, out pntIntersect2, out pntProIntersect1, out pntProIntersect2, false); - //dDist = globeControl1.Globe.Analysis3D.ComputeVerticalDistance(line1, line2, out pntIntersect1, out pntIntersect2, out pntProIntersect1, out pntProIntersect2, false); - + if (dDist > -1) { dDist = Math.Abs(pntIntersect1.Z - pntIntersect2.Z) - pipeStyle1.Radius - pipeStyle2.Radius;//获得净距值 @@ -4472,25 +4218,6 @@ } } } - - //double verticalDis = dDist; - //dDist = globeControl1.Globe.Analysis3D.ComputeVerticalDistance(line1, line2, out pntIntersect1, out pntIntersect2, out pntProIntersect1, out pntProIntersect2, false); - //if (dDist > -1) - //{ - // dDist = Math.Abs(pntIntersect1.Z - pntIntersect2.Z) - pipeStyle1.Radius - pipeStyle2.Radius; - // if (dDist < horizontalDistance) - // { - // 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 = verticalDis.ToString("0.00"); - // dataGridViewAnalysisResult.Rows[idx].Cells[5].Value = dDist.ToString("0.00"); - // } - //} } if (m_FeaturesWithBianhao.ContainsKey(selectedFeature.Name + "-" + feats2[j].Name) == false) @@ -4545,7 +4272,6 @@ } } } - /// /// 水平净距分析 功能界面中 开始分析按钮 的事件处理 /// @@ -4629,8 +4355,6 @@ globeControl1.Refresh(); this.Cursor = Cursors.Default; } - - /// /// 计算指定feature对象与除了该feature所在图层之外的 所有管线图层中的所有feature对象 的水平距离 并记录符合要求的管线 功能 /// @@ -4820,7 +4544,6 @@ else { MessageBox.Show("请选中要进行碰撞分析的管线!", "提示"); - //globeControl1.Globe.Action = EnumAction3D.SelectObject; } globeControl1.Refresh(); this.Cursor = Cursors.Default; @@ -4845,9 +4568,6 @@ } } } - - - /// /// 覆土分析功能操作界面中的 选择管线 复选框选中状态改变事件处理 /// @@ -5071,11 +4791,9 @@ else { MessageBox.Show("请选中要进行覆土分析的管线!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); - //globeControl1.Globe.Action = EnumAction3D.SelectObject; } this.Cursor = Cursors.Default; } - /// /// 覆土分析中 表格的 双击定位 功能 /// @@ -5155,8 +4873,6 @@ //Refresh(); } - - /// /// 垂直净距分析 功能界面中 清除分析结果按钮 事件处理 /// @@ -5201,7 +4917,6 @@ layerTemp.RemoveAllFeature(); globeControl1.Refresh(); } - /// /// 垂直净距分析功能界面中 关闭按钮 事件处理 /// @@ -5262,7 +4977,6 @@ Refresh(); } - /// /// 导出指定DataGridView控件中的内容 /// @@ -5352,7 +5066,6 @@ } } } - /// /// 垂直净距分析功能界面中 导出Excel按钮 事件处理 /// @@ -5384,103 +5097,7 @@ { MessageBox.Show("表格内容为空!", "提示"); } - } - - - - /// - /// 添加指定路径下的数据 功能 - /// - /// - /// - private object AddLayerData(string strDataPath) - { - object objRes = null; - if (Path.GetExtension(strDataPath).ToLower().Equals(".kml")) - { - GSOLayer layer = globeControl1.Globe.Layers.Add(strDataPath); - objRes = layer; - if (layer != null) - { - 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; - // 注意用insert不要用add,因为后加入的图层在上层 - //layerManagerNode.Nodes.Add(node); - layerManagerNode.Nodes.Insert(0, node); - } - newlayername = layer.Caption; - } - else if (GSOUtility.IsDatasetSupportTerrain(strDataPath)) - { - GSOTerrain terrain = globeControl1.Globe.Terrains.Add(strDataPath); - objRes = terrain; - if (terrain != null) - { - TreeNode node = new TreeNode(); - node.Tag = terrain; - node.Text = terrain.Caption; - node.ImageIndex = 0; - node.SelectedImageIndex = 0; - node.Checked = terrain.Visible; - // 注意用insert不要用add,因为后加入的图层在上层 - // terrainManagerNode.Nodes.Add(node); - layerManagerNode.Nodes.Insert(0, node); - } - newlayername = terrain.Caption; - } - else if (Path.GetExtension(strDataPath).ToLower().Equals(".dxf")) - { - GSOLayer layer = globeControl1.Globe.Layers.Add(strDataPath); - objRes = layer; - if (layer != null) - { - GSODataset dataset = layer.Dataset; - CheckDatasetGeoReference(layer.Dataset, strDataPath); - CheckDatasetGeoReference(layer.Dataset, strDataPath); - TreeNode node = new TreeNode(); - node.Tag = layer; - node.Text = layer.Dataset.Caption; - node.ImageIndex = 0; - node.SelectedImageIndex = 0; - node.Checked = layer.Visible; - // 注意用insert不要用add,因为后加入的图层在上层 - //layerManagerNode.Nodes.Add(node); - layerManagerNode.Nodes.Insert(0, node); - } - newlayername = layer.Caption; - } - else - { - GSOLayer layer = globeControl1.Globe.Layers.Add(strDataPath); - objRes = layer; - if (layer != null) - { - GSODataset dataset = layer.Dataset; - - CheckDatasetGeoReference(layer.Dataset, strDataPath); - CheckDatasetGeoReference(layer.Dataset, strDataPath); - //CheckDatasetGeoReference(dataset); - TreeNode node = new TreeNode(); - node.Tag = layer; - node.Text = layer.Dataset.Caption; - node.ImageIndex = 0; - node.SelectedImageIndex = 0; - node.Checked = layer.Visible; - // 注意用insert不要用add,因为后加入的图层在上层 - //layerManagerNode.Nodes.Add(node); - layerManagerNode.Nodes.Insert(0, node); - } - newlayername = layer.Caption; - } - return objRes; - } - + } /// /// 碰撞分析功能界面中 选择管线复选框 选中状态改变事件处理 /// @@ -5600,7 +5217,6 @@ //globeControl1.Globe.Action = EnumAction3D.SelectObject; } } - /// /// 碰撞分析功能界面中 清除分析结果按钮 事件处理 /// @@ -5638,344 +5254,6 @@ MessageBox.Show("表格内容为空!", "提示"); } } - - ///// - ///// 区域分析 菜单 - ///// - ///// - ///// - //private void buttonItem50_Click(object sender, EventArgs e) - //{ - // buttonItem50.Checked = !buttonItem50.Checked; - // ribbonBarQY.Visible = buttonItem50.Checked; - // ribbonBarQY.Location = new Point(0, 0); - //} - - - /// - /// 连接数据库 菜单事件处理 - /// - /// - /// - private void ConnectDB(object sender, EventArgs e) - { - FrmDatabaseParaSetting frm = new FrmDatabaseParaSetting(globeControl1); - if (frm.ShowDialog() == DialogResult.OK) - { - ds = FrmDatabaseParaSetting.ds; - if (ds != null) - { - ds.IsCloseSaved = false; - } - } - } - - /// - /// 根据指定图层创建图层节点并将节点添加到图层管理节点的子节点集合中 - /// - /// - private void addNodeToLayerManagerNode(GSOLayer layer) - { - if (layer != null) - { - 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; - - if (!layerManagerNode.Nodes.Contains(node)) - { - layerManagerNode.Nodes.Insert(0, node); - layerManagerNode.Expand(); - } - } - } - - /// - /// 获取指定图层中最后一个feature对象的名称对应的整数 - /// - /// - /// - public int getLabelName(GSOLayer layer) - { - int nid = -1; - if (layer.GetAllFeatures().Length > 0) - { - string id = layer.GetAllFeatures()[layer.GetAllFeatures().Length - 1].Name; - - int.TryParse(id, out nid); - } - else - { - nid = 0; - } - return nid; - } - /// - /// 设置除指定标注图层之外的所有标注图层不可见 - /// - /// - public void setMarkerLayerUnVisible(string layerName) - { - string[] markerStrs = new string[10]; - markerStrs[0] = "标高标注"; - markerStrs[1] = "管径标注"; - markerStrs[2] = "埋深标注"; - markerStrs[3] = "坐标标注"; - markerStrs[4] = "坡度标注"; - markerStrs[5] = "属性标注"; - markerStrs[6] = "自定义标注"; - markerStrs[7] = "距离标注"; - markerStrs[8] = "红线工具"; - markerStrs[9] = "扯旗标注"; - - for (int i = 0; i < markerStrs.Length; i++) - { - GSOLayer markerLayer = globeControl1.Globe.Layers.GetLayerByCaption(markerStrs[i]); - if (markerLayer != null) - { - if (markerStrs[i] != layerName) - { - 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) - { - markerFeature.Visible = false; - } - } - if (layerMarkerTree.Nodes[0].Nodes.Count > i) - { - layerMarkerTree.Nodes[0].Nodes[i].Checked = true; - } - } - } - } - } - - /// - /// 判断选中的对象是否为管线 - /// - /// 被选中管线 - /// 返回一根线 - private GSOFeature IsPipeLineOfSelectedObj() - { - GSOFeature resFeature = null; - if (globeControl1.Globe.SelObjectCount < 1) - { - return null; - } - GSOLayer resLayer = null; - globeControl1.Globe.GetSelectObject(0, out resFeature, out resLayer); - if (resFeature == null) - return null; - - GSOGeoPolyline3D line1 = resFeature.Geometry as GSOGeoPolyline3D; - if (line1 == null) - { - return null; - } - GSOPipeLineStyle3D pipeStyle1 = line1.Style as GSOPipeLineStyle3D; - if (pipeStyle1 == null) - { - return null; - } - return resFeature; - } - - /// - /// 图层节点树中 节点 右键单击事件处理 - /// - /// - /// - private void layerMarkerTree_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e) - { - if (e.Button == MouseButtons.Right) - { - if (e.Node.Text == "标注管理" || e.Node.Text == "传感器管理") - { - return; - } - else if (e.Node.Parent.Text == "标注管理") - { - layerMarkerTree.SelectedNode = e.Node; - contextMenuStrip2.Show(layerMarkerTree, e.X, e.Y); - contextMenuStrip2.Tag = e.Node; - } - else if (e.Node.Parent.Text == "传感器管理") - { - layerSensorTree.SelectedNode = e.Node; - contextMenuStrip2.Show(layerSensorTree, e.X, e.Y); - contextMenuStrip2.Tag = e.Node; - } - else - { - if (e.Node.Tag is GSOFeature) - { - if (e.Node.Parent.Parent.Text == "标注管理") - { - layerMarkerTree.SelectedNode = e.Node; - contextMenuStrip3.Show(layerMarkerTree, e.X, e.Y); - contextMenuStrip3.Tag = e.Node; - } - else if (e.Node.Parent.Parent.Text == "传感器管理") - { - layerSensorTree.SelectedNode = e.Node; - contextMenuStrip3.Show(layerSensorTree, e.X, e.Y); - contextMenuStrip3.Tag = e.Node; - } - } - } - } - } - - /// - /// 标注管理、传感器管理 图层目录树的右键菜单中的 刷新列表 菜单 - /// - /// - /// - private void toolStripMenuItem1_Click(object sender, EventArgs e) - { - TreeNode node = contextMenuStrip2.Tag as TreeNode; - TreeNode parentNode = node.Parent; - Int32 nIndex = node.Index; - - if (parentNode.Text == "标注管理" || parentNode.Text == "传感器管理") - { - RefreshTreeNodeLayerFeatureList(node); - } - } - /// - /// 给指定的图层节点添加代表feature对象的子节点 - /// - /// - private void RefreshTreeNodeLayerFeatureList(TreeNode layerTreeNode) - { - layerTreeNode.Nodes.Clear(); - GSOLayer layer = (GSOLayer)layerTreeNode.Tag; - // 只将类型为内存数据集的图层列出,如果是其它类型的数据集可能数据量太大,没发显示在树控件中 - if (layer.Dataset is GSOFeatureDataset) - { - VisitFeature3Ds(layer.GetAllFeatures(), layerTreeNode); - } - } - - /// - /// 标注管理、传感器管理 图层目录树的右键菜单中的 移除所有 菜单 - /// - /// - /// - private void toolStripMenuItem2_Click(object sender, EventArgs e) - { - TreeNode node = contextMenuStrip3.Tag as TreeNode; - GSOFeature feature3d = node.Tag as GSOFeature; - if (node == null) - { - return; - } - if (feature3d != null) - { - feature3d.Delete(); - globeControl1.Globe.Refresh(); - node.Remove(); - } - } - - /// - /// 图层目录树的 节点对应的复选框选中状态改变事件处理 - /// - /// - /// - private void layerMarkerTree_AfterCheck(object sender, TreeViewEventArgs e) - { - if (e.Action != TreeViewAction.Unknown) - { - CheckTreeNode(e.Node, e.Node.Checked); - } - } - /// - /// 改变指定节点对应的复选框的选中状态 - /// - /// - /// - private void CheckTreeNode(TreeNode node, Boolean bChecked) - { - CheckChildTreeNode(node, bChecked); - globeControl1.Globe.Refresh(); - } - /// - /// 改变指定节点的子节点对应的复选框的选中状态 - /// - /// - /// - private void CheckChildTreeNode(TreeNode node, Boolean bChecked) - { - if (node == null) - { - return; - } - if (node.Tag != null) - { - if (node.Tag.GetType() == typeof(GSOFeatureFolder) || node.Tag.GetType() == typeof(GSOFeature)) - { - ((GSOFeature)node.Tag).SetVisibleDirectly(bChecked); - } - else - { - GSOLayer curLayer = node.Tag as GSOLayer; - GSOTerrain curTerrain = node.Tag as GSOTerrain; - if (curLayer != null) - { - curLayer.Visible = bChecked; - } - else if (curTerrain != null) - { - curTerrain.Visible = bChecked; - } - } - } - // 递归处理子节点 - for (int i = 0; i < node.Nodes.Count; i++) - { - node.Nodes[i].Checked = bChecked; - CheckChildTreeNode(node.Nodes[i], bChecked); - } - } - /// - /// 标注管理、传感器管理 目录树中的feature节点的右键菜单中的 删除 菜单 - /// - /// - /// - private void 删除ToolStripMenuItem1_Click(object sender, EventArgs e) - { - TreeNode node = contextMenuStrip2.Tag as TreeNode; - GSOLayer l = globeControl1.Globe.Layers.GetLayerByCaption(node.Text); - if (l != null) - { - l.RemoveAllFeature(); - node.Nodes.Clear(); - globeControl1.Refresh(); - } - } - - //定时检查传感器的状态 - public System.Windows.Forms.Timer timerOfSensor = null; - - /// /// 碰撞分析 功能界面中 关闭按钮 事件处理 /// @@ -5984,7 +5262,6 @@ private void buttonX7_Click_1(object sender, EventArgs e) { trackflag = ""; - globeControl1.Globe.Action = EnumAction3D.ActionNull; sideBarPanelItem4.Visible = false; panel2.Visible = false; @@ -5994,14 +5271,9 @@ dataGridViewX4.Rows.Clear(); dataGridViewX5.Rows.Clear(); if (buttonItem1.Checked) - { sideBar1.ExpandedPanel = sideBarPanelItem3; - } else - { sideBar1.Visible = false; - - } Refresh(); } /// @@ -6193,14 +5465,8 @@ comboBoxLayer.SelectedIndex = -1; dataGridViewLineList.Rows.Clear(); dataGridViewAnalysisResult.Rows.Clear(); - //if (buttonItem1.Checked) - //{ - // sideBar1.ExpandedPanel = sideBarPanelItem3; - //} - //else - //{ + sideBar1.Visible = false; - //} Refresh(); } /// @@ -6225,9 +5491,7 @@ globeControl1.Globe.JumpToPosition(point3d, EnumAltitudeMode.Absolute, 5); } else - { globeControl1.Globe.JumpToFeature(rowFeature, 5); - } } } } @@ -6308,897 +5572,6 @@ } } } - - /// - /// 一键审核---导入数据 - /// - /// - /// - private void buttonItem127_Click_2(object sender, EventArgs e) - { - LogManager.saveLog(Utility.userName, "打开数据"); - - try - { - - string dbIp = Utility.sgdbip; - string database = Utility.sgdbname; - string user = Utility.sgdbuser; - string pass = Utility.sgdbpwd; - shds = globeControl1.Globe.DataManager.OpenOracleDataSource(dbIp + "/" + database, "", "", user, pass); - if (shds == null) - { - MessageBox.Show("数据库连接失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); - } - Cyberpipe.Forms.FrmPipelineModelDataOneStep frm = new Cyberpipe.Forms.FrmPipelineModelDataOneStep(globeControl1, shds, layerTree); - if (frm.ShowDialog() == DialogResult.OK) - { - addNodeToLayerManagerNode(frm.rukuLayer); - } - } - catch (Exception ex) - { - LogError.PublishError(ex); - MessageBox.Show("内存过载请清理内存,并重新启动规划分析!", "提示"); - return; - } - - } - - /// - ///自动导出图片 - /// - /// - /// - private void buttonItem130_Click_1(object sender, EventArgs e) - { - LogManager.saveLog(Utility.userName, "导出审核图"); - - Point pt1 = new Point(Convert.ToInt32(0), Convert.ToInt32(0)); - Point pt2 = new Point(Convert.ToInt32(panelEx5.Width), Convert.ToInt32(panelEx5.Height)); - /*Point pt = getUpperLeftPoint(pt1, pt2); - Image myImg = new Bitmap(Convert.ToInt32(panelEx5.Width), Convert.ToInt32(panelEx5.Height)); - Graphics g = Graphics.FromImage(myImg); - g.CopyFromScreen(pt, new Point(0, 0), new Size(Convert.ToInt32(panelEx5.Width), Convert.ToInt32(panelEx5.Height))); - */ - - 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 = System.IO.Path.GetExtension(dlg.FileName);//扩展名 - switch (extension) - { - case ".jpg": - myImg.Save(dlg.FileName, System.Drawing.Imaging.ImageFormat.Jpeg); - break; - case ".png": - myImg.Save(dlg.FileName, System.Drawing.Imaging.ImageFormat.Png); - break; - case ".bmp": - myImg.Save(dlg.FileName, System.Drawing.Imaging.ImageFormat.Bmp); - break; - case ".gif": - myImg.Save(dlg.FileName, System.Drawing.Imaging.ImageFormat.Gif); - break; - default: - break; - } - } - } - /// - /// 一键审核功能 - /// - /// - /// - private void buttonItem128_Click(object sender, EventArgs e) - { - LogManager.saveLog(Utility.userName, this.buttonItem128.Text); - //垂直净距标准 - - frmSh = new FrmYJSHTC(globeControl1, globeControl2, layerTree); - - if (frmSh.ShowDialog() == DialogResult.OK) - { - frmWait = new FrmWait("一键审核……"); - frmWait.Location = new Point(this.Width - frmWait.Width - 10, this.Height - frmWait.Height - 50); - frmWait.Owner = this; - frmWait.Show(); - Thread thread = new Thread(new ThreadStart(doWork)); - thread.IsBackground = true; - thread.Start(); - } - } - - void doWork() - { - FrmShResult frmShResult = null; - - double dVerticalJingJuBiaoZhun = 1, dHorizontalJingJuBiaoZhun = 1; - if (frmSh.rukuLayer != null) - { - #region - this.Invoke((EventHandler)delegate - { - try - { - List managerLayerList = new List(); - for (int i = 0; i < layerManagerNode.Nodes.Count; i++) - { - managerLayerList.Add(layerManagerNode.Nodes[i].Text); - } - if (!managerLayerList.Contains(frmSh.rukuLayer.Caption)) - { - TreeNode node = new TreeNode(); - node.Tag = frmSh.rukuLayer; - node.Text = frmSh.rukuLayer.Dataset.Caption; - node.ImageIndex = 0; - node.SelectedImageIndex = 0; - node.Checked = frmSh.rukuLayer.Visible; - layerManagerNode.Nodes.Insert(0, node); - layerManagerNode.Expand(); - } - } - catch (Exception ex) - { - MessageBox.Show(ex.Message, "提示"); - } - }); - #endregion - - shlayername = frmSh.rukuLayer.Name; - globeControl1.Refresh(); - } - - if (frmShResult != null && !frmShResult.IsDisposed) - { - try - { - clearFeatureHighLight(); - ClearRedlineAnalyseResult(); - frmShResult.Close(); - } - catch (Exception ex) - { - MessageBox.Show(ex.Message); - } - } - - frmShResult = new FrmShResult(dVerticalJingJuBiaoZhun, dHorizontalJingJuBiaoZhun, shlayername, globeControl1, m_PipelineLayerNames); - if (boolfrmShResult == false) - { - frmShResult.Location = new Point(this.Width - frmShResult.Width - 10, this.Height - frmShResult.Height - 50); - frmShResult.Owner = this; - //一键审核实际计算步骤 - frmShResult.analysis(); - - //MainFrm窗体显示控制,回到一键审核Tab - this.Invoke((EventHandler)delegate - { - frmShResult.Show(); - frmWait.Close(); - //将tab页恢复到一键审核 - ribbonTabItem11.Checked = true; - try - { - globeControl1.Globe.Action = EnumAction3D.ActionNull; - //zhanshi = false; - splitContainer1.Panel2Collapsed = true; - - panelOfTable.Visible = false; - legendSC.Visible = false; - legendSG.Visible = false; - - GSOLayer redLayer = globeControl1.Globe.Layers.GetLayerByCaption("红线"); - if (redLayer != null) - { - redLayer.Visible = false; - } - } - catch (Exception ex) - { - MessageBox.Show("系统运行错误:" + ex.ToString(), "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); - } - - }); - - boolfrmShResult = true; - } - else - { - - } - } - - - /// - /// 清除渲染结果 - /// - public void ClearRedlineAnalyseResult() - { - for (int i = 0; i < globeControl1.Globe.Layers.Count; i++) - { - GSOLayer layer = globeControl1.Globe.Layers[i]; - if (layer.Caption == "tempLgdData") - { - layer.RemoveAllFeature(); - } - } - - layerTemp.RemoveAllFeature(); - globeControl1.Refresh(); - } - /// - /// 已审核的图层 - /// - /// - /// - private void buttonItem132_Click_1(object sender, EventArgs e) - { - //保存日志 - LogManager.saveLog(Utility.userName, this.buttonItem132.Text); - - if (shds == null) - { - //没连的话,直接连接审核库; //审核库配置读配置文件 - string dbIp = Utility.sgdbip; - string database = Utility.sgdbname; - string user = Utility.sgdbuser; - string pass = Utility.sgdbpwd; - - /* - if (!Utility.isNetworkConnectionSuccess(dbIp.Trim())) - { - MessageBox.Show("网络连接失败!", "提示"); - return; - } - */ - - shds = globeControl1.Globe.DataManager.OpenOracleDataSource(dbIp + "/" + database, "", "", user, pass); - if (shds == null) - { - MessageBox.Show("数据库连接失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); - } - } - Cyberpipe.Forms.FrmShLayers frm = new Cyberpipe.Forms.FrmShLayers(globeControl1, shds); - frm.Show(); - //if (frm.ShowDialog() == DialogResult.OK) - //{ - // addNodeToLayerManagerNode(frm.rukuLayer); - //} - //if (frm.rukuLayer != null) - //{ - // shlayername = frm.rukuLayer.Name; - //} - - } - /// - /// 审核入库 - /// - /// - /// - private void buttonItem133_Click_1(object sender, EventArgs e) - { - LogManager.saveLog(Utility.userName, "审核入库"); - FrmShRK frmShrk = new FrmShRK(globeControl1); - frmShrk.Show(); - } - /// - /// 模拟设计修改 - /// - /// - /// - private void buttonItem134_Click_1(object sender, EventArgs e) - { - LogManager.saveLog(Utility.userName, "模拟设计修改"); - - frmModify = new FrmMnModify(globeControl1, shlayername, shresultLists); - - if (boolfrmModify == false) - { - frmModify.Owner = this; - frmModify.Location = new Point(this.Width - frmModify.Width - 10, this.Height - frmModify.Height - 50); - frmModify.Show(); - boolfrmModify = true; - } - else - { - - } - - } - - - - /// - /// 一键审核中调节透明度 - /// - /// - /// - private void sliderItem1_ValueChanged(object sender, EventArgs e) - { - LogManager.saveLog(Utility.userName, this.sliderItem1.Text); - - globeControl1.Globe.GroundOpaque = 100 - sliderItem1.Value; - GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(roadLayerName);//("180fd"); - if (layer != null) - { - layer.Opaque = 100 - sliderItem1.Value; - } - - optiValue = sliderItem1.Value; - } - /// - /// 红线审核中的透明度分析 - /// - /// - /// - private void sliderItem3_ValueChanged(object sender, EventArgs e) - { - LogManager.saveLog(Utility.userName, this.sliderItem3.Text); - - globeControl1.Globe.GroundOpaque = 100 - sliderItem3.Value; - GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(roadLayerName);//("180fd"); - if (layer != null) - { - layer.Opaque = 100 - sliderItem3.Value; - } - optiValue = sliderItem3.Value; - } - - #region yanxiaowei - //初始化DataGridViewX1控件 - public delegate void DataGridViewDelegate(DataTable dt, string strLable, string strLayer, bool initDataGrid); - /// - /// 代理函数,操作DatgridViewX1 - /// - /// - /// - public void InitDataGridViewX1(DataTable dt, string strLable, string strLayer, bool initDataGrid) - { - if (initDataGrid == true) - { - dataGridViewX1.DataSource = dt; - panelOfTable.Visible = true; - toolStripNumbers.Text = strLable; - dataGridViewX1.Tag = strLayer; - } - else - { - dataGridViewX1.DataSource = null; - dataGridViewX1.Refresh(); - panelOfTable.Visible = false; - toolStripNumbers.Text = ""; - dataGridViewX1.Tag = ""; - globeControl1.Globe.MemoryLayer.RemoveAllFeature();//清除双击产生的标注 - } - } - FrmAnalysisGuiHuaResult from; - /// - /// 主窗体下方属性表格 双击定位 功能 - /// - /// - /// - 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 if (dataGridViewX1.Columns.Contains("标识器编号")) - { - featureName = dataGridViewX1.Rows[hittestinfo.RowIndex].Cells["标识器编号"].Value.ToString(); - } - featureName = featureName.Trim(); - - GSOLayer layer = null; - layer = globeControl1.Globe.Layers.GetLayerByCaption(dataGridViewX1.Tag.ToString()); - - if (layer == null) return; - - GSOFeatures features = layer.GetFeatureByName(featureName, false); - if (features.Length == 0) return; - GSOFeature rowFeature = features[0]; - - ClassSearchAnalysis.AddMakerToLineFeature(globeControl1, rowFeature); - - } - } - } - else - { - if (e.Button == MouseButtons.Left) - { - if (from != null && !from.IsDisposed) - { - try - { - from.Close(); - } - catch (Exception ex) - { - LogError.PublishError(ex); - } - } - try - { - DataGridView.HitTestInfo hittestinfo = dataGridViewX1.HitTest(e.X, e.Y); - if (hittestinfo.RowIndex >= 0) - { - string layer = dataGridViewX1.Rows[hittestinfo.RowIndex].Cells["管线类型"].Value.ToString(); - string hxName = dataGridViewX1.Rows[hittestinfo.RowIndex].Cells["红线编号"].Value.ToString(); - FrmAnalysisGuiHuaResult frm = new FrmAnalysisGuiHuaResult(globeControl1, lineStruct, featsList, - panelOfTable, dataGridViewX1, layer, hxName); - frm.Location = new Point(this.Width - frm.Width - 10, this.Height - frm.Height - 20); - frm.Show(this); - - from = frm; - } - } - catch (Exception ex) - { - LogError.PublishError(ex); - } - } - } - } - - /// - /// 空间查询 - /// - /// - /// - private void buttonItemSearch1_Click(object sender, EventArgs e) - { - LogManager.saveLog(Utility.userName, this.buttonItemSearch1.Text); - - trackflag = "PipelineSpatialQuery"; - globeControl1.Globe.Action = EnumAction3D.TrackPolygon; - globeControl1.Globe.TrackPolygonTool.TrackMode = EnumTrackMode.SpaceTrack; - - } - /// - /// 关键字查询 - /// - /// - /// - private void buttonItemSearch9_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, this.buttonItemSearch9.Text); - - FrmKeywordQuery.ShowForm(globeControl1, m_PipelineLayerNames, new DataGridViewDelegate(InitDataGridViewX1)); - } - /// - /// 编号查询 - /// - /// - /// - private void buttonItemSearch2_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, this.buttonItemSearch2.Text); - - FrmCodingQuery.ShowForm(globeControl1, m_PipelineLayerNames, new DataGridViewDelegate(InitDataGridViewX1)); - } - /// - /// 坐标查询 - /// - /// - /// - private void buttonItemSearch3_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, this.buttonItemSearch3.Text); - - FrmSetLatLonPos.ShowForm(globeControl1); - } - /// - /// 附属物查询 - /// - /// - /// - private void buttonItemSearch10_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, this.buttonItemSearch10.Text); - - FrmFittingQuery.ShowForm(globeControl1, instrumenLayerNames, new DataGridViewDelegate(InitDataGridViewX1)); - } - /// - /// 管径查询 - /// - /// - /// - private void buttonItemSearch4_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, this.buttonItemSearch4.Text); - - FrmDiameterQuery.ShowForm(globeControl1, m_PipelineLayerNames, new DataGridViewDelegate(InitDataGridViewX1)); - } - /// - /// 材质查询 - /// - /// - /// - private void buttonItemSearch5_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, this.buttonItemSearch5.Text); - - FrmMaterialSel.ShowForm(globeControl1, m_PipelineLayerNames, new DataGridViewDelegate(InitDataGridViewX1)); - } - /// - /// 基本查询 - /// - /// - /// - private void buttonItemSearch6_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, this.buttonItemSearch6.Text); - - FrmBasicQuery.ShowForm(globeControl1, new DataGridViewDelegate(InitDataGridViewX1)); - } - /// - /// 复合查询 - /// - /// - /// - private void buttonItemSearch7_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, this.buttonItemSearch7.Text); - - FrmQuerySQL.ShowForm(globeControl1, new DataGridViewDelegate(InitDataGridViewX1)); - } - /// - /// 关联查询 - /// - /// - /// - private void buttonItemSearch8_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, this.buttonItemSearch8.Text); - - if (globeControl1.Globe.SelObjectCount != 1) - { - MessageBox.Show("请选中一个对象!", "提示"); - return; - } - - double valueAllowance = 1.0; - - for (int j = 0; j < globeControl1.Globe.SelObjectCount; j++) - { - GSOFeature feature = null; - GSOLayer layer = null; - globeControl1.Globe.GetSelectObject(j, out feature, out layer); - - if (feature == null && feature.Geometry == null || (feature.Geometry.Type == EnumGeometryType.GeoPolygon3D - || feature.Geometry.Type == EnumGeometryType.GeoWater)) - return; - else - { - ClassSearchAnalysis.ResultRelationAnalysis(globeControl1, feature, valueLayerNames, workwellLayerNames, - instrumenLayerNames, pipefittingLayerNames, m_PipelineLayerNames, valueAllowance); - } - } - } - #endregion - /// - /// 清除分析 - /// - /// - /// - private void buttonItemClear_Click(object sender, EventArgs e) - { - LogManager.saveLog(Utility.userName, this.buttonItemClear.Text); - - globeControl1.Globe.ClearMeasure(); - layerTemp.RemoveAllFeature(); - layerTemp2.RemoveAllFeature(); - buttonItemLS5.Checked = false; - - dataGridViewX1.DataSource = null; - panelOfTable.Visible = false; - - globeControl1.Globe.MemoryLayer.RemoveAllFeature(); - globeControl1.Globe.ClearAnalysis(); - - - // 清除净距分析结果 - buttonX2_Click(null, null); - buttonX8_Click(null, null); - buttonX15_Click(null, null); - buttonX16_Click(null, null); - buttonClearAnalysisResult_Click(null, null); - - NetworkAnalysisTool.ClearAllTopAnalysis(this.globeControl1); - // ClearConnexityAnalysis();//清除连通性分析 - // 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); - } - } - - GSOFeatures feats = globeControl1.Globe.MemoryLayer.GetFeatureByName("粒子要素", true); - if (feats.Length > 0) - globeControl1.Globe.MemoryLayer.RemoveFeatureByID(feats[0].ID); - - globeControl1.Globe.UnderGroundFloor.Visible = false;//隐藏地下网格线 - - // ClearUpDownTraceAnalysis(); //清除上下游分析 - globeControl1.Globe.RemoveAllPits();//清除所有坑 - - string[] markerStrs = new string[9]; - markerStrs[0] = "标高标注"; - markerStrs[1] = "管径标注"; - markerStrs[2] = "埋深标注"; - markerStrs[3] = "坐标标注"; - markerStrs[4] = "坡度标注"; - markerStrs[5] = "属性标注"; - markerStrs[6] = "自定义标注"; - markerStrs[7] = "距离标注"; - markerStrs[8] = "扯旗标注"; - for (int i = 0; i < markerStrs.Length; i++) - { - GSOLayer markerLayer = globeControl1.Globe.Layers.GetLayerByCaption(markerStrs[i]); - markerLayer.RemoveAllFeature(); - } - if (layerMarkerTree != null && layerMarkerTree.Nodes.Count > 0) - { - for (int i = 0; i < layerMarkerTree.Nodes[0].Nodes.Count; i++) - { - layerMarkerTree.Nodes[0].Nodes[i].Nodes.Clear(); - } - } - - clearFeatureHighLight();//取消管线高亮 - - GSOLayer layerGround = globeControl1.Globe.Layers.GetLayerByCaption(roadLayerName);//("180fd"); - if (layerGround != null) - { - layerGround.Visible = true; - } - globeControl1.Refresh(); - globeControl2.Refresh(); - ClearRedlineAnalyseResult(); - globeControl1.Globe.Action = EnumAction3D.ActionNull; - } - /// - /// 管线长度全区域统计 - /// - /// - /// - private void buttonItemTJ1_ALL_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, "管线长度统计"); - FrmAllPipelineStatis frm = new FrmAllPipelineStatis(globeControl1, null, new DataGridViewDelegate(InitDataGridViewX1), m_PipelineLayerNames); - frm.Show(this); - - } - /// - /// 管线长度绘制区域统计 - /// - /// - /// - private void buttonItemTJ1_DRAW_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, "管线长度统计"); - - trackflag = "PipelineDistanceStatistics"; - globeControl1.Globe.Action = EnumAction3D.TrackPolygon; - globeControl1.Globe.TrackPolygonTool.TrackMode = EnumTrackMode.SpaceTrack; - } - /// - /// 阀门数量全区域统计 - /// - /// - /// - private void buttonItemTJ2_ALL_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, "阀门数量统计"); - FrmValveStatistics frm = new FrmValveStatistics(globeControl1, null, new DataGridViewDelegate(InitDataGridViewX1)); - frm.Show(this); - - globeControl1.Globe.Action = EnumAction3D.ActionNull; - } - /// - /// 阀门数量绘制区域统计 - /// - /// - /// - private void buttonItemTJ2_DRAW_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, "阀门数量统计"); - - trackflag = "valvequery"; - globeControl1.Globe.Action = EnumAction3D.TrackPolygon; - globeControl1.Globe.TrackPolygonTool.TrackMode = EnumTrackMode.SpaceTrack; - } - /// - /// 井盖数量全区域统计 - /// - /// - /// - private void buttonItemTJ3_ALL_Click(object sender, EventArgs e) - { - FrmAllWorkWellStatis frm = new FrmAllWorkWellStatis(globeControl1, null, new DataGridViewDelegate(InitDataGridViewX1)); - frm.Show(this); - } - /// - /// 井盖数量绘制区域统计 - /// - /// - /// - private void buttonItemTJ3_DRAW_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, "井盖数量统计"); - - trackflag = "workwellquery"; - globeControl1.Globe.Action = EnumAction3D.TrackPolygon; - globeControl1.Globe.TrackPolygonTool.TrackMode = EnumTrackMode.SpaceTrack; - } - /// - /// 管径分段统计全区域统计 - /// - /// - /// - private void buttonItemTJ4_ALL_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, "管径分段统计"); - - Frmpipediameterstatis.ShowForm(globeControl1, m_PipelineLayerNames, 0); - } - /// - /// 管径分段统计绘制区域统计 - /// - /// - /// - private void buttonItemTJ4_DRAW_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, "管径分段统计"); - - trackflag = null; - Frmpipediameterstatis.ShowForm(globeControl1, m_PipelineLayerNames, 1); - } - /// - /// 埋深分段统计全区域统计 - /// - /// - /// - private void buttonItemTJ5_ALL_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, "埋深分段统计"); - FrmpipeDeepstatis.ShowForm(globeControl1, m_PipelineLayerNames, 0); - } - /// - /// 埋深分段统计绘制区域统计 - /// - /// - /// - private void buttonItemTJ5_DRAW_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, "埋深分段统计"); - trackflag = null; - FrmpipeDeepstatis.ShowForm(globeControl1, m_PipelineLayerNames, 1); - } - /// - /// 管径分类统计全区域统计 - /// - /// - /// - private void buttonItemTJ6_ALL_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, "管径分类汇总"); - - FrmpipeDiametergather.ShowForm(globeControl1, m_PipelineLayerNames, 0); - } - /// - /// 管径分类统计绘制区域统计 - /// - /// - /// - private void buttonItemTJ6_DRAW_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, "管径分类汇总"); - - trackflag = null; - FrmpipeDiametergather.ShowForm(globeControl1, m_PipelineLayerNames, 1); - } - /// - /// 材质分类统计全区域统计 - /// - /// - /// - private void buttonItemTJ7_ALL_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, "材质分类汇总"); - - FrmpipeMaterialGather.ShowForm(globeControl1, m_PipelineLayerNames, 0); - } - /// - /// 材质分类统计绘制区域统计 - /// - /// - /// - private void buttonItemTJ7_DRAW_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, "材质分类汇总"); - - trackflag = null; - FrmpipeMaterialGather.ShowForm(globeControl1, m_PipelineLayerNames, 1); - } - /// - /// 附属物分类统计全区域统计 - /// - /// - /// - private void buttonItemTJ8_ALL_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, "附属物分类汇总"); - - FrmAccessoriesgather.ShowForm(globeControl1, instrumenLayerNames, 0); - } - /// - /// 附属物分类统计绘制区域统计 - /// - /// - /// - private void buttonItemTJ8_DRAW_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, "附属物分类汇总"); - - trackflag = null; - FrmAccessoriesgather.ShowForm(globeControl1, instrumenLayerNames, 1); - } /// /// 碰撞分析 /// @@ -7206,7 +5579,6 @@ /// private void buttonItemFX1_1_Click(object sender, EventArgs e) { - //日志记录 LogManager.saveLog(Utility.userName, this.buttonItemFX4_4.Text); this.dataGridViewX4.Size = new System.Drawing.Size(195, 120); @@ -7352,7 +5724,1332 @@ sideBar1.Refresh(); Refresh(); } + /// + /// 碰撞审查 + /// + /// + /// + private void buttonItemSH1_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, this.buttonItemSH1.Text); + this.dataGridViewX4.Size = new System.Drawing.Size(185, 92); + this.dataGridViewX5.Size = new System.Drawing.Size(185, 120); + + layerTemp.RemoveAllFeature(); + clearFeatureHighLight(); + globeControl1.Refresh(); + + sideBar1.Visible = true; + sideBarPanelItem3.Visible = true; + buttonItem1.Checked = true; + controlContainerItem3.Visible = true; + sideBarPanelItem4.Visible = true; + sideBarPanelItem4.Text = "碰撞审查"; + trackflag = "collision"; + controlContainerItem5.Control = panel2; + panel2.Dock = DockStyle.Fill; + panel2.Visible = true; + sideBar1.ExpandedPanel = sideBarPanelItem4; + sideBar1.Refresh(); + + Refresh(); + } + /// + /// 覆土审查 + /// + /// + /// + private void buttonItemSH2_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, this.buttonItemSH2.Text); + + this.dataGridViewX6.Size = new System.Drawing.Size(185, 92); + this.dataGridViewX7.Size = new System.Drawing.Size(185, 120); + + layerTemp.RemoveAllFeature(); + clearFeatureHighLight(); + globeControl1.Refresh(); + sideBar1.Visible = true; + sideBarPanelItem3.Visible = true; + buttonItem1.Checked = true; + controlContainerItem3.Visible = true; + sideBarPanelItem4.Visible = true; + sideBarPanelItem4.Text = "覆土审查"; + trackflag = "ftAnalysis"; + controlContainerItem5.Control = panel4; + panel4.Visible = true; + panel4.Dock = DockStyle.Fill; + sideBar1.ExpandedPanel = sideBarPanelItem4; + sideBar1.Refresh(); + Refresh(); + } + /// + /// 水平净距审查 + /// + /// + /// + private void buttonItemSH3_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, this.buttonItemSH3.Text); + + this.dataGridViewX8.Size = new System.Drawing.Size(190, 92); + this.dataGridViewX9.Size = new System.Drawing.Size(190, 120); + + layerTemp.RemoveAllFeature(); + clearFeatureHighLight(); + globeControl1.Refresh(); + sideBar1.Visible = true; + sideBarPanelItem3.Visible = true; + buttonItem1.Checked = true; + controlContainerItem3.Visible = true; + sideBarPanelItem4.Visible = true; + sideBarPanelItem4.Text = "水平净距审查"; + trackflag = "horizontal"; + controlContainerItem5.Control = panel5; + panel5.Dock = DockStyle.Fill; + panel5.Visible = true; + sideBar1.ExpandedPanel = sideBarPanelItem4; + sideBar1.Refresh(); + Refresh(); + } + /// + /// 垂直净距审查 + /// + /// + /// + private void buttonItemSH4_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, this.buttonItemSH4.Text); + + this.dataGridViewX2.Visible = true; + this.dataGridViewX3.Visible = true; + this.dataGridViewX2.Size = new System.Drawing.Size(185, 92); + this.dataGridViewX3.Size = new System.Drawing.Size(185, 120); + + layerTemp.RemoveAllFeature(); + clearFeatureHighLight(); + + globeControl1.Refresh(); + sideBar1.Visible = true; + sideBarPanelItem3.Visible = true; + buttonItem1.Checked = true; + controlContainerItem3.Visible = true; + sideBarPanelItem4.Visible = true; + sideBarPanelItem4.Text = "垂直净距审查"; + trackflag = "vertical"; + //globeControl1.Globe.Action = EnumAction3D.SelectObject; + panel2.Visible = false; + panel3.Visible = false; + panel5.Visible = false; + panel4.Visible = false; + controlContainerItem5.Control = panel1; + panel1.Dock = DockStyle.Fill; + panel1.Visible = true; + sideBar1.ExpandedPanel = sideBarPanelItem4; + sideBar1.Refresh(); + Refresh(); + } + #endregion + + /// + /// 添加指定路径下的数据 功能 + /// + /// + /// + private object AddLayerData(string strDataPath) + { + object objRes = null; + if (Path.GetExtension(strDataPath).ToLower().Equals(".kml")) + { + GSOLayer layer = globeControl1.Globe.Layers.Add(strDataPath); + objRes = layer; + if (layer != null) + { + 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; + layerManagerNode.Nodes.Insert(0, node); + } + newlayername = layer.Caption; + } + else if (GSOUtility.IsDatasetSupportTerrain(strDataPath)) + { + GSOTerrain terrain = globeControl1.Globe.Terrains.Add(strDataPath); + objRes = terrain; + if (terrain != null) + { + TreeNode node = new TreeNode(); + node.Tag = terrain; + node.Text = terrain.Caption; + node.ImageIndex = 0; + node.SelectedImageIndex = 0; + node.Checked = terrain.Visible; + layerManagerNode.Nodes.Insert(0, node); + } + newlayername = terrain.Caption; + } + else if (Path.GetExtension(strDataPath).ToLower().Equals(".dxf")) + { + GSOLayer layer = globeControl1.Globe.Layers.Add(strDataPath); + objRes = layer; + if (layer != null) + { + GSODataset dataset = layer.Dataset; + CheckDatasetGeoReference(layer.Dataset, strDataPath); + CheckDatasetGeoReference(layer.Dataset, strDataPath); + TreeNode node = new TreeNode(); + node.Tag = layer; + node.Text = layer.Dataset.Caption; + node.ImageIndex = 0; + node.SelectedImageIndex = 0; + node.Checked = layer.Visible; + layerManagerNode.Nodes.Insert(0, node); + } + newlayername = layer.Caption; + } + else + { + GSOLayer layer = globeControl1.Globe.Layers.Add(strDataPath); + + objRes = layer; + if (layer == null) + MessageBox.Show("layer is null"); + + CheckDatasetGeoReference(layer.Dataset, strDataPath); + TreeNode node = new TreeNode(); + node.Tag = layer; + node.Text = layer.Dataset.Caption; + node.ImageIndex = 0; + node.SelectedImageIndex = 0; + node.Checked = layer.Visible; + layerManagerNode.Nodes.Insert(0, node); + + newlayername = layer.Caption; + } + return objRes; + } + /// + /// 连接数据库 菜单事件处理 + /// + /// + /// + private void ConnectDB(object sender, EventArgs e) + { + FrmDatabaseParaSetting frm = new FrmDatabaseParaSetting(globeControl1); + if (frm.ShowDialog() == DialogResult.OK) + { + ds = FrmDatabaseParaSetting.ds; + if (ds != null) + { + ds.IsCloseSaved = false; + } + } + } + /// + /// 根据指定图层创建图层节点并将节点添加到图层管理节点的子节点集合中 + /// + /// + private void addNodeToLayerManagerNode(GSOLayer layer) + { + if (layer != null) + { + 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; + + if (!layerManagerNode.Nodes.Contains(node)) + { + layerManagerNode.Nodes.Insert(0, node); + layerManagerNode.Expand(); + } + } + } + /// + /// 获取指定图层中最后一个feature对象的名称对应的整数 + /// + /// + /// + public int getLabelName(GSOLayer layer) + { + int nid = -1; + if (layer.GetAllFeatures().Length > 0) + { + string id = layer.GetAllFeatures()[layer.GetAllFeatures().Length - 1].Name; + + int.TryParse(id, out nid); + } + else + { + nid = 0; + } + return nid; + } + /// + /// 设置除指定标注图层之外的所有标注图层不可见 + /// + /// + public void setMarkerLayerUnVisible(string layerName) + { + string[] markerStrs = new string[10]; + markerStrs[0] = "标高标注"; + markerStrs[1] = "管径标注"; + markerStrs[2] = "埋深标注"; + markerStrs[3] = "坐标标注"; + markerStrs[4] = "坡度标注"; + markerStrs[5] = "属性标注"; + markerStrs[6] = "自定义标注"; + markerStrs[7] = "距离标注"; + markerStrs[8] = "红线工具"; + markerStrs[9] = "扯旗标注"; + + for (int i = 0; i < markerStrs.Length; i++) + { + GSOLayer markerLayer = globeControl1.Globe.Layers.GetLayerByCaption(markerStrs[i]); + if (markerLayer != null) + { + if (markerStrs[i] != layerName) + { + 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) + { + markerFeature.Visible = false; + } + } + if (layerMarkerTree.Nodes[0].Nodes.Count > i) + { + layerMarkerTree.Nodes[0].Nodes[i].Checked = true; + } + } + } + } + } + /// + /// 判断选中的对象是否为管线 + /// + /// 被选中管线 + /// 返回一根线 + private GSOFeature IsPipeLineOfSelectedObj() + { + GSOFeature resFeature = null; + if (globeControl1.Globe.SelObjectCount < 1) return null; + GSOLayer resLayer = null; + globeControl1.Globe.GetSelectObject(0, out resFeature, out resLayer); + if (resFeature == null) return null; + + GSOGeoPolyline3D line1 = resFeature.Geometry as GSOGeoPolyline3D; + if (line1 == null) return null; + GSOPipeLineStyle3D pipeStyle1 = line1.Style as GSOPipeLineStyle3D; + if (pipeStyle1 == null) return null; + + return resFeature; + } + /// + /// 图层节点树中 节点 右键单击事件处理 + /// + /// + /// + private void layerMarkerTree_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e) + { + if (e.Button == MouseButtons.Right) + { + if (e.Node.Text == "标注管理" || e.Node.Text == "传感器管理") + return; + else if (e.Node.Parent.Text == "标注管理") + { + layerMarkerTree.SelectedNode = e.Node; + contextMenuStrip2.Show(layerMarkerTree, e.X, e.Y); + contextMenuStrip2.Tag = e.Node; + } + else if (e.Node.Parent.Text == "传感器管理") + { + layerSensorTree.SelectedNode = e.Node; + contextMenuStrip2.Show(layerSensorTree, e.X, e.Y); + contextMenuStrip2.Tag = e.Node; + } + else + { + if (e.Node.Tag is GSOFeature) + { + if (e.Node.Parent.Parent.Text == "标注管理") + { + layerMarkerTree.SelectedNode = e.Node; + contextMenuStrip3.Show(layerMarkerTree, e.X, e.Y); + contextMenuStrip3.Tag = e.Node; + } + else if (e.Node.Parent.Parent.Text == "传感器管理") + { + layerSensorTree.SelectedNode = e.Node; + contextMenuStrip3.Show(layerSensorTree, e.X, e.Y); + contextMenuStrip3.Tag = e.Node; + } + } + } + } + } + /// + /// 标注管理、传感器管理 图层目录树的右键菜单中的 刷新列表 菜单 + /// + /// + /// + private void toolStripMenuItem1_Click(object sender, EventArgs e) + { + TreeNode node = contextMenuStrip2.Tag as TreeNode; + TreeNode parentNode = node.Parent; + Int32 nIndex = node.Index; + + if (parentNode.Text == "标注管理" || parentNode.Text == "传感器管理") + { + RefreshTreeNodeLayerFeatureList(node); + } + } + /// + /// 给指定的图层节点添加代表feature对象的子节点 + /// + /// + private void RefreshTreeNodeLayerFeatureList(TreeNode layerTreeNode) + { + layerTreeNode.Nodes.Clear(); + GSOLayer layer = (GSOLayer)layerTreeNode.Tag; + // 只将类型为内存数据集的图层列出,如果是其它类型的数据集可能数据量太大,没发显示在树控件中 + if (layer.Dataset is GSOFeatureDataset) + { + VisitFeature3Ds(layer.GetAllFeatures(), layerTreeNode); + } + } + /// + /// 标注管理、传感器管理 图层目录树的右键菜单中的 移除所有 菜单 + /// + /// + /// + private void toolStripMenuItem2_Click(object sender, EventArgs e) + { + TreeNode node = contextMenuStrip3.Tag as TreeNode; + GSOFeature feature3d = node.Tag as GSOFeature; + if (node == null) + return; + if (feature3d != null) + { + feature3d.Delete(); + globeControl1.Globe.Refresh(); + node.Remove(); + } + } + /// + /// 图层目录树的 节点对应的复选框选中状态改变事件处理 + /// + /// + /// + private void layerMarkerTree_AfterCheck(object sender, TreeViewEventArgs e) + { + if (e.Action != TreeViewAction.Unknown) + { + CheckTreeNode(e.Node, e.Node.Checked); + } + } + /// + /// 改变指定节点对应的复选框的选中状态 + /// + /// + /// + private void CheckTreeNode(TreeNode node, Boolean bChecked) + { + CheckChildTreeNode(node, bChecked); + globeControl1.Globe.Refresh(); + } + /// + /// 改变指定节点的子节点对应的复选框的选中状态 + /// + /// + /// + private void CheckChildTreeNode(TreeNode node, Boolean bChecked) + { + if (node == null) + return; + if (node.Tag != null) + { + if (node.Tag.GetType() == typeof(GSOFeatureFolder) || node.Tag.GetType() == typeof(GSOFeature)) + ((GSOFeature)node.Tag).SetVisibleDirectly(bChecked); + else + { + GSOLayer curLayer = node.Tag as GSOLayer; + GSOTerrain curTerrain = node.Tag as GSOTerrain; + if (curLayer != null) + { + curLayer.Visible = bChecked; + } + else if (curTerrain != null) + { + curTerrain.Visible = bChecked; + } + } + } + // 递归处理子节点 + for (int i = 0; i < node.Nodes.Count; i++) + { + node.Nodes[i].Checked = bChecked; + CheckChildTreeNode(node.Nodes[i], bChecked); + } + } + /// + /// 标注管理、传感器管理 目录树中的feature节点的右键菜单中的 删除 菜单 + /// + /// + /// + private void 删除ToolStripMenuItem1_Click(object sender, EventArgs e) + { + TreeNode node = contextMenuStrip2.Tag as TreeNode; + GSOLayer l = globeControl1.Globe.Layers.GetLayerByCaption(node.Text); + if (l != null) + { + l.RemoveAllFeature(); + node.Nodes.Clear(); + globeControl1.Refresh(); + } + } + //定时检查传感器的状态 + public System.Windows.Forms.Timer timerOfSensor = null; + /// + /// 一键审核---导入数据 + /// + /// + /// + private void buttonItem127_Click_2(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "打开数据"); + + try + { + string dbIp = Utility.sgdbip; + string database = Utility.sgdbname; + string user = Utility.sgdbuser; + string pass = Utility.sgdbpwd; + shds = globeControl1.Globe.DataManager.OpenOracleDataSource(dbIp + "/" + database, "", "", user, pass); + if (shds == null) + { + MessageBox.Show("施工数据库连接失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); + } + FrmPipelineModelDB frm = new FrmPipelineModelDB(globeControl1, shds, true); + if (frm.ShowDialog() == DialogResult.OK) + { + addNodeToLayerManagerNode(frm.rukuLayer); + } + } + catch (Exception ex) + { + LogError.PublishError(ex); + MessageBox.Show("内存过载请清理内存,并重新启动规划分析!", "提示"); + return; + } + } + /// + ///自动导出图片 + /// + /// + /// + private void buttonItem130_Click_1(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "导出审核图"); + + Point pt1 = new Point(Convert.ToInt32(0), Convert.ToInt32(0)); + Point pt2 = new Point(Convert.ToInt32(panelEx5.Width), Convert.ToInt32(panelEx5.Height)); + + 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 = System.IO.Path.GetExtension(dlg.FileName);//扩展名 + switch (extension) + { + case ".jpg": + myImg.Save(dlg.FileName, System.Drawing.Imaging.ImageFormat.Jpeg); + break; + case ".png": + myImg.Save(dlg.FileName, System.Drawing.Imaging.ImageFormat.Png); + break; + case ".bmp": + myImg.Save(dlg.FileName, System.Drawing.Imaging.ImageFormat.Bmp); + break; + case ".gif": + myImg.Save(dlg.FileName, System.Drawing.Imaging.ImageFormat.Gif); + break; + default: + break; + } + } + } + /// + /// 一键审核功能 + /// + /// + /// + private void buttonItem128_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, this.buttonItem128.Text); + frmSh = new FrmYJSHTC(globeControl1, globeControl2, layerTree); + + if (frmSh.ShowDialog() == DialogResult.OK) + { + frmWait = new FrmWait("一键审核……"); + frmWait.Location = new Point(this.Width - frmWait.Width - 10, this.Height - frmWait.Height - 50); + frmWait.Owner = this; + frmWait.Show(); + Thread thread = new Thread(new ThreadStart(doWork)); + thread.IsBackground = true; + thread.Start(); + } + } + void doWork() + { + FrmShResult frmShResult = null; + + double dVerticalJingJuBiaoZhun = 1, dHorizontalJingJuBiaoZhun = 1; + if (frmSh.rukuLayer != null) + { + #region + this.Invoke((EventHandler) delegate + { + try + { + List managerLayerList = new List(); + for (int i = 0; i < layerManagerNode.Nodes.Count; i++) + { + managerLayerList.Add(layerManagerNode.Nodes[i].Text); + } + if (!managerLayerList.Contains(frmSh.rukuLayer.Caption)) + { + TreeNode node = new TreeNode(); + node.Tag = frmSh.rukuLayer; + node.Text = frmSh.rukuLayer.Dataset.Caption; + node.ImageIndex = 0; + node.SelectedImageIndex = 0; + node.Checked = frmSh.rukuLayer.Visible; + layerManagerNode.Nodes.Insert(0, node); + layerManagerNode.Expand(); + } + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "提示"); + } + }); + #endregion + + shlayername = frmSh.rukuLayer.Name; + globeControl1.Refresh(); + } + + if (frmShResult != null && !frmShResult.IsDisposed) + { + try + { + clearFeatureHighLight(); + ClearRedlineAnalyseResult(); + frmShResult.Close(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message); + } + } + + frmShResult = new FrmShResult(dVerticalJingJuBiaoZhun, dHorizontalJingJuBiaoZhun, shlayername, globeControl1, + m_PipelineLayerNames); + + if (boolfrmShResult == true) return; + + frmShResult.Location = new Point(this.Width - frmShResult.Width - 10, this.Height - frmShResult.Height - 50); + frmShResult.Owner = this; + //一键审核实际计算步骤 + frmShResult.analysis(); + + //MainFrm窗体显示控制,回到一键审核Tab + this.Invoke((EventHandler) delegate + { + frmShResult.Show(); + frmWait.Close(); + //将tab页恢复到一键审核 + ribbonTabItem11.Checked = true; + try + { + globeControl1.Globe.Action = EnumAction3D.ActionNull; + splitContainer1.Panel2Collapsed = true; + + panelOfTable.Visible = false; + legendSC.Visible = false; + legendSG.Visible = false; + + GSOLayer redLayer = globeControl1.Globe.Layers.GetLayerByCaption("红线"); + if (redLayer != null) + { + redLayer.Visible = false; + } + } + catch (Exception ex) + { + MessageBox.Show("系统运行错误:" + ex.ToString(), "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + + }); + + boolfrmShResult = true; + } + /// + /// 清除渲染结果 + /// + public void ClearRedlineAnalyseResult() + { + for (int i = 0; i < globeControl1.Globe.Layers.Count; i++) + { + GSOLayer layer = globeControl1.Globe.Layers[i]; + if (layer.Caption == "tempLgdData") + { + layer.RemoveAllFeature(); + } + } + + layerTemp.RemoveAllFeature(); + globeControl1.Refresh(); + } + /// + /// 已审核的图层 + /// + /// + /// + private void buttonItem132_Click_1(object sender, EventArgs e) + { + //保存日志 + LogManager.saveLog(Utility.userName, this.buttonItem132.Text); + + if (shds == null) + { + //没连的话,直接连接审核库; //审核库配置读配置文件 + string dbIp = Utility.sgdbip; + string database = Utility.sgdbname; + string user = Utility.sgdbuser; + string pass = Utility.sgdbpwd; + + shds = globeControl1.Globe.DataManager.OpenOracleDataSource(dbIp + "/" + database, "", "", user, pass); + if (shds == null) + { + MessageBox.Show("数据库连接失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); + } + } + FrmShLayers frm = new FrmShLayers(globeControl1, shds); + frm.Show(); + + } + /// + /// 审核入库 + /// + /// + /// + private void buttonItem133_Click_1(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "审核入库"); + FrmShRK frmShrk = new FrmShRK(globeControl1); + frmShrk.Show(); + } + /// + /// 模拟设计修改 + /// + /// + /// + private void buttonItem134_Click_1(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "模拟设计修改"); + + frmModify = new FrmMnModify(globeControl1, shlayername, shresultLists); + + if (boolfrmModify == false) + { + frmModify.Owner = this; + frmModify.Location = new Point(this.Width - frmModify.Width - 10, this.Height - frmModify.Height - 50); + frmModify.Show(); + boolfrmModify = true; + } + } + /// + /// 一键审核中调节透明度 + /// + /// + /// + private void sliderItem1_ValueChanged(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, this.sliderItem1.Text); + + globeControl1.Globe.GroundOpaque = 100 - sliderItem1.Value; + GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(roadLayerName); //("180fd"); + + if (layer != null) + layer.Opaque = 100 - sliderItem1.Value; + optiValue = sliderItem1.Value; + } + /// + /// 红线审核中的透明度分析 + /// + /// + /// + private void sliderItem3_ValueChanged(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, this.sliderItem3.Text); + + globeControl1.Globe.GroundOpaque = 100 - sliderItem3.Value; + GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(roadLayerName); //("180fd"); + if (layer != null) + layer.Opaque = 100 - sliderItem3.Value; + optiValue = sliderItem3.Value; + } + #region yanxiaowei + //初始化DataGridViewX1控件 + public delegate void DataGridViewDelegate(DataTable dt, string strLable, string strLayer, bool initDataGrid); + /// + /// 代理函数,操作DatgridViewX1 + /// + /// + /// + public void InitDataGridViewX1(DataTable dt, string strLable, string strLayer, bool initDataGrid) + { + if (initDataGrid == true) + { + dataGridViewX1.DataSource = dt; + panelOfTable.Visible = true; + toolStripNumbers.Text = strLable; + dataGridViewX1.Tag = strLayer; + } + else + { + dataGridViewX1.DataSource = null; + dataGridViewX1.Refresh(); + panelOfTable.Visible = false; + toolStripNumbers.Text = ""; + dataGridViewX1.Tag = ""; + globeControl1.Globe.MemoryLayer.RemoveAllFeature(); //清除双击产生的标注 + } + } + FrmAnalysisGuiHuaResult from; + /// + /// 主窗体下方属性表格 双击定位 功能 + /// + /// + /// + 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 if (dataGridViewX1.Columns.Contains("标识器编号")) + { + featureName = dataGridViewX1.Rows[hittestinfo.RowIndex].Cells["标识器编号"].Value.ToString(); + } + featureName = featureName.Trim(); + + GSOLayer layer = null; + layer = globeControl1.Globe.Layers.GetLayerByCaption(dataGridViewX1.Tag.ToString()); + + if (layer == null) return; + + GSOFeatures features = layer.GetFeatureByName(featureName, false); + if (features.Length == 0) return; + GSOFeature rowFeature = features[0]; + + ClassSearchAnalysis.AddMakerToLineFeature(globeControl1, rowFeature); + + } + } + } + else + { + if (e.Button == MouseButtons.Left) + { + if (from != null && !from.IsDisposed) + { + try + { + from.Close(); + } + catch (Exception ex) + { + LogError.PublishError(ex); + } + } + try + { + DataGridView.HitTestInfo hittestinfo = dataGridViewX1.HitTest(e.X, e.Y); + if (hittestinfo.RowIndex >= 0) + { + string layer = dataGridViewX1.Rows[hittestinfo.RowIndex].Cells["管线类型"].Value.ToString(); + string hxName = dataGridViewX1.Rows[hittestinfo.RowIndex].Cells["红线编号"].Value.ToString(); + FrmAnalysisGuiHuaResult frm = new FrmAnalysisGuiHuaResult(globeControl1, lineStruct, featsList, + panelOfTable, dataGridViewX1, layer, hxName); + frm.Location = new Point(this.Width - frm.Width - 10, this.Height - frm.Height - 20); + frm.Show(this); + + from = frm; + } + } + catch (Exception ex) + { + LogError.PublishError(ex); + } + } + } + } + /// + /// 空间查询 + /// + /// + /// + private void buttonItemSearch1_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, this.buttonItemSearch1.Text); + + trackflag = "PipelineSpatialQuery"; + globeControl1.Globe.Action = EnumAction3D.TrackPolygon; + globeControl1.Globe.TrackPolygonTool.TrackMode = EnumTrackMode.SpaceTrack; + } + /// + /// 关键字查询 + /// + /// + /// + private void buttonItemSearch9_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, this.buttonItemSearch9.Text); + + FrmKeywordQuery.ShowForm(globeControl1, m_PipelineLayerNames, new DataGridViewDelegate(InitDataGridViewX1)); + } + /// + /// 编号查询 + /// + /// + /// + private void buttonItemSearch2_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, this.buttonItemSearch2.Text); + + FrmCodingQuery.ShowForm(globeControl1, m_PipelineLayerNames, new DataGridViewDelegate(InitDataGridViewX1)); + } + /// + /// 坐标查询 + /// + /// + /// + private void buttonItemSearch3_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, this.buttonItemSearch3.Text); + + FrmSetLatLonPos.ShowForm(globeControl1); + } + /// + /// 附属物查询 + /// + /// + /// + private void buttonItemSearch10_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, this.buttonItemSearch10.Text); + + FrmFittingQuery.ShowForm(globeControl1, instrumenLayerNames, new DataGridViewDelegate(InitDataGridViewX1)); + } + /// + /// 管径查询 + /// + /// + /// + private void buttonItemSearch4_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, this.buttonItemSearch4.Text); + + FrmDiameterQuery.ShowForm(globeControl1, m_PipelineLayerNames, new DataGridViewDelegate(InitDataGridViewX1)); + } + /// + /// 材质查询 + /// + /// + /// + private void buttonItemSearch5_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, this.buttonItemSearch5.Text); + + FrmMaterialSel.ShowForm(globeControl1, m_PipelineLayerNames, new DataGridViewDelegate(InitDataGridViewX1)); + } + /// + /// 基本查询 + /// + /// + /// + private void buttonItemSearch6_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, this.buttonItemSearch6.Text); + + FrmBasicQuery.ShowForm(globeControl1, new DataGridViewDelegate(InitDataGridViewX1)); + } + /// + /// 复合查询 + /// + /// + /// + private void buttonItemSearch7_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, this.buttonItemSearch7.Text); + + FrmQuerySQL.ShowForm(globeControl1, new DataGridViewDelegate(InitDataGridViewX1)); + } + /// + /// 关联查询 + /// + /// + /// + private void buttonItemSearch8_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, this.buttonItemSearch8.Text); + + if (globeControl1.Globe.SelObjectCount != 1) + { + MessageBox.Show("请选中一个对象!", "提示"); + return; + } + double valueAllowance = 1.0; + + for (int j = 0; j < globeControl1.Globe.SelObjectCount; j++) + { + GSOFeature feature = null; + GSOLayer layer = null; + globeControl1.Globe.GetSelectObject(j, out feature, out layer); + + if (feature == null && feature.Geometry == null || (feature.Geometry.Type == EnumGeometryType.GeoPolygon3D + || feature.Geometry.Type == EnumGeometryType.GeoWater)) + return; + else + { + ClassSearchAnalysis.ResultRelationAnalysis(globeControl1, feature, valueLayerNames, workwellLayerNames, + instrumenLayerNames, pipefittingLayerNames, m_PipelineLayerNames, valueAllowance); + } + } + } + #endregion + /// + /// 清除分析(完善) + /// + /// + /// + private void buttonItemClear_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, this.buttonItemClear.Text); + + globeControl1.Globe.ClearMeasure(); + layerTemp.RemoveAllFeature(); + layerTemp2.RemoveAllFeature(); + buttonItemLS5.Checked = false; + + dataGridViewX1.DataSource = null; + panelOfTable.Visible = false; + + globeControl1.Globe.MemoryLayer.RemoveAllFeature(); + globeControl1.Globe.ClearAnalysis(); + + + // 清除净距分析结果 + buttonX2_Click(null, null); + buttonX8_Click(null, null); + buttonX15_Click(null, null); + buttonX16_Click(null, null); + buttonClearAnalysisResult_Click(null, null); + + NetworkAnalysisTool.ClearAllTopAnalysis(this.globeControl1); + // ClearConnexityAnalysis();//清除连通性分析 + // 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); + } + } + + GSOFeatures feats = globeControl1.Globe.MemoryLayer.GetFeatureByName("粒子要素", true); + if (feats.Length > 0) + globeControl1.Globe.MemoryLayer.RemoveFeatureByID(feats[0].ID); + + globeControl1.Globe.UnderGroundFloor.Visible = false;//隐藏地下网格线 + + // ClearUpDownTraceAnalysis(); //清除上下游分析 + globeControl1.Globe.RemoveAllPits();//清除所有坑 + + string[] markerStrs = new string[9]; + markerStrs[0] = "标高标注"; + markerStrs[1] = "管径标注"; + markerStrs[2] = "埋深标注"; + markerStrs[3] = "坐标标注"; + markerStrs[4] = "坡度标注"; + markerStrs[5] = "属性标注"; + markerStrs[6] = "自定义标注"; + markerStrs[7] = "距离标注"; + markerStrs[8] = "扯旗标注"; + for (int i = 0; i < markerStrs.Length; i++) + { + GSOLayer markerLayer = globeControl1.Globe.Layers.GetLayerByCaption(markerStrs[i]); + markerLayer.RemoveAllFeature(); + } + if (layerMarkerTree != null && layerMarkerTree.Nodes.Count > 0) + { + for (int i = 0; i < layerMarkerTree.Nodes[0].Nodes.Count; i++) + { + layerMarkerTree.Nodes[0].Nodes[i].Nodes.Clear(); + } + } + + clearFeatureHighLight();//取消管线高亮 + + GSOLayer layerGround = globeControl1.Globe.Layers.GetLayerByCaption(roadLayerName);//("180fd"); + if (layerGround != null) + { + layerGround.Visible = true; + } + globeControl1.Refresh(); + globeControl2.Refresh(); + ClearRedlineAnalyseResult(); + globeControl1.Globe.Action = EnumAction3D.ActionNull; + } + /// + /// 管线长度全区域统计 + /// + /// + /// + private void buttonItemTJ1_ALL_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "管线长度统计"); + FrmAllPipelineStatis frm = new FrmAllPipelineStatis(globeControl1, null, new DataGridViewDelegate(InitDataGridViewX1), m_PipelineLayerNames); + frm.Show(this); + } + /// + /// 管线长度绘制区域统计 + /// + /// + /// + private void buttonItemTJ1_DRAW_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "管线长度统计"); + + trackflag = "PipelineDistanceStatistics"; + globeControl1.Globe.Action = EnumAction3D.TrackPolygon; + globeControl1.Globe.TrackPolygonTool.TrackMode = EnumTrackMode.SpaceTrack; + } + /// + /// 阀门数量全区域统计 + /// + /// + /// + private void buttonItemTJ2_ALL_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "阀门数量统计"); + FrmValveStatistics frm = new FrmValveStatistics(globeControl1, null, new DataGridViewDelegate(InitDataGridViewX1)); + frm.Show(this); + + globeControl1.Globe.Action = EnumAction3D.ActionNull; + } + /// + /// 阀门数量绘制区域统计 + /// + /// + /// + private void buttonItemTJ2_DRAW_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "阀门数量统计"); + + trackflag = "valvequery"; + globeControl1.Globe.Action = EnumAction3D.TrackPolygon; + globeControl1.Globe.TrackPolygonTool.TrackMode = EnumTrackMode.SpaceTrack; + } + /// + /// 井盖数量全区域统计 + /// + /// + /// + private void buttonItemTJ3_ALL_Click(object sender, EventArgs e) + { + FrmAllWorkWellStatis frm = new FrmAllWorkWellStatis(globeControl1, null, new DataGridViewDelegate(InitDataGridViewX1)); + frm.Show(this); + } + /// + /// 井盖数量绘制区域统计 + /// + /// + /// + private void buttonItemTJ3_DRAW_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "井盖数量统计"); + + trackflag = "workwellquery"; + globeControl1.Globe.Action = EnumAction3D.TrackPolygon; + globeControl1.Globe.TrackPolygonTool.TrackMode = EnumTrackMode.SpaceTrack; + } + /// + /// 管径分段统计全区域统计 + /// + /// + /// + private void buttonItemTJ4_ALL_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "管径分段统计"); + + Frmpipediameterstatis.ShowForm(globeControl1, m_PipelineLayerNames, 0); + } + /// + /// 管径分段统计绘制区域统计 + /// + /// + /// + private void buttonItemTJ4_DRAW_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "管径分段统计"); + + trackflag = null; + Frmpipediameterstatis.ShowForm(globeControl1, m_PipelineLayerNames, 1); + } + /// + /// 埋深分段统计全区域统计 + /// + /// + /// + private void buttonItemTJ5_ALL_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "埋深分段统计"); + FrmpipeDeepstatis.ShowForm(globeControl1, m_PipelineLayerNames, 0); + } + /// + /// 埋深分段统计绘制区域统计 + /// + /// + /// + private void buttonItemTJ5_DRAW_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "埋深分段统计"); + trackflag = null; + FrmpipeDeepstatis.ShowForm(globeControl1, m_PipelineLayerNames, 1); + } + /// + /// 管径分类统计全区域统计 + /// + /// + /// + private void buttonItemTJ6_ALL_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "管径分类汇总"); + + FrmpipeDiametergather.ShowForm(globeControl1, m_PipelineLayerNames, 0); + } + /// + /// 管径分类统计绘制区域统计 + /// + /// + /// + private void buttonItemTJ6_DRAW_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "管径分类汇总"); + + trackflag = null; + FrmpipeDiametergather.ShowForm(globeControl1, m_PipelineLayerNames, 1); + } + /// + /// 材质分类统计全区域统计 + /// + /// + /// + private void buttonItemTJ7_ALL_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "材质分类汇总"); + + FrmpipeMaterialGather.ShowForm(globeControl1, m_PipelineLayerNames, 0); + } + /// + /// 材质分类统计绘制区域统计 + /// + /// + /// + private void buttonItemTJ7_DRAW_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "材质分类汇总"); + + trackflag = null; + FrmpipeMaterialGather.ShowForm(globeControl1, m_PipelineLayerNames, 1); + } + /// + /// 附属物分类统计全区域统计 + /// + /// + /// + private void buttonItemTJ8_ALL_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "附属物分类汇总"); + + FrmAccessoriesgather.ShowForm(globeControl1, instrumenLayerNames, 0); + } + /// + /// 附属物分类统计绘制区域统计 + /// + /// + /// + private void buttonItemTJ8_DRAW_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "附属物分类汇总"); + + trackflag = null; + FrmAccessoriesgather.ShowForm(globeControl1, instrumenLayerNames, 1); + } #region Predaotr,断面分析 /// /// 横断面分析 @@ -7365,7 +7062,6 @@ globeControl1.Globe.TrackPolylineTool.VerticalLineVisible = true; globeControl1.Globe.TrackPolylineTool.TrackMode = EnumTrackMode.SpaceTrack; trackPolylineEndMode = EnumTrackPolylineEndMode.HDM_Analysis; - } /// /// 纵断面分析 @@ -7409,7 +7105,6 @@ globeControl1.Globe.TrackPolylineTool.VerticalLineVisible = true; globeControl1.Globe.TrackPolylineTool.TrackMode = EnumTrackMode.SpaceTrack; trackPolylineEndMode = EnumTrackPolylineEndMode.DLDM_Analysis; - } /// /// 基线剖面分析 @@ -7422,9 +7117,7 @@ globeControl1.Globe.TrackPolylineTool.VerticalLineVisible = true; globeControl1.Globe.TrackPolylineTool.TrackMode = EnumTrackMode.SpaceTrack; trackPolylineEndMode = EnumTrackPolylineEndMode.JXPM_Analysis; - } - #endregion /// /// 创建拓扑 @@ -7462,7 +7155,6 @@ LogManager.saveLog(Utility.userName, this.buttonItemFX3_3.Text); NetworkTraceUpDown(false); } - /// /// 上下游追踪 功能 /// @@ -7480,7 +7172,6 @@ NetworkAnalysisTool.TraceUpDownAnalysis(bTraceUp, selLineFeature, selLayer); } - /// /// 流向分析 /// @@ -7533,7 +7224,6 @@ MessageBox.Show("未找到关闭阀门"); } } - /// /// 连通分析 /// @@ -7580,9 +7270,7 @@ NetworkAnalysisTool.ExplodeAnalysis(this.globeControl1, selLineFeature, selLayer); this.buttonItemFX3_5_Click(sender, e); //关阀分析: - } - #endregion /// /// 多边形开挖 @@ -7591,7 +7279,6 @@ /// private void buttonItemFX4_1_Click(object sender, EventArgs e) { - //日志记录 LogManager.saveLog(Utility.userName, this.buttonItemFX4_1.Text); trackflag = "pit"; @@ -7605,7 +7292,6 @@ /// private void buttonItemFX4_2_Click(object sender, EventArgs e) { - //日志记录 LogManager.saveLog(Utility.userName, this.buttonItemFX4_2.Text); trackflag = "digFillAnalysis"; @@ -7620,7 +7306,6 @@ /// private void buttonItemFX4_3_Click(object sender, EventArgs e) { - //日志记录 LogManager.saveLog(Utility.userName, this.buttonItemFX4_3.Text); if (!buttonItemFX4_3.Checked) @@ -7653,12 +7338,13 @@ /// private void buttonItemFX4_4_Click(object sender, EventArgs e) { - //日志记录 LogManager.saveLog(Utility.userName, this.buttonItemFX4_4.Text); globeControl1.Globe.Action = EnumAction3D.DrawPolyline; GSOLayer tunnel = globeControl1.Globe.Layers.GetLayerByCaption("隧道"); - if (tunnel != null) + if (tunnel == null) + MessageBox.Show("场景中未加载隧道图层!", "提示"); + else { globeControl1.Globe.DestLayerFeatureAdd = tunnel; tunnel.Editable = true; @@ -7666,10 +7352,6 @@ m_AddPipeLine = false; m_isDrawCitySevenLine = false; } - else - { - MessageBox.Show("场景中未加载隧道图层!", "提示"); - } } /// /// 隐藏隧道 @@ -7678,7 +7360,6 @@ /// private void buttonItemFX4_5_Click(object sender, EventArgs e) { - //日志记录 LogManager.saveLog(Utility.userName, this.buttonItemFX4_5.Text); GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption("隧道"); @@ -7694,7 +7375,6 @@ /// private void buttonItemFX4_6_Click(object sender, EventArgs e) { - //日志记录 LogManager.saveLog(Utility.userName, this.buttonItemFX4_6.Text); if (globeControl1.Globe.SelObjectCount > 0) @@ -7736,16 +7416,7 @@ //日志记录 LogManager.saveLog(Utility.userName, this.buttonItemFX5_1.Text); - if (globeControl1.Globe.Action != EnumAction3D.VisibilityAnalysis) - { - //btnSpaceVisibilityAnalysis.Checked = true; - globeControl1.Globe.Action = EnumAction3D.VisibilityAnalysis; - } - else - { - globeControl1.Globe.Action = EnumAction3D.ActionNull; - // SetButtonChecked(); - } + globeControl1.Globe.Action = globeControl1.Globe.Action != EnumAction3D.VisibilityAnalysis ? EnumAction3D.VisibilityAnalysis : EnumAction3D.ActionNull; } /// /// 可视域分析 @@ -7754,7 +7425,6 @@ /// private void buttonItemFX5_2_Click(object sender, EventArgs e) { - //日志记录 LogManager.saveLog(Utility.userName, this.buttonItemFX5_2.Text); globeControl1.Globe.Action = EnumAction3D.ViewshedAnalysis; @@ -7766,7 +7436,6 @@ /// private void buttonItemFX5_3_Click(object sender, EventArgs e) { - //日志记录 LogManager.saveLog(Utility.userName, this.buttonItemFX5_3.Text); globeControl1.Globe.Action = EnumAction3D.ViewEnvelopeAnalysis; @@ -7778,7 +7447,6 @@ /// private void buttonItemFX6_1_Click(object sender, EventArgs e) { - //日志记录 LogManager.saveLog(Utility.userName, this.buttonItemFX6_1.Text); GSOFeature feat = globeControl1.Globe.SelectedObject; @@ -7813,7 +7481,6 @@ /// private void buttonItemFX6_2_Click(object sender, EventArgs e) { - //日志记录 LogManager.saveLog(Utility.userName, this.buttonItemFX6_2.Text); globeControl1.Globe.Action = EnumAction3D.ActionNull; @@ -7827,7 +7494,6 @@ /// private void buttonItemFX6_3_Click(object sender, EventArgs e) { - //日志记录 LogManager.saveLog(Utility.userName, this.buttonItemFX6_3.Text); globeControl1.Globe.Action = EnumAction3D.TrackPolygon; @@ -7901,10 +7567,8 @@ globeControl1.Globe.Action = EnumAction3D.ActionNull; buttonItemLS5.Checked = !buttonItemLS5.Checked; - if (buttonItemLS5.Checked) - { - globeControl1.Globe.Action = EnumAction3D.SelectObject; - } + if (!buttonItemLS5.Checked) return; + globeControl1.Globe.Action = EnumAction3D.SelectObject; } /// /// 水平面积 @@ -8197,7 +7861,6 @@ LogManager.saveLog(Utility.userName, this.buttonItemFXGJ1.Text); FrmSetFlytoPos.ShowForm(globeControl1); - } /// /// 自定义飞行 @@ -8262,7 +7925,6 @@ globeControl1.Globe.FlyAroundEye(720, EnumFlyRepeatValueType.Degrees); globeControl1.Globe.CurFlyID = 2; } - /// /// 权限管理 /// @@ -8343,21 +8005,6 @@ appUSERRESET.ShowDialog(); } /// - /// 统计数据 - /// - /// - /// - private void buttonItemZTT1_Click(object sender, EventArgs e) - { - ////日志记录 - //LogManager.saveLog(Utility.userName, this.buttonItemZTT1.Text); - - //PATM patm = new PATM(); - //patm.operation = "Statistic"; - //patm.Text = "统计专题图管理"; - //patm.ShowDialog(); - } - /// /// 热点功能统计 /// /// @@ -8460,137 +8107,6 @@ FrmLayerControl frm = new FrmLayerControl(layerTree, globeControl1, globeControl2); frm.Show(this); } - - /// - /// 碰撞审查 - /// - /// - /// - private void buttonItemSH1_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, this.buttonItemSH1.Text); - - this.dataGridViewX4.Size = new System.Drawing.Size(185, 92); - this.dataGridViewX5.Size = new System.Drawing.Size(185, 120); - - layerTemp.RemoveAllFeature(); - clearFeatureHighLight(); - globeControl1.Refresh(); - - sideBar1.Visible = true; - sideBarPanelItem3.Visible = true; - buttonItem1.Checked = true; - controlContainerItem3.Visible = true; - sideBarPanelItem4.Visible = true; - sideBarPanelItem4.Text = "碰撞审查"; - trackflag = "collision"; - controlContainerItem5.Control = panel2; - panel2.Dock = DockStyle.Fill; - panel2.Visible = true; - sideBar1.ExpandedPanel = sideBarPanelItem4; - sideBar1.Refresh(); - - Refresh(); - } - /// - /// 覆土审查 - /// - /// - /// - private void buttonItemSH2_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, this.buttonItemSH2.Text); - - this.dataGridViewX6.Size = new System.Drawing.Size(185, 92); - this.dataGridViewX7.Size = new System.Drawing.Size(185, 120); - - layerTemp.RemoveAllFeature(); - clearFeatureHighLight(); - globeControl1.Refresh(); - sideBar1.Visible = true; - sideBarPanelItem3.Visible = true; - buttonItem1.Checked = true; - controlContainerItem3.Visible = true; - sideBarPanelItem4.Visible = true; - sideBarPanelItem4.Text = "覆土审查"; - trackflag = "ftAnalysis"; - controlContainerItem5.Control = panel4; - panel4.Visible = true; - panel4.Dock = DockStyle.Fill; - sideBar1.ExpandedPanel = sideBarPanelItem4; - sideBar1.Refresh(); - Refresh(); - } - /// - /// 水平净距审查 - /// - /// - /// - private void buttonItemSH3_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, this.buttonItemSH3.Text); - - this.dataGridViewX8.Size = new System.Drawing.Size(190, 92); - this.dataGridViewX9.Size = new System.Drawing.Size(190, 120); - - layerTemp.RemoveAllFeature(); - clearFeatureHighLight(); - globeControl1.Refresh(); - sideBar1.Visible = true; - sideBarPanelItem3.Visible = true; - buttonItem1.Checked = true; - controlContainerItem3.Visible = true; - sideBarPanelItem4.Visible = true; - sideBarPanelItem4.Text = "水平净距审查"; - trackflag = "horizontal"; - controlContainerItem5.Control = panel5; - panel5.Dock = DockStyle.Fill; - panel5.Visible = true; - sideBar1.ExpandedPanel = sideBarPanelItem4; - sideBar1.Refresh(); - Refresh(); - } - /// - /// 垂直净距审查 - /// - /// - /// - private void buttonItemSH4_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, this.buttonItemSH4.Text); - - this.dataGridViewX2.Visible = true; - this.dataGridViewX3.Visible = true; - this.dataGridViewX2.Size = new System.Drawing.Size(185, 92); - this.dataGridViewX3.Size = new System.Drawing.Size(185, 120); - - layerTemp.RemoveAllFeature(); - clearFeatureHighLight(); - - globeControl1.Refresh(); - sideBar1.Visible = true; - sideBarPanelItem3.Visible = true; - buttonItem1.Checked = true; - controlContainerItem3.Visible = true; - sideBarPanelItem4.Visible = true; - sideBarPanelItem4.Text = "垂直净距审查"; - trackflag = "vertical"; - //globeControl1.Globe.Action = EnumAction3D.SelectObject; - panel2.Visible = false; - panel3.Visible = false; - panel5.Visible = false; - panel4.Visible = false; - controlContainerItem5.Control = panel1; - panel1.Dock = DockStyle.Fill; - panel1.Visible = true; - sideBar1.ExpandedPanel = sideBarPanelItem4; - sideBar1.Refresh(); - Refresh(); - } /// /// 综合规划区域审查 /// @@ -8666,9 +8182,7 @@ } if (ds == null) return; - Cyberpipe.Forms.FrmPipelineModelDB frm = new Cyberpipe.Forms.FrmPipelineModelDB(globeControl1, ds); - - //frm.Show(); + FrmPipelineModelDB frm = new FrmPipelineModelDB(globeControl1, ds, false); if (frm.ShowDialog() == DialogResult.OK) { @@ -8700,7 +8214,6 @@ addNodeToLayerManagerNode(frm.rukuLayer); } } - /// /// 坐标转换 /// @@ -8711,7 +8224,7 @@ //保存日志 LogManager.saveLog(Utility.userName, this.buttonItemSJGL5.Text); - Cyberpipe.Forms.FrmProject frm = new Cyberpipe.Forms.FrmProject(); + FrmProject frm = new FrmProject(); frm.ShowDialog(); } /// @@ -8738,7 +8251,6 @@ LogManager.saveLog(Utility.userName, this.buttonItemSJGL6_2.Text); FrmMetadataStat frmmds = new FrmMetadataStat(); - //frmmds.Show(); frmmds.ShowDialog(); } /// @@ -8814,12 +8326,11 @@ if (frm.ShowDialog() == DialogResult.OK) { GSOLayer featureAddLayer = TreeNodeFeatureLayer(); - if (featureAddLayer == null) + if (featureAddLayer != null) { - return; + FrmAddInstrument dlg = new FrmAddInstrument(globeControl1, featureAddLayer); + dlg.Show(this); } - FrmAddInstrument dlg = new FrmAddInstrument(globeControl1, featureAddLayer); - dlg.Show(this); } } /// @@ -8836,16 +8347,15 @@ if (frm.ShowDialog() == DialogResult.OK) { GSOLayer featureAddLayer = TreeNodeFeatureLayer(); - if (featureAddLayer == null) + if (featureAddLayer != null) { - return; + FrmAddPipeFitting dlg = new FrmAddPipeFitting(globeControl1, featureAddLayer); + dlg.Show(this); } - FrmAddPipeFitting dlg = new FrmAddPipeFitting(globeControl1, featureAddLayer); - dlg.Show(this); } } /// - /// 绘制城市七线 + /// 绘制城市七线(完善) /// /// /// @@ -9082,15 +8592,6 @@ List listVectorNames = new List(); for (int i = 0; i < 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] == "供电") - { - continue; - } - * */ if (listVectorNames.Contains(m_PipelineLayerNames[i]) == false) { listVectorNames.Add(m_PipelineLayerNames[i]); @@ -9142,15 +8643,11 @@ GSOFeature f = null; GSOLayer layer = null; globeControl1.Globe.GetSelectObject(i, out f, out layer); - if (f != null) - { - f.Delete(); - if (layer != null) - { - globeControl1.Globe.AddToEditHistroy(layer, f, EnumEditType.Delete); - } - globeControl1.Refresh(); - } + if (f == null) continue; + f.Delete(); + if (layer != null) + globeControl1.Globe.AddToEditHistroy(layer, f, EnumEditType.Delete); + globeControl1.Refresh(); } MessageBox.Show("删除成功!", "提示"); } @@ -9190,10 +8687,8 @@ for (int i = 0; i < m_PipelineLayerNames.Count; i++) { layer = globeControl1.Globe.Layers.GetLayerByCaption(m_PipelineLayerNames[i]); - if (layer != null) - { - listPipelineLayers.Add(layer); - } + if (layer == null) continue; + listPipelineLayers.Add(layer); } //yanxiaowei 重构 GSOFeatures selectFeatures = new GSOFeatures(); @@ -9208,15 +8703,15 @@ ClassGSOTool.CalculateRedLineResult(out table, redSH, selectFeatures, globeControl1, listPipelineLayers, out lineStruct, out featsList); - if (table.Rows.Count != 0) - AddDatagridView(table); - else + if (table.Rows.Count == 0) { MessageBox.Show("没有侵入地块红线的管线数据!", "提示"); dataGridViewX1.DataSource = null; panelOfTable.Visible = false; return; } + else + AddDatagridView(table); } private void AddDatagridView(DataTable table) @@ -9234,23 +8729,25 @@ /// private void toolStripDropDownButton3_Click(object sender, EventArgs e) { - if (dataGridViewX1.Rows.Count == 0) + if (dataGridViewX1.Rows.Count != 0) + { + string strSaveFile = string.Empty; + SaveFileDialog savefiledialog = new SaveFileDialog(); + savefiledialog.Filter = "Excel文件|*.xls,*.xlsx"; + savefiledialog.AddExtension = true; + savefiledialog.FileName = "红线审核"; + if (savefiledialog.ShowDialog() == DialogResult.OK) + strSaveFile = savefiledialog.FileName; + else return; + + ExpEXCEL.ExpToExcel(dataGridViewX1, strSaveFile, "红线审核", lineStruct, featsList); + MessageBox.Show("导出成功!"); + } + else { MessageBox.Show("表格内容为空!", "提示"); return; } - - string strSaveFile = string.Empty; - SaveFileDialog savefiledialog = new SaveFileDialog(); - savefiledialog.Filter = "Excel文件|*.xls,*.xlsx"; - savefiledialog.AddExtension = true; - savefiledialog.FileName = "红线审核"; - if (savefiledialog.ShowDialog() == DialogResult.OK) - strSaveFile = savefiledialog.FileName; - else return; - - ExpEXCEL.ExpToExcel(dataGridViewX1, strSaveFile, "红线审核", lineStruct, featsList); - MessageBox.Show("导出成功!"); } private void sliderItem2_ValueChanged(object sender, EventArgs e) @@ -9287,31 +8784,39 @@ dlg.Multiselect = true; if (dlg.ShowDialog() == DialogResult.OK) { - //自定义lprj文件名,从程序中复制一lprj文件。 - string filePath = dlg.FileName; - string lastname = Path.GetFileName(filePath); - - for (int i = 0; i < dlg.FileNames.Length; i++) + try { - AddLayerData(dlg.FileNames[i]); + for (int i = 0; i < dlg.FileNames.Length; i++) + { + AddLayerData(dlg.FileNames[i]); + } + layerManagerNode.Expand(); + + //放大到新导入的图层 + GSOLayer lyr = globeControl1.Globe.Layers.GetLayerByCaption(newlayername); + if (newlayername != "") + { + GSOFeatures features = lyr.GetAllFeatures(); + GSORect2d rd = lyr.LatLonBounds; + GSOPoint2d rdcenter = rd.Center; + + globeControl1.Globe.JumpToPosition(new GSOPoint3d(rdcenter.X, rdcenter.Y, 0), + EnumAltitudeMode.Absolute, 100); + + globeControl1.Refresh(); + } } - layerManagerNode.Expand(); - - //放大到新导入的图层 - GSOLayer lyr = globeControl1.Globe.Layers.GetLayerByCaption(newlayername); - if (newlayername != "") + catch (Exception ex) { - GSOFeatures features = lyr.GetAllFeatures(); - GSORect2d rd = lyr.LatLonBounds; - GSOPoint2d rdcenter = rd.Center; - - globeControl1.Globe.JumpToPosition(new GSOPoint3d(rdcenter.X, rdcenter.Y, 0), EnumAltitudeMode.Absolute, 100); - - globeControl1.Refresh(); + LogHelper.WriteLog(typeof(MainFrm), ex); } } } - + /// + /// 导入红线(完善) + /// + /// + /// private void buttonItemHX1_Click(object sender, EventArgs e) { LogManager.saveLog(Utility.userName, this.buttonItemHX1.Text); @@ -9339,7 +8844,6 @@ GSOFeatures RedFeatures = layer.GetAllFeatures(); redlinelayername = layer.Caption; - //objRes = layer; if (layer != null) { layerRedRegion = layer; @@ -9362,9 +8866,7 @@ { GSOFeature f = layer.GetAt(j); if (f != null) - { f.Geometry.AltitudeMode = EnumAltitudeMode.RelativeToGround; - } } } layerManagerNode.Expand(); @@ -9426,7 +8928,7 @@ fly.Show(this); } /// - /// 2015-10-17演示代码 红线审核 + /// 红线审核 /// /// /// @@ -9438,7 +8940,6 @@ globeControl1.BeforeSceneRenderEvent -= new BeforeSceneRenderEventHandler(globeControl1_BeforeSceneRenderEvent); globeControl2.BeforeSceneRenderEvent -= new BeforeSceneRenderEventHandler(globeControl2_BeforeSceneRenderEvent); - globeControl1.Globe.FlyToPosition(new GSOPoint3d(120.610963, 31.188121, 50), EnumAltitudeMode.Absolute, -4, 50, 800); globeControl1.Globe.FlyToPointSpeed = 10000000; globeControl1.Globe.Action = EnumAction3D.SelectObject; @@ -9453,11 +8954,8 @@ legendSC.Visible = false; ClearGZData(); GSOLayer redLayer = globeControl1.Globe.Layers.GetLayerByCaption("红线"); - if (redLayer != null) - { - redLayer.Visible = true; - } - + if (redLayer == null) return; + redLayer.Visible = true; } catch (Exception ex) { @@ -9477,7 +8975,6 @@ globeControl1.BeforeSceneRenderEvent -= new BeforeSceneRenderEventHandler(globeControl1_BeforeSceneRenderEvent); globeControl2.BeforeSceneRenderEvent -= new BeforeSceneRenderEventHandler(globeControl2_BeforeSceneRenderEvent); - globeControl1.Globe.Action = EnumAction3D.ActionNull; dataGridViewX1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells; //zhanshi = false; @@ -9488,12 +8985,8 @@ legendSG.Visible = false; ClearGZData(); GSOLayer redLayer = globeControl1.Globe.Layers.GetLayerByCaption("红线"); - if (redLayer != null) - { - redLayer.Visible = false; - } - - + if (redLayer == null) return; + redLayer.Visible = false; } catch (Exception ex) { @@ -9513,7 +9006,6 @@ globeControl1.BeforeSceneRenderEvent -= new BeforeSceneRenderEventHandler(globeControl1_BeforeSceneRenderEvent); globeControl2.BeforeSceneRenderEvent -= new BeforeSceneRenderEventHandler(globeControl2_BeforeSceneRenderEvent); - globeControl1.Globe.Action = EnumAction3D.ActionNull; //zhanshi = false; redSH = false; @@ -9524,45 +9016,15 @@ legendSG.Visible = false; ClearGZData(); GSOLayer redLayer = globeControl1.Globe.Layers.GetLayerByCaption("红线"); - if (redLayer != null) - { - redLayer.Visible = false; - } - - + if (redLayer == null) return; + redLayer.Visible = false; } catch (Exception ex) { //MessageBox.Show("系统运行错误:" + ex.ToString(), "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); } } - /// - /// 右屏添加冰箱数据 - /// - void AddDataToGlobeControl2() - { - - bool modelDataBool = false; - for (int i = globeControl2.Globe.Layers.Count - 1; i >= 0; i--) - { - GSOLayer layer = globeControl2.Globe.Layers[i]; - if (layer.Name.Contains("fttp:")) - { - modelDataBool = true; - break; - } - } - - if (modelDataBool == false) - { - GSOLayer ly = globeControl1.Globe.Layers.GetLayerByCaption("天地图地图"); - globeControl2.Globe.Layers.Add(ly); - } - else - { - return; - } - } + /// /// 双屏对比 /// @@ -9572,7 +9034,6 @@ { try { - globeControl1.BeforeSceneRenderEvent += new BeforeSceneRenderEventHandler(globeControl1_BeforeSceneRenderEvent); globeControl2.BeforeSceneRenderEvent += new BeforeSceneRenderEventHandler(globeControl2_BeforeSceneRenderEvent); @@ -9590,10 +9051,7 @@ GSOLayer redLayer = globeControl1.Globe.Layers.GetLayerByCaption("红线"); if (redLayer != null) - { redLayer.Visible = false; - } - AddDataToGlobeControl2(); } catch (Exception ex) { @@ -9613,7 +9071,6 @@ globeControl1.BeforeSceneRenderEvent -= new BeforeSceneRenderEventHandler(globeControl1_BeforeSceneRenderEvent); globeControl2.BeforeSceneRenderEvent -= new BeforeSceneRenderEventHandler(globeControl2_BeforeSceneRenderEvent); - globeControl1.Globe.Action = EnumAction3D.ActionNull; panelOfTable.Visible = false; //zhanshi = false; @@ -9625,9 +9082,7 @@ ClearGZData(); GSOLayer redLayer = globeControl1.Globe.Layers.GetLayerByCaption("红线"); if (redLayer != null) - { redLayer.Visible = false; - } } catch (Exception ex) { @@ -9643,11 +9098,9 @@ { try { - globeControl1.BeforeSceneRenderEvent -= new BeforeSceneRenderEventHandler(globeControl1_BeforeSceneRenderEvent); globeControl2.BeforeSceneRenderEvent -= new BeforeSceneRenderEventHandler(globeControl2_BeforeSceneRenderEvent); - globeControl1.Globe.Action = EnumAction3D.ActionNull; panelOfTable.Visible = false; //zhanshi = false; @@ -9660,10 +9113,7 @@ GSOLayer redLayer = globeControl1.Globe.Layers.GetLayerByCaption("红线"); if (redLayer != null) - { redLayer.Visible = false; - } - } catch (Exception ex) { @@ -9679,11 +9129,9 @@ { try { - globeControl1.BeforeSceneRenderEvent -= new BeforeSceneRenderEventHandler(globeControl1_BeforeSceneRenderEvent); globeControl2.BeforeSceneRenderEvent -= new BeforeSceneRenderEventHandler(globeControl2_BeforeSceneRenderEvent); - globeControl1.Globe.Action = EnumAction3D.ActionNull; panelOfTable.Visible = false; //zhanshi = false; @@ -9695,11 +9143,8 @@ ClearGZData(); GSOLayer redLayer = globeControl1.Globe.Layers.GetLayerByCaption("红线"); - if (redLayer != null) - { - redLayer.Visible = false; - } - + if (redLayer == null) return; + redLayer.Visible = false; } catch (Exception ex) { @@ -9717,12 +9162,8 @@ { LogManager.saveLog(Utility.userName, this.buttonItem8.Text); - //FrmCompareFeature frmCompareFeature = new FrmCompareFeature(globeControl1, globeControl2, layerTemp, layerTemp2,m_PipelineLayerNames,sgPipeLayersNames); int width = this.Width; FrmCompareFeature.ShowForm(globeControl1, globeControl2, layerTemp, layerTemp2, m_PipelineLayerNames, sgPipeLayersNames, width); - //frmCompareFeature.Location = new Point((this.Width - frmCompareFeature.Width)/2,50); - //frmCompareFeature.Show(this); - } /// /// 红线审核导出图片 @@ -9735,11 +9176,7 @@ Point pt1 = new Point(Convert.ToInt32(0), Convert.ToInt32(0)); Point pt2 = new Point(Convert.ToInt32(panelEx5.Width), Convert.ToInt32(panelEx5.Height)); - /*Point pt = getUpperLeftPoint(pt1, pt2); - Image myImg = new Bitmap(Convert.ToInt32(panelEx5.Width), Convert.ToInt32(panelEx5.Height)); - Graphics g = Graphics.FromImage(myImg); - g.CopyFromScreen(pt, new Point(0, 0), new Size(Convert.ToInt32(panelEx5.Width), Convert.ToInt32(panelEx5.Height))); - */ + int mapWidth = 0; int mapHeight = 0; Point pt = getUpperLeftPoint(pt1, pt2, out mapWidth, out mapHeight); @@ -9782,7 +9219,6 @@ { globeControl1.Globe.Action = EnumAction3D.ActionNull; FrmBSQStatis bsqStatis = new FrmBSQStatis(globeControl1, null); - //FrmBSQStatis bsqStatis = new FrmBSQStatis(); bsqStatis.Show(this); } /// @@ -9795,20 +9231,15 @@ trackflag = "BSQDuoBianXiangStatis"; globeControl1.Globe.Action = EnumAction3D.TrackPolygon; } - - private void btn_check_history_Click(object sender, EventArgs e) { LogManager.saveLog(Utility.userName, this.btn_check_history.Text); if (FrmCheckHistory.isOpen == true) - { return; - } FrmCheckHistory frm = new FrmCheckHistory(globeControl1, globeControl2); frm.addNode += new AddNodeToLayerManagerNode(addNodeToLayerManagerNode); frm.Show(); - } private void buttonItem查看数据_Click(object sender, EventArgs e) @@ -9840,34 +9271,29 @@ { LogManager.saveLog(Utility.userName, this.btn_user_info.Text); - if (!FrmSysUserInfoManger.IS_OPEN) - { - FrmSysUserInfoManger frm = new FrmSysUserInfoManger(); - frm.ShowDialog(); - } + if (FrmSysUserInfoManger.IS_OPEN) return; + FrmSysUserInfoManger frm = new FrmSysUserInfoManger(); + frm.ShowDialog(); } private void btn_role_info_Click(object sender, EventArgs e) { LogManager.saveLog(Utility.userName, this.btn_role_info.Text); - if (FrmRoleInfoManager.IS_OPEN) + if (!FrmRoleInfoManager.IS_OPEN) { - return; + FrmRoleInfoManager frm = new FrmRoleInfoManager(); + frm.ShowDialog(); } - FrmRoleInfoManager frm = new FrmRoleInfoManager(); - frm.ShowDialog(); } private void btn_resc_info_Click(object sender, EventArgs e) { LogManager.saveLog(Utility.userName, this.btn_resc_info.Text); - if (!SysRescInfoManager.IS_OPEN) - { - SysRescInfoManager frm = new SysRescInfoManager(); - frm.ShowDialog(); - } + if (SysRescInfoManager.IS_OPEN) return; + SysRescInfoManager frm = new SysRescInfoManager(); + frm.ShowDialog(); } private void btn_role_resc_Click(object sender, EventArgs e) @@ -9875,51 +9301,33 @@ LogManager.saveLog(Utility.userName, this.btn_role_resc.Text); - if (!FrmRoleRescManager.IS_OPEN) - { - FrmRoleRescManager frm = new FrmRoleRescManager(); - frm.ShowDialog(); - } + if (FrmRoleRescManager.IS_OPEN) return; + FrmRoleRescManager frm = new FrmRoleRescManager(); + frm.ShowDialog(); } private void btn_user_role_Click(object sender, EventArgs e) { LogManager.saveLog(Utility.userName, this.btn_user_role.Text); - if (FrmUserRole.IS_OPEN) + if (!FrmUserRole.IS_OPEN) { - return; + FrmUserRole frm = new FrmUserRole(); + frm.ShowDialog(); } - FrmUserRole frm = new FrmUserRole(); - frm.ShowDialog(); } private void btn_document_info_Click(object sender, EventArgs e) { LogManager.saveLog(Utility.userName, this.btn_document_info.Text); - - //if (FormDocumentManager.IS_OPEN) - //{ - // return; - //} - //FormDocumentManager frm = new FormDocumentManager(); - //frm.ShowDialog(); - - //if (FormDocumentManager.IS_OPEN) - //{ - // return; - //} - //new FormDocumentManager().ShowDialog(); - if (FormDocumentManager.IS_OPEN) + if (!FormDocumentManager.IS_OPEN) { - return; + this.Cursor = Cursors.WaitCursor; + FormDocumentManager frm = new FormDocumentManager(); + frm.changeCursor += new ChangeCursor(changeCursorToDefault); + frm.ShowDialog(); } - this.Cursor = Cursors.WaitCursor; - FormDocumentManager frm = new FormDocumentManager(); - frm.changeCursor += new ChangeCursor(changeCursorToDefault); - frm.ShowDialog(); - } private void changeCursorToDefault() @@ -9936,58 +9344,9 @@ dlg.Multiselect = true; if (dlg.ShowDialog() == DialogResult.OK) { - for (int i = 0; i < dlg.FileNames.Length; i++) + foreach (string strDataPath in dlg.FileNames) { - //this.Cursor = Cursors.WaitCursor; - string strDataPath = dlg.FileNames[i]; - - #region - //string strDataPathPrj = strDataPath.ToLower().Replace(".dwg", ".lprj"); - - //if (File.Exists(strDataPathPrj) == false) - //{ - // if (MessageBox.Show("数据没有空间参考信息,请设置空间参考信息!", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation) == DialogResult.OK) - // { - // String strPath = Application.StartupPath + "\\Coordinate Systems"; - // OpenFileDialog dlgPrj = new OpenFileDialog(); - // dlgPrj.InitialDirectory = strPath; - // dlgPrj.RestoreDirectory = true; - // dlgPrj.Multiselect = false; - // dlg.Filter = "投影文件|*.prj"; - // if (dlg.ShowDialog() == DialogResult.OK) - // { - // this.Cursor = Cursors.WaitCursor; - // string proj4 = GSODataEngineUtility.ConvertEsriPrjFileToProj4(dlg.FileName); - // using (StreamWriter stream = new StreamWriter(strDataPathPrj, false)) - // { - // stream.WriteLine("0prj4" + proj4 + ""); - // } - // AddLayerData(strDataPath); - // //globeControl1.Globe.Layers.Add(strDataPath); - - // this.Cursor = Cursors.Default; - // } - // else - // { - // AddLayerData(strDataPath); - // //globeControl1.Globe.Layers.Add(strDataPath); - // } - // } - // else - // { - // AddLayerData(strDataPath); - // //globeControl1.Globe.Layers.Add(strDataPath); - // } - - //} - //else - //{ - // //globeControl1.Globe.Layers.Add(strDataPath); - // AddLayerData(strDataPath); - //} - #endregion AddLayerData(strDataPath); - //this.Cursor = Cursors.Default; } } @@ -10008,38 +9367,13 @@ { LogManager.saveLog(Utility.userName, this.btn_password_edit.Text); - if (FrmChangePassword.IS_OPEN) + if (!FrmChangePassword.IS_OPEN) { - return; + FrmChangePassword frm = new FrmChangePassword(); + frm.ShowDialog(); } - FrmChangePassword frm = new FrmChangePassword(); - frm.ShowDialog(); } - /// - /// 多孔管线入库 - /// - /// - /// - private void buttonItem9_Click(object sender, EventArgs e) - { - //保存日志 - LogManager.saveLog(Utility.userName, this.buttonItemSJGL4_2.Text); - if (ds == null) - { - MessageBox.Show("请先连接数据库", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); - ConnectDB(null, null); - } - if (ds == null) - return; - - FrmMultiPipelineModelDB frm = new FrmMultiPipelineModelDB(globeControl1, ds); - if (frm.ShowDialog() == DialogResult.OK) - { - addNodeToLayerManagerNode(frm.rukuLayer); - } - //frm.Show(); - } private void 导出CADToolStripMenuItem1_Click(object sender, EventArgs e) { TreeNode node = layerNodeContexMenu.Tag as TreeNode; @@ -10049,44 +9383,42 @@ return; } GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(node.Text.Trim()); - if (layer == null || layer.GetAllFeatures().Length <= 0) + if (layer != null && layer.GetAllFeatures().Length > 0) { - MessageBox.Show("要导出的图层为空", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); - return; - } - string strProjectName = Utility.projectStr; - if (strProjectName != "") - { + string strProjectName = Utility.projectStr; + if (strProjectName == "") return; SaveFileDialog dlg = new SaveFileDialog(); dlg.Filter = "*.dwg|*.dwg|*.dxf|*.dxf"; dlg.FileName = layer.Caption; - if (dlg.ShowDialog(this) == DialogResult.OK) + if (dlg.ShowDialog(this) != DialogResult.OK) return; + globeControl1.Globe.MemoryLayer.SaveAs(dlg.FileName); + GSOLayer newlayer = globeControl1.Globe.Layers.Add(dlg.FileName); + newlayer.RemoveAllFeature(); + int featureCount = layer.GetAllFeatures().Length; + for (int i = 0; i < featureCount; i++) { - globeControl1.Globe.MemoryLayer.SaveAs(dlg.FileName); - GSOLayer newlayer = globeControl1.Globe.Layers.Add(dlg.FileName); - newlayer.RemoveAllFeature(); - int featureCount = layer.GetAllFeatures().Length; - for (int i = 0; i < featureCount; i++) + GSOFeature feature = layer.GetAt(i); + if (feature == null || feature.Geometry == null) continue; + switch (feature.Geometry.Type) { - GSOFeature feature = layer.GetAt(i); - if (feature != null && feature.Geometry != null) - { - if (feature.Geometry.Type == EnumGeometryType.GeoPolyline3D) - { - feature.Geometry.Style = new GSOSimpleLineStyle3D(); - } - else if (feature.Geometry.Type == EnumGeometryType.GeoPolygon3D) - { - feature.Geometry.Style = new GSOSimplePolygonStyle3D(); - } - newlayer.AddFeature(feature); - } + case EnumGeometryType.GeoPolyline3D: + feature.Geometry.Style = new GSOSimpleLineStyle3D(); + break; + case EnumGeometryType.GeoPolygon3D: + feature.Geometry.Style = new GSOSimplePolygonStyle3D(); + break; } - newlayer.Save(); - newlayer.Dataset.DataSource.RemoveDataset(newlayer.Dataset); - globeControl1.Globe.Layers.Remove(newlayer); - MessageBox.Show("导出CAD完成!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); + newlayer.AddFeature(feature); } + newlayer.Save(); + newlayer.Dataset.DataSource.RemoveDataset(newlayer.Dataset); + globeControl1.Globe.Layers.Remove(newlayer); + MessageBox.Show("导出CAD完成!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); + } + else + { + MessageBox.Show("要导出的图层为空", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); + return; } } diff --git a/Cyberpipe.suo b/Cyberpipe.suo index ebd45ee..c2c34b1 100644 --- a/Cyberpipe.suo +++ b/Cyberpipe.suo Binary files differ diff --git a/Forms/FrmPipelineModelDataBase.cs b/Forms/FrmPipelineModelDataBase.cs index a060afb..f833db4 100644 --- a/Forms/FrmPipelineModelDataBase.cs +++ b/Forms/FrmPipelineModelDataBase.cs @@ -1,16 +1,10 @@ using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; using System.Drawing; -using System.Text; using System.Windows.Forms; using GeoScene.Globe; using GeoScene.Engine; using GeoScene.Data; using System.IO; -using System.Collections; -using System.Xml; using System.Text.RegularExpressions; using DevComponents.DotNetBar; @@ -39,11 +33,12 @@ /// private void FrmPipelineModel_Load(object sender, EventArgs e) { + buttonOpen.Visible = isSh; string pipelinetype = Utility.pipelinetype; string[] pipelinetypes = pipelinetype.Split(','); for (int i = 0; i < pipelinetypes.Length; i++) { - pipelineTypeCbo.Items.Add(pipelinetypes[i]);//管线类型 + pipelineTypeCbo.Items.Add(pipelinetypes[i]); } comboBoxExLayer.Items.Clear(); diff --git a/FrmDatabaseParaSetting.cs b/FrmDatabaseParaSetting.cs index 39a4e4f..e4dfe80 100644 --- a/FrmDatabaseParaSetting.cs +++ b/FrmDatabaseParaSetting.cs @@ -123,7 +123,6 @@ { MessageBox.Show("数据库连接成功!", "提示"); } - } else { diff --git a/FrmShResult.cs b/FrmShResult.cs index d11fd66..50a7d8c 100644 --- a/FrmShResult.cs +++ b/FrmShResult.cs @@ -663,7 +663,6 @@ private void FrmShResult_FormClosed(object sender, FormClosedEventArgs e) { mainfrm.boolfrmShResult = false; - } /// /// 一键审核导出 diff --git a/MainFrm.cs b/MainFrm.cs index 2e3ba7f..83acfa1 100644 --- a/MainFrm.cs +++ b/MainFrm.cs @@ -19,7 +19,6 @@ { public partial class MainFrm : Office2007Form { - TreeNode layerManagerNode = null; TreeNode myPlaceNode = null; bool m_bFullScreen = false; @@ -1395,7 +1394,6 @@ private void MainFrm_Load(object sender, EventArgs e) { - this.initGlobalControl(); this.initGlobalMap(); this.initLayerTree(); @@ -1403,13 +1401,11 @@ this.initLayout(); this.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]); jumpToCameraState(x, y, z); - } #endregion @@ -1578,12 +1574,6 @@ 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)); - /*Point pt = getUpperLeftPoint(pt1, pt2); - Image myImg = new Bitmap(Convert.ToInt32(e.Rect.Width), Convert.ToInt32(e.Rect.Height)); - Graphics g = Graphics.FromImage(myImg); - g.CopyFromScreen(pt, new Point(0, 0), new Size(Convert.ToInt32(e.Rect.Width), Convert.ToInt32(e.Rect.Height))); - */ - int mapWidth = 0; int mapHeight = 0; Point pt = getUpperLeftPoint(pt1, pt2, out mapWidth, out mapHeight); @@ -1862,7 +1852,6 @@ { GSOLayer layer = node.Tag as GSOLayer; - //globeControl1.Globe.Layers.Remove(layer); for (int i = globeControl1.Globe.Layers.Count - 1; i >= 0; i--) { if (globeControl1.Globe.Layers[i].Caption == layer.Caption) @@ -2065,7 +2054,6 @@ } } - void globeControl1_MouseWheel(object sender, MouseEventArgs e) { if (globeControl1.Globe.CameraState.Distance > 20000000) @@ -2321,8 +2309,6 @@ case "valvequery": FrmValveStatistics frm = new FrmValveStatistics(globeControl1, polygon, new DataGridViewDelegate(InitDataGridViewX1)); frm.Show(this); - //panelEx6.Visible = true; - //toolStripFeatureLength.Text = ""; globeControl1.Globe.Action = EnumAction3D.ActionNull; break; @@ -2365,7 +2351,6 @@ layerGround.Visible = false; } } - // 清除当前TrackPolygonAnalysis的痕迹 globeControl1.Globe.ClearLastTrackPolygon(); globeControl1.Globe.Action = EnumAction3D.ActionNull; break; @@ -2382,20 +2367,7 @@ globeControl1.Globe.Action = EnumAction3D.ActionNull; break; case "BSQDuoBianXiangStatis": - - //GSOFeature f2 = new GSOFeature(); - //f2.Geometry = e.Polygon; - //f2.Geometry.AltitudeMode = EnumAltitudeMode.Absolute; - //globeControl1.Globe.MemoryLayer.AddFeature(f2); - //f2.Geometry.MoveZ(3); - //workWellLen.Clear(); - //List listBSQ = new List(); - - //GSOFeatures bsqFeatures = PolygonIntersectAnalysis(e.Polygon, "标识器"); - //listBSQ.Add(bsqFeatures); - - //FrmBSQDuoBianXingStatis bsqFrm = new FrmBSQDuoBianXingStatis(workWellLen, globeControl1, listBSQ); - FrmBSQStatis bsqFrm = new FrmBSQStatis(globeControl1, e.Polygon); + FrmBSQStatis bsqFrm = new FrmBSQStatis(globeControl1, e.Polygon); bsqFrm.Show(this); globeControl1.Globe.Action = EnumAction3D.ActionNull; break; @@ -2407,8 +2379,6 @@ } } } - - /// /// 鼠标悬浮提示 /// @@ -2432,20 +2402,19 @@ } catch (Exception ex) { - //LogError.PublishError(ex); + LogError.PublishError(ex); } } - + /// /// 添加管线绘制完成事件, 红线工具绘制完成 /// /// - /// + /// (完善) void globeControl1_MouseDoubleClick(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left) { - if (m_AddPipeLine == true && globeControl1.Globe.Action == EnumAction3D.DrawPolyline)//添加管线 { GSOLayer layerDest = globeControl1.Globe.DestLayerFeatureAdd; @@ -2661,18 +2630,12 @@ { if (e.Button == MouseButtons.Right) { - if (e.X == mouseDownX2 && e.Y == mouseDownY2) - { - RightScreenToolMenu.Show(globeControl2, e.X, e.Y); - } - else - { - return; - } + if (e.X != mouseDownX2 || e.Y != mouseDownY2) return; + RightScreenToolMenu.Show(globeControl2, e.X, e.Y); } } /// - /// + /// (完善) /// /// /// @@ -2912,7 +2875,6 @@ bool result = false; System.Net.WebResponse response = null; - try { System.Net.WebRequest req = System.Net.WebRequest.Create(fileUrl); @@ -3038,7 +3000,7 @@ } /// - /// 拼接气泡表格字符串 + /// 拼接气泡表格字符串(完善) /// /// /// @@ -3233,14 +3195,8 @@ { TreeNode featureAddPipeFitTreenode = GetDestLayerFeatureAddTreeNode(); GSOLayer featureAddLayer = globeControl1.Globe.Layers.GetLayerByCaption(featureAddPipeFitTreenode.Tag.ToString().Split('|')[1]); - if (featureAddLayer != null) - { - return featureAddLayer; - } - else - { - return null; - } + + return featureAddLayer != null ? featureAddLayer : null; } private TreeNode GetDestLayerFeatureAddTreeNode() @@ -3306,7 +3262,6 @@ return null; } - /// /// 地上模式 菜单按钮 /// @@ -3335,22 +3290,16 @@ 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(); - } } /// @@ -3382,13 +3331,9 @@ 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; } @@ -3426,20 +3371,8 @@ globeControl1.Globe.GroundOpaque = 100 - sliderGroundTransSet1.Value; GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(roadLayerName);//("180fd"); if (layer != null) - { layer.Opaque = 100 - sliderGroundTransSet1.Value; - } - //if (buttonItemSPDB.Checked) - //{ - // layer = globeControl2.Globe.Layers.GetLayerByCaption("180fd"); - // if (layer != null) - // { - // layer.Opaque = 100 - sliderGroundTransSet1.Value; - // } - // globeControl2.Globe.GroundOpaque = 100 - sliderGroundTransSet1.Value; - //} optiValue = sliderGroundTransSet1.Value; - //sliderItem1.Value = optiValue; } /// /// 图例 菜单按钮 @@ -3499,21 +3432,7 @@ panel3.Visible = false; sideBar1.ExpandedPanel = sideBarPanelItem3; buttonItemBZ11.Checked = false; - - //20160624 - /* - if (sideBarPanelItem4.Visible == true) - { - sideBar1.Visible = true; - controlContainerItem5.Visible = true; - } - else - { - sideBar1.Visible = false; - } - */ Refresh(); - } } /// @@ -3542,7 +3461,7 @@ int xOld = 0; int yOld = 0; /// - /// 全屏显示功能实现 + /// 全屏显示功能实现(完善) /// private void FullScreen() { @@ -3666,7 +3585,6 @@ FullScreen(); break; case Keys.Escape: - // esc仅仅取消全屏 if (m_bFullScreen) { FullScreen(); @@ -3682,7 +3600,6 @@ } } - private Point getUpperLeftPoint(Point p1, Point p2, out int mapWidth, out int mapHeight) // { Rectangle rc = new Rectangle(); @@ -3695,29 +3612,13 @@ int screenWidth = SystemInformation.WorkingArea.Width; int screenHeight = SystemInformation.WorkingArea.Height; - if (p1.X < x) - rc.X = x; - else - rc.X = p1.X; - - if (p1.Y < y) - rc.Y = y; - else - rc.Y = p1.Y; - + rc.X = p1.X < x ? x : p1.X; + rc.Y = p1.Y < y ? y : p1.Y; p1.X = rc.Left; p1.Y = rc.Top; - if (p2.X > screenWidth) - p2.X = screenWidth; - else - p2.X = p2.X; - - if (p2.Y > screenHeight) - p2.Y = screenHeight; - else - p2.Y = p2.Y; - + p2.X = p2.X > screenWidth ? screenWidth : p2.X; + p2.Y = p2.Y > screenHeight ? screenHeight : p2.Y; rc.Width = p2.X - rc.X; rc.Height = p2.Y - rc.Y; @@ -3728,7 +3629,6 @@ } Image printImage; - private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e) { e.Graphics.DrawImage(printImage, 10, 10); @@ -3742,15 +3642,8 @@ { LogManager.saveLog(Utility.userName, this.btnOutputJPG.Text); - //globeControl1.Globe.Action = EnumAction3D.TrackRect; //绘制矩形模式 - //globeControl1.Globe.TrackRectTool.TrackMode = EnumTrackMode.ScreenTrack; //在屏幕上绘制 Point pt1 = new Point(Convert.ToInt32(0), Convert.ToInt32(0)); Point pt2 = new Point(Convert.ToInt32(panelEx5.Width), Convert.ToInt32(panelEx5.Height)); - /*Point pt = getUpperLeftPoint(pt1, pt2); - Image myImg = new Bitmap(Convert.ToInt32(panelEx5.Width), Convert.ToInt32(panelEx5.Height)); - Graphics g = Graphics.FromImage(myImg); - g.CopyFromScreen(pt, new Point(0, 0), new Size(Convert.ToInt32(panelEx5.Width), Convert.ToInt32(panelEx5.Height))); - */ int mapWidth = 0; int mapHeight = 0; Point pt = getUpperLeftPoint(pt1, pt2, out mapWidth, out mapHeight); @@ -3784,120 +3677,6 @@ } } } - - /// - /// 窗体下方属性表格 右键菜单中的 “定位”菜单 - /// - /// - /// - private void FlyToMenu_Click(object sender, EventArgs e) - { - GSOFeature rowFeature = contextMenuStrip1.Tag as GSOFeature; - if (rowFeature == null) - return; - - - 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); - } - else - { - globeControl1.Globe.FlyToFeature(rowFeature, 0, 45, 3); - } - LightMenu_Click(sender, e); - - } - - /// - /// 表格中右键 “单个闪烁” 菜单 - /// - /// - /// - private void LightMenu_Click(object sender, EventArgs e) - { - flashflag = "single"; - timer1.Start(); - } - /// - /// 表格中右键 “全部闪烁” 菜单 - /// - /// - /// - private void AllLightMenuItem_Click(object sender, EventArgs e) - { - flashflag = "all"; - timer1.Start(); - } - - /// - /// 使用timer实现管线的闪烁效果 - /// - /// - /// - private void timer1_Tick(object sender, EventArgs e) - { - GSOFeature rowFeature = contextMenuStrip1.Tag as GSOFeature; - if (rowFeature == null) - return; - - if (count < 40) - { - count++; - if (flashflag == "single") - { - if (rowFeature != null) - { - if (count % 2 != 0) - { - rowFeature.HighLight = true; - globeControl1.Refresh(); - } - else - { - rowFeature.HighLight = false; - globeControl1.Refresh(); - } - } - } - else if (flashflag == "all") - { - GSOFeatures feats = Utility.Table2Features(dataGridViewX1.DataSource as DataTable, m_CurrentQueryLayer, globeControl1); - if (feats.Length > 0) - { - if (count % 2 != 0) - { - for (int i = 0; i < feats.Length; i++) - { - GSOFeature tempfeat = feats[i]; - tempfeat.HighLight = true; - } - - globeControl1.Refresh(); - } - else - { - for (int i = 0; i < feats.Length; i++) - { - GSOFeature tempfeat = feats[i]; - tempfeat.HighLight = false; - } - globeControl1.Refresh(); - } - } - } - } - else - { - timer1.Stop(); - count = 0; - } - } /// /// 图层目录树 右键菜单中的 目标图层 菜单 /// @@ -3910,7 +3689,6 @@ TreeNode node = layerNodeContexMenu.Tag as TreeNode; FeatureAddLayerMenuItem.Checked = true; GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(node.Tag.ToString().Split('|')[1]); - //GSOLayer layer = globeControl1.Globe.Layers.GetLayerByID((int)node.Tag); globeControl1.Globe.DestLayerFeatureAdd = layer; } } @@ -3954,7 +3732,6 @@ layer.Dataset.Save(); } - #region wxl feature的公共方法 /// /// 查找指定图层中在 指定范围内的feature对象集合 @@ -3966,24 +3743,10 @@ { GSOFeatures feats = new GSOFeatures(); GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(layername); - if (layer == null) - { - return feats; - } + if (layer == null)return feats; GSOFeatureLayer flayer = layer as GSOFeatureLayer; - if (flayer != null) - { - GSOFeatureDataset fdataset = flayer.Dataset as GSOFeatureDataset; - } - - if (polygon == null) - { - feats = flayer.GetAllFeatures(); - } - else - { - feats = flayer.FindFeaturesInPolygon(polygon, false); - } + if (flayer == null) return feats; + feats = polygon == null ? flayer.GetAllFeatures() : flayer.FindFeaturesInPolygon(polygon, false); return feats; } #endregion @@ -4014,10 +3777,7 @@ if (globeControl1.Globe.Action != EnumAction3D.NormalHit) { buttonItemFX3_6.Checked = false; - // ClearConnexityAnalysis(); - buttonItemFX3_5.Checked = false; - // ClearCloseValvesAnalysis(); } if (globeControl1.Globe.Action != EnumAction3D.TrackPolygon) { @@ -4025,7 +3785,6 @@ buttonItemFX4_1.Checked = false; } } - /// /// 主窗体关闭事件处理 /// @@ -4033,21 +3792,13 @@ /// private void MainFrm_FormClosing(object sender, FormClosingEventArgs e) { - if (MessageBox.Show("是否退出系统?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) - { e.Cancel = true; - } else - { globeControl1.Globe.MemoryLayer.SaveAs(Application.StartupPath + "/MyPlace.kml"); - } - - //saveLayerList(layerManagerNode.Nodes); - //注销id号为103的热键设定 - // UnregisterHotKey(Handle, 103); } + #region 完善 /// /// 垂直净距分析 功能界面中的 选择图层复选框 选中状态改变事件处理 /// @@ -4198,12 +3949,10 @@ } } } - Dictionary featCount = new Dictionary(); Dictionary featLenth = new Dictionary(); Dictionary m_FeaturesWithBianhao = new Dictionary();//记录编号和对应的标注点的位置 GSOFeatures polygonJingJuAnalysises = new GSOFeatures(); - /// /// 垂直净距分析 功能界面中的 开始分析按钮 事件处理 /// @@ -4293,7 +4042,6 @@ globeControl1.Refresh(); this.Cursor = Cursors.Default; } - /// /// 在指定的两点组成的线的中间添加一个marker对象,并将marker对象添加到指定的图层中 /// @@ -4357,7 +4105,6 @@ return dismarker.Position; } - /// /// 计算指定feature对象与除了该feature所在图层之外的 所有管线图层中的所有feature对象 的垂直距离 并在表格中记录符合要求的管线 /// @@ -4411,8 +4158,7 @@ double dDist = -1; dDist = globeControl1.Globe.Analysis3D.ComputeHorizonDistance(line1, line2, out pntIntersect1, out pntIntersect2, out pntProIntersect1, out pntProIntersect2, false); - //dDist = globeControl1.Globe.Analysis3D.ComputeVerticalDistance(line1, line2, out pntIntersect1, out pntIntersect2, out pntProIntersect1, out pntProIntersect2, false); - + if (dDist > -1) { dDist = Math.Abs(pntIntersect1.Z - pntIntersect2.Z) - pipeStyle1.Radius - pipeStyle2.Radius;//获得净距值 @@ -4472,25 +4218,6 @@ } } } - - //double verticalDis = dDist; - //dDist = globeControl1.Globe.Analysis3D.ComputeVerticalDistance(line1, line2, out pntIntersect1, out pntIntersect2, out pntProIntersect1, out pntProIntersect2, false); - //if (dDist > -1) - //{ - // dDist = Math.Abs(pntIntersect1.Z - pntIntersect2.Z) - pipeStyle1.Radius - pipeStyle2.Radius; - // if (dDist < horizontalDistance) - // { - // 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 = verticalDis.ToString("0.00"); - // dataGridViewAnalysisResult.Rows[idx].Cells[5].Value = dDist.ToString("0.00"); - // } - //} } if (m_FeaturesWithBianhao.ContainsKey(selectedFeature.Name + "-" + feats2[j].Name) == false) @@ -4545,7 +4272,6 @@ } } } - /// /// 水平净距分析 功能界面中 开始分析按钮 的事件处理 /// @@ -4629,8 +4355,6 @@ globeControl1.Refresh(); this.Cursor = Cursors.Default; } - - /// /// 计算指定feature对象与除了该feature所在图层之外的 所有管线图层中的所有feature对象 的水平距离 并记录符合要求的管线 功能 /// @@ -4820,7 +4544,6 @@ else { MessageBox.Show("请选中要进行碰撞分析的管线!", "提示"); - //globeControl1.Globe.Action = EnumAction3D.SelectObject; } globeControl1.Refresh(); this.Cursor = Cursors.Default; @@ -4845,9 +4568,6 @@ } } } - - - /// /// 覆土分析功能操作界面中的 选择管线 复选框选中状态改变事件处理 /// @@ -5071,11 +4791,9 @@ else { MessageBox.Show("请选中要进行覆土分析的管线!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); - //globeControl1.Globe.Action = EnumAction3D.SelectObject; } this.Cursor = Cursors.Default; } - /// /// 覆土分析中 表格的 双击定位 功能 /// @@ -5155,8 +4873,6 @@ //Refresh(); } - - /// /// 垂直净距分析 功能界面中 清除分析结果按钮 事件处理 /// @@ -5201,7 +4917,6 @@ layerTemp.RemoveAllFeature(); globeControl1.Refresh(); } - /// /// 垂直净距分析功能界面中 关闭按钮 事件处理 /// @@ -5262,7 +4977,6 @@ Refresh(); } - /// /// 导出指定DataGridView控件中的内容 /// @@ -5352,7 +5066,6 @@ } } } - /// /// 垂直净距分析功能界面中 导出Excel按钮 事件处理 /// @@ -5384,103 +5097,7 @@ { MessageBox.Show("表格内容为空!", "提示"); } - } - - - - /// - /// 添加指定路径下的数据 功能 - /// - /// - /// - private object AddLayerData(string strDataPath) - { - object objRes = null; - if (Path.GetExtension(strDataPath).ToLower().Equals(".kml")) - { - GSOLayer layer = globeControl1.Globe.Layers.Add(strDataPath); - objRes = layer; - if (layer != null) - { - 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; - // 注意用insert不要用add,因为后加入的图层在上层 - //layerManagerNode.Nodes.Add(node); - layerManagerNode.Nodes.Insert(0, node); - } - newlayername = layer.Caption; - } - else if (GSOUtility.IsDatasetSupportTerrain(strDataPath)) - { - GSOTerrain terrain = globeControl1.Globe.Terrains.Add(strDataPath); - objRes = terrain; - if (terrain != null) - { - TreeNode node = new TreeNode(); - node.Tag = terrain; - node.Text = terrain.Caption; - node.ImageIndex = 0; - node.SelectedImageIndex = 0; - node.Checked = terrain.Visible; - // 注意用insert不要用add,因为后加入的图层在上层 - // terrainManagerNode.Nodes.Add(node); - layerManagerNode.Nodes.Insert(0, node); - } - newlayername = terrain.Caption; - } - else if (Path.GetExtension(strDataPath).ToLower().Equals(".dxf")) - { - GSOLayer layer = globeControl1.Globe.Layers.Add(strDataPath); - objRes = layer; - if (layer != null) - { - GSODataset dataset = layer.Dataset; - CheckDatasetGeoReference(layer.Dataset, strDataPath); - CheckDatasetGeoReference(layer.Dataset, strDataPath); - TreeNode node = new TreeNode(); - node.Tag = layer; - node.Text = layer.Dataset.Caption; - node.ImageIndex = 0; - node.SelectedImageIndex = 0; - node.Checked = layer.Visible; - // 注意用insert不要用add,因为后加入的图层在上层 - //layerManagerNode.Nodes.Add(node); - layerManagerNode.Nodes.Insert(0, node); - } - newlayername = layer.Caption; - } - else - { - GSOLayer layer = globeControl1.Globe.Layers.Add(strDataPath); - objRes = layer; - if (layer != null) - { - GSODataset dataset = layer.Dataset; - - CheckDatasetGeoReference(layer.Dataset, strDataPath); - CheckDatasetGeoReference(layer.Dataset, strDataPath); - //CheckDatasetGeoReference(dataset); - TreeNode node = new TreeNode(); - node.Tag = layer; - node.Text = layer.Dataset.Caption; - node.ImageIndex = 0; - node.SelectedImageIndex = 0; - node.Checked = layer.Visible; - // 注意用insert不要用add,因为后加入的图层在上层 - //layerManagerNode.Nodes.Add(node); - layerManagerNode.Nodes.Insert(0, node); - } - newlayername = layer.Caption; - } - return objRes; - } - + } /// /// 碰撞分析功能界面中 选择管线复选框 选中状态改变事件处理 /// @@ -5600,7 +5217,6 @@ //globeControl1.Globe.Action = EnumAction3D.SelectObject; } } - /// /// 碰撞分析功能界面中 清除分析结果按钮 事件处理 /// @@ -5638,344 +5254,6 @@ MessageBox.Show("表格内容为空!", "提示"); } } - - ///// - ///// 区域分析 菜单 - ///// - ///// - ///// - //private void buttonItem50_Click(object sender, EventArgs e) - //{ - // buttonItem50.Checked = !buttonItem50.Checked; - // ribbonBarQY.Visible = buttonItem50.Checked; - // ribbonBarQY.Location = new Point(0, 0); - //} - - - /// - /// 连接数据库 菜单事件处理 - /// - /// - /// - private void ConnectDB(object sender, EventArgs e) - { - FrmDatabaseParaSetting frm = new FrmDatabaseParaSetting(globeControl1); - if (frm.ShowDialog() == DialogResult.OK) - { - ds = FrmDatabaseParaSetting.ds; - if (ds != null) - { - ds.IsCloseSaved = false; - } - } - } - - /// - /// 根据指定图层创建图层节点并将节点添加到图层管理节点的子节点集合中 - /// - /// - private void addNodeToLayerManagerNode(GSOLayer layer) - { - if (layer != null) - { - 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; - - if (!layerManagerNode.Nodes.Contains(node)) - { - layerManagerNode.Nodes.Insert(0, node); - layerManagerNode.Expand(); - } - } - } - - /// - /// 获取指定图层中最后一个feature对象的名称对应的整数 - /// - /// - /// - public int getLabelName(GSOLayer layer) - { - int nid = -1; - if (layer.GetAllFeatures().Length > 0) - { - string id = layer.GetAllFeatures()[layer.GetAllFeatures().Length - 1].Name; - - int.TryParse(id, out nid); - } - else - { - nid = 0; - } - return nid; - } - /// - /// 设置除指定标注图层之外的所有标注图层不可见 - /// - /// - public void setMarkerLayerUnVisible(string layerName) - { - string[] markerStrs = new string[10]; - markerStrs[0] = "标高标注"; - markerStrs[1] = "管径标注"; - markerStrs[2] = "埋深标注"; - markerStrs[3] = "坐标标注"; - markerStrs[4] = "坡度标注"; - markerStrs[5] = "属性标注"; - markerStrs[6] = "自定义标注"; - markerStrs[7] = "距离标注"; - markerStrs[8] = "红线工具"; - markerStrs[9] = "扯旗标注"; - - for (int i = 0; i < markerStrs.Length; i++) - { - GSOLayer markerLayer = globeControl1.Globe.Layers.GetLayerByCaption(markerStrs[i]); - if (markerLayer != null) - { - if (markerStrs[i] != layerName) - { - 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) - { - markerFeature.Visible = false; - } - } - if (layerMarkerTree.Nodes[0].Nodes.Count > i) - { - layerMarkerTree.Nodes[0].Nodes[i].Checked = true; - } - } - } - } - } - - /// - /// 判断选中的对象是否为管线 - /// - /// 被选中管线 - /// 返回一根线 - private GSOFeature IsPipeLineOfSelectedObj() - { - GSOFeature resFeature = null; - if (globeControl1.Globe.SelObjectCount < 1) - { - return null; - } - GSOLayer resLayer = null; - globeControl1.Globe.GetSelectObject(0, out resFeature, out resLayer); - if (resFeature == null) - return null; - - GSOGeoPolyline3D line1 = resFeature.Geometry as GSOGeoPolyline3D; - if (line1 == null) - { - return null; - } - GSOPipeLineStyle3D pipeStyle1 = line1.Style as GSOPipeLineStyle3D; - if (pipeStyle1 == null) - { - return null; - } - return resFeature; - } - - /// - /// 图层节点树中 节点 右键单击事件处理 - /// - /// - /// - private void layerMarkerTree_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e) - { - if (e.Button == MouseButtons.Right) - { - if (e.Node.Text == "标注管理" || e.Node.Text == "传感器管理") - { - return; - } - else if (e.Node.Parent.Text == "标注管理") - { - layerMarkerTree.SelectedNode = e.Node; - contextMenuStrip2.Show(layerMarkerTree, e.X, e.Y); - contextMenuStrip2.Tag = e.Node; - } - else if (e.Node.Parent.Text == "传感器管理") - { - layerSensorTree.SelectedNode = e.Node; - contextMenuStrip2.Show(layerSensorTree, e.X, e.Y); - contextMenuStrip2.Tag = e.Node; - } - else - { - if (e.Node.Tag is GSOFeature) - { - if (e.Node.Parent.Parent.Text == "标注管理") - { - layerMarkerTree.SelectedNode = e.Node; - contextMenuStrip3.Show(layerMarkerTree, e.X, e.Y); - contextMenuStrip3.Tag = e.Node; - } - else if (e.Node.Parent.Parent.Text == "传感器管理") - { - layerSensorTree.SelectedNode = e.Node; - contextMenuStrip3.Show(layerSensorTree, e.X, e.Y); - contextMenuStrip3.Tag = e.Node; - } - } - } - } - } - - /// - /// 标注管理、传感器管理 图层目录树的右键菜单中的 刷新列表 菜单 - /// - /// - /// - private void toolStripMenuItem1_Click(object sender, EventArgs e) - { - TreeNode node = contextMenuStrip2.Tag as TreeNode; - TreeNode parentNode = node.Parent; - Int32 nIndex = node.Index; - - if (parentNode.Text == "标注管理" || parentNode.Text == "传感器管理") - { - RefreshTreeNodeLayerFeatureList(node); - } - } - /// - /// 给指定的图层节点添加代表feature对象的子节点 - /// - /// - private void RefreshTreeNodeLayerFeatureList(TreeNode layerTreeNode) - { - layerTreeNode.Nodes.Clear(); - GSOLayer layer = (GSOLayer)layerTreeNode.Tag; - // 只将类型为内存数据集的图层列出,如果是其它类型的数据集可能数据量太大,没发显示在树控件中 - if (layer.Dataset is GSOFeatureDataset) - { - VisitFeature3Ds(layer.GetAllFeatures(), layerTreeNode); - } - } - - /// - /// 标注管理、传感器管理 图层目录树的右键菜单中的 移除所有 菜单 - /// - /// - /// - private void toolStripMenuItem2_Click(object sender, EventArgs e) - { - TreeNode node = contextMenuStrip3.Tag as TreeNode; - GSOFeature feature3d = node.Tag as GSOFeature; - if (node == null) - { - return; - } - if (feature3d != null) - { - feature3d.Delete(); - globeControl1.Globe.Refresh(); - node.Remove(); - } - } - - /// - /// 图层目录树的 节点对应的复选框选中状态改变事件处理 - /// - /// - /// - private void layerMarkerTree_AfterCheck(object sender, TreeViewEventArgs e) - { - if (e.Action != TreeViewAction.Unknown) - { - CheckTreeNode(e.Node, e.Node.Checked); - } - } - /// - /// 改变指定节点对应的复选框的选中状态 - /// - /// - /// - private void CheckTreeNode(TreeNode node, Boolean bChecked) - { - CheckChildTreeNode(node, bChecked); - globeControl1.Globe.Refresh(); - } - /// - /// 改变指定节点的子节点对应的复选框的选中状态 - /// - /// - /// - private void CheckChildTreeNode(TreeNode node, Boolean bChecked) - { - if (node == null) - { - return; - } - if (node.Tag != null) - { - if (node.Tag.GetType() == typeof(GSOFeatureFolder) || node.Tag.GetType() == typeof(GSOFeature)) - { - ((GSOFeature)node.Tag).SetVisibleDirectly(bChecked); - } - else - { - GSOLayer curLayer = node.Tag as GSOLayer; - GSOTerrain curTerrain = node.Tag as GSOTerrain; - if (curLayer != null) - { - curLayer.Visible = bChecked; - } - else if (curTerrain != null) - { - curTerrain.Visible = bChecked; - } - } - } - // 递归处理子节点 - for (int i = 0; i < node.Nodes.Count; i++) - { - node.Nodes[i].Checked = bChecked; - CheckChildTreeNode(node.Nodes[i], bChecked); - } - } - /// - /// 标注管理、传感器管理 目录树中的feature节点的右键菜单中的 删除 菜单 - /// - /// - /// - private void 删除ToolStripMenuItem1_Click(object sender, EventArgs e) - { - TreeNode node = contextMenuStrip2.Tag as TreeNode; - GSOLayer l = globeControl1.Globe.Layers.GetLayerByCaption(node.Text); - if (l != null) - { - l.RemoveAllFeature(); - node.Nodes.Clear(); - globeControl1.Refresh(); - } - } - - //定时检查传感器的状态 - public System.Windows.Forms.Timer timerOfSensor = null; - - /// /// 碰撞分析 功能界面中 关闭按钮 事件处理 /// @@ -5984,7 +5262,6 @@ private void buttonX7_Click_1(object sender, EventArgs e) { trackflag = ""; - globeControl1.Globe.Action = EnumAction3D.ActionNull; sideBarPanelItem4.Visible = false; panel2.Visible = false; @@ -5994,14 +5271,9 @@ dataGridViewX4.Rows.Clear(); dataGridViewX5.Rows.Clear(); if (buttonItem1.Checked) - { sideBar1.ExpandedPanel = sideBarPanelItem3; - } else - { sideBar1.Visible = false; - - } Refresh(); } /// @@ -6193,14 +5465,8 @@ comboBoxLayer.SelectedIndex = -1; dataGridViewLineList.Rows.Clear(); dataGridViewAnalysisResult.Rows.Clear(); - //if (buttonItem1.Checked) - //{ - // sideBar1.ExpandedPanel = sideBarPanelItem3; - //} - //else - //{ + sideBar1.Visible = false; - //} Refresh(); } /// @@ -6225,9 +5491,7 @@ globeControl1.Globe.JumpToPosition(point3d, EnumAltitudeMode.Absolute, 5); } else - { globeControl1.Globe.JumpToFeature(rowFeature, 5); - } } } } @@ -6308,897 +5572,6 @@ } } } - - /// - /// 一键审核---导入数据 - /// - /// - /// - private void buttonItem127_Click_2(object sender, EventArgs e) - { - LogManager.saveLog(Utility.userName, "打开数据"); - - try - { - - string dbIp = Utility.sgdbip; - string database = Utility.sgdbname; - string user = Utility.sgdbuser; - string pass = Utility.sgdbpwd; - shds = globeControl1.Globe.DataManager.OpenOracleDataSource(dbIp + "/" + database, "", "", user, pass); - if (shds == null) - { - MessageBox.Show("数据库连接失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); - } - Cyberpipe.Forms.FrmPipelineModelDataOneStep frm = new Cyberpipe.Forms.FrmPipelineModelDataOneStep(globeControl1, shds, layerTree); - if (frm.ShowDialog() == DialogResult.OK) - { - addNodeToLayerManagerNode(frm.rukuLayer); - } - } - catch (Exception ex) - { - LogError.PublishError(ex); - MessageBox.Show("内存过载请清理内存,并重新启动规划分析!", "提示"); - return; - } - - } - - /// - ///自动导出图片 - /// - /// - /// - private void buttonItem130_Click_1(object sender, EventArgs e) - { - LogManager.saveLog(Utility.userName, "导出审核图"); - - Point pt1 = new Point(Convert.ToInt32(0), Convert.ToInt32(0)); - Point pt2 = new Point(Convert.ToInt32(panelEx5.Width), Convert.ToInt32(panelEx5.Height)); - /*Point pt = getUpperLeftPoint(pt1, pt2); - Image myImg = new Bitmap(Convert.ToInt32(panelEx5.Width), Convert.ToInt32(panelEx5.Height)); - Graphics g = Graphics.FromImage(myImg); - g.CopyFromScreen(pt, new Point(0, 0), new Size(Convert.ToInt32(panelEx5.Width), Convert.ToInt32(panelEx5.Height))); - */ - - 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 = System.IO.Path.GetExtension(dlg.FileName);//扩展名 - switch (extension) - { - case ".jpg": - myImg.Save(dlg.FileName, System.Drawing.Imaging.ImageFormat.Jpeg); - break; - case ".png": - myImg.Save(dlg.FileName, System.Drawing.Imaging.ImageFormat.Png); - break; - case ".bmp": - myImg.Save(dlg.FileName, System.Drawing.Imaging.ImageFormat.Bmp); - break; - case ".gif": - myImg.Save(dlg.FileName, System.Drawing.Imaging.ImageFormat.Gif); - break; - default: - break; - } - } - } - /// - /// 一键审核功能 - /// - /// - /// - private void buttonItem128_Click(object sender, EventArgs e) - { - LogManager.saveLog(Utility.userName, this.buttonItem128.Text); - //垂直净距标准 - - frmSh = new FrmYJSHTC(globeControl1, globeControl2, layerTree); - - if (frmSh.ShowDialog() == DialogResult.OK) - { - frmWait = new FrmWait("一键审核……"); - frmWait.Location = new Point(this.Width - frmWait.Width - 10, this.Height - frmWait.Height - 50); - frmWait.Owner = this; - frmWait.Show(); - Thread thread = new Thread(new ThreadStart(doWork)); - thread.IsBackground = true; - thread.Start(); - } - } - - void doWork() - { - FrmShResult frmShResult = null; - - double dVerticalJingJuBiaoZhun = 1, dHorizontalJingJuBiaoZhun = 1; - if (frmSh.rukuLayer != null) - { - #region - this.Invoke((EventHandler)delegate - { - try - { - List managerLayerList = new List(); - for (int i = 0; i < layerManagerNode.Nodes.Count; i++) - { - managerLayerList.Add(layerManagerNode.Nodes[i].Text); - } - if (!managerLayerList.Contains(frmSh.rukuLayer.Caption)) - { - TreeNode node = new TreeNode(); - node.Tag = frmSh.rukuLayer; - node.Text = frmSh.rukuLayer.Dataset.Caption; - node.ImageIndex = 0; - node.SelectedImageIndex = 0; - node.Checked = frmSh.rukuLayer.Visible; - layerManagerNode.Nodes.Insert(0, node); - layerManagerNode.Expand(); - } - } - catch (Exception ex) - { - MessageBox.Show(ex.Message, "提示"); - } - }); - #endregion - - shlayername = frmSh.rukuLayer.Name; - globeControl1.Refresh(); - } - - if (frmShResult != null && !frmShResult.IsDisposed) - { - try - { - clearFeatureHighLight(); - ClearRedlineAnalyseResult(); - frmShResult.Close(); - } - catch (Exception ex) - { - MessageBox.Show(ex.Message); - } - } - - frmShResult = new FrmShResult(dVerticalJingJuBiaoZhun, dHorizontalJingJuBiaoZhun, shlayername, globeControl1, m_PipelineLayerNames); - if (boolfrmShResult == false) - { - frmShResult.Location = new Point(this.Width - frmShResult.Width - 10, this.Height - frmShResult.Height - 50); - frmShResult.Owner = this; - //一键审核实际计算步骤 - frmShResult.analysis(); - - //MainFrm窗体显示控制,回到一键审核Tab - this.Invoke((EventHandler)delegate - { - frmShResult.Show(); - frmWait.Close(); - //将tab页恢复到一键审核 - ribbonTabItem11.Checked = true; - try - { - globeControl1.Globe.Action = EnumAction3D.ActionNull; - //zhanshi = false; - splitContainer1.Panel2Collapsed = true; - - panelOfTable.Visible = false; - legendSC.Visible = false; - legendSG.Visible = false; - - GSOLayer redLayer = globeControl1.Globe.Layers.GetLayerByCaption("红线"); - if (redLayer != null) - { - redLayer.Visible = false; - } - } - catch (Exception ex) - { - MessageBox.Show("系统运行错误:" + ex.ToString(), "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); - } - - }); - - boolfrmShResult = true; - } - else - { - - } - } - - - /// - /// 清除渲染结果 - /// - public void ClearRedlineAnalyseResult() - { - for (int i = 0; i < globeControl1.Globe.Layers.Count; i++) - { - GSOLayer layer = globeControl1.Globe.Layers[i]; - if (layer.Caption == "tempLgdData") - { - layer.RemoveAllFeature(); - } - } - - layerTemp.RemoveAllFeature(); - globeControl1.Refresh(); - } - /// - /// 已审核的图层 - /// - /// - /// - private void buttonItem132_Click_1(object sender, EventArgs e) - { - //保存日志 - LogManager.saveLog(Utility.userName, this.buttonItem132.Text); - - if (shds == null) - { - //没连的话,直接连接审核库; //审核库配置读配置文件 - string dbIp = Utility.sgdbip; - string database = Utility.sgdbname; - string user = Utility.sgdbuser; - string pass = Utility.sgdbpwd; - - /* - if (!Utility.isNetworkConnectionSuccess(dbIp.Trim())) - { - MessageBox.Show("网络连接失败!", "提示"); - return; - } - */ - - shds = globeControl1.Globe.DataManager.OpenOracleDataSource(dbIp + "/" + database, "", "", user, pass); - if (shds == null) - { - MessageBox.Show("数据库连接失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); - } - } - Cyberpipe.Forms.FrmShLayers frm = new Cyberpipe.Forms.FrmShLayers(globeControl1, shds); - frm.Show(); - //if (frm.ShowDialog() == DialogResult.OK) - //{ - // addNodeToLayerManagerNode(frm.rukuLayer); - //} - //if (frm.rukuLayer != null) - //{ - // shlayername = frm.rukuLayer.Name; - //} - - } - /// - /// 审核入库 - /// - /// - /// - private void buttonItem133_Click_1(object sender, EventArgs e) - { - LogManager.saveLog(Utility.userName, "审核入库"); - FrmShRK frmShrk = new FrmShRK(globeControl1); - frmShrk.Show(); - } - /// - /// 模拟设计修改 - /// - /// - /// - private void buttonItem134_Click_1(object sender, EventArgs e) - { - LogManager.saveLog(Utility.userName, "模拟设计修改"); - - frmModify = new FrmMnModify(globeControl1, shlayername, shresultLists); - - if (boolfrmModify == false) - { - frmModify.Owner = this; - frmModify.Location = new Point(this.Width - frmModify.Width - 10, this.Height - frmModify.Height - 50); - frmModify.Show(); - boolfrmModify = true; - } - else - { - - } - - } - - - - /// - /// 一键审核中调节透明度 - /// - /// - /// - private void sliderItem1_ValueChanged(object sender, EventArgs e) - { - LogManager.saveLog(Utility.userName, this.sliderItem1.Text); - - globeControl1.Globe.GroundOpaque = 100 - sliderItem1.Value; - GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(roadLayerName);//("180fd"); - if (layer != null) - { - layer.Opaque = 100 - sliderItem1.Value; - } - - optiValue = sliderItem1.Value; - } - /// - /// 红线审核中的透明度分析 - /// - /// - /// - private void sliderItem3_ValueChanged(object sender, EventArgs e) - { - LogManager.saveLog(Utility.userName, this.sliderItem3.Text); - - globeControl1.Globe.GroundOpaque = 100 - sliderItem3.Value; - GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(roadLayerName);//("180fd"); - if (layer != null) - { - layer.Opaque = 100 - sliderItem3.Value; - } - optiValue = sliderItem3.Value; - } - - #region yanxiaowei - //初始化DataGridViewX1控件 - public delegate void DataGridViewDelegate(DataTable dt, string strLable, string strLayer, bool initDataGrid); - /// - /// 代理函数,操作DatgridViewX1 - /// - /// - /// - public void InitDataGridViewX1(DataTable dt, string strLable, string strLayer, bool initDataGrid) - { - if (initDataGrid == true) - { - dataGridViewX1.DataSource = dt; - panelOfTable.Visible = true; - toolStripNumbers.Text = strLable; - dataGridViewX1.Tag = strLayer; - } - else - { - dataGridViewX1.DataSource = null; - dataGridViewX1.Refresh(); - panelOfTable.Visible = false; - toolStripNumbers.Text = ""; - dataGridViewX1.Tag = ""; - globeControl1.Globe.MemoryLayer.RemoveAllFeature();//清除双击产生的标注 - } - } - FrmAnalysisGuiHuaResult from; - /// - /// 主窗体下方属性表格 双击定位 功能 - /// - /// - /// - 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 if (dataGridViewX1.Columns.Contains("标识器编号")) - { - featureName = dataGridViewX1.Rows[hittestinfo.RowIndex].Cells["标识器编号"].Value.ToString(); - } - featureName = featureName.Trim(); - - GSOLayer layer = null; - layer = globeControl1.Globe.Layers.GetLayerByCaption(dataGridViewX1.Tag.ToString()); - - if (layer == null) return; - - GSOFeatures features = layer.GetFeatureByName(featureName, false); - if (features.Length == 0) return; - GSOFeature rowFeature = features[0]; - - ClassSearchAnalysis.AddMakerToLineFeature(globeControl1, rowFeature); - - } - } - } - else - { - if (e.Button == MouseButtons.Left) - { - if (from != null && !from.IsDisposed) - { - try - { - from.Close(); - } - catch (Exception ex) - { - LogError.PublishError(ex); - } - } - try - { - DataGridView.HitTestInfo hittestinfo = dataGridViewX1.HitTest(e.X, e.Y); - if (hittestinfo.RowIndex >= 0) - { - string layer = dataGridViewX1.Rows[hittestinfo.RowIndex].Cells["管线类型"].Value.ToString(); - string hxName = dataGridViewX1.Rows[hittestinfo.RowIndex].Cells["红线编号"].Value.ToString(); - FrmAnalysisGuiHuaResult frm = new FrmAnalysisGuiHuaResult(globeControl1, lineStruct, featsList, - panelOfTable, dataGridViewX1, layer, hxName); - frm.Location = new Point(this.Width - frm.Width - 10, this.Height - frm.Height - 20); - frm.Show(this); - - from = frm; - } - } - catch (Exception ex) - { - LogError.PublishError(ex); - } - } - } - } - - /// - /// 空间查询 - /// - /// - /// - private void buttonItemSearch1_Click(object sender, EventArgs e) - { - LogManager.saveLog(Utility.userName, this.buttonItemSearch1.Text); - - trackflag = "PipelineSpatialQuery"; - globeControl1.Globe.Action = EnumAction3D.TrackPolygon; - globeControl1.Globe.TrackPolygonTool.TrackMode = EnumTrackMode.SpaceTrack; - - } - /// - /// 关键字查询 - /// - /// - /// - private void buttonItemSearch9_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, this.buttonItemSearch9.Text); - - FrmKeywordQuery.ShowForm(globeControl1, m_PipelineLayerNames, new DataGridViewDelegate(InitDataGridViewX1)); - } - /// - /// 编号查询 - /// - /// - /// - private void buttonItemSearch2_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, this.buttonItemSearch2.Text); - - FrmCodingQuery.ShowForm(globeControl1, m_PipelineLayerNames, new DataGridViewDelegate(InitDataGridViewX1)); - } - /// - /// 坐标查询 - /// - /// - /// - private void buttonItemSearch3_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, this.buttonItemSearch3.Text); - - FrmSetLatLonPos.ShowForm(globeControl1); - } - /// - /// 附属物查询 - /// - /// - /// - private void buttonItemSearch10_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, this.buttonItemSearch10.Text); - - FrmFittingQuery.ShowForm(globeControl1, instrumenLayerNames, new DataGridViewDelegate(InitDataGridViewX1)); - } - /// - /// 管径查询 - /// - /// - /// - private void buttonItemSearch4_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, this.buttonItemSearch4.Text); - - FrmDiameterQuery.ShowForm(globeControl1, m_PipelineLayerNames, new DataGridViewDelegate(InitDataGridViewX1)); - } - /// - /// 材质查询 - /// - /// - /// - private void buttonItemSearch5_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, this.buttonItemSearch5.Text); - - FrmMaterialSel.ShowForm(globeControl1, m_PipelineLayerNames, new DataGridViewDelegate(InitDataGridViewX1)); - } - /// - /// 基本查询 - /// - /// - /// - private void buttonItemSearch6_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, this.buttonItemSearch6.Text); - - FrmBasicQuery.ShowForm(globeControl1, new DataGridViewDelegate(InitDataGridViewX1)); - } - /// - /// 复合查询 - /// - /// - /// - private void buttonItemSearch7_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, this.buttonItemSearch7.Text); - - FrmQuerySQL.ShowForm(globeControl1, new DataGridViewDelegate(InitDataGridViewX1)); - } - /// - /// 关联查询 - /// - /// - /// - private void buttonItemSearch8_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, this.buttonItemSearch8.Text); - - if (globeControl1.Globe.SelObjectCount != 1) - { - MessageBox.Show("请选中一个对象!", "提示"); - return; - } - - double valueAllowance = 1.0; - - for (int j = 0; j < globeControl1.Globe.SelObjectCount; j++) - { - GSOFeature feature = null; - GSOLayer layer = null; - globeControl1.Globe.GetSelectObject(j, out feature, out layer); - - if (feature == null && feature.Geometry == null || (feature.Geometry.Type == EnumGeometryType.GeoPolygon3D - || feature.Geometry.Type == EnumGeometryType.GeoWater)) - return; - else - { - ClassSearchAnalysis.ResultRelationAnalysis(globeControl1, feature, valueLayerNames, workwellLayerNames, - instrumenLayerNames, pipefittingLayerNames, m_PipelineLayerNames, valueAllowance); - } - } - } - #endregion - /// - /// 清除分析 - /// - /// - /// - private void buttonItemClear_Click(object sender, EventArgs e) - { - LogManager.saveLog(Utility.userName, this.buttonItemClear.Text); - - globeControl1.Globe.ClearMeasure(); - layerTemp.RemoveAllFeature(); - layerTemp2.RemoveAllFeature(); - buttonItemLS5.Checked = false; - - dataGridViewX1.DataSource = null; - panelOfTable.Visible = false; - - globeControl1.Globe.MemoryLayer.RemoveAllFeature(); - globeControl1.Globe.ClearAnalysis(); - - - // 清除净距分析结果 - buttonX2_Click(null, null); - buttonX8_Click(null, null); - buttonX15_Click(null, null); - buttonX16_Click(null, null); - buttonClearAnalysisResult_Click(null, null); - - NetworkAnalysisTool.ClearAllTopAnalysis(this.globeControl1); - // ClearConnexityAnalysis();//清除连通性分析 - // 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); - } - } - - GSOFeatures feats = globeControl1.Globe.MemoryLayer.GetFeatureByName("粒子要素", true); - if (feats.Length > 0) - globeControl1.Globe.MemoryLayer.RemoveFeatureByID(feats[0].ID); - - globeControl1.Globe.UnderGroundFloor.Visible = false;//隐藏地下网格线 - - // ClearUpDownTraceAnalysis(); //清除上下游分析 - globeControl1.Globe.RemoveAllPits();//清除所有坑 - - string[] markerStrs = new string[9]; - markerStrs[0] = "标高标注"; - markerStrs[1] = "管径标注"; - markerStrs[2] = "埋深标注"; - markerStrs[3] = "坐标标注"; - markerStrs[4] = "坡度标注"; - markerStrs[5] = "属性标注"; - markerStrs[6] = "自定义标注"; - markerStrs[7] = "距离标注"; - markerStrs[8] = "扯旗标注"; - for (int i = 0; i < markerStrs.Length; i++) - { - GSOLayer markerLayer = globeControl1.Globe.Layers.GetLayerByCaption(markerStrs[i]); - markerLayer.RemoveAllFeature(); - } - if (layerMarkerTree != null && layerMarkerTree.Nodes.Count > 0) - { - for (int i = 0; i < layerMarkerTree.Nodes[0].Nodes.Count; i++) - { - layerMarkerTree.Nodes[0].Nodes[i].Nodes.Clear(); - } - } - - clearFeatureHighLight();//取消管线高亮 - - GSOLayer layerGround = globeControl1.Globe.Layers.GetLayerByCaption(roadLayerName);//("180fd"); - if (layerGround != null) - { - layerGround.Visible = true; - } - globeControl1.Refresh(); - globeControl2.Refresh(); - ClearRedlineAnalyseResult(); - globeControl1.Globe.Action = EnumAction3D.ActionNull; - } - /// - /// 管线长度全区域统计 - /// - /// - /// - private void buttonItemTJ1_ALL_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, "管线长度统计"); - FrmAllPipelineStatis frm = new FrmAllPipelineStatis(globeControl1, null, new DataGridViewDelegate(InitDataGridViewX1), m_PipelineLayerNames); - frm.Show(this); - - } - /// - /// 管线长度绘制区域统计 - /// - /// - /// - private void buttonItemTJ1_DRAW_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, "管线长度统计"); - - trackflag = "PipelineDistanceStatistics"; - globeControl1.Globe.Action = EnumAction3D.TrackPolygon; - globeControl1.Globe.TrackPolygonTool.TrackMode = EnumTrackMode.SpaceTrack; - } - /// - /// 阀门数量全区域统计 - /// - /// - /// - private void buttonItemTJ2_ALL_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, "阀门数量统计"); - FrmValveStatistics frm = new FrmValveStatistics(globeControl1, null, new DataGridViewDelegate(InitDataGridViewX1)); - frm.Show(this); - - globeControl1.Globe.Action = EnumAction3D.ActionNull; - } - /// - /// 阀门数量绘制区域统计 - /// - /// - /// - private void buttonItemTJ2_DRAW_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, "阀门数量统计"); - - trackflag = "valvequery"; - globeControl1.Globe.Action = EnumAction3D.TrackPolygon; - globeControl1.Globe.TrackPolygonTool.TrackMode = EnumTrackMode.SpaceTrack; - } - /// - /// 井盖数量全区域统计 - /// - /// - /// - private void buttonItemTJ3_ALL_Click(object sender, EventArgs e) - { - FrmAllWorkWellStatis frm = new FrmAllWorkWellStatis(globeControl1, null, new DataGridViewDelegate(InitDataGridViewX1)); - frm.Show(this); - } - /// - /// 井盖数量绘制区域统计 - /// - /// - /// - private void buttonItemTJ3_DRAW_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, "井盖数量统计"); - - trackflag = "workwellquery"; - globeControl1.Globe.Action = EnumAction3D.TrackPolygon; - globeControl1.Globe.TrackPolygonTool.TrackMode = EnumTrackMode.SpaceTrack; - } - /// - /// 管径分段统计全区域统计 - /// - /// - /// - private void buttonItemTJ4_ALL_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, "管径分段统计"); - - Frmpipediameterstatis.ShowForm(globeControl1, m_PipelineLayerNames, 0); - } - /// - /// 管径分段统计绘制区域统计 - /// - /// - /// - private void buttonItemTJ4_DRAW_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, "管径分段统计"); - - trackflag = null; - Frmpipediameterstatis.ShowForm(globeControl1, m_PipelineLayerNames, 1); - } - /// - /// 埋深分段统计全区域统计 - /// - /// - /// - private void buttonItemTJ5_ALL_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, "埋深分段统计"); - FrmpipeDeepstatis.ShowForm(globeControl1, m_PipelineLayerNames, 0); - } - /// - /// 埋深分段统计绘制区域统计 - /// - /// - /// - private void buttonItemTJ5_DRAW_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, "埋深分段统计"); - trackflag = null; - FrmpipeDeepstatis.ShowForm(globeControl1, m_PipelineLayerNames, 1); - } - /// - /// 管径分类统计全区域统计 - /// - /// - /// - private void buttonItemTJ6_ALL_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, "管径分类汇总"); - - FrmpipeDiametergather.ShowForm(globeControl1, m_PipelineLayerNames, 0); - } - /// - /// 管径分类统计绘制区域统计 - /// - /// - /// - private void buttonItemTJ6_DRAW_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, "管径分类汇总"); - - trackflag = null; - FrmpipeDiametergather.ShowForm(globeControl1, m_PipelineLayerNames, 1); - } - /// - /// 材质分类统计全区域统计 - /// - /// - /// - private void buttonItemTJ7_ALL_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, "材质分类汇总"); - - FrmpipeMaterialGather.ShowForm(globeControl1, m_PipelineLayerNames, 0); - } - /// - /// 材质分类统计绘制区域统计 - /// - /// - /// - private void buttonItemTJ7_DRAW_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, "材质分类汇总"); - - trackflag = null; - FrmpipeMaterialGather.ShowForm(globeControl1, m_PipelineLayerNames, 1); - } - /// - /// 附属物分类统计全区域统计 - /// - /// - /// - private void buttonItemTJ8_ALL_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, "附属物分类汇总"); - - FrmAccessoriesgather.ShowForm(globeControl1, instrumenLayerNames, 0); - } - /// - /// 附属物分类统计绘制区域统计 - /// - /// - /// - private void buttonItemTJ8_DRAW_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, "附属物分类汇总"); - - trackflag = null; - FrmAccessoriesgather.ShowForm(globeControl1, instrumenLayerNames, 1); - } /// /// 碰撞分析 /// @@ -7206,7 +5579,6 @@ /// private void buttonItemFX1_1_Click(object sender, EventArgs e) { - //日志记录 LogManager.saveLog(Utility.userName, this.buttonItemFX4_4.Text); this.dataGridViewX4.Size = new System.Drawing.Size(195, 120); @@ -7352,7 +5724,1332 @@ sideBar1.Refresh(); Refresh(); } + /// + /// 碰撞审查 + /// + /// + /// + private void buttonItemSH1_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, this.buttonItemSH1.Text); + this.dataGridViewX4.Size = new System.Drawing.Size(185, 92); + this.dataGridViewX5.Size = new System.Drawing.Size(185, 120); + + layerTemp.RemoveAllFeature(); + clearFeatureHighLight(); + globeControl1.Refresh(); + + sideBar1.Visible = true; + sideBarPanelItem3.Visible = true; + buttonItem1.Checked = true; + controlContainerItem3.Visible = true; + sideBarPanelItem4.Visible = true; + sideBarPanelItem4.Text = "碰撞审查"; + trackflag = "collision"; + controlContainerItem5.Control = panel2; + panel2.Dock = DockStyle.Fill; + panel2.Visible = true; + sideBar1.ExpandedPanel = sideBarPanelItem4; + sideBar1.Refresh(); + + Refresh(); + } + /// + /// 覆土审查 + /// + /// + /// + private void buttonItemSH2_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, this.buttonItemSH2.Text); + + this.dataGridViewX6.Size = new System.Drawing.Size(185, 92); + this.dataGridViewX7.Size = new System.Drawing.Size(185, 120); + + layerTemp.RemoveAllFeature(); + clearFeatureHighLight(); + globeControl1.Refresh(); + sideBar1.Visible = true; + sideBarPanelItem3.Visible = true; + buttonItem1.Checked = true; + controlContainerItem3.Visible = true; + sideBarPanelItem4.Visible = true; + sideBarPanelItem4.Text = "覆土审查"; + trackflag = "ftAnalysis"; + controlContainerItem5.Control = panel4; + panel4.Visible = true; + panel4.Dock = DockStyle.Fill; + sideBar1.ExpandedPanel = sideBarPanelItem4; + sideBar1.Refresh(); + Refresh(); + } + /// + /// 水平净距审查 + /// + /// + /// + private void buttonItemSH3_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, this.buttonItemSH3.Text); + + this.dataGridViewX8.Size = new System.Drawing.Size(190, 92); + this.dataGridViewX9.Size = new System.Drawing.Size(190, 120); + + layerTemp.RemoveAllFeature(); + clearFeatureHighLight(); + globeControl1.Refresh(); + sideBar1.Visible = true; + sideBarPanelItem3.Visible = true; + buttonItem1.Checked = true; + controlContainerItem3.Visible = true; + sideBarPanelItem4.Visible = true; + sideBarPanelItem4.Text = "水平净距审查"; + trackflag = "horizontal"; + controlContainerItem5.Control = panel5; + panel5.Dock = DockStyle.Fill; + panel5.Visible = true; + sideBar1.ExpandedPanel = sideBarPanelItem4; + sideBar1.Refresh(); + Refresh(); + } + /// + /// 垂直净距审查 + /// + /// + /// + private void buttonItemSH4_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, this.buttonItemSH4.Text); + + this.dataGridViewX2.Visible = true; + this.dataGridViewX3.Visible = true; + this.dataGridViewX2.Size = new System.Drawing.Size(185, 92); + this.dataGridViewX3.Size = new System.Drawing.Size(185, 120); + + layerTemp.RemoveAllFeature(); + clearFeatureHighLight(); + + globeControl1.Refresh(); + sideBar1.Visible = true; + sideBarPanelItem3.Visible = true; + buttonItem1.Checked = true; + controlContainerItem3.Visible = true; + sideBarPanelItem4.Visible = true; + sideBarPanelItem4.Text = "垂直净距审查"; + trackflag = "vertical"; + //globeControl1.Globe.Action = EnumAction3D.SelectObject; + panel2.Visible = false; + panel3.Visible = false; + panel5.Visible = false; + panel4.Visible = false; + controlContainerItem5.Control = panel1; + panel1.Dock = DockStyle.Fill; + panel1.Visible = true; + sideBar1.ExpandedPanel = sideBarPanelItem4; + sideBar1.Refresh(); + Refresh(); + } + #endregion + + /// + /// 添加指定路径下的数据 功能 + /// + /// + /// + private object AddLayerData(string strDataPath) + { + object objRes = null; + if (Path.GetExtension(strDataPath).ToLower().Equals(".kml")) + { + GSOLayer layer = globeControl1.Globe.Layers.Add(strDataPath); + objRes = layer; + if (layer != null) + { + 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; + layerManagerNode.Nodes.Insert(0, node); + } + newlayername = layer.Caption; + } + else if (GSOUtility.IsDatasetSupportTerrain(strDataPath)) + { + GSOTerrain terrain = globeControl1.Globe.Terrains.Add(strDataPath); + objRes = terrain; + if (terrain != null) + { + TreeNode node = new TreeNode(); + node.Tag = terrain; + node.Text = terrain.Caption; + node.ImageIndex = 0; + node.SelectedImageIndex = 0; + node.Checked = terrain.Visible; + layerManagerNode.Nodes.Insert(0, node); + } + newlayername = terrain.Caption; + } + else if (Path.GetExtension(strDataPath).ToLower().Equals(".dxf")) + { + GSOLayer layer = globeControl1.Globe.Layers.Add(strDataPath); + objRes = layer; + if (layer != null) + { + GSODataset dataset = layer.Dataset; + CheckDatasetGeoReference(layer.Dataset, strDataPath); + CheckDatasetGeoReference(layer.Dataset, strDataPath); + TreeNode node = new TreeNode(); + node.Tag = layer; + node.Text = layer.Dataset.Caption; + node.ImageIndex = 0; + node.SelectedImageIndex = 0; + node.Checked = layer.Visible; + layerManagerNode.Nodes.Insert(0, node); + } + newlayername = layer.Caption; + } + else + { + GSOLayer layer = globeControl1.Globe.Layers.Add(strDataPath); + + objRes = layer; + if (layer == null) + MessageBox.Show("layer is null"); + + CheckDatasetGeoReference(layer.Dataset, strDataPath); + TreeNode node = new TreeNode(); + node.Tag = layer; + node.Text = layer.Dataset.Caption; + node.ImageIndex = 0; + node.SelectedImageIndex = 0; + node.Checked = layer.Visible; + layerManagerNode.Nodes.Insert(0, node); + + newlayername = layer.Caption; + } + return objRes; + } + /// + /// 连接数据库 菜单事件处理 + /// + /// + /// + private void ConnectDB(object sender, EventArgs e) + { + FrmDatabaseParaSetting frm = new FrmDatabaseParaSetting(globeControl1); + if (frm.ShowDialog() == DialogResult.OK) + { + ds = FrmDatabaseParaSetting.ds; + if (ds != null) + { + ds.IsCloseSaved = false; + } + } + } + /// + /// 根据指定图层创建图层节点并将节点添加到图层管理节点的子节点集合中 + /// + /// + private void addNodeToLayerManagerNode(GSOLayer layer) + { + if (layer != null) + { + 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; + + if (!layerManagerNode.Nodes.Contains(node)) + { + layerManagerNode.Nodes.Insert(0, node); + layerManagerNode.Expand(); + } + } + } + /// + /// 获取指定图层中最后一个feature对象的名称对应的整数 + /// + /// + /// + public int getLabelName(GSOLayer layer) + { + int nid = -1; + if (layer.GetAllFeatures().Length > 0) + { + string id = layer.GetAllFeatures()[layer.GetAllFeatures().Length - 1].Name; + + int.TryParse(id, out nid); + } + else + { + nid = 0; + } + return nid; + } + /// + /// 设置除指定标注图层之外的所有标注图层不可见 + /// + /// + public void setMarkerLayerUnVisible(string layerName) + { + string[] markerStrs = new string[10]; + markerStrs[0] = "标高标注"; + markerStrs[1] = "管径标注"; + markerStrs[2] = "埋深标注"; + markerStrs[3] = "坐标标注"; + markerStrs[4] = "坡度标注"; + markerStrs[5] = "属性标注"; + markerStrs[6] = "自定义标注"; + markerStrs[7] = "距离标注"; + markerStrs[8] = "红线工具"; + markerStrs[9] = "扯旗标注"; + + for (int i = 0; i < markerStrs.Length; i++) + { + GSOLayer markerLayer = globeControl1.Globe.Layers.GetLayerByCaption(markerStrs[i]); + if (markerLayer != null) + { + if (markerStrs[i] != layerName) + { + 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) + { + markerFeature.Visible = false; + } + } + if (layerMarkerTree.Nodes[0].Nodes.Count > i) + { + layerMarkerTree.Nodes[0].Nodes[i].Checked = true; + } + } + } + } + } + /// + /// 判断选中的对象是否为管线 + /// + /// 被选中管线 + /// 返回一根线 + private GSOFeature IsPipeLineOfSelectedObj() + { + GSOFeature resFeature = null; + if (globeControl1.Globe.SelObjectCount < 1) return null; + GSOLayer resLayer = null; + globeControl1.Globe.GetSelectObject(0, out resFeature, out resLayer); + if (resFeature == null) return null; + + GSOGeoPolyline3D line1 = resFeature.Geometry as GSOGeoPolyline3D; + if (line1 == null) return null; + GSOPipeLineStyle3D pipeStyle1 = line1.Style as GSOPipeLineStyle3D; + if (pipeStyle1 == null) return null; + + return resFeature; + } + /// + /// 图层节点树中 节点 右键单击事件处理 + /// + /// + /// + private void layerMarkerTree_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e) + { + if (e.Button == MouseButtons.Right) + { + if (e.Node.Text == "标注管理" || e.Node.Text == "传感器管理") + return; + else if (e.Node.Parent.Text == "标注管理") + { + layerMarkerTree.SelectedNode = e.Node; + contextMenuStrip2.Show(layerMarkerTree, e.X, e.Y); + contextMenuStrip2.Tag = e.Node; + } + else if (e.Node.Parent.Text == "传感器管理") + { + layerSensorTree.SelectedNode = e.Node; + contextMenuStrip2.Show(layerSensorTree, e.X, e.Y); + contextMenuStrip2.Tag = e.Node; + } + else + { + if (e.Node.Tag is GSOFeature) + { + if (e.Node.Parent.Parent.Text == "标注管理") + { + layerMarkerTree.SelectedNode = e.Node; + contextMenuStrip3.Show(layerMarkerTree, e.X, e.Y); + contextMenuStrip3.Tag = e.Node; + } + else if (e.Node.Parent.Parent.Text == "传感器管理") + { + layerSensorTree.SelectedNode = e.Node; + contextMenuStrip3.Show(layerSensorTree, e.X, e.Y); + contextMenuStrip3.Tag = e.Node; + } + } + } + } + } + /// + /// 标注管理、传感器管理 图层目录树的右键菜单中的 刷新列表 菜单 + /// + /// + /// + private void toolStripMenuItem1_Click(object sender, EventArgs e) + { + TreeNode node = contextMenuStrip2.Tag as TreeNode; + TreeNode parentNode = node.Parent; + Int32 nIndex = node.Index; + + if (parentNode.Text == "标注管理" || parentNode.Text == "传感器管理") + { + RefreshTreeNodeLayerFeatureList(node); + } + } + /// + /// 给指定的图层节点添加代表feature对象的子节点 + /// + /// + private void RefreshTreeNodeLayerFeatureList(TreeNode layerTreeNode) + { + layerTreeNode.Nodes.Clear(); + GSOLayer layer = (GSOLayer)layerTreeNode.Tag; + // 只将类型为内存数据集的图层列出,如果是其它类型的数据集可能数据量太大,没发显示在树控件中 + if (layer.Dataset is GSOFeatureDataset) + { + VisitFeature3Ds(layer.GetAllFeatures(), layerTreeNode); + } + } + /// + /// 标注管理、传感器管理 图层目录树的右键菜单中的 移除所有 菜单 + /// + /// + /// + private void toolStripMenuItem2_Click(object sender, EventArgs e) + { + TreeNode node = contextMenuStrip3.Tag as TreeNode; + GSOFeature feature3d = node.Tag as GSOFeature; + if (node == null) + return; + if (feature3d != null) + { + feature3d.Delete(); + globeControl1.Globe.Refresh(); + node.Remove(); + } + } + /// + /// 图层目录树的 节点对应的复选框选中状态改变事件处理 + /// + /// + /// + private void layerMarkerTree_AfterCheck(object sender, TreeViewEventArgs e) + { + if (e.Action != TreeViewAction.Unknown) + { + CheckTreeNode(e.Node, e.Node.Checked); + } + } + /// + /// 改变指定节点对应的复选框的选中状态 + /// + /// + /// + private void CheckTreeNode(TreeNode node, Boolean bChecked) + { + CheckChildTreeNode(node, bChecked); + globeControl1.Globe.Refresh(); + } + /// + /// 改变指定节点的子节点对应的复选框的选中状态 + /// + /// + /// + private void CheckChildTreeNode(TreeNode node, Boolean bChecked) + { + if (node == null) + return; + if (node.Tag != null) + { + if (node.Tag.GetType() == typeof(GSOFeatureFolder) || node.Tag.GetType() == typeof(GSOFeature)) + ((GSOFeature)node.Tag).SetVisibleDirectly(bChecked); + else + { + GSOLayer curLayer = node.Tag as GSOLayer; + GSOTerrain curTerrain = node.Tag as GSOTerrain; + if (curLayer != null) + { + curLayer.Visible = bChecked; + } + else if (curTerrain != null) + { + curTerrain.Visible = bChecked; + } + } + } + // 递归处理子节点 + for (int i = 0; i < node.Nodes.Count; i++) + { + node.Nodes[i].Checked = bChecked; + CheckChildTreeNode(node.Nodes[i], bChecked); + } + } + /// + /// 标注管理、传感器管理 目录树中的feature节点的右键菜单中的 删除 菜单 + /// + /// + /// + private void 删除ToolStripMenuItem1_Click(object sender, EventArgs e) + { + TreeNode node = contextMenuStrip2.Tag as TreeNode; + GSOLayer l = globeControl1.Globe.Layers.GetLayerByCaption(node.Text); + if (l != null) + { + l.RemoveAllFeature(); + node.Nodes.Clear(); + globeControl1.Refresh(); + } + } + //定时检查传感器的状态 + public System.Windows.Forms.Timer timerOfSensor = null; + /// + /// 一键审核---导入数据 + /// + /// + /// + private void buttonItem127_Click_2(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "打开数据"); + + try + { + string dbIp = Utility.sgdbip; + string database = Utility.sgdbname; + string user = Utility.sgdbuser; + string pass = Utility.sgdbpwd; + shds = globeControl1.Globe.DataManager.OpenOracleDataSource(dbIp + "/" + database, "", "", user, pass); + if (shds == null) + { + MessageBox.Show("施工数据库连接失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); + } + FrmPipelineModelDB frm = new FrmPipelineModelDB(globeControl1, shds, true); + if (frm.ShowDialog() == DialogResult.OK) + { + addNodeToLayerManagerNode(frm.rukuLayer); + } + } + catch (Exception ex) + { + LogError.PublishError(ex); + MessageBox.Show("内存过载请清理内存,并重新启动规划分析!", "提示"); + return; + } + } + /// + ///自动导出图片 + /// + /// + /// + private void buttonItem130_Click_1(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "导出审核图"); + + Point pt1 = new Point(Convert.ToInt32(0), Convert.ToInt32(0)); + Point pt2 = new Point(Convert.ToInt32(panelEx5.Width), Convert.ToInt32(panelEx5.Height)); + + 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 = System.IO.Path.GetExtension(dlg.FileName);//扩展名 + switch (extension) + { + case ".jpg": + myImg.Save(dlg.FileName, System.Drawing.Imaging.ImageFormat.Jpeg); + break; + case ".png": + myImg.Save(dlg.FileName, System.Drawing.Imaging.ImageFormat.Png); + break; + case ".bmp": + myImg.Save(dlg.FileName, System.Drawing.Imaging.ImageFormat.Bmp); + break; + case ".gif": + myImg.Save(dlg.FileName, System.Drawing.Imaging.ImageFormat.Gif); + break; + default: + break; + } + } + } + /// + /// 一键审核功能 + /// + /// + /// + private void buttonItem128_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, this.buttonItem128.Text); + frmSh = new FrmYJSHTC(globeControl1, globeControl2, layerTree); + + if (frmSh.ShowDialog() == DialogResult.OK) + { + frmWait = new FrmWait("一键审核……"); + frmWait.Location = new Point(this.Width - frmWait.Width - 10, this.Height - frmWait.Height - 50); + frmWait.Owner = this; + frmWait.Show(); + Thread thread = new Thread(new ThreadStart(doWork)); + thread.IsBackground = true; + thread.Start(); + } + } + void doWork() + { + FrmShResult frmShResult = null; + + double dVerticalJingJuBiaoZhun = 1, dHorizontalJingJuBiaoZhun = 1; + if (frmSh.rukuLayer != null) + { + #region + this.Invoke((EventHandler) delegate + { + try + { + List managerLayerList = new List(); + for (int i = 0; i < layerManagerNode.Nodes.Count; i++) + { + managerLayerList.Add(layerManagerNode.Nodes[i].Text); + } + if (!managerLayerList.Contains(frmSh.rukuLayer.Caption)) + { + TreeNode node = new TreeNode(); + node.Tag = frmSh.rukuLayer; + node.Text = frmSh.rukuLayer.Dataset.Caption; + node.ImageIndex = 0; + node.SelectedImageIndex = 0; + node.Checked = frmSh.rukuLayer.Visible; + layerManagerNode.Nodes.Insert(0, node); + layerManagerNode.Expand(); + } + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "提示"); + } + }); + #endregion + + shlayername = frmSh.rukuLayer.Name; + globeControl1.Refresh(); + } + + if (frmShResult != null && !frmShResult.IsDisposed) + { + try + { + clearFeatureHighLight(); + ClearRedlineAnalyseResult(); + frmShResult.Close(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message); + } + } + + frmShResult = new FrmShResult(dVerticalJingJuBiaoZhun, dHorizontalJingJuBiaoZhun, shlayername, globeControl1, + m_PipelineLayerNames); + + if (boolfrmShResult == true) return; + + frmShResult.Location = new Point(this.Width - frmShResult.Width - 10, this.Height - frmShResult.Height - 50); + frmShResult.Owner = this; + //一键审核实际计算步骤 + frmShResult.analysis(); + + //MainFrm窗体显示控制,回到一键审核Tab + this.Invoke((EventHandler) delegate + { + frmShResult.Show(); + frmWait.Close(); + //将tab页恢复到一键审核 + ribbonTabItem11.Checked = true; + try + { + globeControl1.Globe.Action = EnumAction3D.ActionNull; + splitContainer1.Panel2Collapsed = true; + + panelOfTable.Visible = false; + legendSC.Visible = false; + legendSG.Visible = false; + + GSOLayer redLayer = globeControl1.Globe.Layers.GetLayerByCaption("红线"); + if (redLayer != null) + { + redLayer.Visible = false; + } + } + catch (Exception ex) + { + MessageBox.Show("系统运行错误:" + ex.ToString(), "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + + }); + + boolfrmShResult = true; + } + /// + /// 清除渲染结果 + /// + public void ClearRedlineAnalyseResult() + { + for (int i = 0; i < globeControl1.Globe.Layers.Count; i++) + { + GSOLayer layer = globeControl1.Globe.Layers[i]; + if (layer.Caption == "tempLgdData") + { + layer.RemoveAllFeature(); + } + } + + layerTemp.RemoveAllFeature(); + globeControl1.Refresh(); + } + /// + /// 已审核的图层 + /// + /// + /// + private void buttonItem132_Click_1(object sender, EventArgs e) + { + //保存日志 + LogManager.saveLog(Utility.userName, this.buttonItem132.Text); + + if (shds == null) + { + //没连的话,直接连接审核库; //审核库配置读配置文件 + string dbIp = Utility.sgdbip; + string database = Utility.sgdbname; + string user = Utility.sgdbuser; + string pass = Utility.sgdbpwd; + + shds = globeControl1.Globe.DataManager.OpenOracleDataSource(dbIp + "/" + database, "", "", user, pass); + if (shds == null) + { + MessageBox.Show("数据库连接失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); + } + } + FrmShLayers frm = new FrmShLayers(globeControl1, shds); + frm.Show(); + + } + /// + /// 审核入库 + /// + /// + /// + private void buttonItem133_Click_1(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "审核入库"); + FrmShRK frmShrk = new FrmShRK(globeControl1); + frmShrk.Show(); + } + /// + /// 模拟设计修改 + /// + /// + /// + private void buttonItem134_Click_1(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "模拟设计修改"); + + frmModify = new FrmMnModify(globeControl1, shlayername, shresultLists); + + if (boolfrmModify == false) + { + frmModify.Owner = this; + frmModify.Location = new Point(this.Width - frmModify.Width - 10, this.Height - frmModify.Height - 50); + frmModify.Show(); + boolfrmModify = true; + } + } + /// + /// 一键审核中调节透明度 + /// + /// + /// + private void sliderItem1_ValueChanged(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, this.sliderItem1.Text); + + globeControl1.Globe.GroundOpaque = 100 - sliderItem1.Value; + GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(roadLayerName); //("180fd"); + + if (layer != null) + layer.Opaque = 100 - sliderItem1.Value; + optiValue = sliderItem1.Value; + } + /// + /// 红线审核中的透明度分析 + /// + /// + /// + private void sliderItem3_ValueChanged(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, this.sliderItem3.Text); + + globeControl1.Globe.GroundOpaque = 100 - sliderItem3.Value; + GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(roadLayerName); //("180fd"); + if (layer != null) + layer.Opaque = 100 - sliderItem3.Value; + optiValue = sliderItem3.Value; + } + #region yanxiaowei + //初始化DataGridViewX1控件 + public delegate void DataGridViewDelegate(DataTable dt, string strLable, string strLayer, bool initDataGrid); + /// + /// 代理函数,操作DatgridViewX1 + /// + /// + /// + public void InitDataGridViewX1(DataTable dt, string strLable, string strLayer, bool initDataGrid) + { + if (initDataGrid == true) + { + dataGridViewX1.DataSource = dt; + panelOfTable.Visible = true; + toolStripNumbers.Text = strLable; + dataGridViewX1.Tag = strLayer; + } + else + { + dataGridViewX1.DataSource = null; + dataGridViewX1.Refresh(); + panelOfTable.Visible = false; + toolStripNumbers.Text = ""; + dataGridViewX1.Tag = ""; + globeControl1.Globe.MemoryLayer.RemoveAllFeature(); //清除双击产生的标注 + } + } + FrmAnalysisGuiHuaResult from; + /// + /// 主窗体下方属性表格 双击定位 功能 + /// + /// + /// + 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 if (dataGridViewX1.Columns.Contains("标识器编号")) + { + featureName = dataGridViewX1.Rows[hittestinfo.RowIndex].Cells["标识器编号"].Value.ToString(); + } + featureName = featureName.Trim(); + + GSOLayer layer = null; + layer = globeControl1.Globe.Layers.GetLayerByCaption(dataGridViewX1.Tag.ToString()); + + if (layer == null) return; + + GSOFeatures features = layer.GetFeatureByName(featureName, false); + if (features.Length == 0) return; + GSOFeature rowFeature = features[0]; + + ClassSearchAnalysis.AddMakerToLineFeature(globeControl1, rowFeature); + + } + } + } + else + { + if (e.Button == MouseButtons.Left) + { + if (from != null && !from.IsDisposed) + { + try + { + from.Close(); + } + catch (Exception ex) + { + LogError.PublishError(ex); + } + } + try + { + DataGridView.HitTestInfo hittestinfo = dataGridViewX1.HitTest(e.X, e.Y); + if (hittestinfo.RowIndex >= 0) + { + string layer = dataGridViewX1.Rows[hittestinfo.RowIndex].Cells["管线类型"].Value.ToString(); + string hxName = dataGridViewX1.Rows[hittestinfo.RowIndex].Cells["红线编号"].Value.ToString(); + FrmAnalysisGuiHuaResult frm = new FrmAnalysisGuiHuaResult(globeControl1, lineStruct, featsList, + panelOfTable, dataGridViewX1, layer, hxName); + frm.Location = new Point(this.Width - frm.Width - 10, this.Height - frm.Height - 20); + frm.Show(this); + + from = frm; + } + } + catch (Exception ex) + { + LogError.PublishError(ex); + } + } + } + } + /// + /// 空间查询 + /// + /// + /// + private void buttonItemSearch1_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, this.buttonItemSearch1.Text); + + trackflag = "PipelineSpatialQuery"; + globeControl1.Globe.Action = EnumAction3D.TrackPolygon; + globeControl1.Globe.TrackPolygonTool.TrackMode = EnumTrackMode.SpaceTrack; + } + /// + /// 关键字查询 + /// + /// + /// + private void buttonItemSearch9_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, this.buttonItemSearch9.Text); + + FrmKeywordQuery.ShowForm(globeControl1, m_PipelineLayerNames, new DataGridViewDelegate(InitDataGridViewX1)); + } + /// + /// 编号查询 + /// + /// + /// + private void buttonItemSearch2_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, this.buttonItemSearch2.Text); + + FrmCodingQuery.ShowForm(globeControl1, m_PipelineLayerNames, new DataGridViewDelegate(InitDataGridViewX1)); + } + /// + /// 坐标查询 + /// + /// + /// + private void buttonItemSearch3_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, this.buttonItemSearch3.Text); + + FrmSetLatLonPos.ShowForm(globeControl1); + } + /// + /// 附属物查询 + /// + /// + /// + private void buttonItemSearch10_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, this.buttonItemSearch10.Text); + + FrmFittingQuery.ShowForm(globeControl1, instrumenLayerNames, new DataGridViewDelegate(InitDataGridViewX1)); + } + /// + /// 管径查询 + /// + /// + /// + private void buttonItemSearch4_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, this.buttonItemSearch4.Text); + + FrmDiameterQuery.ShowForm(globeControl1, m_PipelineLayerNames, new DataGridViewDelegate(InitDataGridViewX1)); + } + /// + /// 材质查询 + /// + /// + /// + private void buttonItemSearch5_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, this.buttonItemSearch5.Text); + + FrmMaterialSel.ShowForm(globeControl1, m_PipelineLayerNames, new DataGridViewDelegate(InitDataGridViewX1)); + } + /// + /// 基本查询 + /// + /// + /// + private void buttonItemSearch6_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, this.buttonItemSearch6.Text); + + FrmBasicQuery.ShowForm(globeControl1, new DataGridViewDelegate(InitDataGridViewX1)); + } + /// + /// 复合查询 + /// + /// + /// + private void buttonItemSearch7_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, this.buttonItemSearch7.Text); + + FrmQuerySQL.ShowForm(globeControl1, new DataGridViewDelegate(InitDataGridViewX1)); + } + /// + /// 关联查询 + /// + /// + /// + private void buttonItemSearch8_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, this.buttonItemSearch8.Text); + + if (globeControl1.Globe.SelObjectCount != 1) + { + MessageBox.Show("请选中一个对象!", "提示"); + return; + } + double valueAllowance = 1.0; + + for (int j = 0; j < globeControl1.Globe.SelObjectCount; j++) + { + GSOFeature feature = null; + GSOLayer layer = null; + globeControl1.Globe.GetSelectObject(j, out feature, out layer); + + if (feature == null && feature.Geometry == null || (feature.Geometry.Type == EnumGeometryType.GeoPolygon3D + || feature.Geometry.Type == EnumGeometryType.GeoWater)) + return; + else + { + ClassSearchAnalysis.ResultRelationAnalysis(globeControl1, feature, valueLayerNames, workwellLayerNames, + instrumenLayerNames, pipefittingLayerNames, m_PipelineLayerNames, valueAllowance); + } + } + } + #endregion + /// + /// 清除分析(完善) + /// + /// + /// + private void buttonItemClear_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, this.buttonItemClear.Text); + + globeControl1.Globe.ClearMeasure(); + layerTemp.RemoveAllFeature(); + layerTemp2.RemoveAllFeature(); + buttonItemLS5.Checked = false; + + dataGridViewX1.DataSource = null; + panelOfTable.Visible = false; + + globeControl1.Globe.MemoryLayer.RemoveAllFeature(); + globeControl1.Globe.ClearAnalysis(); + + + // 清除净距分析结果 + buttonX2_Click(null, null); + buttonX8_Click(null, null); + buttonX15_Click(null, null); + buttonX16_Click(null, null); + buttonClearAnalysisResult_Click(null, null); + + NetworkAnalysisTool.ClearAllTopAnalysis(this.globeControl1); + // ClearConnexityAnalysis();//清除连通性分析 + // 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); + } + } + + GSOFeatures feats = globeControl1.Globe.MemoryLayer.GetFeatureByName("粒子要素", true); + if (feats.Length > 0) + globeControl1.Globe.MemoryLayer.RemoveFeatureByID(feats[0].ID); + + globeControl1.Globe.UnderGroundFloor.Visible = false;//隐藏地下网格线 + + // ClearUpDownTraceAnalysis(); //清除上下游分析 + globeControl1.Globe.RemoveAllPits();//清除所有坑 + + string[] markerStrs = new string[9]; + markerStrs[0] = "标高标注"; + markerStrs[1] = "管径标注"; + markerStrs[2] = "埋深标注"; + markerStrs[3] = "坐标标注"; + markerStrs[4] = "坡度标注"; + markerStrs[5] = "属性标注"; + markerStrs[6] = "自定义标注"; + markerStrs[7] = "距离标注"; + markerStrs[8] = "扯旗标注"; + for (int i = 0; i < markerStrs.Length; i++) + { + GSOLayer markerLayer = globeControl1.Globe.Layers.GetLayerByCaption(markerStrs[i]); + markerLayer.RemoveAllFeature(); + } + if (layerMarkerTree != null && layerMarkerTree.Nodes.Count > 0) + { + for (int i = 0; i < layerMarkerTree.Nodes[0].Nodes.Count; i++) + { + layerMarkerTree.Nodes[0].Nodes[i].Nodes.Clear(); + } + } + + clearFeatureHighLight();//取消管线高亮 + + GSOLayer layerGround = globeControl1.Globe.Layers.GetLayerByCaption(roadLayerName);//("180fd"); + if (layerGround != null) + { + layerGround.Visible = true; + } + globeControl1.Refresh(); + globeControl2.Refresh(); + ClearRedlineAnalyseResult(); + globeControl1.Globe.Action = EnumAction3D.ActionNull; + } + /// + /// 管线长度全区域统计 + /// + /// + /// + private void buttonItemTJ1_ALL_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "管线长度统计"); + FrmAllPipelineStatis frm = new FrmAllPipelineStatis(globeControl1, null, new DataGridViewDelegate(InitDataGridViewX1), m_PipelineLayerNames); + frm.Show(this); + } + /// + /// 管线长度绘制区域统计 + /// + /// + /// + private void buttonItemTJ1_DRAW_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "管线长度统计"); + + trackflag = "PipelineDistanceStatistics"; + globeControl1.Globe.Action = EnumAction3D.TrackPolygon; + globeControl1.Globe.TrackPolygonTool.TrackMode = EnumTrackMode.SpaceTrack; + } + /// + /// 阀门数量全区域统计 + /// + /// + /// + private void buttonItemTJ2_ALL_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "阀门数量统计"); + FrmValveStatistics frm = new FrmValveStatistics(globeControl1, null, new DataGridViewDelegate(InitDataGridViewX1)); + frm.Show(this); + + globeControl1.Globe.Action = EnumAction3D.ActionNull; + } + /// + /// 阀门数量绘制区域统计 + /// + /// + /// + private void buttonItemTJ2_DRAW_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "阀门数量统计"); + + trackflag = "valvequery"; + globeControl1.Globe.Action = EnumAction3D.TrackPolygon; + globeControl1.Globe.TrackPolygonTool.TrackMode = EnumTrackMode.SpaceTrack; + } + /// + /// 井盖数量全区域统计 + /// + /// + /// + private void buttonItemTJ3_ALL_Click(object sender, EventArgs e) + { + FrmAllWorkWellStatis frm = new FrmAllWorkWellStatis(globeControl1, null, new DataGridViewDelegate(InitDataGridViewX1)); + frm.Show(this); + } + /// + /// 井盖数量绘制区域统计 + /// + /// + /// + private void buttonItemTJ3_DRAW_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "井盖数量统计"); + + trackflag = "workwellquery"; + globeControl1.Globe.Action = EnumAction3D.TrackPolygon; + globeControl1.Globe.TrackPolygonTool.TrackMode = EnumTrackMode.SpaceTrack; + } + /// + /// 管径分段统计全区域统计 + /// + /// + /// + private void buttonItemTJ4_ALL_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "管径分段统计"); + + Frmpipediameterstatis.ShowForm(globeControl1, m_PipelineLayerNames, 0); + } + /// + /// 管径分段统计绘制区域统计 + /// + /// + /// + private void buttonItemTJ4_DRAW_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "管径分段统计"); + + trackflag = null; + Frmpipediameterstatis.ShowForm(globeControl1, m_PipelineLayerNames, 1); + } + /// + /// 埋深分段统计全区域统计 + /// + /// + /// + private void buttonItemTJ5_ALL_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "埋深分段统计"); + FrmpipeDeepstatis.ShowForm(globeControl1, m_PipelineLayerNames, 0); + } + /// + /// 埋深分段统计绘制区域统计 + /// + /// + /// + private void buttonItemTJ5_DRAW_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "埋深分段统计"); + trackflag = null; + FrmpipeDeepstatis.ShowForm(globeControl1, m_PipelineLayerNames, 1); + } + /// + /// 管径分类统计全区域统计 + /// + /// + /// + private void buttonItemTJ6_ALL_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "管径分类汇总"); + + FrmpipeDiametergather.ShowForm(globeControl1, m_PipelineLayerNames, 0); + } + /// + /// 管径分类统计绘制区域统计 + /// + /// + /// + private void buttonItemTJ6_DRAW_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "管径分类汇总"); + + trackflag = null; + FrmpipeDiametergather.ShowForm(globeControl1, m_PipelineLayerNames, 1); + } + /// + /// 材质分类统计全区域统计 + /// + /// + /// + private void buttonItemTJ7_ALL_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "材质分类汇总"); + + FrmpipeMaterialGather.ShowForm(globeControl1, m_PipelineLayerNames, 0); + } + /// + /// 材质分类统计绘制区域统计 + /// + /// + /// + private void buttonItemTJ7_DRAW_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "材质分类汇总"); + + trackflag = null; + FrmpipeMaterialGather.ShowForm(globeControl1, m_PipelineLayerNames, 1); + } + /// + /// 附属物分类统计全区域统计 + /// + /// + /// + private void buttonItemTJ8_ALL_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "附属物分类汇总"); + + FrmAccessoriesgather.ShowForm(globeControl1, instrumenLayerNames, 0); + } + /// + /// 附属物分类统计绘制区域统计 + /// + /// + /// + private void buttonItemTJ8_DRAW_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "附属物分类汇总"); + + trackflag = null; + FrmAccessoriesgather.ShowForm(globeControl1, instrumenLayerNames, 1); + } #region Predaotr,断面分析 /// /// 横断面分析 @@ -7365,7 +7062,6 @@ globeControl1.Globe.TrackPolylineTool.VerticalLineVisible = true; globeControl1.Globe.TrackPolylineTool.TrackMode = EnumTrackMode.SpaceTrack; trackPolylineEndMode = EnumTrackPolylineEndMode.HDM_Analysis; - } /// /// 纵断面分析 @@ -7409,7 +7105,6 @@ globeControl1.Globe.TrackPolylineTool.VerticalLineVisible = true; globeControl1.Globe.TrackPolylineTool.TrackMode = EnumTrackMode.SpaceTrack; trackPolylineEndMode = EnumTrackPolylineEndMode.DLDM_Analysis; - } /// /// 基线剖面分析 @@ -7422,9 +7117,7 @@ globeControl1.Globe.TrackPolylineTool.VerticalLineVisible = true; globeControl1.Globe.TrackPolylineTool.TrackMode = EnumTrackMode.SpaceTrack; trackPolylineEndMode = EnumTrackPolylineEndMode.JXPM_Analysis; - } - #endregion /// /// 创建拓扑 @@ -7462,7 +7155,6 @@ LogManager.saveLog(Utility.userName, this.buttonItemFX3_3.Text); NetworkTraceUpDown(false); } - /// /// 上下游追踪 功能 /// @@ -7480,7 +7172,6 @@ NetworkAnalysisTool.TraceUpDownAnalysis(bTraceUp, selLineFeature, selLayer); } - /// /// 流向分析 /// @@ -7533,7 +7224,6 @@ MessageBox.Show("未找到关闭阀门"); } } - /// /// 连通分析 /// @@ -7580,9 +7270,7 @@ NetworkAnalysisTool.ExplodeAnalysis(this.globeControl1, selLineFeature, selLayer); this.buttonItemFX3_5_Click(sender, e); //关阀分析: - } - #endregion /// /// 多边形开挖 @@ -7591,7 +7279,6 @@ /// private void buttonItemFX4_1_Click(object sender, EventArgs e) { - //日志记录 LogManager.saveLog(Utility.userName, this.buttonItemFX4_1.Text); trackflag = "pit"; @@ -7605,7 +7292,6 @@ /// private void buttonItemFX4_2_Click(object sender, EventArgs e) { - //日志记录 LogManager.saveLog(Utility.userName, this.buttonItemFX4_2.Text); trackflag = "digFillAnalysis"; @@ -7620,7 +7306,6 @@ /// private void buttonItemFX4_3_Click(object sender, EventArgs e) { - //日志记录 LogManager.saveLog(Utility.userName, this.buttonItemFX4_3.Text); if (!buttonItemFX4_3.Checked) @@ -7653,12 +7338,13 @@ /// private void buttonItemFX4_4_Click(object sender, EventArgs e) { - //日志记录 LogManager.saveLog(Utility.userName, this.buttonItemFX4_4.Text); globeControl1.Globe.Action = EnumAction3D.DrawPolyline; GSOLayer tunnel = globeControl1.Globe.Layers.GetLayerByCaption("隧道"); - if (tunnel != null) + if (tunnel == null) + MessageBox.Show("场景中未加载隧道图层!", "提示"); + else { globeControl1.Globe.DestLayerFeatureAdd = tunnel; tunnel.Editable = true; @@ -7666,10 +7352,6 @@ m_AddPipeLine = false; m_isDrawCitySevenLine = false; } - else - { - MessageBox.Show("场景中未加载隧道图层!", "提示"); - } } /// /// 隐藏隧道 @@ -7678,7 +7360,6 @@ /// private void buttonItemFX4_5_Click(object sender, EventArgs e) { - //日志记录 LogManager.saveLog(Utility.userName, this.buttonItemFX4_5.Text); GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption("隧道"); @@ -7694,7 +7375,6 @@ /// private void buttonItemFX4_6_Click(object sender, EventArgs e) { - //日志记录 LogManager.saveLog(Utility.userName, this.buttonItemFX4_6.Text); if (globeControl1.Globe.SelObjectCount > 0) @@ -7736,16 +7416,7 @@ //日志记录 LogManager.saveLog(Utility.userName, this.buttonItemFX5_1.Text); - if (globeControl1.Globe.Action != EnumAction3D.VisibilityAnalysis) - { - //btnSpaceVisibilityAnalysis.Checked = true; - globeControl1.Globe.Action = EnumAction3D.VisibilityAnalysis; - } - else - { - globeControl1.Globe.Action = EnumAction3D.ActionNull; - // SetButtonChecked(); - } + globeControl1.Globe.Action = globeControl1.Globe.Action != EnumAction3D.VisibilityAnalysis ? EnumAction3D.VisibilityAnalysis : EnumAction3D.ActionNull; } /// /// 可视域分析 @@ -7754,7 +7425,6 @@ /// private void buttonItemFX5_2_Click(object sender, EventArgs e) { - //日志记录 LogManager.saveLog(Utility.userName, this.buttonItemFX5_2.Text); globeControl1.Globe.Action = EnumAction3D.ViewshedAnalysis; @@ -7766,7 +7436,6 @@ /// private void buttonItemFX5_3_Click(object sender, EventArgs e) { - //日志记录 LogManager.saveLog(Utility.userName, this.buttonItemFX5_3.Text); globeControl1.Globe.Action = EnumAction3D.ViewEnvelopeAnalysis; @@ -7778,7 +7447,6 @@ /// private void buttonItemFX6_1_Click(object sender, EventArgs e) { - //日志记录 LogManager.saveLog(Utility.userName, this.buttonItemFX6_1.Text); GSOFeature feat = globeControl1.Globe.SelectedObject; @@ -7813,7 +7481,6 @@ /// private void buttonItemFX6_2_Click(object sender, EventArgs e) { - //日志记录 LogManager.saveLog(Utility.userName, this.buttonItemFX6_2.Text); globeControl1.Globe.Action = EnumAction3D.ActionNull; @@ -7827,7 +7494,6 @@ /// private void buttonItemFX6_3_Click(object sender, EventArgs e) { - //日志记录 LogManager.saveLog(Utility.userName, this.buttonItemFX6_3.Text); globeControl1.Globe.Action = EnumAction3D.TrackPolygon; @@ -7901,10 +7567,8 @@ globeControl1.Globe.Action = EnumAction3D.ActionNull; buttonItemLS5.Checked = !buttonItemLS5.Checked; - if (buttonItemLS5.Checked) - { - globeControl1.Globe.Action = EnumAction3D.SelectObject; - } + if (!buttonItemLS5.Checked) return; + globeControl1.Globe.Action = EnumAction3D.SelectObject; } /// /// 水平面积 @@ -8197,7 +7861,6 @@ LogManager.saveLog(Utility.userName, this.buttonItemFXGJ1.Text); FrmSetFlytoPos.ShowForm(globeControl1); - } /// /// 自定义飞行 @@ -8262,7 +7925,6 @@ globeControl1.Globe.FlyAroundEye(720, EnumFlyRepeatValueType.Degrees); globeControl1.Globe.CurFlyID = 2; } - /// /// 权限管理 /// @@ -8343,21 +8005,6 @@ appUSERRESET.ShowDialog(); } /// - /// 统计数据 - /// - /// - /// - private void buttonItemZTT1_Click(object sender, EventArgs e) - { - ////日志记录 - //LogManager.saveLog(Utility.userName, this.buttonItemZTT1.Text); - - //PATM patm = new PATM(); - //patm.operation = "Statistic"; - //patm.Text = "统计专题图管理"; - //patm.ShowDialog(); - } - /// /// 热点功能统计 /// /// @@ -8460,137 +8107,6 @@ FrmLayerControl frm = new FrmLayerControl(layerTree, globeControl1, globeControl2); frm.Show(this); } - - /// - /// 碰撞审查 - /// - /// - /// - private void buttonItemSH1_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, this.buttonItemSH1.Text); - - this.dataGridViewX4.Size = new System.Drawing.Size(185, 92); - this.dataGridViewX5.Size = new System.Drawing.Size(185, 120); - - layerTemp.RemoveAllFeature(); - clearFeatureHighLight(); - globeControl1.Refresh(); - - sideBar1.Visible = true; - sideBarPanelItem3.Visible = true; - buttonItem1.Checked = true; - controlContainerItem3.Visible = true; - sideBarPanelItem4.Visible = true; - sideBarPanelItem4.Text = "碰撞审查"; - trackflag = "collision"; - controlContainerItem5.Control = panel2; - panel2.Dock = DockStyle.Fill; - panel2.Visible = true; - sideBar1.ExpandedPanel = sideBarPanelItem4; - sideBar1.Refresh(); - - Refresh(); - } - /// - /// 覆土审查 - /// - /// - /// - private void buttonItemSH2_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, this.buttonItemSH2.Text); - - this.dataGridViewX6.Size = new System.Drawing.Size(185, 92); - this.dataGridViewX7.Size = new System.Drawing.Size(185, 120); - - layerTemp.RemoveAllFeature(); - clearFeatureHighLight(); - globeControl1.Refresh(); - sideBar1.Visible = true; - sideBarPanelItem3.Visible = true; - buttonItem1.Checked = true; - controlContainerItem3.Visible = true; - sideBarPanelItem4.Visible = true; - sideBarPanelItem4.Text = "覆土审查"; - trackflag = "ftAnalysis"; - controlContainerItem5.Control = panel4; - panel4.Visible = true; - panel4.Dock = DockStyle.Fill; - sideBar1.ExpandedPanel = sideBarPanelItem4; - sideBar1.Refresh(); - Refresh(); - } - /// - /// 水平净距审查 - /// - /// - /// - private void buttonItemSH3_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, this.buttonItemSH3.Text); - - this.dataGridViewX8.Size = new System.Drawing.Size(190, 92); - this.dataGridViewX9.Size = new System.Drawing.Size(190, 120); - - layerTemp.RemoveAllFeature(); - clearFeatureHighLight(); - globeControl1.Refresh(); - sideBar1.Visible = true; - sideBarPanelItem3.Visible = true; - buttonItem1.Checked = true; - controlContainerItem3.Visible = true; - sideBarPanelItem4.Visible = true; - sideBarPanelItem4.Text = "水平净距审查"; - trackflag = "horizontal"; - controlContainerItem5.Control = panel5; - panel5.Dock = DockStyle.Fill; - panel5.Visible = true; - sideBar1.ExpandedPanel = sideBarPanelItem4; - sideBar1.Refresh(); - Refresh(); - } - /// - /// 垂直净距审查 - /// - /// - /// - private void buttonItemSH4_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, this.buttonItemSH4.Text); - - this.dataGridViewX2.Visible = true; - this.dataGridViewX3.Visible = true; - this.dataGridViewX2.Size = new System.Drawing.Size(185, 92); - this.dataGridViewX3.Size = new System.Drawing.Size(185, 120); - - layerTemp.RemoveAllFeature(); - clearFeatureHighLight(); - - globeControl1.Refresh(); - sideBar1.Visible = true; - sideBarPanelItem3.Visible = true; - buttonItem1.Checked = true; - controlContainerItem3.Visible = true; - sideBarPanelItem4.Visible = true; - sideBarPanelItem4.Text = "垂直净距审查"; - trackflag = "vertical"; - //globeControl1.Globe.Action = EnumAction3D.SelectObject; - panel2.Visible = false; - panel3.Visible = false; - panel5.Visible = false; - panel4.Visible = false; - controlContainerItem5.Control = panel1; - panel1.Dock = DockStyle.Fill; - panel1.Visible = true; - sideBar1.ExpandedPanel = sideBarPanelItem4; - sideBar1.Refresh(); - Refresh(); - } /// /// 综合规划区域审查 /// @@ -8666,9 +8182,7 @@ } if (ds == null) return; - Cyberpipe.Forms.FrmPipelineModelDB frm = new Cyberpipe.Forms.FrmPipelineModelDB(globeControl1, ds); - - //frm.Show(); + FrmPipelineModelDB frm = new FrmPipelineModelDB(globeControl1, ds, false); if (frm.ShowDialog() == DialogResult.OK) { @@ -8700,7 +8214,6 @@ addNodeToLayerManagerNode(frm.rukuLayer); } } - /// /// 坐标转换 /// @@ -8711,7 +8224,7 @@ //保存日志 LogManager.saveLog(Utility.userName, this.buttonItemSJGL5.Text); - Cyberpipe.Forms.FrmProject frm = new Cyberpipe.Forms.FrmProject(); + FrmProject frm = new FrmProject(); frm.ShowDialog(); } /// @@ -8738,7 +8251,6 @@ LogManager.saveLog(Utility.userName, this.buttonItemSJGL6_2.Text); FrmMetadataStat frmmds = new FrmMetadataStat(); - //frmmds.Show(); frmmds.ShowDialog(); } /// @@ -8814,12 +8326,11 @@ if (frm.ShowDialog() == DialogResult.OK) { GSOLayer featureAddLayer = TreeNodeFeatureLayer(); - if (featureAddLayer == null) + if (featureAddLayer != null) { - return; + FrmAddInstrument dlg = new FrmAddInstrument(globeControl1, featureAddLayer); + dlg.Show(this); } - FrmAddInstrument dlg = new FrmAddInstrument(globeControl1, featureAddLayer); - dlg.Show(this); } } /// @@ -8836,16 +8347,15 @@ if (frm.ShowDialog() == DialogResult.OK) { GSOLayer featureAddLayer = TreeNodeFeatureLayer(); - if (featureAddLayer == null) + if (featureAddLayer != null) { - return; + FrmAddPipeFitting dlg = new FrmAddPipeFitting(globeControl1, featureAddLayer); + dlg.Show(this); } - FrmAddPipeFitting dlg = new FrmAddPipeFitting(globeControl1, featureAddLayer); - dlg.Show(this); } } /// - /// 绘制城市七线 + /// 绘制城市七线(完善) /// /// /// @@ -9082,15 +8592,6 @@ List listVectorNames = new List(); for (int i = 0; i < 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] == "供电") - { - continue; - } - * */ if (listVectorNames.Contains(m_PipelineLayerNames[i]) == false) { listVectorNames.Add(m_PipelineLayerNames[i]); @@ -9142,15 +8643,11 @@ GSOFeature f = null; GSOLayer layer = null; globeControl1.Globe.GetSelectObject(i, out f, out layer); - if (f != null) - { - f.Delete(); - if (layer != null) - { - globeControl1.Globe.AddToEditHistroy(layer, f, EnumEditType.Delete); - } - globeControl1.Refresh(); - } + if (f == null) continue; + f.Delete(); + if (layer != null) + globeControl1.Globe.AddToEditHistroy(layer, f, EnumEditType.Delete); + globeControl1.Refresh(); } MessageBox.Show("删除成功!", "提示"); } @@ -9190,10 +8687,8 @@ for (int i = 0; i < m_PipelineLayerNames.Count; i++) { layer = globeControl1.Globe.Layers.GetLayerByCaption(m_PipelineLayerNames[i]); - if (layer != null) - { - listPipelineLayers.Add(layer); - } + if (layer == null) continue; + listPipelineLayers.Add(layer); } //yanxiaowei 重构 GSOFeatures selectFeatures = new GSOFeatures(); @@ -9208,15 +8703,15 @@ ClassGSOTool.CalculateRedLineResult(out table, redSH, selectFeatures, globeControl1, listPipelineLayers, out lineStruct, out featsList); - if (table.Rows.Count != 0) - AddDatagridView(table); - else + if (table.Rows.Count == 0) { MessageBox.Show("没有侵入地块红线的管线数据!", "提示"); dataGridViewX1.DataSource = null; panelOfTable.Visible = false; return; } + else + AddDatagridView(table); } private void AddDatagridView(DataTable table) @@ -9234,23 +8729,25 @@ /// private void toolStripDropDownButton3_Click(object sender, EventArgs e) { - if (dataGridViewX1.Rows.Count == 0) + if (dataGridViewX1.Rows.Count != 0) + { + string strSaveFile = string.Empty; + SaveFileDialog savefiledialog = new SaveFileDialog(); + savefiledialog.Filter = "Excel文件|*.xls,*.xlsx"; + savefiledialog.AddExtension = true; + savefiledialog.FileName = "红线审核"; + if (savefiledialog.ShowDialog() == DialogResult.OK) + strSaveFile = savefiledialog.FileName; + else return; + + ExpEXCEL.ExpToExcel(dataGridViewX1, strSaveFile, "红线审核", lineStruct, featsList); + MessageBox.Show("导出成功!"); + } + else { MessageBox.Show("表格内容为空!", "提示"); return; } - - string strSaveFile = string.Empty; - SaveFileDialog savefiledialog = new SaveFileDialog(); - savefiledialog.Filter = "Excel文件|*.xls,*.xlsx"; - savefiledialog.AddExtension = true; - savefiledialog.FileName = "红线审核"; - if (savefiledialog.ShowDialog() == DialogResult.OK) - strSaveFile = savefiledialog.FileName; - else return; - - ExpEXCEL.ExpToExcel(dataGridViewX1, strSaveFile, "红线审核", lineStruct, featsList); - MessageBox.Show("导出成功!"); } private void sliderItem2_ValueChanged(object sender, EventArgs e) @@ -9287,31 +8784,39 @@ dlg.Multiselect = true; if (dlg.ShowDialog() == DialogResult.OK) { - //自定义lprj文件名,从程序中复制一lprj文件。 - string filePath = dlg.FileName; - string lastname = Path.GetFileName(filePath); - - for (int i = 0; i < dlg.FileNames.Length; i++) + try { - AddLayerData(dlg.FileNames[i]); + for (int i = 0; i < dlg.FileNames.Length; i++) + { + AddLayerData(dlg.FileNames[i]); + } + layerManagerNode.Expand(); + + //放大到新导入的图层 + GSOLayer lyr = globeControl1.Globe.Layers.GetLayerByCaption(newlayername); + if (newlayername != "") + { + GSOFeatures features = lyr.GetAllFeatures(); + GSORect2d rd = lyr.LatLonBounds; + GSOPoint2d rdcenter = rd.Center; + + globeControl1.Globe.JumpToPosition(new GSOPoint3d(rdcenter.X, rdcenter.Y, 0), + EnumAltitudeMode.Absolute, 100); + + globeControl1.Refresh(); + } } - layerManagerNode.Expand(); - - //放大到新导入的图层 - GSOLayer lyr = globeControl1.Globe.Layers.GetLayerByCaption(newlayername); - if (newlayername != "") + catch (Exception ex) { - GSOFeatures features = lyr.GetAllFeatures(); - GSORect2d rd = lyr.LatLonBounds; - GSOPoint2d rdcenter = rd.Center; - - globeControl1.Globe.JumpToPosition(new GSOPoint3d(rdcenter.X, rdcenter.Y, 0), EnumAltitudeMode.Absolute, 100); - - globeControl1.Refresh(); + LogHelper.WriteLog(typeof(MainFrm), ex); } } } - + /// + /// 导入红线(完善) + /// + /// + /// private void buttonItemHX1_Click(object sender, EventArgs e) { LogManager.saveLog(Utility.userName, this.buttonItemHX1.Text); @@ -9339,7 +8844,6 @@ GSOFeatures RedFeatures = layer.GetAllFeatures(); redlinelayername = layer.Caption; - //objRes = layer; if (layer != null) { layerRedRegion = layer; @@ -9362,9 +8866,7 @@ { GSOFeature f = layer.GetAt(j); if (f != null) - { f.Geometry.AltitudeMode = EnumAltitudeMode.RelativeToGround; - } } } layerManagerNode.Expand(); @@ -9426,7 +8928,7 @@ fly.Show(this); } /// - /// 2015-10-17演示代码 红线审核 + /// 红线审核 /// /// /// @@ -9438,7 +8940,6 @@ globeControl1.BeforeSceneRenderEvent -= new BeforeSceneRenderEventHandler(globeControl1_BeforeSceneRenderEvent); globeControl2.BeforeSceneRenderEvent -= new BeforeSceneRenderEventHandler(globeControl2_BeforeSceneRenderEvent); - globeControl1.Globe.FlyToPosition(new GSOPoint3d(120.610963, 31.188121, 50), EnumAltitudeMode.Absolute, -4, 50, 800); globeControl1.Globe.FlyToPointSpeed = 10000000; globeControl1.Globe.Action = EnumAction3D.SelectObject; @@ -9453,11 +8954,8 @@ legendSC.Visible = false; ClearGZData(); GSOLayer redLayer = globeControl1.Globe.Layers.GetLayerByCaption("红线"); - if (redLayer != null) - { - redLayer.Visible = true; - } - + if (redLayer == null) return; + redLayer.Visible = true; } catch (Exception ex) { @@ -9477,7 +8975,6 @@ globeControl1.BeforeSceneRenderEvent -= new BeforeSceneRenderEventHandler(globeControl1_BeforeSceneRenderEvent); globeControl2.BeforeSceneRenderEvent -= new BeforeSceneRenderEventHandler(globeControl2_BeforeSceneRenderEvent); - globeControl1.Globe.Action = EnumAction3D.ActionNull; dataGridViewX1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells; //zhanshi = false; @@ -9488,12 +8985,8 @@ legendSG.Visible = false; ClearGZData(); GSOLayer redLayer = globeControl1.Globe.Layers.GetLayerByCaption("红线"); - if (redLayer != null) - { - redLayer.Visible = false; - } - - + if (redLayer == null) return; + redLayer.Visible = false; } catch (Exception ex) { @@ -9513,7 +9006,6 @@ globeControl1.BeforeSceneRenderEvent -= new BeforeSceneRenderEventHandler(globeControl1_BeforeSceneRenderEvent); globeControl2.BeforeSceneRenderEvent -= new BeforeSceneRenderEventHandler(globeControl2_BeforeSceneRenderEvent); - globeControl1.Globe.Action = EnumAction3D.ActionNull; //zhanshi = false; redSH = false; @@ -9524,45 +9016,15 @@ legendSG.Visible = false; ClearGZData(); GSOLayer redLayer = globeControl1.Globe.Layers.GetLayerByCaption("红线"); - if (redLayer != null) - { - redLayer.Visible = false; - } - - + if (redLayer == null) return; + redLayer.Visible = false; } catch (Exception ex) { //MessageBox.Show("系统运行错误:" + ex.ToString(), "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); } } - /// - /// 右屏添加冰箱数据 - /// - void AddDataToGlobeControl2() - { - - bool modelDataBool = false; - for (int i = globeControl2.Globe.Layers.Count - 1; i >= 0; i--) - { - GSOLayer layer = globeControl2.Globe.Layers[i]; - if (layer.Name.Contains("fttp:")) - { - modelDataBool = true; - break; - } - } - - if (modelDataBool == false) - { - GSOLayer ly = globeControl1.Globe.Layers.GetLayerByCaption("天地图地图"); - globeControl2.Globe.Layers.Add(ly); - } - else - { - return; - } - } + /// /// 双屏对比 /// @@ -9572,7 +9034,6 @@ { try { - globeControl1.BeforeSceneRenderEvent += new BeforeSceneRenderEventHandler(globeControl1_BeforeSceneRenderEvent); globeControl2.BeforeSceneRenderEvent += new BeforeSceneRenderEventHandler(globeControl2_BeforeSceneRenderEvent); @@ -9590,10 +9051,7 @@ GSOLayer redLayer = globeControl1.Globe.Layers.GetLayerByCaption("红线"); if (redLayer != null) - { redLayer.Visible = false; - } - AddDataToGlobeControl2(); } catch (Exception ex) { @@ -9613,7 +9071,6 @@ globeControl1.BeforeSceneRenderEvent -= new BeforeSceneRenderEventHandler(globeControl1_BeforeSceneRenderEvent); globeControl2.BeforeSceneRenderEvent -= new BeforeSceneRenderEventHandler(globeControl2_BeforeSceneRenderEvent); - globeControl1.Globe.Action = EnumAction3D.ActionNull; panelOfTable.Visible = false; //zhanshi = false; @@ -9625,9 +9082,7 @@ ClearGZData(); GSOLayer redLayer = globeControl1.Globe.Layers.GetLayerByCaption("红线"); if (redLayer != null) - { redLayer.Visible = false; - } } catch (Exception ex) { @@ -9643,11 +9098,9 @@ { try { - globeControl1.BeforeSceneRenderEvent -= new BeforeSceneRenderEventHandler(globeControl1_BeforeSceneRenderEvent); globeControl2.BeforeSceneRenderEvent -= new BeforeSceneRenderEventHandler(globeControl2_BeforeSceneRenderEvent); - globeControl1.Globe.Action = EnumAction3D.ActionNull; panelOfTable.Visible = false; //zhanshi = false; @@ -9660,10 +9113,7 @@ GSOLayer redLayer = globeControl1.Globe.Layers.GetLayerByCaption("红线"); if (redLayer != null) - { redLayer.Visible = false; - } - } catch (Exception ex) { @@ -9679,11 +9129,9 @@ { try { - globeControl1.BeforeSceneRenderEvent -= new BeforeSceneRenderEventHandler(globeControl1_BeforeSceneRenderEvent); globeControl2.BeforeSceneRenderEvent -= new BeforeSceneRenderEventHandler(globeControl2_BeforeSceneRenderEvent); - globeControl1.Globe.Action = EnumAction3D.ActionNull; panelOfTable.Visible = false; //zhanshi = false; @@ -9695,11 +9143,8 @@ ClearGZData(); GSOLayer redLayer = globeControl1.Globe.Layers.GetLayerByCaption("红线"); - if (redLayer != null) - { - redLayer.Visible = false; - } - + if (redLayer == null) return; + redLayer.Visible = false; } catch (Exception ex) { @@ -9717,12 +9162,8 @@ { LogManager.saveLog(Utility.userName, this.buttonItem8.Text); - //FrmCompareFeature frmCompareFeature = new FrmCompareFeature(globeControl1, globeControl2, layerTemp, layerTemp2,m_PipelineLayerNames,sgPipeLayersNames); int width = this.Width; FrmCompareFeature.ShowForm(globeControl1, globeControl2, layerTemp, layerTemp2, m_PipelineLayerNames, sgPipeLayersNames, width); - //frmCompareFeature.Location = new Point((this.Width - frmCompareFeature.Width)/2,50); - //frmCompareFeature.Show(this); - } /// /// 红线审核导出图片 @@ -9735,11 +9176,7 @@ Point pt1 = new Point(Convert.ToInt32(0), Convert.ToInt32(0)); Point pt2 = new Point(Convert.ToInt32(panelEx5.Width), Convert.ToInt32(panelEx5.Height)); - /*Point pt = getUpperLeftPoint(pt1, pt2); - Image myImg = new Bitmap(Convert.ToInt32(panelEx5.Width), Convert.ToInt32(panelEx5.Height)); - Graphics g = Graphics.FromImage(myImg); - g.CopyFromScreen(pt, new Point(0, 0), new Size(Convert.ToInt32(panelEx5.Width), Convert.ToInt32(panelEx5.Height))); - */ + int mapWidth = 0; int mapHeight = 0; Point pt = getUpperLeftPoint(pt1, pt2, out mapWidth, out mapHeight); @@ -9782,7 +9219,6 @@ { globeControl1.Globe.Action = EnumAction3D.ActionNull; FrmBSQStatis bsqStatis = new FrmBSQStatis(globeControl1, null); - //FrmBSQStatis bsqStatis = new FrmBSQStatis(); bsqStatis.Show(this); } /// @@ -9795,20 +9231,15 @@ trackflag = "BSQDuoBianXiangStatis"; globeControl1.Globe.Action = EnumAction3D.TrackPolygon; } - - private void btn_check_history_Click(object sender, EventArgs e) { LogManager.saveLog(Utility.userName, this.btn_check_history.Text); if (FrmCheckHistory.isOpen == true) - { return; - } FrmCheckHistory frm = new FrmCheckHistory(globeControl1, globeControl2); frm.addNode += new AddNodeToLayerManagerNode(addNodeToLayerManagerNode); frm.Show(); - } private void buttonItem查看数据_Click(object sender, EventArgs e) @@ -9840,34 +9271,29 @@ { LogManager.saveLog(Utility.userName, this.btn_user_info.Text); - if (!FrmSysUserInfoManger.IS_OPEN) - { - FrmSysUserInfoManger frm = new FrmSysUserInfoManger(); - frm.ShowDialog(); - } + if (FrmSysUserInfoManger.IS_OPEN) return; + FrmSysUserInfoManger frm = new FrmSysUserInfoManger(); + frm.ShowDialog(); } private void btn_role_info_Click(object sender, EventArgs e) { LogManager.saveLog(Utility.userName, this.btn_role_info.Text); - if (FrmRoleInfoManager.IS_OPEN) + if (!FrmRoleInfoManager.IS_OPEN) { - return; + FrmRoleInfoManager frm = new FrmRoleInfoManager(); + frm.ShowDialog(); } - FrmRoleInfoManager frm = new FrmRoleInfoManager(); - frm.ShowDialog(); } private void btn_resc_info_Click(object sender, EventArgs e) { LogManager.saveLog(Utility.userName, this.btn_resc_info.Text); - if (!SysRescInfoManager.IS_OPEN) - { - SysRescInfoManager frm = new SysRescInfoManager(); - frm.ShowDialog(); - } + if (SysRescInfoManager.IS_OPEN) return; + SysRescInfoManager frm = new SysRescInfoManager(); + frm.ShowDialog(); } private void btn_role_resc_Click(object sender, EventArgs e) @@ -9875,51 +9301,33 @@ LogManager.saveLog(Utility.userName, this.btn_role_resc.Text); - if (!FrmRoleRescManager.IS_OPEN) - { - FrmRoleRescManager frm = new FrmRoleRescManager(); - frm.ShowDialog(); - } + if (FrmRoleRescManager.IS_OPEN) return; + FrmRoleRescManager frm = new FrmRoleRescManager(); + frm.ShowDialog(); } private void btn_user_role_Click(object sender, EventArgs e) { LogManager.saveLog(Utility.userName, this.btn_user_role.Text); - if (FrmUserRole.IS_OPEN) + if (!FrmUserRole.IS_OPEN) { - return; + FrmUserRole frm = new FrmUserRole(); + frm.ShowDialog(); } - FrmUserRole frm = new FrmUserRole(); - frm.ShowDialog(); } private void btn_document_info_Click(object sender, EventArgs e) { LogManager.saveLog(Utility.userName, this.btn_document_info.Text); - - //if (FormDocumentManager.IS_OPEN) - //{ - // return; - //} - //FormDocumentManager frm = new FormDocumentManager(); - //frm.ShowDialog(); - - //if (FormDocumentManager.IS_OPEN) - //{ - // return; - //} - //new FormDocumentManager().ShowDialog(); - if (FormDocumentManager.IS_OPEN) + if (!FormDocumentManager.IS_OPEN) { - return; + this.Cursor = Cursors.WaitCursor; + FormDocumentManager frm = new FormDocumentManager(); + frm.changeCursor += new ChangeCursor(changeCursorToDefault); + frm.ShowDialog(); } - this.Cursor = Cursors.WaitCursor; - FormDocumentManager frm = new FormDocumentManager(); - frm.changeCursor += new ChangeCursor(changeCursorToDefault); - frm.ShowDialog(); - } private void changeCursorToDefault() @@ -9936,58 +9344,9 @@ dlg.Multiselect = true; if (dlg.ShowDialog() == DialogResult.OK) { - for (int i = 0; i < dlg.FileNames.Length; i++) + foreach (string strDataPath in dlg.FileNames) { - //this.Cursor = Cursors.WaitCursor; - string strDataPath = dlg.FileNames[i]; - - #region - //string strDataPathPrj = strDataPath.ToLower().Replace(".dwg", ".lprj"); - - //if (File.Exists(strDataPathPrj) == false) - //{ - // if (MessageBox.Show("数据没有空间参考信息,请设置空间参考信息!", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation) == DialogResult.OK) - // { - // String strPath = Application.StartupPath + "\\Coordinate Systems"; - // OpenFileDialog dlgPrj = new OpenFileDialog(); - // dlgPrj.InitialDirectory = strPath; - // dlgPrj.RestoreDirectory = true; - // dlgPrj.Multiselect = false; - // dlg.Filter = "投影文件|*.prj"; - // if (dlg.ShowDialog() == DialogResult.OK) - // { - // this.Cursor = Cursors.WaitCursor; - // string proj4 = GSODataEngineUtility.ConvertEsriPrjFileToProj4(dlg.FileName); - // using (StreamWriter stream = new StreamWriter(strDataPathPrj, false)) - // { - // stream.WriteLine("0prj4" + proj4 + ""); - // } - // AddLayerData(strDataPath); - // //globeControl1.Globe.Layers.Add(strDataPath); - - // this.Cursor = Cursors.Default; - // } - // else - // { - // AddLayerData(strDataPath); - // //globeControl1.Globe.Layers.Add(strDataPath); - // } - // } - // else - // { - // AddLayerData(strDataPath); - // //globeControl1.Globe.Layers.Add(strDataPath); - // } - - //} - //else - //{ - // //globeControl1.Globe.Layers.Add(strDataPath); - // AddLayerData(strDataPath); - //} - #endregion AddLayerData(strDataPath); - //this.Cursor = Cursors.Default; } } @@ -10008,38 +9367,13 @@ { LogManager.saveLog(Utility.userName, this.btn_password_edit.Text); - if (FrmChangePassword.IS_OPEN) + if (!FrmChangePassword.IS_OPEN) { - return; + FrmChangePassword frm = new FrmChangePassword(); + frm.ShowDialog(); } - FrmChangePassword frm = new FrmChangePassword(); - frm.ShowDialog(); } - /// - /// 多孔管线入库 - /// - /// - /// - private void buttonItem9_Click(object sender, EventArgs e) - { - //保存日志 - LogManager.saveLog(Utility.userName, this.buttonItemSJGL4_2.Text); - if (ds == null) - { - MessageBox.Show("请先连接数据库", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); - ConnectDB(null, null); - } - if (ds == null) - return; - - FrmMultiPipelineModelDB frm = new FrmMultiPipelineModelDB(globeControl1, ds); - if (frm.ShowDialog() == DialogResult.OK) - { - addNodeToLayerManagerNode(frm.rukuLayer); - } - //frm.Show(); - } private void 导出CADToolStripMenuItem1_Click(object sender, EventArgs e) { TreeNode node = layerNodeContexMenu.Tag as TreeNode; @@ -10049,44 +9383,42 @@ return; } GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(node.Text.Trim()); - if (layer == null || layer.GetAllFeatures().Length <= 0) + if (layer != null && layer.GetAllFeatures().Length > 0) { - MessageBox.Show("要导出的图层为空", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); - return; - } - string strProjectName = Utility.projectStr; - if (strProjectName != "") - { + string strProjectName = Utility.projectStr; + if (strProjectName == "") return; SaveFileDialog dlg = new SaveFileDialog(); dlg.Filter = "*.dwg|*.dwg|*.dxf|*.dxf"; dlg.FileName = layer.Caption; - if (dlg.ShowDialog(this) == DialogResult.OK) + if (dlg.ShowDialog(this) != DialogResult.OK) return; + globeControl1.Globe.MemoryLayer.SaveAs(dlg.FileName); + GSOLayer newlayer = globeControl1.Globe.Layers.Add(dlg.FileName); + newlayer.RemoveAllFeature(); + int featureCount = layer.GetAllFeatures().Length; + for (int i = 0; i < featureCount; i++) { - globeControl1.Globe.MemoryLayer.SaveAs(dlg.FileName); - GSOLayer newlayer = globeControl1.Globe.Layers.Add(dlg.FileName); - newlayer.RemoveAllFeature(); - int featureCount = layer.GetAllFeatures().Length; - for (int i = 0; i < featureCount; i++) + GSOFeature feature = layer.GetAt(i); + if (feature == null || feature.Geometry == null) continue; + switch (feature.Geometry.Type) { - GSOFeature feature = layer.GetAt(i); - if (feature != null && feature.Geometry != null) - { - if (feature.Geometry.Type == EnumGeometryType.GeoPolyline3D) - { - feature.Geometry.Style = new GSOSimpleLineStyle3D(); - } - else if (feature.Geometry.Type == EnumGeometryType.GeoPolygon3D) - { - feature.Geometry.Style = new GSOSimplePolygonStyle3D(); - } - newlayer.AddFeature(feature); - } + case EnumGeometryType.GeoPolyline3D: + feature.Geometry.Style = new GSOSimpleLineStyle3D(); + break; + case EnumGeometryType.GeoPolygon3D: + feature.Geometry.Style = new GSOSimplePolygonStyle3D(); + break; } - newlayer.Save(); - newlayer.Dataset.DataSource.RemoveDataset(newlayer.Dataset); - globeControl1.Globe.Layers.Remove(newlayer); - MessageBox.Show("导出CAD完成!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); + newlayer.AddFeature(feature); } + newlayer.Save(); + newlayer.Dataset.DataSource.RemoveDataset(newlayer.Dataset); + globeControl1.Globe.Layers.Remove(newlayer); + MessageBox.Show("导出CAD完成!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); + } + else + { + MessageBox.Show("要导出的图层为空", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); + return; } } diff --git a/MainFrm.designer.cs b/MainFrm.designer.cs index fd0ef22..1022ac7 100644 --- a/MainFrm.designer.cs +++ b/MainFrm.designer.cs @@ -195,10 +195,6 @@ this.缓冲区分析ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.无源淹没分析ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.清除分析ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components); - this.FlyToMenu = new System.Windows.Forms.ToolStripMenuItem(); - this.LightMenu = new System.Windows.Forms.ToolStripMenuItem(); - this.AllLightMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.timer1 = new System.Windows.Forms.Timer(this.components); this.layerNodeContexMenu = new System.Windows.Forms.ContextMenuStrip(this.components); this.RefreshLayerFeatureListMenuItem = new System.Windows.Forms.ToolStripMenuItem(); @@ -644,7 +640,6 @@ this.panelEx3.SuspendLayout(); this.RightScreenToolMenu.SuspendLayout(); this.toolRightMenu.SuspendLayout(); - this.contextMenuStrip1.SuspendLayout(); this.layerNodeContexMenu.SuspendLayout(); this.contextMenuStrip2.SuspendLayout(); this.contextMenuStrip3.SuspendLayout(); @@ -1263,7 +1258,7 @@ this.区域分析ToolStripMenuItem, this.清除分析ToolStripMenuItem}); this.toolRightMenu.Name = "toolRightMenu"; - this.toolRightMenu.Size = new System.Drawing.Size(153, 312); + this.toolRightMenu.Size = new System.Drawing.Size(149, 290); // // 量算ToolStripMenuItem // @@ -1276,7 +1271,7 @@ this.水平面积ToolStripMenuItem1, this.地表面积ToolStripMenuItem1}); this.量算ToolStripMenuItem.Name = "量算ToolStripMenuItem"; - this.量算ToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.量算ToolStripMenuItem.Size = new System.Drawing.Size(148, 22); this.量算ToolStripMenuItem.Text = "量算"; // // 水平距离ToolStripMenuItem1 @@ -1339,7 +1334,7 @@ this.前进ToolStripMenuItem, this.删除模型ToolStripMenuItem}); this.编辑ToolStripMenuItem.Name = "编辑ToolStripMenuItem"; - this.编辑ToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.编辑ToolStripMenuItem.Size = new System.Drawing.Size(148, 22); this.编辑ToolStripMenuItem.Text = "编辑"; // // 平移对象ToolStripMenuItem @@ -1415,7 +1410,7 @@ this.绕中心点飞行ToolStripMenuItem, this.绕眼睛飞行ToolStripMenuItem}); this.飞行ToolStripMenuItem.Name = "飞行ToolStripMenuItem"; - this.飞行ToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.飞行ToolStripMenuItem.Size = new System.Drawing.Size(148, 22); this.飞行ToolStripMenuItem.Text = "飞行"; // // 自定义飞行ToolStripMenuItem @@ -1460,7 +1455,7 @@ this.属性标注ToolStripMenuItem, this.标注管理ToolStripMenuItem}); this.标注ToolStripMenuItem.Name = "标注ToolStripMenuItem"; - this.标注ToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.标注ToolStripMenuItem.Size = new System.Drawing.Size(148, 22); this.标注ToolStripMenuItem.Text = "标注"; // // 标高标注ToolStripMenuItem @@ -1547,7 +1542,7 @@ this.关联查询ToolStripMenuItem, this.关键字查询ToolStripMenuItem}); this.查询ToolStripMenuItem.Name = "查询ToolStripMenuItem"; - this.查询ToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.查询ToolStripMenuItem.Size = new System.Drawing.Size(148, 22); this.查询ToolStripMenuItem.Text = "查询"; // // 空间查询ToolStripMenuItem @@ -1633,7 +1628,7 @@ this.附属物分类统计ToolStripMenuItem, this.标识器分类统计ToolStripMenuItem}); this.全区域统计ToolStripMenuItem.Name = "全区域统计ToolStripMenuItem"; - this.全区域统计ToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.全区域统计ToolStripMenuItem.Size = new System.Drawing.Size(148, 22); this.全区域统计ToolStripMenuItem.Text = "全区域统计"; // // 管线长度统计ToolStripMenuItem @@ -1712,7 +1707,7 @@ this.附属物分类统计ToolStripMenuItem1, this.标识器分类统计ToolStripMenuItem1}); this.绘制区域统计ToolStripMenuItem.Name = "绘制区域统计ToolStripMenuItem"; - this.绘制区域统计ToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.绘制区域统计ToolStripMenuItem.Size = new System.Drawing.Size(148, 22); this.绘制区域统计ToolStripMenuItem.Text = "绘制区域统计"; // // 管线长度统计ToolStripMenuItem1 @@ -1786,7 +1781,7 @@ this.道路断面分析ToolStripMenuItem, this.基线剖面分析ToolStripMenuItem}); this.断面分析ToolStripMenuItem.Name = "断面分析ToolStripMenuItem"; - this.断面分析ToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.断面分析ToolStripMenuItem.Size = new System.Drawing.Size(148, 22); this.断面分析ToolStripMenuItem.Text = "断面分析"; // // 横断面分析ToolStripMenuItem @@ -1828,7 +1823,7 @@ this.连通分析ToolStripMenuItem, this.爆管分析ToolStripMenuItem}); this.拓扑分析ToolStripMenuItem.Name = "拓扑分析ToolStripMenuItem"; - this.拓扑分析ToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.拓扑分析ToolStripMenuItem.Size = new System.Drawing.Size(148, 22); this.拓扑分析ToolStripMenuItem.Text = "拓扑分析"; // // 创建拓扑ToolStripMenuItem @@ -1890,7 +1885,7 @@ this.隐藏隧道ToolStripMenuItem, this.删除隧道ToolStripMenuItem}); this.开挖分析ToolStripMenuItem.Name = "开挖分析ToolStripMenuItem"; - this.开挖分析ToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.开挖分析ToolStripMenuItem.Size = new System.Drawing.Size(148, 22); this.开挖分析ToolStripMenuItem.Text = "开挖分析"; // // 多边形开挖ToolStripMenuItem @@ -1942,7 +1937,7 @@ this.可视域分析ToolStripMenuItem, this.可视包络分析ToolStripMenuItem}); this.视域分析ToolStripMenuItem.Name = "视域分析ToolStripMenuItem"; - this.视域分析ToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.视域分析ToolStripMenuItem.Size = new System.Drawing.Size(148, 22); this.视域分析ToolStripMenuItem.Text = "视域分析"; // // 通视分析ToolStripMenuItem @@ -1973,7 +1968,7 @@ this.缓冲区分析ToolStripMenuItem, this.无源淹没分析ToolStripMenuItem}); this.区域分析ToolStripMenuItem.Name = "区域分析ToolStripMenuItem"; - this.区域分析ToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.区域分析ToolStripMenuItem.Size = new System.Drawing.Size(148, 22); this.区域分析ToolStripMenuItem.Text = "区域分析"; // // 附属物分析ToolStripMenuItem @@ -2000,45 +1995,14 @@ // 清除分析ToolStripMenuItem // this.清除分析ToolStripMenuItem.Name = "清除分析ToolStripMenuItem"; - this.清除分析ToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.清除分析ToolStripMenuItem.Size = new System.Drawing.Size(148, 22); this.清除分析ToolStripMenuItem.Text = "清除分析"; this.清除分析ToolStripMenuItem.Click += new System.EventHandler(this.buttonItemClear_Click); // - // contextMenuStrip1 - // - this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.FlyToMenu, - this.LightMenu, - this.AllLightMenuItem}); - this.contextMenuStrip1.Name = "contextMenuStrip1"; - this.contextMenuStrip1.Size = new System.Drawing.Size(125, 70); - // - // FlyToMenu - // - this.FlyToMenu.Name = "FlyToMenu"; - this.FlyToMenu.Size = new System.Drawing.Size(124, 22); - this.FlyToMenu.Text = "定位"; - this.FlyToMenu.Click += new System.EventHandler(this.FlyToMenu_Click); - // - // LightMenu - // - this.LightMenu.Name = "LightMenu"; - this.LightMenu.Size = new System.Drawing.Size(124, 22); - this.LightMenu.Text = "单个闪烁"; - this.LightMenu.Click += new System.EventHandler(this.LightMenu_Click); - // - // AllLightMenuItem - // - this.AllLightMenuItem.Name = "AllLightMenuItem"; - this.AllLightMenuItem.Size = new System.Drawing.Size(124, 22); - this.AllLightMenuItem.Text = "全部闪烁"; - this.AllLightMenuItem.Visible = false; - this.AllLightMenuItem.Click += new System.EventHandler(this.AllLightMenuItem_Click); - // // timer1 // this.timer1.Interval = 500; - this.timer1.Tick += new System.EventHandler(this.timer1_Tick); + //this.timer1.Tick += new System.EventHandler(this.timer1_Tick); // // layerNodeContexMenu // @@ -2684,7 +2648,6 @@ this.buttonItemZTT1.Name = "buttonItemZTT1"; this.buttonItemZTT1.Text = "统计数据"; this.buttonItemZTT1.Visible = false; - this.buttonItemZTT1.Click += new System.EventHandler(this.buttonItemZTT1_Click); // // buttonItemZTT2 // @@ -5514,7 +5477,7 @@ this.dataGridViewX2.ReadOnly = true; this.dataGridViewX2.RowHeadersVisible = false; this.dataGridViewX2.RowTemplate.Height = 23; - this.dataGridViewX2.Size = new System.Drawing.Size(20983, 92); + this.dataGridViewX2.Size = new System.Drawing.Size(21874, 92); this.dataGridViewX2.TabIndex = 11; // // dataGridViewTextBoxColumn10 @@ -5608,7 +5571,7 @@ this.dataGridViewX3.ReadOnly = true; this.dataGridViewX3.RowHeadersVisible = false; this.dataGridViewX3.RowTemplate.Height = 23; - this.dataGridViewX3.Size = new System.Drawing.Size(20982, 127); + this.dataGridViewX3.Size = new System.Drawing.Size(21873, 127); this.dataGridViewX3.TabIndex = 5; this.dataGridViewX3.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.dataGridViewX3_MouseDoubleClick); // @@ -5866,7 +5829,7 @@ this.dataGridViewX8.ReadOnly = true; this.dataGridViewX8.RowHeadersVisible = false; this.dataGridViewX8.RowTemplate.Height = 23; - this.dataGridViewX8.Size = new System.Drawing.Size(91, 92); + this.dataGridViewX8.Size = new System.Drawing.Size(40, 92); this.dataGridViewX8.TabIndex = 11; // // dataGridViewTextBoxColumn12 @@ -5961,7 +5924,7 @@ this.dataGridViewX9.ReadOnly = true; this.dataGridViewX9.RowHeadersVisible = false; this.dataGridViewX9.RowTemplate.Height = 23; - this.dataGridViewX9.Size = new System.Drawing.Size(90, 127); + this.dataGridViewX9.Size = new System.Drawing.Size(39, 127); this.dataGridViewX9.TabIndex = 5; this.dataGridViewX9.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.dataGridViewX9_MouseDoubleClick); // @@ -6819,7 +6782,6 @@ this.panelEx3.ResumeLayout(false); this.RightScreenToolMenu.ResumeLayout(false); this.toolRightMenu.ResumeLayout(false); - this.contextMenuStrip1.ResumeLayout(false); this.layerNodeContexMenu.ResumeLayout(false); this.contextMenuStrip2.ResumeLayout(false); this.contextMenuStrip3.ResumeLayout(false); @@ -6914,10 +6876,6 @@ private DevComponents.DotNetBar.SideBar sideBar1; private DevComponents.DotNetBar.SideBarPanelItem sideBarPanelItem3; private DevComponents.DotNetBar.ExpandableSplitter expandableSplitter1; - private System.Windows.Forms.ContextMenuStrip contextMenuStrip1; - private System.Windows.Forms.ToolStripMenuItem FlyToMenu; - private System.Windows.Forms.ToolStripMenuItem LightMenu; - private System.Windows.Forms.ToolStripMenuItem AllLightMenuItem; private System.Windows.Forms.Timer timer1; private System.Windows.Forms.ContextMenuStrip layerNodeContexMenu; private System.Windows.Forms.ToolStripMenuItem RefreshLayerFeatureListMenuItem; diff --git a/Cyberpipe.suo b/Cyberpipe.suo index ebd45ee..c2c34b1 100644 --- a/Cyberpipe.suo +++ b/Cyberpipe.suo Binary files differ diff --git a/Forms/FrmPipelineModelDataBase.cs b/Forms/FrmPipelineModelDataBase.cs index a060afb..f833db4 100644 --- a/Forms/FrmPipelineModelDataBase.cs +++ b/Forms/FrmPipelineModelDataBase.cs @@ -1,16 +1,10 @@ using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; using System.Drawing; -using System.Text; using System.Windows.Forms; using GeoScene.Globe; using GeoScene.Engine; using GeoScene.Data; using System.IO; -using System.Collections; -using System.Xml; using System.Text.RegularExpressions; using DevComponents.DotNetBar; @@ -39,11 +33,12 @@ /// private void FrmPipelineModel_Load(object sender, EventArgs e) { + buttonOpen.Visible = isSh; string pipelinetype = Utility.pipelinetype; string[] pipelinetypes = pipelinetype.Split(','); for (int i = 0; i < pipelinetypes.Length; i++) { - pipelineTypeCbo.Items.Add(pipelinetypes[i]);//管线类型 + pipelineTypeCbo.Items.Add(pipelinetypes[i]); } comboBoxExLayer.Items.Clear(); diff --git a/FrmDatabaseParaSetting.cs b/FrmDatabaseParaSetting.cs index 39a4e4f..e4dfe80 100644 --- a/FrmDatabaseParaSetting.cs +++ b/FrmDatabaseParaSetting.cs @@ -123,7 +123,6 @@ { MessageBox.Show("数据库连接成功!", "提示"); } - } else { diff --git a/FrmShResult.cs b/FrmShResult.cs index d11fd66..50a7d8c 100644 --- a/FrmShResult.cs +++ b/FrmShResult.cs @@ -663,7 +663,6 @@ private void FrmShResult_FormClosed(object sender, FormClosedEventArgs e) { mainfrm.boolfrmShResult = false; - } /// /// 一键审核导出 diff --git a/MainFrm.cs b/MainFrm.cs index 2e3ba7f..83acfa1 100644 --- a/MainFrm.cs +++ b/MainFrm.cs @@ -19,7 +19,6 @@ { public partial class MainFrm : Office2007Form { - TreeNode layerManagerNode = null; TreeNode myPlaceNode = null; bool m_bFullScreen = false; @@ -1395,7 +1394,6 @@ private void MainFrm_Load(object sender, EventArgs e) { - this.initGlobalControl(); this.initGlobalMap(); this.initLayerTree(); @@ -1403,13 +1401,11 @@ this.initLayout(); this.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]); jumpToCameraState(x, y, z); - } #endregion @@ -1578,12 +1574,6 @@ 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)); - /*Point pt = getUpperLeftPoint(pt1, pt2); - Image myImg = new Bitmap(Convert.ToInt32(e.Rect.Width), Convert.ToInt32(e.Rect.Height)); - Graphics g = Graphics.FromImage(myImg); - g.CopyFromScreen(pt, new Point(0, 0), new Size(Convert.ToInt32(e.Rect.Width), Convert.ToInt32(e.Rect.Height))); - */ - int mapWidth = 0; int mapHeight = 0; Point pt = getUpperLeftPoint(pt1, pt2, out mapWidth, out mapHeight); @@ -1862,7 +1852,6 @@ { GSOLayer layer = node.Tag as GSOLayer; - //globeControl1.Globe.Layers.Remove(layer); for (int i = globeControl1.Globe.Layers.Count - 1; i >= 0; i--) { if (globeControl1.Globe.Layers[i].Caption == layer.Caption) @@ -2065,7 +2054,6 @@ } } - void globeControl1_MouseWheel(object sender, MouseEventArgs e) { if (globeControl1.Globe.CameraState.Distance > 20000000) @@ -2321,8 +2309,6 @@ case "valvequery": FrmValveStatistics frm = new FrmValveStatistics(globeControl1, polygon, new DataGridViewDelegate(InitDataGridViewX1)); frm.Show(this); - //panelEx6.Visible = true; - //toolStripFeatureLength.Text = ""; globeControl1.Globe.Action = EnumAction3D.ActionNull; break; @@ -2365,7 +2351,6 @@ layerGround.Visible = false; } } - // 清除当前TrackPolygonAnalysis的痕迹 globeControl1.Globe.ClearLastTrackPolygon(); globeControl1.Globe.Action = EnumAction3D.ActionNull; break; @@ -2382,20 +2367,7 @@ globeControl1.Globe.Action = EnumAction3D.ActionNull; break; case "BSQDuoBianXiangStatis": - - //GSOFeature f2 = new GSOFeature(); - //f2.Geometry = e.Polygon; - //f2.Geometry.AltitudeMode = EnumAltitudeMode.Absolute; - //globeControl1.Globe.MemoryLayer.AddFeature(f2); - //f2.Geometry.MoveZ(3); - //workWellLen.Clear(); - //List listBSQ = new List(); - - //GSOFeatures bsqFeatures = PolygonIntersectAnalysis(e.Polygon, "标识器"); - //listBSQ.Add(bsqFeatures); - - //FrmBSQDuoBianXingStatis bsqFrm = new FrmBSQDuoBianXingStatis(workWellLen, globeControl1, listBSQ); - FrmBSQStatis bsqFrm = new FrmBSQStatis(globeControl1, e.Polygon); + FrmBSQStatis bsqFrm = new FrmBSQStatis(globeControl1, e.Polygon); bsqFrm.Show(this); globeControl1.Globe.Action = EnumAction3D.ActionNull; break; @@ -2407,8 +2379,6 @@ } } } - - /// /// 鼠标悬浮提示 /// @@ -2432,20 +2402,19 @@ } catch (Exception ex) { - //LogError.PublishError(ex); + LogError.PublishError(ex); } } - + /// /// 添加管线绘制完成事件, 红线工具绘制完成 /// /// - /// + /// (完善) void globeControl1_MouseDoubleClick(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left) { - if (m_AddPipeLine == true && globeControl1.Globe.Action == EnumAction3D.DrawPolyline)//添加管线 { GSOLayer layerDest = globeControl1.Globe.DestLayerFeatureAdd; @@ -2661,18 +2630,12 @@ { if (e.Button == MouseButtons.Right) { - if (e.X == mouseDownX2 && e.Y == mouseDownY2) - { - RightScreenToolMenu.Show(globeControl2, e.X, e.Y); - } - else - { - return; - } + if (e.X != mouseDownX2 || e.Y != mouseDownY2) return; + RightScreenToolMenu.Show(globeControl2, e.X, e.Y); } } /// - /// + /// (完善) /// /// /// @@ -2912,7 +2875,6 @@ bool result = false; System.Net.WebResponse response = null; - try { System.Net.WebRequest req = System.Net.WebRequest.Create(fileUrl); @@ -3038,7 +3000,7 @@ } /// - /// 拼接气泡表格字符串 + /// 拼接气泡表格字符串(完善) /// /// /// @@ -3233,14 +3195,8 @@ { TreeNode featureAddPipeFitTreenode = GetDestLayerFeatureAddTreeNode(); GSOLayer featureAddLayer = globeControl1.Globe.Layers.GetLayerByCaption(featureAddPipeFitTreenode.Tag.ToString().Split('|')[1]); - if (featureAddLayer != null) - { - return featureAddLayer; - } - else - { - return null; - } + + return featureAddLayer != null ? featureAddLayer : null; } private TreeNode GetDestLayerFeatureAddTreeNode() @@ -3306,7 +3262,6 @@ return null; } - /// /// 地上模式 菜单按钮 /// @@ -3335,22 +3290,16 @@ 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(); - } } /// @@ -3382,13 +3331,9 @@ 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; } @@ -3426,20 +3371,8 @@ globeControl1.Globe.GroundOpaque = 100 - sliderGroundTransSet1.Value; GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(roadLayerName);//("180fd"); if (layer != null) - { layer.Opaque = 100 - sliderGroundTransSet1.Value; - } - //if (buttonItemSPDB.Checked) - //{ - // layer = globeControl2.Globe.Layers.GetLayerByCaption("180fd"); - // if (layer != null) - // { - // layer.Opaque = 100 - sliderGroundTransSet1.Value; - // } - // globeControl2.Globe.GroundOpaque = 100 - sliderGroundTransSet1.Value; - //} optiValue = sliderGroundTransSet1.Value; - //sliderItem1.Value = optiValue; } /// /// 图例 菜单按钮 @@ -3499,21 +3432,7 @@ panel3.Visible = false; sideBar1.ExpandedPanel = sideBarPanelItem3; buttonItemBZ11.Checked = false; - - //20160624 - /* - if (sideBarPanelItem4.Visible == true) - { - sideBar1.Visible = true; - controlContainerItem5.Visible = true; - } - else - { - sideBar1.Visible = false; - } - */ Refresh(); - } } /// @@ -3542,7 +3461,7 @@ int xOld = 0; int yOld = 0; /// - /// 全屏显示功能实现 + /// 全屏显示功能实现(完善) /// private void FullScreen() { @@ -3666,7 +3585,6 @@ FullScreen(); break; case Keys.Escape: - // esc仅仅取消全屏 if (m_bFullScreen) { FullScreen(); @@ -3682,7 +3600,6 @@ } } - private Point getUpperLeftPoint(Point p1, Point p2, out int mapWidth, out int mapHeight) // { Rectangle rc = new Rectangle(); @@ -3695,29 +3612,13 @@ int screenWidth = SystemInformation.WorkingArea.Width; int screenHeight = SystemInformation.WorkingArea.Height; - if (p1.X < x) - rc.X = x; - else - rc.X = p1.X; - - if (p1.Y < y) - rc.Y = y; - else - rc.Y = p1.Y; - + rc.X = p1.X < x ? x : p1.X; + rc.Y = p1.Y < y ? y : p1.Y; p1.X = rc.Left; p1.Y = rc.Top; - if (p2.X > screenWidth) - p2.X = screenWidth; - else - p2.X = p2.X; - - if (p2.Y > screenHeight) - p2.Y = screenHeight; - else - p2.Y = p2.Y; - + p2.X = p2.X > screenWidth ? screenWidth : p2.X; + p2.Y = p2.Y > screenHeight ? screenHeight : p2.Y; rc.Width = p2.X - rc.X; rc.Height = p2.Y - rc.Y; @@ -3728,7 +3629,6 @@ } Image printImage; - private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e) { e.Graphics.DrawImage(printImage, 10, 10); @@ -3742,15 +3642,8 @@ { LogManager.saveLog(Utility.userName, this.btnOutputJPG.Text); - //globeControl1.Globe.Action = EnumAction3D.TrackRect; //绘制矩形模式 - //globeControl1.Globe.TrackRectTool.TrackMode = EnumTrackMode.ScreenTrack; //在屏幕上绘制 Point pt1 = new Point(Convert.ToInt32(0), Convert.ToInt32(0)); Point pt2 = new Point(Convert.ToInt32(panelEx5.Width), Convert.ToInt32(panelEx5.Height)); - /*Point pt = getUpperLeftPoint(pt1, pt2); - Image myImg = new Bitmap(Convert.ToInt32(panelEx5.Width), Convert.ToInt32(panelEx5.Height)); - Graphics g = Graphics.FromImage(myImg); - g.CopyFromScreen(pt, new Point(0, 0), new Size(Convert.ToInt32(panelEx5.Width), Convert.ToInt32(panelEx5.Height))); - */ int mapWidth = 0; int mapHeight = 0; Point pt = getUpperLeftPoint(pt1, pt2, out mapWidth, out mapHeight); @@ -3784,120 +3677,6 @@ } } } - - /// - /// 窗体下方属性表格 右键菜单中的 “定位”菜单 - /// - /// - /// - private void FlyToMenu_Click(object sender, EventArgs e) - { - GSOFeature rowFeature = contextMenuStrip1.Tag as GSOFeature; - if (rowFeature == null) - return; - - - 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); - } - else - { - globeControl1.Globe.FlyToFeature(rowFeature, 0, 45, 3); - } - LightMenu_Click(sender, e); - - } - - /// - /// 表格中右键 “单个闪烁” 菜单 - /// - /// - /// - private void LightMenu_Click(object sender, EventArgs e) - { - flashflag = "single"; - timer1.Start(); - } - /// - /// 表格中右键 “全部闪烁” 菜单 - /// - /// - /// - private void AllLightMenuItem_Click(object sender, EventArgs e) - { - flashflag = "all"; - timer1.Start(); - } - - /// - /// 使用timer实现管线的闪烁效果 - /// - /// - /// - private void timer1_Tick(object sender, EventArgs e) - { - GSOFeature rowFeature = contextMenuStrip1.Tag as GSOFeature; - if (rowFeature == null) - return; - - if (count < 40) - { - count++; - if (flashflag == "single") - { - if (rowFeature != null) - { - if (count % 2 != 0) - { - rowFeature.HighLight = true; - globeControl1.Refresh(); - } - else - { - rowFeature.HighLight = false; - globeControl1.Refresh(); - } - } - } - else if (flashflag == "all") - { - GSOFeatures feats = Utility.Table2Features(dataGridViewX1.DataSource as DataTable, m_CurrentQueryLayer, globeControl1); - if (feats.Length > 0) - { - if (count % 2 != 0) - { - for (int i = 0; i < feats.Length; i++) - { - GSOFeature tempfeat = feats[i]; - tempfeat.HighLight = true; - } - - globeControl1.Refresh(); - } - else - { - for (int i = 0; i < feats.Length; i++) - { - GSOFeature tempfeat = feats[i]; - tempfeat.HighLight = false; - } - globeControl1.Refresh(); - } - } - } - } - else - { - timer1.Stop(); - count = 0; - } - } /// /// 图层目录树 右键菜单中的 目标图层 菜单 /// @@ -3910,7 +3689,6 @@ TreeNode node = layerNodeContexMenu.Tag as TreeNode; FeatureAddLayerMenuItem.Checked = true; GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(node.Tag.ToString().Split('|')[1]); - //GSOLayer layer = globeControl1.Globe.Layers.GetLayerByID((int)node.Tag); globeControl1.Globe.DestLayerFeatureAdd = layer; } } @@ -3954,7 +3732,6 @@ layer.Dataset.Save(); } - #region wxl feature的公共方法 /// /// 查找指定图层中在 指定范围内的feature对象集合 @@ -3966,24 +3743,10 @@ { GSOFeatures feats = new GSOFeatures(); GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(layername); - if (layer == null) - { - return feats; - } + if (layer == null)return feats; GSOFeatureLayer flayer = layer as GSOFeatureLayer; - if (flayer != null) - { - GSOFeatureDataset fdataset = flayer.Dataset as GSOFeatureDataset; - } - - if (polygon == null) - { - feats = flayer.GetAllFeatures(); - } - else - { - feats = flayer.FindFeaturesInPolygon(polygon, false); - } + if (flayer == null) return feats; + feats = polygon == null ? flayer.GetAllFeatures() : flayer.FindFeaturesInPolygon(polygon, false); return feats; } #endregion @@ -4014,10 +3777,7 @@ if (globeControl1.Globe.Action != EnumAction3D.NormalHit) { buttonItemFX3_6.Checked = false; - // ClearConnexityAnalysis(); - buttonItemFX3_5.Checked = false; - // ClearCloseValvesAnalysis(); } if (globeControl1.Globe.Action != EnumAction3D.TrackPolygon) { @@ -4025,7 +3785,6 @@ buttonItemFX4_1.Checked = false; } } - /// /// 主窗体关闭事件处理 /// @@ -4033,21 +3792,13 @@ /// private void MainFrm_FormClosing(object sender, FormClosingEventArgs e) { - if (MessageBox.Show("是否退出系统?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) - { e.Cancel = true; - } else - { globeControl1.Globe.MemoryLayer.SaveAs(Application.StartupPath + "/MyPlace.kml"); - } - - //saveLayerList(layerManagerNode.Nodes); - //注销id号为103的热键设定 - // UnregisterHotKey(Handle, 103); } + #region 完善 /// /// 垂直净距分析 功能界面中的 选择图层复选框 选中状态改变事件处理 /// @@ -4198,12 +3949,10 @@ } } } - Dictionary featCount = new Dictionary(); Dictionary featLenth = new Dictionary(); Dictionary m_FeaturesWithBianhao = new Dictionary();//记录编号和对应的标注点的位置 GSOFeatures polygonJingJuAnalysises = new GSOFeatures(); - /// /// 垂直净距分析 功能界面中的 开始分析按钮 事件处理 /// @@ -4293,7 +4042,6 @@ globeControl1.Refresh(); this.Cursor = Cursors.Default; } - /// /// 在指定的两点组成的线的中间添加一个marker对象,并将marker对象添加到指定的图层中 /// @@ -4357,7 +4105,6 @@ return dismarker.Position; } - /// /// 计算指定feature对象与除了该feature所在图层之外的 所有管线图层中的所有feature对象 的垂直距离 并在表格中记录符合要求的管线 /// @@ -4411,8 +4158,7 @@ double dDist = -1; dDist = globeControl1.Globe.Analysis3D.ComputeHorizonDistance(line1, line2, out pntIntersect1, out pntIntersect2, out pntProIntersect1, out pntProIntersect2, false); - //dDist = globeControl1.Globe.Analysis3D.ComputeVerticalDistance(line1, line2, out pntIntersect1, out pntIntersect2, out pntProIntersect1, out pntProIntersect2, false); - + if (dDist > -1) { dDist = Math.Abs(pntIntersect1.Z - pntIntersect2.Z) - pipeStyle1.Radius - pipeStyle2.Radius;//获得净距值 @@ -4472,25 +4218,6 @@ } } } - - //double verticalDis = dDist; - //dDist = globeControl1.Globe.Analysis3D.ComputeVerticalDistance(line1, line2, out pntIntersect1, out pntIntersect2, out pntProIntersect1, out pntProIntersect2, false); - //if (dDist > -1) - //{ - // dDist = Math.Abs(pntIntersect1.Z - pntIntersect2.Z) - pipeStyle1.Radius - pipeStyle2.Radius; - // if (dDist < horizontalDistance) - // { - // 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 = verticalDis.ToString("0.00"); - // dataGridViewAnalysisResult.Rows[idx].Cells[5].Value = dDist.ToString("0.00"); - // } - //} } if (m_FeaturesWithBianhao.ContainsKey(selectedFeature.Name + "-" + feats2[j].Name) == false) @@ -4545,7 +4272,6 @@ } } } - /// /// 水平净距分析 功能界面中 开始分析按钮 的事件处理 /// @@ -4629,8 +4355,6 @@ globeControl1.Refresh(); this.Cursor = Cursors.Default; } - - /// /// 计算指定feature对象与除了该feature所在图层之外的 所有管线图层中的所有feature对象 的水平距离 并记录符合要求的管线 功能 /// @@ -4820,7 +4544,6 @@ else { MessageBox.Show("请选中要进行碰撞分析的管线!", "提示"); - //globeControl1.Globe.Action = EnumAction3D.SelectObject; } globeControl1.Refresh(); this.Cursor = Cursors.Default; @@ -4845,9 +4568,6 @@ } } } - - - /// /// 覆土分析功能操作界面中的 选择管线 复选框选中状态改变事件处理 /// @@ -5071,11 +4791,9 @@ else { MessageBox.Show("请选中要进行覆土分析的管线!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); - //globeControl1.Globe.Action = EnumAction3D.SelectObject; } this.Cursor = Cursors.Default; } - /// /// 覆土分析中 表格的 双击定位 功能 /// @@ -5155,8 +4873,6 @@ //Refresh(); } - - /// /// 垂直净距分析 功能界面中 清除分析结果按钮 事件处理 /// @@ -5201,7 +4917,6 @@ layerTemp.RemoveAllFeature(); globeControl1.Refresh(); } - /// /// 垂直净距分析功能界面中 关闭按钮 事件处理 /// @@ -5262,7 +4977,6 @@ Refresh(); } - /// /// 导出指定DataGridView控件中的内容 /// @@ -5352,7 +5066,6 @@ } } } - /// /// 垂直净距分析功能界面中 导出Excel按钮 事件处理 /// @@ -5384,103 +5097,7 @@ { MessageBox.Show("表格内容为空!", "提示"); } - } - - - - /// - /// 添加指定路径下的数据 功能 - /// - /// - /// - private object AddLayerData(string strDataPath) - { - object objRes = null; - if (Path.GetExtension(strDataPath).ToLower().Equals(".kml")) - { - GSOLayer layer = globeControl1.Globe.Layers.Add(strDataPath); - objRes = layer; - if (layer != null) - { - 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; - // 注意用insert不要用add,因为后加入的图层在上层 - //layerManagerNode.Nodes.Add(node); - layerManagerNode.Nodes.Insert(0, node); - } - newlayername = layer.Caption; - } - else if (GSOUtility.IsDatasetSupportTerrain(strDataPath)) - { - GSOTerrain terrain = globeControl1.Globe.Terrains.Add(strDataPath); - objRes = terrain; - if (terrain != null) - { - TreeNode node = new TreeNode(); - node.Tag = terrain; - node.Text = terrain.Caption; - node.ImageIndex = 0; - node.SelectedImageIndex = 0; - node.Checked = terrain.Visible; - // 注意用insert不要用add,因为后加入的图层在上层 - // terrainManagerNode.Nodes.Add(node); - layerManagerNode.Nodes.Insert(0, node); - } - newlayername = terrain.Caption; - } - else if (Path.GetExtension(strDataPath).ToLower().Equals(".dxf")) - { - GSOLayer layer = globeControl1.Globe.Layers.Add(strDataPath); - objRes = layer; - if (layer != null) - { - GSODataset dataset = layer.Dataset; - CheckDatasetGeoReference(layer.Dataset, strDataPath); - CheckDatasetGeoReference(layer.Dataset, strDataPath); - TreeNode node = new TreeNode(); - node.Tag = layer; - node.Text = layer.Dataset.Caption; - node.ImageIndex = 0; - node.SelectedImageIndex = 0; - node.Checked = layer.Visible; - // 注意用insert不要用add,因为后加入的图层在上层 - //layerManagerNode.Nodes.Add(node); - layerManagerNode.Nodes.Insert(0, node); - } - newlayername = layer.Caption; - } - else - { - GSOLayer layer = globeControl1.Globe.Layers.Add(strDataPath); - objRes = layer; - if (layer != null) - { - GSODataset dataset = layer.Dataset; - - CheckDatasetGeoReference(layer.Dataset, strDataPath); - CheckDatasetGeoReference(layer.Dataset, strDataPath); - //CheckDatasetGeoReference(dataset); - TreeNode node = new TreeNode(); - node.Tag = layer; - node.Text = layer.Dataset.Caption; - node.ImageIndex = 0; - node.SelectedImageIndex = 0; - node.Checked = layer.Visible; - // 注意用insert不要用add,因为后加入的图层在上层 - //layerManagerNode.Nodes.Add(node); - layerManagerNode.Nodes.Insert(0, node); - } - newlayername = layer.Caption; - } - return objRes; - } - + } /// /// 碰撞分析功能界面中 选择管线复选框 选中状态改变事件处理 /// @@ -5600,7 +5217,6 @@ //globeControl1.Globe.Action = EnumAction3D.SelectObject; } } - /// /// 碰撞分析功能界面中 清除分析结果按钮 事件处理 /// @@ -5638,344 +5254,6 @@ MessageBox.Show("表格内容为空!", "提示"); } } - - ///// - ///// 区域分析 菜单 - ///// - ///// - ///// - //private void buttonItem50_Click(object sender, EventArgs e) - //{ - // buttonItem50.Checked = !buttonItem50.Checked; - // ribbonBarQY.Visible = buttonItem50.Checked; - // ribbonBarQY.Location = new Point(0, 0); - //} - - - /// - /// 连接数据库 菜单事件处理 - /// - /// - /// - private void ConnectDB(object sender, EventArgs e) - { - FrmDatabaseParaSetting frm = new FrmDatabaseParaSetting(globeControl1); - if (frm.ShowDialog() == DialogResult.OK) - { - ds = FrmDatabaseParaSetting.ds; - if (ds != null) - { - ds.IsCloseSaved = false; - } - } - } - - /// - /// 根据指定图层创建图层节点并将节点添加到图层管理节点的子节点集合中 - /// - /// - private void addNodeToLayerManagerNode(GSOLayer layer) - { - if (layer != null) - { - 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; - - if (!layerManagerNode.Nodes.Contains(node)) - { - layerManagerNode.Nodes.Insert(0, node); - layerManagerNode.Expand(); - } - } - } - - /// - /// 获取指定图层中最后一个feature对象的名称对应的整数 - /// - /// - /// - public int getLabelName(GSOLayer layer) - { - int nid = -1; - if (layer.GetAllFeatures().Length > 0) - { - string id = layer.GetAllFeatures()[layer.GetAllFeatures().Length - 1].Name; - - int.TryParse(id, out nid); - } - else - { - nid = 0; - } - return nid; - } - /// - /// 设置除指定标注图层之外的所有标注图层不可见 - /// - /// - public void setMarkerLayerUnVisible(string layerName) - { - string[] markerStrs = new string[10]; - markerStrs[0] = "标高标注"; - markerStrs[1] = "管径标注"; - markerStrs[2] = "埋深标注"; - markerStrs[3] = "坐标标注"; - markerStrs[4] = "坡度标注"; - markerStrs[5] = "属性标注"; - markerStrs[6] = "自定义标注"; - markerStrs[7] = "距离标注"; - markerStrs[8] = "红线工具"; - markerStrs[9] = "扯旗标注"; - - for (int i = 0; i < markerStrs.Length; i++) - { - GSOLayer markerLayer = globeControl1.Globe.Layers.GetLayerByCaption(markerStrs[i]); - if (markerLayer != null) - { - if (markerStrs[i] != layerName) - { - 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) - { - markerFeature.Visible = false; - } - } - if (layerMarkerTree.Nodes[0].Nodes.Count > i) - { - layerMarkerTree.Nodes[0].Nodes[i].Checked = true; - } - } - } - } - } - - /// - /// 判断选中的对象是否为管线 - /// - /// 被选中管线 - /// 返回一根线 - private GSOFeature IsPipeLineOfSelectedObj() - { - GSOFeature resFeature = null; - if (globeControl1.Globe.SelObjectCount < 1) - { - return null; - } - GSOLayer resLayer = null; - globeControl1.Globe.GetSelectObject(0, out resFeature, out resLayer); - if (resFeature == null) - return null; - - GSOGeoPolyline3D line1 = resFeature.Geometry as GSOGeoPolyline3D; - if (line1 == null) - { - return null; - } - GSOPipeLineStyle3D pipeStyle1 = line1.Style as GSOPipeLineStyle3D; - if (pipeStyle1 == null) - { - return null; - } - return resFeature; - } - - /// - /// 图层节点树中 节点 右键单击事件处理 - /// - /// - /// - private void layerMarkerTree_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e) - { - if (e.Button == MouseButtons.Right) - { - if (e.Node.Text == "标注管理" || e.Node.Text == "传感器管理") - { - return; - } - else if (e.Node.Parent.Text == "标注管理") - { - layerMarkerTree.SelectedNode = e.Node; - contextMenuStrip2.Show(layerMarkerTree, e.X, e.Y); - contextMenuStrip2.Tag = e.Node; - } - else if (e.Node.Parent.Text == "传感器管理") - { - layerSensorTree.SelectedNode = e.Node; - contextMenuStrip2.Show(layerSensorTree, e.X, e.Y); - contextMenuStrip2.Tag = e.Node; - } - else - { - if (e.Node.Tag is GSOFeature) - { - if (e.Node.Parent.Parent.Text == "标注管理") - { - layerMarkerTree.SelectedNode = e.Node; - contextMenuStrip3.Show(layerMarkerTree, e.X, e.Y); - contextMenuStrip3.Tag = e.Node; - } - else if (e.Node.Parent.Parent.Text == "传感器管理") - { - layerSensorTree.SelectedNode = e.Node; - contextMenuStrip3.Show(layerSensorTree, e.X, e.Y); - contextMenuStrip3.Tag = e.Node; - } - } - } - } - } - - /// - /// 标注管理、传感器管理 图层目录树的右键菜单中的 刷新列表 菜单 - /// - /// - /// - private void toolStripMenuItem1_Click(object sender, EventArgs e) - { - TreeNode node = contextMenuStrip2.Tag as TreeNode; - TreeNode parentNode = node.Parent; - Int32 nIndex = node.Index; - - if (parentNode.Text == "标注管理" || parentNode.Text == "传感器管理") - { - RefreshTreeNodeLayerFeatureList(node); - } - } - /// - /// 给指定的图层节点添加代表feature对象的子节点 - /// - /// - private void RefreshTreeNodeLayerFeatureList(TreeNode layerTreeNode) - { - layerTreeNode.Nodes.Clear(); - GSOLayer layer = (GSOLayer)layerTreeNode.Tag; - // 只将类型为内存数据集的图层列出,如果是其它类型的数据集可能数据量太大,没发显示在树控件中 - if (layer.Dataset is GSOFeatureDataset) - { - VisitFeature3Ds(layer.GetAllFeatures(), layerTreeNode); - } - } - - /// - /// 标注管理、传感器管理 图层目录树的右键菜单中的 移除所有 菜单 - /// - /// - /// - private void toolStripMenuItem2_Click(object sender, EventArgs e) - { - TreeNode node = contextMenuStrip3.Tag as TreeNode; - GSOFeature feature3d = node.Tag as GSOFeature; - if (node == null) - { - return; - } - if (feature3d != null) - { - feature3d.Delete(); - globeControl1.Globe.Refresh(); - node.Remove(); - } - } - - /// - /// 图层目录树的 节点对应的复选框选中状态改变事件处理 - /// - /// - /// - private void layerMarkerTree_AfterCheck(object sender, TreeViewEventArgs e) - { - if (e.Action != TreeViewAction.Unknown) - { - CheckTreeNode(e.Node, e.Node.Checked); - } - } - /// - /// 改变指定节点对应的复选框的选中状态 - /// - /// - /// - private void CheckTreeNode(TreeNode node, Boolean bChecked) - { - CheckChildTreeNode(node, bChecked); - globeControl1.Globe.Refresh(); - } - /// - /// 改变指定节点的子节点对应的复选框的选中状态 - /// - /// - /// - private void CheckChildTreeNode(TreeNode node, Boolean bChecked) - { - if (node == null) - { - return; - } - if (node.Tag != null) - { - if (node.Tag.GetType() == typeof(GSOFeatureFolder) || node.Tag.GetType() == typeof(GSOFeature)) - { - ((GSOFeature)node.Tag).SetVisibleDirectly(bChecked); - } - else - { - GSOLayer curLayer = node.Tag as GSOLayer; - GSOTerrain curTerrain = node.Tag as GSOTerrain; - if (curLayer != null) - { - curLayer.Visible = bChecked; - } - else if (curTerrain != null) - { - curTerrain.Visible = bChecked; - } - } - } - // 递归处理子节点 - for (int i = 0; i < node.Nodes.Count; i++) - { - node.Nodes[i].Checked = bChecked; - CheckChildTreeNode(node.Nodes[i], bChecked); - } - } - /// - /// 标注管理、传感器管理 目录树中的feature节点的右键菜单中的 删除 菜单 - /// - /// - /// - private void 删除ToolStripMenuItem1_Click(object sender, EventArgs e) - { - TreeNode node = contextMenuStrip2.Tag as TreeNode; - GSOLayer l = globeControl1.Globe.Layers.GetLayerByCaption(node.Text); - if (l != null) - { - l.RemoveAllFeature(); - node.Nodes.Clear(); - globeControl1.Refresh(); - } - } - - //定时检查传感器的状态 - public System.Windows.Forms.Timer timerOfSensor = null; - - /// /// 碰撞分析 功能界面中 关闭按钮 事件处理 /// @@ -5984,7 +5262,6 @@ private void buttonX7_Click_1(object sender, EventArgs e) { trackflag = ""; - globeControl1.Globe.Action = EnumAction3D.ActionNull; sideBarPanelItem4.Visible = false; panel2.Visible = false; @@ -5994,14 +5271,9 @@ dataGridViewX4.Rows.Clear(); dataGridViewX5.Rows.Clear(); if (buttonItem1.Checked) - { sideBar1.ExpandedPanel = sideBarPanelItem3; - } else - { sideBar1.Visible = false; - - } Refresh(); } /// @@ -6193,14 +5465,8 @@ comboBoxLayer.SelectedIndex = -1; dataGridViewLineList.Rows.Clear(); dataGridViewAnalysisResult.Rows.Clear(); - //if (buttonItem1.Checked) - //{ - // sideBar1.ExpandedPanel = sideBarPanelItem3; - //} - //else - //{ + sideBar1.Visible = false; - //} Refresh(); } /// @@ -6225,9 +5491,7 @@ globeControl1.Globe.JumpToPosition(point3d, EnumAltitudeMode.Absolute, 5); } else - { globeControl1.Globe.JumpToFeature(rowFeature, 5); - } } } } @@ -6308,897 +5572,6 @@ } } } - - /// - /// 一键审核---导入数据 - /// - /// - /// - private void buttonItem127_Click_2(object sender, EventArgs e) - { - LogManager.saveLog(Utility.userName, "打开数据"); - - try - { - - string dbIp = Utility.sgdbip; - string database = Utility.sgdbname; - string user = Utility.sgdbuser; - string pass = Utility.sgdbpwd; - shds = globeControl1.Globe.DataManager.OpenOracleDataSource(dbIp + "/" + database, "", "", user, pass); - if (shds == null) - { - MessageBox.Show("数据库连接失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); - } - Cyberpipe.Forms.FrmPipelineModelDataOneStep frm = new Cyberpipe.Forms.FrmPipelineModelDataOneStep(globeControl1, shds, layerTree); - if (frm.ShowDialog() == DialogResult.OK) - { - addNodeToLayerManagerNode(frm.rukuLayer); - } - } - catch (Exception ex) - { - LogError.PublishError(ex); - MessageBox.Show("内存过载请清理内存,并重新启动规划分析!", "提示"); - return; - } - - } - - /// - ///自动导出图片 - /// - /// - /// - private void buttonItem130_Click_1(object sender, EventArgs e) - { - LogManager.saveLog(Utility.userName, "导出审核图"); - - Point pt1 = new Point(Convert.ToInt32(0), Convert.ToInt32(0)); - Point pt2 = new Point(Convert.ToInt32(panelEx5.Width), Convert.ToInt32(panelEx5.Height)); - /*Point pt = getUpperLeftPoint(pt1, pt2); - Image myImg = new Bitmap(Convert.ToInt32(panelEx5.Width), Convert.ToInt32(panelEx5.Height)); - Graphics g = Graphics.FromImage(myImg); - g.CopyFromScreen(pt, new Point(0, 0), new Size(Convert.ToInt32(panelEx5.Width), Convert.ToInt32(panelEx5.Height))); - */ - - 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 = System.IO.Path.GetExtension(dlg.FileName);//扩展名 - switch (extension) - { - case ".jpg": - myImg.Save(dlg.FileName, System.Drawing.Imaging.ImageFormat.Jpeg); - break; - case ".png": - myImg.Save(dlg.FileName, System.Drawing.Imaging.ImageFormat.Png); - break; - case ".bmp": - myImg.Save(dlg.FileName, System.Drawing.Imaging.ImageFormat.Bmp); - break; - case ".gif": - myImg.Save(dlg.FileName, System.Drawing.Imaging.ImageFormat.Gif); - break; - default: - break; - } - } - } - /// - /// 一键审核功能 - /// - /// - /// - private void buttonItem128_Click(object sender, EventArgs e) - { - LogManager.saveLog(Utility.userName, this.buttonItem128.Text); - //垂直净距标准 - - frmSh = new FrmYJSHTC(globeControl1, globeControl2, layerTree); - - if (frmSh.ShowDialog() == DialogResult.OK) - { - frmWait = new FrmWait("一键审核……"); - frmWait.Location = new Point(this.Width - frmWait.Width - 10, this.Height - frmWait.Height - 50); - frmWait.Owner = this; - frmWait.Show(); - Thread thread = new Thread(new ThreadStart(doWork)); - thread.IsBackground = true; - thread.Start(); - } - } - - void doWork() - { - FrmShResult frmShResult = null; - - double dVerticalJingJuBiaoZhun = 1, dHorizontalJingJuBiaoZhun = 1; - if (frmSh.rukuLayer != null) - { - #region - this.Invoke((EventHandler)delegate - { - try - { - List managerLayerList = new List(); - for (int i = 0; i < layerManagerNode.Nodes.Count; i++) - { - managerLayerList.Add(layerManagerNode.Nodes[i].Text); - } - if (!managerLayerList.Contains(frmSh.rukuLayer.Caption)) - { - TreeNode node = new TreeNode(); - node.Tag = frmSh.rukuLayer; - node.Text = frmSh.rukuLayer.Dataset.Caption; - node.ImageIndex = 0; - node.SelectedImageIndex = 0; - node.Checked = frmSh.rukuLayer.Visible; - layerManagerNode.Nodes.Insert(0, node); - layerManagerNode.Expand(); - } - } - catch (Exception ex) - { - MessageBox.Show(ex.Message, "提示"); - } - }); - #endregion - - shlayername = frmSh.rukuLayer.Name; - globeControl1.Refresh(); - } - - if (frmShResult != null && !frmShResult.IsDisposed) - { - try - { - clearFeatureHighLight(); - ClearRedlineAnalyseResult(); - frmShResult.Close(); - } - catch (Exception ex) - { - MessageBox.Show(ex.Message); - } - } - - frmShResult = new FrmShResult(dVerticalJingJuBiaoZhun, dHorizontalJingJuBiaoZhun, shlayername, globeControl1, m_PipelineLayerNames); - if (boolfrmShResult == false) - { - frmShResult.Location = new Point(this.Width - frmShResult.Width - 10, this.Height - frmShResult.Height - 50); - frmShResult.Owner = this; - //一键审核实际计算步骤 - frmShResult.analysis(); - - //MainFrm窗体显示控制,回到一键审核Tab - this.Invoke((EventHandler)delegate - { - frmShResult.Show(); - frmWait.Close(); - //将tab页恢复到一键审核 - ribbonTabItem11.Checked = true; - try - { - globeControl1.Globe.Action = EnumAction3D.ActionNull; - //zhanshi = false; - splitContainer1.Panel2Collapsed = true; - - panelOfTable.Visible = false; - legendSC.Visible = false; - legendSG.Visible = false; - - GSOLayer redLayer = globeControl1.Globe.Layers.GetLayerByCaption("红线"); - if (redLayer != null) - { - redLayer.Visible = false; - } - } - catch (Exception ex) - { - MessageBox.Show("系统运行错误:" + ex.ToString(), "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); - } - - }); - - boolfrmShResult = true; - } - else - { - - } - } - - - /// - /// 清除渲染结果 - /// - public void ClearRedlineAnalyseResult() - { - for (int i = 0; i < globeControl1.Globe.Layers.Count; i++) - { - GSOLayer layer = globeControl1.Globe.Layers[i]; - if (layer.Caption == "tempLgdData") - { - layer.RemoveAllFeature(); - } - } - - layerTemp.RemoveAllFeature(); - globeControl1.Refresh(); - } - /// - /// 已审核的图层 - /// - /// - /// - private void buttonItem132_Click_1(object sender, EventArgs e) - { - //保存日志 - LogManager.saveLog(Utility.userName, this.buttonItem132.Text); - - if (shds == null) - { - //没连的话,直接连接审核库; //审核库配置读配置文件 - string dbIp = Utility.sgdbip; - string database = Utility.sgdbname; - string user = Utility.sgdbuser; - string pass = Utility.sgdbpwd; - - /* - if (!Utility.isNetworkConnectionSuccess(dbIp.Trim())) - { - MessageBox.Show("网络连接失败!", "提示"); - return; - } - */ - - shds = globeControl1.Globe.DataManager.OpenOracleDataSource(dbIp + "/" + database, "", "", user, pass); - if (shds == null) - { - MessageBox.Show("数据库连接失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); - } - } - Cyberpipe.Forms.FrmShLayers frm = new Cyberpipe.Forms.FrmShLayers(globeControl1, shds); - frm.Show(); - //if (frm.ShowDialog() == DialogResult.OK) - //{ - // addNodeToLayerManagerNode(frm.rukuLayer); - //} - //if (frm.rukuLayer != null) - //{ - // shlayername = frm.rukuLayer.Name; - //} - - } - /// - /// 审核入库 - /// - /// - /// - private void buttonItem133_Click_1(object sender, EventArgs e) - { - LogManager.saveLog(Utility.userName, "审核入库"); - FrmShRK frmShrk = new FrmShRK(globeControl1); - frmShrk.Show(); - } - /// - /// 模拟设计修改 - /// - /// - /// - private void buttonItem134_Click_1(object sender, EventArgs e) - { - LogManager.saveLog(Utility.userName, "模拟设计修改"); - - frmModify = new FrmMnModify(globeControl1, shlayername, shresultLists); - - if (boolfrmModify == false) - { - frmModify.Owner = this; - frmModify.Location = new Point(this.Width - frmModify.Width - 10, this.Height - frmModify.Height - 50); - frmModify.Show(); - boolfrmModify = true; - } - else - { - - } - - } - - - - /// - /// 一键审核中调节透明度 - /// - /// - /// - private void sliderItem1_ValueChanged(object sender, EventArgs e) - { - LogManager.saveLog(Utility.userName, this.sliderItem1.Text); - - globeControl1.Globe.GroundOpaque = 100 - sliderItem1.Value; - GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(roadLayerName);//("180fd"); - if (layer != null) - { - layer.Opaque = 100 - sliderItem1.Value; - } - - optiValue = sliderItem1.Value; - } - /// - /// 红线审核中的透明度分析 - /// - /// - /// - private void sliderItem3_ValueChanged(object sender, EventArgs e) - { - LogManager.saveLog(Utility.userName, this.sliderItem3.Text); - - globeControl1.Globe.GroundOpaque = 100 - sliderItem3.Value; - GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(roadLayerName);//("180fd"); - if (layer != null) - { - layer.Opaque = 100 - sliderItem3.Value; - } - optiValue = sliderItem3.Value; - } - - #region yanxiaowei - //初始化DataGridViewX1控件 - public delegate void DataGridViewDelegate(DataTable dt, string strLable, string strLayer, bool initDataGrid); - /// - /// 代理函数,操作DatgridViewX1 - /// - /// - /// - public void InitDataGridViewX1(DataTable dt, string strLable, string strLayer, bool initDataGrid) - { - if (initDataGrid == true) - { - dataGridViewX1.DataSource = dt; - panelOfTable.Visible = true; - toolStripNumbers.Text = strLable; - dataGridViewX1.Tag = strLayer; - } - else - { - dataGridViewX1.DataSource = null; - dataGridViewX1.Refresh(); - panelOfTable.Visible = false; - toolStripNumbers.Text = ""; - dataGridViewX1.Tag = ""; - globeControl1.Globe.MemoryLayer.RemoveAllFeature();//清除双击产生的标注 - } - } - FrmAnalysisGuiHuaResult from; - /// - /// 主窗体下方属性表格 双击定位 功能 - /// - /// - /// - 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 if (dataGridViewX1.Columns.Contains("标识器编号")) - { - featureName = dataGridViewX1.Rows[hittestinfo.RowIndex].Cells["标识器编号"].Value.ToString(); - } - featureName = featureName.Trim(); - - GSOLayer layer = null; - layer = globeControl1.Globe.Layers.GetLayerByCaption(dataGridViewX1.Tag.ToString()); - - if (layer == null) return; - - GSOFeatures features = layer.GetFeatureByName(featureName, false); - if (features.Length == 0) return; - GSOFeature rowFeature = features[0]; - - ClassSearchAnalysis.AddMakerToLineFeature(globeControl1, rowFeature); - - } - } - } - else - { - if (e.Button == MouseButtons.Left) - { - if (from != null && !from.IsDisposed) - { - try - { - from.Close(); - } - catch (Exception ex) - { - LogError.PublishError(ex); - } - } - try - { - DataGridView.HitTestInfo hittestinfo = dataGridViewX1.HitTest(e.X, e.Y); - if (hittestinfo.RowIndex >= 0) - { - string layer = dataGridViewX1.Rows[hittestinfo.RowIndex].Cells["管线类型"].Value.ToString(); - string hxName = dataGridViewX1.Rows[hittestinfo.RowIndex].Cells["红线编号"].Value.ToString(); - FrmAnalysisGuiHuaResult frm = new FrmAnalysisGuiHuaResult(globeControl1, lineStruct, featsList, - panelOfTable, dataGridViewX1, layer, hxName); - frm.Location = new Point(this.Width - frm.Width - 10, this.Height - frm.Height - 20); - frm.Show(this); - - from = frm; - } - } - catch (Exception ex) - { - LogError.PublishError(ex); - } - } - } - } - - /// - /// 空间查询 - /// - /// - /// - private void buttonItemSearch1_Click(object sender, EventArgs e) - { - LogManager.saveLog(Utility.userName, this.buttonItemSearch1.Text); - - trackflag = "PipelineSpatialQuery"; - globeControl1.Globe.Action = EnumAction3D.TrackPolygon; - globeControl1.Globe.TrackPolygonTool.TrackMode = EnumTrackMode.SpaceTrack; - - } - /// - /// 关键字查询 - /// - /// - /// - private void buttonItemSearch9_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, this.buttonItemSearch9.Text); - - FrmKeywordQuery.ShowForm(globeControl1, m_PipelineLayerNames, new DataGridViewDelegate(InitDataGridViewX1)); - } - /// - /// 编号查询 - /// - /// - /// - private void buttonItemSearch2_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, this.buttonItemSearch2.Text); - - FrmCodingQuery.ShowForm(globeControl1, m_PipelineLayerNames, new DataGridViewDelegate(InitDataGridViewX1)); - } - /// - /// 坐标查询 - /// - /// - /// - private void buttonItemSearch3_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, this.buttonItemSearch3.Text); - - FrmSetLatLonPos.ShowForm(globeControl1); - } - /// - /// 附属物查询 - /// - /// - /// - private void buttonItemSearch10_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, this.buttonItemSearch10.Text); - - FrmFittingQuery.ShowForm(globeControl1, instrumenLayerNames, new DataGridViewDelegate(InitDataGridViewX1)); - } - /// - /// 管径查询 - /// - /// - /// - private void buttonItemSearch4_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, this.buttonItemSearch4.Text); - - FrmDiameterQuery.ShowForm(globeControl1, m_PipelineLayerNames, new DataGridViewDelegate(InitDataGridViewX1)); - } - /// - /// 材质查询 - /// - /// - /// - private void buttonItemSearch5_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, this.buttonItemSearch5.Text); - - FrmMaterialSel.ShowForm(globeControl1, m_PipelineLayerNames, new DataGridViewDelegate(InitDataGridViewX1)); - } - /// - /// 基本查询 - /// - /// - /// - private void buttonItemSearch6_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, this.buttonItemSearch6.Text); - - FrmBasicQuery.ShowForm(globeControl1, new DataGridViewDelegate(InitDataGridViewX1)); - } - /// - /// 复合查询 - /// - /// - /// - private void buttonItemSearch7_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, this.buttonItemSearch7.Text); - - FrmQuerySQL.ShowForm(globeControl1, new DataGridViewDelegate(InitDataGridViewX1)); - } - /// - /// 关联查询 - /// - /// - /// - private void buttonItemSearch8_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, this.buttonItemSearch8.Text); - - if (globeControl1.Globe.SelObjectCount != 1) - { - MessageBox.Show("请选中一个对象!", "提示"); - return; - } - - double valueAllowance = 1.0; - - for (int j = 0; j < globeControl1.Globe.SelObjectCount; j++) - { - GSOFeature feature = null; - GSOLayer layer = null; - globeControl1.Globe.GetSelectObject(j, out feature, out layer); - - if (feature == null && feature.Geometry == null || (feature.Geometry.Type == EnumGeometryType.GeoPolygon3D - || feature.Geometry.Type == EnumGeometryType.GeoWater)) - return; - else - { - ClassSearchAnalysis.ResultRelationAnalysis(globeControl1, feature, valueLayerNames, workwellLayerNames, - instrumenLayerNames, pipefittingLayerNames, m_PipelineLayerNames, valueAllowance); - } - } - } - #endregion - /// - /// 清除分析 - /// - /// - /// - private void buttonItemClear_Click(object sender, EventArgs e) - { - LogManager.saveLog(Utility.userName, this.buttonItemClear.Text); - - globeControl1.Globe.ClearMeasure(); - layerTemp.RemoveAllFeature(); - layerTemp2.RemoveAllFeature(); - buttonItemLS5.Checked = false; - - dataGridViewX1.DataSource = null; - panelOfTable.Visible = false; - - globeControl1.Globe.MemoryLayer.RemoveAllFeature(); - globeControl1.Globe.ClearAnalysis(); - - - // 清除净距分析结果 - buttonX2_Click(null, null); - buttonX8_Click(null, null); - buttonX15_Click(null, null); - buttonX16_Click(null, null); - buttonClearAnalysisResult_Click(null, null); - - NetworkAnalysisTool.ClearAllTopAnalysis(this.globeControl1); - // ClearConnexityAnalysis();//清除连通性分析 - // 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); - } - } - - GSOFeatures feats = globeControl1.Globe.MemoryLayer.GetFeatureByName("粒子要素", true); - if (feats.Length > 0) - globeControl1.Globe.MemoryLayer.RemoveFeatureByID(feats[0].ID); - - globeControl1.Globe.UnderGroundFloor.Visible = false;//隐藏地下网格线 - - // ClearUpDownTraceAnalysis(); //清除上下游分析 - globeControl1.Globe.RemoveAllPits();//清除所有坑 - - string[] markerStrs = new string[9]; - markerStrs[0] = "标高标注"; - markerStrs[1] = "管径标注"; - markerStrs[2] = "埋深标注"; - markerStrs[3] = "坐标标注"; - markerStrs[4] = "坡度标注"; - markerStrs[5] = "属性标注"; - markerStrs[6] = "自定义标注"; - markerStrs[7] = "距离标注"; - markerStrs[8] = "扯旗标注"; - for (int i = 0; i < markerStrs.Length; i++) - { - GSOLayer markerLayer = globeControl1.Globe.Layers.GetLayerByCaption(markerStrs[i]); - markerLayer.RemoveAllFeature(); - } - if (layerMarkerTree != null && layerMarkerTree.Nodes.Count > 0) - { - for (int i = 0; i < layerMarkerTree.Nodes[0].Nodes.Count; i++) - { - layerMarkerTree.Nodes[0].Nodes[i].Nodes.Clear(); - } - } - - clearFeatureHighLight();//取消管线高亮 - - GSOLayer layerGround = globeControl1.Globe.Layers.GetLayerByCaption(roadLayerName);//("180fd"); - if (layerGround != null) - { - layerGround.Visible = true; - } - globeControl1.Refresh(); - globeControl2.Refresh(); - ClearRedlineAnalyseResult(); - globeControl1.Globe.Action = EnumAction3D.ActionNull; - } - /// - /// 管线长度全区域统计 - /// - /// - /// - private void buttonItemTJ1_ALL_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, "管线长度统计"); - FrmAllPipelineStatis frm = new FrmAllPipelineStatis(globeControl1, null, new DataGridViewDelegate(InitDataGridViewX1), m_PipelineLayerNames); - frm.Show(this); - - } - /// - /// 管线长度绘制区域统计 - /// - /// - /// - private void buttonItemTJ1_DRAW_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, "管线长度统计"); - - trackflag = "PipelineDistanceStatistics"; - globeControl1.Globe.Action = EnumAction3D.TrackPolygon; - globeControl1.Globe.TrackPolygonTool.TrackMode = EnumTrackMode.SpaceTrack; - } - /// - /// 阀门数量全区域统计 - /// - /// - /// - private void buttonItemTJ2_ALL_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, "阀门数量统计"); - FrmValveStatistics frm = new FrmValveStatistics(globeControl1, null, new DataGridViewDelegate(InitDataGridViewX1)); - frm.Show(this); - - globeControl1.Globe.Action = EnumAction3D.ActionNull; - } - /// - /// 阀门数量绘制区域统计 - /// - /// - /// - private void buttonItemTJ2_DRAW_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, "阀门数量统计"); - - trackflag = "valvequery"; - globeControl1.Globe.Action = EnumAction3D.TrackPolygon; - globeControl1.Globe.TrackPolygonTool.TrackMode = EnumTrackMode.SpaceTrack; - } - /// - /// 井盖数量全区域统计 - /// - /// - /// - private void buttonItemTJ3_ALL_Click(object sender, EventArgs e) - { - FrmAllWorkWellStatis frm = new FrmAllWorkWellStatis(globeControl1, null, new DataGridViewDelegate(InitDataGridViewX1)); - frm.Show(this); - } - /// - /// 井盖数量绘制区域统计 - /// - /// - /// - private void buttonItemTJ3_DRAW_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, "井盖数量统计"); - - trackflag = "workwellquery"; - globeControl1.Globe.Action = EnumAction3D.TrackPolygon; - globeControl1.Globe.TrackPolygonTool.TrackMode = EnumTrackMode.SpaceTrack; - } - /// - /// 管径分段统计全区域统计 - /// - /// - /// - private void buttonItemTJ4_ALL_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, "管径分段统计"); - - Frmpipediameterstatis.ShowForm(globeControl1, m_PipelineLayerNames, 0); - } - /// - /// 管径分段统计绘制区域统计 - /// - /// - /// - private void buttonItemTJ4_DRAW_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, "管径分段统计"); - - trackflag = null; - Frmpipediameterstatis.ShowForm(globeControl1, m_PipelineLayerNames, 1); - } - /// - /// 埋深分段统计全区域统计 - /// - /// - /// - private void buttonItemTJ5_ALL_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, "埋深分段统计"); - FrmpipeDeepstatis.ShowForm(globeControl1, m_PipelineLayerNames, 0); - } - /// - /// 埋深分段统计绘制区域统计 - /// - /// - /// - private void buttonItemTJ5_DRAW_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, "埋深分段统计"); - trackflag = null; - FrmpipeDeepstatis.ShowForm(globeControl1, m_PipelineLayerNames, 1); - } - /// - /// 管径分类统计全区域统计 - /// - /// - /// - private void buttonItemTJ6_ALL_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, "管径分类汇总"); - - FrmpipeDiametergather.ShowForm(globeControl1, m_PipelineLayerNames, 0); - } - /// - /// 管径分类统计绘制区域统计 - /// - /// - /// - private void buttonItemTJ6_DRAW_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, "管径分类汇总"); - - trackflag = null; - FrmpipeDiametergather.ShowForm(globeControl1, m_PipelineLayerNames, 1); - } - /// - /// 材质分类统计全区域统计 - /// - /// - /// - private void buttonItemTJ7_ALL_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, "材质分类汇总"); - - FrmpipeMaterialGather.ShowForm(globeControl1, m_PipelineLayerNames, 0); - } - /// - /// 材质分类统计绘制区域统计 - /// - /// - /// - private void buttonItemTJ7_DRAW_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, "材质分类汇总"); - - trackflag = null; - FrmpipeMaterialGather.ShowForm(globeControl1, m_PipelineLayerNames, 1); - } - /// - /// 附属物分类统计全区域统计 - /// - /// - /// - private void buttonItemTJ8_ALL_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, "附属物分类汇总"); - - FrmAccessoriesgather.ShowForm(globeControl1, instrumenLayerNames, 0); - } - /// - /// 附属物分类统计绘制区域统计 - /// - /// - /// - private void buttonItemTJ8_DRAW_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, "附属物分类汇总"); - - trackflag = null; - FrmAccessoriesgather.ShowForm(globeControl1, instrumenLayerNames, 1); - } /// /// 碰撞分析 /// @@ -7206,7 +5579,6 @@ /// private void buttonItemFX1_1_Click(object sender, EventArgs e) { - //日志记录 LogManager.saveLog(Utility.userName, this.buttonItemFX4_4.Text); this.dataGridViewX4.Size = new System.Drawing.Size(195, 120); @@ -7352,7 +5724,1332 @@ sideBar1.Refresh(); Refresh(); } + /// + /// 碰撞审查 + /// + /// + /// + private void buttonItemSH1_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, this.buttonItemSH1.Text); + this.dataGridViewX4.Size = new System.Drawing.Size(185, 92); + this.dataGridViewX5.Size = new System.Drawing.Size(185, 120); + + layerTemp.RemoveAllFeature(); + clearFeatureHighLight(); + globeControl1.Refresh(); + + sideBar1.Visible = true; + sideBarPanelItem3.Visible = true; + buttonItem1.Checked = true; + controlContainerItem3.Visible = true; + sideBarPanelItem4.Visible = true; + sideBarPanelItem4.Text = "碰撞审查"; + trackflag = "collision"; + controlContainerItem5.Control = panel2; + panel2.Dock = DockStyle.Fill; + panel2.Visible = true; + sideBar1.ExpandedPanel = sideBarPanelItem4; + sideBar1.Refresh(); + + Refresh(); + } + /// + /// 覆土审查 + /// + /// + /// + private void buttonItemSH2_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, this.buttonItemSH2.Text); + + this.dataGridViewX6.Size = new System.Drawing.Size(185, 92); + this.dataGridViewX7.Size = new System.Drawing.Size(185, 120); + + layerTemp.RemoveAllFeature(); + clearFeatureHighLight(); + globeControl1.Refresh(); + sideBar1.Visible = true; + sideBarPanelItem3.Visible = true; + buttonItem1.Checked = true; + controlContainerItem3.Visible = true; + sideBarPanelItem4.Visible = true; + sideBarPanelItem4.Text = "覆土审查"; + trackflag = "ftAnalysis"; + controlContainerItem5.Control = panel4; + panel4.Visible = true; + panel4.Dock = DockStyle.Fill; + sideBar1.ExpandedPanel = sideBarPanelItem4; + sideBar1.Refresh(); + Refresh(); + } + /// + /// 水平净距审查 + /// + /// + /// + private void buttonItemSH3_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, this.buttonItemSH3.Text); + + this.dataGridViewX8.Size = new System.Drawing.Size(190, 92); + this.dataGridViewX9.Size = new System.Drawing.Size(190, 120); + + layerTemp.RemoveAllFeature(); + clearFeatureHighLight(); + globeControl1.Refresh(); + sideBar1.Visible = true; + sideBarPanelItem3.Visible = true; + buttonItem1.Checked = true; + controlContainerItem3.Visible = true; + sideBarPanelItem4.Visible = true; + sideBarPanelItem4.Text = "水平净距审查"; + trackflag = "horizontal"; + controlContainerItem5.Control = panel5; + panel5.Dock = DockStyle.Fill; + panel5.Visible = true; + sideBar1.ExpandedPanel = sideBarPanelItem4; + sideBar1.Refresh(); + Refresh(); + } + /// + /// 垂直净距审查 + /// + /// + /// + private void buttonItemSH4_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, this.buttonItemSH4.Text); + + this.dataGridViewX2.Visible = true; + this.dataGridViewX3.Visible = true; + this.dataGridViewX2.Size = new System.Drawing.Size(185, 92); + this.dataGridViewX3.Size = new System.Drawing.Size(185, 120); + + layerTemp.RemoveAllFeature(); + clearFeatureHighLight(); + + globeControl1.Refresh(); + sideBar1.Visible = true; + sideBarPanelItem3.Visible = true; + buttonItem1.Checked = true; + controlContainerItem3.Visible = true; + sideBarPanelItem4.Visible = true; + sideBarPanelItem4.Text = "垂直净距审查"; + trackflag = "vertical"; + //globeControl1.Globe.Action = EnumAction3D.SelectObject; + panel2.Visible = false; + panel3.Visible = false; + panel5.Visible = false; + panel4.Visible = false; + controlContainerItem5.Control = panel1; + panel1.Dock = DockStyle.Fill; + panel1.Visible = true; + sideBar1.ExpandedPanel = sideBarPanelItem4; + sideBar1.Refresh(); + Refresh(); + } + #endregion + + /// + /// 添加指定路径下的数据 功能 + /// + /// + /// + private object AddLayerData(string strDataPath) + { + object objRes = null; + if (Path.GetExtension(strDataPath).ToLower().Equals(".kml")) + { + GSOLayer layer = globeControl1.Globe.Layers.Add(strDataPath); + objRes = layer; + if (layer != null) + { + 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; + layerManagerNode.Nodes.Insert(0, node); + } + newlayername = layer.Caption; + } + else if (GSOUtility.IsDatasetSupportTerrain(strDataPath)) + { + GSOTerrain terrain = globeControl1.Globe.Terrains.Add(strDataPath); + objRes = terrain; + if (terrain != null) + { + TreeNode node = new TreeNode(); + node.Tag = terrain; + node.Text = terrain.Caption; + node.ImageIndex = 0; + node.SelectedImageIndex = 0; + node.Checked = terrain.Visible; + layerManagerNode.Nodes.Insert(0, node); + } + newlayername = terrain.Caption; + } + else if (Path.GetExtension(strDataPath).ToLower().Equals(".dxf")) + { + GSOLayer layer = globeControl1.Globe.Layers.Add(strDataPath); + objRes = layer; + if (layer != null) + { + GSODataset dataset = layer.Dataset; + CheckDatasetGeoReference(layer.Dataset, strDataPath); + CheckDatasetGeoReference(layer.Dataset, strDataPath); + TreeNode node = new TreeNode(); + node.Tag = layer; + node.Text = layer.Dataset.Caption; + node.ImageIndex = 0; + node.SelectedImageIndex = 0; + node.Checked = layer.Visible; + layerManagerNode.Nodes.Insert(0, node); + } + newlayername = layer.Caption; + } + else + { + GSOLayer layer = globeControl1.Globe.Layers.Add(strDataPath); + + objRes = layer; + if (layer == null) + MessageBox.Show("layer is null"); + + CheckDatasetGeoReference(layer.Dataset, strDataPath); + TreeNode node = new TreeNode(); + node.Tag = layer; + node.Text = layer.Dataset.Caption; + node.ImageIndex = 0; + node.SelectedImageIndex = 0; + node.Checked = layer.Visible; + layerManagerNode.Nodes.Insert(0, node); + + newlayername = layer.Caption; + } + return objRes; + } + /// + /// 连接数据库 菜单事件处理 + /// + /// + /// + private void ConnectDB(object sender, EventArgs e) + { + FrmDatabaseParaSetting frm = new FrmDatabaseParaSetting(globeControl1); + if (frm.ShowDialog() == DialogResult.OK) + { + ds = FrmDatabaseParaSetting.ds; + if (ds != null) + { + ds.IsCloseSaved = false; + } + } + } + /// + /// 根据指定图层创建图层节点并将节点添加到图层管理节点的子节点集合中 + /// + /// + private void addNodeToLayerManagerNode(GSOLayer layer) + { + if (layer != null) + { + 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; + + if (!layerManagerNode.Nodes.Contains(node)) + { + layerManagerNode.Nodes.Insert(0, node); + layerManagerNode.Expand(); + } + } + } + /// + /// 获取指定图层中最后一个feature对象的名称对应的整数 + /// + /// + /// + public int getLabelName(GSOLayer layer) + { + int nid = -1; + if (layer.GetAllFeatures().Length > 0) + { + string id = layer.GetAllFeatures()[layer.GetAllFeatures().Length - 1].Name; + + int.TryParse(id, out nid); + } + else + { + nid = 0; + } + return nid; + } + /// + /// 设置除指定标注图层之外的所有标注图层不可见 + /// + /// + public void setMarkerLayerUnVisible(string layerName) + { + string[] markerStrs = new string[10]; + markerStrs[0] = "标高标注"; + markerStrs[1] = "管径标注"; + markerStrs[2] = "埋深标注"; + markerStrs[3] = "坐标标注"; + markerStrs[4] = "坡度标注"; + markerStrs[5] = "属性标注"; + markerStrs[6] = "自定义标注"; + markerStrs[7] = "距离标注"; + markerStrs[8] = "红线工具"; + markerStrs[9] = "扯旗标注"; + + for (int i = 0; i < markerStrs.Length; i++) + { + GSOLayer markerLayer = globeControl1.Globe.Layers.GetLayerByCaption(markerStrs[i]); + if (markerLayer != null) + { + if (markerStrs[i] != layerName) + { + 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) + { + markerFeature.Visible = false; + } + } + if (layerMarkerTree.Nodes[0].Nodes.Count > i) + { + layerMarkerTree.Nodes[0].Nodes[i].Checked = true; + } + } + } + } + } + /// + /// 判断选中的对象是否为管线 + /// + /// 被选中管线 + /// 返回一根线 + private GSOFeature IsPipeLineOfSelectedObj() + { + GSOFeature resFeature = null; + if (globeControl1.Globe.SelObjectCount < 1) return null; + GSOLayer resLayer = null; + globeControl1.Globe.GetSelectObject(0, out resFeature, out resLayer); + if (resFeature == null) return null; + + GSOGeoPolyline3D line1 = resFeature.Geometry as GSOGeoPolyline3D; + if (line1 == null) return null; + GSOPipeLineStyle3D pipeStyle1 = line1.Style as GSOPipeLineStyle3D; + if (pipeStyle1 == null) return null; + + return resFeature; + } + /// + /// 图层节点树中 节点 右键单击事件处理 + /// + /// + /// + private void layerMarkerTree_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e) + { + if (e.Button == MouseButtons.Right) + { + if (e.Node.Text == "标注管理" || e.Node.Text == "传感器管理") + return; + else if (e.Node.Parent.Text == "标注管理") + { + layerMarkerTree.SelectedNode = e.Node; + contextMenuStrip2.Show(layerMarkerTree, e.X, e.Y); + contextMenuStrip2.Tag = e.Node; + } + else if (e.Node.Parent.Text == "传感器管理") + { + layerSensorTree.SelectedNode = e.Node; + contextMenuStrip2.Show(layerSensorTree, e.X, e.Y); + contextMenuStrip2.Tag = e.Node; + } + else + { + if (e.Node.Tag is GSOFeature) + { + if (e.Node.Parent.Parent.Text == "标注管理") + { + layerMarkerTree.SelectedNode = e.Node; + contextMenuStrip3.Show(layerMarkerTree, e.X, e.Y); + contextMenuStrip3.Tag = e.Node; + } + else if (e.Node.Parent.Parent.Text == "传感器管理") + { + layerSensorTree.SelectedNode = e.Node; + contextMenuStrip3.Show(layerSensorTree, e.X, e.Y); + contextMenuStrip3.Tag = e.Node; + } + } + } + } + } + /// + /// 标注管理、传感器管理 图层目录树的右键菜单中的 刷新列表 菜单 + /// + /// + /// + private void toolStripMenuItem1_Click(object sender, EventArgs e) + { + TreeNode node = contextMenuStrip2.Tag as TreeNode; + TreeNode parentNode = node.Parent; + Int32 nIndex = node.Index; + + if (parentNode.Text == "标注管理" || parentNode.Text == "传感器管理") + { + RefreshTreeNodeLayerFeatureList(node); + } + } + /// + /// 给指定的图层节点添加代表feature对象的子节点 + /// + /// + private void RefreshTreeNodeLayerFeatureList(TreeNode layerTreeNode) + { + layerTreeNode.Nodes.Clear(); + GSOLayer layer = (GSOLayer)layerTreeNode.Tag; + // 只将类型为内存数据集的图层列出,如果是其它类型的数据集可能数据量太大,没发显示在树控件中 + if (layer.Dataset is GSOFeatureDataset) + { + VisitFeature3Ds(layer.GetAllFeatures(), layerTreeNode); + } + } + /// + /// 标注管理、传感器管理 图层目录树的右键菜单中的 移除所有 菜单 + /// + /// + /// + private void toolStripMenuItem2_Click(object sender, EventArgs e) + { + TreeNode node = contextMenuStrip3.Tag as TreeNode; + GSOFeature feature3d = node.Tag as GSOFeature; + if (node == null) + return; + if (feature3d != null) + { + feature3d.Delete(); + globeControl1.Globe.Refresh(); + node.Remove(); + } + } + /// + /// 图层目录树的 节点对应的复选框选中状态改变事件处理 + /// + /// + /// + private void layerMarkerTree_AfterCheck(object sender, TreeViewEventArgs e) + { + if (e.Action != TreeViewAction.Unknown) + { + CheckTreeNode(e.Node, e.Node.Checked); + } + } + /// + /// 改变指定节点对应的复选框的选中状态 + /// + /// + /// + private void CheckTreeNode(TreeNode node, Boolean bChecked) + { + CheckChildTreeNode(node, bChecked); + globeControl1.Globe.Refresh(); + } + /// + /// 改变指定节点的子节点对应的复选框的选中状态 + /// + /// + /// + private void CheckChildTreeNode(TreeNode node, Boolean bChecked) + { + if (node == null) + return; + if (node.Tag != null) + { + if (node.Tag.GetType() == typeof(GSOFeatureFolder) || node.Tag.GetType() == typeof(GSOFeature)) + ((GSOFeature)node.Tag).SetVisibleDirectly(bChecked); + else + { + GSOLayer curLayer = node.Tag as GSOLayer; + GSOTerrain curTerrain = node.Tag as GSOTerrain; + if (curLayer != null) + { + curLayer.Visible = bChecked; + } + else if (curTerrain != null) + { + curTerrain.Visible = bChecked; + } + } + } + // 递归处理子节点 + for (int i = 0; i < node.Nodes.Count; i++) + { + node.Nodes[i].Checked = bChecked; + CheckChildTreeNode(node.Nodes[i], bChecked); + } + } + /// + /// 标注管理、传感器管理 目录树中的feature节点的右键菜单中的 删除 菜单 + /// + /// + /// + private void 删除ToolStripMenuItem1_Click(object sender, EventArgs e) + { + TreeNode node = contextMenuStrip2.Tag as TreeNode; + GSOLayer l = globeControl1.Globe.Layers.GetLayerByCaption(node.Text); + if (l != null) + { + l.RemoveAllFeature(); + node.Nodes.Clear(); + globeControl1.Refresh(); + } + } + //定时检查传感器的状态 + public System.Windows.Forms.Timer timerOfSensor = null; + /// + /// 一键审核---导入数据 + /// + /// + /// + private void buttonItem127_Click_2(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "打开数据"); + + try + { + string dbIp = Utility.sgdbip; + string database = Utility.sgdbname; + string user = Utility.sgdbuser; + string pass = Utility.sgdbpwd; + shds = globeControl1.Globe.DataManager.OpenOracleDataSource(dbIp + "/" + database, "", "", user, pass); + if (shds == null) + { + MessageBox.Show("施工数据库连接失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); + } + FrmPipelineModelDB frm = new FrmPipelineModelDB(globeControl1, shds, true); + if (frm.ShowDialog() == DialogResult.OK) + { + addNodeToLayerManagerNode(frm.rukuLayer); + } + } + catch (Exception ex) + { + LogError.PublishError(ex); + MessageBox.Show("内存过载请清理内存,并重新启动规划分析!", "提示"); + return; + } + } + /// + ///自动导出图片 + /// + /// + /// + private void buttonItem130_Click_1(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "导出审核图"); + + Point pt1 = new Point(Convert.ToInt32(0), Convert.ToInt32(0)); + Point pt2 = new Point(Convert.ToInt32(panelEx5.Width), Convert.ToInt32(panelEx5.Height)); + + 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 = System.IO.Path.GetExtension(dlg.FileName);//扩展名 + switch (extension) + { + case ".jpg": + myImg.Save(dlg.FileName, System.Drawing.Imaging.ImageFormat.Jpeg); + break; + case ".png": + myImg.Save(dlg.FileName, System.Drawing.Imaging.ImageFormat.Png); + break; + case ".bmp": + myImg.Save(dlg.FileName, System.Drawing.Imaging.ImageFormat.Bmp); + break; + case ".gif": + myImg.Save(dlg.FileName, System.Drawing.Imaging.ImageFormat.Gif); + break; + default: + break; + } + } + } + /// + /// 一键审核功能 + /// + /// + /// + private void buttonItem128_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, this.buttonItem128.Text); + frmSh = new FrmYJSHTC(globeControl1, globeControl2, layerTree); + + if (frmSh.ShowDialog() == DialogResult.OK) + { + frmWait = new FrmWait("一键审核……"); + frmWait.Location = new Point(this.Width - frmWait.Width - 10, this.Height - frmWait.Height - 50); + frmWait.Owner = this; + frmWait.Show(); + Thread thread = new Thread(new ThreadStart(doWork)); + thread.IsBackground = true; + thread.Start(); + } + } + void doWork() + { + FrmShResult frmShResult = null; + + double dVerticalJingJuBiaoZhun = 1, dHorizontalJingJuBiaoZhun = 1; + if (frmSh.rukuLayer != null) + { + #region + this.Invoke((EventHandler) delegate + { + try + { + List managerLayerList = new List(); + for (int i = 0; i < layerManagerNode.Nodes.Count; i++) + { + managerLayerList.Add(layerManagerNode.Nodes[i].Text); + } + if (!managerLayerList.Contains(frmSh.rukuLayer.Caption)) + { + TreeNode node = new TreeNode(); + node.Tag = frmSh.rukuLayer; + node.Text = frmSh.rukuLayer.Dataset.Caption; + node.ImageIndex = 0; + node.SelectedImageIndex = 0; + node.Checked = frmSh.rukuLayer.Visible; + layerManagerNode.Nodes.Insert(0, node); + layerManagerNode.Expand(); + } + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "提示"); + } + }); + #endregion + + shlayername = frmSh.rukuLayer.Name; + globeControl1.Refresh(); + } + + if (frmShResult != null && !frmShResult.IsDisposed) + { + try + { + clearFeatureHighLight(); + ClearRedlineAnalyseResult(); + frmShResult.Close(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message); + } + } + + frmShResult = new FrmShResult(dVerticalJingJuBiaoZhun, dHorizontalJingJuBiaoZhun, shlayername, globeControl1, + m_PipelineLayerNames); + + if (boolfrmShResult == true) return; + + frmShResult.Location = new Point(this.Width - frmShResult.Width - 10, this.Height - frmShResult.Height - 50); + frmShResult.Owner = this; + //一键审核实际计算步骤 + frmShResult.analysis(); + + //MainFrm窗体显示控制,回到一键审核Tab + this.Invoke((EventHandler) delegate + { + frmShResult.Show(); + frmWait.Close(); + //将tab页恢复到一键审核 + ribbonTabItem11.Checked = true; + try + { + globeControl1.Globe.Action = EnumAction3D.ActionNull; + splitContainer1.Panel2Collapsed = true; + + panelOfTable.Visible = false; + legendSC.Visible = false; + legendSG.Visible = false; + + GSOLayer redLayer = globeControl1.Globe.Layers.GetLayerByCaption("红线"); + if (redLayer != null) + { + redLayer.Visible = false; + } + } + catch (Exception ex) + { + MessageBox.Show("系统运行错误:" + ex.ToString(), "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + + }); + + boolfrmShResult = true; + } + /// + /// 清除渲染结果 + /// + public void ClearRedlineAnalyseResult() + { + for (int i = 0; i < globeControl1.Globe.Layers.Count; i++) + { + GSOLayer layer = globeControl1.Globe.Layers[i]; + if (layer.Caption == "tempLgdData") + { + layer.RemoveAllFeature(); + } + } + + layerTemp.RemoveAllFeature(); + globeControl1.Refresh(); + } + /// + /// 已审核的图层 + /// + /// + /// + private void buttonItem132_Click_1(object sender, EventArgs e) + { + //保存日志 + LogManager.saveLog(Utility.userName, this.buttonItem132.Text); + + if (shds == null) + { + //没连的话,直接连接审核库; //审核库配置读配置文件 + string dbIp = Utility.sgdbip; + string database = Utility.sgdbname; + string user = Utility.sgdbuser; + string pass = Utility.sgdbpwd; + + shds = globeControl1.Globe.DataManager.OpenOracleDataSource(dbIp + "/" + database, "", "", user, pass); + if (shds == null) + { + MessageBox.Show("数据库连接失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); + } + } + FrmShLayers frm = new FrmShLayers(globeControl1, shds); + frm.Show(); + + } + /// + /// 审核入库 + /// + /// + /// + private void buttonItem133_Click_1(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "审核入库"); + FrmShRK frmShrk = new FrmShRK(globeControl1); + frmShrk.Show(); + } + /// + /// 模拟设计修改 + /// + /// + /// + private void buttonItem134_Click_1(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "模拟设计修改"); + + frmModify = new FrmMnModify(globeControl1, shlayername, shresultLists); + + if (boolfrmModify == false) + { + frmModify.Owner = this; + frmModify.Location = new Point(this.Width - frmModify.Width - 10, this.Height - frmModify.Height - 50); + frmModify.Show(); + boolfrmModify = true; + } + } + /// + /// 一键审核中调节透明度 + /// + /// + /// + private void sliderItem1_ValueChanged(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, this.sliderItem1.Text); + + globeControl1.Globe.GroundOpaque = 100 - sliderItem1.Value; + GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(roadLayerName); //("180fd"); + + if (layer != null) + layer.Opaque = 100 - sliderItem1.Value; + optiValue = sliderItem1.Value; + } + /// + /// 红线审核中的透明度分析 + /// + /// + /// + private void sliderItem3_ValueChanged(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, this.sliderItem3.Text); + + globeControl1.Globe.GroundOpaque = 100 - sliderItem3.Value; + GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(roadLayerName); //("180fd"); + if (layer != null) + layer.Opaque = 100 - sliderItem3.Value; + optiValue = sliderItem3.Value; + } + #region yanxiaowei + //初始化DataGridViewX1控件 + public delegate void DataGridViewDelegate(DataTable dt, string strLable, string strLayer, bool initDataGrid); + /// + /// 代理函数,操作DatgridViewX1 + /// + /// + /// + public void InitDataGridViewX1(DataTable dt, string strLable, string strLayer, bool initDataGrid) + { + if (initDataGrid == true) + { + dataGridViewX1.DataSource = dt; + panelOfTable.Visible = true; + toolStripNumbers.Text = strLable; + dataGridViewX1.Tag = strLayer; + } + else + { + dataGridViewX1.DataSource = null; + dataGridViewX1.Refresh(); + panelOfTable.Visible = false; + toolStripNumbers.Text = ""; + dataGridViewX1.Tag = ""; + globeControl1.Globe.MemoryLayer.RemoveAllFeature(); //清除双击产生的标注 + } + } + FrmAnalysisGuiHuaResult from; + /// + /// 主窗体下方属性表格 双击定位 功能 + /// + /// + /// + 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 if (dataGridViewX1.Columns.Contains("标识器编号")) + { + featureName = dataGridViewX1.Rows[hittestinfo.RowIndex].Cells["标识器编号"].Value.ToString(); + } + featureName = featureName.Trim(); + + GSOLayer layer = null; + layer = globeControl1.Globe.Layers.GetLayerByCaption(dataGridViewX1.Tag.ToString()); + + if (layer == null) return; + + GSOFeatures features = layer.GetFeatureByName(featureName, false); + if (features.Length == 0) return; + GSOFeature rowFeature = features[0]; + + ClassSearchAnalysis.AddMakerToLineFeature(globeControl1, rowFeature); + + } + } + } + else + { + if (e.Button == MouseButtons.Left) + { + if (from != null && !from.IsDisposed) + { + try + { + from.Close(); + } + catch (Exception ex) + { + LogError.PublishError(ex); + } + } + try + { + DataGridView.HitTestInfo hittestinfo = dataGridViewX1.HitTest(e.X, e.Y); + if (hittestinfo.RowIndex >= 0) + { + string layer = dataGridViewX1.Rows[hittestinfo.RowIndex].Cells["管线类型"].Value.ToString(); + string hxName = dataGridViewX1.Rows[hittestinfo.RowIndex].Cells["红线编号"].Value.ToString(); + FrmAnalysisGuiHuaResult frm = new FrmAnalysisGuiHuaResult(globeControl1, lineStruct, featsList, + panelOfTable, dataGridViewX1, layer, hxName); + frm.Location = new Point(this.Width - frm.Width - 10, this.Height - frm.Height - 20); + frm.Show(this); + + from = frm; + } + } + catch (Exception ex) + { + LogError.PublishError(ex); + } + } + } + } + /// + /// 空间查询 + /// + /// + /// + private void buttonItemSearch1_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, this.buttonItemSearch1.Text); + + trackflag = "PipelineSpatialQuery"; + globeControl1.Globe.Action = EnumAction3D.TrackPolygon; + globeControl1.Globe.TrackPolygonTool.TrackMode = EnumTrackMode.SpaceTrack; + } + /// + /// 关键字查询 + /// + /// + /// + private void buttonItemSearch9_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, this.buttonItemSearch9.Text); + + FrmKeywordQuery.ShowForm(globeControl1, m_PipelineLayerNames, new DataGridViewDelegate(InitDataGridViewX1)); + } + /// + /// 编号查询 + /// + /// + /// + private void buttonItemSearch2_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, this.buttonItemSearch2.Text); + + FrmCodingQuery.ShowForm(globeControl1, m_PipelineLayerNames, new DataGridViewDelegate(InitDataGridViewX1)); + } + /// + /// 坐标查询 + /// + /// + /// + private void buttonItemSearch3_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, this.buttonItemSearch3.Text); + + FrmSetLatLonPos.ShowForm(globeControl1); + } + /// + /// 附属物查询 + /// + /// + /// + private void buttonItemSearch10_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, this.buttonItemSearch10.Text); + + FrmFittingQuery.ShowForm(globeControl1, instrumenLayerNames, new DataGridViewDelegate(InitDataGridViewX1)); + } + /// + /// 管径查询 + /// + /// + /// + private void buttonItemSearch4_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, this.buttonItemSearch4.Text); + + FrmDiameterQuery.ShowForm(globeControl1, m_PipelineLayerNames, new DataGridViewDelegate(InitDataGridViewX1)); + } + /// + /// 材质查询 + /// + /// + /// + private void buttonItemSearch5_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, this.buttonItemSearch5.Text); + + FrmMaterialSel.ShowForm(globeControl1, m_PipelineLayerNames, new DataGridViewDelegate(InitDataGridViewX1)); + } + /// + /// 基本查询 + /// + /// + /// + private void buttonItemSearch6_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, this.buttonItemSearch6.Text); + + FrmBasicQuery.ShowForm(globeControl1, new DataGridViewDelegate(InitDataGridViewX1)); + } + /// + /// 复合查询 + /// + /// + /// + private void buttonItemSearch7_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, this.buttonItemSearch7.Text); + + FrmQuerySQL.ShowForm(globeControl1, new DataGridViewDelegate(InitDataGridViewX1)); + } + /// + /// 关联查询 + /// + /// + /// + private void buttonItemSearch8_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, this.buttonItemSearch8.Text); + + if (globeControl1.Globe.SelObjectCount != 1) + { + MessageBox.Show("请选中一个对象!", "提示"); + return; + } + double valueAllowance = 1.0; + + for (int j = 0; j < globeControl1.Globe.SelObjectCount; j++) + { + GSOFeature feature = null; + GSOLayer layer = null; + globeControl1.Globe.GetSelectObject(j, out feature, out layer); + + if (feature == null && feature.Geometry == null || (feature.Geometry.Type == EnumGeometryType.GeoPolygon3D + || feature.Geometry.Type == EnumGeometryType.GeoWater)) + return; + else + { + ClassSearchAnalysis.ResultRelationAnalysis(globeControl1, feature, valueLayerNames, workwellLayerNames, + instrumenLayerNames, pipefittingLayerNames, m_PipelineLayerNames, valueAllowance); + } + } + } + #endregion + /// + /// 清除分析(完善) + /// + /// + /// + private void buttonItemClear_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, this.buttonItemClear.Text); + + globeControl1.Globe.ClearMeasure(); + layerTemp.RemoveAllFeature(); + layerTemp2.RemoveAllFeature(); + buttonItemLS5.Checked = false; + + dataGridViewX1.DataSource = null; + panelOfTable.Visible = false; + + globeControl1.Globe.MemoryLayer.RemoveAllFeature(); + globeControl1.Globe.ClearAnalysis(); + + + // 清除净距分析结果 + buttonX2_Click(null, null); + buttonX8_Click(null, null); + buttonX15_Click(null, null); + buttonX16_Click(null, null); + buttonClearAnalysisResult_Click(null, null); + + NetworkAnalysisTool.ClearAllTopAnalysis(this.globeControl1); + // ClearConnexityAnalysis();//清除连通性分析 + // 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); + } + } + + GSOFeatures feats = globeControl1.Globe.MemoryLayer.GetFeatureByName("粒子要素", true); + if (feats.Length > 0) + globeControl1.Globe.MemoryLayer.RemoveFeatureByID(feats[0].ID); + + globeControl1.Globe.UnderGroundFloor.Visible = false;//隐藏地下网格线 + + // ClearUpDownTraceAnalysis(); //清除上下游分析 + globeControl1.Globe.RemoveAllPits();//清除所有坑 + + string[] markerStrs = new string[9]; + markerStrs[0] = "标高标注"; + markerStrs[1] = "管径标注"; + markerStrs[2] = "埋深标注"; + markerStrs[3] = "坐标标注"; + markerStrs[4] = "坡度标注"; + markerStrs[5] = "属性标注"; + markerStrs[6] = "自定义标注"; + markerStrs[7] = "距离标注"; + markerStrs[8] = "扯旗标注"; + for (int i = 0; i < markerStrs.Length; i++) + { + GSOLayer markerLayer = globeControl1.Globe.Layers.GetLayerByCaption(markerStrs[i]); + markerLayer.RemoveAllFeature(); + } + if (layerMarkerTree != null && layerMarkerTree.Nodes.Count > 0) + { + for (int i = 0; i < layerMarkerTree.Nodes[0].Nodes.Count; i++) + { + layerMarkerTree.Nodes[0].Nodes[i].Nodes.Clear(); + } + } + + clearFeatureHighLight();//取消管线高亮 + + GSOLayer layerGround = globeControl1.Globe.Layers.GetLayerByCaption(roadLayerName);//("180fd"); + if (layerGround != null) + { + layerGround.Visible = true; + } + globeControl1.Refresh(); + globeControl2.Refresh(); + ClearRedlineAnalyseResult(); + globeControl1.Globe.Action = EnumAction3D.ActionNull; + } + /// + /// 管线长度全区域统计 + /// + /// + /// + private void buttonItemTJ1_ALL_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "管线长度统计"); + FrmAllPipelineStatis frm = new FrmAllPipelineStatis(globeControl1, null, new DataGridViewDelegate(InitDataGridViewX1), m_PipelineLayerNames); + frm.Show(this); + } + /// + /// 管线长度绘制区域统计 + /// + /// + /// + private void buttonItemTJ1_DRAW_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "管线长度统计"); + + trackflag = "PipelineDistanceStatistics"; + globeControl1.Globe.Action = EnumAction3D.TrackPolygon; + globeControl1.Globe.TrackPolygonTool.TrackMode = EnumTrackMode.SpaceTrack; + } + /// + /// 阀门数量全区域统计 + /// + /// + /// + private void buttonItemTJ2_ALL_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "阀门数量统计"); + FrmValveStatistics frm = new FrmValveStatistics(globeControl1, null, new DataGridViewDelegate(InitDataGridViewX1)); + frm.Show(this); + + globeControl1.Globe.Action = EnumAction3D.ActionNull; + } + /// + /// 阀门数量绘制区域统计 + /// + /// + /// + private void buttonItemTJ2_DRAW_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "阀门数量统计"); + + trackflag = "valvequery"; + globeControl1.Globe.Action = EnumAction3D.TrackPolygon; + globeControl1.Globe.TrackPolygonTool.TrackMode = EnumTrackMode.SpaceTrack; + } + /// + /// 井盖数量全区域统计 + /// + /// + /// + private void buttonItemTJ3_ALL_Click(object sender, EventArgs e) + { + FrmAllWorkWellStatis frm = new FrmAllWorkWellStatis(globeControl1, null, new DataGridViewDelegate(InitDataGridViewX1)); + frm.Show(this); + } + /// + /// 井盖数量绘制区域统计 + /// + /// + /// + private void buttonItemTJ3_DRAW_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "井盖数量统计"); + + trackflag = "workwellquery"; + globeControl1.Globe.Action = EnumAction3D.TrackPolygon; + globeControl1.Globe.TrackPolygonTool.TrackMode = EnumTrackMode.SpaceTrack; + } + /// + /// 管径分段统计全区域统计 + /// + /// + /// + private void buttonItemTJ4_ALL_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "管径分段统计"); + + Frmpipediameterstatis.ShowForm(globeControl1, m_PipelineLayerNames, 0); + } + /// + /// 管径分段统计绘制区域统计 + /// + /// + /// + private void buttonItemTJ4_DRAW_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "管径分段统计"); + + trackflag = null; + Frmpipediameterstatis.ShowForm(globeControl1, m_PipelineLayerNames, 1); + } + /// + /// 埋深分段统计全区域统计 + /// + /// + /// + private void buttonItemTJ5_ALL_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "埋深分段统计"); + FrmpipeDeepstatis.ShowForm(globeControl1, m_PipelineLayerNames, 0); + } + /// + /// 埋深分段统计绘制区域统计 + /// + /// + /// + private void buttonItemTJ5_DRAW_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "埋深分段统计"); + trackflag = null; + FrmpipeDeepstatis.ShowForm(globeControl1, m_PipelineLayerNames, 1); + } + /// + /// 管径分类统计全区域统计 + /// + /// + /// + private void buttonItemTJ6_ALL_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "管径分类汇总"); + + FrmpipeDiametergather.ShowForm(globeControl1, m_PipelineLayerNames, 0); + } + /// + /// 管径分类统计绘制区域统计 + /// + /// + /// + private void buttonItemTJ6_DRAW_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "管径分类汇总"); + + trackflag = null; + FrmpipeDiametergather.ShowForm(globeControl1, m_PipelineLayerNames, 1); + } + /// + /// 材质分类统计全区域统计 + /// + /// + /// + private void buttonItemTJ7_ALL_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "材质分类汇总"); + + FrmpipeMaterialGather.ShowForm(globeControl1, m_PipelineLayerNames, 0); + } + /// + /// 材质分类统计绘制区域统计 + /// + /// + /// + private void buttonItemTJ7_DRAW_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "材质分类汇总"); + + trackflag = null; + FrmpipeMaterialGather.ShowForm(globeControl1, m_PipelineLayerNames, 1); + } + /// + /// 附属物分类统计全区域统计 + /// + /// + /// + private void buttonItemTJ8_ALL_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "附属物分类汇总"); + + FrmAccessoriesgather.ShowForm(globeControl1, instrumenLayerNames, 0); + } + /// + /// 附属物分类统计绘制区域统计 + /// + /// + /// + private void buttonItemTJ8_DRAW_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "附属物分类汇总"); + + trackflag = null; + FrmAccessoriesgather.ShowForm(globeControl1, instrumenLayerNames, 1); + } #region Predaotr,断面分析 /// /// 横断面分析 @@ -7365,7 +7062,6 @@ globeControl1.Globe.TrackPolylineTool.VerticalLineVisible = true; globeControl1.Globe.TrackPolylineTool.TrackMode = EnumTrackMode.SpaceTrack; trackPolylineEndMode = EnumTrackPolylineEndMode.HDM_Analysis; - } /// /// 纵断面分析 @@ -7409,7 +7105,6 @@ globeControl1.Globe.TrackPolylineTool.VerticalLineVisible = true; globeControl1.Globe.TrackPolylineTool.TrackMode = EnumTrackMode.SpaceTrack; trackPolylineEndMode = EnumTrackPolylineEndMode.DLDM_Analysis; - } /// /// 基线剖面分析 @@ -7422,9 +7117,7 @@ globeControl1.Globe.TrackPolylineTool.VerticalLineVisible = true; globeControl1.Globe.TrackPolylineTool.TrackMode = EnumTrackMode.SpaceTrack; trackPolylineEndMode = EnumTrackPolylineEndMode.JXPM_Analysis; - } - #endregion /// /// 创建拓扑 @@ -7462,7 +7155,6 @@ LogManager.saveLog(Utility.userName, this.buttonItemFX3_3.Text); NetworkTraceUpDown(false); } - /// /// 上下游追踪 功能 /// @@ -7480,7 +7172,6 @@ NetworkAnalysisTool.TraceUpDownAnalysis(bTraceUp, selLineFeature, selLayer); } - /// /// 流向分析 /// @@ -7533,7 +7224,6 @@ MessageBox.Show("未找到关闭阀门"); } } - /// /// 连通分析 /// @@ -7580,9 +7270,7 @@ NetworkAnalysisTool.ExplodeAnalysis(this.globeControl1, selLineFeature, selLayer); this.buttonItemFX3_5_Click(sender, e); //关阀分析: - } - #endregion /// /// 多边形开挖 @@ -7591,7 +7279,6 @@ /// private void buttonItemFX4_1_Click(object sender, EventArgs e) { - //日志记录 LogManager.saveLog(Utility.userName, this.buttonItemFX4_1.Text); trackflag = "pit"; @@ -7605,7 +7292,6 @@ /// private void buttonItemFX4_2_Click(object sender, EventArgs e) { - //日志记录 LogManager.saveLog(Utility.userName, this.buttonItemFX4_2.Text); trackflag = "digFillAnalysis"; @@ -7620,7 +7306,6 @@ /// private void buttonItemFX4_3_Click(object sender, EventArgs e) { - //日志记录 LogManager.saveLog(Utility.userName, this.buttonItemFX4_3.Text); if (!buttonItemFX4_3.Checked) @@ -7653,12 +7338,13 @@ /// private void buttonItemFX4_4_Click(object sender, EventArgs e) { - //日志记录 LogManager.saveLog(Utility.userName, this.buttonItemFX4_4.Text); globeControl1.Globe.Action = EnumAction3D.DrawPolyline; GSOLayer tunnel = globeControl1.Globe.Layers.GetLayerByCaption("隧道"); - if (tunnel != null) + if (tunnel == null) + MessageBox.Show("场景中未加载隧道图层!", "提示"); + else { globeControl1.Globe.DestLayerFeatureAdd = tunnel; tunnel.Editable = true; @@ -7666,10 +7352,6 @@ m_AddPipeLine = false; m_isDrawCitySevenLine = false; } - else - { - MessageBox.Show("场景中未加载隧道图层!", "提示"); - } } /// /// 隐藏隧道 @@ -7678,7 +7360,6 @@ /// private void buttonItemFX4_5_Click(object sender, EventArgs e) { - //日志记录 LogManager.saveLog(Utility.userName, this.buttonItemFX4_5.Text); GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption("隧道"); @@ -7694,7 +7375,6 @@ /// private void buttonItemFX4_6_Click(object sender, EventArgs e) { - //日志记录 LogManager.saveLog(Utility.userName, this.buttonItemFX4_6.Text); if (globeControl1.Globe.SelObjectCount > 0) @@ -7736,16 +7416,7 @@ //日志记录 LogManager.saveLog(Utility.userName, this.buttonItemFX5_1.Text); - if (globeControl1.Globe.Action != EnumAction3D.VisibilityAnalysis) - { - //btnSpaceVisibilityAnalysis.Checked = true; - globeControl1.Globe.Action = EnumAction3D.VisibilityAnalysis; - } - else - { - globeControl1.Globe.Action = EnumAction3D.ActionNull; - // SetButtonChecked(); - } + globeControl1.Globe.Action = globeControl1.Globe.Action != EnumAction3D.VisibilityAnalysis ? EnumAction3D.VisibilityAnalysis : EnumAction3D.ActionNull; } /// /// 可视域分析 @@ -7754,7 +7425,6 @@ /// private void buttonItemFX5_2_Click(object sender, EventArgs e) { - //日志记录 LogManager.saveLog(Utility.userName, this.buttonItemFX5_2.Text); globeControl1.Globe.Action = EnumAction3D.ViewshedAnalysis; @@ -7766,7 +7436,6 @@ /// private void buttonItemFX5_3_Click(object sender, EventArgs e) { - //日志记录 LogManager.saveLog(Utility.userName, this.buttonItemFX5_3.Text); globeControl1.Globe.Action = EnumAction3D.ViewEnvelopeAnalysis; @@ -7778,7 +7447,6 @@ /// private void buttonItemFX6_1_Click(object sender, EventArgs e) { - //日志记录 LogManager.saveLog(Utility.userName, this.buttonItemFX6_1.Text); GSOFeature feat = globeControl1.Globe.SelectedObject; @@ -7813,7 +7481,6 @@ /// private void buttonItemFX6_2_Click(object sender, EventArgs e) { - //日志记录 LogManager.saveLog(Utility.userName, this.buttonItemFX6_2.Text); globeControl1.Globe.Action = EnumAction3D.ActionNull; @@ -7827,7 +7494,6 @@ /// private void buttonItemFX6_3_Click(object sender, EventArgs e) { - //日志记录 LogManager.saveLog(Utility.userName, this.buttonItemFX6_3.Text); globeControl1.Globe.Action = EnumAction3D.TrackPolygon; @@ -7901,10 +7567,8 @@ globeControl1.Globe.Action = EnumAction3D.ActionNull; buttonItemLS5.Checked = !buttonItemLS5.Checked; - if (buttonItemLS5.Checked) - { - globeControl1.Globe.Action = EnumAction3D.SelectObject; - } + if (!buttonItemLS5.Checked) return; + globeControl1.Globe.Action = EnumAction3D.SelectObject; } /// /// 水平面积 @@ -8197,7 +7861,6 @@ LogManager.saveLog(Utility.userName, this.buttonItemFXGJ1.Text); FrmSetFlytoPos.ShowForm(globeControl1); - } /// /// 自定义飞行 @@ -8262,7 +7925,6 @@ globeControl1.Globe.FlyAroundEye(720, EnumFlyRepeatValueType.Degrees); globeControl1.Globe.CurFlyID = 2; } - /// /// 权限管理 /// @@ -8343,21 +8005,6 @@ appUSERRESET.ShowDialog(); } /// - /// 统计数据 - /// - /// - /// - private void buttonItemZTT1_Click(object sender, EventArgs e) - { - ////日志记录 - //LogManager.saveLog(Utility.userName, this.buttonItemZTT1.Text); - - //PATM patm = new PATM(); - //patm.operation = "Statistic"; - //patm.Text = "统计专题图管理"; - //patm.ShowDialog(); - } - /// /// 热点功能统计 /// /// @@ -8460,137 +8107,6 @@ FrmLayerControl frm = new FrmLayerControl(layerTree, globeControl1, globeControl2); frm.Show(this); } - - /// - /// 碰撞审查 - /// - /// - /// - private void buttonItemSH1_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, this.buttonItemSH1.Text); - - this.dataGridViewX4.Size = new System.Drawing.Size(185, 92); - this.dataGridViewX5.Size = new System.Drawing.Size(185, 120); - - layerTemp.RemoveAllFeature(); - clearFeatureHighLight(); - globeControl1.Refresh(); - - sideBar1.Visible = true; - sideBarPanelItem3.Visible = true; - buttonItem1.Checked = true; - controlContainerItem3.Visible = true; - sideBarPanelItem4.Visible = true; - sideBarPanelItem4.Text = "碰撞审查"; - trackflag = "collision"; - controlContainerItem5.Control = panel2; - panel2.Dock = DockStyle.Fill; - panel2.Visible = true; - sideBar1.ExpandedPanel = sideBarPanelItem4; - sideBar1.Refresh(); - - Refresh(); - } - /// - /// 覆土审查 - /// - /// - /// - private void buttonItemSH2_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, this.buttonItemSH2.Text); - - this.dataGridViewX6.Size = new System.Drawing.Size(185, 92); - this.dataGridViewX7.Size = new System.Drawing.Size(185, 120); - - layerTemp.RemoveAllFeature(); - clearFeatureHighLight(); - globeControl1.Refresh(); - sideBar1.Visible = true; - sideBarPanelItem3.Visible = true; - buttonItem1.Checked = true; - controlContainerItem3.Visible = true; - sideBarPanelItem4.Visible = true; - sideBarPanelItem4.Text = "覆土审查"; - trackflag = "ftAnalysis"; - controlContainerItem5.Control = panel4; - panel4.Visible = true; - panel4.Dock = DockStyle.Fill; - sideBar1.ExpandedPanel = sideBarPanelItem4; - sideBar1.Refresh(); - Refresh(); - } - /// - /// 水平净距审查 - /// - /// - /// - private void buttonItemSH3_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, this.buttonItemSH3.Text); - - this.dataGridViewX8.Size = new System.Drawing.Size(190, 92); - this.dataGridViewX9.Size = new System.Drawing.Size(190, 120); - - layerTemp.RemoveAllFeature(); - clearFeatureHighLight(); - globeControl1.Refresh(); - sideBar1.Visible = true; - sideBarPanelItem3.Visible = true; - buttonItem1.Checked = true; - controlContainerItem3.Visible = true; - sideBarPanelItem4.Visible = true; - sideBarPanelItem4.Text = "水平净距审查"; - trackflag = "horizontal"; - controlContainerItem5.Control = panel5; - panel5.Dock = DockStyle.Fill; - panel5.Visible = true; - sideBar1.ExpandedPanel = sideBarPanelItem4; - sideBar1.Refresh(); - Refresh(); - } - /// - /// 垂直净距审查 - /// - /// - /// - private void buttonItemSH4_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, this.buttonItemSH4.Text); - - this.dataGridViewX2.Visible = true; - this.dataGridViewX3.Visible = true; - this.dataGridViewX2.Size = new System.Drawing.Size(185, 92); - this.dataGridViewX3.Size = new System.Drawing.Size(185, 120); - - layerTemp.RemoveAllFeature(); - clearFeatureHighLight(); - - globeControl1.Refresh(); - sideBar1.Visible = true; - sideBarPanelItem3.Visible = true; - buttonItem1.Checked = true; - controlContainerItem3.Visible = true; - sideBarPanelItem4.Visible = true; - sideBarPanelItem4.Text = "垂直净距审查"; - trackflag = "vertical"; - //globeControl1.Globe.Action = EnumAction3D.SelectObject; - panel2.Visible = false; - panel3.Visible = false; - panel5.Visible = false; - panel4.Visible = false; - controlContainerItem5.Control = panel1; - panel1.Dock = DockStyle.Fill; - panel1.Visible = true; - sideBar1.ExpandedPanel = sideBarPanelItem4; - sideBar1.Refresh(); - Refresh(); - } /// /// 综合规划区域审查 /// @@ -8666,9 +8182,7 @@ } if (ds == null) return; - Cyberpipe.Forms.FrmPipelineModelDB frm = new Cyberpipe.Forms.FrmPipelineModelDB(globeControl1, ds); - - //frm.Show(); + FrmPipelineModelDB frm = new FrmPipelineModelDB(globeControl1, ds, false); if (frm.ShowDialog() == DialogResult.OK) { @@ -8700,7 +8214,6 @@ addNodeToLayerManagerNode(frm.rukuLayer); } } - /// /// 坐标转换 /// @@ -8711,7 +8224,7 @@ //保存日志 LogManager.saveLog(Utility.userName, this.buttonItemSJGL5.Text); - Cyberpipe.Forms.FrmProject frm = new Cyberpipe.Forms.FrmProject(); + FrmProject frm = new FrmProject(); frm.ShowDialog(); } /// @@ -8738,7 +8251,6 @@ LogManager.saveLog(Utility.userName, this.buttonItemSJGL6_2.Text); FrmMetadataStat frmmds = new FrmMetadataStat(); - //frmmds.Show(); frmmds.ShowDialog(); } /// @@ -8814,12 +8326,11 @@ if (frm.ShowDialog() == DialogResult.OK) { GSOLayer featureAddLayer = TreeNodeFeatureLayer(); - if (featureAddLayer == null) + if (featureAddLayer != null) { - return; + FrmAddInstrument dlg = new FrmAddInstrument(globeControl1, featureAddLayer); + dlg.Show(this); } - FrmAddInstrument dlg = new FrmAddInstrument(globeControl1, featureAddLayer); - dlg.Show(this); } } /// @@ -8836,16 +8347,15 @@ if (frm.ShowDialog() == DialogResult.OK) { GSOLayer featureAddLayer = TreeNodeFeatureLayer(); - if (featureAddLayer == null) + if (featureAddLayer != null) { - return; + FrmAddPipeFitting dlg = new FrmAddPipeFitting(globeControl1, featureAddLayer); + dlg.Show(this); } - FrmAddPipeFitting dlg = new FrmAddPipeFitting(globeControl1, featureAddLayer); - dlg.Show(this); } } /// - /// 绘制城市七线 + /// 绘制城市七线(完善) /// /// /// @@ -9082,15 +8592,6 @@ List listVectorNames = new List(); for (int i = 0; i < 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] == "供电") - { - continue; - } - * */ if (listVectorNames.Contains(m_PipelineLayerNames[i]) == false) { listVectorNames.Add(m_PipelineLayerNames[i]); @@ -9142,15 +8643,11 @@ GSOFeature f = null; GSOLayer layer = null; globeControl1.Globe.GetSelectObject(i, out f, out layer); - if (f != null) - { - f.Delete(); - if (layer != null) - { - globeControl1.Globe.AddToEditHistroy(layer, f, EnumEditType.Delete); - } - globeControl1.Refresh(); - } + if (f == null) continue; + f.Delete(); + if (layer != null) + globeControl1.Globe.AddToEditHistroy(layer, f, EnumEditType.Delete); + globeControl1.Refresh(); } MessageBox.Show("删除成功!", "提示"); } @@ -9190,10 +8687,8 @@ for (int i = 0; i < m_PipelineLayerNames.Count; i++) { layer = globeControl1.Globe.Layers.GetLayerByCaption(m_PipelineLayerNames[i]); - if (layer != null) - { - listPipelineLayers.Add(layer); - } + if (layer == null) continue; + listPipelineLayers.Add(layer); } //yanxiaowei 重构 GSOFeatures selectFeatures = new GSOFeatures(); @@ -9208,15 +8703,15 @@ ClassGSOTool.CalculateRedLineResult(out table, redSH, selectFeatures, globeControl1, listPipelineLayers, out lineStruct, out featsList); - if (table.Rows.Count != 0) - AddDatagridView(table); - else + if (table.Rows.Count == 0) { MessageBox.Show("没有侵入地块红线的管线数据!", "提示"); dataGridViewX1.DataSource = null; panelOfTable.Visible = false; return; } + else + AddDatagridView(table); } private void AddDatagridView(DataTable table) @@ -9234,23 +8729,25 @@ /// private void toolStripDropDownButton3_Click(object sender, EventArgs e) { - if (dataGridViewX1.Rows.Count == 0) + if (dataGridViewX1.Rows.Count != 0) + { + string strSaveFile = string.Empty; + SaveFileDialog savefiledialog = new SaveFileDialog(); + savefiledialog.Filter = "Excel文件|*.xls,*.xlsx"; + savefiledialog.AddExtension = true; + savefiledialog.FileName = "红线审核"; + if (savefiledialog.ShowDialog() == DialogResult.OK) + strSaveFile = savefiledialog.FileName; + else return; + + ExpEXCEL.ExpToExcel(dataGridViewX1, strSaveFile, "红线审核", lineStruct, featsList); + MessageBox.Show("导出成功!"); + } + else { MessageBox.Show("表格内容为空!", "提示"); return; } - - string strSaveFile = string.Empty; - SaveFileDialog savefiledialog = new SaveFileDialog(); - savefiledialog.Filter = "Excel文件|*.xls,*.xlsx"; - savefiledialog.AddExtension = true; - savefiledialog.FileName = "红线审核"; - if (savefiledialog.ShowDialog() == DialogResult.OK) - strSaveFile = savefiledialog.FileName; - else return; - - ExpEXCEL.ExpToExcel(dataGridViewX1, strSaveFile, "红线审核", lineStruct, featsList); - MessageBox.Show("导出成功!"); } private void sliderItem2_ValueChanged(object sender, EventArgs e) @@ -9287,31 +8784,39 @@ dlg.Multiselect = true; if (dlg.ShowDialog() == DialogResult.OK) { - //自定义lprj文件名,从程序中复制一lprj文件。 - string filePath = dlg.FileName; - string lastname = Path.GetFileName(filePath); - - for (int i = 0; i < dlg.FileNames.Length; i++) + try { - AddLayerData(dlg.FileNames[i]); + for (int i = 0; i < dlg.FileNames.Length; i++) + { + AddLayerData(dlg.FileNames[i]); + } + layerManagerNode.Expand(); + + //放大到新导入的图层 + GSOLayer lyr = globeControl1.Globe.Layers.GetLayerByCaption(newlayername); + if (newlayername != "") + { + GSOFeatures features = lyr.GetAllFeatures(); + GSORect2d rd = lyr.LatLonBounds; + GSOPoint2d rdcenter = rd.Center; + + globeControl1.Globe.JumpToPosition(new GSOPoint3d(rdcenter.X, rdcenter.Y, 0), + EnumAltitudeMode.Absolute, 100); + + globeControl1.Refresh(); + } } - layerManagerNode.Expand(); - - //放大到新导入的图层 - GSOLayer lyr = globeControl1.Globe.Layers.GetLayerByCaption(newlayername); - if (newlayername != "") + catch (Exception ex) { - GSOFeatures features = lyr.GetAllFeatures(); - GSORect2d rd = lyr.LatLonBounds; - GSOPoint2d rdcenter = rd.Center; - - globeControl1.Globe.JumpToPosition(new GSOPoint3d(rdcenter.X, rdcenter.Y, 0), EnumAltitudeMode.Absolute, 100); - - globeControl1.Refresh(); + LogHelper.WriteLog(typeof(MainFrm), ex); } } } - + /// + /// 导入红线(完善) + /// + /// + /// private void buttonItemHX1_Click(object sender, EventArgs e) { LogManager.saveLog(Utility.userName, this.buttonItemHX1.Text); @@ -9339,7 +8844,6 @@ GSOFeatures RedFeatures = layer.GetAllFeatures(); redlinelayername = layer.Caption; - //objRes = layer; if (layer != null) { layerRedRegion = layer; @@ -9362,9 +8866,7 @@ { GSOFeature f = layer.GetAt(j); if (f != null) - { f.Geometry.AltitudeMode = EnumAltitudeMode.RelativeToGround; - } } } layerManagerNode.Expand(); @@ -9426,7 +8928,7 @@ fly.Show(this); } /// - /// 2015-10-17演示代码 红线审核 + /// 红线审核 /// /// /// @@ -9438,7 +8940,6 @@ globeControl1.BeforeSceneRenderEvent -= new BeforeSceneRenderEventHandler(globeControl1_BeforeSceneRenderEvent); globeControl2.BeforeSceneRenderEvent -= new BeforeSceneRenderEventHandler(globeControl2_BeforeSceneRenderEvent); - globeControl1.Globe.FlyToPosition(new GSOPoint3d(120.610963, 31.188121, 50), EnumAltitudeMode.Absolute, -4, 50, 800); globeControl1.Globe.FlyToPointSpeed = 10000000; globeControl1.Globe.Action = EnumAction3D.SelectObject; @@ -9453,11 +8954,8 @@ legendSC.Visible = false; ClearGZData(); GSOLayer redLayer = globeControl1.Globe.Layers.GetLayerByCaption("红线"); - if (redLayer != null) - { - redLayer.Visible = true; - } - + if (redLayer == null) return; + redLayer.Visible = true; } catch (Exception ex) { @@ -9477,7 +8975,6 @@ globeControl1.BeforeSceneRenderEvent -= new BeforeSceneRenderEventHandler(globeControl1_BeforeSceneRenderEvent); globeControl2.BeforeSceneRenderEvent -= new BeforeSceneRenderEventHandler(globeControl2_BeforeSceneRenderEvent); - globeControl1.Globe.Action = EnumAction3D.ActionNull; dataGridViewX1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells; //zhanshi = false; @@ -9488,12 +8985,8 @@ legendSG.Visible = false; ClearGZData(); GSOLayer redLayer = globeControl1.Globe.Layers.GetLayerByCaption("红线"); - if (redLayer != null) - { - redLayer.Visible = false; - } - - + if (redLayer == null) return; + redLayer.Visible = false; } catch (Exception ex) { @@ -9513,7 +9006,6 @@ globeControl1.BeforeSceneRenderEvent -= new BeforeSceneRenderEventHandler(globeControl1_BeforeSceneRenderEvent); globeControl2.BeforeSceneRenderEvent -= new BeforeSceneRenderEventHandler(globeControl2_BeforeSceneRenderEvent); - globeControl1.Globe.Action = EnumAction3D.ActionNull; //zhanshi = false; redSH = false; @@ -9524,45 +9016,15 @@ legendSG.Visible = false; ClearGZData(); GSOLayer redLayer = globeControl1.Globe.Layers.GetLayerByCaption("红线"); - if (redLayer != null) - { - redLayer.Visible = false; - } - - + if (redLayer == null) return; + redLayer.Visible = false; } catch (Exception ex) { //MessageBox.Show("系统运行错误:" + ex.ToString(), "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); } } - /// - /// 右屏添加冰箱数据 - /// - void AddDataToGlobeControl2() - { - - bool modelDataBool = false; - for (int i = globeControl2.Globe.Layers.Count - 1; i >= 0; i--) - { - GSOLayer layer = globeControl2.Globe.Layers[i]; - if (layer.Name.Contains("fttp:")) - { - modelDataBool = true; - break; - } - } - - if (modelDataBool == false) - { - GSOLayer ly = globeControl1.Globe.Layers.GetLayerByCaption("天地图地图"); - globeControl2.Globe.Layers.Add(ly); - } - else - { - return; - } - } + /// /// 双屏对比 /// @@ -9572,7 +9034,6 @@ { try { - globeControl1.BeforeSceneRenderEvent += new BeforeSceneRenderEventHandler(globeControl1_BeforeSceneRenderEvent); globeControl2.BeforeSceneRenderEvent += new BeforeSceneRenderEventHandler(globeControl2_BeforeSceneRenderEvent); @@ -9590,10 +9051,7 @@ GSOLayer redLayer = globeControl1.Globe.Layers.GetLayerByCaption("红线"); if (redLayer != null) - { redLayer.Visible = false; - } - AddDataToGlobeControl2(); } catch (Exception ex) { @@ -9613,7 +9071,6 @@ globeControl1.BeforeSceneRenderEvent -= new BeforeSceneRenderEventHandler(globeControl1_BeforeSceneRenderEvent); globeControl2.BeforeSceneRenderEvent -= new BeforeSceneRenderEventHandler(globeControl2_BeforeSceneRenderEvent); - globeControl1.Globe.Action = EnumAction3D.ActionNull; panelOfTable.Visible = false; //zhanshi = false; @@ -9625,9 +9082,7 @@ ClearGZData(); GSOLayer redLayer = globeControl1.Globe.Layers.GetLayerByCaption("红线"); if (redLayer != null) - { redLayer.Visible = false; - } } catch (Exception ex) { @@ -9643,11 +9098,9 @@ { try { - globeControl1.BeforeSceneRenderEvent -= new BeforeSceneRenderEventHandler(globeControl1_BeforeSceneRenderEvent); globeControl2.BeforeSceneRenderEvent -= new BeforeSceneRenderEventHandler(globeControl2_BeforeSceneRenderEvent); - globeControl1.Globe.Action = EnumAction3D.ActionNull; panelOfTable.Visible = false; //zhanshi = false; @@ -9660,10 +9113,7 @@ GSOLayer redLayer = globeControl1.Globe.Layers.GetLayerByCaption("红线"); if (redLayer != null) - { redLayer.Visible = false; - } - } catch (Exception ex) { @@ -9679,11 +9129,9 @@ { try { - globeControl1.BeforeSceneRenderEvent -= new BeforeSceneRenderEventHandler(globeControl1_BeforeSceneRenderEvent); globeControl2.BeforeSceneRenderEvent -= new BeforeSceneRenderEventHandler(globeControl2_BeforeSceneRenderEvent); - globeControl1.Globe.Action = EnumAction3D.ActionNull; panelOfTable.Visible = false; //zhanshi = false; @@ -9695,11 +9143,8 @@ ClearGZData(); GSOLayer redLayer = globeControl1.Globe.Layers.GetLayerByCaption("红线"); - if (redLayer != null) - { - redLayer.Visible = false; - } - + if (redLayer == null) return; + redLayer.Visible = false; } catch (Exception ex) { @@ -9717,12 +9162,8 @@ { LogManager.saveLog(Utility.userName, this.buttonItem8.Text); - //FrmCompareFeature frmCompareFeature = new FrmCompareFeature(globeControl1, globeControl2, layerTemp, layerTemp2,m_PipelineLayerNames,sgPipeLayersNames); int width = this.Width; FrmCompareFeature.ShowForm(globeControl1, globeControl2, layerTemp, layerTemp2, m_PipelineLayerNames, sgPipeLayersNames, width); - //frmCompareFeature.Location = new Point((this.Width - frmCompareFeature.Width)/2,50); - //frmCompareFeature.Show(this); - } /// /// 红线审核导出图片 @@ -9735,11 +9176,7 @@ Point pt1 = new Point(Convert.ToInt32(0), Convert.ToInt32(0)); Point pt2 = new Point(Convert.ToInt32(panelEx5.Width), Convert.ToInt32(panelEx5.Height)); - /*Point pt = getUpperLeftPoint(pt1, pt2); - Image myImg = new Bitmap(Convert.ToInt32(panelEx5.Width), Convert.ToInt32(panelEx5.Height)); - Graphics g = Graphics.FromImage(myImg); - g.CopyFromScreen(pt, new Point(0, 0), new Size(Convert.ToInt32(panelEx5.Width), Convert.ToInt32(panelEx5.Height))); - */ + int mapWidth = 0; int mapHeight = 0; Point pt = getUpperLeftPoint(pt1, pt2, out mapWidth, out mapHeight); @@ -9782,7 +9219,6 @@ { globeControl1.Globe.Action = EnumAction3D.ActionNull; FrmBSQStatis bsqStatis = new FrmBSQStatis(globeControl1, null); - //FrmBSQStatis bsqStatis = new FrmBSQStatis(); bsqStatis.Show(this); } /// @@ -9795,20 +9231,15 @@ trackflag = "BSQDuoBianXiangStatis"; globeControl1.Globe.Action = EnumAction3D.TrackPolygon; } - - private void btn_check_history_Click(object sender, EventArgs e) { LogManager.saveLog(Utility.userName, this.btn_check_history.Text); if (FrmCheckHistory.isOpen == true) - { return; - } FrmCheckHistory frm = new FrmCheckHistory(globeControl1, globeControl2); frm.addNode += new AddNodeToLayerManagerNode(addNodeToLayerManagerNode); frm.Show(); - } private void buttonItem查看数据_Click(object sender, EventArgs e) @@ -9840,34 +9271,29 @@ { LogManager.saveLog(Utility.userName, this.btn_user_info.Text); - if (!FrmSysUserInfoManger.IS_OPEN) - { - FrmSysUserInfoManger frm = new FrmSysUserInfoManger(); - frm.ShowDialog(); - } + if (FrmSysUserInfoManger.IS_OPEN) return; + FrmSysUserInfoManger frm = new FrmSysUserInfoManger(); + frm.ShowDialog(); } private void btn_role_info_Click(object sender, EventArgs e) { LogManager.saveLog(Utility.userName, this.btn_role_info.Text); - if (FrmRoleInfoManager.IS_OPEN) + if (!FrmRoleInfoManager.IS_OPEN) { - return; + FrmRoleInfoManager frm = new FrmRoleInfoManager(); + frm.ShowDialog(); } - FrmRoleInfoManager frm = new FrmRoleInfoManager(); - frm.ShowDialog(); } private void btn_resc_info_Click(object sender, EventArgs e) { LogManager.saveLog(Utility.userName, this.btn_resc_info.Text); - if (!SysRescInfoManager.IS_OPEN) - { - SysRescInfoManager frm = new SysRescInfoManager(); - frm.ShowDialog(); - } + if (SysRescInfoManager.IS_OPEN) return; + SysRescInfoManager frm = new SysRescInfoManager(); + frm.ShowDialog(); } private void btn_role_resc_Click(object sender, EventArgs e) @@ -9875,51 +9301,33 @@ LogManager.saveLog(Utility.userName, this.btn_role_resc.Text); - if (!FrmRoleRescManager.IS_OPEN) - { - FrmRoleRescManager frm = new FrmRoleRescManager(); - frm.ShowDialog(); - } + if (FrmRoleRescManager.IS_OPEN) return; + FrmRoleRescManager frm = new FrmRoleRescManager(); + frm.ShowDialog(); } private void btn_user_role_Click(object sender, EventArgs e) { LogManager.saveLog(Utility.userName, this.btn_user_role.Text); - if (FrmUserRole.IS_OPEN) + if (!FrmUserRole.IS_OPEN) { - return; + FrmUserRole frm = new FrmUserRole(); + frm.ShowDialog(); } - FrmUserRole frm = new FrmUserRole(); - frm.ShowDialog(); } private void btn_document_info_Click(object sender, EventArgs e) { LogManager.saveLog(Utility.userName, this.btn_document_info.Text); - - //if (FormDocumentManager.IS_OPEN) - //{ - // return; - //} - //FormDocumentManager frm = new FormDocumentManager(); - //frm.ShowDialog(); - - //if (FormDocumentManager.IS_OPEN) - //{ - // return; - //} - //new FormDocumentManager().ShowDialog(); - if (FormDocumentManager.IS_OPEN) + if (!FormDocumentManager.IS_OPEN) { - return; + this.Cursor = Cursors.WaitCursor; + FormDocumentManager frm = new FormDocumentManager(); + frm.changeCursor += new ChangeCursor(changeCursorToDefault); + frm.ShowDialog(); } - this.Cursor = Cursors.WaitCursor; - FormDocumentManager frm = new FormDocumentManager(); - frm.changeCursor += new ChangeCursor(changeCursorToDefault); - frm.ShowDialog(); - } private void changeCursorToDefault() @@ -9936,58 +9344,9 @@ dlg.Multiselect = true; if (dlg.ShowDialog() == DialogResult.OK) { - for (int i = 0; i < dlg.FileNames.Length; i++) + foreach (string strDataPath in dlg.FileNames) { - //this.Cursor = Cursors.WaitCursor; - string strDataPath = dlg.FileNames[i]; - - #region - //string strDataPathPrj = strDataPath.ToLower().Replace(".dwg", ".lprj"); - - //if (File.Exists(strDataPathPrj) == false) - //{ - // if (MessageBox.Show("数据没有空间参考信息,请设置空间参考信息!", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation) == DialogResult.OK) - // { - // String strPath = Application.StartupPath + "\\Coordinate Systems"; - // OpenFileDialog dlgPrj = new OpenFileDialog(); - // dlgPrj.InitialDirectory = strPath; - // dlgPrj.RestoreDirectory = true; - // dlgPrj.Multiselect = false; - // dlg.Filter = "投影文件|*.prj"; - // if (dlg.ShowDialog() == DialogResult.OK) - // { - // this.Cursor = Cursors.WaitCursor; - // string proj4 = GSODataEngineUtility.ConvertEsriPrjFileToProj4(dlg.FileName); - // using (StreamWriter stream = new StreamWriter(strDataPathPrj, false)) - // { - // stream.WriteLine("0prj4" + proj4 + ""); - // } - // AddLayerData(strDataPath); - // //globeControl1.Globe.Layers.Add(strDataPath); - - // this.Cursor = Cursors.Default; - // } - // else - // { - // AddLayerData(strDataPath); - // //globeControl1.Globe.Layers.Add(strDataPath); - // } - // } - // else - // { - // AddLayerData(strDataPath); - // //globeControl1.Globe.Layers.Add(strDataPath); - // } - - //} - //else - //{ - // //globeControl1.Globe.Layers.Add(strDataPath); - // AddLayerData(strDataPath); - //} - #endregion AddLayerData(strDataPath); - //this.Cursor = Cursors.Default; } } @@ -10008,38 +9367,13 @@ { LogManager.saveLog(Utility.userName, this.btn_password_edit.Text); - if (FrmChangePassword.IS_OPEN) + if (!FrmChangePassword.IS_OPEN) { - return; + FrmChangePassword frm = new FrmChangePassword(); + frm.ShowDialog(); } - FrmChangePassword frm = new FrmChangePassword(); - frm.ShowDialog(); } - /// - /// 多孔管线入库 - /// - /// - /// - private void buttonItem9_Click(object sender, EventArgs e) - { - //保存日志 - LogManager.saveLog(Utility.userName, this.buttonItemSJGL4_2.Text); - if (ds == null) - { - MessageBox.Show("请先连接数据库", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); - ConnectDB(null, null); - } - if (ds == null) - return; - - FrmMultiPipelineModelDB frm = new FrmMultiPipelineModelDB(globeControl1, ds); - if (frm.ShowDialog() == DialogResult.OK) - { - addNodeToLayerManagerNode(frm.rukuLayer); - } - //frm.Show(); - } private void 导出CADToolStripMenuItem1_Click(object sender, EventArgs e) { TreeNode node = layerNodeContexMenu.Tag as TreeNode; @@ -10049,44 +9383,42 @@ return; } GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(node.Text.Trim()); - if (layer == null || layer.GetAllFeatures().Length <= 0) + if (layer != null && layer.GetAllFeatures().Length > 0) { - MessageBox.Show("要导出的图层为空", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); - return; - } - string strProjectName = Utility.projectStr; - if (strProjectName != "") - { + string strProjectName = Utility.projectStr; + if (strProjectName == "") return; SaveFileDialog dlg = new SaveFileDialog(); dlg.Filter = "*.dwg|*.dwg|*.dxf|*.dxf"; dlg.FileName = layer.Caption; - if (dlg.ShowDialog(this) == DialogResult.OK) + if (dlg.ShowDialog(this) != DialogResult.OK) return; + globeControl1.Globe.MemoryLayer.SaveAs(dlg.FileName); + GSOLayer newlayer = globeControl1.Globe.Layers.Add(dlg.FileName); + newlayer.RemoveAllFeature(); + int featureCount = layer.GetAllFeatures().Length; + for (int i = 0; i < featureCount; i++) { - globeControl1.Globe.MemoryLayer.SaveAs(dlg.FileName); - GSOLayer newlayer = globeControl1.Globe.Layers.Add(dlg.FileName); - newlayer.RemoveAllFeature(); - int featureCount = layer.GetAllFeatures().Length; - for (int i = 0; i < featureCount; i++) + GSOFeature feature = layer.GetAt(i); + if (feature == null || feature.Geometry == null) continue; + switch (feature.Geometry.Type) { - GSOFeature feature = layer.GetAt(i); - if (feature != null && feature.Geometry != null) - { - if (feature.Geometry.Type == EnumGeometryType.GeoPolyline3D) - { - feature.Geometry.Style = new GSOSimpleLineStyle3D(); - } - else if (feature.Geometry.Type == EnumGeometryType.GeoPolygon3D) - { - feature.Geometry.Style = new GSOSimplePolygonStyle3D(); - } - newlayer.AddFeature(feature); - } + case EnumGeometryType.GeoPolyline3D: + feature.Geometry.Style = new GSOSimpleLineStyle3D(); + break; + case EnumGeometryType.GeoPolygon3D: + feature.Geometry.Style = new GSOSimplePolygonStyle3D(); + break; } - newlayer.Save(); - newlayer.Dataset.DataSource.RemoveDataset(newlayer.Dataset); - globeControl1.Globe.Layers.Remove(newlayer); - MessageBox.Show("导出CAD完成!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); + newlayer.AddFeature(feature); } + newlayer.Save(); + newlayer.Dataset.DataSource.RemoveDataset(newlayer.Dataset); + globeControl1.Globe.Layers.Remove(newlayer); + MessageBox.Show("导出CAD完成!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); + } + else + { + MessageBox.Show("要导出的图层为空", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); + return; } } diff --git a/MainFrm.designer.cs b/MainFrm.designer.cs index fd0ef22..1022ac7 100644 --- a/MainFrm.designer.cs +++ b/MainFrm.designer.cs @@ -195,10 +195,6 @@ this.缓冲区分析ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.无源淹没分析ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.清除分析ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components); - this.FlyToMenu = new System.Windows.Forms.ToolStripMenuItem(); - this.LightMenu = new System.Windows.Forms.ToolStripMenuItem(); - this.AllLightMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.timer1 = new System.Windows.Forms.Timer(this.components); this.layerNodeContexMenu = new System.Windows.Forms.ContextMenuStrip(this.components); this.RefreshLayerFeatureListMenuItem = new System.Windows.Forms.ToolStripMenuItem(); @@ -644,7 +640,6 @@ this.panelEx3.SuspendLayout(); this.RightScreenToolMenu.SuspendLayout(); this.toolRightMenu.SuspendLayout(); - this.contextMenuStrip1.SuspendLayout(); this.layerNodeContexMenu.SuspendLayout(); this.contextMenuStrip2.SuspendLayout(); this.contextMenuStrip3.SuspendLayout(); @@ -1263,7 +1258,7 @@ this.区域分析ToolStripMenuItem, this.清除分析ToolStripMenuItem}); this.toolRightMenu.Name = "toolRightMenu"; - this.toolRightMenu.Size = new System.Drawing.Size(153, 312); + this.toolRightMenu.Size = new System.Drawing.Size(149, 290); // // 量算ToolStripMenuItem // @@ -1276,7 +1271,7 @@ this.水平面积ToolStripMenuItem1, this.地表面积ToolStripMenuItem1}); this.量算ToolStripMenuItem.Name = "量算ToolStripMenuItem"; - this.量算ToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.量算ToolStripMenuItem.Size = new System.Drawing.Size(148, 22); this.量算ToolStripMenuItem.Text = "量算"; // // 水平距离ToolStripMenuItem1 @@ -1339,7 +1334,7 @@ this.前进ToolStripMenuItem, this.删除模型ToolStripMenuItem}); this.编辑ToolStripMenuItem.Name = "编辑ToolStripMenuItem"; - this.编辑ToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.编辑ToolStripMenuItem.Size = new System.Drawing.Size(148, 22); this.编辑ToolStripMenuItem.Text = "编辑"; // // 平移对象ToolStripMenuItem @@ -1415,7 +1410,7 @@ this.绕中心点飞行ToolStripMenuItem, this.绕眼睛飞行ToolStripMenuItem}); this.飞行ToolStripMenuItem.Name = "飞行ToolStripMenuItem"; - this.飞行ToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.飞行ToolStripMenuItem.Size = new System.Drawing.Size(148, 22); this.飞行ToolStripMenuItem.Text = "飞行"; // // 自定义飞行ToolStripMenuItem @@ -1460,7 +1455,7 @@ this.属性标注ToolStripMenuItem, this.标注管理ToolStripMenuItem}); this.标注ToolStripMenuItem.Name = "标注ToolStripMenuItem"; - this.标注ToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.标注ToolStripMenuItem.Size = new System.Drawing.Size(148, 22); this.标注ToolStripMenuItem.Text = "标注"; // // 标高标注ToolStripMenuItem @@ -1547,7 +1542,7 @@ this.关联查询ToolStripMenuItem, this.关键字查询ToolStripMenuItem}); this.查询ToolStripMenuItem.Name = "查询ToolStripMenuItem"; - this.查询ToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.查询ToolStripMenuItem.Size = new System.Drawing.Size(148, 22); this.查询ToolStripMenuItem.Text = "查询"; // // 空间查询ToolStripMenuItem @@ -1633,7 +1628,7 @@ this.附属物分类统计ToolStripMenuItem, this.标识器分类统计ToolStripMenuItem}); this.全区域统计ToolStripMenuItem.Name = "全区域统计ToolStripMenuItem"; - this.全区域统计ToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.全区域统计ToolStripMenuItem.Size = new System.Drawing.Size(148, 22); this.全区域统计ToolStripMenuItem.Text = "全区域统计"; // // 管线长度统计ToolStripMenuItem @@ -1712,7 +1707,7 @@ this.附属物分类统计ToolStripMenuItem1, this.标识器分类统计ToolStripMenuItem1}); this.绘制区域统计ToolStripMenuItem.Name = "绘制区域统计ToolStripMenuItem"; - this.绘制区域统计ToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.绘制区域统计ToolStripMenuItem.Size = new System.Drawing.Size(148, 22); this.绘制区域统计ToolStripMenuItem.Text = "绘制区域统计"; // // 管线长度统计ToolStripMenuItem1 @@ -1786,7 +1781,7 @@ this.道路断面分析ToolStripMenuItem, this.基线剖面分析ToolStripMenuItem}); this.断面分析ToolStripMenuItem.Name = "断面分析ToolStripMenuItem"; - this.断面分析ToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.断面分析ToolStripMenuItem.Size = new System.Drawing.Size(148, 22); this.断面分析ToolStripMenuItem.Text = "断面分析"; // // 横断面分析ToolStripMenuItem @@ -1828,7 +1823,7 @@ this.连通分析ToolStripMenuItem, this.爆管分析ToolStripMenuItem}); this.拓扑分析ToolStripMenuItem.Name = "拓扑分析ToolStripMenuItem"; - this.拓扑分析ToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.拓扑分析ToolStripMenuItem.Size = new System.Drawing.Size(148, 22); this.拓扑分析ToolStripMenuItem.Text = "拓扑分析"; // // 创建拓扑ToolStripMenuItem @@ -1890,7 +1885,7 @@ this.隐藏隧道ToolStripMenuItem, this.删除隧道ToolStripMenuItem}); this.开挖分析ToolStripMenuItem.Name = "开挖分析ToolStripMenuItem"; - this.开挖分析ToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.开挖分析ToolStripMenuItem.Size = new System.Drawing.Size(148, 22); this.开挖分析ToolStripMenuItem.Text = "开挖分析"; // // 多边形开挖ToolStripMenuItem @@ -1942,7 +1937,7 @@ this.可视域分析ToolStripMenuItem, this.可视包络分析ToolStripMenuItem}); this.视域分析ToolStripMenuItem.Name = "视域分析ToolStripMenuItem"; - this.视域分析ToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.视域分析ToolStripMenuItem.Size = new System.Drawing.Size(148, 22); this.视域分析ToolStripMenuItem.Text = "视域分析"; // // 通视分析ToolStripMenuItem @@ -1973,7 +1968,7 @@ this.缓冲区分析ToolStripMenuItem, this.无源淹没分析ToolStripMenuItem}); this.区域分析ToolStripMenuItem.Name = "区域分析ToolStripMenuItem"; - this.区域分析ToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.区域分析ToolStripMenuItem.Size = new System.Drawing.Size(148, 22); this.区域分析ToolStripMenuItem.Text = "区域分析"; // // 附属物分析ToolStripMenuItem @@ -2000,45 +1995,14 @@ // 清除分析ToolStripMenuItem // this.清除分析ToolStripMenuItem.Name = "清除分析ToolStripMenuItem"; - this.清除分析ToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.清除分析ToolStripMenuItem.Size = new System.Drawing.Size(148, 22); this.清除分析ToolStripMenuItem.Text = "清除分析"; this.清除分析ToolStripMenuItem.Click += new System.EventHandler(this.buttonItemClear_Click); // - // contextMenuStrip1 - // - this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.FlyToMenu, - this.LightMenu, - this.AllLightMenuItem}); - this.contextMenuStrip1.Name = "contextMenuStrip1"; - this.contextMenuStrip1.Size = new System.Drawing.Size(125, 70); - // - // FlyToMenu - // - this.FlyToMenu.Name = "FlyToMenu"; - this.FlyToMenu.Size = new System.Drawing.Size(124, 22); - this.FlyToMenu.Text = "定位"; - this.FlyToMenu.Click += new System.EventHandler(this.FlyToMenu_Click); - // - // LightMenu - // - this.LightMenu.Name = "LightMenu"; - this.LightMenu.Size = new System.Drawing.Size(124, 22); - this.LightMenu.Text = "单个闪烁"; - this.LightMenu.Click += new System.EventHandler(this.LightMenu_Click); - // - // AllLightMenuItem - // - this.AllLightMenuItem.Name = "AllLightMenuItem"; - this.AllLightMenuItem.Size = new System.Drawing.Size(124, 22); - this.AllLightMenuItem.Text = "全部闪烁"; - this.AllLightMenuItem.Visible = false; - this.AllLightMenuItem.Click += new System.EventHandler(this.AllLightMenuItem_Click); - // // timer1 // this.timer1.Interval = 500; - this.timer1.Tick += new System.EventHandler(this.timer1_Tick); + //this.timer1.Tick += new System.EventHandler(this.timer1_Tick); // // layerNodeContexMenu // @@ -2684,7 +2648,6 @@ this.buttonItemZTT1.Name = "buttonItemZTT1"; this.buttonItemZTT1.Text = "统计数据"; this.buttonItemZTT1.Visible = false; - this.buttonItemZTT1.Click += new System.EventHandler(this.buttonItemZTT1_Click); // // buttonItemZTT2 // @@ -5514,7 +5477,7 @@ this.dataGridViewX2.ReadOnly = true; this.dataGridViewX2.RowHeadersVisible = false; this.dataGridViewX2.RowTemplate.Height = 23; - this.dataGridViewX2.Size = new System.Drawing.Size(20983, 92); + this.dataGridViewX2.Size = new System.Drawing.Size(21874, 92); this.dataGridViewX2.TabIndex = 11; // // dataGridViewTextBoxColumn10 @@ -5608,7 +5571,7 @@ this.dataGridViewX3.ReadOnly = true; this.dataGridViewX3.RowHeadersVisible = false; this.dataGridViewX3.RowTemplate.Height = 23; - this.dataGridViewX3.Size = new System.Drawing.Size(20982, 127); + this.dataGridViewX3.Size = new System.Drawing.Size(21873, 127); this.dataGridViewX3.TabIndex = 5; this.dataGridViewX3.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.dataGridViewX3_MouseDoubleClick); // @@ -5866,7 +5829,7 @@ this.dataGridViewX8.ReadOnly = true; this.dataGridViewX8.RowHeadersVisible = false; this.dataGridViewX8.RowTemplate.Height = 23; - this.dataGridViewX8.Size = new System.Drawing.Size(91, 92); + this.dataGridViewX8.Size = new System.Drawing.Size(40, 92); this.dataGridViewX8.TabIndex = 11; // // dataGridViewTextBoxColumn12 @@ -5961,7 +5924,7 @@ this.dataGridViewX9.ReadOnly = true; this.dataGridViewX9.RowHeadersVisible = false; this.dataGridViewX9.RowTemplate.Height = 23; - this.dataGridViewX9.Size = new System.Drawing.Size(90, 127); + this.dataGridViewX9.Size = new System.Drawing.Size(39, 127); this.dataGridViewX9.TabIndex = 5; this.dataGridViewX9.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.dataGridViewX9_MouseDoubleClick); // @@ -6819,7 +6782,6 @@ this.panelEx3.ResumeLayout(false); this.RightScreenToolMenu.ResumeLayout(false); this.toolRightMenu.ResumeLayout(false); - this.contextMenuStrip1.ResumeLayout(false); this.layerNodeContexMenu.ResumeLayout(false); this.contextMenuStrip2.ResumeLayout(false); this.contextMenuStrip3.ResumeLayout(false); @@ -6914,10 +6876,6 @@ private DevComponents.DotNetBar.SideBar sideBar1; private DevComponents.DotNetBar.SideBarPanelItem sideBarPanelItem3; private DevComponents.DotNetBar.ExpandableSplitter expandableSplitter1; - private System.Windows.Forms.ContextMenuStrip contextMenuStrip1; - private System.Windows.Forms.ToolStripMenuItem FlyToMenu; - private System.Windows.Forms.ToolStripMenuItem LightMenu; - private System.Windows.Forms.ToolStripMenuItem AllLightMenuItem; private System.Windows.Forms.Timer timer1; private System.Windows.Forms.ContextMenuStrip layerNodeContexMenu; private System.Windows.Forms.ToolStripMenuItem RefreshLayerFeatureListMenuItem; diff --git a/MainFrm.resx b/MainFrm.resx index b5d8c43..bf053b9 100644 --- a/MainFrm.resx +++ b/MainFrm.resx @@ -154,9 +154,6 @@ 375, 94 - - 17, 54 - 461, 17 diff --git a/Cyberpipe.suo b/Cyberpipe.suo index ebd45ee..c2c34b1 100644 --- a/Cyberpipe.suo +++ b/Cyberpipe.suo Binary files differ diff --git a/Forms/FrmPipelineModelDataBase.cs b/Forms/FrmPipelineModelDataBase.cs index a060afb..f833db4 100644 --- a/Forms/FrmPipelineModelDataBase.cs +++ b/Forms/FrmPipelineModelDataBase.cs @@ -1,16 +1,10 @@ using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; using System.Drawing; -using System.Text; using System.Windows.Forms; using GeoScene.Globe; using GeoScene.Engine; using GeoScene.Data; using System.IO; -using System.Collections; -using System.Xml; using System.Text.RegularExpressions; using DevComponents.DotNetBar; @@ -39,11 +33,12 @@ /// private void FrmPipelineModel_Load(object sender, EventArgs e) { + buttonOpen.Visible = isSh; string pipelinetype = Utility.pipelinetype; string[] pipelinetypes = pipelinetype.Split(','); for (int i = 0; i < pipelinetypes.Length; i++) { - pipelineTypeCbo.Items.Add(pipelinetypes[i]);//管线类型 + pipelineTypeCbo.Items.Add(pipelinetypes[i]); } comboBoxExLayer.Items.Clear(); diff --git a/FrmDatabaseParaSetting.cs b/FrmDatabaseParaSetting.cs index 39a4e4f..e4dfe80 100644 --- a/FrmDatabaseParaSetting.cs +++ b/FrmDatabaseParaSetting.cs @@ -123,7 +123,6 @@ { MessageBox.Show("数据库连接成功!", "提示"); } - } else { diff --git a/FrmShResult.cs b/FrmShResult.cs index d11fd66..50a7d8c 100644 --- a/FrmShResult.cs +++ b/FrmShResult.cs @@ -663,7 +663,6 @@ private void FrmShResult_FormClosed(object sender, FormClosedEventArgs e) { mainfrm.boolfrmShResult = false; - } /// /// 一键审核导出 diff --git a/MainFrm.cs b/MainFrm.cs index 2e3ba7f..83acfa1 100644 --- a/MainFrm.cs +++ b/MainFrm.cs @@ -19,7 +19,6 @@ { public partial class MainFrm : Office2007Form { - TreeNode layerManagerNode = null; TreeNode myPlaceNode = null; bool m_bFullScreen = false; @@ -1395,7 +1394,6 @@ private void MainFrm_Load(object sender, EventArgs e) { - this.initGlobalControl(); this.initGlobalMap(); this.initLayerTree(); @@ -1403,13 +1401,11 @@ this.initLayout(); this.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]); jumpToCameraState(x, y, z); - } #endregion @@ -1578,12 +1574,6 @@ 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)); - /*Point pt = getUpperLeftPoint(pt1, pt2); - Image myImg = new Bitmap(Convert.ToInt32(e.Rect.Width), Convert.ToInt32(e.Rect.Height)); - Graphics g = Graphics.FromImage(myImg); - g.CopyFromScreen(pt, new Point(0, 0), new Size(Convert.ToInt32(e.Rect.Width), Convert.ToInt32(e.Rect.Height))); - */ - int mapWidth = 0; int mapHeight = 0; Point pt = getUpperLeftPoint(pt1, pt2, out mapWidth, out mapHeight); @@ -1862,7 +1852,6 @@ { GSOLayer layer = node.Tag as GSOLayer; - //globeControl1.Globe.Layers.Remove(layer); for (int i = globeControl1.Globe.Layers.Count - 1; i >= 0; i--) { if (globeControl1.Globe.Layers[i].Caption == layer.Caption) @@ -2065,7 +2054,6 @@ } } - void globeControl1_MouseWheel(object sender, MouseEventArgs e) { if (globeControl1.Globe.CameraState.Distance > 20000000) @@ -2321,8 +2309,6 @@ case "valvequery": FrmValveStatistics frm = new FrmValveStatistics(globeControl1, polygon, new DataGridViewDelegate(InitDataGridViewX1)); frm.Show(this); - //panelEx6.Visible = true; - //toolStripFeatureLength.Text = ""; globeControl1.Globe.Action = EnumAction3D.ActionNull; break; @@ -2365,7 +2351,6 @@ layerGround.Visible = false; } } - // 清除当前TrackPolygonAnalysis的痕迹 globeControl1.Globe.ClearLastTrackPolygon(); globeControl1.Globe.Action = EnumAction3D.ActionNull; break; @@ -2382,20 +2367,7 @@ globeControl1.Globe.Action = EnumAction3D.ActionNull; break; case "BSQDuoBianXiangStatis": - - //GSOFeature f2 = new GSOFeature(); - //f2.Geometry = e.Polygon; - //f2.Geometry.AltitudeMode = EnumAltitudeMode.Absolute; - //globeControl1.Globe.MemoryLayer.AddFeature(f2); - //f2.Geometry.MoveZ(3); - //workWellLen.Clear(); - //List listBSQ = new List(); - - //GSOFeatures bsqFeatures = PolygonIntersectAnalysis(e.Polygon, "标识器"); - //listBSQ.Add(bsqFeatures); - - //FrmBSQDuoBianXingStatis bsqFrm = new FrmBSQDuoBianXingStatis(workWellLen, globeControl1, listBSQ); - FrmBSQStatis bsqFrm = new FrmBSQStatis(globeControl1, e.Polygon); + FrmBSQStatis bsqFrm = new FrmBSQStatis(globeControl1, e.Polygon); bsqFrm.Show(this); globeControl1.Globe.Action = EnumAction3D.ActionNull; break; @@ -2407,8 +2379,6 @@ } } } - - /// /// 鼠标悬浮提示 /// @@ -2432,20 +2402,19 @@ } catch (Exception ex) { - //LogError.PublishError(ex); + LogError.PublishError(ex); } } - + /// /// 添加管线绘制完成事件, 红线工具绘制完成 /// /// - /// + /// (完善) void globeControl1_MouseDoubleClick(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left) { - if (m_AddPipeLine == true && globeControl1.Globe.Action == EnumAction3D.DrawPolyline)//添加管线 { GSOLayer layerDest = globeControl1.Globe.DestLayerFeatureAdd; @@ -2661,18 +2630,12 @@ { if (e.Button == MouseButtons.Right) { - if (e.X == mouseDownX2 && e.Y == mouseDownY2) - { - RightScreenToolMenu.Show(globeControl2, e.X, e.Y); - } - else - { - return; - } + if (e.X != mouseDownX2 || e.Y != mouseDownY2) return; + RightScreenToolMenu.Show(globeControl2, e.X, e.Y); } } /// - /// + /// (完善) /// /// /// @@ -2912,7 +2875,6 @@ bool result = false; System.Net.WebResponse response = null; - try { System.Net.WebRequest req = System.Net.WebRequest.Create(fileUrl); @@ -3038,7 +3000,7 @@ } /// - /// 拼接气泡表格字符串 + /// 拼接气泡表格字符串(完善) /// /// /// @@ -3233,14 +3195,8 @@ { TreeNode featureAddPipeFitTreenode = GetDestLayerFeatureAddTreeNode(); GSOLayer featureAddLayer = globeControl1.Globe.Layers.GetLayerByCaption(featureAddPipeFitTreenode.Tag.ToString().Split('|')[1]); - if (featureAddLayer != null) - { - return featureAddLayer; - } - else - { - return null; - } + + return featureAddLayer != null ? featureAddLayer : null; } private TreeNode GetDestLayerFeatureAddTreeNode() @@ -3306,7 +3262,6 @@ return null; } - /// /// 地上模式 菜单按钮 /// @@ -3335,22 +3290,16 @@ 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(); - } } /// @@ -3382,13 +3331,9 @@ 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; } @@ -3426,20 +3371,8 @@ globeControl1.Globe.GroundOpaque = 100 - sliderGroundTransSet1.Value; GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(roadLayerName);//("180fd"); if (layer != null) - { layer.Opaque = 100 - sliderGroundTransSet1.Value; - } - //if (buttonItemSPDB.Checked) - //{ - // layer = globeControl2.Globe.Layers.GetLayerByCaption("180fd"); - // if (layer != null) - // { - // layer.Opaque = 100 - sliderGroundTransSet1.Value; - // } - // globeControl2.Globe.GroundOpaque = 100 - sliderGroundTransSet1.Value; - //} optiValue = sliderGroundTransSet1.Value; - //sliderItem1.Value = optiValue; } /// /// 图例 菜单按钮 @@ -3499,21 +3432,7 @@ panel3.Visible = false; sideBar1.ExpandedPanel = sideBarPanelItem3; buttonItemBZ11.Checked = false; - - //20160624 - /* - if (sideBarPanelItem4.Visible == true) - { - sideBar1.Visible = true; - controlContainerItem5.Visible = true; - } - else - { - sideBar1.Visible = false; - } - */ Refresh(); - } } /// @@ -3542,7 +3461,7 @@ int xOld = 0; int yOld = 0; /// - /// 全屏显示功能实现 + /// 全屏显示功能实现(完善) /// private void FullScreen() { @@ -3666,7 +3585,6 @@ FullScreen(); break; case Keys.Escape: - // esc仅仅取消全屏 if (m_bFullScreen) { FullScreen(); @@ -3682,7 +3600,6 @@ } } - private Point getUpperLeftPoint(Point p1, Point p2, out int mapWidth, out int mapHeight) // { Rectangle rc = new Rectangle(); @@ -3695,29 +3612,13 @@ int screenWidth = SystemInformation.WorkingArea.Width; int screenHeight = SystemInformation.WorkingArea.Height; - if (p1.X < x) - rc.X = x; - else - rc.X = p1.X; - - if (p1.Y < y) - rc.Y = y; - else - rc.Y = p1.Y; - + rc.X = p1.X < x ? x : p1.X; + rc.Y = p1.Y < y ? y : p1.Y; p1.X = rc.Left; p1.Y = rc.Top; - if (p2.X > screenWidth) - p2.X = screenWidth; - else - p2.X = p2.X; - - if (p2.Y > screenHeight) - p2.Y = screenHeight; - else - p2.Y = p2.Y; - + p2.X = p2.X > screenWidth ? screenWidth : p2.X; + p2.Y = p2.Y > screenHeight ? screenHeight : p2.Y; rc.Width = p2.X - rc.X; rc.Height = p2.Y - rc.Y; @@ -3728,7 +3629,6 @@ } Image printImage; - private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e) { e.Graphics.DrawImage(printImage, 10, 10); @@ -3742,15 +3642,8 @@ { LogManager.saveLog(Utility.userName, this.btnOutputJPG.Text); - //globeControl1.Globe.Action = EnumAction3D.TrackRect; //绘制矩形模式 - //globeControl1.Globe.TrackRectTool.TrackMode = EnumTrackMode.ScreenTrack; //在屏幕上绘制 Point pt1 = new Point(Convert.ToInt32(0), Convert.ToInt32(0)); Point pt2 = new Point(Convert.ToInt32(panelEx5.Width), Convert.ToInt32(panelEx5.Height)); - /*Point pt = getUpperLeftPoint(pt1, pt2); - Image myImg = new Bitmap(Convert.ToInt32(panelEx5.Width), Convert.ToInt32(panelEx5.Height)); - Graphics g = Graphics.FromImage(myImg); - g.CopyFromScreen(pt, new Point(0, 0), new Size(Convert.ToInt32(panelEx5.Width), Convert.ToInt32(panelEx5.Height))); - */ int mapWidth = 0; int mapHeight = 0; Point pt = getUpperLeftPoint(pt1, pt2, out mapWidth, out mapHeight); @@ -3784,120 +3677,6 @@ } } } - - /// - /// 窗体下方属性表格 右键菜单中的 “定位”菜单 - /// - /// - /// - private void FlyToMenu_Click(object sender, EventArgs e) - { - GSOFeature rowFeature = contextMenuStrip1.Tag as GSOFeature; - if (rowFeature == null) - return; - - - 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); - } - else - { - globeControl1.Globe.FlyToFeature(rowFeature, 0, 45, 3); - } - LightMenu_Click(sender, e); - - } - - /// - /// 表格中右键 “单个闪烁” 菜单 - /// - /// - /// - private void LightMenu_Click(object sender, EventArgs e) - { - flashflag = "single"; - timer1.Start(); - } - /// - /// 表格中右键 “全部闪烁” 菜单 - /// - /// - /// - private void AllLightMenuItem_Click(object sender, EventArgs e) - { - flashflag = "all"; - timer1.Start(); - } - - /// - /// 使用timer实现管线的闪烁效果 - /// - /// - /// - private void timer1_Tick(object sender, EventArgs e) - { - GSOFeature rowFeature = contextMenuStrip1.Tag as GSOFeature; - if (rowFeature == null) - return; - - if (count < 40) - { - count++; - if (flashflag == "single") - { - if (rowFeature != null) - { - if (count % 2 != 0) - { - rowFeature.HighLight = true; - globeControl1.Refresh(); - } - else - { - rowFeature.HighLight = false; - globeControl1.Refresh(); - } - } - } - else if (flashflag == "all") - { - GSOFeatures feats = Utility.Table2Features(dataGridViewX1.DataSource as DataTable, m_CurrentQueryLayer, globeControl1); - if (feats.Length > 0) - { - if (count % 2 != 0) - { - for (int i = 0; i < feats.Length; i++) - { - GSOFeature tempfeat = feats[i]; - tempfeat.HighLight = true; - } - - globeControl1.Refresh(); - } - else - { - for (int i = 0; i < feats.Length; i++) - { - GSOFeature tempfeat = feats[i]; - tempfeat.HighLight = false; - } - globeControl1.Refresh(); - } - } - } - } - else - { - timer1.Stop(); - count = 0; - } - } /// /// 图层目录树 右键菜单中的 目标图层 菜单 /// @@ -3910,7 +3689,6 @@ TreeNode node = layerNodeContexMenu.Tag as TreeNode; FeatureAddLayerMenuItem.Checked = true; GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(node.Tag.ToString().Split('|')[1]); - //GSOLayer layer = globeControl1.Globe.Layers.GetLayerByID((int)node.Tag); globeControl1.Globe.DestLayerFeatureAdd = layer; } } @@ -3954,7 +3732,6 @@ layer.Dataset.Save(); } - #region wxl feature的公共方法 /// /// 查找指定图层中在 指定范围内的feature对象集合 @@ -3966,24 +3743,10 @@ { GSOFeatures feats = new GSOFeatures(); GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(layername); - if (layer == null) - { - return feats; - } + if (layer == null)return feats; GSOFeatureLayer flayer = layer as GSOFeatureLayer; - if (flayer != null) - { - GSOFeatureDataset fdataset = flayer.Dataset as GSOFeatureDataset; - } - - if (polygon == null) - { - feats = flayer.GetAllFeatures(); - } - else - { - feats = flayer.FindFeaturesInPolygon(polygon, false); - } + if (flayer == null) return feats; + feats = polygon == null ? flayer.GetAllFeatures() : flayer.FindFeaturesInPolygon(polygon, false); return feats; } #endregion @@ -4014,10 +3777,7 @@ if (globeControl1.Globe.Action != EnumAction3D.NormalHit) { buttonItemFX3_6.Checked = false; - // ClearConnexityAnalysis(); - buttonItemFX3_5.Checked = false; - // ClearCloseValvesAnalysis(); } if (globeControl1.Globe.Action != EnumAction3D.TrackPolygon) { @@ -4025,7 +3785,6 @@ buttonItemFX4_1.Checked = false; } } - /// /// 主窗体关闭事件处理 /// @@ -4033,21 +3792,13 @@ /// private void MainFrm_FormClosing(object sender, FormClosingEventArgs e) { - if (MessageBox.Show("是否退出系统?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) - { e.Cancel = true; - } else - { globeControl1.Globe.MemoryLayer.SaveAs(Application.StartupPath + "/MyPlace.kml"); - } - - //saveLayerList(layerManagerNode.Nodes); - //注销id号为103的热键设定 - // UnregisterHotKey(Handle, 103); } + #region 完善 /// /// 垂直净距分析 功能界面中的 选择图层复选框 选中状态改变事件处理 /// @@ -4198,12 +3949,10 @@ } } } - Dictionary featCount = new Dictionary(); Dictionary featLenth = new Dictionary(); Dictionary m_FeaturesWithBianhao = new Dictionary();//记录编号和对应的标注点的位置 GSOFeatures polygonJingJuAnalysises = new GSOFeatures(); - /// /// 垂直净距分析 功能界面中的 开始分析按钮 事件处理 /// @@ -4293,7 +4042,6 @@ globeControl1.Refresh(); this.Cursor = Cursors.Default; } - /// /// 在指定的两点组成的线的中间添加一个marker对象,并将marker对象添加到指定的图层中 /// @@ -4357,7 +4105,6 @@ return dismarker.Position; } - /// /// 计算指定feature对象与除了该feature所在图层之外的 所有管线图层中的所有feature对象 的垂直距离 并在表格中记录符合要求的管线 /// @@ -4411,8 +4158,7 @@ double dDist = -1; dDist = globeControl1.Globe.Analysis3D.ComputeHorizonDistance(line1, line2, out pntIntersect1, out pntIntersect2, out pntProIntersect1, out pntProIntersect2, false); - //dDist = globeControl1.Globe.Analysis3D.ComputeVerticalDistance(line1, line2, out pntIntersect1, out pntIntersect2, out pntProIntersect1, out pntProIntersect2, false); - + if (dDist > -1) { dDist = Math.Abs(pntIntersect1.Z - pntIntersect2.Z) - pipeStyle1.Radius - pipeStyle2.Radius;//获得净距值 @@ -4472,25 +4218,6 @@ } } } - - //double verticalDis = dDist; - //dDist = globeControl1.Globe.Analysis3D.ComputeVerticalDistance(line1, line2, out pntIntersect1, out pntIntersect2, out pntProIntersect1, out pntProIntersect2, false); - //if (dDist > -1) - //{ - // dDist = Math.Abs(pntIntersect1.Z - pntIntersect2.Z) - pipeStyle1.Radius - pipeStyle2.Radius; - // if (dDist < horizontalDistance) - // { - // 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 = verticalDis.ToString("0.00"); - // dataGridViewAnalysisResult.Rows[idx].Cells[5].Value = dDist.ToString("0.00"); - // } - //} } if (m_FeaturesWithBianhao.ContainsKey(selectedFeature.Name + "-" + feats2[j].Name) == false) @@ -4545,7 +4272,6 @@ } } } - /// /// 水平净距分析 功能界面中 开始分析按钮 的事件处理 /// @@ -4629,8 +4355,6 @@ globeControl1.Refresh(); this.Cursor = Cursors.Default; } - - /// /// 计算指定feature对象与除了该feature所在图层之外的 所有管线图层中的所有feature对象 的水平距离 并记录符合要求的管线 功能 /// @@ -4820,7 +4544,6 @@ else { MessageBox.Show("请选中要进行碰撞分析的管线!", "提示"); - //globeControl1.Globe.Action = EnumAction3D.SelectObject; } globeControl1.Refresh(); this.Cursor = Cursors.Default; @@ -4845,9 +4568,6 @@ } } } - - - /// /// 覆土分析功能操作界面中的 选择管线 复选框选中状态改变事件处理 /// @@ -5071,11 +4791,9 @@ else { MessageBox.Show("请选中要进行覆土分析的管线!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); - //globeControl1.Globe.Action = EnumAction3D.SelectObject; } this.Cursor = Cursors.Default; } - /// /// 覆土分析中 表格的 双击定位 功能 /// @@ -5155,8 +4873,6 @@ //Refresh(); } - - /// /// 垂直净距分析 功能界面中 清除分析结果按钮 事件处理 /// @@ -5201,7 +4917,6 @@ layerTemp.RemoveAllFeature(); globeControl1.Refresh(); } - /// /// 垂直净距分析功能界面中 关闭按钮 事件处理 /// @@ -5262,7 +4977,6 @@ Refresh(); } - /// /// 导出指定DataGridView控件中的内容 /// @@ -5352,7 +5066,6 @@ } } } - /// /// 垂直净距分析功能界面中 导出Excel按钮 事件处理 /// @@ -5384,103 +5097,7 @@ { MessageBox.Show("表格内容为空!", "提示"); } - } - - - - /// - /// 添加指定路径下的数据 功能 - /// - /// - /// - private object AddLayerData(string strDataPath) - { - object objRes = null; - if (Path.GetExtension(strDataPath).ToLower().Equals(".kml")) - { - GSOLayer layer = globeControl1.Globe.Layers.Add(strDataPath); - objRes = layer; - if (layer != null) - { - 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; - // 注意用insert不要用add,因为后加入的图层在上层 - //layerManagerNode.Nodes.Add(node); - layerManagerNode.Nodes.Insert(0, node); - } - newlayername = layer.Caption; - } - else if (GSOUtility.IsDatasetSupportTerrain(strDataPath)) - { - GSOTerrain terrain = globeControl1.Globe.Terrains.Add(strDataPath); - objRes = terrain; - if (terrain != null) - { - TreeNode node = new TreeNode(); - node.Tag = terrain; - node.Text = terrain.Caption; - node.ImageIndex = 0; - node.SelectedImageIndex = 0; - node.Checked = terrain.Visible; - // 注意用insert不要用add,因为后加入的图层在上层 - // terrainManagerNode.Nodes.Add(node); - layerManagerNode.Nodes.Insert(0, node); - } - newlayername = terrain.Caption; - } - else if (Path.GetExtension(strDataPath).ToLower().Equals(".dxf")) - { - GSOLayer layer = globeControl1.Globe.Layers.Add(strDataPath); - objRes = layer; - if (layer != null) - { - GSODataset dataset = layer.Dataset; - CheckDatasetGeoReference(layer.Dataset, strDataPath); - CheckDatasetGeoReference(layer.Dataset, strDataPath); - TreeNode node = new TreeNode(); - node.Tag = layer; - node.Text = layer.Dataset.Caption; - node.ImageIndex = 0; - node.SelectedImageIndex = 0; - node.Checked = layer.Visible; - // 注意用insert不要用add,因为后加入的图层在上层 - //layerManagerNode.Nodes.Add(node); - layerManagerNode.Nodes.Insert(0, node); - } - newlayername = layer.Caption; - } - else - { - GSOLayer layer = globeControl1.Globe.Layers.Add(strDataPath); - objRes = layer; - if (layer != null) - { - GSODataset dataset = layer.Dataset; - - CheckDatasetGeoReference(layer.Dataset, strDataPath); - CheckDatasetGeoReference(layer.Dataset, strDataPath); - //CheckDatasetGeoReference(dataset); - TreeNode node = new TreeNode(); - node.Tag = layer; - node.Text = layer.Dataset.Caption; - node.ImageIndex = 0; - node.SelectedImageIndex = 0; - node.Checked = layer.Visible; - // 注意用insert不要用add,因为后加入的图层在上层 - //layerManagerNode.Nodes.Add(node); - layerManagerNode.Nodes.Insert(0, node); - } - newlayername = layer.Caption; - } - return objRes; - } - + } /// /// 碰撞分析功能界面中 选择管线复选框 选中状态改变事件处理 /// @@ -5600,7 +5217,6 @@ //globeControl1.Globe.Action = EnumAction3D.SelectObject; } } - /// /// 碰撞分析功能界面中 清除分析结果按钮 事件处理 /// @@ -5638,344 +5254,6 @@ MessageBox.Show("表格内容为空!", "提示"); } } - - ///// - ///// 区域分析 菜单 - ///// - ///// - ///// - //private void buttonItem50_Click(object sender, EventArgs e) - //{ - // buttonItem50.Checked = !buttonItem50.Checked; - // ribbonBarQY.Visible = buttonItem50.Checked; - // ribbonBarQY.Location = new Point(0, 0); - //} - - - /// - /// 连接数据库 菜单事件处理 - /// - /// - /// - private void ConnectDB(object sender, EventArgs e) - { - FrmDatabaseParaSetting frm = new FrmDatabaseParaSetting(globeControl1); - if (frm.ShowDialog() == DialogResult.OK) - { - ds = FrmDatabaseParaSetting.ds; - if (ds != null) - { - ds.IsCloseSaved = false; - } - } - } - - /// - /// 根据指定图层创建图层节点并将节点添加到图层管理节点的子节点集合中 - /// - /// - private void addNodeToLayerManagerNode(GSOLayer layer) - { - if (layer != null) - { - 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; - - if (!layerManagerNode.Nodes.Contains(node)) - { - layerManagerNode.Nodes.Insert(0, node); - layerManagerNode.Expand(); - } - } - } - - /// - /// 获取指定图层中最后一个feature对象的名称对应的整数 - /// - /// - /// - public int getLabelName(GSOLayer layer) - { - int nid = -1; - if (layer.GetAllFeatures().Length > 0) - { - string id = layer.GetAllFeatures()[layer.GetAllFeatures().Length - 1].Name; - - int.TryParse(id, out nid); - } - else - { - nid = 0; - } - return nid; - } - /// - /// 设置除指定标注图层之外的所有标注图层不可见 - /// - /// - public void setMarkerLayerUnVisible(string layerName) - { - string[] markerStrs = new string[10]; - markerStrs[0] = "标高标注"; - markerStrs[1] = "管径标注"; - markerStrs[2] = "埋深标注"; - markerStrs[3] = "坐标标注"; - markerStrs[4] = "坡度标注"; - markerStrs[5] = "属性标注"; - markerStrs[6] = "自定义标注"; - markerStrs[7] = "距离标注"; - markerStrs[8] = "红线工具"; - markerStrs[9] = "扯旗标注"; - - for (int i = 0; i < markerStrs.Length; i++) - { - GSOLayer markerLayer = globeControl1.Globe.Layers.GetLayerByCaption(markerStrs[i]); - if (markerLayer != null) - { - if (markerStrs[i] != layerName) - { - 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) - { - markerFeature.Visible = false; - } - } - if (layerMarkerTree.Nodes[0].Nodes.Count > i) - { - layerMarkerTree.Nodes[0].Nodes[i].Checked = true; - } - } - } - } - } - - /// - /// 判断选中的对象是否为管线 - /// - /// 被选中管线 - /// 返回一根线 - private GSOFeature IsPipeLineOfSelectedObj() - { - GSOFeature resFeature = null; - if (globeControl1.Globe.SelObjectCount < 1) - { - return null; - } - GSOLayer resLayer = null; - globeControl1.Globe.GetSelectObject(0, out resFeature, out resLayer); - if (resFeature == null) - return null; - - GSOGeoPolyline3D line1 = resFeature.Geometry as GSOGeoPolyline3D; - if (line1 == null) - { - return null; - } - GSOPipeLineStyle3D pipeStyle1 = line1.Style as GSOPipeLineStyle3D; - if (pipeStyle1 == null) - { - return null; - } - return resFeature; - } - - /// - /// 图层节点树中 节点 右键单击事件处理 - /// - /// - /// - private void layerMarkerTree_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e) - { - if (e.Button == MouseButtons.Right) - { - if (e.Node.Text == "标注管理" || e.Node.Text == "传感器管理") - { - return; - } - else if (e.Node.Parent.Text == "标注管理") - { - layerMarkerTree.SelectedNode = e.Node; - contextMenuStrip2.Show(layerMarkerTree, e.X, e.Y); - contextMenuStrip2.Tag = e.Node; - } - else if (e.Node.Parent.Text == "传感器管理") - { - layerSensorTree.SelectedNode = e.Node; - contextMenuStrip2.Show(layerSensorTree, e.X, e.Y); - contextMenuStrip2.Tag = e.Node; - } - else - { - if (e.Node.Tag is GSOFeature) - { - if (e.Node.Parent.Parent.Text == "标注管理") - { - layerMarkerTree.SelectedNode = e.Node; - contextMenuStrip3.Show(layerMarkerTree, e.X, e.Y); - contextMenuStrip3.Tag = e.Node; - } - else if (e.Node.Parent.Parent.Text == "传感器管理") - { - layerSensorTree.SelectedNode = e.Node; - contextMenuStrip3.Show(layerSensorTree, e.X, e.Y); - contextMenuStrip3.Tag = e.Node; - } - } - } - } - } - - /// - /// 标注管理、传感器管理 图层目录树的右键菜单中的 刷新列表 菜单 - /// - /// - /// - private void toolStripMenuItem1_Click(object sender, EventArgs e) - { - TreeNode node = contextMenuStrip2.Tag as TreeNode; - TreeNode parentNode = node.Parent; - Int32 nIndex = node.Index; - - if (parentNode.Text == "标注管理" || parentNode.Text == "传感器管理") - { - RefreshTreeNodeLayerFeatureList(node); - } - } - /// - /// 给指定的图层节点添加代表feature对象的子节点 - /// - /// - private void RefreshTreeNodeLayerFeatureList(TreeNode layerTreeNode) - { - layerTreeNode.Nodes.Clear(); - GSOLayer layer = (GSOLayer)layerTreeNode.Tag; - // 只将类型为内存数据集的图层列出,如果是其它类型的数据集可能数据量太大,没发显示在树控件中 - if (layer.Dataset is GSOFeatureDataset) - { - VisitFeature3Ds(layer.GetAllFeatures(), layerTreeNode); - } - } - - /// - /// 标注管理、传感器管理 图层目录树的右键菜单中的 移除所有 菜单 - /// - /// - /// - private void toolStripMenuItem2_Click(object sender, EventArgs e) - { - TreeNode node = contextMenuStrip3.Tag as TreeNode; - GSOFeature feature3d = node.Tag as GSOFeature; - if (node == null) - { - return; - } - if (feature3d != null) - { - feature3d.Delete(); - globeControl1.Globe.Refresh(); - node.Remove(); - } - } - - /// - /// 图层目录树的 节点对应的复选框选中状态改变事件处理 - /// - /// - /// - private void layerMarkerTree_AfterCheck(object sender, TreeViewEventArgs e) - { - if (e.Action != TreeViewAction.Unknown) - { - CheckTreeNode(e.Node, e.Node.Checked); - } - } - /// - /// 改变指定节点对应的复选框的选中状态 - /// - /// - /// - private void CheckTreeNode(TreeNode node, Boolean bChecked) - { - CheckChildTreeNode(node, bChecked); - globeControl1.Globe.Refresh(); - } - /// - /// 改变指定节点的子节点对应的复选框的选中状态 - /// - /// - /// - private void CheckChildTreeNode(TreeNode node, Boolean bChecked) - { - if (node == null) - { - return; - } - if (node.Tag != null) - { - if (node.Tag.GetType() == typeof(GSOFeatureFolder) || node.Tag.GetType() == typeof(GSOFeature)) - { - ((GSOFeature)node.Tag).SetVisibleDirectly(bChecked); - } - else - { - GSOLayer curLayer = node.Tag as GSOLayer; - GSOTerrain curTerrain = node.Tag as GSOTerrain; - if (curLayer != null) - { - curLayer.Visible = bChecked; - } - else if (curTerrain != null) - { - curTerrain.Visible = bChecked; - } - } - } - // 递归处理子节点 - for (int i = 0; i < node.Nodes.Count; i++) - { - node.Nodes[i].Checked = bChecked; - CheckChildTreeNode(node.Nodes[i], bChecked); - } - } - /// - /// 标注管理、传感器管理 目录树中的feature节点的右键菜单中的 删除 菜单 - /// - /// - /// - private void 删除ToolStripMenuItem1_Click(object sender, EventArgs e) - { - TreeNode node = contextMenuStrip2.Tag as TreeNode; - GSOLayer l = globeControl1.Globe.Layers.GetLayerByCaption(node.Text); - if (l != null) - { - l.RemoveAllFeature(); - node.Nodes.Clear(); - globeControl1.Refresh(); - } - } - - //定时检查传感器的状态 - public System.Windows.Forms.Timer timerOfSensor = null; - - /// /// 碰撞分析 功能界面中 关闭按钮 事件处理 /// @@ -5984,7 +5262,6 @@ private void buttonX7_Click_1(object sender, EventArgs e) { trackflag = ""; - globeControl1.Globe.Action = EnumAction3D.ActionNull; sideBarPanelItem4.Visible = false; panel2.Visible = false; @@ -5994,14 +5271,9 @@ dataGridViewX4.Rows.Clear(); dataGridViewX5.Rows.Clear(); if (buttonItem1.Checked) - { sideBar1.ExpandedPanel = sideBarPanelItem3; - } else - { sideBar1.Visible = false; - - } Refresh(); } /// @@ -6193,14 +5465,8 @@ comboBoxLayer.SelectedIndex = -1; dataGridViewLineList.Rows.Clear(); dataGridViewAnalysisResult.Rows.Clear(); - //if (buttonItem1.Checked) - //{ - // sideBar1.ExpandedPanel = sideBarPanelItem3; - //} - //else - //{ + sideBar1.Visible = false; - //} Refresh(); } /// @@ -6225,9 +5491,7 @@ globeControl1.Globe.JumpToPosition(point3d, EnumAltitudeMode.Absolute, 5); } else - { globeControl1.Globe.JumpToFeature(rowFeature, 5); - } } } } @@ -6308,897 +5572,6 @@ } } } - - /// - /// 一键审核---导入数据 - /// - /// - /// - private void buttonItem127_Click_2(object sender, EventArgs e) - { - LogManager.saveLog(Utility.userName, "打开数据"); - - try - { - - string dbIp = Utility.sgdbip; - string database = Utility.sgdbname; - string user = Utility.sgdbuser; - string pass = Utility.sgdbpwd; - shds = globeControl1.Globe.DataManager.OpenOracleDataSource(dbIp + "/" + database, "", "", user, pass); - if (shds == null) - { - MessageBox.Show("数据库连接失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); - } - Cyberpipe.Forms.FrmPipelineModelDataOneStep frm = new Cyberpipe.Forms.FrmPipelineModelDataOneStep(globeControl1, shds, layerTree); - if (frm.ShowDialog() == DialogResult.OK) - { - addNodeToLayerManagerNode(frm.rukuLayer); - } - } - catch (Exception ex) - { - LogError.PublishError(ex); - MessageBox.Show("内存过载请清理内存,并重新启动规划分析!", "提示"); - return; - } - - } - - /// - ///自动导出图片 - /// - /// - /// - private void buttonItem130_Click_1(object sender, EventArgs e) - { - LogManager.saveLog(Utility.userName, "导出审核图"); - - Point pt1 = new Point(Convert.ToInt32(0), Convert.ToInt32(0)); - Point pt2 = new Point(Convert.ToInt32(panelEx5.Width), Convert.ToInt32(panelEx5.Height)); - /*Point pt = getUpperLeftPoint(pt1, pt2); - Image myImg = new Bitmap(Convert.ToInt32(panelEx5.Width), Convert.ToInt32(panelEx5.Height)); - Graphics g = Graphics.FromImage(myImg); - g.CopyFromScreen(pt, new Point(0, 0), new Size(Convert.ToInt32(panelEx5.Width), Convert.ToInt32(panelEx5.Height))); - */ - - 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 = System.IO.Path.GetExtension(dlg.FileName);//扩展名 - switch (extension) - { - case ".jpg": - myImg.Save(dlg.FileName, System.Drawing.Imaging.ImageFormat.Jpeg); - break; - case ".png": - myImg.Save(dlg.FileName, System.Drawing.Imaging.ImageFormat.Png); - break; - case ".bmp": - myImg.Save(dlg.FileName, System.Drawing.Imaging.ImageFormat.Bmp); - break; - case ".gif": - myImg.Save(dlg.FileName, System.Drawing.Imaging.ImageFormat.Gif); - break; - default: - break; - } - } - } - /// - /// 一键审核功能 - /// - /// - /// - private void buttonItem128_Click(object sender, EventArgs e) - { - LogManager.saveLog(Utility.userName, this.buttonItem128.Text); - //垂直净距标准 - - frmSh = new FrmYJSHTC(globeControl1, globeControl2, layerTree); - - if (frmSh.ShowDialog() == DialogResult.OK) - { - frmWait = new FrmWait("一键审核……"); - frmWait.Location = new Point(this.Width - frmWait.Width - 10, this.Height - frmWait.Height - 50); - frmWait.Owner = this; - frmWait.Show(); - Thread thread = new Thread(new ThreadStart(doWork)); - thread.IsBackground = true; - thread.Start(); - } - } - - void doWork() - { - FrmShResult frmShResult = null; - - double dVerticalJingJuBiaoZhun = 1, dHorizontalJingJuBiaoZhun = 1; - if (frmSh.rukuLayer != null) - { - #region - this.Invoke((EventHandler)delegate - { - try - { - List managerLayerList = new List(); - for (int i = 0; i < layerManagerNode.Nodes.Count; i++) - { - managerLayerList.Add(layerManagerNode.Nodes[i].Text); - } - if (!managerLayerList.Contains(frmSh.rukuLayer.Caption)) - { - TreeNode node = new TreeNode(); - node.Tag = frmSh.rukuLayer; - node.Text = frmSh.rukuLayer.Dataset.Caption; - node.ImageIndex = 0; - node.SelectedImageIndex = 0; - node.Checked = frmSh.rukuLayer.Visible; - layerManagerNode.Nodes.Insert(0, node); - layerManagerNode.Expand(); - } - } - catch (Exception ex) - { - MessageBox.Show(ex.Message, "提示"); - } - }); - #endregion - - shlayername = frmSh.rukuLayer.Name; - globeControl1.Refresh(); - } - - if (frmShResult != null && !frmShResult.IsDisposed) - { - try - { - clearFeatureHighLight(); - ClearRedlineAnalyseResult(); - frmShResult.Close(); - } - catch (Exception ex) - { - MessageBox.Show(ex.Message); - } - } - - frmShResult = new FrmShResult(dVerticalJingJuBiaoZhun, dHorizontalJingJuBiaoZhun, shlayername, globeControl1, m_PipelineLayerNames); - if (boolfrmShResult == false) - { - frmShResult.Location = new Point(this.Width - frmShResult.Width - 10, this.Height - frmShResult.Height - 50); - frmShResult.Owner = this; - //一键审核实际计算步骤 - frmShResult.analysis(); - - //MainFrm窗体显示控制,回到一键审核Tab - this.Invoke((EventHandler)delegate - { - frmShResult.Show(); - frmWait.Close(); - //将tab页恢复到一键审核 - ribbonTabItem11.Checked = true; - try - { - globeControl1.Globe.Action = EnumAction3D.ActionNull; - //zhanshi = false; - splitContainer1.Panel2Collapsed = true; - - panelOfTable.Visible = false; - legendSC.Visible = false; - legendSG.Visible = false; - - GSOLayer redLayer = globeControl1.Globe.Layers.GetLayerByCaption("红线"); - if (redLayer != null) - { - redLayer.Visible = false; - } - } - catch (Exception ex) - { - MessageBox.Show("系统运行错误:" + ex.ToString(), "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); - } - - }); - - boolfrmShResult = true; - } - else - { - - } - } - - - /// - /// 清除渲染结果 - /// - public void ClearRedlineAnalyseResult() - { - for (int i = 0; i < globeControl1.Globe.Layers.Count; i++) - { - GSOLayer layer = globeControl1.Globe.Layers[i]; - if (layer.Caption == "tempLgdData") - { - layer.RemoveAllFeature(); - } - } - - layerTemp.RemoveAllFeature(); - globeControl1.Refresh(); - } - /// - /// 已审核的图层 - /// - /// - /// - private void buttonItem132_Click_1(object sender, EventArgs e) - { - //保存日志 - LogManager.saveLog(Utility.userName, this.buttonItem132.Text); - - if (shds == null) - { - //没连的话,直接连接审核库; //审核库配置读配置文件 - string dbIp = Utility.sgdbip; - string database = Utility.sgdbname; - string user = Utility.sgdbuser; - string pass = Utility.sgdbpwd; - - /* - if (!Utility.isNetworkConnectionSuccess(dbIp.Trim())) - { - MessageBox.Show("网络连接失败!", "提示"); - return; - } - */ - - shds = globeControl1.Globe.DataManager.OpenOracleDataSource(dbIp + "/" + database, "", "", user, pass); - if (shds == null) - { - MessageBox.Show("数据库连接失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); - } - } - Cyberpipe.Forms.FrmShLayers frm = new Cyberpipe.Forms.FrmShLayers(globeControl1, shds); - frm.Show(); - //if (frm.ShowDialog() == DialogResult.OK) - //{ - // addNodeToLayerManagerNode(frm.rukuLayer); - //} - //if (frm.rukuLayer != null) - //{ - // shlayername = frm.rukuLayer.Name; - //} - - } - /// - /// 审核入库 - /// - /// - /// - private void buttonItem133_Click_1(object sender, EventArgs e) - { - LogManager.saveLog(Utility.userName, "审核入库"); - FrmShRK frmShrk = new FrmShRK(globeControl1); - frmShrk.Show(); - } - /// - /// 模拟设计修改 - /// - /// - /// - private void buttonItem134_Click_1(object sender, EventArgs e) - { - LogManager.saveLog(Utility.userName, "模拟设计修改"); - - frmModify = new FrmMnModify(globeControl1, shlayername, shresultLists); - - if (boolfrmModify == false) - { - frmModify.Owner = this; - frmModify.Location = new Point(this.Width - frmModify.Width - 10, this.Height - frmModify.Height - 50); - frmModify.Show(); - boolfrmModify = true; - } - else - { - - } - - } - - - - /// - /// 一键审核中调节透明度 - /// - /// - /// - private void sliderItem1_ValueChanged(object sender, EventArgs e) - { - LogManager.saveLog(Utility.userName, this.sliderItem1.Text); - - globeControl1.Globe.GroundOpaque = 100 - sliderItem1.Value; - GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(roadLayerName);//("180fd"); - if (layer != null) - { - layer.Opaque = 100 - sliderItem1.Value; - } - - optiValue = sliderItem1.Value; - } - /// - /// 红线审核中的透明度分析 - /// - /// - /// - private void sliderItem3_ValueChanged(object sender, EventArgs e) - { - LogManager.saveLog(Utility.userName, this.sliderItem3.Text); - - globeControl1.Globe.GroundOpaque = 100 - sliderItem3.Value; - GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(roadLayerName);//("180fd"); - if (layer != null) - { - layer.Opaque = 100 - sliderItem3.Value; - } - optiValue = sliderItem3.Value; - } - - #region yanxiaowei - //初始化DataGridViewX1控件 - public delegate void DataGridViewDelegate(DataTable dt, string strLable, string strLayer, bool initDataGrid); - /// - /// 代理函数,操作DatgridViewX1 - /// - /// - /// - public void InitDataGridViewX1(DataTable dt, string strLable, string strLayer, bool initDataGrid) - { - if (initDataGrid == true) - { - dataGridViewX1.DataSource = dt; - panelOfTable.Visible = true; - toolStripNumbers.Text = strLable; - dataGridViewX1.Tag = strLayer; - } - else - { - dataGridViewX1.DataSource = null; - dataGridViewX1.Refresh(); - panelOfTable.Visible = false; - toolStripNumbers.Text = ""; - dataGridViewX1.Tag = ""; - globeControl1.Globe.MemoryLayer.RemoveAllFeature();//清除双击产生的标注 - } - } - FrmAnalysisGuiHuaResult from; - /// - /// 主窗体下方属性表格 双击定位 功能 - /// - /// - /// - 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 if (dataGridViewX1.Columns.Contains("标识器编号")) - { - featureName = dataGridViewX1.Rows[hittestinfo.RowIndex].Cells["标识器编号"].Value.ToString(); - } - featureName = featureName.Trim(); - - GSOLayer layer = null; - layer = globeControl1.Globe.Layers.GetLayerByCaption(dataGridViewX1.Tag.ToString()); - - if (layer == null) return; - - GSOFeatures features = layer.GetFeatureByName(featureName, false); - if (features.Length == 0) return; - GSOFeature rowFeature = features[0]; - - ClassSearchAnalysis.AddMakerToLineFeature(globeControl1, rowFeature); - - } - } - } - else - { - if (e.Button == MouseButtons.Left) - { - if (from != null && !from.IsDisposed) - { - try - { - from.Close(); - } - catch (Exception ex) - { - LogError.PublishError(ex); - } - } - try - { - DataGridView.HitTestInfo hittestinfo = dataGridViewX1.HitTest(e.X, e.Y); - if (hittestinfo.RowIndex >= 0) - { - string layer = dataGridViewX1.Rows[hittestinfo.RowIndex].Cells["管线类型"].Value.ToString(); - string hxName = dataGridViewX1.Rows[hittestinfo.RowIndex].Cells["红线编号"].Value.ToString(); - FrmAnalysisGuiHuaResult frm = new FrmAnalysisGuiHuaResult(globeControl1, lineStruct, featsList, - panelOfTable, dataGridViewX1, layer, hxName); - frm.Location = new Point(this.Width - frm.Width - 10, this.Height - frm.Height - 20); - frm.Show(this); - - from = frm; - } - } - catch (Exception ex) - { - LogError.PublishError(ex); - } - } - } - } - - /// - /// 空间查询 - /// - /// - /// - private void buttonItemSearch1_Click(object sender, EventArgs e) - { - LogManager.saveLog(Utility.userName, this.buttonItemSearch1.Text); - - trackflag = "PipelineSpatialQuery"; - globeControl1.Globe.Action = EnumAction3D.TrackPolygon; - globeControl1.Globe.TrackPolygonTool.TrackMode = EnumTrackMode.SpaceTrack; - - } - /// - /// 关键字查询 - /// - /// - /// - private void buttonItemSearch9_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, this.buttonItemSearch9.Text); - - FrmKeywordQuery.ShowForm(globeControl1, m_PipelineLayerNames, new DataGridViewDelegate(InitDataGridViewX1)); - } - /// - /// 编号查询 - /// - /// - /// - private void buttonItemSearch2_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, this.buttonItemSearch2.Text); - - FrmCodingQuery.ShowForm(globeControl1, m_PipelineLayerNames, new DataGridViewDelegate(InitDataGridViewX1)); - } - /// - /// 坐标查询 - /// - /// - /// - private void buttonItemSearch3_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, this.buttonItemSearch3.Text); - - FrmSetLatLonPos.ShowForm(globeControl1); - } - /// - /// 附属物查询 - /// - /// - /// - private void buttonItemSearch10_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, this.buttonItemSearch10.Text); - - FrmFittingQuery.ShowForm(globeControl1, instrumenLayerNames, new DataGridViewDelegate(InitDataGridViewX1)); - } - /// - /// 管径查询 - /// - /// - /// - private void buttonItemSearch4_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, this.buttonItemSearch4.Text); - - FrmDiameterQuery.ShowForm(globeControl1, m_PipelineLayerNames, new DataGridViewDelegate(InitDataGridViewX1)); - } - /// - /// 材质查询 - /// - /// - /// - private void buttonItemSearch5_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, this.buttonItemSearch5.Text); - - FrmMaterialSel.ShowForm(globeControl1, m_PipelineLayerNames, new DataGridViewDelegate(InitDataGridViewX1)); - } - /// - /// 基本查询 - /// - /// - /// - private void buttonItemSearch6_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, this.buttonItemSearch6.Text); - - FrmBasicQuery.ShowForm(globeControl1, new DataGridViewDelegate(InitDataGridViewX1)); - } - /// - /// 复合查询 - /// - /// - /// - private void buttonItemSearch7_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, this.buttonItemSearch7.Text); - - FrmQuerySQL.ShowForm(globeControl1, new DataGridViewDelegate(InitDataGridViewX1)); - } - /// - /// 关联查询 - /// - /// - /// - private void buttonItemSearch8_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, this.buttonItemSearch8.Text); - - if (globeControl1.Globe.SelObjectCount != 1) - { - MessageBox.Show("请选中一个对象!", "提示"); - return; - } - - double valueAllowance = 1.0; - - for (int j = 0; j < globeControl1.Globe.SelObjectCount; j++) - { - GSOFeature feature = null; - GSOLayer layer = null; - globeControl1.Globe.GetSelectObject(j, out feature, out layer); - - if (feature == null && feature.Geometry == null || (feature.Geometry.Type == EnumGeometryType.GeoPolygon3D - || feature.Geometry.Type == EnumGeometryType.GeoWater)) - return; - else - { - ClassSearchAnalysis.ResultRelationAnalysis(globeControl1, feature, valueLayerNames, workwellLayerNames, - instrumenLayerNames, pipefittingLayerNames, m_PipelineLayerNames, valueAllowance); - } - } - } - #endregion - /// - /// 清除分析 - /// - /// - /// - private void buttonItemClear_Click(object sender, EventArgs e) - { - LogManager.saveLog(Utility.userName, this.buttonItemClear.Text); - - globeControl1.Globe.ClearMeasure(); - layerTemp.RemoveAllFeature(); - layerTemp2.RemoveAllFeature(); - buttonItemLS5.Checked = false; - - dataGridViewX1.DataSource = null; - panelOfTable.Visible = false; - - globeControl1.Globe.MemoryLayer.RemoveAllFeature(); - globeControl1.Globe.ClearAnalysis(); - - - // 清除净距分析结果 - buttonX2_Click(null, null); - buttonX8_Click(null, null); - buttonX15_Click(null, null); - buttonX16_Click(null, null); - buttonClearAnalysisResult_Click(null, null); - - NetworkAnalysisTool.ClearAllTopAnalysis(this.globeControl1); - // ClearConnexityAnalysis();//清除连通性分析 - // 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); - } - } - - GSOFeatures feats = globeControl1.Globe.MemoryLayer.GetFeatureByName("粒子要素", true); - if (feats.Length > 0) - globeControl1.Globe.MemoryLayer.RemoveFeatureByID(feats[0].ID); - - globeControl1.Globe.UnderGroundFloor.Visible = false;//隐藏地下网格线 - - // ClearUpDownTraceAnalysis(); //清除上下游分析 - globeControl1.Globe.RemoveAllPits();//清除所有坑 - - string[] markerStrs = new string[9]; - markerStrs[0] = "标高标注"; - markerStrs[1] = "管径标注"; - markerStrs[2] = "埋深标注"; - markerStrs[3] = "坐标标注"; - markerStrs[4] = "坡度标注"; - markerStrs[5] = "属性标注"; - markerStrs[6] = "自定义标注"; - markerStrs[7] = "距离标注"; - markerStrs[8] = "扯旗标注"; - for (int i = 0; i < markerStrs.Length; i++) - { - GSOLayer markerLayer = globeControl1.Globe.Layers.GetLayerByCaption(markerStrs[i]); - markerLayer.RemoveAllFeature(); - } - if (layerMarkerTree != null && layerMarkerTree.Nodes.Count > 0) - { - for (int i = 0; i < layerMarkerTree.Nodes[0].Nodes.Count; i++) - { - layerMarkerTree.Nodes[0].Nodes[i].Nodes.Clear(); - } - } - - clearFeatureHighLight();//取消管线高亮 - - GSOLayer layerGround = globeControl1.Globe.Layers.GetLayerByCaption(roadLayerName);//("180fd"); - if (layerGround != null) - { - layerGround.Visible = true; - } - globeControl1.Refresh(); - globeControl2.Refresh(); - ClearRedlineAnalyseResult(); - globeControl1.Globe.Action = EnumAction3D.ActionNull; - } - /// - /// 管线长度全区域统计 - /// - /// - /// - private void buttonItemTJ1_ALL_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, "管线长度统计"); - FrmAllPipelineStatis frm = new FrmAllPipelineStatis(globeControl1, null, new DataGridViewDelegate(InitDataGridViewX1), m_PipelineLayerNames); - frm.Show(this); - - } - /// - /// 管线长度绘制区域统计 - /// - /// - /// - private void buttonItemTJ1_DRAW_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, "管线长度统计"); - - trackflag = "PipelineDistanceStatistics"; - globeControl1.Globe.Action = EnumAction3D.TrackPolygon; - globeControl1.Globe.TrackPolygonTool.TrackMode = EnumTrackMode.SpaceTrack; - } - /// - /// 阀门数量全区域统计 - /// - /// - /// - private void buttonItemTJ2_ALL_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, "阀门数量统计"); - FrmValveStatistics frm = new FrmValveStatistics(globeControl1, null, new DataGridViewDelegate(InitDataGridViewX1)); - frm.Show(this); - - globeControl1.Globe.Action = EnumAction3D.ActionNull; - } - /// - /// 阀门数量绘制区域统计 - /// - /// - /// - private void buttonItemTJ2_DRAW_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, "阀门数量统计"); - - trackflag = "valvequery"; - globeControl1.Globe.Action = EnumAction3D.TrackPolygon; - globeControl1.Globe.TrackPolygonTool.TrackMode = EnumTrackMode.SpaceTrack; - } - /// - /// 井盖数量全区域统计 - /// - /// - /// - private void buttonItemTJ3_ALL_Click(object sender, EventArgs e) - { - FrmAllWorkWellStatis frm = new FrmAllWorkWellStatis(globeControl1, null, new DataGridViewDelegate(InitDataGridViewX1)); - frm.Show(this); - } - /// - /// 井盖数量绘制区域统计 - /// - /// - /// - private void buttonItemTJ3_DRAW_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, "井盖数量统计"); - - trackflag = "workwellquery"; - globeControl1.Globe.Action = EnumAction3D.TrackPolygon; - globeControl1.Globe.TrackPolygonTool.TrackMode = EnumTrackMode.SpaceTrack; - } - /// - /// 管径分段统计全区域统计 - /// - /// - /// - private void buttonItemTJ4_ALL_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, "管径分段统计"); - - Frmpipediameterstatis.ShowForm(globeControl1, m_PipelineLayerNames, 0); - } - /// - /// 管径分段统计绘制区域统计 - /// - /// - /// - private void buttonItemTJ4_DRAW_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, "管径分段统计"); - - trackflag = null; - Frmpipediameterstatis.ShowForm(globeControl1, m_PipelineLayerNames, 1); - } - /// - /// 埋深分段统计全区域统计 - /// - /// - /// - private void buttonItemTJ5_ALL_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, "埋深分段统计"); - FrmpipeDeepstatis.ShowForm(globeControl1, m_PipelineLayerNames, 0); - } - /// - /// 埋深分段统计绘制区域统计 - /// - /// - /// - private void buttonItemTJ5_DRAW_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, "埋深分段统计"); - trackflag = null; - FrmpipeDeepstatis.ShowForm(globeControl1, m_PipelineLayerNames, 1); - } - /// - /// 管径分类统计全区域统计 - /// - /// - /// - private void buttonItemTJ6_ALL_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, "管径分类汇总"); - - FrmpipeDiametergather.ShowForm(globeControl1, m_PipelineLayerNames, 0); - } - /// - /// 管径分类统计绘制区域统计 - /// - /// - /// - private void buttonItemTJ6_DRAW_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, "管径分类汇总"); - - trackflag = null; - FrmpipeDiametergather.ShowForm(globeControl1, m_PipelineLayerNames, 1); - } - /// - /// 材质分类统计全区域统计 - /// - /// - /// - private void buttonItemTJ7_ALL_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, "材质分类汇总"); - - FrmpipeMaterialGather.ShowForm(globeControl1, m_PipelineLayerNames, 0); - } - /// - /// 材质分类统计绘制区域统计 - /// - /// - /// - private void buttonItemTJ7_DRAW_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, "材质分类汇总"); - - trackflag = null; - FrmpipeMaterialGather.ShowForm(globeControl1, m_PipelineLayerNames, 1); - } - /// - /// 附属物分类统计全区域统计 - /// - /// - /// - private void buttonItemTJ8_ALL_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, "附属物分类汇总"); - - FrmAccessoriesgather.ShowForm(globeControl1, instrumenLayerNames, 0); - } - /// - /// 附属物分类统计绘制区域统计 - /// - /// - /// - private void buttonItemTJ8_DRAW_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, "附属物分类汇总"); - - trackflag = null; - FrmAccessoriesgather.ShowForm(globeControl1, instrumenLayerNames, 1); - } /// /// 碰撞分析 /// @@ -7206,7 +5579,6 @@ /// private void buttonItemFX1_1_Click(object sender, EventArgs e) { - //日志记录 LogManager.saveLog(Utility.userName, this.buttonItemFX4_4.Text); this.dataGridViewX4.Size = new System.Drawing.Size(195, 120); @@ -7352,7 +5724,1332 @@ sideBar1.Refresh(); Refresh(); } + /// + /// 碰撞审查 + /// + /// + /// + private void buttonItemSH1_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, this.buttonItemSH1.Text); + this.dataGridViewX4.Size = new System.Drawing.Size(185, 92); + this.dataGridViewX5.Size = new System.Drawing.Size(185, 120); + + layerTemp.RemoveAllFeature(); + clearFeatureHighLight(); + globeControl1.Refresh(); + + sideBar1.Visible = true; + sideBarPanelItem3.Visible = true; + buttonItem1.Checked = true; + controlContainerItem3.Visible = true; + sideBarPanelItem4.Visible = true; + sideBarPanelItem4.Text = "碰撞审查"; + trackflag = "collision"; + controlContainerItem5.Control = panel2; + panel2.Dock = DockStyle.Fill; + panel2.Visible = true; + sideBar1.ExpandedPanel = sideBarPanelItem4; + sideBar1.Refresh(); + + Refresh(); + } + /// + /// 覆土审查 + /// + /// + /// + private void buttonItemSH2_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, this.buttonItemSH2.Text); + + this.dataGridViewX6.Size = new System.Drawing.Size(185, 92); + this.dataGridViewX7.Size = new System.Drawing.Size(185, 120); + + layerTemp.RemoveAllFeature(); + clearFeatureHighLight(); + globeControl1.Refresh(); + sideBar1.Visible = true; + sideBarPanelItem3.Visible = true; + buttonItem1.Checked = true; + controlContainerItem3.Visible = true; + sideBarPanelItem4.Visible = true; + sideBarPanelItem4.Text = "覆土审查"; + trackflag = "ftAnalysis"; + controlContainerItem5.Control = panel4; + panel4.Visible = true; + panel4.Dock = DockStyle.Fill; + sideBar1.ExpandedPanel = sideBarPanelItem4; + sideBar1.Refresh(); + Refresh(); + } + /// + /// 水平净距审查 + /// + /// + /// + private void buttonItemSH3_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, this.buttonItemSH3.Text); + + this.dataGridViewX8.Size = new System.Drawing.Size(190, 92); + this.dataGridViewX9.Size = new System.Drawing.Size(190, 120); + + layerTemp.RemoveAllFeature(); + clearFeatureHighLight(); + globeControl1.Refresh(); + sideBar1.Visible = true; + sideBarPanelItem3.Visible = true; + buttonItem1.Checked = true; + controlContainerItem3.Visible = true; + sideBarPanelItem4.Visible = true; + sideBarPanelItem4.Text = "水平净距审查"; + trackflag = "horizontal"; + controlContainerItem5.Control = panel5; + panel5.Dock = DockStyle.Fill; + panel5.Visible = true; + sideBar1.ExpandedPanel = sideBarPanelItem4; + sideBar1.Refresh(); + Refresh(); + } + /// + /// 垂直净距审查 + /// + /// + /// + private void buttonItemSH4_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, this.buttonItemSH4.Text); + + this.dataGridViewX2.Visible = true; + this.dataGridViewX3.Visible = true; + this.dataGridViewX2.Size = new System.Drawing.Size(185, 92); + this.dataGridViewX3.Size = new System.Drawing.Size(185, 120); + + layerTemp.RemoveAllFeature(); + clearFeatureHighLight(); + + globeControl1.Refresh(); + sideBar1.Visible = true; + sideBarPanelItem3.Visible = true; + buttonItem1.Checked = true; + controlContainerItem3.Visible = true; + sideBarPanelItem4.Visible = true; + sideBarPanelItem4.Text = "垂直净距审查"; + trackflag = "vertical"; + //globeControl1.Globe.Action = EnumAction3D.SelectObject; + panel2.Visible = false; + panel3.Visible = false; + panel5.Visible = false; + panel4.Visible = false; + controlContainerItem5.Control = panel1; + panel1.Dock = DockStyle.Fill; + panel1.Visible = true; + sideBar1.ExpandedPanel = sideBarPanelItem4; + sideBar1.Refresh(); + Refresh(); + } + #endregion + + /// + /// 添加指定路径下的数据 功能 + /// + /// + /// + private object AddLayerData(string strDataPath) + { + object objRes = null; + if (Path.GetExtension(strDataPath).ToLower().Equals(".kml")) + { + GSOLayer layer = globeControl1.Globe.Layers.Add(strDataPath); + objRes = layer; + if (layer != null) + { + 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; + layerManagerNode.Nodes.Insert(0, node); + } + newlayername = layer.Caption; + } + else if (GSOUtility.IsDatasetSupportTerrain(strDataPath)) + { + GSOTerrain terrain = globeControl1.Globe.Terrains.Add(strDataPath); + objRes = terrain; + if (terrain != null) + { + TreeNode node = new TreeNode(); + node.Tag = terrain; + node.Text = terrain.Caption; + node.ImageIndex = 0; + node.SelectedImageIndex = 0; + node.Checked = terrain.Visible; + layerManagerNode.Nodes.Insert(0, node); + } + newlayername = terrain.Caption; + } + else if (Path.GetExtension(strDataPath).ToLower().Equals(".dxf")) + { + GSOLayer layer = globeControl1.Globe.Layers.Add(strDataPath); + objRes = layer; + if (layer != null) + { + GSODataset dataset = layer.Dataset; + CheckDatasetGeoReference(layer.Dataset, strDataPath); + CheckDatasetGeoReference(layer.Dataset, strDataPath); + TreeNode node = new TreeNode(); + node.Tag = layer; + node.Text = layer.Dataset.Caption; + node.ImageIndex = 0; + node.SelectedImageIndex = 0; + node.Checked = layer.Visible; + layerManagerNode.Nodes.Insert(0, node); + } + newlayername = layer.Caption; + } + else + { + GSOLayer layer = globeControl1.Globe.Layers.Add(strDataPath); + + objRes = layer; + if (layer == null) + MessageBox.Show("layer is null"); + + CheckDatasetGeoReference(layer.Dataset, strDataPath); + TreeNode node = new TreeNode(); + node.Tag = layer; + node.Text = layer.Dataset.Caption; + node.ImageIndex = 0; + node.SelectedImageIndex = 0; + node.Checked = layer.Visible; + layerManagerNode.Nodes.Insert(0, node); + + newlayername = layer.Caption; + } + return objRes; + } + /// + /// 连接数据库 菜单事件处理 + /// + /// + /// + private void ConnectDB(object sender, EventArgs e) + { + FrmDatabaseParaSetting frm = new FrmDatabaseParaSetting(globeControl1); + if (frm.ShowDialog() == DialogResult.OK) + { + ds = FrmDatabaseParaSetting.ds; + if (ds != null) + { + ds.IsCloseSaved = false; + } + } + } + /// + /// 根据指定图层创建图层节点并将节点添加到图层管理节点的子节点集合中 + /// + /// + private void addNodeToLayerManagerNode(GSOLayer layer) + { + if (layer != null) + { + 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; + + if (!layerManagerNode.Nodes.Contains(node)) + { + layerManagerNode.Nodes.Insert(0, node); + layerManagerNode.Expand(); + } + } + } + /// + /// 获取指定图层中最后一个feature对象的名称对应的整数 + /// + /// + /// + public int getLabelName(GSOLayer layer) + { + int nid = -1; + if (layer.GetAllFeatures().Length > 0) + { + string id = layer.GetAllFeatures()[layer.GetAllFeatures().Length - 1].Name; + + int.TryParse(id, out nid); + } + else + { + nid = 0; + } + return nid; + } + /// + /// 设置除指定标注图层之外的所有标注图层不可见 + /// + /// + public void setMarkerLayerUnVisible(string layerName) + { + string[] markerStrs = new string[10]; + markerStrs[0] = "标高标注"; + markerStrs[1] = "管径标注"; + markerStrs[2] = "埋深标注"; + markerStrs[3] = "坐标标注"; + markerStrs[4] = "坡度标注"; + markerStrs[5] = "属性标注"; + markerStrs[6] = "自定义标注"; + markerStrs[7] = "距离标注"; + markerStrs[8] = "红线工具"; + markerStrs[9] = "扯旗标注"; + + for (int i = 0; i < markerStrs.Length; i++) + { + GSOLayer markerLayer = globeControl1.Globe.Layers.GetLayerByCaption(markerStrs[i]); + if (markerLayer != null) + { + if (markerStrs[i] != layerName) + { + 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) + { + markerFeature.Visible = false; + } + } + if (layerMarkerTree.Nodes[0].Nodes.Count > i) + { + layerMarkerTree.Nodes[0].Nodes[i].Checked = true; + } + } + } + } + } + /// + /// 判断选中的对象是否为管线 + /// + /// 被选中管线 + /// 返回一根线 + private GSOFeature IsPipeLineOfSelectedObj() + { + GSOFeature resFeature = null; + if (globeControl1.Globe.SelObjectCount < 1) return null; + GSOLayer resLayer = null; + globeControl1.Globe.GetSelectObject(0, out resFeature, out resLayer); + if (resFeature == null) return null; + + GSOGeoPolyline3D line1 = resFeature.Geometry as GSOGeoPolyline3D; + if (line1 == null) return null; + GSOPipeLineStyle3D pipeStyle1 = line1.Style as GSOPipeLineStyle3D; + if (pipeStyle1 == null) return null; + + return resFeature; + } + /// + /// 图层节点树中 节点 右键单击事件处理 + /// + /// + /// + private void layerMarkerTree_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e) + { + if (e.Button == MouseButtons.Right) + { + if (e.Node.Text == "标注管理" || e.Node.Text == "传感器管理") + return; + else if (e.Node.Parent.Text == "标注管理") + { + layerMarkerTree.SelectedNode = e.Node; + contextMenuStrip2.Show(layerMarkerTree, e.X, e.Y); + contextMenuStrip2.Tag = e.Node; + } + else if (e.Node.Parent.Text == "传感器管理") + { + layerSensorTree.SelectedNode = e.Node; + contextMenuStrip2.Show(layerSensorTree, e.X, e.Y); + contextMenuStrip2.Tag = e.Node; + } + else + { + if (e.Node.Tag is GSOFeature) + { + if (e.Node.Parent.Parent.Text == "标注管理") + { + layerMarkerTree.SelectedNode = e.Node; + contextMenuStrip3.Show(layerMarkerTree, e.X, e.Y); + contextMenuStrip3.Tag = e.Node; + } + else if (e.Node.Parent.Parent.Text == "传感器管理") + { + layerSensorTree.SelectedNode = e.Node; + contextMenuStrip3.Show(layerSensorTree, e.X, e.Y); + contextMenuStrip3.Tag = e.Node; + } + } + } + } + } + /// + /// 标注管理、传感器管理 图层目录树的右键菜单中的 刷新列表 菜单 + /// + /// + /// + private void toolStripMenuItem1_Click(object sender, EventArgs e) + { + TreeNode node = contextMenuStrip2.Tag as TreeNode; + TreeNode parentNode = node.Parent; + Int32 nIndex = node.Index; + + if (parentNode.Text == "标注管理" || parentNode.Text == "传感器管理") + { + RefreshTreeNodeLayerFeatureList(node); + } + } + /// + /// 给指定的图层节点添加代表feature对象的子节点 + /// + /// + private void RefreshTreeNodeLayerFeatureList(TreeNode layerTreeNode) + { + layerTreeNode.Nodes.Clear(); + GSOLayer layer = (GSOLayer)layerTreeNode.Tag; + // 只将类型为内存数据集的图层列出,如果是其它类型的数据集可能数据量太大,没发显示在树控件中 + if (layer.Dataset is GSOFeatureDataset) + { + VisitFeature3Ds(layer.GetAllFeatures(), layerTreeNode); + } + } + /// + /// 标注管理、传感器管理 图层目录树的右键菜单中的 移除所有 菜单 + /// + /// + /// + private void toolStripMenuItem2_Click(object sender, EventArgs e) + { + TreeNode node = contextMenuStrip3.Tag as TreeNode; + GSOFeature feature3d = node.Tag as GSOFeature; + if (node == null) + return; + if (feature3d != null) + { + feature3d.Delete(); + globeControl1.Globe.Refresh(); + node.Remove(); + } + } + /// + /// 图层目录树的 节点对应的复选框选中状态改变事件处理 + /// + /// + /// + private void layerMarkerTree_AfterCheck(object sender, TreeViewEventArgs e) + { + if (e.Action != TreeViewAction.Unknown) + { + CheckTreeNode(e.Node, e.Node.Checked); + } + } + /// + /// 改变指定节点对应的复选框的选中状态 + /// + /// + /// + private void CheckTreeNode(TreeNode node, Boolean bChecked) + { + CheckChildTreeNode(node, bChecked); + globeControl1.Globe.Refresh(); + } + /// + /// 改变指定节点的子节点对应的复选框的选中状态 + /// + /// + /// + private void CheckChildTreeNode(TreeNode node, Boolean bChecked) + { + if (node == null) + return; + if (node.Tag != null) + { + if (node.Tag.GetType() == typeof(GSOFeatureFolder) || node.Tag.GetType() == typeof(GSOFeature)) + ((GSOFeature)node.Tag).SetVisibleDirectly(bChecked); + else + { + GSOLayer curLayer = node.Tag as GSOLayer; + GSOTerrain curTerrain = node.Tag as GSOTerrain; + if (curLayer != null) + { + curLayer.Visible = bChecked; + } + else if (curTerrain != null) + { + curTerrain.Visible = bChecked; + } + } + } + // 递归处理子节点 + for (int i = 0; i < node.Nodes.Count; i++) + { + node.Nodes[i].Checked = bChecked; + CheckChildTreeNode(node.Nodes[i], bChecked); + } + } + /// + /// 标注管理、传感器管理 目录树中的feature节点的右键菜单中的 删除 菜单 + /// + /// + /// + private void 删除ToolStripMenuItem1_Click(object sender, EventArgs e) + { + TreeNode node = contextMenuStrip2.Tag as TreeNode; + GSOLayer l = globeControl1.Globe.Layers.GetLayerByCaption(node.Text); + if (l != null) + { + l.RemoveAllFeature(); + node.Nodes.Clear(); + globeControl1.Refresh(); + } + } + //定时检查传感器的状态 + public System.Windows.Forms.Timer timerOfSensor = null; + /// + /// 一键审核---导入数据 + /// + /// + /// + private void buttonItem127_Click_2(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "打开数据"); + + try + { + string dbIp = Utility.sgdbip; + string database = Utility.sgdbname; + string user = Utility.sgdbuser; + string pass = Utility.sgdbpwd; + shds = globeControl1.Globe.DataManager.OpenOracleDataSource(dbIp + "/" + database, "", "", user, pass); + if (shds == null) + { + MessageBox.Show("施工数据库连接失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); + } + FrmPipelineModelDB frm = new FrmPipelineModelDB(globeControl1, shds, true); + if (frm.ShowDialog() == DialogResult.OK) + { + addNodeToLayerManagerNode(frm.rukuLayer); + } + } + catch (Exception ex) + { + LogError.PublishError(ex); + MessageBox.Show("内存过载请清理内存,并重新启动规划分析!", "提示"); + return; + } + } + /// + ///自动导出图片 + /// + /// + /// + private void buttonItem130_Click_1(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "导出审核图"); + + Point pt1 = new Point(Convert.ToInt32(0), Convert.ToInt32(0)); + Point pt2 = new Point(Convert.ToInt32(panelEx5.Width), Convert.ToInt32(panelEx5.Height)); + + 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 = System.IO.Path.GetExtension(dlg.FileName);//扩展名 + switch (extension) + { + case ".jpg": + myImg.Save(dlg.FileName, System.Drawing.Imaging.ImageFormat.Jpeg); + break; + case ".png": + myImg.Save(dlg.FileName, System.Drawing.Imaging.ImageFormat.Png); + break; + case ".bmp": + myImg.Save(dlg.FileName, System.Drawing.Imaging.ImageFormat.Bmp); + break; + case ".gif": + myImg.Save(dlg.FileName, System.Drawing.Imaging.ImageFormat.Gif); + break; + default: + break; + } + } + } + /// + /// 一键审核功能 + /// + /// + /// + private void buttonItem128_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, this.buttonItem128.Text); + frmSh = new FrmYJSHTC(globeControl1, globeControl2, layerTree); + + if (frmSh.ShowDialog() == DialogResult.OK) + { + frmWait = new FrmWait("一键审核……"); + frmWait.Location = new Point(this.Width - frmWait.Width - 10, this.Height - frmWait.Height - 50); + frmWait.Owner = this; + frmWait.Show(); + Thread thread = new Thread(new ThreadStart(doWork)); + thread.IsBackground = true; + thread.Start(); + } + } + void doWork() + { + FrmShResult frmShResult = null; + + double dVerticalJingJuBiaoZhun = 1, dHorizontalJingJuBiaoZhun = 1; + if (frmSh.rukuLayer != null) + { + #region + this.Invoke((EventHandler) delegate + { + try + { + List managerLayerList = new List(); + for (int i = 0; i < layerManagerNode.Nodes.Count; i++) + { + managerLayerList.Add(layerManagerNode.Nodes[i].Text); + } + if (!managerLayerList.Contains(frmSh.rukuLayer.Caption)) + { + TreeNode node = new TreeNode(); + node.Tag = frmSh.rukuLayer; + node.Text = frmSh.rukuLayer.Dataset.Caption; + node.ImageIndex = 0; + node.SelectedImageIndex = 0; + node.Checked = frmSh.rukuLayer.Visible; + layerManagerNode.Nodes.Insert(0, node); + layerManagerNode.Expand(); + } + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "提示"); + } + }); + #endregion + + shlayername = frmSh.rukuLayer.Name; + globeControl1.Refresh(); + } + + if (frmShResult != null && !frmShResult.IsDisposed) + { + try + { + clearFeatureHighLight(); + ClearRedlineAnalyseResult(); + frmShResult.Close(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message); + } + } + + frmShResult = new FrmShResult(dVerticalJingJuBiaoZhun, dHorizontalJingJuBiaoZhun, shlayername, globeControl1, + m_PipelineLayerNames); + + if (boolfrmShResult == true) return; + + frmShResult.Location = new Point(this.Width - frmShResult.Width - 10, this.Height - frmShResult.Height - 50); + frmShResult.Owner = this; + //一键审核实际计算步骤 + frmShResult.analysis(); + + //MainFrm窗体显示控制,回到一键审核Tab + this.Invoke((EventHandler) delegate + { + frmShResult.Show(); + frmWait.Close(); + //将tab页恢复到一键审核 + ribbonTabItem11.Checked = true; + try + { + globeControl1.Globe.Action = EnumAction3D.ActionNull; + splitContainer1.Panel2Collapsed = true; + + panelOfTable.Visible = false; + legendSC.Visible = false; + legendSG.Visible = false; + + GSOLayer redLayer = globeControl1.Globe.Layers.GetLayerByCaption("红线"); + if (redLayer != null) + { + redLayer.Visible = false; + } + } + catch (Exception ex) + { + MessageBox.Show("系统运行错误:" + ex.ToString(), "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + + }); + + boolfrmShResult = true; + } + /// + /// 清除渲染结果 + /// + public void ClearRedlineAnalyseResult() + { + for (int i = 0; i < globeControl1.Globe.Layers.Count; i++) + { + GSOLayer layer = globeControl1.Globe.Layers[i]; + if (layer.Caption == "tempLgdData") + { + layer.RemoveAllFeature(); + } + } + + layerTemp.RemoveAllFeature(); + globeControl1.Refresh(); + } + /// + /// 已审核的图层 + /// + /// + /// + private void buttonItem132_Click_1(object sender, EventArgs e) + { + //保存日志 + LogManager.saveLog(Utility.userName, this.buttonItem132.Text); + + if (shds == null) + { + //没连的话,直接连接审核库; //审核库配置读配置文件 + string dbIp = Utility.sgdbip; + string database = Utility.sgdbname; + string user = Utility.sgdbuser; + string pass = Utility.sgdbpwd; + + shds = globeControl1.Globe.DataManager.OpenOracleDataSource(dbIp + "/" + database, "", "", user, pass); + if (shds == null) + { + MessageBox.Show("数据库连接失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); + } + } + FrmShLayers frm = new FrmShLayers(globeControl1, shds); + frm.Show(); + + } + /// + /// 审核入库 + /// + /// + /// + private void buttonItem133_Click_1(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "审核入库"); + FrmShRK frmShrk = new FrmShRK(globeControl1); + frmShrk.Show(); + } + /// + /// 模拟设计修改 + /// + /// + /// + private void buttonItem134_Click_1(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "模拟设计修改"); + + frmModify = new FrmMnModify(globeControl1, shlayername, shresultLists); + + if (boolfrmModify == false) + { + frmModify.Owner = this; + frmModify.Location = new Point(this.Width - frmModify.Width - 10, this.Height - frmModify.Height - 50); + frmModify.Show(); + boolfrmModify = true; + } + } + /// + /// 一键审核中调节透明度 + /// + /// + /// + private void sliderItem1_ValueChanged(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, this.sliderItem1.Text); + + globeControl1.Globe.GroundOpaque = 100 - sliderItem1.Value; + GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(roadLayerName); //("180fd"); + + if (layer != null) + layer.Opaque = 100 - sliderItem1.Value; + optiValue = sliderItem1.Value; + } + /// + /// 红线审核中的透明度分析 + /// + /// + /// + private void sliderItem3_ValueChanged(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, this.sliderItem3.Text); + + globeControl1.Globe.GroundOpaque = 100 - sliderItem3.Value; + GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(roadLayerName); //("180fd"); + if (layer != null) + layer.Opaque = 100 - sliderItem3.Value; + optiValue = sliderItem3.Value; + } + #region yanxiaowei + //初始化DataGridViewX1控件 + public delegate void DataGridViewDelegate(DataTable dt, string strLable, string strLayer, bool initDataGrid); + /// + /// 代理函数,操作DatgridViewX1 + /// + /// + /// + public void InitDataGridViewX1(DataTable dt, string strLable, string strLayer, bool initDataGrid) + { + if (initDataGrid == true) + { + dataGridViewX1.DataSource = dt; + panelOfTable.Visible = true; + toolStripNumbers.Text = strLable; + dataGridViewX1.Tag = strLayer; + } + else + { + dataGridViewX1.DataSource = null; + dataGridViewX1.Refresh(); + panelOfTable.Visible = false; + toolStripNumbers.Text = ""; + dataGridViewX1.Tag = ""; + globeControl1.Globe.MemoryLayer.RemoveAllFeature(); //清除双击产生的标注 + } + } + FrmAnalysisGuiHuaResult from; + /// + /// 主窗体下方属性表格 双击定位 功能 + /// + /// + /// + 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 if (dataGridViewX1.Columns.Contains("标识器编号")) + { + featureName = dataGridViewX1.Rows[hittestinfo.RowIndex].Cells["标识器编号"].Value.ToString(); + } + featureName = featureName.Trim(); + + GSOLayer layer = null; + layer = globeControl1.Globe.Layers.GetLayerByCaption(dataGridViewX1.Tag.ToString()); + + if (layer == null) return; + + GSOFeatures features = layer.GetFeatureByName(featureName, false); + if (features.Length == 0) return; + GSOFeature rowFeature = features[0]; + + ClassSearchAnalysis.AddMakerToLineFeature(globeControl1, rowFeature); + + } + } + } + else + { + if (e.Button == MouseButtons.Left) + { + if (from != null && !from.IsDisposed) + { + try + { + from.Close(); + } + catch (Exception ex) + { + LogError.PublishError(ex); + } + } + try + { + DataGridView.HitTestInfo hittestinfo = dataGridViewX1.HitTest(e.X, e.Y); + if (hittestinfo.RowIndex >= 0) + { + string layer = dataGridViewX1.Rows[hittestinfo.RowIndex].Cells["管线类型"].Value.ToString(); + string hxName = dataGridViewX1.Rows[hittestinfo.RowIndex].Cells["红线编号"].Value.ToString(); + FrmAnalysisGuiHuaResult frm = new FrmAnalysisGuiHuaResult(globeControl1, lineStruct, featsList, + panelOfTable, dataGridViewX1, layer, hxName); + frm.Location = new Point(this.Width - frm.Width - 10, this.Height - frm.Height - 20); + frm.Show(this); + + from = frm; + } + } + catch (Exception ex) + { + LogError.PublishError(ex); + } + } + } + } + /// + /// 空间查询 + /// + /// + /// + private void buttonItemSearch1_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, this.buttonItemSearch1.Text); + + trackflag = "PipelineSpatialQuery"; + globeControl1.Globe.Action = EnumAction3D.TrackPolygon; + globeControl1.Globe.TrackPolygonTool.TrackMode = EnumTrackMode.SpaceTrack; + } + /// + /// 关键字查询 + /// + /// + /// + private void buttonItemSearch9_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, this.buttonItemSearch9.Text); + + FrmKeywordQuery.ShowForm(globeControl1, m_PipelineLayerNames, new DataGridViewDelegate(InitDataGridViewX1)); + } + /// + /// 编号查询 + /// + /// + /// + private void buttonItemSearch2_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, this.buttonItemSearch2.Text); + + FrmCodingQuery.ShowForm(globeControl1, m_PipelineLayerNames, new DataGridViewDelegate(InitDataGridViewX1)); + } + /// + /// 坐标查询 + /// + /// + /// + private void buttonItemSearch3_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, this.buttonItemSearch3.Text); + + FrmSetLatLonPos.ShowForm(globeControl1); + } + /// + /// 附属物查询 + /// + /// + /// + private void buttonItemSearch10_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, this.buttonItemSearch10.Text); + + FrmFittingQuery.ShowForm(globeControl1, instrumenLayerNames, new DataGridViewDelegate(InitDataGridViewX1)); + } + /// + /// 管径查询 + /// + /// + /// + private void buttonItemSearch4_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, this.buttonItemSearch4.Text); + + FrmDiameterQuery.ShowForm(globeControl1, m_PipelineLayerNames, new DataGridViewDelegate(InitDataGridViewX1)); + } + /// + /// 材质查询 + /// + /// + /// + private void buttonItemSearch5_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, this.buttonItemSearch5.Text); + + FrmMaterialSel.ShowForm(globeControl1, m_PipelineLayerNames, new DataGridViewDelegate(InitDataGridViewX1)); + } + /// + /// 基本查询 + /// + /// + /// + private void buttonItemSearch6_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, this.buttonItemSearch6.Text); + + FrmBasicQuery.ShowForm(globeControl1, new DataGridViewDelegate(InitDataGridViewX1)); + } + /// + /// 复合查询 + /// + /// + /// + private void buttonItemSearch7_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, this.buttonItemSearch7.Text); + + FrmQuerySQL.ShowForm(globeControl1, new DataGridViewDelegate(InitDataGridViewX1)); + } + /// + /// 关联查询 + /// + /// + /// + private void buttonItemSearch8_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, this.buttonItemSearch8.Text); + + if (globeControl1.Globe.SelObjectCount != 1) + { + MessageBox.Show("请选中一个对象!", "提示"); + return; + } + double valueAllowance = 1.0; + + for (int j = 0; j < globeControl1.Globe.SelObjectCount; j++) + { + GSOFeature feature = null; + GSOLayer layer = null; + globeControl1.Globe.GetSelectObject(j, out feature, out layer); + + if (feature == null && feature.Geometry == null || (feature.Geometry.Type == EnumGeometryType.GeoPolygon3D + || feature.Geometry.Type == EnumGeometryType.GeoWater)) + return; + else + { + ClassSearchAnalysis.ResultRelationAnalysis(globeControl1, feature, valueLayerNames, workwellLayerNames, + instrumenLayerNames, pipefittingLayerNames, m_PipelineLayerNames, valueAllowance); + } + } + } + #endregion + /// + /// 清除分析(完善) + /// + /// + /// + private void buttonItemClear_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, this.buttonItemClear.Text); + + globeControl1.Globe.ClearMeasure(); + layerTemp.RemoveAllFeature(); + layerTemp2.RemoveAllFeature(); + buttonItemLS5.Checked = false; + + dataGridViewX1.DataSource = null; + panelOfTable.Visible = false; + + globeControl1.Globe.MemoryLayer.RemoveAllFeature(); + globeControl1.Globe.ClearAnalysis(); + + + // 清除净距分析结果 + buttonX2_Click(null, null); + buttonX8_Click(null, null); + buttonX15_Click(null, null); + buttonX16_Click(null, null); + buttonClearAnalysisResult_Click(null, null); + + NetworkAnalysisTool.ClearAllTopAnalysis(this.globeControl1); + // ClearConnexityAnalysis();//清除连通性分析 + // 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); + } + } + + GSOFeatures feats = globeControl1.Globe.MemoryLayer.GetFeatureByName("粒子要素", true); + if (feats.Length > 0) + globeControl1.Globe.MemoryLayer.RemoveFeatureByID(feats[0].ID); + + globeControl1.Globe.UnderGroundFloor.Visible = false;//隐藏地下网格线 + + // ClearUpDownTraceAnalysis(); //清除上下游分析 + globeControl1.Globe.RemoveAllPits();//清除所有坑 + + string[] markerStrs = new string[9]; + markerStrs[0] = "标高标注"; + markerStrs[1] = "管径标注"; + markerStrs[2] = "埋深标注"; + markerStrs[3] = "坐标标注"; + markerStrs[4] = "坡度标注"; + markerStrs[5] = "属性标注"; + markerStrs[6] = "自定义标注"; + markerStrs[7] = "距离标注"; + markerStrs[8] = "扯旗标注"; + for (int i = 0; i < markerStrs.Length; i++) + { + GSOLayer markerLayer = globeControl1.Globe.Layers.GetLayerByCaption(markerStrs[i]); + markerLayer.RemoveAllFeature(); + } + if (layerMarkerTree != null && layerMarkerTree.Nodes.Count > 0) + { + for (int i = 0; i < layerMarkerTree.Nodes[0].Nodes.Count; i++) + { + layerMarkerTree.Nodes[0].Nodes[i].Nodes.Clear(); + } + } + + clearFeatureHighLight();//取消管线高亮 + + GSOLayer layerGround = globeControl1.Globe.Layers.GetLayerByCaption(roadLayerName);//("180fd"); + if (layerGround != null) + { + layerGround.Visible = true; + } + globeControl1.Refresh(); + globeControl2.Refresh(); + ClearRedlineAnalyseResult(); + globeControl1.Globe.Action = EnumAction3D.ActionNull; + } + /// + /// 管线长度全区域统计 + /// + /// + /// + private void buttonItemTJ1_ALL_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "管线长度统计"); + FrmAllPipelineStatis frm = new FrmAllPipelineStatis(globeControl1, null, new DataGridViewDelegate(InitDataGridViewX1), m_PipelineLayerNames); + frm.Show(this); + } + /// + /// 管线长度绘制区域统计 + /// + /// + /// + private void buttonItemTJ1_DRAW_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "管线长度统计"); + + trackflag = "PipelineDistanceStatistics"; + globeControl1.Globe.Action = EnumAction3D.TrackPolygon; + globeControl1.Globe.TrackPolygonTool.TrackMode = EnumTrackMode.SpaceTrack; + } + /// + /// 阀门数量全区域统计 + /// + /// + /// + private void buttonItemTJ2_ALL_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "阀门数量统计"); + FrmValveStatistics frm = new FrmValveStatistics(globeControl1, null, new DataGridViewDelegate(InitDataGridViewX1)); + frm.Show(this); + + globeControl1.Globe.Action = EnumAction3D.ActionNull; + } + /// + /// 阀门数量绘制区域统计 + /// + /// + /// + private void buttonItemTJ2_DRAW_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "阀门数量统计"); + + trackflag = "valvequery"; + globeControl1.Globe.Action = EnumAction3D.TrackPolygon; + globeControl1.Globe.TrackPolygonTool.TrackMode = EnumTrackMode.SpaceTrack; + } + /// + /// 井盖数量全区域统计 + /// + /// + /// + private void buttonItemTJ3_ALL_Click(object sender, EventArgs e) + { + FrmAllWorkWellStatis frm = new FrmAllWorkWellStatis(globeControl1, null, new DataGridViewDelegate(InitDataGridViewX1)); + frm.Show(this); + } + /// + /// 井盖数量绘制区域统计 + /// + /// + /// + private void buttonItemTJ3_DRAW_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "井盖数量统计"); + + trackflag = "workwellquery"; + globeControl1.Globe.Action = EnumAction3D.TrackPolygon; + globeControl1.Globe.TrackPolygonTool.TrackMode = EnumTrackMode.SpaceTrack; + } + /// + /// 管径分段统计全区域统计 + /// + /// + /// + private void buttonItemTJ4_ALL_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "管径分段统计"); + + Frmpipediameterstatis.ShowForm(globeControl1, m_PipelineLayerNames, 0); + } + /// + /// 管径分段统计绘制区域统计 + /// + /// + /// + private void buttonItemTJ4_DRAW_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "管径分段统计"); + + trackflag = null; + Frmpipediameterstatis.ShowForm(globeControl1, m_PipelineLayerNames, 1); + } + /// + /// 埋深分段统计全区域统计 + /// + /// + /// + private void buttonItemTJ5_ALL_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "埋深分段统计"); + FrmpipeDeepstatis.ShowForm(globeControl1, m_PipelineLayerNames, 0); + } + /// + /// 埋深分段统计绘制区域统计 + /// + /// + /// + private void buttonItemTJ5_DRAW_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "埋深分段统计"); + trackflag = null; + FrmpipeDeepstatis.ShowForm(globeControl1, m_PipelineLayerNames, 1); + } + /// + /// 管径分类统计全区域统计 + /// + /// + /// + private void buttonItemTJ6_ALL_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "管径分类汇总"); + + FrmpipeDiametergather.ShowForm(globeControl1, m_PipelineLayerNames, 0); + } + /// + /// 管径分类统计绘制区域统计 + /// + /// + /// + private void buttonItemTJ6_DRAW_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "管径分类汇总"); + + trackflag = null; + FrmpipeDiametergather.ShowForm(globeControl1, m_PipelineLayerNames, 1); + } + /// + /// 材质分类统计全区域统计 + /// + /// + /// + private void buttonItemTJ7_ALL_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "材质分类汇总"); + + FrmpipeMaterialGather.ShowForm(globeControl1, m_PipelineLayerNames, 0); + } + /// + /// 材质分类统计绘制区域统计 + /// + /// + /// + private void buttonItemTJ7_DRAW_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "材质分类汇总"); + + trackflag = null; + FrmpipeMaterialGather.ShowForm(globeControl1, m_PipelineLayerNames, 1); + } + /// + /// 附属物分类统计全区域统计 + /// + /// + /// + private void buttonItemTJ8_ALL_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "附属物分类汇总"); + + FrmAccessoriesgather.ShowForm(globeControl1, instrumenLayerNames, 0); + } + /// + /// 附属物分类统计绘制区域统计 + /// + /// + /// + private void buttonItemTJ8_DRAW_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "附属物分类汇总"); + + trackflag = null; + FrmAccessoriesgather.ShowForm(globeControl1, instrumenLayerNames, 1); + } #region Predaotr,断面分析 /// /// 横断面分析 @@ -7365,7 +7062,6 @@ globeControl1.Globe.TrackPolylineTool.VerticalLineVisible = true; globeControl1.Globe.TrackPolylineTool.TrackMode = EnumTrackMode.SpaceTrack; trackPolylineEndMode = EnumTrackPolylineEndMode.HDM_Analysis; - } /// /// 纵断面分析 @@ -7409,7 +7105,6 @@ globeControl1.Globe.TrackPolylineTool.VerticalLineVisible = true; globeControl1.Globe.TrackPolylineTool.TrackMode = EnumTrackMode.SpaceTrack; trackPolylineEndMode = EnumTrackPolylineEndMode.DLDM_Analysis; - } /// /// 基线剖面分析 @@ -7422,9 +7117,7 @@ globeControl1.Globe.TrackPolylineTool.VerticalLineVisible = true; globeControl1.Globe.TrackPolylineTool.TrackMode = EnumTrackMode.SpaceTrack; trackPolylineEndMode = EnumTrackPolylineEndMode.JXPM_Analysis; - } - #endregion /// /// 创建拓扑 @@ -7462,7 +7155,6 @@ LogManager.saveLog(Utility.userName, this.buttonItemFX3_3.Text); NetworkTraceUpDown(false); } - /// /// 上下游追踪 功能 /// @@ -7480,7 +7172,6 @@ NetworkAnalysisTool.TraceUpDownAnalysis(bTraceUp, selLineFeature, selLayer); } - /// /// 流向分析 /// @@ -7533,7 +7224,6 @@ MessageBox.Show("未找到关闭阀门"); } } - /// /// 连通分析 /// @@ -7580,9 +7270,7 @@ NetworkAnalysisTool.ExplodeAnalysis(this.globeControl1, selLineFeature, selLayer); this.buttonItemFX3_5_Click(sender, e); //关阀分析: - } - #endregion /// /// 多边形开挖 @@ -7591,7 +7279,6 @@ /// private void buttonItemFX4_1_Click(object sender, EventArgs e) { - //日志记录 LogManager.saveLog(Utility.userName, this.buttonItemFX4_1.Text); trackflag = "pit"; @@ -7605,7 +7292,6 @@ /// private void buttonItemFX4_2_Click(object sender, EventArgs e) { - //日志记录 LogManager.saveLog(Utility.userName, this.buttonItemFX4_2.Text); trackflag = "digFillAnalysis"; @@ -7620,7 +7306,6 @@ /// private void buttonItemFX4_3_Click(object sender, EventArgs e) { - //日志记录 LogManager.saveLog(Utility.userName, this.buttonItemFX4_3.Text); if (!buttonItemFX4_3.Checked) @@ -7653,12 +7338,13 @@ /// private void buttonItemFX4_4_Click(object sender, EventArgs e) { - //日志记录 LogManager.saveLog(Utility.userName, this.buttonItemFX4_4.Text); globeControl1.Globe.Action = EnumAction3D.DrawPolyline; GSOLayer tunnel = globeControl1.Globe.Layers.GetLayerByCaption("隧道"); - if (tunnel != null) + if (tunnel == null) + MessageBox.Show("场景中未加载隧道图层!", "提示"); + else { globeControl1.Globe.DestLayerFeatureAdd = tunnel; tunnel.Editable = true; @@ -7666,10 +7352,6 @@ m_AddPipeLine = false; m_isDrawCitySevenLine = false; } - else - { - MessageBox.Show("场景中未加载隧道图层!", "提示"); - } } /// /// 隐藏隧道 @@ -7678,7 +7360,6 @@ /// private void buttonItemFX4_5_Click(object sender, EventArgs e) { - //日志记录 LogManager.saveLog(Utility.userName, this.buttonItemFX4_5.Text); GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption("隧道"); @@ -7694,7 +7375,6 @@ /// private void buttonItemFX4_6_Click(object sender, EventArgs e) { - //日志记录 LogManager.saveLog(Utility.userName, this.buttonItemFX4_6.Text); if (globeControl1.Globe.SelObjectCount > 0) @@ -7736,16 +7416,7 @@ //日志记录 LogManager.saveLog(Utility.userName, this.buttonItemFX5_1.Text); - if (globeControl1.Globe.Action != EnumAction3D.VisibilityAnalysis) - { - //btnSpaceVisibilityAnalysis.Checked = true; - globeControl1.Globe.Action = EnumAction3D.VisibilityAnalysis; - } - else - { - globeControl1.Globe.Action = EnumAction3D.ActionNull; - // SetButtonChecked(); - } + globeControl1.Globe.Action = globeControl1.Globe.Action != EnumAction3D.VisibilityAnalysis ? EnumAction3D.VisibilityAnalysis : EnumAction3D.ActionNull; } /// /// 可视域分析 @@ -7754,7 +7425,6 @@ /// private void buttonItemFX5_2_Click(object sender, EventArgs e) { - //日志记录 LogManager.saveLog(Utility.userName, this.buttonItemFX5_2.Text); globeControl1.Globe.Action = EnumAction3D.ViewshedAnalysis; @@ -7766,7 +7436,6 @@ /// private void buttonItemFX5_3_Click(object sender, EventArgs e) { - //日志记录 LogManager.saveLog(Utility.userName, this.buttonItemFX5_3.Text); globeControl1.Globe.Action = EnumAction3D.ViewEnvelopeAnalysis; @@ -7778,7 +7447,6 @@ /// private void buttonItemFX6_1_Click(object sender, EventArgs e) { - //日志记录 LogManager.saveLog(Utility.userName, this.buttonItemFX6_1.Text); GSOFeature feat = globeControl1.Globe.SelectedObject; @@ -7813,7 +7481,6 @@ /// private void buttonItemFX6_2_Click(object sender, EventArgs e) { - //日志记录 LogManager.saveLog(Utility.userName, this.buttonItemFX6_2.Text); globeControl1.Globe.Action = EnumAction3D.ActionNull; @@ -7827,7 +7494,6 @@ /// private void buttonItemFX6_3_Click(object sender, EventArgs e) { - //日志记录 LogManager.saveLog(Utility.userName, this.buttonItemFX6_3.Text); globeControl1.Globe.Action = EnumAction3D.TrackPolygon; @@ -7901,10 +7567,8 @@ globeControl1.Globe.Action = EnumAction3D.ActionNull; buttonItemLS5.Checked = !buttonItemLS5.Checked; - if (buttonItemLS5.Checked) - { - globeControl1.Globe.Action = EnumAction3D.SelectObject; - } + if (!buttonItemLS5.Checked) return; + globeControl1.Globe.Action = EnumAction3D.SelectObject; } /// /// 水平面积 @@ -8197,7 +7861,6 @@ LogManager.saveLog(Utility.userName, this.buttonItemFXGJ1.Text); FrmSetFlytoPos.ShowForm(globeControl1); - } /// /// 自定义飞行 @@ -8262,7 +7925,6 @@ globeControl1.Globe.FlyAroundEye(720, EnumFlyRepeatValueType.Degrees); globeControl1.Globe.CurFlyID = 2; } - /// /// 权限管理 /// @@ -8343,21 +8005,6 @@ appUSERRESET.ShowDialog(); } /// - /// 统计数据 - /// - /// - /// - private void buttonItemZTT1_Click(object sender, EventArgs e) - { - ////日志记录 - //LogManager.saveLog(Utility.userName, this.buttonItemZTT1.Text); - - //PATM patm = new PATM(); - //patm.operation = "Statistic"; - //patm.Text = "统计专题图管理"; - //patm.ShowDialog(); - } - /// /// 热点功能统计 /// /// @@ -8460,137 +8107,6 @@ FrmLayerControl frm = new FrmLayerControl(layerTree, globeControl1, globeControl2); frm.Show(this); } - - /// - /// 碰撞审查 - /// - /// - /// - private void buttonItemSH1_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, this.buttonItemSH1.Text); - - this.dataGridViewX4.Size = new System.Drawing.Size(185, 92); - this.dataGridViewX5.Size = new System.Drawing.Size(185, 120); - - layerTemp.RemoveAllFeature(); - clearFeatureHighLight(); - globeControl1.Refresh(); - - sideBar1.Visible = true; - sideBarPanelItem3.Visible = true; - buttonItem1.Checked = true; - controlContainerItem3.Visible = true; - sideBarPanelItem4.Visible = true; - sideBarPanelItem4.Text = "碰撞审查"; - trackflag = "collision"; - controlContainerItem5.Control = panel2; - panel2.Dock = DockStyle.Fill; - panel2.Visible = true; - sideBar1.ExpandedPanel = sideBarPanelItem4; - sideBar1.Refresh(); - - Refresh(); - } - /// - /// 覆土审查 - /// - /// - /// - private void buttonItemSH2_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, this.buttonItemSH2.Text); - - this.dataGridViewX6.Size = new System.Drawing.Size(185, 92); - this.dataGridViewX7.Size = new System.Drawing.Size(185, 120); - - layerTemp.RemoveAllFeature(); - clearFeatureHighLight(); - globeControl1.Refresh(); - sideBar1.Visible = true; - sideBarPanelItem3.Visible = true; - buttonItem1.Checked = true; - controlContainerItem3.Visible = true; - sideBarPanelItem4.Visible = true; - sideBarPanelItem4.Text = "覆土审查"; - trackflag = "ftAnalysis"; - controlContainerItem5.Control = panel4; - panel4.Visible = true; - panel4.Dock = DockStyle.Fill; - sideBar1.ExpandedPanel = sideBarPanelItem4; - sideBar1.Refresh(); - Refresh(); - } - /// - /// 水平净距审查 - /// - /// - /// - private void buttonItemSH3_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, this.buttonItemSH3.Text); - - this.dataGridViewX8.Size = new System.Drawing.Size(190, 92); - this.dataGridViewX9.Size = new System.Drawing.Size(190, 120); - - layerTemp.RemoveAllFeature(); - clearFeatureHighLight(); - globeControl1.Refresh(); - sideBar1.Visible = true; - sideBarPanelItem3.Visible = true; - buttonItem1.Checked = true; - controlContainerItem3.Visible = true; - sideBarPanelItem4.Visible = true; - sideBarPanelItem4.Text = "水平净距审查"; - trackflag = "horizontal"; - controlContainerItem5.Control = panel5; - panel5.Dock = DockStyle.Fill; - panel5.Visible = true; - sideBar1.ExpandedPanel = sideBarPanelItem4; - sideBar1.Refresh(); - Refresh(); - } - /// - /// 垂直净距审查 - /// - /// - /// - private void buttonItemSH4_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, this.buttonItemSH4.Text); - - this.dataGridViewX2.Visible = true; - this.dataGridViewX3.Visible = true; - this.dataGridViewX2.Size = new System.Drawing.Size(185, 92); - this.dataGridViewX3.Size = new System.Drawing.Size(185, 120); - - layerTemp.RemoveAllFeature(); - clearFeatureHighLight(); - - globeControl1.Refresh(); - sideBar1.Visible = true; - sideBarPanelItem3.Visible = true; - buttonItem1.Checked = true; - controlContainerItem3.Visible = true; - sideBarPanelItem4.Visible = true; - sideBarPanelItem4.Text = "垂直净距审查"; - trackflag = "vertical"; - //globeControl1.Globe.Action = EnumAction3D.SelectObject; - panel2.Visible = false; - panel3.Visible = false; - panel5.Visible = false; - panel4.Visible = false; - controlContainerItem5.Control = panel1; - panel1.Dock = DockStyle.Fill; - panel1.Visible = true; - sideBar1.ExpandedPanel = sideBarPanelItem4; - sideBar1.Refresh(); - Refresh(); - } /// /// 综合规划区域审查 /// @@ -8666,9 +8182,7 @@ } if (ds == null) return; - Cyberpipe.Forms.FrmPipelineModelDB frm = new Cyberpipe.Forms.FrmPipelineModelDB(globeControl1, ds); - - //frm.Show(); + FrmPipelineModelDB frm = new FrmPipelineModelDB(globeControl1, ds, false); if (frm.ShowDialog() == DialogResult.OK) { @@ -8700,7 +8214,6 @@ addNodeToLayerManagerNode(frm.rukuLayer); } } - /// /// 坐标转换 /// @@ -8711,7 +8224,7 @@ //保存日志 LogManager.saveLog(Utility.userName, this.buttonItemSJGL5.Text); - Cyberpipe.Forms.FrmProject frm = new Cyberpipe.Forms.FrmProject(); + FrmProject frm = new FrmProject(); frm.ShowDialog(); } /// @@ -8738,7 +8251,6 @@ LogManager.saveLog(Utility.userName, this.buttonItemSJGL6_2.Text); FrmMetadataStat frmmds = new FrmMetadataStat(); - //frmmds.Show(); frmmds.ShowDialog(); } /// @@ -8814,12 +8326,11 @@ if (frm.ShowDialog() == DialogResult.OK) { GSOLayer featureAddLayer = TreeNodeFeatureLayer(); - if (featureAddLayer == null) + if (featureAddLayer != null) { - return; + FrmAddInstrument dlg = new FrmAddInstrument(globeControl1, featureAddLayer); + dlg.Show(this); } - FrmAddInstrument dlg = new FrmAddInstrument(globeControl1, featureAddLayer); - dlg.Show(this); } } /// @@ -8836,16 +8347,15 @@ if (frm.ShowDialog() == DialogResult.OK) { GSOLayer featureAddLayer = TreeNodeFeatureLayer(); - if (featureAddLayer == null) + if (featureAddLayer != null) { - return; + FrmAddPipeFitting dlg = new FrmAddPipeFitting(globeControl1, featureAddLayer); + dlg.Show(this); } - FrmAddPipeFitting dlg = new FrmAddPipeFitting(globeControl1, featureAddLayer); - dlg.Show(this); } } /// - /// 绘制城市七线 + /// 绘制城市七线(完善) /// /// /// @@ -9082,15 +8592,6 @@ List listVectorNames = new List(); for (int i = 0; i < 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] == "供电") - { - continue; - } - * */ if (listVectorNames.Contains(m_PipelineLayerNames[i]) == false) { listVectorNames.Add(m_PipelineLayerNames[i]); @@ -9142,15 +8643,11 @@ GSOFeature f = null; GSOLayer layer = null; globeControl1.Globe.GetSelectObject(i, out f, out layer); - if (f != null) - { - f.Delete(); - if (layer != null) - { - globeControl1.Globe.AddToEditHistroy(layer, f, EnumEditType.Delete); - } - globeControl1.Refresh(); - } + if (f == null) continue; + f.Delete(); + if (layer != null) + globeControl1.Globe.AddToEditHistroy(layer, f, EnumEditType.Delete); + globeControl1.Refresh(); } MessageBox.Show("删除成功!", "提示"); } @@ -9190,10 +8687,8 @@ for (int i = 0; i < m_PipelineLayerNames.Count; i++) { layer = globeControl1.Globe.Layers.GetLayerByCaption(m_PipelineLayerNames[i]); - if (layer != null) - { - listPipelineLayers.Add(layer); - } + if (layer == null) continue; + listPipelineLayers.Add(layer); } //yanxiaowei 重构 GSOFeatures selectFeatures = new GSOFeatures(); @@ -9208,15 +8703,15 @@ ClassGSOTool.CalculateRedLineResult(out table, redSH, selectFeatures, globeControl1, listPipelineLayers, out lineStruct, out featsList); - if (table.Rows.Count != 0) - AddDatagridView(table); - else + if (table.Rows.Count == 0) { MessageBox.Show("没有侵入地块红线的管线数据!", "提示"); dataGridViewX1.DataSource = null; panelOfTable.Visible = false; return; } + else + AddDatagridView(table); } private void AddDatagridView(DataTable table) @@ -9234,23 +8729,25 @@ /// private void toolStripDropDownButton3_Click(object sender, EventArgs e) { - if (dataGridViewX1.Rows.Count == 0) + if (dataGridViewX1.Rows.Count != 0) + { + string strSaveFile = string.Empty; + SaveFileDialog savefiledialog = new SaveFileDialog(); + savefiledialog.Filter = "Excel文件|*.xls,*.xlsx"; + savefiledialog.AddExtension = true; + savefiledialog.FileName = "红线审核"; + if (savefiledialog.ShowDialog() == DialogResult.OK) + strSaveFile = savefiledialog.FileName; + else return; + + ExpEXCEL.ExpToExcel(dataGridViewX1, strSaveFile, "红线审核", lineStruct, featsList); + MessageBox.Show("导出成功!"); + } + else { MessageBox.Show("表格内容为空!", "提示"); return; } - - string strSaveFile = string.Empty; - SaveFileDialog savefiledialog = new SaveFileDialog(); - savefiledialog.Filter = "Excel文件|*.xls,*.xlsx"; - savefiledialog.AddExtension = true; - savefiledialog.FileName = "红线审核"; - if (savefiledialog.ShowDialog() == DialogResult.OK) - strSaveFile = savefiledialog.FileName; - else return; - - ExpEXCEL.ExpToExcel(dataGridViewX1, strSaveFile, "红线审核", lineStruct, featsList); - MessageBox.Show("导出成功!"); } private void sliderItem2_ValueChanged(object sender, EventArgs e) @@ -9287,31 +8784,39 @@ dlg.Multiselect = true; if (dlg.ShowDialog() == DialogResult.OK) { - //自定义lprj文件名,从程序中复制一lprj文件。 - string filePath = dlg.FileName; - string lastname = Path.GetFileName(filePath); - - for (int i = 0; i < dlg.FileNames.Length; i++) + try { - AddLayerData(dlg.FileNames[i]); + for (int i = 0; i < dlg.FileNames.Length; i++) + { + AddLayerData(dlg.FileNames[i]); + } + layerManagerNode.Expand(); + + //放大到新导入的图层 + GSOLayer lyr = globeControl1.Globe.Layers.GetLayerByCaption(newlayername); + if (newlayername != "") + { + GSOFeatures features = lyr.GetAllFeatures(); + GSORect2d rd = lyr.LatLonBounds; + GSOPoint2d rdcenter = rd.Center; + + globeControl1.Globe.JumpToPosition(new GSOPoint3d(rdcenter.X, rdcenter.Y, 0), + EnumAltitudeMode.Absolute, 100); + + globeControl1.Refresh(); + } } - layerManagerNode.Expand(); - - //放大到新导入的图层 - GSOLayer lyr = globeControl1.Globe.Layers.GetLayerByCaption(newlayername); - if (newlayername != "") + catch (Exception ex) { - GSOFeatures features = lyr.GetAllFeatures(); - GSORect2d rd = lyr.LatLonBounds; - GSOPoint2d rdcenter = rd.Center; - - globeControl1.Globe.JumpToPosition(new GSOPoint3d(rdcenter.X, rdcenter.Y, 0), EnumAltitudeMode.Absolute, 100); - - globeControl1.Refresh(); + LogHelper.WriteLog(typeof(MainFrm), ex); } } } - + /// + /// 导入红线(完善) + /// + /// + /// private void buttonItemHX1_Click(object sender, EventArgs e) { LogManager.saveLog(Utility.userName, this.buttonItemHX1.Text); @@ -9339,7 +8844,6 @@ GSOFeatures RedFeatures = layer.GetAllFeatures(); redlinelayername = layer.Caption; - //objRes = layer; if (layer != null) { layerRedRegion = layer; @@ -9362,9 +8866,7 @@ { GSOFeature f = layer.GetAt(j); if (f != null) - { f.Geometry.AltitudeMode = EnumAltitudeMode.RelativeToGround; - } } } layerManagerNode.Expand(); @@ -9426,7 +8928,7 @@ fly.Show(this); } /// - /// 2015-10-17演示代码 红线审核 + /// 红线审核 /// /// /// @@ -9438,7 +8940,6 @@ globeControl1.BeforeSceneRenderEvent -= new BeforeSceneRenderEventHandler(globeControl1_BeforeSceneRenderEvent); globeControl2.BeforeSceneRenderEvent -= new BeforeSceneRenderEventHandler(globeControl2_BeforeSceneRenderEvent); - globeControl1.Globe.FlyToPosition(new GSOPoint3d(120.610963, 31.188121, 50), EnumAltitudeMode.Absolute, -4, 50, 800); globeControl1.Globe.FlyToPointSpeed = 10000000; globeControl1.Globe.Action = EnumAction3D.SelectObject; @@ -9453,11 +8954,8 @@ legendSC.Visible = false; ClearGZData(); GSOLayer redLayer = globeControl1.Globe.Layers.GetLayerByCaption("红线"); - if (redLayer != null) - { - redLayer.Visible = true; - } - + if (redLayer == null) return; + redLayer.Visible = true; } catch (Exception ex) { @@ -9477,7 +8975,6 @@ globeControl1.BeforeSceneRenderEvent -= new BeforeSceneRenderEventHandler(globeControl1_BeforeSceneRenderEvent); globeControl2.BeforeSceneRenderEvent -= new BeforeSceneRenderEventHandler(globeControl2_BeforeSceneRenderEvent); - globeControl1.Globe.Action = EnumAction3D.ActionNull; dataGridViewX1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells; //zhanshi = false; @@ -9488,12 +8985,8 @@ legendSG.Visible = false; ClearGZData(); GSOLayer redLayer = globeControl1.Globe.Layers.GetLayerByCaption("红线"); - if (redLayer != null) - { - redLayer.Visible = false; - } - - + if (redLayer == null) return; + redLayer.Visible = false; } catch (Exception ex) { @@ -9513,7 +9006,6 @@ globeControl1.BeforeSceneRenderEvent -= new BeforeSceneRenderEventHandler(globeControl1_BeforeSceneRenderEvent); globeControl2.BeforeSceneRenderEvent -= new BeforeSceneRenderEventHandler(globeControl2_BeforeSceneRenderEvent); - globeControl1.Globe.Action = EnumAction3D.ActionNull; //zhanshi = false; redSH = false; @@ -9524,45 +9016,15 @@ legendSG.Visible = false; ClearGZData(); GSOLayer redLayer = globeControl1.Globe.Layers.GetLayerByCaption("红线"); - if (redLayer != null) - { - redLayer.Visible = false; - } - - + if (redLayer == null) return; + redLayer.Visible = false; } catch (Exception ex) { //MessageBox.Show("系统运行错误:" + ex.ToString(), "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); } } - /// - /// 右屏添加冰箱数据 - /// - void AddDataToGlobeControl2() - { - - bool modelDataBool = false; - for (int i = globeControl2.Globe.Layers.Count - 1; i >= 0; i--) - { - GSOLayer layer = globeControl2.Globe.Layers[i]; - if (layer.Name.Contains("fttp:")) - { - modelDataBool = true; - break; - } - } - - if (modelDataBool == false) - { - GSOLayer ly = globeControl1.Globe.Layers.GetLayerByCaption("天地图地图"); - globeControl2.Globe.Layers.Add(ly); - } - else - { - return; - } - } + /// /// 双屏对比 /// @@ -9572,7 +9034,6 @@ { try { - globeControl1.BeforeSceneRenderEvent += new BeforeSceneRenderEventHandler(globeControl1_BeforeSceneRenderEvent); globeControl2.BeforeSceneRenderEvent += new BeforeSceneRenderEventHandler(globeControl2_BeforeSceneRenderEvent); @@ -9590,10 +9051,7 @@ GSOLayer redLayer = globeControl1.Globe.Layers.GetLayerByCaption("红线"); if (redLayer != null) - { redLayer.Visible = false; - } - AddDataToGlobeControl2(); } catch (Exception ex) { @@ -9613,7 +9071,6 @@ globeControl1.BeforeSceneRenderEvent -= new BeforeSceneRenderEventHandler(globeControl1_BeforeSceneRenderEvent); globeControl2.BeforeSceneRenderEvent -= new BeforeSceneRenderEventHandler(globeControl2_BeforeSceneRenderEvent); - globeControl1.Globe.Action = EnumAction3D.ActionNull; panelOfTable.Visible = false; //zhanshi = false; @@ -9625,9 +9082,7 @@ ClearGZData(); GSOLayer redLayer = globeControl1.Globe.Layers.GetLayerByCaption("红线"); if (redLayer != null) - { redLayer.Visible = false; - } } catch (Exception ex) { @@ -9643,11 +9098,9 @@ { try { - globeControl1.BeforeSceneRenderEvent -= new BeforeSceneRenderEventHandler(globeControl1_BeforeSceneRenderEvent); globeControl2.BeforeSceneRenderEvent -= new BeforeSceneRenderEventHandler(globeControl2_BeforeSceneRenderEvent); - globeControl1.Globe.Action = EnumAction3D.ActionNull; panelOfTable.Visible = false; //zhanshi = false; @@ -9660,10 +9113,7 @@ GSOLayer redLayer = globeControl1.Globe.Layers.GetLayerByCaption("红线"); if (redLayer != null) - { redLayer.Visible = false; - } - } catch (Exception ex) { @@ -9679,11 +9129,9 @@ { try { - globeControl1.BeforeSceneRenderEvent -= new BeforeSceneRenderEventHandler(globeControl1_BeforeSceneRenderEvent); globeControl2.BeforeSceneRenderEvent -= new BeforeSceneRenderEventHandler(globeControl2_BeforeSceneRenderEvent); - globeControl1.Globe.Action = EnumAction3D.ActionNull; panelOfTable.Visible = false; //zhanshi = false; @@ -9695,11 +9143,8 @@ ClearGZData(); GSOLayer redLayer = globeControl1.Globe.Layers.GetLayerByCaption("红线"); - if (redLayer != null) - { - redLayer.Visible = false; - } - + if (redLayer == null) return; + redLayer.Visible = false; } catch (Exception ex) { @@ -9717,12 +9162,8 @@ { LogManager.saveLog(Utility.userName, this.buttonItem8.Text); - //FrmCompareFeature frmCompareFeature = new FrmCompareFeature(globeControl1, globeControl2, layerTemp, layerTemp2,m_PipelineLayerNames,sgPipeLayersNames); int width = this.Width; FrmCompareFeature.ShowForm(globeControl1, globeControl2, layerTemp, layerTemp2, m_PipelineLayerNames, sgPipeLayersNames, width); - //frmCompareFeature.Location = new Point((this.Width - frmCompareFeature.Width)/2,50); - //frmCompareFeature.Show(this); - } /// /// 红线审核导出图片 @@ -9735,11 +9176,7 @@ Point pt1 = new Point(Convert.ToInt32(0), Convert.ToInt32(0)); Point pt2 = new Point(Convert.ToInt32(panelEx5.Width), Convert.ToInt32(panelEx5.Height)); - /*Point pt = getUpperLeftPoint(pt1, pt2); - Image myImg = new Bitmap(Convert.ToInt32(panelEx5.Width), Convert.ToInt32(panelEx5.Height)); - Graphics g = Graphics.FromImage(myImg); - g.CopyFromScreen(pt, new Point(0, 0), new Size(Convert.ToInt32(panelEx5.Width), Convert.ToInt32(panelEx5.Height))); - */ + int mapWidth = 0; int mapHeight = 0; Point pt = getUpperLeftPoint(pt1, pt2, out mapWidth, out mapHeight); @@ -9782,7 +9219,6 @@ { globeControl1.Globe.Action = EnumAction3D.ActionNull; FrmBSQStatis bsqStatis = new FrmBSQStatis(globeControl1, null); - //FrmBSQStatis bsqStatis = new FrmBSQStatis(); bsqStatis.Show(this); } /// @@ -9795,20 +9231,15 @@ trackflag = "BSQDuoBianXiangStatis"; globeControl1.Globe.Action = EnumAction3D.TrackPolygon; } - - private void btn_check_history_Click(object sender, EventArgs e) { LogManager.saveLog(Utility.userName, this.btn_check_history.Text); if (FrmCheckHistory.isOpen == true) - { return; - } FrmCheckHistory frm = new FrmCheckHistory(globeControl1, globeControl2); frm.addNode += new AddNodeToLayerManagerNode(addNodeToLayerManagerNode); frm.Show(); - } private void buttonItem查看数据_Click(object sender, EventArgs e) @@ -9840,34 +9271,29 @@ { LogManager.saveLog(Utility.userName, this.btn_user_info.Text); - if (!FrmSysUserInfoManger.IS_OPEN) - { - FrmSysUserInfoManger frm = new FrmSysUserInfoManger(); - frm.ShowDialog(); - } + if (FrmSysUserInfoManger.IS_OPEN) return; + FrmSysUserInfoManger frm = new FrmSysUserInfoManger(); + frm.ShowDialog(); } private void btn_role_info_Click(object sender, EventArgs e) { LogManager.saveLog(Utility.userName, this.btn_role_info.Text); - if (FrmRoleInfoManager.IS_OPEN) + if (!FrmRoleInfoManager.IS_OPEN) { - return; + FrmRoleInfoManager frm = new FrmRoleInfoManager(); + frm.ShowDialog(); } - FrmRoleInfoManager frm = new FrmRoleInfoManager(); - frm.ShowDialog(); } private void btn_resc_info_Click(object sender, EventArgs e) { LogManager.saveLog(Utility.userName, this.btn_resc_info.Text); - if (!SysRescInfoManager.IS_OPEN) - { - SysRescInfoManager frm = new SysRescInfoManager(); - frm.ShowDialog(); - } + if (SysRescInfoManager.IS_OPEN) return; + SysRescInfoManager frm = new SysRescInfoManager(); + frm.ShowDialog(); } private void btn_role_resc_Click(object sender, EventArgs e) @@ -9875,51 +9301,33 @@ LogManager.saveLog(Utility.userName, this.btn_role_resc.Text); - if (!FrmRoleRescManager.IS_OPEN) - { - FrmRoleRescManager frm = new FrmRoleRescManager(); - frm.ShowDialog(); - } + if (FrmRoleRescManager.IS_OPEN) return; + FrmRoleRescManager frm = new FrmRoleRescManager(); + frm.ShowDialog(); } private void btn_user_role_Click(object sender, EventArgs e) { LogManager.saveLog(Utility.userName, this.btn_user_role.Text); - if (FrmUserRole.IS_OPEN) + if (!FrmUserRole.IS_OPEN) { - return; + FrmUserRole frm = new FrmUserRole(); + frm.ShowDialog(); } - FrmUserRole frm = new FrmUserRole(); - frm.ShowDialog(); } private void btn_document_info_Click(object sender, EventArgs e) { LogManager.saveLog(Utility.userName, this.btn_document_info.Text); - - //if (FormDocumentManager.IS_OPEN) - //{ - // return; - //} - //FormDocumentManager frm = new FormDocumentManager(); - //frm.ShowDialog(); - - //if (FormDocumentManager.IS_OPEN) - //{ - // return; - //} - //new FormDocumentManager().ShowDialog(); - if (FormDocumentManager.IS_OPEN) + if (!FormDocumentManager.IS_OPEN) { - return; + this.Cursor = Cursors.WaitCursor; + FormDocumentManager frm = new FormDocumentManager(); + frm.changeCursor += new ChangeCursor(changeCursorToDefault); + frm.ShowDialog(); } - this.Cursor = Cursors.WaitCursor; - FormDocumentManager frm = new FormDocumentManager(); - frm.changeCursor += new ChangeCursor(changeCursorToDefault); - frm.ShowDialog(); - } private void changeCursorToDefault() @@ -9936,58 +9344,9 @@ dlg.Multiselect = true; if (dlg.ShowDialog() == DialogResult.OK) { - for (int i = 0; i < dlg.FileNames.Length; i++) + foreach (string strDataPath in dlg.FileNames) { - //this.Cursor = Cursors.WaitCursor; - string strDataPath = dlg.FileNames[i]; - - #region - //string strDataPathPrj = strDataPath.ToLower().Replace(".dwg", ".lprj"); - - //if (File.Exists(strDataPathPrj) == false) - //{ - // if (MessageBox.Show("数据没有空间参考信息,请设置空间参考信息!", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation) == DialogResult.OK) - // { - // String strPath = Application.StartupPath + "\\Coordinate Systems"; - // OpenFileDialog dlgPrj = new OpenFileDialog(); - // dlgPrj.InitialDirectory = strPath; - // dlgPrj.RestoreDirectory = true; - // dlgPrj.Multiselect = false; - // dlg.Filter = "投影文件|*.prj"; - // if (dlg.ShowDialog() == DialogResult.OK) - // { - // this.Cursor = Cursors.WaitCursor; - // string proj4 = GSODataEngineUtility.ConvertEsriPrjFileToProj4(dlg.FileName); - // using (StreamWriter stream = new StreamWriter(strDataPathPrj, false)) - // { - // stream.WriteLine("0prj4" + proj4 + ""); - // } - // AddLayerData(strDataPath); - // //globeControl1.Globe.Layers.Add(strDataPath); - - // this.Cursor = Cursors.Default; - // } - // else - // { - // AddLayerData(strDataPath); - // //globeControl1.Globe.Layers.Add(strDataPath); - // } - // } - // else - // { - // AddLayerData(strDataPath); - // //globeControl1.Globe.Layers.Add(strDataPath); - // } - - //} - //else - //{ - // //globeControl1.Globe.Layers.Add(strDataPath); - // AddLayerData(strDataPath); - //} - #endregion AddLayerData(strDataPath); - //this.Cursor = Cursors.Default; } } @@ -10008,38 +9367,13 @@ { LogManager.saveLog(Utility.userName, this.btn_password_edit.Text); - if (FrmChangePassword.IS_OPEN) + if (!FrmChangePassword.IS_OPEN) { - return; + FrmChangePassword frm = new FrmChangePassword(); + frm.ShowDialog(); } - FrmChangePassword frm = new FrmChangePassword(); - frm.ShowDialog(); } - /// - /// 多孔管线入库 - /// - /// - /// - private void buttonItem9_Click(object sender, EventArgs e) - { - //保存日志 - LogManager.saveLog(Utility.userName, this.buttonItemSJGL4_2.Text); - if (ds == null) - { - MessageBox.Show("请先连接数据库", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); - ConnectDB(null, null); - } - if (ds == null) - return; - - FrmMultiPipelineModelDB frm = new FrmMultiPipelineModelDB(globeControl1, ds); - if (frm.ShowDialog() == DialogResult.OK) - { - addNodeToLayerManagerNode(frm.rukuLayer); - } - //frm.Show(); - } private void 导出CADToolStripMenuItem1_Click(object sender, EventArgs e) { TreeNode node = layerNodeContexMenu.Tag as TreeNode; @@ -10049,44 +9383,42 @@ return; } GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(node.Text.Trim()); - if (layer == null || layer.GetAllFeatures().Length <= 0) + if (layer != null && layer.GetAllFeatures().Length > 0) { - MessageBox.Show("要导出的图层为空", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); - return; - } - string strProjectName = Utility.projectStr; - if (strProjectName != "") - { + string strProjectName = Utility.projectStr; + if (strProjectName == "") return; SaveFileDialog dlg = new SaveFileDialog(); dlg.Filter = "*.dwg|*.dwg|*.dxf|*.dxf"; dlg.FileName = layer.Caption; - if (dlg.ShowDialog(this) == DialogResult.OK) + if (dlg.ShowDialog(this) != DialogResult.OK) return; + globeControl1.Globe.MemoryLayer.SaveAs(dlg.FileName); + GSOLayer newlayer = globeControl1.Globe.Layers.Add(dlg.FileName); + newlayer.RemoveAllFeature(); + int featureCount = layer.GetAllFeatures().Length; + for (int i = 0; i < featureCount; i++) { - globeControl1.Globe.MemoryLayer.SaveAs(dlg.FileName); - GSOLayer newlayer = globeControl1.Globe.Layers.Add(dlg.FileName); - newlayer.RemoveAllFeature(); - int featureCount = layer.GetAllFeatures().Length; - for (int i = 0; i < featureCount; i++) + GSOFeature feature = layer.GetAt(i); + if (feature == null || feature.Geometry == null) continue; + switch (feature.Geometry.Type) { - GSOFeature feature = layer.GetAt(i); - if (feature != null && feature.Geometry != null) - { - if (feature.Geometry.Type == EnumGeometryType.GeoPolyline3D) - { - feature.Geometry.Style = new GSOSimpleLineStyle3D(); - } - else if (feature.Geometry.Type == EnumGeometryType.GeoPolygon3D) - { - feature.Geometry.Style = new GSOSimplePolygonStyle3D(); - } - newlayer.AddFeature(feature); - } + case EnumGeometryType.GeoPolyline3D: + feature.Geometry.Style = new GSOSimpleLineStyle3D(); + break; + case EnumGeometryType.GeoPolygon3D: + feature.Geometry.Style = new GSOSimplePolygonStyle3D(); + break; } - newlayer.Save(); - newlayer.Dataset.DataSource.RemoveDataset(newlayer.Dataset); - globeControl1.Globe.Layers.Remove(newlayer); - MessageBox.Show("导出CAD完成!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); + newlayer.AddFeature(feature); } + newlayer.Save(); + newlayer.Dataset.DataSource.RemoveDataset(newlayer.Dataset); + globeControl1.Globe.Layers.Remove(newlayer); + MessageBox.Show("导出CAD完成!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); + } + else + { + MessageBox.Show("要导出的图层为空", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); + return; } } diff --git a/MainFrm.designer.cs b/MainFrm.designer.cs index fd0ef22..1022ac7 100644 --- a/MainFrm.designer.cs +++ b/MainFrm.designer.cs @@ -195,10 +195,6 @@ this.缓冲区分析ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.无源淹没分析ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.清除分析ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components); - this.FlyToMenu = new System.Windows.Forms.ToolStripMenuItem(); - this.LightMenu = new System.Windows.Forms.ToolStripMenuItem(); - this.AllLightMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.timer1 = new System.Windows.Forms.Timer(this.components); this.layerNodeContexMenu = new System.Windows.Forms.ContextMenuStrip(this.components); this.RefreshLayerFeatureListMenuItem = new System.Windows.Forms.ToolStripMenuItem(); @@ -644,7 +640,6 @@ this.panelEx3.SuspendLayout(); this.RightScreenToolMenu.SuspendLayout(); this.toolRightMenu.SuspendLayout(); - this.contextMenuStrip1.SuspendLayout(); this.layerNodeContexMenu.SuspendLayout(); this.contextMenuStrip2.SuspendLayout(); this.contextMenuStrip3.SuspendLayout(); @@ -1263,7 +1258,7 @@ this.区域分析ToolStripMenuItem, this.清除分析ToolStripMenuItem}); this.toolRightMenu.Name = "toolRightMenu"; - this.toolRightMenu.Size = new System.Drawing.Size(153, 312); + this.toolRightMenu.Size = new System.Drawing.Size(149, 290); // // 量算ToolStripMenuItem // @@ -1276,7 +1271,7 @@ this.水平面积ToolStripMenuItem1, this.地表面积ToolStripMenuItem1}); this.量算ToolStripMenuItem.Name = "量算ToolStripMenuItem"; - this.量算ToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.量算ToolStripMenuItem.Size = new System.Drawing.Size(148, 22); this.量算ToolStripMenuItem.Text = "量算"; // // 水平距离ToolStripMenuItem1 @@ -1339,7 +1334,7 @@ this.前进ToolStripMenuItem, this.删除模型ToolStripMenuItem}); this.编辑ToolStripMenuItem.Name = "编辑ToolStripMenuItem"; - this.编辑ToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.编辑ToolStripMenuItem.Size = new System.Drawing.Size(148, 22); this.编辑ToolStripMenuItem.Text = "编辑"; // // 平移对象ToolStripMenuItem @@ -1415,7 +1410,7 @@ this.绕中心点飞行ToolStripMenuItem, this.绕眼睛飞行ToolStripMenuItem}); this.飞行ToolStripMenuItem.Name = "飞行ToolStripMenuItem"; - this.飞行ToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.飞行ToolStripMenuItem.Size = new System.Drawing.Size(148, 22); this.飞行ToolStripMenuItem.Text = "飞行"; // // 自定义飞行ToolStripMenuItem @@ -1460,7 +1455,7 @@ this.属性标注ToolStripMenuItem, this.标注管理ToolStripMenuItem}); this.标注ToolStripMenuItem.Name = "标注ToolStripMenuItem"; - this.标注ToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.标注ToolStripMenuItem.Size = new System.Drawing.Size(148, 22); this.标注ToolStripMenuItem.Text = "标注"; // // 标高标注ToolStripMenuItem @@ -1547,7 +1542,7 @@ this.关联查询ToolStripMenuItem, this.关键字查询ToolStripMenuItem}); this.查询ToolStripMenuItem.Name = "查询ToolStripMenuItem"; - this.查询ToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.查询ToolStripMenuItem.Size = new System.Drawing.Size(148, 22); this.查询ToolStripMenuItem.Text = "查询"; // // 空间查询ToolStripMenuItem @@ -1633,7 +1628,7 @@ this.附属物分类统计ToolStripMenuItem, this.标识器分类统计ToolStripMenuItem}); this.全区域统计ToolStripMenuItem.Name = "全区域统计ToolStripMenuItem"; - this.全区域统计ToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.全区域统计ToolStripMenuItem.Size = new System.Drawing.Size(148, 22); this.全区域统计ToolStripMenuItem.Text = "全区域统计"; // // 管线长度统计ToolStripMenuItem @@ -1712,7 +1707,7 @@ this.附属物分类统计ToolStripMenuItem1, this.标识器分类统计ToolStripMenuItem1}); this.绘制区域统计ToolStripMenuItem.Name = "绘制区域统计ToolStripMenuItem"; - this.绘制区域统计ToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.绘制区域统计ToolStripMenuItem.Size = new System.Drawing.Size(148, 22); this.绘制区域统计ToolStripMenuItem.Text = "绘制区域统计"; // // 管线长度统计ToolStripMenuItem1 @@ -1786,7 +1781,7 @@ this.道路断面分析ToolStripMenuItem, this.基线剖面分析ToolStripMenuItem}); this.断面分析ToolStripMenuItem.Name = "断面分析ToolStripMenuItem"; - this.断面分析ToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.断面分析ToolStripMenuItem.Size = new System.Drawing.Size(148, 22); this.断面分析ToolStripMenuItem.Text = "断面分析"; // // 横断面分析ToolStripMenuItem @@ -1828,7 +1823,7 @@ this.连通分析ToolStripMenuItem, this.爆管分析ToolStripMenuItem}); this.拓扑分析ToolStripMenuItem.Name = "拓扑分析ToolStripMenuItem"; - this.拓扑分析ToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.拓扑分析ToolStripMenuItem.Size = new System.Drawing.Size(148, 22); this.拓扑分析ToolStripMenuItem.Text = "拓扑分析"; // // 创建拓扑ToolStripMenuItem @@ -1890,7 +1885,7 @@ this.隐藏隧道ToolStripMenuItem, this.删除隧道ToolStripMenuItem}); this.开挖分析ToolStripMenuItem.Name = "开挖分析ToolStripMenuItem"; - this.开挖分析ToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.开挖分析ToolStripMenuItem.Size = new System.Drawing.Size(148, 22); this.开挖分析ToolStripMenuItem.Text = "开挖分析"; // // 多边形开挖ToolStripMenuItem @@ -1942,7 +1937,7 @@ this.可视域分析ToolStripMenuItem, this.可视包络分析ToolStripMenuItem}); this.视域分析ToolStripMenuItem.Name = "视域分析ToolStripMenuItem"; - this.视域分析ToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.视域分析ToolStripMenuItem.Size = new System.Drawing.Size(148, 22); this.视域分析ToolStripMenuItem.Text = "视域分析"; // // 通视分析ToolStripMenuItem @@ -1973,7 +1968,7 @@ this.缓冲区分析ToolStripMenuItem, this.无源淹没分析ToolStripMenuItem}); this.区域分析ToolStripMenuItem.Name = "区域分析ToolStripMenuItem"; - this.区域分析ToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.区域分析ToolStripMenuItem.Size = new System.Drawing.Size(148, 22); this.区域分析ToolStripMenuItem.Text = "区域分析"; // // 附属物分析ToolStripMenuItem @@ -2000,45 +1995,14 @@ // 清除分析ToolStripMenuItem // this.清除分析ToolStripMenuItem.Name = "清除分析ToolStripMenuItem"; - this.清除分析ToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.清除分析ToolStripMenuItem.Size = new System.Drawing.Size(148, 22); this.清除分析ToolStripMenuItem.Text = "清除分析"; this.清除分析ToolStripMenuItem.Click += new System.EventHandler(this.buttonItemClear_Click); // - // contextMenuStrip1 - // - this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.FlyToMenu, - this.LightMenu, - this.AllLightMenuItem}); - this.contextMenuStrip1.Name = "contextMenuStrip1"; - this.contextMenuStrip1.Size = new System.Drawing.Size(125, 70); - // - // FlyToMenu - // - this.FlyToMenu.Name = "FlyToMenu"; - this.FlyToMenu.Size = new System.Drawing.Size(124, 22); - this.FlyToMenu.Text = "定位"; - this.FlyToMenu.Click += new System.EventHandler(this.FlyToMenu_Click); - // - // LightMenu - // - this.LightMenu.Name = "LightMenu"; - this.LightMenu.Size = new System.Drawing.Size(124, 22); - this.LightMenu.Text = "单个闪烁"; - this.LightMenu.Click += new System.EventHandler(this.LightMenu_Click); - // - // AllLightMenuItem - // - this.AllLightMenuItem.Name = "AllLightMenuItem"; - this.AllLightMenuItem.Size = new System.Drawing.Size(124, 22); - this.AllLightMenuItem.Text = "全部闪烁"; - this.AllLightMenuItem.Visible = false; - this.AllLightMenuItem.Click += new System.EventHandler(this.AllLightMenuItem_Click); - // // timer1 // this.timer1.Interval = 500; - this.timer1.Tick += new System.EventHandler(this.timer1_Tick); + //this.timer1.Tick += new System.EventHandler(this.timer1_Tick); // // layerNodeContexMenu // @@ -2684,7 +2648,6 @@ this.buttonItemZTT1.Name = "buttonItemZTT1"; this.buttonItemZTT1.Text = "统计数据"; this.buttonItemZTT1.Visible = false; - this.buttonItemZTT1.Click += new System.EventHandler(this.buttonItemZTT1_Click); // // buttonItemZTT2 // @@ -5514,7 +5477,7 @@ this.dataGridViewX2.ReadOnly = true; this.dataGridViewX2.RowHeadersVisible = false; this.dataGridViewX2.RowTemplate.Height = 23; - this.dataGridViewX2.Size = new System.Drawing.Size(20983, 92); + this.dataGridViewX2.Size = new System.Drawing.Size(21874, 92); this.dataGridViewX2.TabIndex = 11; // // dataGridViewTextBoxColumn10 @@ -5608,7 +5571,7 @@ this.dataGridViewX3.ReadOnly = true; this.dataGridViewX3.RowHeadersVisible = false; this.dataGridViewX3.RowTemplate.Height = 23; - this.dataGridViewX3.Size = new System.Drawing.Size(20982, 127); + this.dataGridViewX3.Size = new System.Drawing.Size(21873, 127); this.dataGridViewX3.TabIndex = 5; this.dataGridViewX3.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.dataGridViewX3_MouseDoubleClick); // @@ -5866,7 +5829,7 @@ this.dataGridViewX8.ReadOnly = true; this.dataGridViewX8.RowHeadersVisible = false; this.dataGridViewX8.RowTemplate.Height = 23; - this.dataGridViewX8.Size = new System.Drawing.Size(91, 92); + this.dataGridViewX8.Size = new System.Drawing.Size(40, 92); this.dataGridViewX8.TabIndex = 11; // // dataGridViewTextBoxColumn12 @@ -5961,7 +5924,7 @@ this.dataGridViewX9.ReadOnly = true; this.dataGridViewX9.RowHeadersVisible = false; this.dataGridViewX9.RowTemplate.Height = 23; - this.dataGridViewX9.Size = new System.Drawing.Size(90, 127); + this.dataGridViewX9.Size = new System.Drawing.Size(39, 127); this.dataGridViewX9.TabIndex = 5; this.dataGridViewX9.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.dataGridViewX9_MouseDoubleClick); // @@ -6819,7 +6782,6 @@ this.panelEx3.ResumeLayout(false); this.RightScreenToolMenu.ResumeLayout(false); this.toolRightMenu.ResumeLayout(false); - this.contextMenuStrip1.ResumeLayout(false); this.layerNodeContexMenu.ResumeLayout(false); this.contextMenuStrip2.ResumeLayout(false); this.contextMenuStrip3.ResumeLayout(false); @@ -6914,10 +6876,6 @@ private DevComponents.DotNetBar.SideBar sideBar1; private DevComponents.DotNetBar.SideBarPanelItem sideBarPanelItem3; private DevComponents.DotNetBar.ExpandableSplitter expandableSplitter1; - private System.Windows.Forms.ContextMenuStrip contextMenuStrip1; - private System.Windows.Forms.ToolStripMenuItem FlyToMenu; - private System.Windows.Forms.ToolStripMenuItem LightMenu; - private System.Windows.Forms.ToolStripMenuItem AllLightMenuItem; private System.Windows.Forms.Timer timer1; private System.Windows.Forms.ContextMenuStrip layerNodeContexMenu; private System.Windows.Forms.ToolStripMenuItem RefreshLayerFeatureListMenuItem; diff --git a/MainFrm.resx b/MainFrm.resx index b5d8c43..bf053b9 100644 --- a/MainFrm.resx +++ b/MainFrm.resx @@ -154,9 +154,6 @@ 375, 94 - - 17, 54 - 461, 17 diff --git a/bin/x86/Debug/Cyberpipe.exe b/bin/x86/Debug/Cyberpipe.exe index a37517d..511d28f 100644 --- a/bin/x86/Debug/Cyberpipe.exe +++ b/bin/x86/Debug/Cyberpipe.exe Binary files differ diff --git a/Cyberpipe.suo b/Cyberpipe.suo index ebd45ee..c2c34b1 100644 --- a/Cyberpipe.suo +++ b/Cyberpipe.suo Binary files differ diff --git a/Forms/FrmPipelineModelDataBase.cs b/Forms/FrmPipelineModelDataBase.cs index a060afb..f833db4 100644 --- a/Forms/FrmPipelineModelDataBase.cs +++ b/Forms/FrmPipelineModelDataBase.cs @@ -1,16 +1,10 @@ using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; using System.Drawing; -using System.Text; using System.Windows.Forms; using GeoScene.Globe; using GeoScene.Engine; using GeoScene.Data; using System.IO; -using System.Collections; -using System.Xml; using System.Text.RegularExpressions; using DevComponents.DotNetBar; @@ -39,11 +33,12 @@ /// private void FrmPipelineModel_Load(object sender, EventArgs e) { + buttonOpen.Visible = isSh; string pipelinetype = Utility.pipelinetype; string[] pipelinetypes = pipelinetype.Split(','); for (int i = 0; i < pipelinetypes.Length; i++) { - pipelineTypeCbo.Items.Add(pipelinetypes[i]);//管线类型 + pipelineTypeCbo.Items.Add(pipelinetypes[i]); } comboBoxExLayer.Items.Clear(); diff --git a/FrmDatabaseParaSetting.cs b/FrmDatabaseParaSetting.cs index 39a4e4f..e4dfe80 100644 --- a/FrmDatabaseParaSetting.cs +++ b/FrmDatabaseParaSetting.cs @@ -123,7 +123,6 @@ { MessageBox.Show("数据库连接成功!", "提示"); } - } else { diff --git a/FrmShResult.cs b/FrmShResult.cs index d11fd66..50a7d8c 100644 --- a/FrmShResult.cs +++ b/FrmShResult.cs @@ -663,7 +663,6 @@ private void FrmShResult_FormClosed(object sender, FormClosedEventArgs e) { mainfrm.boolfrmShResult = false; - } /// /// 一键审核导出 diff --git a/MainFrm.cs b/MainFrm.cs index 2e3ba7f..83acfa1 100644 --- a/MainFrm.cs +++ b/MainFrm.cs @@ -19,7 +19,6 @@ { public partial class MainFrm : Office2007Form { - TreeNode layerManagerNode = null; TreeNode myPlaceNode = null; bool m_bFullScreen = false; @@ -1395,7 +1394,6 @@ private void MainFrm_Load(object sender, EventArgs e) { - this.initGlobalControl(); this.initGlobalMap(); this.initLayerTree(); @@ -1403,13 +1401,11 @@ this.initLayout(); this.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]); jumpToCameraState(x, y, z); - } #endregion @@ -1578,12 +1574,6 @@ 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)); - /*Point pt = getUpperLeftPoint(pt1, pt2); - Image myImg = new Bitmap(Convert.ToInt32(e.Rect.Width), Convert.ToInt32(e.Rect.Height)); - Graphics g = Graphics.FromImage(myImg); - g.CopyFromScreen(pt, new Point(0, 0), new Size(Convert.ToInt32(e.Rect.Width), Convert.ToInt32(e.Rect.Height))); - */ - int mapWidth = 0; int mapHeight = 0; Point pt = getUpperLeftPoint(pt1, pt2, out mapWidth, out mapHeight); @@ -1862,7 +1852,6 @@ { GSOLayer layer = node.Tag as GSOLayer; - //globeControl1.Globe.Layers.Remove(layer); for (int i = globeControl1.Globe.Layers.Count - 1; i >= 0; i--) { if (globeControl1.Globe.Layers[i].Caption == layer.Caption) @@ -2065,7 +2054,6 @@ } } - void globeControl1_MouseWheel(object sender, MouseEventArgs e) { if (globeControl1.Globe.CameraState.Distance > 20000000) @@ -2321,8 +2309,6 @@ case "valvequery": FrmValveStatistics frm = new FrmValveStatistics(globeControl1, polygon, new DataGridViewDelegate(InitDataGridViewX1)); frm.Show(this); - //panelEx6.Visible = true; - //toolStripFeatureLength.Text = ""; globeControl1.Globe.Action = EnumAction3D.ActionNull; break; @@ -2365,7 +2351,6 @@ layerGround.Visible = false; } } - // 清除当前TrackPolygonAnalysis的痕迹 globeControl1.Globe.ClearLastTrackPolygon(); globeControl1.Globe.Action = EnumAction3D.ActionNull; break; @@ -2382,20 +2367,7 @@ globeControl1.Globe.Action = EnumAction3D.ActionNull; break; case "BSQDuoBianXiangStatis": - - //GSOFeature f2 = new GSOFeature(); - //f2.Geometry = e.Polygon; - //f2.Geometry.AltitudeMode = EnumAltitudeMode.Absolute; - //globeControl1.Globe.MemoryLayer.AddFeature(f2); - //f2.Geometry.MoveZ(3); - //workWellLen.Clear(); - //List listBSQ = new List(); - - //GSOFeatures bsqFeatures = PolygonIntersectAnalysis(e.Polygon, "标识器"); - //listBSQ.Add(bsqFeatures); - - //FrmBSQDuoBianXingStatis bsqFrm = new FrmBSQDuoBianXingStatis(workWellLen, globeControl1, listBSQ); - FrmBSQStatis bsqFrm = new FrmBSQStatis(globeControl1, e.Polygon); + FrmBSQStatis bsqFrm = new FrmBSQStatis(globeControl1, e.Polygon); bsqFrm.Show(this); globeControl1.Globe.Action = EnumAction3D.ActionNull; break; @@ -2407,8 +2379,6 @@ } } } - - /// /// 鼠标悬浮提示 /// @@ -2432,20 +2402,19 @@ } catch (Exception ex) { - //LogError.PublishError(ex); + LogError.PublishError(ex); } } - + /// /// 添加管线绘制完成事件, 红线工具绘制完成 /// /// - /// + /// (完善) void globeControl1_MouseDoubleClick(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left) { - if (m_AddPipeLine == true && globeControl1.Globe.Action == EnumAction3D.DrawPolyline)//添加管线 { GSOLayer layerDest = globeControl1.Globe.DestLayerFeatureAdd; @@ -2661,18 +2630,12 @@ { if (e.Button == MouseButtons.Right) { - if (e.X == mouseDownX2 && e.Y == mouseDownY2) - { - RightScreenToolMenu.Show(globeControl2, e.X, e.Y); - } - else - { - return; - } + if (e.X != mouseDownX2 || e.Y != mouseDownY2) return; + RightScreenToolMenu.Show(globeControl2, e.X, e.Y); } } /// - /// + /// (完善) /// /// /// @@ -2912,7 +2875,6 @@ bool result = false; System.Net.WebResponse response = null; - try { System.Net.WebRequest req = System.Net.WebRequest.Create(fileUrl); @@ -3038,7 +3000,7 @@ } /// - /// 拼接气泡表格字符串 + /// 拼接气泡表格字符串(完善) /// /// /// @@ -3233,14 +3195,8 @@ { TreeNode featureAddPipeFitTreenode = GetDestLayerFeatureAddTreeNode(); GSOLayer featureAddLayer = globeControl1.Globe.Layers.GetLayerByCaption(featureAddPipeFitTreenode.Tag.ToString().Split('|')[1]); - if (featureAddLayer != null) - { - return featureAddLayer; - } - else - { - return null; - } + + return featureAddLayer != null ? featureAddLayer : null; } private TreeNode GetDestLayerFeatureAddTreeNode() @@ -3306,7 +3262,6 @@ return null; } - /// /// 地上模式 菜单按钮 /// @@ -3335,22 +3290,16 @@ 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(); - } } /// @@ -3382,13 +3331,9 @@ 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; } @@ -3426,20 +3371,8 @@ globeControl1.Globe.GroundOpaque = 100 - sliderGroundTransSet1.Value; GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(roadLayerName);//("180fd"); if (layer != null) - { layer.Opaque = 100 - sliderGroundTransSet1.Value; - } - //if (buttonItemSPDB.Checked) - //{ - // layer = globeControl2.Globe.Layers.GetLayerByCaption("180fd"); - // if (layer != null) - // { - // layer.Opaque = 100 - sliderGroundTransSet1.Value; - // } - // globeControl2.Globe.GroundOpaque = 100 - sliderGroundTransSet1.Value; - //} optiValue = sliderGroundTransSet1.Value; - //sliderItem1.Value = optiValue; } /// /// 图例 菜单按钮 @@ -3499,21 +3432,7 @@ panel3.Visible = false; sideBar1.ExpandedPanel = sideBarPanelItem3; buttonItemBZ11.Checked = false; - - //20160624 - /* - if (sideBarPanelItem4.Visible == true) - { - sideBar1.Visible = true; - controlContainerItem5.Visible = true; - } - else - { - sideBar1.Visible = false; - } - */ Refresh(); - } } /// @@ -3542,7 +3461,7 @@ int xOld = 0; int yOld = 0; /// - /// 全屏显示功能实现 + /// 全屏显示功能实现(完善) /// private void FullScreen() { @@ -3666,7 +3585,6 @@ FullScreen(); break; case Keys.Escape: - // esc仅仅取消全屏 if (m_bFullScreen) { FullScreen(); @@ -3682,7 +3600,6 @@ } } - private Point getUpperLeftPoint(Point p1, Point p2, out int mapWidth, out int mapHeight) // { Rectangle rc = new Rectangle(); @@ -3695,29 +3612,13 @@ int screenWidth = SystemInformation.WorkingArea.Width; int screenHeight = SystemInformation.WorkingArea.Height; - if (p1.X < x) - rc.X = x; - else - rc.X = p1.X; - - if (p1.Y < y) - rc.Y = y; - else - rc.Y = p1.Y; - + rc.X = p1.X < x ? x : p1.X; + rc.Y = p1.Y < y ? y : p1.Y; p1.X = rc.Left; p1.Y = rc.Top; - if (p2.X > screenWidth) - p2.X = screenWidth; - else - p2.X = p2.X; - - if (p2.Y > screenHeight) - p2.Y = screenHeight; - else - p2.Y = p2.Y; - + p2.X = p2.X > screenWidth ? screenWidth : p2.X; + p2.Y = p2.Y > screenHeight ? screenHeight : p2.Y; rc.Width = p2.X - rc.X; rc.Height = p2.Y - rc.Y; @@ -3728,7 +3629,6 @@ } Image printImage; - private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e) { e.Graphics.DrawImage(printImage, 10, 10); @@ -3742,15 +3642,8 @@ { LogManager.saveLog(Utility.userName, this.btnOutputJPG.Text); - //globeControl1.Globe.Action = EnumAction3D.TrackRect; //绘制矩形模式 - //globeControl1.Globe.TrackRectTool.TrackMode = EnumTrackMode.ScreenTrack; //在屏幕上绘制 Point pt1 = new Point(Convert.ToInt32(0), Convert.ToInt32(0)); Point pt2 = new Point(Convert.ToInt32(panelEx5.Width), Convert.ToInt32(panelEx5.Height)); - /*Point pt = getUpperLeftPoint(pt1, pt2); - Image myImg = new Bitmap(Convert.ToInt32(panelEx5.Width), Convert.ToInt32(panelEx5.Height)); - Graphics g = Graphics.FromImage(myImg); - g.CopyFromScreen(pt, new Point(0, 0), new Size(Convert.ToInt32(panelEx5.Width), Convert.ToInt32(panelEx5.Height))); - */ int mapWidth = 0; int mapHeight = 0; Point pt = getUpperLeftPoint(pt1, pt2, out mapWidth, out mapHeight); @@ -3784,120 +3677,6 @@ } } } - - /// - /// 窗体下方属性表格 右键菜单中的 “定位”菜单 - /// - /// - /// - private void FlyToMenu_Click(object sender, EventArgs e) - { - GSOFeature rowFeature = contextMenuStrip1.Tag as GSOFeature; - if (rowFeature == null) - return; - - - 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); - } - else - { - globeControl1.Globe.FlyToFeature(rowFeature, 0, 45, 3); - } - LightMenu_Click(sender, e); - - } - - /// - /// 表格中右键 “单个闪烁” 菜单 - /// - /// - /// - private void LightMenu_Click(object sender, EventArgs e) - { - flashflag = "single"; - timer1.Start(); - } - /// - /// 表格中右键 “全部闪烁” 菜单 - /// - /// - /// - private void AllLightMenuItem_Click(object sender, EventArgs e) - { - flashflag = "all"; - timer1.Start(); - } - - /// - /// 使用timer实现管线的闪烁效果 - /// - /// - /// - private void timer1_Tick(object sender, EventArgs e) - { - GSOFeature rowFeature = contextMenuStrip1.Tag as GSOFeature; - if (rowFeature == null) - return; - - if (count < 40) - { - count++; - if (flashflag == "single") - { - if (rowFeature != null) - { - if (count % 2 != 0) - { - rowFeature.HighLight = true; - globeControl1.Refresh(); - } - else - { - rowFeature.HighLight = false; - globeControl1.Refresh(); - } - } - } - else if (flashflag == "all") - { - GSOFeatures feats = Utility.Table2Features(dataGridViewX1.DataSource as DataTable, m_CurrentQueryLayer, globeControl1); - if (feats.Length > 0) - { - if (count % 2 != 0) - { - for (int i = 0; i < feats.Length; i++) - { - GSOFeature tempfeat = feats[i]; - tempfeat.HighLight = true; - } - - globeControl1.Refresh(); - } - else - { - for (int i = 0; i < feats.Length; i++) - { - GSOFeature tempfeat = feats[i]; - tempfeat.HighLight = false; - } - globeControl1.Refresh(); - } - } - } - } - else - { - timer1.Stop(); - count = 0; - } - } /// /// 图层目录树 右键菜单中的 目标图层 菜单 /// @@ -3910,7 +3689,6 @@ TreeNode node = layerNodeContexMenu.Tag as TreeNode; FeatureAddLayerMenuItem.Checked = true; GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(node.Tag.ToString().Split('|')[1]); - //GSOLayer layer = globeControl1.Globe.Layers.GetLayerByID((int)node.Tag); globeControl1.Globe.DestLayerFeatureAdd = layer; } } @@ -3954,7 +3732,6 @@ layer.Dataset.Save(); } - #region wxl feature的公共方法 /// /// 查找指定图层中在 指定范围内的feature对象集合 @@ -3966,24 +3743,10 @@ { GSOFeatures feats = new GSOFeatures(); GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(layername); - if (layer == null) - { - return feats; - } + if (layer == null)return feats; GSOFeatureLayer flayer = layer as GSOFeatureLayer; - if (flayer != null) - { - GSOFeatureDataset fdataset = flayer.Dataset as GSOFeatureDataset; - } - - if (polygon == null) - { - feats = flayer.GetAllFeatures(); - } - else - { - feats = flayer.FindFeaturesInPolygon(polygon, false); - } + if (flayer == null) return feats; + feats = polygon == null ? flayer.GetAllFeatures() : flayer.FindFeaturesInPolygon(polygon, false); return feats; } #endregion @@ -4014,10 +3777,7 @@ if (globeControl1.Globe.Action != EnumAction3D.NormalHit) { buttonItemFX3_6.Checked = false; - // ClearConnexityAnalysis(); - buttonItemFX3_5.Checked = false; - // ClearCloseValvesAnalysis(); } if (globeControl1.Globe.Action != EnumAction3D.TrackPolygon) { @@ -4025,7 +3785,6 @@ buttonItemFX4_1.Checked = false; } } - /// /// 主窗体关闭事件处理 /// @@ -4033,21 +3792,13 @@ /// private void MainFrm_FormClosing(object sender, FormClosingEventArgs e) { - if (MessageBox.Show("是否退出系统?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) - { e.Cancel = true; - } else - { globeControl1.Globe.MemoryLayer.SaveAs(Application.StartupPath + "/MyPlace.kml"); - } - - //saveLayerList(layerManagerNode.Nodes); - //注销id号为103的热键设定 - // UnregisterHotKey(Handle, 103); } + #region 完善 /// /// 垂直净距分析 功能界面中的 选择图层复选框 选中状态改变事件处理 /// @@ -4198,12 +3949,10 @@ } } } - Dictionary featCount = new Dictionary(); Dictionary featLenth = new Dictionary(); Dictionary m_FeaturesWithBianhao = new Dictionary();//记录编号和对应的标注点的位置 GSOFeatures polygonJingJuAnalysises = new GSOFeatures(); - /// /// 垂直净距分析 功能界面中的 开始分析按钮 事件处理 /// @@ -4293,7 +4042,6 @@ globeControl1.Refresh(); this.Cursor = Cursors.Default; } - /// /// 在指定的两点组成的线的中间添加一个marker对象,并将marker对象添加到指定的图层中 /// @@ -4357,7 +4105,6 @@ return dismarker.Position; } - /// /// 计算指定feature对象与除了该feature所在图层之外的 所有管线图层中的所有feature对象 的垂直距离 并在表格中记录符合要求的管线 /// @@ -4411,8 +4158,7 @@ double dDist = -1; dDist = globeControl1.Globe.Analysis3D.ComputeHorizonDistance(line1, line2, out pntIntersect1, out pntIntersect2, out pntProIntersect1, out pntProIntersect2, false); - //dDist = globeControl1.Globe.Analysis3D.ComputeVerticalDistance(line1, line2, out pntIntersect1, out pntIntersect2, out pntProIntersect1, out pntProIntersect2, false); - + if (dDist > -1) { dDist = Math.Abs(pntIntersect1.Z - pntIntersect2.Z) - pipeStyle1.Radius - pipeStyle2.Radius;//获得净距值 @@ -4472,25 +4218,6 @@ } } } - - //double verticalDis = dDist; - //dDist = globeControl1.Globe.Analysis3D.ComputeVerticalDistance(line1, line2, out pntIntersect1, out pntIntersect2, out pntProIntersect1, out pntProIntersect2, false); - //if (dDist > -1) - //{ - // dDist = Math.Abs(pntIntersect1.Z - pntIntersect2.Z) - pipeStyle1.Radius - pipeStyle2.Radius; - // if (dDist < horizontalDistance) - // { - // 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 = verticalDis.ToString("0.00"); - // dataGridViewAnalysisResult.Rows[idx].Cells[5].Value = dDist.ToString("0.00"); - // } - //} } if (m_FeaturesWithBianhao.ContainsKey(selectedFeature.Name + "-" + feats2[j].Name) == false) @@ -4545,7 +4272,6 @@ } } } - /// /// 水平净距分析 功能界面中 开始分析按钮 的事件处理 /// @@ -4629,8 +4355,6 @@ globeControl1.Refresh(); this.Cursor = Cursors.Default; } - - /// /// 计算指定feature对象与除了该feature所在图层之外的 所有管线图层中的所有feature对象 的水平距离 并记录符合要求的管线 功能 /// @@ -4820,7 +4544,6 @@ else { MessageBox.Show("请选中要进行碰撞分析的管线!", "提示"); - //globeControl1.Globe.Action = EnumAction3D.SelectObject; } globeControl1.Refresh(); this.Cursor = Cursors.Default; @@ -4845,9 +4568,6 @@ } } } - - - /// /// 覆土分析功能操作界面中的 选择管线 复选框选中状态改变事件处理 /// @@ -5071,11 +4791,9 @@ else { MessageBox.Show("请选中要进行覆土分析的管线!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); - //globeControl1.Globe.Action = EnumAction3D.SelectObject; } this.Cursor = Cursors.Default; } - /// /// 覆土分析中 表格的 双击定位 功能 /// @@ -5155,8 +4873,6 @@ //Refresh(); } - - /// /// 垂直净距分析 功能界面中 清除分析结果按钮 事件处理 /// @@ -5201,7 +4917,6 @@ layerTemp.RemoveAllFeature(); globeControl1.Refresh(); } - /// /// 垂直净距分析功能界面中 关闭按钮 事件处理 /// @@ -5262,7 +4977,6 @@ Refresh(); } - /// /// 导出指定DataGridView控件中的内容 /// @@ -5352,7 +5066,6 @@ } } } - /// /// 垂直净距分析功能界面中 导出Excel按钮 事件处理 /// @@ -5384,103 +5097,7 @@ { MessageBox.Show("表格内容为空!", "提示"); } - } - - - - /// - /// 添加指定路径下的数据 功能 - /// - /// - /// - private object AddLayerData(string strDataPath) - { - object objRes = null; - if (Path.GetExtension(strDataPath).ToLower().Equals(".kml")) - { - GSOLayer layer = globeControl1.Globe.Layers.Add(strDataPath); - objRes = layer; - if (layer != null) - { - 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; - // 注意用insert不要用add,因为后加入的图层在上层 - //layerManagerNode.Nodes.Add(node); - layerManagerNode.Nodes.Insert(0, node); - } - newlayername = layer.Caption; - } - else if (GSOUtility.IsDatasetSupportTerrain(strDataPath)) - { - GSOTerrain terrain = globeControl1.Globe.Terrains.Add(strDataPath); - objRes = terrain; - if (terrain != null) - { - TreeNode node = new TreeNode(); - node.Tag = terrain; - node.Text = terrain.Caption; - node.ImageIndex = 0; - node.SelectedImageIndex = 0; - node.Checked = terrain.Visible; - // 注意用insert不要用add,因为后加入的图层在上层 - // terrainManagerNode.Nodes.Add(node); - layerManagerNode.Nodes.Insert(0, node); - } - newlayername = terrain.Caption; - } - else if (Path.GetExtension(strDataPath).ToLower().Equals(".dxf")) - { - GSOLayer layer = globeControl1.Globe.Layers.Add(strDataPath); - objRes = layer; - if (layer != null) - { - GSODataset dataset = layer.Dataset; - CheckDatasetGeoReference(layer.Dataset, strDataPath); - CheckDatasetGeoReference(layer.Dataset, strDataPath); - TreeNode node = new TreeNode(); - node.Tag = layer; - node.Text = layer.Dataset.Caption; - node.ImageIndex = 0; - node.SelectedImageIndex = 0; - node.Checked = layer.Visible; - // 注意用insert不要用add,因为后加入的图层在上层 - //layerManagerNode.Nodes.Add(node); - layerManagerNode.Nodes.Insert(0, node); - } - newlayername = layer.Caption; - } - else - { - GSOLayer layer = globeControl1.Globe.Layers.Add(strDataPath); - objRes = layer; - if (layer != null) - { - GSODataset dataset = layer.Dataset; - - CheckDatasetGeoReference(layer.Dataset, strDataPath); - CheckDatasetGeoReference(layer.Dataset, strDataPath); - //CheckDatasetGeoReference(dataset); - TreeNode node = new TreeNode(); - node.Tag = layer; - node.Text = layer.Dataset.Caption; - node.ImageIndex = 0; - node.SelectedImageIndex = 0; - node.Checked = layer.Visible; - // 注意用insert不要用add,因为后加入的图层在上层 - //layerManagerNode.Nodes.Add(node); - layerManagerNode.Nodes.Insert(0, node); - } - newlayername = layer.Caption; - } - return objRes; - } - + } /// /// 碰撞分析功能界面中 选择管线复选框 选中状态改变事件处理 /// @@ -5600,7 +5217,6 @@ //globeControl1.Globe.Action = EnumAction3D.SelectObject; } } - /// /// 碰撞分析功能界面中 清除分析结果按钮 事件处理 /// @@ -5638,344 +5254,6 @@ MessageBox.Show("表格内容为空!", "提示"); } } - - ///// - ///// 区域分析 菜单 - ///// - ///// - ///// - //private void buttonItem50_Click(object sender, EventArgs e) - //{ - // buttonItem50.Checked = !buttonItem50.Checked; - // ribbonBarQY.Visible = buttonItem50.Checked; - // ribbonBarQY.Location = new Point(0, 0); - //} - - - /// - /// 连接数据库 菜单事件处理 - /// - /// - /// - private void ConnectDB(object sender, EventArgs e) - { - FrmDatabaseParaSetting frm = new FrmDatabaseParaSetting(globeControl1); - if (frm.ShowDialog() == DialogResult.OK) - { - ds = FrmDatabaseParaSetting.ds; - if (ds != null) - { - ds.IsCloseSaved = false; - } - } - } - - /// - /// 根据指定图层创建图层节点并将节点添加到图层管理节点的子节点集合中 - /// - /// - private void addNodeToLayerManagerNode(GSOLayer layer) - { - if (layer != null) - { - 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; - - if (!layerManagerNode.Nodes.Contains(node)) - { - layerManagerNode.Nodes.Insert(0, node); - layerManagerNode.Expand(); - } - } - } - - /// - /// 获取指定图层中最后一个feature对象的名称对应的整数 - /// - /// - /// - public int getLabelName(GSOLayer layer) - { - int nid = -1; - if (layer.GetAllFeatures().Length > 0) - { - string id = layer.GetAllFeatures()[layer.GetAllFeatures().Length - 1].Name; - - int.TryParse(id, out nid); - } - else - { - nid = 0; - } - return nid; - } - /// - /// 设置除指定标注图层之外的所有标注图层不可见 - /// - /// - public void setMarkerLayerUnVisible(string layerName) - { - string[] markerStrs = new string[10]; - markerStrs[0] = "标高标注"; - markerStrs[1] = "管径标注"; - markerStrs[2] = "埋深标注"; - markerStrs[3] = "坐标标注"; - markerStrs[4] = "坡度标注"; - markerStrs[5] = "属性标注"; - markerStrs[6] = "自定义标注"; - markerStrs[7] = "距离标注"; - markerStrs[8] = "红线工具"; - markerStrs[9] = "扯旗标注"; - - for (int i = 0; i < markerStrs.Length; i++) - { - GSOLayer markerLayer = globeControl1.Globe.Layers.GetLayerByCaption(markerStrs[i]); - if (markerLayer != null) - { - if (markerStrs[i] != layerName) - { - 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) - { - markerFeature.Visible = false; - } - } - if (layerMarkerTree.Nodes[0].Nodes.Count > i) - { - layerMarkerTree.Nodes[0].Nodes[i].Checked = true; - } - } - } - } - } - - /// - /// 判断选中的对象是否为管线 - /// - /// 被选中管线 - /// 返回一根线 - private GSOFeature IsPipeLineOfSelectedObj() - { - GSOFeature resFeature = null; - if (globeControl1.Globe.SelObjectCount < 1) - { - return null; - } - GSOLayer resLayer = null; - globeControl1.Globe.GetSelectObject(0, out resFeature, out resLayer); - if (resFeature == null) - return null; - - GSOGeoPolyline3D line1 = resFeature.Geometry as GSOGeoPolyline3D; - if (line1 == null) - { - return null; - } - GSOPipeLineStyle3D pipeStyle1 = line1.Style as GSOPipeLineStyle3D; - if (pipeStyle1 == null) - { - return null; - } - return resFeature; - } - - /// - /// 图层节点树中 节点 右键单击事件处理 - /// - /// - /// - private void layerMarkerTree_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e) - { - if (e.Button == MouseButtons.Right) - { - if (e.Node.Text == "标注管理" || e.Node.Text == "传感器管理") - { - return; - } - else if (e.Node.Parent.Text == "标注管理") - { - layerMarkerTree.SelectedNode = e.Node; - contextMenuStrip2.Show(layerMarkerTree, e.X, e.Y); - contextMenuStrip2.Tag = e.Node; - } - else if (e.Node.Parent.Text == "传感器管理") - { - layerSensorTree.SelectedNode = e.Node; - contextMenuStrip2.Show(layerSensorTree, e.X, e.Y); - contextMenuStrip2.Tag = e.Node; - } - else - { - if (e.Node.Tag is GSOFeature) - { - if (e.Node.Parent.Parent.Text == "标注管理") - { - layerMarkerTree.SelectedNode = e.Node; - contextMenuStrip3.Show(layerMarkerTree, e.X, e.Y); - contextMenuStrip3.Tag = e.Node; - } - else if (e.Node.Parent.Parent.Text == "传感器管理") - { - layerSensorTree.SelectedNode = e.Node; - contextMenuStrip3.Show(layerSensorTree, e.X, e.Y); - contextMenuStrip3.Tag = e.Node; - } - } - } - } - } - - /// - /// 标注管理、传感器管理 图层目录树的右键菜单中的 刷新列表 菜单 - /// - /// - /// - private void toolStripMenuItem1_Click(object sender, EventArgs e) - { - TreeNode node = contextMenuStrip2.Tag as TreeNode; - TreeNode parentNode = node.Parent; - Int32 nIndex = node.Index; - - if (parentNode.Text == "标注管理" || parentNode.Text == "传感器管理") - { - RefreshTreeNodeLayerFeatureList(node); - } - } - /// - /// 给指定的图层节点添加代表feature对象的子节点 - /// - /// - private void RefreshTreeNodeLayerFeatureList(TreeNode layerTreeNode) - { - layerTreeNode.Nodes.Clear(); - GSOLayer layer = (GSOLayer)layerTreeNode.Tag; - // 只将类型为内存数据集的图层列出,如果是其它类型的数据集可能数据量太大,没发显示在树控件中 - if (layer.Dataset is GSOFeatureDataset) - { - VisitFeature3Ds(layer.GetAllFeatures(), layerTreeNode); - } - } - - /// - /// 标注管理、传感器管理 图层目录树的右键菜单中的 移除所有 菜单 - /// - /// - /// - private void toolStripMenuItem2_Click(object sender, EventArgs e) - { - TreeNode node = contextMenuStrip3.Tag as TreeNode; - GSOFeature feature3d = node.Tag as GSOFeature; - if (node == null) - { - return; - } - if (feature3d != null) - { - feature3d.Delete(); - globeControl1.Globe.Refresh(); - node.Remove(); - } - } - - /// - /// 图层目录树的 节点对应的复选框选中状态改变事件处理 - /// - /// - /// - private void layerMarkerTree_AfterCheck(object sender, TreeViewEventArgs e) - { - if (e.Action != TreeViewAction.Unknown) - { - CheckTreeNode(e.Node, e.Node.Checked); - } - } - /// - /// 改变指定节点对应的复选框的选中状态 - /// - /// - /// - private void CheckTreeNode(TreeNode node, Boolean bChecked) - { - CheckChildTreeNode(node, bChecked); - globeControl1.Globe.Refresh(); - } - /// - /// 改变指定节点的子节点对应的复选框的选中状态 - /// - /// - /// - private void CheckChildTreeNode(TreeNode node, Boolean bChecked) - { - if (node == null) - { - return; - } - if (node.Tag != null) - { - if (node.Tag.GetType() == typeof(GSOFeatureFolder) || node.Tag.GetType() == typeof(GSOFeature)) - { - ((GSOFeature)node.Tag).SetVisibleDirectly(bChecked); - } - else - { - GSOLayer curLayer = node.Tag as GSOLayer; - GSOTerrain curTerrain = node.Tag as GSOTerrain; - if (curLayer != null) - { - curLayer.Visible = bChecked; - } - else if (curTerrain != null) - { - curTerrain.Visible = bChecked; - } - } - } - // 递归处理子节点 - for (int i = 0; i < node.Nodes.Count; i++) - { - node.Nodes[i].Checked = bChecked; - CheckChildTreeNode(node.Nodes[i], bChecked); - } - } - /// - /// 标注管理、传感器管理 目录树中的feature节点的右键菜单中的 删除 菜单 - /// - /// - /// - private void 删除ToolStripMenuItem1_Click(object sender, EventArgs e) - { - TreeNode node = contextMenuStrip2.Tag as TreeNode; - GSOLayer l = globeControl1.Globe.Layers.GetLayerByCaption(node.Text); - if (l != null) - { - l.RemoveAllFeature(); - node.Nodes.Clear(); - globeControl1.Refresh(); - } - } - - //定时检查传感器的状态 - public System.Windows.Forms.Timer timerOfSensor = null; - - /// /// 碰撞分析 功能界面中 关闭按钮 事件处理 /// @@ -5984,7 +5262,6 @@ private void buttonX7_Click_1(object sender, EventArgs e) { trackflag = ""; - globeControl1.Globe.Action = EnumAction3D.ActionNull; sideBarPanelItem4.Visible = false; panel2.Visible = false; @@ -5994,14 +5271,9 @@ dataGridViewX4.Rows.Clear(); dataGridViewX5.Rows.Clear(); if (buttonItem1.Checked) - { sideBar1.ExpandedPanel = sideBarPanelItem3; - } else - { sideBar1.Visible = false; - - } Refresh(); } /// @@ -6193,14 +5465,8 @@ comboBoxLayer.SelectedIndex = -1; dataGridViewLineList.Rows.Clear(); dataGridViewAnalysisResult.Rows.Clear(); - //if (buttonItem1.Checked) - //{ - // sideBar1.ExpandedPanel = sideBarPanelItem3; - //} - //else - //{ + sideBar1.Visible = false; - //} Refresh(); } /// @@ -6225,9 +5491,7 @@ globeControl1.Globe.JumpToPosition(point3d, EnumAltitudeMode.Absolute, 5); } else - { globeControl1.Globe.JumpToFeature(rowFeature, 5); - } } } } @@ -6308,897 +5572,6 @@ } } } - - /// - /// 一键审核---导入数据 - /// - /// - /// - private void buttonItem127_Click_2(object sender, EventArgs e) - { - LogManager.saveLog(Utility.userName, "打开数据"); - - try - { - - string dbIp = Utility.sgdbip; - string database = Utility.sgdbname; - string user = Utility.sgdbuser; - string pass = Utility.sgdbpwd; - shds = globeControl1.Globe.DataManager.OpenOracleDataSource(dbIp + "/" + database, "", "", user, pass); - if (shds == null) - { - MessageBox.Show("数据库连接失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); - } - Cyberpipe.Forms.FrmPipelineModelDataOneStep frm = new Cyberpipe.Forms.FrmPipelineModelDataOneStep(globeControl1, shds, layerTree); - if (frm.ShowDialog() == DialogResult.OK) - { - addNodeToLayerManagerNode(frm.rukuLayer); - } - } - catch (Exception ex) - { - LogError.PublishError(ex); - MessageBox.Show("内存过载请清理内存,并重新启动规划分析!", "提示"); - return; - } - - } - - /// - ///自动导出图片 - /// - /// - /// - private void buttonItem130_Click_1(object sender, EventArgs e) - { - LogManager.saveLog(Utility.userName, "导出审核图"); - - Point pt1 = new Point(Convert.ToInt32(0), Convert.ToInt32(0)); - Point pt2 = new Point(Convert.ToInt32(panelEx5.Width), Convert.ToInt32(panelEx5.Height)); - /*Point pt = getUpperLeftPoint(pt1, pt2); - Image myImg = new Bitmap(Convert.ToInt32(panelEx5.Width), Convert.ToInt32(panelEx5.Height)); - Graphics g = Graphics.FromImage(myImg); - g.CopyFromScreen(pt, new Point(0, 0), new Size(Convert.ToInt32(panelEx5.Width), Convert.ToInt32(panelEx5.Height))); - */ - - 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 = System.IO.Path.GetExtension(dlg.FileName);//扩展名 - switch (extension) - { - case ".jpg": - myImg.Save(dlg.FileName, System.Drawing.Imaging.ImageFormat.Jpeg); - break; - case ".png": - myImg.Save(dlg.FileName, System.Drawing.Imaging.ImageFormat.Png); - break; - case ".bmp": - myImg.Save(dlg.FileName, System.Drawing.Imaging.ImageFormat.Bmp); - break; - case ".gif": - myImg.Save(dlg.FileName, System.Drawing.Imaging.ImageFormat.Gif); - break; - default: - break; - } - } - } - /// - /// 一键审核功能 - /// - /// - /// - private void buttonItem128_Click(object sender, EventArgs e) - { - LogManager.saveLog(Utility.userName, this.buttonItem128.Text); - //垂直净距标准 - - frmSh = new FrmYJSHTC(globeControl1, globeControl2, layerTree); - - if (frmSh.ShowDialog() == DialogResult.OK) - { - frmWait = new FrmWait("一键审核……"); - frmWait.Location = new Point(this.Width - frmWait.Width - 10, this.Height - frmWait.Height - 50); - frmWait.Owner = this; - frmWait.Show(); - Thread thread = new Thread(new ThreadStart(doWork)); - thread.IsBackground = true; - thread.Start(); - } - } - - void doWork() - { - FrmShResult frmShResult = null; - - double dVerticalJingJuBiaoZhun = 1, dHorizontalJingJuBiaoZhun = 1; - if (frmSh.rukuLayer != null) - { - #region - this.Invoke((EventHandler)delegate - { - try - { - List managerLayerList = new List(); - for (int i = 0; i < layerManagerNode.Nodes.Count; i++) - { - managerLayerList.Add(layerManagerNode.Nodes[i].Text); - } - if (!managerLayerList.Contains(frmSh.rukuLayer.Caption)) - { - TreeNode node = new TreeNode(); - node.Tag = frmSh.rukuLayer; - node.Text = frmSh.rukuLayer.Dataset.Caption; - node.ImageIndex = 0; - node.SelectedImageIndex = 0; - node.Checked = frmSh.rukuLayer.Visible; - layerManagerNode.Nodes.Insert(0, node); - layerManagerNode.Expand(); - } - } - catch (Exception ex) - { - MessageBox.Show(ex.Message, "提示"); - } - }); - #endregion - - shlayername = frmSh.rukuLayer.Name; - globeControl1.Refresh(); - } - - if (frmShResult != null && !frmShResult.IsDisposed) - { - try - { - clearFeatureHighLight(); - ClearRedlineAnalyseResult(); - frmShResult.Close(); - } - catch (Exception ex) - { - MessageBox.Show(ex.Message); - } - } - - frmShResult = new FrmShResult(dVerticalJingJuBiaoZhun, dHorizontalJingJuBiaoZhun, shlayername, globeControl1, m_PipelineLayerNames); - if (boolfrmShResult == false) - { - frmShResult.Location = new Point(this.Width - frmShResult.Width - 10, this.Height - frmShResult.Height - 50); - frmShResult.Owner = this; - //一键审核实际计算步骤 - frmShResult.analysis(); - - //MainFrm窗体显示控制,回到一键审核Tab - this.Invoke((EventHandler)delegate - { - frmShResult.Show(); - frmWait.Close(); - //将tab页恢复到一键审核 - ribbonTabItem11.Checked = true; - try - { - globeControl1.Globe.Action = EnumAction3D.ActionNull; - //zhanshi = false; - splitContainer1.Panel2Collapsed = true; - - panelOfTable.Visible = false; - legendSC.Visible = false; - legendSG.Visible = false; - - GSOLayer redLayer = globeControl1.Globe.Layers.GetLayerByCaption("红线"); - if (redLayer != null) - { - redLayer.Visible = false; - } - } - catch (Exception ex) - { - MessageBox.Show("系统运行错误:" + ex.ToString(), "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); - } - - }); - - boolfrmShResult = true; - } - else - { - - } - } - - - /// - /// 清除渲染结果 - /// - public void ClearRedlineAnalyseResult() - { - for (int i = 0; i < globeControl1.Globe.Layers.Count; i++) - { - GSOLayer layer = globeControl1.Globe.Layers[i]; - if (layer.Caption == "tempLgdData") - { - layer.RemoveAllFeature(); - } - } - - layerTemp.RemoveAllFeature(); - globeControl1.Refresh(); - } - /// - /// 已审核的图层 - /// - /// - /// - private void buttonItem132_Click_1(object sender, EventArgs e) - { - //保存日志 - LogManager.saveLog(Utility.userName, this.buttonItem132.Text); - - if (shds == null) - { - //没连的话,直接连接审核库; //审核库配置读配置文件 - string dbIp = Utility.sgdbip; - string database = Utility.sgdbname; - string user = Utility.sgdbuser; - string pass = Utility.sgdbpwd; - - /* - if (!Utility.isNetworkConnectionSuccess(dbIp.Trim())) - { - MessageBox.Show("网络连接失败!", "提示"); - return; - } - */ - - shds = globeControl1.Globe.DataManager.OpenOracleDataSource(dbIp + "/" + database, "", "", user, pass); - if (shds == null) - { - MessageBox.Show("数据库连接失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); - } - } - Cyberpipe.Forms.FrmShLayers frm = new Cyberpipe.Forms.FrmShLayers(globeControl1, shds); - frm.Show(); - //if (frm.ShowDialog() == DialogResult.OK) - //{ - // addNodeToLayerManagerNode(frm.rukuLayer); - //} - //if (frm.rukuLayer != null) - //{ - // shlayername = frm.rukuLayer.Name; - //} - - } - /// - /// 审核入库 - /// - /// - /// - private void buttonItem133_Click_1(object sender, EventArgs e) - { - LogManager.saveLog(Utility.userName, "审核入库"); - FrmShRK frmShrk = new FrmShRK(globeControl1); - frmShrk.Show(); - } - /// - /// 模拟设计修改 - /// - /// - /// - private void buttonItem134_Click_1(object sender, EventArgs e) - { - LogManager.saveLog(Utility.userName, "模拟设计修改"); - - frmModify = new FrmMnModify(globeControl1, shlayername, shresultLists); - - if (boolfrmModify == false) - { - frmModify.Owner = this; - frmModify.Location = new Point(this.Width - frmModify.Width - 10, this.Height - frmModify.Height - 50); - frmModify.Show(); - boolfrmModify = true; - } - else - { - - } - - } - - - - /// - /// 一键审核中调节透明度 - /// - /// - /// - private void sliderItem1_ValueChanged(object sender, EventArgs e) - { - LogManager.saveLog(Utility.userName, this.sliderItem1.Text); - - globeControl1.Globe.GroundOpaque = 100 - sliderItem1.Value; - GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(roadLayerName);//("180fd"); - if (layer != null) - { - layer.Opaque = 100 - sliderItem1.Value; - } - - optiValue = sliderItem1.Value; - } - /// - /// 红线审核中的透明度分析 - /// - /// - /// - private void sliderItem3_ValueChanged(object sender, EventArgs e) - { - LogManager.saveLog(Utility.userName, this.sliderItem3.Text); - - globeControl1.Globe.GroundOpaque = 100 - sliderItem3.Value; - GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(roadLayerName);//("180fd"); - if (layer != null) - { - layer.Opaque = 100 - sliderItem3.Value; - } - optiValue = sliderItem3.Value; - } - - #region yanxiaowei - //初始化DataGridViewX1控件 - public delegate void DataGridViewDelegate(DataTable dt, string strLable, string strLayer, bool initDataGrid); - /// - /// 代理函数,操作DatgridViewX1 - /// - /// - /// - public void InitDataGridViewX1(DataTable dt, string strLable, string strLayer, bool initDataGrid) - { - if (initDataGrid == true) - { - dataGridViewX1.DataSource = dt; - panelOfTable.Visible = true; - toolStripNumbers.Text = strLable; - dataGridViewX1.Tag = strLayer; - } - else - { - dataGridViewX1.DataSource = null; - dataGridViewX1.Refresh(); - panelOfTable.Visible = false; - toolStripNumbers.Text = ""; - dataGridViewX1.Tag = ""; - globeControl1.Globe.MemoryLayer.RemoveAllFeature();//清除双击产生的标注 - } - } - FrmAnalysisGuiHuaResult from; - /// - /// 主窗体下方属性表格 双击定位 功能 - /// - /// - /// - 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 if (dataGridViewX1.Columns.Contains("标识器编号")) - { - featureName = dataGridViewX1.Rows[hittestinfo.RowIndex].Cells["标识器编号"].Value.ToString(); - } - featureName = featureName.Trim(); - - GSOLayer layer = null; - layer = globeControl1.Globe.Layers.GetLayerByCaption(dataGridViewX1.Tag.ToString()); - - if (layer == null) return; - - GSOFeatures features = layer.GetFeatureByName(featureName, false); - if (features.Length == 0) return; - GSOFeature rowFeature = features[0]; - - ClassSearchAnalysis.AddMakerToLineFeature(globeControl1, rowFeature); - - } - } - } - else - { - if (e.Button == MouseButtons.Left) - { - if (from != null && !from.IsDisposed) - { - try - { - from.Close(); - } - catch (Exception ex) - { - LogError.PublishError(ex); - } - } - try - { - DataGridView.HitTestInfo hittestinfo = dataGridViewX1.HitTest(e.X, e.Y); - if (hittestinfo.RowIndex >= 0) - { - string layer = dataGridViewX1.Rows[hittestinfo.RowIndex].Cells["管线类型"].Value.ToString(); - string hxName = dataGridViewX1.Rows[hittestinfo.RowIndex].Cells["红线编号"].Value.ToString(); - FrmAnalysisGuiHuaResult frm = new FrmAnalysisGuiHuaResult(globeControl1, lineStruct, featsList, - panelOfTable, dataGridViewX1, layer, hxName); - frm.Location = new Point(this.Width - frm.Width - 10, this.Height - frm.Height - 20); - frm.Show(this); - - from = frm; - } - } - catch (Exception ex) - { - LogError.PublishError(ex); - } - } - } - } - - /// - /// 空间查询 - /// - /// - /// - private void buttonItemSearch1_Click(object sender, EventArgs e) - { - LogManager.saveLog(Utility.userName, this.buttonItemSearch1.Text); - - trackflag = "PipelineSpatialQuery"; - globeControl1.Globe.Action = EnumAction3D.TrackPolygon; - globeControl1.Globe.TrackPolygonTool.TrackMode = EnumTrackMode.SpaceTrack; - - } - /// - /// 关键字查询 - /// - /// - /// - private void buttonItemSearch9_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, this.buttonItemSearch9.Text); - - FrmKeywordQuery.ShowForm(globeControl1, m_PipelineLayerNames, new DataGridViewDelegate(InitDataGridViewX1)); - } - /// - /// 编号查询 - /// - /// - /// - private void buttonItemSearch2_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, this.buttonItemSearch2.Text); - - FrmCodingQuery.ShowForm(globeControl1, m_PipelineLayerNames, new DataGridViewDelegate(InitDataGridViewX1)); - } - /// - /// 坐标查询 - /// - /// - /// - private void buttonItemSearch3_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, this.buttonItemSearch3.Text); - - FrmSetLatLonPos.ShowForm(globeControl1); - } - /// - /// 附属物查询 - /// - /// - /// - private void buttonItemSearch10_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, this.buttonItemSearch10.Text); - - FrmFittingQuery.ShowForm(globeControl1, instrumenLayerNames, new DataGridViewDelegate(InitDataGridViewX1)); - } - /// - /// 管径查询 - /// - /// - /// - private void buttonItemSearch4_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, this.buttonItemSearch4.Text); - - FrmDiameterQuery.ShowForm(globeControl1, m_PipelineLayerNames, new DataGridViewDelegate(InitDataGridViewX1)); - } - /// - /// 材质查询 - /// - /// - /// - private void buttonItemSearch5_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, this.buttonItemSearch5.Text); - - FrmMaterialSel.ShowForm(globeControl1, m_PipelineLayerNames, new DataGridViewDelegate(InitDataGridViewX1)); - } - /// - /// 基本查询 - /// - /// - /// - private void buttonItemSearch6_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, this.buttonItemSearch6.Text); - - FrmBasicQuery.ShowForm(globeControl1, new DataGridViewDelegate(InitDataGridViewX1)); - } - /// - /// 复合查询 - /// - /// - /// - private void buttonItemSearch7_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, this.buttonItemSearch7.Text); - - FrmQuerySQL.ShowForm(globeControl1, new DataGridViewDelegate(InitDataGridViewX1)); - } - /// - /// 关联查询 - /// - /// - /// - private void buttonItemSearch8_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, this.buttonItemSearch8.Text); - - if (globeControl1.Globe.SelObjectCount != 1) - { - MessageBox.Show("请选中一个对象!", "提示"); - return; - } - - double valueAllowance = 1.0; - - for (int j = 0; j < globeControl1.Globe.SelObjectCount; j++) - { - GSOFeature feature = null; - GSOLayer layer = null; - globeControl1.Globe.GetSelectObject(j, out feature, out layer); - - if (feature == null && feature.Geometry == null || (feature.Geometry.Type == EnumGeometryType.GeoPolygon3D - || feature.Geometry.Type == EnumGeometryType.GeoWater)) - return; - else - { - ClassSearchAnalysis.ResultRelationAnalysis(globeControl1, feature, valueLayerNames, workwellLayerNames, - instrumenLayerNames, pipefittingLayerNames, m_PipelineLayerNames, valueAllowance); - } - } - } - #endregion - /// - /// 清除分析 - /// - /// - /// - private void buttonItemClear_Click(object sender, EventArgs e) - { - LogManager.saveLog(Utility.userName, this.buttonItemClear.Text); - - globeControl1.Globe.ClearMeasure(); - layerTemp.RemoveAllFeature(); - layerTemp2.RemoveAllFeature(); - buttonItemLS5.Checked = false; - - dataGridViewX1.DataSource = null; - panelOfTable.Visible = false; - - globeControl1.Globe.MemoryLayer.RemoveAllFeature(); - globeControl1.Globe.ClearAnalysis(); - - - // 清除净距分析结果 - buttonX2_Click(null, null); - buttonX8_Click(null, null); - buttonX15_Click(null, null); - buttonX16_Click(null, null); - buttonClearAnalysisResult_Click(null, null); - - NetworkAnalysisTool.ClearAllTopAnalysis(this.globeControl1); - // ClearConnexityAnalysis();//清除连通性分析 - // 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); - } - } - - GSOFeatures feats = globeControl1.Globe.MemoryLayer.GetFeatureByName("粒子要素", true); - if (feats.Length > 0) - globeControl1.Globe.MemoryLayer.RemoveFeatureByID(feats[0].ID); - - globeControl1.Globe.UnderGroundFloor.Visible = false;//隐藏地下网格线 - - // ClearUpDownTraceAnalysis(); //清除上下游分析 - globeControl1.Globe.RemoveAllPits();//清除所有坑 - - string[] markerStrs = new string[9]; - markerStrs[0] = "标高标注"; - markerStrs[1] = "管径标注"; - markerStrs[2] = "埋深标注"; - markerStrs[3] = "坐标标注"; - markerStrs[4] = "坡度标注"; - markerStrs[5] = "属性标注"; - markerStrs[6] = "自定义标注"; - markerStrs[7] = "距离标注"; - markerStrs[8] = "扯旗标注"; - for (int i = 0; i < markerStrs.Length; i++) - { - GSOLayer markerLayer = globeControl1.Globe.Layers.GetLayerByCaption(markerStrs[i]); - markerLayer.RemoveAllFeature(); - } - if (layerMarkerTree != null && layerMarkerTree.Nodes.Count > 0) - { - for (int i = 0; i < layerMarkerTree.Nodes[0].Nodes.Count; i++) - { - layerMarkerTree.Nodes[0].Nodes[i].Nodes.Clear(); - } - } - - clearFeatureHighLight();//取消管线高亮 - - GSOLayer layerGround = globeControl1.Globe.Layers.GetLayerByCaption(roadLayerName);//("180fd"); - if (layerGround != null) - { - layerGround.Visible = true; - } - globeControl1.Refresh(); - globeControl2.Refresh(); - ClearRedlineAnalyseResult(); - globeControl1.Globe.Action = EnumAction3D.ActionNull; - } - /// - /// 管线长度全区域统计 - /// - /// - /// - private void buttonItemTJ1_ALL_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, "管线长度统计"); - FrmAllPipelineStatis frm = new FrmAllPipelineStatis(globeControl1, null, new DataGridViewDelegate(InitDataGridViewX1), m_PipelineLayerNames); - frm.Show(this); - - } - /// - /// 管线长度绘制区域统计 - /// - /// - /// - private void buttonItemTJ1_DRAW_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, "管线长度统计"); - - trackflag = "PipelineDistanceStatistics"; - globeControl1.Globe.Action = EnumAction3D.TrackPolygon; - globeControl1.Globe.TrackPolygonTool.TrackMode = EnumTrackMode.SpaceTrack; - } - /// - /// 阀门数量全区域统计 - /// - /// - /// - private void buttonItemTJ2_ALL_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, "阀门数量统计"); - FrmValveStatistics frm = new FrmValveStatistics(globeControl1, null, new DataGridViewDelegate(InitDataGridViewX1)); - frm.Show(this); - - globeControl1.Globe.Action = EnumAction3D.ActionNull; - } - /// - /// 阀门数量绘制区域统计 - /// - /// - /// - private void buttonItemTJ2_DRAW_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, "阀门数量统计"); - - trackflag = "valvequery"; - globeControl1.Globe.Action = EnumAction3D.TrackPolygon; - globeControl1.Globe.TrackPolygonTool.TrackMode = EnumTrackMode.SpaceTrack; - } - /// - /// 井盖数量全区域统计 - /// - /// - /// - private void buttonItemTJ3_ALL_Click(object sender, EventArgs e) - { - FrmAllWorkWellStatis frm = new FrmAllWorkWellStatis(globeControl1, null, new DataGridViewDelegate(InitDataGridViewX1)); - frm.Show(this); - } - /// - /// 井盖数量绘制区域统计 - /// - /// - /// - private void buttonItemTJ3_DRAW_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, "井盖数量统计"); - - trackflag = "workwellquery"; - globeControl1.Globe.Action = EnumAction3D.TrackPolygon; - globeControl1.Globe.TrackPolygonTool.TrackMode = EnumTrackMode.SpaceTrack; - } - /// - /// 管径分段统计全区域统计 - /// - /// - /// - private void buttonItemTJ4_ALL_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, "管径分段统计"); - - Frmpipediameterstatis.ShowForm(globeControl1, m_PipelineLayerNames, 0); - } - /// - /// 管径分段统计绘制区域统计 - /// - /// - /// - private void buttonItemTJ4_DRAW_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, "管径分段统计"); - - trackflag = null; - Frmpipediameterstatis.ShowForm(globeControl1, m_PipelineLayerNames, 1); - } - /// - /// 埋深分段统计全区域统计 - /// - /// - /// - private void buttonItemTJ5_ALL_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, "埋深分段统计"); - FrmpipeDeepstatis.ShowForm(globeControl1, m_PipelineLayerNames, 0); - } - /// - /// 埋深分段统计绘制区域统计 - /// - /// - /// - private void buttonItemTJ5_DRAW_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, "埋深分段统计"); - trackflag = null; - FrmpipeDeepstatis.ShowForm(globeControl1, m_PipelineLayerNames, 1); - } - /// - /// 管径分类统计全区域统计 - /// - /// - /// - private void buttonItemTJ6_ALL_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, "管径分类汇总"); - - FrmpipeDiametergather.ShowForm(globeControl1, m_PipelineLayerNames, 0); - } - /// - /// 管径分类统计绘制区域统计 - /// - /// - /// - private void buttonItemTJ6_DRAW_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, "管径分类汇总"); - - trackflag = null; - FrmpipeDiametergather.ShowForm(globeControl1, m_PipelineLayerNames, 1); - } - /// - /// 材质分类统计全区域统计 - /// - /// - /// - private void buttonItemTJ7_ALL_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, "材质分类汇总"); - - FrmpipeMaterialGather.ShowForm(globeControl1, m_PipelineLayerNames, 0); - } - /// - /// 材质分类统计绘制区域统计 - /// - /// - /// - private void buttonItemTJ7_DRAW_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, "材质分类汇总"); - - trackflag = null; - FrmpipeMaterialGather.ShowForm(globeControl1, m_PipelineLayerNames, 1); - } - /// - /// 附属物分类统计全区域统计 - /// - /// - /// - private void buttonItemTJ8_ALL_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, "附属物分类汇总"); - - FrmAccessoriesgather.ShowForm(globeControl1, instrumenLayerNames, 0); - } - /// - /// 附属物分类统计绘制区域统计 - /// - /// - /// - private void buttonItemTJ8_DRAW_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, "附属物分类汇总"); - - trackflag = null; - FrmAccessoriesgather.ShowForm(globeControl1, instrumenLayerNames, 1); - } /// /// 碰撞分析 /// @@ -7206,7 +5579,6 @@ /// private void buttonItemFX1_1_Click(object sender, EventArgs e) { - //日志记录 LogManager.saveLog(Utility.userName, this.buttonItemFX4_4.Text); this.dataGridViewX4.Size = new System.Drawing.Size(195, 120); @@ -7352,7 +5724,1332 @@ sideBar1.Refresh(); Refresh(); } + /// + /// 碰撞审查 + /// + /// + /// + private void buttonItemSH1_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, this.buttonItemSH1.Text); + this.dataGridViewX4.Size = new System.Drawing.Size(185, 92); + this.dataGridViewX5.Size = new System.Drawing.Size(185, 120); + + layerTemp.RemoveAllFeature(); + clearFeatureHighLight(); + globeControl1.Refresh(); + + sideBar1.Visible = true; + sideBarPanelItem3.Visible = true; + buttonItem1.Checked = true; + controlContainerItem3.Visible = true; + sideBarPanelItem4.Visible = true; + sideBarPanelItem4.Text = "碰撞审查"; + trackflag = "collision"; + controlContainerItem5.Control = panel2; + panel2.Dock = DockStyle.Fill; + panel2.Visible = true; + sideBar1.ExpandedPanel = sideBarPanelItem4; + sideBar1.Refresh(); + + Refresh(); + } + /// + /// 覆土审查 + /// + /// + /// + private void buttonItemSH2_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, this.buttonItemSH2.Text); + + this.dataGridViewX6.Size = new System.Drawing.Size(185, 92); + this.dataGridViewX7.Size = new System.Drawing.Size(185, 120); + + layerTemp.RemoveAllFeature(); + clearFeatureHighLight(); + globeControl1.Refresh(); + sideBar1.Visible = true; + sideBarPanelItem3.Visible = true; + buttonItem1.Checked = true; + controlContainerItem3.Visible = true; + sideBarPanelItem4.Visible = true; + sideBarPanelItem4.Text = "覆土审查"; + trackflag = "ftAnalysis"; + controlContainerItem5.Control = panel4; + panel4.Visible = true; + panel4.Dock = DockStyle.Fill; + sideBar1.ExpandedPanel = sideBarPanelItem4; + sideBar1.Refresh(); + Refresh(); + } + /// + /// 水平净距审查 + /// + /// + /// + private void buttonItemSH3_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, this.buttonItemSH3.Text); + + this.dataGridViewX8.Size = new System.Drawing.Size(190, 92); + this.dataGridViewX9.Size = new System.Drawing.Size(190, 120); + + layerTemp.RemoveAllFeature(); + clearFeatureHighLight(); + globeControl1.Refresh(); + sideBar1.Visible = true; + sideBarPanelItem3.Visible = true; + buttonItem1.Checked = true; + controlContainerItem3.Visible = true; + sideBarPanelItem4.Visible = true; + sideBarPanelItem4.Text = "水平净距审查"; + trackflag = "horizontal"; + controlContainerItem5.Control = panel5; + panel5.Dock = DockStyle.Fill; + panel5.Visible = true; + sideBar1.ExpandedPanel = sideBarPanelItem4; + sideBar1.Refresh(); + Refresh(); + } + /// + /// 垂直净距审查 + /// + /// + /// + private void buttonItemSH4_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, this.buttonItemSH4.Text); + + this.dataGridViewX2.Visible = true; + this.dataGridViewX3.Visible = true; + this.dataGridViewX2.Size = new System.Drawing.Size(185, 92); + this.dataGridViewX3.Size = new System.Drawing.Size(185, 120); + + layerTemp.RemoveAllFeature(); + clearFeatureHighLight(); + + globeControl1.Refresh(); + sideBar1.Visible = true; + sideBarPanelItem3.Visible = true; + buttonItem1.Checked = true; + controlContainerItem3.Visible = true; + sideBarPanelItem4.Visible = true; + sideBarPanelItem4.Text = "垂直净距审查"; + trackflag = "vertical"; + //globeControl1.Globe.Action = EnumAction3D.SelectObject; + panel2.Visible = false; + panel3.Visible = false; + panel5.Visible = false; + panel4.Visible = false; + controlContainerItem5.Control = panel1; + panel1.Dock = DockStyle.Fill; + panel1.Visible = true; + sideBar1.ExpandedPanel = sideBarPanelItem4; + sideBar1.Refresh(); + Refresh(); + } + #endregion + + /// + /// 添加指定路径下的数据 功能 + /// + /// + /// + private object AddLayerData(string strDataPath) + { + object objRes = null; + if (Path.GetExtension(strDataPath).ToLower().Equals(".kml")) + { + GSOLayer layer = globeControl1.Globe.Layers.Add(strDataPath); + objRes = layer; + if (layer != null) + { + 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; + layerManagerNode.Nodes.Insert(0, node); + } + newlayername = layer.Caption; + } + else if (GSOUtility.IsDatasetSupportTerrain(strDataPath)) + { + GSOTerrain terrain = globeControl1.Globe.Terrains.Add(strDataPath); + objRes = terrain; + if (terrain != null) + { + TreeNode node = new TreeNode(); + node.Tag = terrain; + node.Text = terrain.Caption; + node.ImageIndex = 0; + node.SelectedImageIndex = 0; + node.Checked = terrain.Visible; + layerManagerNode.Nodes.Insert(0, node); + } + newlayername = terrain.Caption; + } + else if (Path.GetExtension(strDataPath).ToLower().Equals(".dxf")) + { + GSOLayer layer = globeControl1.Globe.Layers.Add(strDataPath); + objRes = layer; + if (layer != null) + { + GSODataset dataset = layer.Dataset; + CheckDatasetGeoReference(layer.Dataset, strDataPath); + CheckDatasetGeoReference(layer.Dataset, strDataPath); + TreeNode node = new TreeNode(); + node.Tag = layer; + node.Text = layer.Dataset.Caption; + node.ImageIndex = 0; + node.SelectedImageIndex = 0; + node.Checked = layer.Visible; + layerManagerNode.Nodes.Insert(0, node); + } + newlayername = layer.Caption; + } + else + { + GSOLayer layer = globeControl1.Globe.Layers.Add(strDataPath); + + objRes = layer; + if (layer == null) + MessageBox.Show("layer is null"); + + CheckDatasetGeoReference(layer.Dataset, strDataPath); + TreeNode node = new TreeNode(); + node.Tag = layer; + node.Text = layer.Dataset.Caption; + node.ImageIndex = 0; + node.SelectedImageIndex = 0; + node.Checked = layer.Visible; + layerManagerNode.Nodes.Insert(0, node); + + newlayername = layer.Caption; + } + return objRes; + } + /// + /// 连接数据库 菜单事件处理 + /// + /// + /// + private void ConnectDB(object sender, EventArgs e) + { + FrmDatabaseParaSetting frm = new FrmDatabaseParaSetting(globeControl1); + if (frm.ShowDialog() == DialogResult.OK) + { + ds = FrmDatabaseParaSetting.ds; + if (ds != null) + { + ds.IsCloseSaved = false; + } + } + } + /// + /// 根据指定图层创建图层节点并将节点添加到图层管理节点的子节点集合中 + /// + /// + private void addNodeToLayerManagerNode(GSOLayer layer) + { + if (layer != null) + { + 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; + + if (!layerManagerNode.Nodes.Contains(node)) + { + layerManagerNode.Nodes.Insert(0, node); + layerManagerNode.Expand(); + } + } + } + /// + /// 获取指定图层中最后一个feature对象的名称对应的整数 + /// + /// + /// + public int getLabelName(GSOLayer layer) + { + int nid = -1; + if (layer.GetAllFeatures().Length > 0) + { + string id = layer.GetAllFeatures()[layer.GetAllFeatures().Length - 1].Name; + + int.TryParse(id, out nid); + } + else + { + nid = 0; + } + return nid; + } + /// + /// 设置除指定标注图层之外的所有标注图层不可见 + /// + /// + public void setMarkerLayerUnVisible(string layerName) + { + string[] markerStrs = new string[10]; + markerStrs[0] = "标高标注"; + markerStrs[1] = "管径标注"; + markerStrs[2] = "埋深标注"; + markerStrs[3] = "坐标标注"; + markerStrs[4] = "坡度标注"; + markerStrs[5] = "属性标注"; + markerStrs[6] = "自定义标注"; + markerStrs[7] = "距离标注"; + markerStrs[8] = "红线工具"; + markerStrs[9] = "扯旗标注"; + + for (int i = 0; i < markerStrs.Length; i++) + { + GSOLayer markerLayer = globeControl1.Globe.Layers.GetLayerByCaption(markerStrs[i]); + if (markerLayer != null) + { + if (markerStrs[i] != layerName) + { + 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) + { + markerFeature.Visible = false; + } + } + if (layerMarkerTree.Nodes[0].Nodes.Count > i) + { + layerMarkerTree.Nodes[0].Nodes[i].Checked = true; + } + } + } + } + } + /// + /// 判断选中的对象是否为管线 + /// + /// 被选中管线 + /// 返回一根线 + private GSOFeature IsPipeLineOfSelectedObj() + { + GSOFeature resFeature = null; + if (globeControl1.Globe.SelObjectCount < 1) return null; + GSOLayer resLayer = null; + globeControl1.Globe.GetSelectObject(0, out resFeature, out resLayer); + if (resFeature == null) return null; + + GSOGeoPolyline3D line1 = resFeature.Geometry as GSOGeoPolyline3D; + if (line1 == null) return null; + GSOPipeLineStyle3D pipeStyle1 = line1.Style as GSOPipeLineStyle3D; + if (pipeStyle1 == null) return null; + + return resFeature; + } + /// + /// 图层节点树中 节点 右键单击事件处理 + /// + /// + /// + private void layerMarkerTree_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e) + { + if (e.Button == MouseButtons.Right) + { + if (e.Node.Text == "标注管理" || e.Node.Text == "传感器管理") + return; + else if (e.Node.Parent.Text == "标注管理") + { + layerMarkerTree.SelectedNode = e.Node; + contextMenuStrip2.Show(layerMarkerTree, e.X, e.Y); + contextMenuStrip2.Tag = e.Node; + } + else if (e.Node.Parent.Text == "传感器管理") + { + layerSensorTree.SelectedNode = e.Node; + contextMenuStrip2.Show(layerSensorTree, e.X, e.Y); + contextMenuStrip2.Tag = e.Node; + } + else + { + if (e.Node.Tag is GSOFeature) + { + if (e.Node.Parent.Parent.Text == "标注管理") + { + layerMarkerTree.SelectedNode = e.Node; + contextMenuStrip3.Show(layerMarkerTree, e.X, e.Y); + contextMenuStrip3.Tag = e.Node; + } + else if (e.Node.Parent.Parent.Text == "传感器管理") + { + layerSensorTree.SelectedNode = e.Node; + contextMenuStrip3.Show(layerSensorTree, e.X, e.Y); + contextMenuStrip3.Tag = e.Node; + } + } + } + } + } + /// + /// 标注管理、传感器管理 图层目录树的右键菜单中的 刷新列表 菜单 + /// + /// + /// + private void toolStripMenuItem1_Click(object sender, EventArgs e) + { + TreeNode node = contextMenuStrip2.Tag as TreeNode; + TreeNode parentNode = node.Parent; + Int32 nIndex = node.Index; + + if (parentNode.Text == "标注管理" || parentNode.Text == "传感器管理") + { + RefreshTreeNodeLayerFeatureList(node); + } + } + /// + /// 给指定的图层节点添加代表feature对象的子节点 + /// + /// + private void RefreshTreeNodeLayerFeatureList(TreeNode layerTreeNode) + { + layerTreeNode.Nodes.Clear(); + GSOLayer layer = (GSOLayer)layerTreeNode.Tag; + // 只将类型为内存数据集的图层列出,如果是其它类型的数据集可能数据量太大,没发显示在树控件中 + if (layer.Dataset is GSOFeatureDataset) + { + VisitFeature3Ds(layer.GetAllFeatures(), layerTreeNode); + } + } + /// + /// 标注管理、传感器管理 图层目录树的右键菜单中的 移除所有 菜单 + /// + /// + /// + private void toolStripMenuItem2_Click(object sender, EventArgs e) + { + TreeNode node = contextMenuStrip3.Tag as TreeNode; + GSOFeature feature3d = node.Tag as GSOFeature; + if (node == null) + return; + if (feature3d != null) + { + feature3d.Delete(); + globeControl1.Globe.Refresh(); + node.Remove(); + } + } + /// + /// 图层目录树的 节点对应的复选框选中状态改变事件处理 + /// + /// + /// + private void layerMarkerTree_AfterCheck(object sender, TreeViewEventArgs e) + { + if (e.Action != TreeViewAction.Unknown) + { + CheckTreeNode(e.Node, e.Node.Checked); + } + } + /// + /// 改变指定节点对应的复选框的选中状态 + /// + /// + /// + private void CheckTreeNode(TreeNode node, Boolean bChecked) + { + CheckChildTreeNode(node, bChecked); + globeControl1.Globe.Refresh(); + } + /// + /// 改变指定节点的子节点对应的复选框的选中状态 + /// + /// + /// + private void CheckChildTreeNode(TreeNode node, Boolean bChecked) + { + if (node == null) + return; + if (node.Tag != null) + { + if (node.Tag.GetType() == typeof(GSOFeatureFolder) || node.Tag.GetType() == typeof(GSOFeature)) + ((GSOFeature)node.Tag).SetVisibleDirectly(bChecked); + else + { + GSOLayer curLayer = node.Tag as GSOLayer; + GSOTerrain curTerrain = node.Tag as GSOTerrain; + if (curLayer != null) + { + curLayer.Visible = bChecked; + } + else if (curTerrain != null) + { + curTerrain.Visible = bChecked; + } + } + } + // 递归处理子节点 + for (int i = 0; i < node.Nodes.Count; i++) + { + node.Nodes[i].Checked = bChecked; + CheckChildTreeNode(node.Nodes[i], bChecked); + } + } + /// + /// 标注管理、传感器管理 目录树中的feature节点的右键菜单中的 删除 菜单 + /// + /// + /// + private void 删除ToolStripMenuItem1_Click(object sender, EventArgs e) + { + TreeNode node = contextMenuStrip2.Tag as TreeNode; + GSOLayer l = globeControl1.Globe.Layers.GetLayerByCaption(node.Text); + if (l != null) + { + l.RemoveAllFeature(); + node.Nodes.Clear(); + globeControl1.Refresh(); + } + } + //定时检查传感器的状态 + public System.Windows.Forms.Timer timerOfSensor = null; + /// + /// 一键审核---导入数据 + /// + /// + /// + private void buttonItem127_Click_2(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "打开数据"); + + try + { + string dbIp = Utility.sgdbip; + string database = Utility.sgdbname; + string user = Utility.sgdbuser; + string pass = Utility.sgdbpwd; + shds = globeControl1.Globe.DataManager.OpenOracleDataSource(dbIp + "/" + database, "", "", user, pass); + if (shds == null) + { + MessageBox.Show("施工数据库连接失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); + } + FrmPipelineModelDB frm = new FrmPipelineModelDB(globeControl1, shds, true); + if (frm.ShowDialog() == DialogResult.OK) + { + addNodeToLayerManagerNode(frm.rukuLayer); + } + } + catch (Exception ex) + { + LogError.PublishError(ex); + MessageBox.Show("内存过载请清理内存,并重新启动规划分析!", "提示"); + return; + } + } + /// + ///自动导出图片 + /// + /// + /// + private void buttonItem130_Click_1(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "导出审核图"); + + Point pt1 = new Point(Convert.ToInt32(0), Convert.ToInt32(0)); + Point pt2 = new Point(Convert.ToInt32(panelEx5.Width), Convert.ToInt32(panelEx5.Height)); + + 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 = System.IO.Path.GetExtension(dlg.FileName);//扩展名 + switch (extension) + { + case ".jpg": + myImg.Save(dlg.FileName, System.Drawing.Imaging.ImageFormat.Jpeg); + break; + case ".png": + myImg.Save(dlg.FileName, System.Drawing.Imaging.ImageFormat.Png); + break; + case ".bmp": + myImg.Save(dlg.FileName, System.Drawing.Imaging.ImageFormat.Bmp); + break; + case ".gif": + myImg.Save(dlg.FileName, System.Drawing.Imaging.ImageFormat.Gif); + break; + default: + break; + } + } + } + /// + /// 一键审核功能 + /// + /// + /// + private void buttonItem128_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, this.buttonItem128.Text); + frmSh = new FrmYJSHTC(globeControl1, globeControl2, layerTree); + + if (frmSh.ShowDialog() == DialogResult.OK) + { + frmWait = new FrmWait("一键审核……"); + frmWait.Location = new Point(this.Width - frmWait.Width - 10, this.Height - frmWait.Height - 50); + frmWait.Owner = this; + frmWait.Show(); + Thread thread = new Thread(new ThreadStart(doWork)); + thread.IsBackground = true; + thread.Start(); + } + } + void doWork() + { + FrmShResult frmShResult = null; + + double dVerticalJingJuBiaoZhun = 1, dHorizontalJingJuBiaoZhun = 1; + if (frmSh.rukuLayer != null) + { + #region + this.Invoke((EventHandler) delegate + { + try + { + List managerLayerList = new List(); + for (int i = 0; i < layerManagerNode.Nodes.Count; i++) + { + managerLayerList.Add(layerManagerNode.Nodes[i].Text); + } + if (!managerLayerList.Contains(frmSh.rukuLayer.Caption)) + { + TreeNode node = new TreeNode(); + node.Tag = frmSh.rukuLayer; + node.Text = frmSh.rukuLayer.Dataset.Caption; + node.ImageIndex = 0; + node.SelectedImageIndex = 0; + node.Checked = frmSh.rukuLayer.Visible; + layerManagerNode.Nodes.Insert(0, node); + layerManagerNode.Expand(); + } + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "提示"); + } + }); + #endregion + + shlayername = frmSh.rukuLayer.Name; + globeControl1.Refresh(); + } + + if (frmShResult != null && !frmShResult.IsDisposed) + { + try + { + clearFeatureHighLight(); + ClearRedlineAnalyseResult(); + frmShResult.Close(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message); + } + } + + frmShResult = new FrmShResult(dVerticalJingJuBiaoZhun, dHorizontalJingJuBiaoZhun, shlayername, globeControl1, + m_PipelineLayerNames); + + if (boolfrmShResult == true) return; + + frmShResult.Location = new Point(this.Width - frmShResult.Width - 10, this.Height - frmShResult.Height - 50); + frmShResult.Owner = this; + //一键审核实际计算步骤 + frmShResult.analysis(); + + //MainFrm窗体显示控制,回到一键审核Tab + this.Invoke((EventHandler) delegate + { + frmShResult.Show(); + frmWait.Close(); + //将tab页恢复到一键审核 + ribbonTabItem11.Checked = true; + try + { + globeControl1.Globe.Action = EnumAction3D.ActionNull; + splitContainer1.Panel2Collapsed = true; + + panelOfTable.Visible = false; + legendSC.Visible = false; + legendSG.Visible = false; + + GSOLayer redLayer = globeControl1.Globe.Layers.GetLayerByCaption("红线"); + if (redLayer != null) + { + redLayer.Visible = false; + } + } + catch (Exception ex) + { + MessageBox.Show("系统运行错误:" + ex.ToString(), "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + + }); + + boolfrmShResult = true; + } + /// + /// 清除渲染结果 + /// + public void ClearRedlineAnalyseResult() + { + for (int i = 0; i < globeControl1.Globe.Layers.Count; i++) + { + GSOLayer layer = globeControl1.Globe.Layers[i]; + if (layer.Caption == "tempLgdData") + { + layer.RemoveAllFeature(); + } + } + + layerTemp.RemoveAllFeature(); + globeControl1.Refresh(); + } + /// + /// 已审核的图层 + /// + /// + /// + private void buttonItem132_Click_1(object sender, EventArgs e) + { + //保存日志 + LogManager.saveLog(Utility.userName, this.buttonItem132.Text); + + if (shds == null) + { + //没连的话,直接连接审核库; //审核库配置读配置文件 + string dbIp = Utility.sgdbip; + string database = Utility.sgdbname; + string user = Utility.sgdbuser; + string pass = Utility.sgdbpwd; + + shds = globeControl1.Globe.DataManager.OpenOracleDataSource(dbIp + "/" + database, "", "", user, pass); + if (shds == null) + { + MessageBox.Show("数据库连接失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); + } + } + FrmShLayers frm = new FrmShLayers(globeControl1, shds); + frm.Show(); + + } + /// + /// 审核入库 + /// + /// + /// + private void buttonItem133_Click_1(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "审核入库"); + FrmShRK frmShrk = new FrmShRK(globeControl1); + frmShrk.Show(); + } + /// + /// 模拟设计修改 + /// + /// + /// + private void buttonItem134_Click_1(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "模拟设计修改"); + + frmModify = new FrmMnModify(globeControl1, shlayername, shresultLists); + + if (boolfrmModify == false) + { + frmModify.Owner = this; + frmModify.Location = new Point(this.Width - frmModify.Width - 10, this.Height - frmModify.Height - 50); + frmModify.Show(); + boolfrmModify = true; + } + } + /// + /// 一键审核中调节透明度 + /// + /// + /// + private void sliderItem1_ValueChanged(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, this.sliderItem1.Text); + + globeControl1.Globe.GroundOpaque = 100 - sliderItem1.Value; + GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(roadLayerName); //("180fd"); + + if (layer != null) + layer.Opaque = 100 - sliderItem1.Value; + optiValue = sliderItem1.Value; + } + /// + /// 红线审核中的透明度分析 + /// + /// + /// + private void sliderItem3_ValueChanged(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, this.sliderItem3.Text); + + globeControl1.Globe.GroundOpaque = 100 - sliderItem3.Value; + GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(roadLayerName); //("180fd"); + if (layer != null) + layer.Opaque = 100 - sliderItem3.Value; + optiValue = sliderItem3.Value; + } + #region yanxiaowei + //初始化DataGridViewX1控件 + public delegate void DataGridViewDelegate(DataTable dt, string strLable, string strLayer, bool initDataGrid); + /// + /// 代理函数,操作DatgridViewX1 + /// + /// + /// + public void InitDataGridViewX1(DataTable dt, string strLable, string strLayer, bool initDataGrid) + { + if (initDataGrid == true) + { + dataGridViewX1.DataSource = dt; + panelOfTable.Visible = true; + toolStripNumbers.Text = strLable; + dataGridViewX1.Tag = strLayer; + } + else + { + dataGridViewX1.DataSource = null; + dataGridViewX1.Refresh(); + panelOfTable.Visible = false; + toolStripNumbers.Text = ""; + dataGridViewX1.Tag = ""; + globeControl1.Globe.MemoryLayer.RemoveAllFeature(); //清除双击产生的标注 + } + } + FrmAnalysisGuiHuaResult from; + /// + /// 主窗体下方属性表格 双击定位 功能 + /// + /// + /// + 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 if (dataGridViewX1.Columns.Contains("标识器编号")) + { + featureName = dataGridViewX1.Rows[hittestinfo.RowIndex].Cells["标识器编号"].Value.ToString(); + } + featureName = featureName.Trim(); + + GSOLayer layer = null; + layer = globeControl1.Globe.Layers.GetLayerByCaption(dataGridViewX1.Tag.ToString()); + + if (layer == null) return; + + GSOFeatures features = layer.GetFeatureByName(featureName, false); + if (features.Length == 0) return; + GSOFeature rowFeature = features[0]; + + ClassSearchAnalysis.AddMakerToLineFeature(globeControl1, rowFeature); + + } + } + } + else + { + if (e.Button == MouseButtons.Left) + { + if (from != null && !from.IsDisposed) + { + try + { + from.Close(); + } + catch (Exception ex) + { + LogError.PublishError(ex); + } + } + try + { + DataGridView.HitTestInfo hittestinfo = dataGridViewX1.HitTest(e.X, e.Y); + if (hittestinfo.RowIndex >= 0) + { + string layer = dataGridViewX1.Rows[hittestinfo.RowIndex].Cells["管线类型"].Value.ToString(); + string hxName = dataGridViewX1.Rows[hittestinfo.RowIndex].Cells["红线编号"].Value.ToString(); + FrmAnalysisGuiHuaResult frm = new FrmAnalysisGuiHuaResult(globeControl1, lineStruct, featsList, + panelOfTable, dataGridViewX1, layer, hxName); + frm.Location = new Point(this.Width - frm.Width - 10, this.Height - frm.Height - 20); + frm.Show(this); + + from = frm; + } + } + catch (Exception ex) + { + LogError.PublishError(ex); + } + } + } + } + /// + /// 空间查询 + /// + /// + /// + private void buttonItemSearch1_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, this.buttonItemSearch1.Text); + + trackflag = "PipelineSpatialQuery"; + globeControl1.Globe.Action = EnumAction3D.TrackPolygon; + globeControl1.Globe.TrackPolygonTool.TrackMode = EnumTrackMode.SpaceTrack; + } + /// + /// 关键字查询 + /// + /// + /// + private void buttonItemSearch9_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, this.buttonItemSearch9.Text); + + FrmKeywordQuery.ShowForm(globeControl1, m_PipelineLayerNames, new DataGridViewDelegate(InitDataGridViewX1)); + } + /// + /// 编号查询 + /// + /// + /// + private void buttonItemSearch2_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, this.buttonItemSearch2.Text); + + FrmCodingQuery.ShowForm(globeControl1, m_PipelineLayerNames, new DataGridViewDelegate(InitDataGridViewX1)); + } + /// + /// 坐标查询 + /// + /// + /// + private void buttonItemSearch3_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, this.buttonItemSearch3.Text); + + FrmSetLatLonPos.ShowForm(globeControl1); + } + /// + /// 附属物查询 + /// + /// + /// + private void buttonItemSearch10_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, this.buttonItemSearch10.Text); + + FrmFittingQuery.ShowForm(globeControl1, instrumenLayerNames, new DataGridViewDelegate(InitDataGridViewX1)); + } + /// + /// 管径查询 + /// + /// + /// + private void buttonItemSearch4_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, this.buttonItemSearch4.Text); + + FrmDiameterQuery.ShowForm(globeControl1, m_PipelineLayerNames, new DataGridViewDelegate(InitDataGridViewX1)); + } + /// + /// 材质查询 + /// + /// + /// + private void buttonItemSearch5_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, this.buttonItemSearch5.Text); + + FrmMaterialSel.ShowForm(globeControl1, m_PipelineLayerNames, new DataGridViewDelegate(InitDataGridViewX1)); + } + /// + /// 基本查询 + /// + /// + /// + private void buttonItemSearch6_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, this.buttonItemSearch6.Text); + + FrmBasicQuery.ShowForm(globeControl1, new DataGridViewDelegate(InitDataGridViewX1)); + } + /// + /// 复合查询 + /// + /// + /// + private void buttonItemSearch7_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, this.buttonItemSearch7.Text); + + FrmQuerySQL.ShowForm(globeControl1, new DataGridViewDelegate(InitDataGridViewX1)); + } + /// + /// 关联查询 + /// + /// + /// + private void buttonItemSearch8_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, this.buttonItemSearch8.Text); + + if (globeControl1.Globe.SelObjectCount != 1) + { + MessageBox.Show("请选中一个对象!", "提示"); + return; + } + double valueAllowance = 1.0; + + for (int j = 0; j < globeControl1.Globe.SelObjectCount; j++) + { + GSOFeature feature = null; + GSOLayer layer = null; + globeControl1.Globe.GetSelectObject(j, out feature, out layer); + + if (feature == null && feature.Geometry == null || (feature.Geometry.Type == EnumGeometryType.GeoPolygon3D + || feature.Geometry.Type == EnumGeometryType.GeoWater)) + return; + else + { + ClassSearchAnalysis.ResultRelationAnalysis(globeControl1, feature, valueLayerNames, workwellLayerNames, + instrumenLayerNames, pipefittingLayerNames, m_PipelineLayerNames, valueAllowance); + } + } + } + #endregion + /// + /// 清除分析(完善) + /// + /// + /// + private void buttonItemClear_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, this.buttonItemClear.Text); + + globeControl1.Globe.ClearMeasure(); + layerTemp.RemoveAllFeature(); + layerTemp2.RemoveAllFeature(); + buttonItemLS5.Checked = false; + + dataGridViewX1.DataSource = null; + panelOfTable.Visible = false; + + globeControl1.Globe.MemoryLayer.RemoveAllFeature(); + globeControl1.Globe.ClearAnalysis(); + + + // 清除净距分析结果 + buttonX2_Click(null, null); + buttonX8_Click(null, null); + buttonX15_Click(null, null); + buttonX16_Click(null, null); + buttonClearAnalysisResult_Click(null, null); + + NetworkAnalysisTool.ClearAllTopAnalysis(this.globeControl1); + // ClearConnexityAnalysis();//清除连通性分析 + // 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); + } + } + + GSOFeatures feats = globeControl1.Globe.MemoryLayer.GetFeatureByName("粒子要素", true); + if (feats.Length > 0) + globeControl1.Globe.MemoryLayer.RemoveFeatureByID(feats[0].ID); + + globeControl1.Globe.UnderGroundFloor.Visible = false;//隐藏地下网格线 + + // ClearUpDownTraceAnalysis(); //清除上下游分析 + globeControl1.Globe.RemoveAllPits();//清除所有坑 + + string[] markerStrs = new string[9]; + markerStrs[0] = "标高标注"; + markerStrs[1] = "管径标注"; + markerStrs[2] = "埋深标注"; + markerStrs[3] = "坐标标注"; + markerStrs[4] = "坡度标注"; + markerStrs[5] = "属性标注"; + markerStrs[6] = "自定义标注"; + markerStrs[7] = "距离标注"; + markerStrs[8] = "扯旗标注"; + for (int i = 0; i < markerStrs.Length; i++) + { + GSOLayer markerLayer = globeControl1.Globe.Layers.GetLayerByCaption(markerStrs[i]); + markerLayer.RemoveAllFeature(); + } + if (layerMarkerTree != null && layerMarkerTree.Nodes.Count > 0) + { + for (int i = 0; i < layerMarkerTree.Nodes[0].Nodes.Count; i++) + { + layerMarkerTree.Nodes[0].Nodes[i].Nodes.Clear(); + } + } + + clearFeatureHighLight();//取消管线高亮 + + GSOLayer layerGround = globeControl1.Globe.Layers.GetLayerByCaption(roadLayerName);//("180fd"); + if (layerGround != null) + { + layerGround.Visible = true; + } + globeControl1.Refresh(); + globeControl2.Refresh(); + ClearRedlineAnalyseResult(); + globeControl1.Globe.Action = EnumAction3D.ActionNull; + } + /// + /// 管线长度全区域统计 + /// + /// + /// + private void buttonItemTJ1_ALL_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "管线长度统计"); + FrmAllPipelineStatis frm = new FrmAllPipelineStatis(globeControl1, null, new DataGridViewDelegate(InitDataGridViewX1), m_PipelineLayerNames); + frm.Show(this); + } + /// + /// 管线长度绘制区域统计 + /// + /// + /// + private void buttonItemTJ1_DRAW_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "管线长度统计"); + + trackflag = "PipelineDistanceStatistics"; + globeControl1.Globe.Action = EnumAction3D.TrackPolygon; + globeControl1.Globe.TrackPolygonTool.TrackMode = EnumTrackMode.SpaceTrack; + } + /// + /// 阀门数量全区域统计 + /// + /// + /// + private void buttonItemTJ2_ALL_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "阀门数量统计"); + FrmValveStatistics frm = new FrmValveStatistics(globeControl1, null, new DataGridViewDelegate(InitDataGridViewX1)); + frm.Show(this); + + globeControl1.Globe.Action = EnumAction3D.ActionNull; + } + /// + /// 阀门数量绘制区域统计 + /// + /// + /// + private void buttonItemTJ2_DRAW_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "阀门数量统计"); + + trackflag = "valvequery"; + globeControl1.Globe.Action = EnumAction3D.TrackPolygon; + globeControl1.Globe.TrackPolygonTool.TrackMode = EnumTrackMode.SpaceTrack; + } + /// + /// 井盖数量全区域统计 + /// + /// + /// + private void buttonItemTJ3_ALL_Click(object sender, EventArgs e) + { + FrmAllWorkWellStatis frm = new FrmAllWorkWellStatis(globeControl1, null, new DataGridViewDelegate(InitDataGridViewX1)); + frm.Show(this); + } + /// + /// 井盖数量绘制区域统计 + /// + /// + /// + private void buttonItemTJ3_DRAW_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "井盖数量统计"); + + trackflag = "workwellquery"; + globeControl1.Globe.Action = EnumAction3D.TrackPolygon; + globeControl1.Globe.TrackPolygonTool.TrackMode = EnumTrackMode.SpaceTrack; + } + /// + /// 管径分段统计全区域统计 + /// + /// + /// + private void buttonItemTJ4_ALL_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "管径分段统计"); + + Frmpipediameterstatis.ShowForm(globeControl1, m_PipelineLayerNames, 0); + } + /// + /// 管径分段统计绘制区域统计 + /// + /// + /// + private void buttonItemTJ4_DRAW_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "管径分段统计"); + + trackflag = null; + Frmpipediameterstatis.ShowForm(globeControl1, m_PipelineLayerNames, 1); + } + /// + /// 埋深分段统计全区域统计 + /// + /// + /// + private void buttonItemTJ5_ALL_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "埋深分段统计"); + FrmpipeDeepstatis.ShowForm(globeControl1, m_PipelineLayerNames, 0); + } + /// + /// 埋深分段统计绘制区域统计 + /// + /// + /// + private void buttonItemTJ5_DRAW_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "埋深分段统计"); + trackflag = null; + FrmpipeDeepstatis.ShowForm(globeControl1, m_PipelineLayerNames, 1); + } + /// + /// 管径分类统计全区域统计 + /// + /// + /// + private void buttonItemTJ6_ALL_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "管径分类汇总"); + + FrmpipeDiametergather.ShowForm(globeControl1, m_PipelineLayerNames, 0); + } + /// + /// 管径分类统计绘制区域统计 + /// + /// + /// + private void buttonItemTJ6_DRAW_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "管径分类汇总"); + + trackflag = null; + FrmpipeDiametergather.ShowForm(globeControl1, m_PipelineLayerNames, 1); + } + /// + /// 材质分类统计全区域统计 + /// + /// + /// + private void buttonItemTJ7_ALL_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "材质分类汇总"); + + FrmpipeMaterialGather.ShowForm(globeControl1, m_PipelineLayerNames, 0); + } + /// + /// 材质分类统计绘制区域统计 + /// + /// + /// + private void buttonItemTJ7_DRAW_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "材质分类汇总"); + + trackflag = null; + FrmpipeMaterialGather.ShowForm(globeControl1, m_PipelineLayerNames, 1); + } + /// + /// 附属物分类统计全区域统计 + /// + /// + /// + private void buttonItemTJ8_ALL_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "附属物分类汇总"); + + FrmAccessoriesgather.ShowForm(globeControl1, instrumenLayerNames, 0); + } + /// + /// 附属物分类统计绘制区域统计 + /// + /// + /// + private void buttonItemTJ8_DRAW_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "附属物分类汇总"); + + trackflag = null; + FrmAccessoriesgather.ShowForm(globeControl1, instrumenLayerNames, 1); + } #region Predaotr,断面分析 /// /// 横断面分析 @@ -7365,7 +7062,6 @@ globeControl1.Globe.TrackPolylineTool.VerticalLineVisible = true; globeControl1.Globe.TrackPolylineTool.TrackMode = EnumTrackMode.SpaceTrack; trackPolylineEndMode = EnumTrackPolylineEndMode.HDM_Analysis; - } /// /// 纵断面分析 @@ -7409,7 +7105,6 @@ globeControl1.Globe.TrackPolylineTool.VerticalLineVisible = true; globeControl1.Globe.TrackPolylineTool.TrackMode = EnumTrackMode.SpaceTrack; trackPolylineEndMode = EnumTrackPolylineEndMode.DLDM_Analysis; - } /// /// 基线剖面分析 @@ -7422,9 +7117,7 @@ globeControl1.Globe.TrackPolylineTool.VerticalLineVisible = true; globeControl1.Globe.TrackPolylineTool.TrackMode = EnumTrackMode.SpaceTrack; trackPolylineEndMode = EnumTrackPolylineEndMode.JXPM_Analysis; - } - #endregion /// /// 创建拓扑 @@ -7462,7 +7155,6 @@ LogManager.saveLog(Utility.userName, this.buttonItemFX3_3.Text); NetworkTraceUpDown(false); } - /// /// 上下游追踪 功能 /// @@ -7480,7 +7172,6 @@ NetworkAnalysisTool.TraceUpDownAnalysis(bTraceUp, selLineFeature, selLayer); } - /// /// 流向分析 /// @@ -7533,7 +7224,6 @@ MessageBox.Show("未找到关闭阀门"); } } - /// /// 连通分析 /// @@ -7580,9 +7270,7 @@ NetworkAnalysisTool.ExplodeAnalysis(this.globeControl1, selLineFeature, selLayer); this.buttonItemFX3_5_Click(sender, e); //关阀分析: - } - #endregion /// /// 多边形开挖 @@ -7591,7 +7279,6 @@ /// private void buttonItemFX4_1_Click(object sender, EventArgs e) { - //日志记录 LogManager.saveLog(Utility.userName, this.buttonItemFX4_1.Text); trackflag = "pit"; @@ -7605,7 +7292,6 @@ /// private void buttonItemFX4_2_Click(object sender, EventArgs e) { - //日志记录 LogManager.saveLog(Utility.userName, this.buttonItemFX4_2.Text); trackflag = "digFillAnalysis"; @@ -7620,7 +7306,6 @@ /// private void buttonItemFX4_3_Click(object sender, EventArgs e) { - //日志记录 LogManager.saveLog(Utility.userName, this.buttonItemFX4_3.Text); if (!buttonItemFX4_3.Checked) @@ -7653,12 +7338,13 @@ /// private void buttonItemFX4_4_Click(object sender, EventArgs e) { - //日志记录 LogManager.saveLog(Utility.userName, this.buttonItemFX4_4.Text); globeControl1.Globe.Action = EnumAction3D.DrawPolyline; GSOLayer tunnel = globeControl1.Globe.Layers.GetLayerByCaption("隧道"); - if (tunnel != null) + if (tunnel == null) + MessageBox.Show("场景中未加载隧道图层!", "提示"); + else { globeControl1.Globe.DestLayerFeatureAdd = tunnel; tunnel.Editable = true; @@ -7666,10 +7352,6 @@ m_AddPipeLine = false; m_isDrawCitySevenLine = false; } - else - { - MessageBox.Show("场景中未加载隧道图层!", "提示"); - } } /// /// 隐藏隧道 @@ -7678,7 +7360,6 @@ /// private void buttonItemFX4_5_Click(object sender, EventArgs e) { - //日志记录 LogManager.saveLog(Utility.userName, this.buttonItemFX4_5.Text); GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption("隧道"); @@ -7694,7 +7375,6 @@ /// private void buttonItemFX4_6_Click(object sender, EventArgs e) { - //日志记录 LogManager.saveLog(Utility.userName, this.buttonItemFX4_6.Text); if (globeControl1.Globe.SelObjectCount > 0) @@ -7736,16 +7416,7 @@ //日志记录 LogManager.saveLog(Utility.userName, this.buttonItemFX5_1.Text); - if (globeControl1.Globe.Action != EnumAction3D.VisibilityAnalysis) - { - //btnSpaceVisibilityAnalysis.Checked = true; - globeControl1.Globe.Action = EnumAction3D.VisibilityAnalysis; - } - else - { - globeControl1.Globe.Action = EnumAction3D.ActionNull; - // SetButtonChecked(); - } + globeControl1.Globe.Action = globeControl1.Globe.Action != EnumAction3D.VisibilityAnalysis ? EnumAction3D.VisibilityAnalysis : EnumAction3D.ActionNull; } /// /// 可视域分析 @@ -7754,7 +7425,6 @@ /// private void buttonItemFX5_2_Click(object sender, EventArgs e) { - //日志记录 LogManager.saveLog(Utility.userName, this.buttonItemFX5_2.Text); globeControl1.Globe.Action = EnumAction3D.ViewshedAnalysis; @@ -7766,7 +7436,6 @@ /// private void buttonItemFX5_3_Click(object sender, EventArgs e) { - //日志记录 LogManager.saveLog(Utility.userName, this.buttonItemFX5_3.Text); globeControl1.Globe.Action = EnumAction3D.ViewEnvelopeAnalysis; @@ -7778,7 +7447,6 @@ /// private void buttonItemFX6_1_Click(object sender, EventArgs e) { - //日志记录 LogManager.saveLog(Utility.userName, this.buttonItemFX6_1.Text); GSOFeature feat = globeControl1.Globe.SelectedObject; @@ -7813,7 +7481,6 @@ /// private void buttonItemFX6_2_Click(object sender, EventArgs e) { - //日志记录 LogManager.saveLog(Utility.userName, this.buttonItemFX6_2.Text); globeControl1.Globe.Action = EnumAction3D.ActionNull; @@ -7827,7 +7494,6 @@ /// private void buttonItemFX6_3_Click(object sender, EventArgs e) { - //日志记录 LogManager.saveLog(Utility.userName, this.buttonItemFX6_3.Text); globeControl1.Globe.Action = EnumAction3D.TrackPolygon; @@ -7901,10 +7567,8 @@ globeControl1.Globe.Action = EnumAction3D.ActionNull; buttonItemLS5.Checked = !buttonItemLS5.Checked; - if (buttonItemLS5.Checked) - { - globeControl1.Globe.Action = EnumAction3D.SelectObject; - } + if (!buttonItemLS5.Checked) return; + globeControl1.Globe.Action = EnumAction3D.SelectObject; } /// /// 水平面积 @@ -8197,7 +7861,6 @@ LogManager.saveLog(Utility.userName, this.buttonItemFXGJ1.Text); FrmSetFlytoPos.ShowForm(globeControl1); - } /// /// 自定义飞行 @@ -8262,7 +7925,6 @@ globeControl1.Globe.FlyAroundEye(720, EnumFlyRepeatValueType.Degrees); globeControl1.Globe.CurFlyID = 2; } - /// /// 权限管理 /// @@ -8343,21 +8005,6 @@ appUSERRESET.ShowDialog(); } /// - /// 统计数据 - /// - /// - /// - private void buttonItemZTT1_Click(object sender, EventArgs e) - { - ////日志记录 - //LogManager.saveLog(Utility.userName, this.buttonItemZTT1.Text); - - //PATM patm = new PATM(); - //patm.operation = "Statistic"; - //patm.Text = "统计专题图管理"; - //patm.ShowDialog(); - } - /// /// 热点功能统计 /// /// @@ -8460,137 +8107,6 @@ FrmLayerControl frm = new FrmLayerControl(layerTree, globeControl1, globeControl2); frm.Show(this); } - - /// - /// 碰撞审查 - /// - /// - /// - private void buttonItemSH1_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, this.buttonItemSH1.Text); - - this.dataGridViewX4.Size = new System.Drawing.Size(185, 92); - this.dataGridViewX5.Size = new System.Drawing.Size(185, 120); - - layerTemp.RemoveAllFeature(); - clearFeatureHighLight(); - globeControl1.Refresh(); - - sideBar1.Visible = true; - sideBarPanelItem3.Visible = true; - buttonItem1.Checked = true; - controlContainerItem3.Visible = true; - sideBarPanelItem4.Visible = true; - sideBarPanelItem4.Text = "碰撞审查"; - trackflag = "collision"; - controlContainerItem5.Control = panel2; - panel2.Dock = DockStyle.Fill; - panel2.Visible = true; - sideBar1.ExpandedPanel = sideBarPanelItem4; - sideBar1.Refresh(); - - Refresh(); - } - /// - /// 覆土审查 - /// - /// - /// - private void buttonItemSH2_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, this.buttonItemSH2.Text); - - this.dataGridViewX6.Size = new System.Drawing.Size(185, 92); - this.dataGridViewX7.Size = new System.Drawing.Size(185, 120); - - layerTemp.RemoveAllFeature(); - clearFeatureHighLight(); - globeControl1.Refresh(); - sideBar1.Visible = true; - sideBarPanelItem3.Visible = true; - buttonItem1.Checked = true; - controlContainerItem3.Visible = true; - sideBarPanelItem4.Visible = true; - sideBarPanelItem4.Text = "覆土审查"; - trackflag = "ftAnalysis"; - controlContainerItem5.Control = panel4; - panel4.Visible = true; - panel4.Dock = DockStyle.Fill; - sideBar1.ExpandedPanel = sideBarPanelItem4; - sideBar1.Refresh(); - Refresh(); - } - /// - /// 水平净距审查 - /// - /// - /// - private void buttonItemSH3_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, this.buttonItemSH3.Text); - - this.dataGridViewX8.Size = new System.Drawing.Size(190, 92); - this.dataGridViewX9.Size = new System.Drawing.Size(190, 120); - - layerTemp.RemoveAllFeature(); - clearFeatureHighLight(); - globeControl1.Refresh(); - sideBar1.Visible = true; - sideBarPanelItem3.Visible = true; - buttonItem1.Checked = true; - controlContainerItem3.Visible = true; - sideBarPanelItem4.Visible = true; - sideBarPanelItem4.Text = "水平净距审查"; - trackflag = "horizontal"; - controlContainerItem5.Control = panel5; - panel5.Dock = DockStyle.Fill; - panel5.Visible = true; - sideBar1.ExpandedPanel = sideBarPanelItem4; - sideBar1.Refresh(); - Refresh(); - } - /// - /// 垂直净距审查 - /// - /// - /// - private void buttonItemSH4_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, this.buttonItemSH4.Text); - - this.dataGridViewX2.Visible = true; - this.dataGridViewX3.Visible = true; - this.dataGridViewX2.Size = new System.Drawing.Size(185, 92); - this.dataGridViewX3.Size = new System.Drawing.Size(185, 120); - - layerTemp.RemoveAllFeature(); - clearFeatureHighLight(); - - globeControl1.Refresh(); - sideBar1.Visible = true; - sideBarPanelItem3.Visible = true; - buttonItem1.Checked = true; - controlContainerItem3.Visible = true; - sideBarPanelItem4.Visible = true; - sideBarPanelItem4.Text = "垂直净距审查"; - trackflag = "vertical"; - //globeControl1.Globe.Action = EnumAction3D.SelectObject; - panel2.Visible = false; - panel3.Visible = false; - panel5.Visible = false; - panel4.Visible = false; - controlContainerItem5.Control = panel1; - panel1.Dock = DockStyle.Fill; - panel1.Visible = true; - sideBar1.ExpandedPanel = sideBarPanelItem4; - sideBar1.Refresh(); - Refresh(); - } /// /// 综合规划区域审查 /// @@ -8666,9 +8182,7 @@ } if (ds == null) return; - Cyberpipe.Forms.FrmPipelineModelDB frm = new Cyberpipe.Forms.FrmPipelineModelDB(globeControl1, ds); - - //frm.Show(); + FrmPipelineModelDB frm = new FrmPipelineModelDB(globeControl1, ds, false); if (frm.ShowDialog() == DialogResult.OK) { @@ -8700,7 +8214,6 @@ addNodeToLayerManagerNode(frm.rukuLayer); } } - /// /// 坐标转换 /// @@ -8711,7 +8224,7 @@ //保存日志 LogManager.saveLog(Utility.userName, this.buttonItemSJGL5.Text); - Cyberpipe.Forms.FrmProject frm = new Cyberpipe.Forms.FrmProject(); + FrmProject frm = new FrmProject(); frm.ShowDialog(); } /// @@ -8738,7 +8251,6 @@ LogManager.saveLog(Utility.userName, this.buttonItemSJGL6_2.Text); FrmMetadataStat frmmds = new FrmMetadataStat(); - //frmmds.Show(); frmmds.ShowDialog(); } /// @@ -8814,12 +8326,11 @@ if (frm.ShowDialog() == DialogResult.OK) { GSOLayer featureAddLayer = TreeNodeFeatureLayer(); - if (featureAddLayer == null) + if (featureAddLayer != null) { - return; + FrmAddInstrument dlg = new FrmAddInstrument(globeControl1, featureAddLayer); + dlg.Show(this); } - FrmAddInstrument dlg = new FrmAddInstrument(globeControl1, featureAddLayer); - dlg.Show(this); } } /// @@ -8836,16 +8347,15 @@ if (frm.ShowDialog() == DialogResult.OK) { GSOLayer featureAddLayer = TreeNodeFeatureLayer(); - if (featureAddLayer == null) + if (featureAddLayer != null) { - return; + FrmAddPipeFitting dlg = new FrmAddPipeFitting(globeControl1, featureAddLayer); + dlg.Show(this); } - FrmAddPipeFitting dlg = new FrmAddPipeFitting(globeControl1, featureAddLayer); - dlg.Show(this); } } /// - /// 绘制城市七线 + /// 绘制城市七线(完善) /// /// /// @@ -9082,15 +8592,6 @@ List listVectorNames = new List(); for (int i = 0; i < 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] == "供电") - { - continue; - } - * */ if (listVectorNames.Contains(m_PipelineLayerNames[i]) == false) { listVectorNames.Add(m_PipelineLayerNames[i]); @@ -9142,15 +8643,11 @@ GSOFeature f = null; GSOLayer layer = null; globeControl1.Globe.GetSelectObject(i, out f, out layer); - if (f != null) - { - f.Delete(); - if (layer != null) - { - globeControl1.Globe.AddToEditHistroy(layer, f, EnumEditType.Delete); - } - globeControl1.Refresh(); - } + if (f == null) continue; + f.Delete(); + if (layer != null) + globeControl1.Globe.AddToEditHistroy(layer, f, EnumEditType.Delete); + globeControl1.Refresh(); } MessageBox.Show("删除成功!", "提示"); } @@ -9190,10 +8687,8 @@ for (int i = 0; i < m_PipelineLayerNames.Count; i++) { layer = globeControl1.Globe.Layers.GetLayerByCaption(m_PipelineLayerNames[i]); - if (layer != null) - { - listPipelineLayers.Add(layer); - } + if (layer == null) continue; + listPipelineLayers.Add(layer); } //yanxiaowei 重构 GSOFeatures selectFeatures = new GSOFeatures(); @@ -9208,15 +8703,15 @@ ClassGSOTool.CalculateRedLineResult(out table, redSH, selectFeatures, globeControl1, listPipelineLayers, out lineStruct, out featsList); - if (table.Rows.Count != 0) - AddDatagridView(table); - else + if (table.Rows.Count == 0) { MessageBox.Show("没有侵入地块红线的管线数据!", "提示"); dataGridViewX1.DataSource = null; panelOfTable.Visible = false; return; } + else + AddDatagridView(table); } private void AddDatagridView(DataTable table) @@ -9234,23 +8729,25 @@ /// private void toolStripDropDownButton3_Click(object sender, EventArgs e) { - if (dataGridViewX1.Rows.Count == 0) + if (dataGridViewX1.Rows.Count != 0) + { + string strSaveFile = string.Empty; + SaveFileDialog savefiledialog = new SaveFileDialog(); + savefiledialog.Filter = "Excel文件|*.xls,*.xlsx"; + savefiledialog.AddExtension = true; + savefiledialog.FileName = "红线审核"; + if (savefiledialog.ShowDialog() == DialogResult.OK) + strSaveFile = savefiledialog.FileName; + else return; + + ExpEXCEL.ExpToExcel(dataGridViewX1, strSaveFile, "红线审核", lineStruct, featsList); + MessageBox.Show("导出成功!"); + } + else { MessageBox.Show("表格内容为空!", "提示"); return; } - - string strSaveFile = string.Empty; - SaveFileDialog savefiledialog = new SaveFileDialog(); - savefiledialog.Filter = "Excel文件|*.xls,*.xlsx"; - savefiledialog.AddExtension = true; - savefiledialog.FileName = "红线审核"; - if (savefiledialog.ShowDialog() == DialogResult.OK) - strSaveFile = savefiledialog.FileName; - else return; - - ExpEXCEL.ExpToExcel(dataGridViewX1, strSaveFile, "红线审核", lineStruct, featsList); - MessageBox.Show("导出成功!"); } private void sliderItem2_ValueChanged(object sender, EventArgs e) @@ -9287,31 +8784,39 @@ dlg.Multiselect = true; if (dlg.ShowDialog() == DialogResult.OK) { - //自定义lprj文件名,从程序中复制一lprj文件。 - string filePath = dlg.FileName; - string lastname = Path.GetFileName(filePath); - - for (int i = 0; i < dlg.FileNames.Length; i++) + try { - AddLayerData(dlg.FileNames[i]); + for (int i = 0; i < dlg.FileNames.Length; i++) + { + AddLayerData(dlg.FileNames[i]); + } + layerManagerNode.Expand(); + + //放大到新导入的图层 + GSOLayer lyr = globeControl1.Globe.Layers.GetLayerByCaption(newlayername); + if (newlayername != "") + { + GSOFeatures features = lyr.GetAllFeatures(); + GSORect2d rd = lyr.LatLonBounds; + GSOPoint2d rdcenter = rd.Center; + + globeControl1.Globe.JumpToPosition(new GSOPoint3d(rdcenter.X, rdcenter.Y, 0), + EnumAltitudeMode.Absolute, 100); + + globeControl1.Refresh(); + } } - layerManagerNode.Expand(); - - //放大到新导入的图层 - GSOLayer lyr = globeControl1.Globe.Layers.GetLayerByCaption(newlayername); - if (newlayername != "") + catch (Exception ex) { - GSOFeatures features = lyr.GetAllFeatures(); - GSORect2d rd = lyr.LatLonBounds; - GSOPoint2d rdcenter = rd.Center; - - globeControl1.Globe.JumpToPosition(new GSOPoint3d(rdcenter.X, rdcenter.Y, 0), EnumAltitudeMode.Absolute, 100); - - globeControl1.Refresh(); + LogHelper.WriteLog(typeof(MainFrm), ex); } } } - + /// + /// 导入红线(完善) + /// + /// + /// private void buttonItemHX1_Click(object sender, EventArgs e) { LogManager.saveLog(Utility.userName, this.buttonItemHX1.Text); @@ -9339,7 +8844,6 @@ GSOFeatures RedFeatures = layer.GetAllFeatures(); redlinelayername = layer.Caption; - //objRes = layer; if (layer != null) { layerRedRegion = layer; @@ -9362,9 +8866,7 @@ { GSOFeature f = layer.GetAt(j); if (f != null) - { f.Geometry.AltitudeMode = EnumAltitudeMode.RelativeToGround; - } } } layerManagerNode.Expand(); @@ -9426,7 +8928,7 @@ fly.Show(this); } /// - /// 2015-10-17演示代码 红线审核 + /// 红线审核 /// /// /// @@ -9438,7 +8940,6 @@ globeControl1.BeforeSceneRenderEvent -= new BeforeSceneRenderEventHandler(globeControl1_BeforeSceneRenderEvent); globeControl2.BeforeSceneRenderEvent -= new BeforeSceneRenderEventHandler(globeControl2_BeforeSceneRenderEvent); - globeControl1.Globe.FlyToPosition(new GSOPoint3d(120.610963, 31.188121, 50), EnumAltitudeMode.Absolute, -4, 50, 800); globeControl1.Globe.FlyToPointSpeed = 10000000; globeControl1.Globe.Action = EnumAction3D.SelectObject; @@ -9453,11 +8954,8 @@ legendSC.Visible = false; ClearGZData(); GSOLayer redLayer = globeControl1.Globe.Layers.GetLayerByCaption("红线"); - if (redLayer != null) - { - redLayer.Visible = true; - } - + if (redLayer == null) return; + redLayer.Visible = true; } catch (Exception ex) { @@ -9477,7 +8975,6 @@ globeControl1.BeforeSceneRenderEvent -= new BeforeSceneRenderEventHandler(globeControl1_BeforeSceneRenderEvent); globeControl2.BeforeSceneRenderEvent -= new BeforeSceneRenderEventHandler(globeControl2_BeforeSceneRenderEvent); - globeControl1.Globe.Action = EnumAction3D.ActionNull; dataGridViewX1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells; //zhanshi = false; @@ -9488,12 +8985,8 @@ legendSG.Visible = false; ClearGZData(); GSOLayer redLayer = globeControl1.Globe.Layers.GetLayerByCaption("红线"); - if (redLayer != null) - { - redLayer.Visible = false; - } - - + if (redLayer == null) return; + redLayer.Visible = false; } catch (Exception ex) { @@ -9513,7 +9006,6 @@ globeControl1.BeforeSceneRenderEvent -= new BeforeSceneRenderEventHandler(globeControl1_BeforeSceneRenderEvent); globeControl2.BeforeSceneRenderEvent -= new BeforeSceneRenderEventHandler(globeControl2_BeforeSceneRenderEvent); - globeControl1.Globe.Action = EnumAction3D.ActionNull; //zhanshi = false; redSH = false; @@ -9524,45 +9016,15 @@ legendSG.Visible = false; ClearGZData(); GSOLayer redLayer = globeControl1.Globe.Layers.GetLayerByCaption("红线"); - if (redLayer != null) - { - redLayer.Visible = false; - } - - + if (redLayer == null) return; + redLayer.Visible = false; } catch (Exception ex) { //MessageBox.Show("系统运行错误:" + ex.ToString(), "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); } } - /// - /// 右屏添加冰箱数据 - /// - void AddDataToGlobeControl2() - { - - bool modelDataBool = false; - for (int i = globeControl2.Globe.Layers.Count - 1; i >= 0; i--) - { - GSOLayer layer = globeControl2.Globe.Layers[i]; - if (layer.Name.Contains("fttp:")) - { - modelDataBool = true; - break; - } - } - - if (modelDataBool == false) - { - GSOLayer ly = globeControl1.Globe.Layers.GetLayerByCaption("天地图地图"); - globeControl2.Globe.Layers.Add(ly); - } - else - { - return; - } - } + /// /// 双屏对比 /// @@ -9572,7 +9034,6 @@ { try { - globeControl1.BeforeSceneRenderEvent += new BeforeSceneRenderEventHandler(globeControl1_BeforeSceneRenderEvent); globeControl2.BeforeSceneRenderEvent += new BeforeSceneRenderEventHandler(globeControl2_BeforeSceneRenderEvent); @@ -9590,10 +9051,7 @@ GSOLayer redLayer = globeControl1.Globe.Layers.GetLayerByCaption("红线"); if (redLayer != null) - { redLayer.Visible = false; - } - AddDataToGlobeControl2(); } catch (Exception ex) { @@ -9613,7 +9071,6 @@ globeControl1.BeforeSceneRenderEvent -= new BeforeSceneRenderEventHandler(globeControl1_BeforeSceneRenderEvent); globeControl2.BeforeSceneRenderEvent -= new BeforeSceneRenderEventHandler(globeControl2_BeforeSceneRenderEvent); - globeControl1.Globe.Action = EnumAction3D.ActionNull; panelOfTable.Visible = false; //zhanshi = false; @@ -9625,9 +9082,7 @@ ClearGZData(); GSOLayer redLayer = globeControl1.Globe.Layers.GetLayerByCaption("红线"); if (redLayer != null) - { redLayer.Visible = false; - } } catch (Exception ex) { @@ -9643,11 +9098,9 @@ { try { - globeControl1.BeforeSceneRenderEvent -= new BeforeSceneRenderEventHandler(globeControl1_BeforeSceneRenderEvent); globeControl2.BeforeSceneRenderEvent -= new BeforeSceneRenderEventHandler(globeControl2_BeforeSceneRenderEvent); - globeControl1.Globe.Action = EnumAction3D.ActionNull; panelOfTable.Visible = false; //zhanshi = false; @@ -9660,10 +9113,7 @@ GSOLayer redLayer = globeControl1.Globe.Layers.GetLayerByCaption("红线"); if (redLayer != null) - { redLayer.Visible = false; - } - } catch (Exception ex) { @@ -9679,11 +9129,9 @@ { try { - globeControl1.BeforeSceneRenderEvent -= new BeforeSceneRenderEventHandler(globeControl1_BeforeSceneRenderEvent); globeControl2.BeforeSceneRenderEvent -= new BeforeSceneRenderEventHandler(globeControl2_BeforeSceneRenderEvent); - globeControl1.Globe.Action = EnumAction3D.ActionNull; panelOfTable.Visible = false; //zhanshi = false; @@ -9695,11 +9143,8 @@ ClearGZData(); GSOLayer redLayer = globeControl1.Globe.Layers.GetLayerByCaption("红线"); - if (redLayer != null) - { - redLayer.Visible = false; - } - + if (redLayer == null) return; + redLayer.Visible = false; } catch (Exception ex) { @@ -9717,12 +9162,8 @@ { LogManager.saveLog(Utility.userName, this.buttonItem8.Text); - //FrmCompareFeature frmCompareFeature = new FrmCompareFeature(globeControl1, globeControl2, layerTemp, layerTemp2,m_PipelineLayerNames,sgPipeLayersNames); int width = this.Width; FrmCompareFeature.ShowForm(globeControl1, globeControl2, layerTemp, layerTemp2, m_PipelineLayerNames, sgPipeLayersNames, width); - //frmCompareFeature.Location = new Point((this.Width - frmCompareFeature.Width)/2,50); - //frmCompareFeature.Show(this); - } /// /// 红线审核导出图片 @@ -9735,11 +9176,7 @@ Point pt1 = new Point(Convert.ToInt32(0), Convert.ToInt32(0)); Point pt2 = new Point(Convert.ToInt32(panelEx5.Width), Convert.ToInt32(panelEx5.Height)); - /*Point pt = getUpperLeftPoint(pt1, pt2); - Image myImg = new Bitmap(Convert.ToInt32(panelEx5.Width), Convert.ToInt32(panelEx5.Height)); - Graphics g = Graphics.FromImage(myImg); - g.CopyFromScreen(pt, new Point(0, 0), new Size(Convert.ToInt32(panelEx5.Width), Convert.ToInt32(panelEx5.Height))); - */ + int mapWidth = 0; int mapHeight = 0; Point pt = getUpperLeftPoint(pt1, pt2, out mapWidth, out mapHeight); @@ -9782,7 +9219,6 @@ { globeControl1.Globe.Action = EnumAction3D.ActionNull; FrmBSQStatis bsqStatis = new FrmBSQStatis(globeControl1, null); - //FrmBSQStatis bsqStatis = new FrmBSQStatis(); bsqStatis.Show(this); } /// @@ -9795,20 +9231,15 @@ trackflag = "BSQDuoBianXiangStatis"; globeControl1.Globe.Action = EnumAction3D.TrackPolygon; } - - private void btn_check_history_Click(object sender, EventArgs e) { LogManager.saveLog(Utility.userName, this.btn_check_history.Text); if (FrmCheckHistory.isOpen == true) - { return; - } FrmCheckHistory frm = new FrmCheckHistory(globeControl1, globeControl2); frm.addNode += new AddNodeToLayerManagerNode(addNodeToLayerManagerNode); frm.Show(); - } private void buttonItem查看数据_Click(object sender, EventArgs e) @@ -9840,34 +9271,29 @@ { LogManager.saveLog(Utility.userName, this.btn_user_info.Text); - if (!FrmSysUserInfoManger.IS_OPEN) - { - FrmSysUserInfoManger frm = new FrmSysUserInfoManger(); - frm.ShowDialog(); - } + if (FrmSysUserInfoManger.IS_OPEN) return; + FrmSysUserInfoManger frm = new FrmSysUserInfoManger(); + frm.ShowDialog(); } private void btn_role_info_Click(object sender, EventArgs e) { LogManager.saveLog(Utility.userName, this.btn_role_info.Text); - if (FrmRoleInfoManager.IS_OPEN) + if (!FrmRoleInfoManager.IS_OPEN) { - return; + FrmRoleInfoManager frm = new FrmRoleInfoManager(); + frm.ShowDialog(); } - FrmRoleInfoManager frm = new FrmRoleInfoManager(); - frm.ShowDialog(); } private void btn_resc_info_Click(object sender, EventArgs e) { LogManager.saveLog(Utility.userName, this.btn_resc_info.Text); - if (!SysRescInfoManager.IS_OPEN) - { - SysRescInfoManager frm = new SysRescInfoManager(); - frm.ShowDialog(); - } + if (SysRescInfoManager.IS_OPEN) return; + SysRescInfoManager frm = new SysRescInfoManager(); + frm.ShowDialog(); } private void btn_role_resc_Click(object sender, EventArgs e) @@ -9875,51 +9301,33 @@ LogManager.saveLog(Utility.userName, this.btn_role_resc.Text); - if (!FrmRoleRescManager.IS_OPEN) - { - FrmRoleRescManager frm = new FrmRoleRescManager(); - frm.ShowDialog(); - } + if (FrmRoleRescManager.IS_OPEN) return; + FrmRoleRescManager frm = new FrmRoleRescManager(); + frm.ShowDialog(); } private void btn_user_role_Click(object sender, EventArgs e) { LogManager.saveLog(Utility.userName, this.btn_user_role.Text); - if (FrmUserRole.IS_OPEN) + if (!FrmUserRole.IS_OPEN) { - return; + FrmUserRole frm = new FrmUserRole(); + frm.ShowDialog(); } - FrmUserRole frm = new FrmUserRole(); - frm.ShowDialog(); } private void btn_document_info_Click(object sender, EventArgs e) { LogManager.saveLog(Utility.userName, this.btn_document_info.Text); - - //if (FormDocumentManager.IS_OPEN) - //{ - // return; - //} - //FormDocumentManager frm = new FormDocumentManager(); - //frm.ShowDialog(); - - //if (FormDocumentManager.IS_OPEN) - //{ - // return; - //} - //new FormDocumentManager().ShowDialog(); - if (FormDocumentManager.IS_OPEN) + if (!FormDocumentManager.IS_OPEN) { - return; + this.Cursor = Cursors.WaitCursor; + FormDocumentManager frm = new FormDocumentManager(); + frm.changeCursor += new ChangeCursor(changeCursorToDefault); + frm.ShowDialog(); } - this.Cursor = Cursors.WaitCursor; - FormDocumentManager frm = new FormDocumentManager(); - frm.changeCursor += new ChangeCursor(changeCursorToDefault); - frm.ShowDialog(); - } private void changeCursorToDefault() @@ -9936,58 +9344,9 @@ dlg.Multiselect = true; if (dlg.ShowDialog() == DialogResult.OK) { - for (int i = 0; i < dlg.FileNames.Length; i++) + foreach (string strDataPath in dlg.FileNames) { - //this.Cursor = Cursors.WaitCursor; - string strDataPath = dlg.FileNames[i]; - - #region - //string strDataPathPrj = strDataPath.ToLower().Replace(".dwg", ".lprj"); - - //if (File.Exists(strDataPathPrj) == false) - //{ - // if (MessageBox.Show("数据没有空间参考信息,请设置空间参考信息!", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation) == DialogResult.OK) - // { - // String strPath = Application.StartupPath + "\\Coordinate Systems"; - // OpenFileDialog dlgPrj = new OpenFileDialog(); - // dlgPrj.InitialDirectory = strPath; - // dlgPrj.RestoreDirectory = true; - // dlgPrj.Multiselect = false; - // dlg.Filter = "投影文件|*.prj"; - // if (dlg.ShowDialog() == DialogResult.OK) - // { - // this.Cursor = Cursors.WaitCursor; - // string proj4 = GSODataEngineUtility.ConvertEsriPrjFileToProj4(dlg.FileName); - // using (StreamWriter stream = new StreamWriter(strDataPathPrj, false)) - // { - // stream.WriteLine("0prj4" + proj4 + ""); - // } - // AddLayerData(strDataPath); - // //globeControl1.Globe.Layers.Add(strDataPath); - - // this.Cursor = Cursors.Default; - // } - // else - // { - // AddLayerData(strDataPath); - // //globeControl1.Globe.Layers.Add(strDataPath); - // } - // } - // else - // { - // AddLayerData(strDataPath); - // //globeControl1.Globe.Layers.Add(strDataPath); - // } - - //} - //else - //{ - // //globeControl1.Globe.Layers.Add(strDataPath); - // AddLayerData(strDataPath); - //} - #endregion AddLayerData(strDataPath); - //this.Cursor = Cursors.Default; } } @@ -10008,38 +9367,13 @@ { LogManager.saveLog(Utility.userName, this.btn_password_edit.Text); - if (FrmChangePassword.IS_OPEN) + if (!FrmChangePassword.IS_OPEN) { - return; + FrmChangePassword frm = new FrmChangePassword(); + frm.ShowDialog(); } - FrmChangePassword frm = new FrmChangePassword(); - frm.ShowDialog(); } - /// - /// 多孔管线入库 - /// - /// - /// - private void buttonItem9_Click(object sender, EventArgs e) - { - //保存日志 - LogManager.saveLog(Utility.userName, this.buttonItemSJGL4_2.Text); - if (ds == null) - { - MessageBox.Show("请先连接数据库", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); - ConnectDB(null, null); - } - if (ds == null) - return; - - FrmMultiPipelineModelDB frm = new FrmMultiPipelineModelDB(globeControl1, ds); - if (frm.ShowDialog() == DialogResult.OK) - { - addNodeToLayerManagerNode(frm.rukuLayer); - } - //frm.Show(); - } private void 导出CADToolStripMenuItem1_Click(object sender, EventArgs e) { TreeNode node = layerNodeContexMenu.Tag as TreeNode; @@ -10049,44 +9383,42 @@ return; } GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(node.Text.Trim()); - if (layer == null || layer.GetAllFeatures().Length <= 0) + if (layer != null && layer.GetAllFeatures().Length > 0) { - MessageBox.Show("要导出的图层为空", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); - return; - } - string strProjectName = Utility.projectStr; - if (strProjectName != "") - { + string strProjectName = Utility.projectStr; + if (strProjectName == "") return; SaveFileDialog dlg = new SaveFileDialog(); dlg.Filter = "*.dwg|*.dwg|*.dxf|*.dxf"; dlg.FileName = layer.Caption; - if (dlg.ShowDialog(this) == DialogResult.OK) + if (dlg.ShowDialog(this) != DialogResult.OK) return; + globeControl1.Globe.MemoryLayer.SaveAs(dlg.FileName); + GSOLayer newlayer = globeControl1.Globe.Layers.Add(dlg.FileName); + newlayer.RemoveAllFeature(); + int featureCount = layer.GetAllFeatures().Length; + for (int i = 0; i < featureCount; i++) { - globeControl1.Globe.MemoryLayer.SaveAs(dlg.FileName); - GSOLayer newlayer = globeControl1.Globe.Layers.Add(dlg.FileName); - newlayer.RemoveAllFeature(); - int featureCount = layer.GetAllFeatures().Length; - for (int i = 0; i < featureCount; i++) + GSOFeature feature = layer.GetAt(i); + if (feature == null || feature.Geometry == null) continue; + switch (feature.Geometry.Type) { - GSOFeature feature = layer.GetAt(i); - if (feature != null && feature.Geometry != null) - { - if (feature.Geometry.Type == EnumGeometryType.GeoPolyline3D) - { - feature.Geometry.Style = new GSOSimpleLineStyle3D(); - } - else if (feature.Geometry.Type == EnumGeometryType.GeoPolygon3D) - { - feature.Geometry.Style = new GSOSimplePolygonStyle3D(); - } - newlayer.AddFeature(feature); - } + case EnumGeometryType.GeoPolyline3D: + feature.Geometry.Style = new GSOSimpleLineStyle3D(); + break; + case EnumGeometryType.GeoPolygon3D: + feature.Geometry.Style = new GSOSimplePolygonStyle3D(); + break; } - newlayer.Save(); - newlayer.Dataset.DataSource.RemoveDataset(newlayer.Dataset); - globeControl1.Globe.Layers.Remove(newlayer); - MessageBox.Show("导出CAD完成!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); + newlayer.AddFeature(feature); } + newlayer.Save(); + newlayer.Dataset.DataSource.RemoveDataset(newlayer.Dataset); + globeControl1.Globe.Layers.Remove(newlayer); + MessageBox.Show("导出CAD完成!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); + } + else + { + MessageBox.Show("要导出的图层为空", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); + return; } } diff --git a/MainFrm.designer.cs b/MainFrm.designer.cs index fd0ef22..1022ac7 100644 --- a/MainFrm.designer.cs +++ b/MainFrm.designer.cs @@ -195,10 +195,6 @@ this.缓冲区分析ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.无源淹没分析ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.清除分析ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components); - this.FlyToMenu = new System.Windows.Forms.ToolStripMenuItem(); - this.LightMenu = new System.Windows.Forms.ToolStripMenuItem(); - this.AllLightMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.timer1 = new System.Windows.Forms.Timer(this.components); this.layerNodeContexMenu = new System.Windows.Forms.ContextMenuStrip(this.components); this.RefreshLayerFeatureListMenuItem = new System.Windows.Forms.ToolStripMenuItem(); @@ -644,7 +640,6 @@ this.panelEx3.SuspendLayout(); this.RightScreenToolMenu.SuspendLayout(); this.toolRightMenu.SuspendLayout(); - this.contextMenuStrip1.SuspendLayout(); this.layerNodeContexMenu.SuspendLayout(); this.contextMenuStrip2.SuspendLayout(); this.contextMenuStrip3.SuspendLayout(); @@ -1263,7 +1258,7 @@ this.区域分析ToolStripMenuItem, this.清除分析ToolStripMenuItem}); this.toolRightMenu.Name = "toolRightMenu"; - this.toolRightMenu.Size = new System.Drawing.Size(153, 312); + this.toolRightMenu.Size = new System.Drawing.Size(149, 290); // // 量算ToolStripMenuItem // @@ -1276,7 +1271,7 @@ this.水平面积ToolStripMenuItem1, this.地表面积ToolStripMenuItem1}); this.量算ToolStripMenuItem.Name = "量算ToolStripMenuItem"; - this.量算ToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.量算ToolStripMenuItem.Size = new System.Drawing.Size(148, 22); this.量算ToolStripMenuItem.Text = "量算"; // // 水平距离ToolStripMenuItem1 @@ -1339,7 +1334,7 @@ this.前进ToolStripMenuItem, this.删除模型ToolStripMenuItem}); this.编辑ToolStripMenuItem.Name = "编辑ToolStripMenuItem"; - this.编辑ToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.编辑ToolStripMenuItem.Size = new System.Drawing.Size(148, 22); this.编辑ToolStripMenuItem.Text = "编辑"; // // 平移对象ToolStripMenuItem @@ -1415,7 +1410,7 @@ this.绕中心点飞行ToolStripMenuItem, this.绕眼睛飞行ToolStripMenuItem}); this.飞行ToolStripMenuItem.Name = "飞行ToolStripMenuItem"; - this.飞行ToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.飞行ToolStripMenuItem.Size = new System.Drawing.Size(148, 22); this.飞行ToolStripMenuItem.Text = "飞行"; // // 自定义飞行ToolStripMenuItem @@ -1460,7 +1455,7 @@ this.属性标注ToolStripMenuItem, this.标注管理ToolStripMenuItem}); this.标注ToolStripMenuItem.Name = "标注ToolStripMenuItem"; - this.标注ToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.标注ToolStripMenuItem.Size = new System.Drawing.Size(148, 22); this.标注ToolStripMenuItem.Text = "标注"; // // 标高标注ToolStripMenuItem @@ -1547,7 +1542,7 @@ this.关联查询ToolStripMenuItem, this.关键字查询ToolStripMenuItem}); this.查询ToolStripMenuItem.Name = "查询ToolStripMenuItem"; - this.查询ToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.查询ToolStripMenuItem.Size = new System.Drawing.Size(148, 22); this.查询ToolStripMenuItem.Text = "查询"; // // 空间查询ToolStripMenuItem @@ -1633,7 +1628,7 @@ this.附属物分类统计ToolStripMenuItem, this.标识器分类统计ToolStripMenuItem}); this.全区域统计ToolStripMenuItem.Name = "全区域统计ToolStripMenuItem"; - this.全区域统计ToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.全区域统计ToolStripMenuItem.Size = new System.Drawing.Size(148, 22); this.全区域统计ToolStripMenuItem.Text = "全区域统计"; // // 管线长度统计ToolStripMenuItem @@ -1712,7 +1707,7 @@ this.附属物分类统计ToolStripMenuItem1, this.标识器分类统计ToolStripMenuItem1}); this.绘制区域统计ToolStripMenuItem.Name = "绘制区域统计ToolStripMenuItem"; - this.绘制区域统计ToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.绘制区域统计ToolStripMenuItem.Size = new System.Drawing.Size(148, 22); this.绘制区域统计ToolStripMenuItem.Text = "绘制区域统计"; // // 管线长度统计ToolStripMenuItem1 @@ -1786,7 +1781,7 @@ this.道路断面分析ToolStripMenuItem, this.基线剖面分析ToolStripMenuItem}); this.断面分析ToolStripMenuItem.Name = "断面分析ToolStripMenuItem"; - this.断面分析ToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.断面分析ToolStripMenuItem.Size = new System.Drawing.Size(148, 22); this.断面分析ToolStripMenuItem.Text = "断面分析"; // // 横断面分析ToolStripMenuItem @@ -1828,7 +1823,7 @@ this.连通分析ToolStripMenuItem, this.爆管分析ToolStripMenuItem}); this.拓扑分析ToolStripMenuItem.Name = "拓扑分析ToolStripMenuItem"; - this.拓扑分析ToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.拓扑分析ToolStripMenuItem.Size = new System.Drawing.Size(148, 22); this.拓扑分析ToolStripMenuItem.Text = "拓扑分析"; // // 创建拓扑ToolStripMenuItem @@ -1890,7 +1885,7 @@ this.隐藏隧道ToolStripMenuItem, this.删除隧道ToolStripMenuItem}); this.开挖分析ToolStripMenuItem.Name = "开挖分析ToolStripMenuItem"; - this.开挖分析ToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.开挖分析ToolStripMenuItem.Size = new System.Drawing.Size(148, 22); this.开挖分析ToolStripMenuItem.Text = "开挖分析"; // // 多边形开挖ToolStripMenuItem @@ -1942,7 +1937,7 @@ this.可视域分析ToolStripMenuItem, this.可视包络分析ToolStripMenuItem}); this.视域分析ToolStripMenuItem.Name = "视域分析ToolStripMenuItem"; - this.视域分析ToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.视域分析ToolStripMenuItem.Size = new System.Drawing.Size(148, 22); this.视域分析ToolStripMenuItem.Text = "视域分析"; // // 通视分析ToolStripMenuItem @@ -1973,7 +1968,7 @@ this.缓冲区分析ToolStripMenuItem, this.无源淹没分析ToolStripMenuItem}); this.区域分析ToolStripMenuItem.Name = "区域分析ToolStripMenuItem"; - this.区域分析ToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.区域分析ToolStripMenuItem.Size = new System.Drawing.Size(148, 22); this.区域分析ToolStripMenuItem.Text = "区域分析"; // // 附属物分析ToolStripMenuItem @@ -2000,45 +1995,14 @@ // 清除分析ToolStripMenuItem // this.清除分析ToolStripMenuItem.Name = "清除分析ToolStripMenuItem"; - this.清除分析ToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.清除分析ToolStripMenuItem.Size = new System.Drawing.Size(148, 22); this.清除分析ToolStripMenuItem.Text = "清除分析"; this.清除分析ToolStripMenuItem.Click += new System.EventHandler(this.buttonItemClear_Click); // - // contextMenuStrip1 - // - this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.FlyToMenu, - this.LightMenu, - this.AllLightMenuItem}); - this.contextMenuStrip1.Name = "contextMenuStrip1"; - this.contextMenuStrip1.Size = new System.Drawing.Size(125, 70); - // - // FlyToMenu - // - this.FlyToMenu.Name = "FlyToMenu"; - this.FlyToMenu.Size = new System.Drawing.Size(124, 22); - this.FlyToMenu.Text = "定位"; - this.FlyToMenu.Click += new System.EventHandler(this.FlyToMenu_Click); - // - // LightMenu - // - this.LightMenu.Name = "LightMenu"; - this.LightMenu.Size = new System.Drawing.Size(124, 22); - this.LightMenu.Text = "单个闪烁"; - this.LightMenu.Click += new System.EventHandler(this.LightMenu_Click); - // - // AllLightMenuItem - // - this.AllLightMenuItem.Name = "AllLightMenuItem"; - this.AllLightMenuItem.Size = new System.Drawing.Size(124, 22); - this.AllLightMenuItem.Text = "全部闪烁"; - this.AllLightMenuItem.Visible = false; - this.AllLightMenuItem.Click += new System.EventHandler(this.AllLightMenuItem_Click); - // // timer1 // this.timer1.Interval = 500; - this.timer1.Tick += new System.EventHandler(this.timer1_Tick); + //this.timer1.Tick += new System.EventHandler(this.timer1_Tick); // // layerNodeContexMenu // @@ -2684,7 +2648,6 @@ this.buttonItemZTT1.Name = "buttonItemZTT1"; this.buttonItemZTT1.Text = "统计数据"; this.buttonItemZTT1.Visible = false; - this.buttonItemZTT1.Click += new System.EventHandler(this.buttonItemZTT1_Click); // // buttonItemZTT2 // @@ -5514,7 +5477,7 @@ this.dataGridViewX2.ReadOnly = true; this.dataGridViewX2.RowHeadersVisible = false; this.dataGridViewX2.RowTemplate.Height = 23; - this.dataGridViewX2.Size = new System.Drawing.Size(20983, 92); + this.dataGridViewX2.Size = new System.Drawing.Size(21874, 92); this.dataGridViewX2.TabIndex = 11; // // dataGridViewTextBoxColumn10 @@ -5608,7 +5571,7 @@ this.dataGridViewX3.ReadOnly = true; this.dataGridViewX3.RowHeadersVisible = false; this.dataGridViewX3.RowTemplate.Height = 23; - this.dataGridViewX3.Size = new System.Drawing.Size(20982, 127); + this.dataGridViewX3.Size = new System.Drawing.Size(21873, 127); this.dataGridViewX3.TabIndex = 5; this.dataGridViewX3.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.dataGridViewX3_MouseDoubleClick); // @@ -5866,7 +5829,7 @@ this.dataGridViewX8.ReadOnly = true; this.dataGridViewX8.RowHeadersVisible = false; this.dataGridViewX8.RowTemplate.Height = 23; - this.dataGridViewX8.Size = new System.Drawing.Size(91, 92); + this.dataGridViewX8.Size = new System.Drawing.Size(40, 92); this.dataGridViewX8.TabIndex = 11; // // dataGridViewTextBoxColumn12 @@ -5961,7 +5924,7 @@ this.dataGridViewX9.ReadOnly = true; this.dataGridViewX9.RowHeadersVisible = false; this.dataGridViewX9.RowTemplate.Height = 23; - this.dataGridViewX9.Size = new System.Drawing.Size(90, 127); + this.dataGridViewX9.Size = new System.Drawing.Size(39, 127); this.dataGridViewX9.TabIndex = 5; this.dataGridViewX9.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.dataGridViewX9_MouseDoubleClick); // @@ -6819,7 +6782,6 @@ this.panelEx3.ResumeLayout(false); this.RightScreenToolMenu.ResumeLayout(false); this.toolRightMenu.ResumeLayout(false); - this.contextMenuStrip1.ResumeLayout(false); this.layerNodeContexMenu.ResumeLayout(false); this.contextMenuStrip2.ResumeLayout(false); this.contextMenuStrip3.ResumeLayout(false); @@ -6914,10 +6876,6 @@ private DevComponents.DotNetBar.SideBar sideBar1; private DevComponents.DotNetBar.SideBarPanelItem sideBarPanelItem3; private DevComponents.DotNetBar.ExpandableSplitter expandableSplitter1; - private System.Windows.Forms.ContextMenuStrip contextMenuStrip1; - private System.Windows.Forms.ToolStripMenuItem FlyToMenu; - private System.Windows.Forms.ToolStripMenuItem LightMenu; - private System.Windows.Forms.ToolStripMenuItem AllLightMenuItem; private System.Windows.Forms.Timer timer1; private System.Windows.Forms.ContextMenuStrip layerNodeContexMenu; private System.Windows.Forms.ToolStripMenuItem RefreshLayerFeatureListMenuItem; diff --git a/MainFrm.resx b/MainFrm.resx index b5d8c43..bf053b9 100644 --- a/MainFrm.resx +++ b/MainFrm.resx @@ -154,9 +154,6 @@ 375, 94 - - 17, 54 - 461, 17 diff --git a/bin/x86/Debug/Cyberpipe.exe b/bin/x86/Debug/Cyberpipe.exe index a37517d..511d28f 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 77f4d13..9773759 100644 --- a/bin/x86/Debug/Cyberpipe.pdb +++ b/bin/x86/Debug/Cyberpipe.pdb Binary files differ diff --git a/Cyberpipe.suo b/Cyberpipe.suo index ebd45ee..c2c34b1 100644 --- a/Cyberpipe.suo +++ b/Cyberpipe.suo Binary files differ diff --git a/Forms/FrmPipelineModelDataBase.cs b/Forms/FrmPipelineModelDataBase.cs index a060afb..f833db4 100644 --- a/Forms/FrmPipelineModelDataBase.cs +++ b/Forms/FrmPipelineModelDataBase.cs @@ -1,16 +1,10 @@ using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; using System.Drawing; -using System.Text; using System.Windows.Forms; using GeoScene.Globe; using GeoScene.Engine; using GeoScene.Data; using System.IO; -using System.Collections; -using System.Xml; using System.Text.RegularExpressions; using DevComponents.DotNetBar; @@ -39,11 +33,12 @@ /// private void FrmPipelineModel_Load(object sender, EventArgs e) { + buttonOpen.Visible = isSh; string pipelinetype = Utility.pipelinetype; string[] pipelinetypes = pipelinetype.Split(','); for (int i = 0; i < pipelinetypes.Length; i++) { - pipelineTypeCbo.Items.Add(pipelinetypes[i]);//管线类型 + pipelineTypeCbo.Items.Add(pipelinetypes[i]); } comboBoxExLayer.Items.Clear(); diff --git a/FrmDatabaseParaSetting.cs b/FrmDatabaseParaSetting.cs index 39a4e4f..e4dfe80 100644 --- a/FrmDatabaseParaSetting.cs +++ b/FrmDatabaseParaSetting.cs @@ -123,7 +123,6 @@ { MessageBox.Show("数据库连接成功!", "提示"); } - } else { diff --git a/FrmShResult.cs b/FrmShResult.cs index d11fd66..50a7d8c 100644 --- a/FrmShResult.cs +++ b/FrmShResult.cs @@ -663,7 +663,6 @@ private void FrmShResult_FormClosed(object sender, FormClosedEventArgs e) { mainfrm.boolfrmShResult = false; - } /// /// 一键审核导出 diff --git a/MainFrm.cs b/MainFrm.cs index 2e3ba7f..83acfa1 100644 --- a/MainFrm.cs +++ b/MainFrm.cs @@ -19,7 +19,6 @@ { public partial class MainFrm : Office2007Form { - TreeNode layerManagerNode = null; TreeNode myPlaceNode = null; bool m_bFullScreen = false; @@ -1395,7 +1394,6 @@ private void MainFrm_Load(object sender, EventArgs e) { - this.initGlobalControl(); this.initGlobalMap(); this.initLayerTree(); @@ -1403,13 +1401,11 @@ this.initLayout(); this.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]); jumpToCameraState(x, y, z); - } #endregion @@ -1578,12 +1574,6 @@ 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)); - /*Point pt = getUpperLeftPoint(pt1, pt2); - Image myImg = new Bitmap(Convert.ToInt32(e.Rect.Width), Convert.ToInt32(e.Rect.Height)); - Graphics g = Graphics.FromImage(myImg); - g.CopyFromScreen(pt, new Point(0, 0), new Size(Convert.ToInt32(e.Rect.Width), Convert.ToInt32(e.Rect.Height))); - */ - int mapWidth = 0; int mapHeight = 0; Point pt = getUpperLeftPoint(pt1, pt2, out mapWidth, out mapHeight); @@ -1862,7 +1852,6 @@ { GSOLayer layer = node.Tag as GSOLayer; - //globeControl1.Globe.Layers.Remove(layer); for (int i = globeControl1.Globe.Layers.Count - 1; i >= 0; i--) { if (globeControl1.Globe.Layers[i].Caption == layer.Caption) @@ -2065,7 +2054,6 @@ } } - void globeControl1_MouseWheel(object sender, MouseEventArgs e) { if (globeControl1.Globe.CameraState.Distance > 20000000) @@ -2321,8 +2309,6 @@ case "valvequery": FrmValveStatistics frm = new FrmValveStatistics(globeControl1, polygon, new DataGridViewDelegate(InitDataGridViewX1)); frm.Show(this); - //panelEx6.Visible = true; - //toolStripFeatureLength.Text = ""; globeControl1.Globe.Action = EnumAction3D.ActionNull; break; @@ -2365,7 +2351,6 @@ layerGround.Visible = false; } } - // 清除当前TrackPolygonAnalysis的痕迹 globeControl1.Globe.ClearLastTrackPolygon(); globeControl1.Globe.Action = EnumAction3D.ActionNull; break; @@ -2382,20 +2367,7 @@ globeControl1.Globe.Action = EnumAction3D.ActionNull; break; case "BSQDuoBianXiangStatis": - - //GSOFeature f2 = new GSOFeature(); - //f2.Geometry = e.Polygon; - //f2.Geometry.AltitudeMode = EnumAltitudeMode.Absolute; - //globeControl1.Globe.MemoryLayer.AddFeature(f2); - //f2.Geometry.MoveZ(3); - //workWellLen.Clear(); - //List listBSQ = new List(); - - //GSOFeatures bsqFeatures = PolygonIntersectAnalysis(e.Polygon, "标识器"); - //listBSQ.Add(bsqFeatures); - - //FrmBSQDuoBianXingStatis bsqFrm = new FrmBSQDuoBianXingStatis(workWellLen, globeControl1, listBSQ); - FrmBSQStatis bsqFrm = new FrmBSQStatis(globeControl1, e.Polygon); + FrmBSQStatis bsqFrm = new FrmBSQStatis(globeControl1, e.Polygon); bsqFrm.Show(this); globeControl1.Globe.Action = EnumAction3D.ActionNull; break; @@ -2407,8 +2379,6 @@ } } } - - /// /// 鼠标悬浮提示 /// @@ -2432,20 +2402,19 @@ } catch (Exception ex) { - //LogError.PublishError(ex); + LogError.PublishError(ex); } } - + /// /// 添加管线绘制完成事件, 红线工具绘制完成 /// /// - /// + /// (完善) void globeControl1_MouseDoubleClick(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left) { - if (m_AddPipeLine == true && globeControl1.Globe.Action == EnumAction3D.DrawPolyline)//添加管线 { GSOLayer layerDest = globeControl1.Globe.DestLayerFeatureAdd; @@ -2661,18 +2630,12 @@ { if (e.Button == MouseButtons.Right) { - if (e.X == mouseDownX2 && e.Y == mouseDownY2) - { - RightScreenToolMenu.Show(globeControl2, e.X, e.Y); - } - else - { - return; - } + if (e.X != mouseDownX2 || e.Y != mouseDownY2) return; + RightScreenToolMenu.Show(globeControl2, e.X, e.Y); } } /// - /// + /// (完善) /// /// /// @@ -2912,7 +2875,6 @@ bool result = false; System.Net.WebResponse response = null; - try { System.Net.WebRequest req = System.Net.WebRequest.Create(fileUrl); @@ -3038,7 +3000,7 @@ } /// - /// 拼接气泡表格字符串 + /// 拼接气泡表格字符串(完善) /// /// /// @@ -3233,14 +3195,8 @@ { TreeNode featureAddPipeFitTreenode = GetDestLayerFeatureAddTreeNode(); GSOLayer featureAddLayer = globeControl1.Globe.Layers.GetLayerByCaption(featureAddPipeFitTreenode.Tag.ToString().Split('|')[1]); - if (featureAddLayer != null) - { - return featureAddLayer; - } - else - { - return null; - } + + return featureAddLayer != null ? featureAddLayer : null; } private TreeNode GetDestLayerFeatureAddTreeNode() @@ -3306,7 +3262,6 @@ return null; } - /// /// 地上模式 菜单按钮 /// @@ -3335,22 +3290,16 @@ 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(); - } } /// @@ -3382,13 +3331,9 @@ 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; } @@ -3426,20 +3371,8 @@ globeControl1.Globe.GroundOpaque = 100 - sliderGroundTransSet1.Value; GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(roadLayerName);//("180fd"); if (layer != null) - { layer.Opaque = 100 - sliderGroundTransSet1.Value; - } - //if (buttonItemSPDB.Checked) - //{ - // layer = globeControl2.Globe.Layers.GetLayerByCaption("180fd"); - // if (layer != null) - // { - // layer.Opaque = 100 - sliderGroundTransSet1.Value; - // } - // globeControl2.Globe.GroundOpaque = 100 - sliderGroundTransSet1.Value; - //} optiValue = sliderGroundTransSet1.Value; - //sliderItem1.Value = optiValue; } /// /// 图例 菜单按钮 @@ -3499,21 +3432,7 @@ panel3.Visible = false; sideBar1.ExpandedPanel = sideBarPanelItem3; buttonItemBZ11.Checked = false; - - //20160624 - /* - if (sideBarPanelItem4.Visible == true) - { - sideBar1.Visible = true; - controlContainerItem5.Visible = true; - } - else - { - sideBar1.Visible = false; - } - */ Refresh(); - } } /// @@ -3542,7 +3461,7 @@ int xOld = 0; int yOld = 0; /// - /// 全屏显示功能实现 + /// 全屏显示功能实现(完善) /// private void FullScreen() { @@ -3666,7 +3585,6 @@ FullScreen(); break; case Keys.Escape: - // esc仅仅取消全屏 if (m_bFullScreen) { FullScreen(); @@ -3682,7 +3600,6 @@ } } - private Point getUpperLeftPoint(Point p1, Point p2, out int mapWidth, out int mapHeight) // { Rectangle rc = new Rectangle(); @@ -3695,29 +3612,13 @@ int screenWidth = SystemInformation.WorkingArea.Width; int screenHeight = SystemInformation.WorkingArea.Height; - if (p1.X < x) - rc.X = x; - else - rc.X = p1.X; - - if (p1.Y < y) - rc.Y = y; - else - rc.Y = p1.Y; - + rc.X = p1.X < x ? x : p1.X; + rc.Y = p1.Y < y ? y : p1.Y; p1.X = rc.Left; p1.Y = rc.Top; - if (p2.X > screenWidth) - p2.X = screenWidth; - else - p2.X = p2.X; - - if (p2.Y > screenHeight) - p2.Y = screenHeight; - else - p2.Y = p2.Y; - + p2.X = p2.X > screenWidth ? screenWidth : p2.X; + p2.Y = p2.Y > screenHeight ? screenHeight : p2.Y; rc.Width = p2.X - rc.X; rc.Height = p2.Y - rc.Y; @@ -3728,7 +3629,6 @@ } Image printImage; - private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e) { e.Graphics.DrawImage(printImage, 10, 10); @@ -3742,15 +3642,8 @@ { LogManager.saveLog(Utility.userName, this.btnOutputJPG.Text); - //globeControl1.Globe.Action = EnumAction3D.TrackRect; //绘制矩形模式 - //globeControl1.Globe.TrackRectTool.TrackMode = EnumTrackMode.ScreenTrack; //在屏幕上绘制 Point pt1 = new Point(Convert.ToInt32(0), Convert.ToInt32(0)); Point pt2 = new Point(Convert.ToInt32(panelEx5.Width), Convert.ToInt32(panelEx5.Height)); - /*Point pt = getUpperLeftPoint(pt1, pt2); - Image myImg = new Bitmap(Convert.ToInt32(panelEx5.Width), Convert.ToInt32(panelEx5.Height)); - Graphics g = Graphics.FromImage(myImg); - g.CopyFromScreen(pt, new Point(0, 0), new Size(Convert.ToInt32(panelEx5.Width), Convert.ToInt32(panelEx5.Height))); - */ int mapWidth = 0; int mapHeight = 0; Point pt = getUpperLeftPoint(pt1, pt2, out mapWidth, out mapHeight); @@ -3784,120 +3677,6 @@ } } } - - /// - /// 窗体下方属性表格 右键菜单中的 “定位”菜单 - /// - /// - /// - private void FlyToMenu_Click(object sender, EventArgs e) - { - GSOFeature rowFeature = contextMenuStrip1.Tag as GSOFeature; - if (rowFeature == null) - return; - - - 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); - } - else - { - globeControl1.Globe.FlyToFeature(rowFeature, 0, 45, 3); - } - LightMenu_Click(sender, e); - - } - - /// - /// 表格中右键 “单个闪烁” 菜单 - /// - /// - /// - private void LightMenu_Click(object sender, EventArgs e) - { - flashflag = "single"; - timer1.Start(); - } - /// - /// 表格中右键 “全部闪烁” 菜单 - /// - /// - /// - private void AllLightMenuItem_Click(object sender, EventArgs e) - { - flashflag = "all"; - timer1.Start(); - } - - /// - /// 使用timer实现管线的闪烁效果 - /// - /// - /// - private void timer1_Tick(object sender, EventArgs e) - { - GSOFeature rowFeature = contextMenuStrip1.Tag as GSOFeature; - if (rowFeature == null) - return; - - if (count < 40) - { - count++; - if (flashflag == "single") - { - if (rowFeature != null) - { - if (count % 2 != 0) - { - rowFeature.HighLight = true; - globeControl1.Refresh(); - } - else - { - rowFeature.HighLight = false; - globeControl1.Refresh(); - } - } - } - else if (flashflag == "all") - { - GSOFeatures feats = Utility.Table2Features(dataGridViewX1.DataSource as DataTable, m_CurrentQueryLayer, globeControl1); - if (feats.Length > 0) - { - if (count % 2 != 0) - { - for (int i = 0; i < feats.Length; i++) - { - GSOFeature tempfeat = feats[i]; - tempfeat.HighLight = true; - } - - globeControl1.Refresh(); - } - else - { - for (int i = 0; i < feats.Length; i++) - { - GSOFeature tempfeat = feats[i]; - tempfeat.HighLight = false; - } - globeControl1.Refresh(); - } - } - } - } - else - { - timer1.Stop(); - count = 0; - } - } /// /// 图层目录树 右键菜单中的 目标图层 菜单 /// @@ -3910,7 +3689,6 @@ TreeNode node = layerNodeContexMenu.Tag as TreeNode; FeatureAddLayerMenuItem.Checked = true; GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(node.Tag.ToString().Split('|')[1]); - //GSOLayer layer = globeControl1.Globe.Layers.GetLayerByID((int)node.Tag); globeControl1.Globe.DestLayerFeatureAdd = layer; } } @@ -3954,7 +3732,6 @@ layer.Dataset.Save(); } - #region wxl feature的公共方法 /// /// 查找指定图层中在 指定范围内的feature对象集合 @@ -3966,24 +3743,10 @@ { GSOFeatures feats = new GSOFeatures(); GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(layername); - if (layer == null) - { - return feats; - } + if (layer == null)return feats; GSOFeatureLayer flayer = layer as GSOFeatureLayer; - if (flayer != null) - { - GSOFeatureDataset fdataset = flayer.Dataset as GSOFeatureDataset; - } - - if (polygon == null) - { - feats = flayer.GetAllFeatures(); - } - else - { - feats = flayer.FindFeaturesInPolygon(polygon, false); - } + if (flayer == null) return feats; + feats = polygon == null ? flayer.GetAllFeatures() : flayer.FindFeaturesInPolygon(polygon, false); return feats; } #endregion @@ -4014,10 +3777,7 @@ if (globeControl1.Globe.Action != EnumAction3D.NormalHit) { buttonItemFX3_6.Checked = false; - // ClearConnexityAnalysis(); - buttonItemFX3_5.Checked = false; - // ClearCloseValvesAnalysis(); } if (globeControl1.Globe.Action != EnumAction3D.TrackPolygon) { @@ -4025,7 +3785,6 @@ buttonItemFX4_1.Checked = false; } } - /// /// 主窗体关闭事件处理 /// @@ -4033,21 +3792,13 @@ /// private void MainFrm_FormClosing(object sender, FormClosingEventArgs e) { - if (MessageBox.Show("是否退出系统?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) - { e.Cancel = true; - } else - { globeControl1.Globe.MemoryLayer.SaveAs(Application.StartupPath + "/MyPlace.kml"); - } - - //saveLayerList(layerManagerNode.Nodes); - //注销id号为103的热键设定 - // UnregisterHotKey(Handle, 103); } + #region 完善 /// /// 垂直净距分析 功能界面中的 选择图层复选框 选中状态改变事件处理 /// @@ -4198,12 +3949,10 @@ } } } - Dictionary featCount = new Dictionary(); Dictionary featLenth = new Dictionary(); Dictionary m_FeaturesWithBianhao = new Dictionary();//记录编号和对应的标注点的位置 GSOFeatures polygonJingJuAnalysises = new GSOFeatures(); - /// /// 垂直净距分析 功能界面中的 开始分析按钮 事件处理 /// @@ -4293,7 +4042,6 @@ globeControl1.Refresh(); this.Cursor = Cursors.Default; } - /// /// 在指定的两点组成的线的中间添加一个marker对象,并将marker对象添加到指定的图层中 /// @@ -4357,7 +4105,6 @@ return dismarker.Position; } - /// /// 计算指定feature对象与除了该feature所在图层之外的 所有管线图层中的所有feature对象 的垂直距离 并在表格中记录符合要求的管线 /// @@ -4411,8 +4158,7 @@ double dDist = -1; dDist = globeControl1.Globe.Analysis3D.ComputeHorizonDistance(line1, line2, out pntIntersect1, out pntIntersect2, out pntProIntersect1, out pntProIntersect2, false); - //dDist = globeControl1.Globe.Analysis3D.ComputeVerticalDistance(line1, line2, out pntIntersect1, out pntIntersect2, out pntProIntersect1, out pntProIntersect2, false); - + if (dDist > -1) { dDist = Math.Abs(pntIntersect1.Z - pntIntersect2.Z) - pipeStyle1.Radius - pipeStyle2.Radius;//获得净距值 @@ -4472,25 +4218,6 @@ } } } - - //double verticalDis = dDist; - //dDist = globeControl1.Globe.Analysis3D.ComputeVerticalDistance(line1, line2, out pntIntersect1, out pntIntersect2, out pntProIntersect1, out pntProIntersect2, false); - //if (dDist > -1) - //{ - // dDist = Math.Abs(pntIntersect1.Z - pntIntersect2.Z) - pipeStyle1.Radius - pipeStyle2.Radius; - // if (dDist < horizontalDistance) - // { - // 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 = verticalDis.ToString("0.00"); - // dataGridViewAnalysisResult.Rows[idx].Cells[5].Value = dDist.ToString("0.00"); - // } - //} } if (m_FeaturesWithBianhao.ContainsKey(selectedFeature.Name + "-" + feats2[j].Name) == false) @@ -4545,7 +4272,6 @@ } } } - /// /// 水平净距分析 功能界面中 开始分析按钮 的事件处理 /// @@ -4629,8 +4355,6 @@ globeControl1.Refresh(); this.Cursor = Cursors.Default; } - - /// /// 计算指定feature对象与除了该feature所在图层之外的 所有管线图层中的所有feature对象 的水平距离 并记录符合要求的管线 功能 /// @@ -4820,7 +4544,6 @@ else { MessageBox.Show("请选中要进行碰撞分析的管线!", "提示"); - //globeControl1.Globe.Action = EnumAction3D.SelectObject; } globeControl1.Refresh(); this.Cursor = Cursors.Default; @@ -4845,9 +4568,6 @@ } } } - - - /// /// 覆土分析功能操作界面中的 选择管线 复选框选中状态改变事件处理 /// @@ -5071,11 +4791,9 @@ else { MessageBox.Show("请选中要进行覆土分析的管线!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); - //globeControl1.Globe.Action = EnumAction3D.SelectObject; } this.Cursor = Cursors.Default; } - /// /// 覆土分析中 表格的 双击定位 功能 /// @@ -5155,8 +4873,6 @@ //Refresh(); } - - /// /// 垂直净距分析 功能界面中 清除分析结果按钮 事件处理 /// @@ -5201,7 +4917,6 @@ layerTemp.RemoveAllFeature(); globeControl1.Refresh(); } - /// /// 垂直净距分析功能界面中 关闭按钮 事件处理 /// @@ -5262,7 +4977,6 @@ Refresh(); } - /// /// 导出指定DataGridView控件中的内容 /// @@ -5352,7 +5066,6 @@ } } } - /// /// 垂直净距分析功能界面中 导出Excel按钮 事件处理 /// @@ -5384,103 +5097,7 @@ { MessageBox.Show("表格内容为空!", "提示"); } - } - - - - /// - /// 添加指定路径下的数据 功能 - /// - /// - /// - private object AddLayerData(string strDataPath) - { - object objRes = null; - if (Path.GetExtension(strDataPath).ToLower().Equals(".kml")) - { - GSOLayer layer = globeControl1.Globe.Layers.Add(strDataPath); - objRes = layer; - if (layer != null) - { - 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; - // 注意用insert不要用add,因为后加入的图层在上层 - //layerManagerNode.Nodes.Add(node); - layerManagerNode.Nodes.Insert(0, node); - } - newlayername = layer.Caption; - } - else if (GSOUtility.IsDatasetSupportTerrain(strDataPath)) - { - GSOTerrain terrain = globeControl1.Globe.Terrains.Add(strDataPath); - objRes = terrain; - if (terrain != null) - { - TreeNode node = new TreeNode(); - node.Tag = terrain; - node.Text = terrain.Caption; - node.ImageIndex = 0; - node.SelectedImageIndex = 0; - node.Checked = terrain.Visible; - // 注意用insert不要用add,因为后加入的图层在上层 - // terrainManagerNode.Nodes.Add(node); - layerManagerNode.Nodes.Insert(0, node); - } - newlayername = terrain.Caption; - } - else if (Path.GetExtension(strDataPath).ToLower().Equals(".dxf")) - { - GSOLayer layer = globeControl1.Globe.Layers.Add(strDataPath); - objRes = layer; - if (layer != null) - { - GSODataset dataset = layer.Dataset; - CheckDatasetGeoReference(layer.Dataset, strDataPath); - CheckDatasetGeoReference(layer.Dataset, strDataPath); - TreeNode node = new TreeNode(); - node.Tag = layer; - node.Text = layer.Dataset.Caption; - node.ImageIndex = 0; - node.SelectedImageIndex = 0; - node.Checked = layer.Visible; - // 注意用insert不要用add,因为后加入的图层在上层 - //layerManagerNode.Nodes.Add(node); - layerManagerNode.Nodes.Insert(0, node); - } - newlayername = layer.Caption; - } - else - { - GSOLayer layer = globeControl1.Globe.Layers.Add(strDataPath); - objRes = layer; - if (layer != null) - { - GSODataset dataset = layer.Dataset; - - CheckDatasetGeoReference(layer.Dataset, strDataPath); - CheckDatasetGeoReference(layer.Dataset, strDataPath); - //CheckDatasetGeoReference(dataset); - TreeNode node = new TreeNode(); - node.Tag = layer; - node.Text = layer.Dataset.Caption; - node.ImageIndex = 0; - node.SelectedImageIndex = 0; - node.Checked = layer.Visible; - // 注意用insert不要用add,因为后加入的图层在上层 - //layerManagerNode.Nodes.Add(node); - layerManagerNode.Nodes.Insert(0, node); - } - newlayername = layer.Caption; - } - return objRes; - } - + } /// /// 碰撞分析功能界面中 选择管线复选框 选中状态改变事件处理 /// @@ -5600,7 +5217,6 @@ //globeControl1.Globe.Action = EnumAction3D.SelectObject; } } - /// /// 碰撞分析功能界面中 清除分析结果按钮 事件处理 /// @@ -5638,344 +5254,6 @@ MessageBox.Show("表格内容为空!", "提示"); } } - - ///// - ///// 区域分析 菜单 - ///// - ///// - ///// - //private void buttonItem50_Click(object sender, EventArgs e) - //{ - // buttonItem50.Checked = !buttonItem50.Checked; - // ribbonBarQY.Visible = buttonItem50.Checked; - // ribbonBarQY.Location = new Point(0, 0); - //} - - - /// - /// 连接数据库 菜单事件处理 - /// - /// - /// - private void ConnectDB(object sender, EventArgs e) - { - FrmDatabaseParaSetting frm = new FrmDatabaseParaSetting(globeControl1); - if (frm.ShowDialog() == DialogResult.OK) - { - ds = FrmDatabaseParaSetting.ds; - if (ds != null) - { - ds.IsCloseSaved = false; - } - } - } - - /// - /// 根据指定图层创建图层节点并将节点添加到图层管理节点的子节点集合中 - /// - /// - private void addNodeToLayerManagerNode(GSOLayer layer) - { - if (layer != null) - { - 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; - - if (!layerManagerNode.Nodes.Contains(node)) - { - layerManagerNode.Nodes.Insert(0, node); - layerManagerNode.Expand(); - } - } - } - - /// - /// 获取指定图层中最后一个feature对象的名称对应的整数 - /// - /// - /// - public int getLabelName(GSOLayer layer) - { - int nid = -1; - if (layer.GetAllFeatures().Length > 0) - { - string id = layer.GetAllFeatures()[layer.GetAllFeatures().Length - 1].Name; - - int.TryParse(id, out nid); - } - else - { - nid = 0; - } - return nid; - } - /// - /// 设置除指定标注图层之外的所有标注图层不可见 - /// - /// - public void setMarkerLayerUnVisible(string layerName) - { - string[] markerStrs = new string[10]; - markerStrs[0] = "标高标注"; - markerStrs[1] = "管径标注"; - markerStrs[2] = "埋深标注"; - markerStrs[3] = "坐标标注"; - markerStrs[4] = "坡度标注"; - markerStrs[5] = "属性标注"; - markerStrs[6] = "自定义标注"; - markerStrs[7] = "距离标注"; - markerStrs[8] = "红线工具"; - markerStrs[9] = "扯旗标注"; - - for (int i = 0; i < markerStrs.Length; i++) - { - GSOLayer markerLayer = globeControl1.Globe.Layers.GetLayerByCaption(markerStrs[i]); - if (markerLayer != null) - { - if (markerStrs[i] != layerName) - { - 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) - { - markerFeature.Visible = false; - } - } - if (layerMarkerTree.Nodes[0].Nodes.Count > i) - { - layerMarkerTree.Nodes[0].Nodes[i].Checked = true; - } - } - } - } - } - - /// - /// 判断选中的对象是否为管线 - /// - /// 被选中管线 - /// 返回一根线 - private GSOFeature IsPipeLineOfSelectedObj() - { - GSOFeature resFeature = null; - if (globeControl1.Globe.SelObjectCount < 1) - { - return null; - } - GSOLayer resLayer = null; - globeControl1.Globe.GetSelectObject(0, out resFeature, out resLayer); - if (resFeature == null) - return null; - - GSOGeoPolyline3D line1 = resFeature.Geometry as GSOGeoPolyline3D; - if (line1 == null) - { - return null; - } - GSOPipeLineStyle3D pipeStyle1 = line1.Style as GSOPipeLineStyle3D; - if (pipeStyle1 == null) - { - return null; - } - return resFeature; - } - - /// - /// 图层节点树中 节点 右键单击事件处理 - /// - /// - /// - private void layerMarkerTree_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e) - { - if (e.Button == MouseButtons.Right) - { - if (e.Node.Text == "标注管理" || e.Node.Text == "传感器管理") - { - return; - } - else if (e.Node.Parent.Text == "标注管理") - { - layerMarkerTree.SelectedNode = e.Node; - contextMenuStrip2.Show(layerMarkerTree, e.X, e.Y); - contextMenuStrip2.Tag = e.Node; - } - else if (e.Node.Parent.Text == "传感器管理") - { - layerSensorTree.SelectedNode = e.Node; - contextMenuStrip2.Show(layerSensorTree, e.X, e.Y); - contextMenuStrip2.Tag = e.Node; - } - else - { - if (e.Node.Tag is GSOFeature) - { - if (e.Node.Parent.Parent.Text == "标注管理") - { - layerMarkerTree.SelectedNode = e.Node; - contextMenuStrip3.Show(layerMarkerTree, e.X, e.Y); - contextMenuStrip3.Tag = e.Node; - } - else if (e.Node.Parent.Parent.Text == "传感器管理") - { - layerSensorTree.SelectedNode = e.Node; - contextMenuStrip3.Show(layerSensorTree, e.X, e.Y); - contextMenuStrip3.Tag = e.Node; - } - } - } - } - } - - /// - /// 标注管理、传感器管理 图层目录树的右键菜单中的 刷新列表 菜单 - /// - /// - /// - private void toolStripMenuItem1_Click(object sender, EventArgs e) - { - TreeNode node = contextMenuStrip2.Tag as TreeNode; - TreeNode parentNode = node.Parent; - Int32 nIndex = node.Index; - - if (parentNode.Text == "标注管理" || parentNode.Text == "传感器管理") - { - RefreshTreeNodeLayerFeatureList(node); - } - } - /// - /// 给指定的图层节点添加代表feature对象的子节点 - /// - /// - private void RefreshTreeNodeLayerFeatureList(TreeNode layerTreeNode) - { - layerTreeNode.Nodes.Clear(); - GSOLayer layer = (GSOLayer)layerTreeNode.Tag; - // 只将类型为内存数据集的图层列出,如果是其它类型的数据集可能数据量太大,没发显示在树控件中 - if (layer.Dataset is GSOFeatureDataset) - { - VisitFeature3Ds(layer.GetAllFeatures(), layerTreeNode); - } - } - - /// - /// 标注管理、传感器管理 图层目录树的右键菜单中的 移除所有 菜单 - /// - /// - /// - private void toolStripMenuItem2_Click(object sender, EventArgs e) - { - TreeNode node = contextMenuStrip3.Tag as TreeNode; - GSOFeature feature3d = node.Tag as GSOFeature; - if (node == null) - { - return; - } - if (feature3d != null) - { - feature3d.Delete(); - globeControl1.Globe.Refresh(); - node.Remove(); - } - } - - /// - /// 图层目录树的 节点对应的复选框选中状态改变事件处理 - /// - /// - /// - private void layerMarkerTree_AfterCheck(object sender, TreeViewEventArgs e) - { - if (e.Action != TreeViewAction.Unknown) - { - CheckTreeNode(e.Node, e.Node.Checked); - } - } - /// - /// 改变指定节点对应的复选框的选中状态 - /// - /// - /// - private void CheckTreeNode(TreeNode node, Boolean bChecked) - { - CheckChildTreeNode(node, bChecked); - globeControl1.Globe.Refresh(); - } - /// - /// 改变指定节点的子节点对应的复选框的选中状态 - /// - /// - /// - private void CheckChildTreeNode(TreeNode node, Boolean bChecked) - { - if (node == null) - { - return; - } - if (node.Tag != null) - { - if (node.Tag.GetType() == typeof(GSOFeatureFolder) || node.Tag.GetType() == typeof(GSOFeature)) - { - ((GSOFeature)node.Tag).SetVisibleDirectly(bChecked); - } - else - { - GSOLayer curLayer = node.Tag as GSOLayer; - GSOTerrain curTerrain = node.Tag as GSOTerrain; - if (curLayer != null) - { - curLayer.Visible = bChecked; - } - else if (curTerrain != null) - { - curTerrain.Visible = bChecked; - } - } - } - // 递归处理子节点 - for (int i = 0; i < node.Nodes.Count; i++) - { - node.Nodes[i].Checked = bChecked; - CheckChildTreeNode(node.Nodes[i], bChecked); - } - } - /// - /// 标注管理、传感器管理 目录树中的feature节点的右键菜单中的 删除 菜单 - /// - /// - /// - private void 删除ToolStripMenuItem1_Click(object sender, EventArgs e) - { - TreeNode node = contextMenuStrip2.Tag as TreeNode; - GSOLayer l = globeControl1.Globe.Layers.GetLayerByCaption(node.Text); - if (l != null) - { - l.RemoveAllFeature(); - node.Nodes.Clear(); - globeControl1.Refresh(); - } - } - - //定时检查传感器的状态 - public System.Windows.Forms.Timer timerOfSensor = null; - - /// /// 碰撞分析 功能界面中 关闭按钮 事件处理 /// @@ -5984,7 +5262,6 @@ private void buttonX7_Click_1(object sender, EventArgs e) { trackflag = ""; - globeControl1.Globe.Action = EnumAction3D.ActionNull; sideBarPanelItem4.Visible = false; panel2.Visible = false; @@ -5994,14 +5271,9 @@ dataGridViewX4.Rows.Clear(); dataGridViewX5.Rows.Clear(); if (buttonItem1.Checked) - { sideBar1.ExpandedPanel = sideBarPanelItem3; - } else - { sideBar1.Visible = false; - - } Refresh(); } /// @@ -6193,14 +5465,8 @@ comboBoxLayer.SelectedIndex = -1; dataGridViewLineList.Rows.Clear(); dataGridViewAnalysisResult.Rows.Clear(); - //if (buttonItem1.Checked) - //{ - // sideBar1.ExpandedPanel = sideBarPanelItem3; - //} - //else - //{ + sideBar1.Visible = false; - //} Refresh(); } /// @@ -6225,9 +5491,7 @@ globeControl1.Globe.JumpToPosition(point3d, EnumAltitudeMode.Absolute, 5); } else - { globeControl1.Globe.JumpToFeature(rowFeature, 5); - } } } } @@ -6308,897 +5572,6 @@ } } } - - /// - /// 一键审核---导入数据 - /// - /// - /// - private void buttonItem127_Click_2(object sender, EventArgs e) - { - LogManager.saveLog(Utility.userName, "打开数据"); - - try - { - - string dbIp = Utility.sgdbip; - string database = Utility.sgdbname; - string user = Utility.sgdbuser; - string pass = Utility.sgdbpwd; - shds = globeControl1.Globe.DataManager.OpenOracleDataSource(dbIp + "/" + database, "", "", user, pass); - if (shds == null) - { - MessageBox.Show("数据库连接失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); - } - Cyberpipe.Forms.FrmPipelineModelDataOneStep frm = new Cyberpipe.Forms.FrmPipelineModelDataOneStep(globeControl1, shds, layerTree); - if (frm.ShowDialog() == DialogResult.OK) - { - addNodeToLayerManagerNode(frm.rukuLayer); - } - } - catch (Exception ex) - { - LogError.PublishError(ex); - MessageBox.Show("内存过载请清理内存,并重新启动规划分析!", "提示"); - return; - } - - } - - /// - ///自动导出图片 - /// - /// - /// - private void buttonItem130_Click_1(object sender, EventArgs e) - { - LogManager.saveLog(Utility.userName, "导出审核图"); - - Point pt1 = new Point(Convert.ToInt32(0), Convert.ToInt32(0)); - Point pt2 = new Point(Convert.ToInt32(panelEx5.Width), Convert.ToInt32(panelEx5.Height)); - /*Point pt = getUpperLeftPoint(pt1, pt2); - Image myImg = new Bitmap(Convert.ToInt32(panelEx5.Width), Convert.ToInt32(panelEx5.Height)); - Graphics g = Graphics.FromImage(myImg); - g.CopyFromScreen(pt, new Point(0, 0), new Size(Convert.ToInt32(panelEx5.Width), Convert.ToInt32(panelEx5.Height))); - */ - - 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 = System.IO.Path.GetExtension(dlg.FileName);//扩展名 - switch (extension) - { - case ".jpg": - myImg.Save(dlg.FileName, System.Drawing.Imaging.ImageFormat.Jpeg); - break; - case ".png": - myImg.Save(dlg.FileName, System.Drawing.Imaging.ImageFormat.Png); - break; - case ".bmp": - myImg.Save(dlg.FileName, System.Drawing.Imaging.ImageFormat.Bmp); - break; - case ".gif": - myImg.Save(dlg.FileName, System.Drawing.Imaging.ImageFormat.Gif); - break; - default: - break; - } - } - } - /// - /// 一键审核功能 - /// - /// - /// - private void buttonItem128_Click(object sender, EventArgs e) - { - LogManager.saveLog(Utility.userName, this.buttonItem128.Text); - //垂直净距标准 - - frmSh = new FrmYJSHTC(globeControl1, globeControl2, layerTree); - - if (frmSh.ShowDialog() == DialogResult.OK) - { - frmWait = new FrmWait("一键审核……"); - frmWait.Location = new Point(this.Width - frmWait.Width - 10, this.Height - frmWait.Height - 50); - frmWait.Owner = this; - frmWait.Show(); - Thread thread = new Thread(new ThreadStart(doWork)); - thread.IsBackground = true; - thread.Start(); - } - } - - void doWork() - { - FrmShResult frmShResult = null; - - double dVerticalJingJuBiaoZhun = 1, dHorizontalJingJuBiaoZhun = 1; - if (frmSh.rukuLayer != null) - { - #region - this.Invoke((EventHandler)delegate - { - try - { - List managerLayerList = new List(); - for (int i = 0; i < layerManagerNode.Nodes.Count; i++) - { - managerLayerList.Add(layerManagerNode.Nodes[i].Text); - } - if (!managerLayerList.Contains(frmSh.rukuLayer.Caption)) - { - TreeNode node = new TreeNode(); - node.Tag = frmSh.rukuLayer; - node.Text = frmSh.rukuLayer.Dataset.Caption; - node.ImageIndex = 0; - node.SelectedImageIndex = 0; - node.Checked = frmSh.rukuLayer.Visible; - layerManagerNode.Nodes.Insert(0, node); - layerManagerNode.Expand(); - } - } - catch (Exception ex) - { - MessageBox.Show(ex.Message, "提示"); - } - }); - #endregion - - shlayername = frmSh.rukuLayer.Name; - globeControl1.Refresh(); - } - - if (frmShResult != null && !frmShResult.IsDisposed) - { - try - { - clearFeatureHighLight(); - ClearRedlineAnalyseResult(); - frmShResult.Close(); - } - catch (Exception ex) - { - MessageBox.Show(ex.Message); - } - } - - frmShResult = new FrmShResult(dVerticalJingJuBiaoZhun, dHorizontalJingJuBiaoZhun, shlayername, globeControl1, m_PipelineLayerNames); - if (boolfrmShResult == false) - { - frmShResult.Location = new Point(this.Width - frmShResult.Width - 10, this.Height - frmShResult.Height - 50); - frmShResult.Owner = this; - //一键审核实际计算步骤 - frmShResult.analysis(); - - //MainFrm窗体显示控制,回到一键审核Tab - this.Invoke((EventHandler)delegate - { - frmShResult.Show(); - frmWait.Close(); - //将tab页恢复到一键审核 - ribbonTabItem11.Checked = true; - try - { - globeControl1.Globe.Action = EnumAction3D.ActionNull; - //zhanshi = false; - splitContainer1.Panel2Collapsed = true; - - panelOfTable.Visible = false; - legendSC.Visible = false; - legendSG.Visible = false; - - GSOLayer redLayer = globeControl1.Globe.Layers.GetLayerByCaption("红线"); - if (redLayer != null) - { - redLayer.Visible = false; - } - } - catch (Exception ex) - { - MessageBox.Show("系统运行错误:" + ex.ToString(), "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); - } - - }); - - boolfrmShResult = true; - } - else - { - - } - } - - - /// - /// 清除渲染结果 - /// - public void ClearRedlineAnalyseResult() - { - for (int i = 0; i < globeControl1.Globe.Layers.Count; i++) - { - GSOLayer layer = globeControl1.Globe.Layers[i]; - if (layer.Caption == "tempLgdData") - { - layer.RemoveAllFeature(); - } - } - - layerTemp.RemoveAllFeature(); - globeControl1.Refresh(); - } - /// - /// 已审核的图层 - /// - /// - /// - private void buttonItem132_Click_1(object sender, EventArgs e) - { - //保存日志 - LogManager.saveLog(Utility.userName, this.buttonItem132.Text); - - if (shds == null) - { - //没连的话,直接连接审核库; //审核库配置读配置文件 - string dbIp = Utility.sgdbip; - string database = Utility.sgdbname; - string user = Utility.sgdbuser; - string pass = Utility.sgdbpwd; - - /* - if (!Utility.isNetworkConnectionSuccess(dbIp.Trim())) - { - MessageBox.Show("网络连接失败!", "提示"); - return; - } - */ - - shds = globeControl1.Globe.DataManager.OpenOracleDataSource(dbIp + "/" + database, "", "", user, pass); - if (shds == null) - { - MessageBox.Show("数据库连接失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); - } - } - Cyberpipe.Forms.FrmShLayers frm = new Cyberpipe.Forms.FrmShLayers(globeControl1, shds); - frm.Show(); - //if (frm.ShowDialog() == DialogResult.OK) - //{ - // addNodeToLayerManagerNode(frm.rukuLayer); - //} - //if (frm.rukuLayer != null) - //{ - // shlayername = frm.rukuLayer.Name; - //} - - } - /// - /// 审核入库 - /// - /// - /// - private void buttonItem133_Click_1(object sender, EventArgs e) - { - LogManager.saveLog(Utility.userName, "审核入库"); - FrmShRK frmShrk = new FrmShRK(globeControl1); - frmShrk.Show(); - } - /// - /// 模拟设计修改 - /// - /// - /// - private void buttonItem134_Click_1(object sender, EventArgs e) - { - LogManager.saveLog(Utility.userName, "模拟设计修改"); - - frmModify = new FrmMnModify(globeControl1, shlayername, shresultLists); - - if (boolfrmModify == false) - { - frmModify.Owner = this; - frmModify.Location = new Point(this.Width - frmModify.Width - 10, this.Height - frmModify.Height - 50); - frmModify.Show(); - boolfrmModify = true; - } - else - { - - } - - } - - - - /// - /// 一键审核中调节透明度 - /// - /// - /// - private void sliderItem1_ValueChanged(object sender, EventArgs e) - { - LogManager.saveLog(Utility.userName, this.sliderItem1.Text); - - globeControl1.Globe.GroundOpaque = 100 - sliderItem1.Value; - GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(roadLayerName);//("180fd"); - if (layer != null) - { - layer.Opaque = 100 - sliderItem1.Value; - } - - optiValue = sliderItem1.Value; - } - /// - /// 红线审核中的透明度分析 - /// - /// - /// - private void sliderItem3_ValueChanged(object sender, EventArgs e) - { - LogManager.saveLog(Utility.userName, this.sliderItem3.Text); - - globeControl1.Globe.GroundOpaque = 100 - sliderItem3.Value; - GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(roadLayerName);//("180fd"); - if (layer != null) - { - layer.Opaque = 100 - sliderItem3.Value; - } - optiValue = sliderItem3.Value; - } - - #region yanxiaowei - //初始化DataGridViewX1控件 - public delegate void DataGridViewDelegate(DataTable dt, string strLable, string strLayer, bool initDataGrid); - /// - /// 代理函数,操作DatgridViewX1 - /// - /// - /// - public void InitDataGridViewX1(DataTable dt, string strLable, string strLayer, bool initDataGrid) - { - if (initDataGrid == true) - { - dataGridViewX1.DataSource = dt; - panelOfTable.Visible = true; - toolStripNumbers.Text = strLable; - dataGridViewX1.Tag = strLayer; - } - else - { - dataGridViewX1.DataSource = null; - dataGridViewX1.Refresh(); - panelOfTable.Visible = false; - toolStripNumbers.Text = ""; - dataGridViewX1.Tag = ""; - globeControl1.Globe.MemoryLayer.RemoveAllFeature();//清除双击产生的标注 - } - } - FrmAnalysisGuiHuaResult from; - /// - /// 主窗体下方属性表格 双击定位 功能 - /// - /// - /// - 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 if (dataGridViewX1.Columns.Contains("标识器编号")) - { - featureName = dataGridViewX1.Rows[hittestinfo.RowIndex].Cells["标识器编号"].Value.ToString(); - } - featureName = featureName.Trim(); - - GSOLayer layer = null; - layer = globeControl1.Globe.Layers.GetLayerByCaption(dataGridViewX1.Tag.ToString()); - - if (layer == null) return; - - GSOFeatures features = layer.GetFeatureByName(featureName, false); - if (features.Length == 0) return; - GSOFeature rowFeature = features[0]; - - ClassSearchAnalysis.AddMakerToLineFeature(globeControl1, rowFeature); - - } - } - } - else - { - if (e.Button == MouseButtons.Left) - { - if (from != null && !from.IsDisposed) - { - try - { - from.Close(); - } - catch (Exception ex) - { - LogError.PublishError(ex); - } - } - try - { - DataGridView.HitTestInfo hittestinfo = dataGridViewX1.HitTest(e.X, e.Y); - if (hittestinfo.RowIndex >= 0) - { - string layer = dataGridViewX1.Rows[hittestinfo.RowIndex].Cells["管线类型"].Value.ToString(); - string hxName = dataGridViewX1.Rows[hittestinfo.RowIndex].Cells["红线编号"].Value.ToString(); - FrmAnalysisGuiHuaResult frm = new FrmAnalysisGuiHuaResult(globeControl1, lineStruct, featsList, - panelOfTable, dataGridViewX1, layer, hxName); - frm.Location = new Point(this.Width - frm.Width - 10, this.Height - frm.Height - 20); - frm.Show(this); - - from = frm; - } - } - catch (Exception ex) - { - LogError.PublishError(ex); - } - } - } - } - - /// - /// 空间查询 - /// - /// - /// - private void buttonItemSearch1_Click(object sender, EventArgs e) - { - LogManager.saveLog(Utility.userName, this.buttonItemSearch1.Text); - - trackflag = "PipelineSpatialQuery"; - globeControl1.Globe.Action = EnumAction3D.TrackPolygon; - globeControl1.Globe.TrackPolygonTool.TrackMode = EnumTrackMode.SpaceTrack; - - } - /// - /// 关键字查询 - /// - /// - /// - private void buttonItemSearch9_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, this.buttonItemSearch9.Text); - - FrmKeywordQuery.ShowForm(globeControl1, m_PipelineLayerNames, new DataGridViewDelegate(InitDataGridViewX1)); - } - /// - /// 编号查询 - /// - /// - /// - private void buttonItemSearch2_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, this.buttonItemSearch2.Text); - - FrmCodingQuery.ShowForm(globeControl1, m_PipelineLayerNames, new DataGridViewDelegate(InitDataGridViewX1)); - } - /// - /// 坐标查询 - /// - /// - /// - private void buttonItemSearch3_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, this.buttonItemSearch3.Text); - - FrmSetLatLonPos.ShowForm(globeControl1); - } - /// - /// 附属物查询 - /// - /// - /// - private void buttonItemSearch10_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, this.buttonItemSearch10.Text); - - FrmFittingQuery.ShowForm(globeControl1, instrumenLayerNames, new DataGridViewDelegate(InitDataGridViewX1)); - } - /// - /// 管径查询 - /// - /// - /// - private void buttonItemSearch4_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, this.buttonItemSearch4.Text); - - FrmDiameterQuery.ShowForm(globeControl1, m_PipelineLayerNames, new DataGridViewDelegate(InitDataGridViewX1)); - } - /// - /// 材质查询 - /// - /// - /// - private void buttonItemSearch5_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, this.buttonItemSearch5.Text); - - FrmMaterialSel.ShowForm(globeControl1, m_PipelineLayerNames, new DataGridViewDelegate(InitDataGridViewX1)); - } - /// - /// 基本查询 - /// - /// - /// - private void buttonItemSearch6_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, this.buttonItemSearch6.Text); - - FrmBasicQuery.ShowForm(globeControl1, new DataGridViewDelegate(InitDataGridViewX1)); - } - /// - /// 复合查询 - /// - /// - /// - private void buttonItemSearch7_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, this.buttonItemSearch7.Text); - - FrmQuerySQL.ShowForm(globeControl1, new DataGridViewDelegate(InitDataGridViewX1)); - } - /// - /// 关联查询 - /// - /// - /// - private void buttonItemSearch8_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, this.buttonItemSearch8.Text); - - if (globeControl1.Globe.SelObjectCount != 1) - { - MessageBox.Show("请选中一个对象!", "提示"); - return; - } - - double valueAllowance = 1.0; - - for (int j = 0; j < globeControl1.Globe.SelObjectCount; j++) - { - GSOFeature feature = null; - GSOLayer layer = null; - globeControl1.Globe.GetSelectObject(j, out feature, out layer); - - if (feature == null && feature.Geometry == null || (feature.Geometry.Type == EnumGeometryType.GeoPolygon3D - || feature.Geometry.Type == EnumGeometryType.GeoWater)) - return; - else - { - ClassSearchAnalysis.ResultRelationAnalysis(globeControl1, feature, valueLayerNames, workwellLayerNames, - instrumenLayerNames, pipefittingLayerNames, m_PipelineLayerNames, valueAllowance); - } - } - } - #endregion - /// - /// 清除分析 - /// - /// - /// - private void buttonItemClear_Click(object sender, EventArgs e) - { - LogManager.saveLog(Utility.userName, this.buttonItemClear.Text); - - globeControl1.Globe.ClearMeasure(); - layerTemp.RemoveAllFeature(); - layerTemp2.RemoveAllFeature(); - buttonItemLS5.Checked = false; - - dataGridViewX1.DataSource = null; - panelOfTable.Visible = false; - - globeControl1.Globe.MemoryLayer.RemoveAllFeature(); - globeControl1.Globe.ClearAnalysis(); - - - // 清除净距分析结果 - buttonX2_Click(null, null); - buttonX8_Click(null, null); - buttonX15_Click(null, null); - buttonX16_Click(null, null); - buttonClearAnalysisResult_Click(null, null); - - NetworkAnalysisTool.ClearAllTopAnalysis(this.globeControl1); - // ClearConnexityAnalysis();//清除连通性分析 - // 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); - } - } - - GSOFeatures feats = globeControl1.Globe.MemoryLayer.GetFeatureByName("粒子要素", true); - if (feats.Length > 0) - globeControl1.Globe.MemoryLayer.RemoveFeatureByID(feats[0].ID); - - globeControl1.Globe.UnderGroundFloor.Visible = false;//隐藏地下网格线 - - // ClearUpDownTraceAnalysis(); //清除上下游分析 - globeControl1.Globe.RemoveAllPits();//清除所有坑 - - string[] markerStrs = new string[9]; - markerStrs[0] = "标高标注"; - markerStrs[1] = "管径标注"; - markerStrs[2] = "埋深标注"; - markerStrs[3] = "坐标标注"; - markerStrs[4] = "坡度标注"; - markerStrs[5] = "属性标注"; - markerStrs[6] = "自定义标注"; - markerStrs[7] = "距离标注"; - markerStrs[8] = "扯旗标注"; - for (int i = 0; i < markerStrs.Length; i++) - { - GSOLayer markerLayer = globeControl1.Globe.Layers.GetLayerByCaption(markerStrs[i]); - markerLayer.RemoveAllFeature(); - } - if (layerMarkerTree != null && layerMarkerTree.Nodes.Count > 0) - { - for (int i = 0; i < layerMarkerTree.Nodes[0].Nodes.Count; i++) - { - layerMarkerTree.Nodes[0].Nodes[i].Nodes.Clear(); - } - } - - clearFeatureHighLight();//取消管线高亮 - - GSOLayer layerGround = globeControl1.Globe.Layers.GetLayerByCaption(roadLayerName);//("180fd"); - if (layerGround != null) - { - layerGround.Visible = true; - } - globeControl1.Refresh(); - globeControl2.Refresh(); - ClearRedlineAnalyseResult(); - globeControl1.Globe.Action = EnumAction3D.ActionNull; - } - /// - /// 管线长度全区域统计 - /// - /// - /// - private void buttonItemTJ1_ALL_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, "管线长度统计"); - FrmAllPipelineStatis frm = new FrmAllPipelineStatis(globeControl1, null, new DataGridViewDelegate(InitDataGridViewX1), m_PipelineLayerNames); - frm.Show(this); - - } - /// - /// 管线长度绘制区域统计 - /// - /// - /// - private void buttonItemTJ1_DRAW_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, "管线长度统计"); - - trackflag = "PipelineDistanceStatistics"; - globeControl1.Globe.Action = EnumAction3D.TrackPolygon; - globeControl1.Globe.TrackPolygonTool.TrackMode = EnumTrackMode.SpaceTrack; - } - /// - /// 阀门数量全区域统计 - /// - /// - /// - private void buttonItemTJ2_ALL_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, "阀门数量统计"); - FrmValveStatistics frm = new FrmValveStatistics(globeControl1, null, new DataGridViewDelegate(InitDataGridViewX1)); - frm.Show(this); - - globeControl1.Globe.Action = EnumAction3D.ActionNull; - } - /// - /// 阀门数量绘制区域统计 - /// - /// - /// - private void buttonItemTJ2_DRAW_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, "阀门数量统计"); - - trackflag = "valvequery"; - globeControl1.Globe.Action = EnumAction3D.TrackPolygon; - globeControl1.Globe.TrackPolygonTool.TrackMode = EnumTrackMode.SpaceTrack; - } - /// - /// 井盖数量全区域统计 - /// - /// - /// - private void buttonItemTJ3_ALL_Click(object sender, EventArgs e) - { - FrmAllWorkWellStatis frm = new FrmAllWorkWellStatis(globeControl1, null, new DataGridViewDelegate(InitDataGridViewX1)); - frm.Show(this); - } - /// - /// 井盖数量绘制区域统计 - /// - /// - /// - private void buttonItemTJ3_DRAW_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, "井盖数量统计"); - - trackflag = "workwellquery"; - globeControl1.Globe.Action = EnumAction3D.TrackPolygon; - globeControl1.Globe.TrackPolygonTool.TrackMode = EnumTrackMode.SpaceTrack; - } - /// - /// 管径分段统计全区域统计 - /// - /// - /// - private void buttonItemTJ4_ALL_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, "管径分段统计"); - - Frmpipediameterstatis.ShowForm(globeControl1, m_PipelineLayerNames, 0); - } - /// - /// 管径分段统计绘制区域统计 - /// - /// - /// - private void buttonItemTJ4_DRAW_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, "管径分段统计"); - - trackflag = null; - Frmpipediameterstatis.ShowForm(globeControl1, m_PipelineLayerNames, 1); - } - /// - /// 埋深分段统计全区域统计 - /// - /// - /// - private void buttonItemTJ5_ALL_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, "埋深分段统计"); - FrmpipeDeepstatis.ShowForm(globeControl1, m_PipelineLayerNames, 0); - } - /// - /// 埋深分段统计绘制区域统计 - /// - /// - /// - private void buttonItemTJ5_DRAW_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, "埋深分段统计"); - trackflag = null; - FrmpipeDeepstatis.ShowForm(globeControl1, m_PipelineLayerNames, 1); - } - /// - /// 管径分类统计全区域统计 - /// - /// - /// - private void buttonItemTJ6_ALL_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, "管径分类汇总"); - - FrmpipeDiametergather.ShowForm(globeControl1, m_PipelineLayerNames, 0); - } - /// - /// 管径分类统计绘制区域统计 - /// - /// - /// - private void buttonItemTJ6_DRAW_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, "管径分类汇总"); - - trackflag = null; - FrmpipeDiametergather.ShowForm(globeControl1, m_PipelineLayerNames, 1); - } - /// - /// 材质分类统计全区域统计 - /// - /// - /// - private void buttonItemTJ7_ALL_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, "材质分类汇总"); - - FrmpipeMaterialGather.ShowForm(globeControl1, m_PipelineLayerNames, 0); - } - /// - /// 材质分类统计绘制区域统计 - /// - /// - /// - private void buttonItemTJ7_DRAW_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, "材质分类汇总"); - - trackflag = null; - FrmpipeMaterialGather.ShowForm(globeControl1, m_PipelineLayerNames, 1); - } - /// - /// 附属物分类统计全区域统计 - /// - /// - /// - private void buttonItemTJ8_ALL_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, "附属物分类汇总"); - - FrmAccessoriesgather.ShowForm(globeControl1, instrumenLayerNames, 0); - } - /// - /// 附属物分类统计绘制区域统计 - /// - /// - /// - private void buttonItemTJ8_DRAW_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, "附属物分类汇总"); - - trackflag = null; - FrmAccessoriesgather.ShowForm(globeControl1, instrumenLayerNames, 1); - } /// /// 碰撞分析 /// @@ -7206,7 +5579,6 @@ /// private void buttonItemFX1_1_Click(object sender, EventArgs e) { - //日志记录 LogManager.saveLog(Utility.userName, this.buttonItemFX4_4.Text); this.dataGridViewX4.Size = new System.Drawing.Size(195, 120); @@ -7352,7 +5724,1332 @@ sideBar1.Refresh(); Refresh(); } + /// + /// 碰撞审查 + /// + /// + /// + private void buttonItemSH1_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, this.buttonItemSH1.Text); + this.dataGridViewX4.Size = new System.Drawing.Size(185, 92); + this.dataGridViewX5.Size = new System.Drawing.Size(185, 120); + + layerTemp.RemoveAllFeature(); + clearFeatureHighLight(); + globeControl1.Refresh(); + + sideBar1.Visible = true; + sideBarPanelItem3.Visible = true; + buttonItem1.Checked = true; + controlContainerItem3.Visible = true; + sideBarPanelItem4.Visible = true; + sideBarPanelItem4.Text = "碰撞审查"; + trackflag = "collision"; + controlContainerItem5.Control = panel2; + panel2.Dock = DockStyle.Fill; + panel2.Visible = true; + sideBar1.ExpandedPanel = sideBarPanelItem4; + sideBar1.Refresh(); + + Refresh(); + } + /// + /// 覆土审查 + /// + /// + /// + private void buttonItemSH2_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, this.buttonItemSH2.Text); + + this.dataGridViewX6.Size = new System.Drawing.Size(185, 92); + this.dataGridViewX7.Size = new System.Drawing.Size(185, 120); + + layerTemp.RemoveAllFeature(); + clearFeatureHighLight(); + globeControl1.Refresh(); + sideBar1.Visible = true; + sideBarPanelItem3.Visible = true; + buttonItem1.Checked = true; + controlContainerItem3.Visible = true; + sideBarPanelItem4.Visible = true; + sideBarPanelItem4.Text = "覆土审查"; + trackflag = "ftAnalysis"; + controlContainerItem5.Control = panel4; + panel4.Visible = true; + panel4.Dock = DockStyle.Fill; + sideBar1.ExpandedPanel = sideBarPanelItem4; + sideBar1.Refresh(); + Refresh(); + } + /// + /// 水平净距审查 + /// + /// + /// + private void buttonItemSH3_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, this.buttonItemSH3.Text); + + this.dataGridViewX8.Size = new System.Drawing.Size(190, 92); + this.dataGridViewX9.Size = new System.Drawing.Size(190, 120); + + layerTemp.RemoveAllFeature(); + clearFeatureHighLight(); + globeControl1.Refresh(); + sideBar1.Visible = true; + sideBarPanelItem3.Visible = true; + buttonItem1.Checked = true; + controlContainerItem3.Visible = true; + sideBarPanelItem4.Visible = true; + sideBarPanelItem4.Text = "水平净距审查"; + trackflag = "horizontal"; + controlContainerItem5.Control = panel5; + panel5.Dock = DockStyle.Fill; + panel5.Visible = true; + sideBar1.ExpandedPanel = sideBarPanelItem4; + sideBar1.Refresh(); + Refresh(); + } + /// + /// 垂直净距审查 + /// + /// + /// + private void buttonItemSH4_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, this.buttonItemSH4.Text); + + this.dataGridViewX2.Visible = true; + this.dataGridViewX3.Visible = true; + this.dataGridViewX2.Size = new System.Drawing.Size(185, 92); + this.dataGridViewX3.Size = new System.Drawing.Size(185, 120); + + layerTemp.RemoveAllFeature(); + clearFeatureHighLight(); + + globeControl1.Refresh(); + sideBar1.Visible = true; + sideBarPanelItem3.Visible = true; + buttonItem1.Checked = true; + controlContainerItem3.Visible = true; + sideBarPanelItem4.Visible = true; + sideBarPanelItem4.Text = "垂直净距审查"; + trackflag = "vertical"; + //globeControl1.Globe.Action = EnumAction3D.SelectObject; + panel2.Visible = false; + panel3.Visible = false; + panel5.Visible = false; + panel4.Visible = false; + controlContainerItem5.Control = panel1; + panel1.Dock = DockStyle.Fill; + panel1.Visible = true; + sideBar1.ExpandedPanel = sideBarPanelItem4; + sideBar1.Refresh(); + Refresh(); + } + #endregion + + /// + /// 添加指定路径下的数据 功能 + /// + /// + /// + private object AddLayerData(string strDataPath) + { + object objRes = null; + if (Path.GetExtension(strDataPath).ToLower().Equals(".kml")) + { + GSOLayer layer = globeControl1.Globe.Layers.Add(strDataPath); + objRes = layer; + if (layer != null) + { + 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; + layerManagerNode.Nodes.Insert(0, node); + } + newlayername = layer.Caption; + } + else if (GSOUtility.IsDatasetSupportTerrain(strDataPath)) + { + GSOTerrain terrain = globeControl1.Globe.Terrains.Add(strDataPath); + objRes = terrain; + if (terrain != null) + { + TreeNode node = new TreeNode(); + node.Tag = terrain; + node.Text = terrain.Caption; + node.ImageIndex = 0; + node.SelectedImageIndex = 0; + node.Checked = terrain.Visible; + layerManagerNode.Nodes.Insert(0, node); + } + newlayername = terrain.Caption; + } + else if (Path.GetExtension(strDataPath).ToLower().Equals(".dxf")) + { + GSOLayer layer = globeControl1.Globe.Layers.Add(strDataPath); + objRes = layer; + if (layer != null) + { + GSODataset dataset = layer.Dataset; + CheckDatasetGeoReference(layer.Dataset, strDataPath); + CheckDatasetGeoReference(layer.Dataset, strDataPath); + TreeNode node = new TreeNode(); + node.Tag = layer; + node.Text = layer.Dataset.Caption; + node.ImageIndex = 0; + node.SelectedImageIndex = 0; + node.Checked = layer.Visible; + layerManagerNode.Nodes.Insert(0, node); + } + newlayername = layer.Caption; + } + else + { + GSOLayer layer = globeControl1.Globe.Layers.Add(strDataPath); + + objRes = layer; + if (layer == null) + MessageBox.Show("layer is null"); + + CheckDatasetGeoReference(layer.Dataset, strDataPath); + TreeNode node = new TreeNode(); + node.Tag = layer; + node.Text = layer.Dataset.Caption; + node.ImageIndex = 0; + node.SelectedImageIndex = 0; + node.Checked = layer.Visible; + layerManagerNode.Nodes.Insert(0, node); + + newlayername = layer.Caption; + } + return objRes; + } + /// + /// 连接数据库 菜单事件处理 + /// + /// + /// + private void ConnectDB(object sender, EventArgs e) + { + FrmDatabaseParaSetting frm = new FrmDatabaseParaSetting(globeControl1); + if (frm.ShowDialog() == DialogResult.OK) + { + ds = FrmDatabaseParaSetting.ds; + if (ds != null) + { + ds.IsCloseSaved = false; + } + } + } + /// + /// 根据指定图层创建图层节点并将节点添加到图层管理节点的子节点集合中 + /// + /// + private void addNodeToLayerManagerNode(GSOLayer layer) + { + if (layer != null) + { + 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; + + if (!layerManagerNode.Nodes.Contains(node)) + { + layerManagerNode.Nodes.Insert(0, node); + layerManagerNode.Expand(); + } + } + } + /// + /// 获取指定图层中最后一个feature对象的名称对应的整数 + /// + /// + /// + public int getLabelName(GSOLayer layer) + { + int nid = -1; + if (layer.GetAllFeatures().Length > 0) + { + string id = layer.GetAllFeatures()[layer.GetAllFeatures().Length - 1].Name; + + int.TryParse(id, out nid); + } + else + { + nid = 0; + } + return nid; + } + /// + /// 设置除指定标注图层之外的所有标注图层不可见 + /// + /// + public void setMarkerLayerUnVisible(string layerName) + { + string[] markerStrs = new string[10]; + markerStrs[0] = "标高标注"; + markerStrs[1] = "管径标注"; + markerStrs[2] = "埋深标注"; + markerStrs[3] = "坐标标注"; + markerStrs[4] = "坡度标注"; + markerStrs[5] = "属性标注"; + markerStrs[6] = "自定义标注"; + markerStrs[7] = "距离标注"; + markerStrs[8] = "红线工具"; + markerStrs[9] = "扯旗标注"; + + for (int i = 0; i < markerStrs.Length; i++) + { + GSOLayer markerLayer = globeControl1.Globe.Layers.GetLayerByCaption(markerStrs[i]); + if (markerLayer != null) + { + if (markerStrs[i] != layerName) + { + 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) + { + markerFeature.Visible = false; + } + } + if (layerMarkerTree.Nodes[0].Nodes.Count > i) + { + layerMarkerTree.Nodes[0].Nodes[i].Checked = true; + } + } + } + } + } + /// + /// 判断选中的对象是否为管线 + /// + /// 被选中管线 + /// 返回一根线 + private GSOFeature IsPipeLineOfSelectedObj() + { + GSOFeature resFeature = null; + if (globeControl1.Globe.SelObjectCount < 1) return null; + GSOLayer resLayer = null; + globeControl1.Globe.GetSelectObject(0, out resFeature, out resLayer); + if (resFeature == null) return null; + + GSOGeoPolyline3D line1 = resFeature.Geometry as GSOGeoPolyline3D; + if (line1 == null) return null; + GSOPipeLineStyle3D pipeStyle1 = line1.Style as GSOPipeLineStyle3D; + if (pipeStyle1 == null) return null; + + return resFeature; + } + /// + /// 图层节点树中 节点 右键单击事件处理 + /// + /// + /// + private void layerMarkerTree_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e) + { + if (e.Button == MouseButtons.Right) + { + if (e.Node.Text == "标注管理" || e.Node.Text == "传感器管理") + return; + else if (e.Node.Parent.Text == "标注管理") + { + layerMarkerTree.SelectedNode = e.Node; + contextMenuStrip2.Show(layerMarkerTree, e.X, e.Y); + contextMenuStrip2.Tag = e.Node; + } + else if (e.Node.Parent.Text == "传感器管理") + { + layerSensorTree.SelectedNode = e.Node; + contextMenuStrip2.Show(layerSensorTree, e.X, e.Y); + contextMenuStrip2.Tag = e.Node; + } + else + { + if (e.Node.Tag is GSOFeature) + { + if (e.Node.Parent.Parent.Text == "标注管理") + { + layerMarkerTree.SelectedNode = e.Node; + contextMenuStrip3.Show(layerMarkerTree, e.X, e.Y); + contextMenuStrip3.Tag = e.Node; + } + else if (e.Node.Parent.Parent.Text == "传感器管理") + { + layerSensorTree.SelectedNode = e.Node; + contextMenuStrip3.Show(layerSensorTree, e.X, e.Y); + contextMenuStrip3.Tag = e.Node; + } + } + } + } + } + /// + /// 标注管理、传感器管理 图层目录树的右键菜单中的 刷新列表 菜单 + /// + /// + /// + private void toolStripMenuItem1_Click(object sender, EventArgs e) + { + TreeNode node = contextMenuStrip2.Tag as TreeNode; + TreeNode parentNode = node.Parent; + Int32 nIndex = node.Index; + + if (parentNode.Text == "标注管理" || parentNode.Text == "传感器管理") + { + RefreshTreeNodeLayerFeatureList(node); + } + } + /// + /// 给指定的图层节点添加代表feature对象的子节点 + /// + /// + private void RefreshTreeNodeLayerFeatureList(TreeNode layerTreeNode) + { + layerTreeNode.Nodes.Clear(); + GSOLayer layer = (GSOLayer)layerTreeNode.Tag; + // 只将类型为内存数据集的图层列出,如果是其它类型的数据集可能数据量太大,没发显示在树控件中 + if (layer.Dataset is GSOFeatureDataset) + { + VisitFeature3Ds(layer.GetAllFeatures(), layerTreeNode); + } + } + /// + /// 标注管理、传感器管理 图层目录树的右键菜单中的 移除所有 菜单 + /// + /// + /// + private void toolStripMenuItem2_Click(object sender, EventArgs e) + { + TreeNode node = contextMenuStrip3.Tag as TreeNode; + GSOFeature feature3d = node.Tag as GSOFeature; + if (node == null) + return; + if (feature3d != null) + { + feature3d.Delete(); + globeControl1.Globe.Refresh(); + node.Remove(); + } + } + /// + /// 图层目录树的 节点对应的复选框选中状态改变事件处理 + /// + /// + /// + private void layerMarkerTree_AfterCheck(object sender, TreeViewEventArgs e) + { + if (e.Action != TreeViewAction.Unknown) + { + CheckTreeNode(e.Node, e.Node.Checked); + } + } + /// + /// 改变指定节点对应的复选框的选中状态 + /// + /// + /// + private void CheckTreeNode(TreeNode node, Boolean bChecked) + { + CheckChildTreeNode(node, bChecked); + globeControl1.Globe.Refresh(); + } + /// + /// 改变指定节点的子节点对应的复选框的选中状态 + /// + /// + /// + private void CheckChildTreeNode(TreeNode node, Boolean bChecked) + { + if (node == null) + return; + if (node.Tag != null) + { + if (node.Tag.GetType() == typeof(GSOFeatureFolder) || node.Tag.GetType() == typeof(GSOFeature)) + ((GSOFeature)node.Tag).SetVisibleDirectly(bChecked); + else + { + GSOLayer curLayer = node.Tag as GSOLayer; + GSOTerrain curTerrain = node.Tag as GSOTerrain; + if (curLayer != null) + { + curLayer.Visible = bChecked; + } + else if (curTerrain != null) + { + curTerrain.Visible = bChecked; + } + } + } + // 递归处理子节点 + for (int i = 0; i < node.Nodes.Count; i++) + { + node.Nodes[i].Checked = bChecked; + CheckChildTreeNode(node.Nodes[i], bChecked); + } + } + /// + /// 标注管理、传感器管理 目录树中的feature节点的右键菜单中的 删除 菜单 + /// + /// + /// + private void 删除ToolStripMenuItem1_Click(object sender, EventArgs e) + { + TreeNode node = contextMenuStrip2.Tag as TreeNode; + GSOLayer l = globeControl1.Globe.Layers.GetLayerByCaption(node.Text); + if (l != null) + { + l.RemoveAllFeature(); + node.Nodes.Clear(); + globeControl1.Refresh(); + } + } + //定时检查传感器的状态 + public System.Windows.Forms.Timer timerOfSensor = null; + /// + /// 一键审核---导入数据 + /// + /// + /// + private void buttonItem127_Click_2(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "打开数据"); + + try + { + string dbIp = Utility.sgdbip; + string database = Utility.sgdbname; + string user = Utility.sgdbuser; + string pass = Utility.sgdbpwd; + shds = globeControl1.Globe.DataManager.OpenOracleDataSource(dbIp + "/" + database, "", "", user, pass); + if (shds == null) + { + MessageBox.Show("施工数据库连接失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); + } + FrmPipelineModelDB frm = new FrmPipelineModelDB(globeControl1, shds, true); + if (frm.ShowDialog() == DialogResult.OK) + { + addNodeToLayerManagerNode(frm.rukuLayer); + } + } + catch (Exception ex) + { + LogError.PublishError(ex); + MessageBox.Show("内存过载请清理内存,并重新启动规划分析!", "提示"); + return; + } + } + /// + ///自动导出图片 + /// + /// + /// + private void buttonItem130_Click_1(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "导出审核图"); + + Point pt1 = new Point(Convert.ToInt32(0), Convert.ToInt32(0)); + Point pt2 = new Point(Convert.ToInt32(panelEx5.Width), Convert.ToInt32(panelEx5.Height)); + + 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 = System.IO.Path.GetExtension(dlg.FileName);//扩展名 + switch (extension) + { + case ".jpg": + myImg.Save(dlg.FileName, System.Drawing.Imaging.ImageFormat.Jpeg); + break; + case ".png": + myImg.Save(dlg.FileName, System.Drawing.Imaging.ImageFormat.Png); + break; + case ".bmp": + myImg.Save(dlg.FileName, System.Drawing.Imaging.ImageFormat.Bmp); + break; + case ".gif": + myImg.Save(dlg.FileName, System.Drawing.Imaging.ImageFormat.Gif); + break; + default: + break; + } + } + } + /// + /// 一键审核功能 + /// + /// + /// + private void buttonItem128_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, this.buttonItem128.Text); + frmSh = new FrmYJSHTC(globeControl1, globeControl2, layerTree); + + if (frmSh.ShowDialog() == DialogResult.OK) + { + frmWait = new FrmWait("一键审核……"); + frmWait.Location = new Point(this.Width - frmWait.Width - 10, this.Height - frmWait.Height - 50); + frmWait.Owner = this; + frmWait.Show(); + Thread thread = new Thread(new ThreadStart(doWork)); + thread.IsBackground = true; + thread.Start(); + } + } + void doWork() + { + FrmShResult frmShResult = null; + + double dVerticalJingJuBiaoZhun = 1, dHorizontalJingJuBiaoZhun = 1; + if (frmSh.rukuLayer != null) + { + #region + this.Invoke((EventHandler) delegate + { + try + { + List managerLayerList = new List(); + for (int i = 0; i < layerManagerNode.Nodes.Count; i++) + { + managerLayerList.Add(layerManagerNode.Nodes[i].Text); + } + if (!managerLayerList.Contains(frmSh.rukuLayer.Caption)) + { + TreeNode node = new TreeNode(); + node.Tag = frmSh.rukuLayer; + node.Text = frmSh.rukuLayer.Dataset.Caption; + node.ImageIndex = 0; + node.SelectedImageIndex = 0; + node.Checked = frmSh.rukuLayer.Visible; + layerManagerNode.Nodes.Insert(0, node); + layerManagerNode.Expand(); + } + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "提示"); + } + }); + #endregion + + shlayername = frmSh.rukuLayer.Name; + globeControl1.Refresh(); + } + + if (frmShResult != null && !frmShResult.IsDisposed) + { + try + { + clearFeatureHighLight(); + ClearRedlineAnalyseResult(); + frmShResult.Close(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message); + } + } + + frmShResult = new FrmShResult(dVerticalJingJuBiaoZhun, dHorizontalJingJuBiaoZhun, shlayername, globeControl1, + m_PipelineLayerNames); + + if (boolfrmShResult == true) return; + + frmShResult.Location = new Point(this.Width - frmShResult.Width - 10, this.Height - frmShResult.Height - 50); + frmShResult.Owner = this; + //一键审核实际计算步骤 + frmShResult.analysis(); + + //MainFrm窗体显示控制,回到一键审核Tab + this.Invoke((EventHandler) delegate + { + frmShResult.Show(); + frmWait.Close(); + //将tab页恢复到一键审核 + ribbonTabItem11.Checked = true; + try + { + globeControl1.Globe.Action = EnumAction3D.ActionNull; + splitContainer1.Panel2Collapsed = true; + + panelOfTable.Visible = false; + legendSC.Visible = false; + legendSG.Visible = false; + + GSOLayer redLayer = globeControl1.Globe.Layers.GetLayerByCaption("红线"); + if (redLayer != null) + { + redLayer.Visible = false; + } + } + catch (Exception ex) + { + MessageBox.Show("系统运行错误:" + ex.ToString(), "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + + }); + + boolfrmShResult = true; + } + /// + /// 清除渲染结果 + /// + public void ClearRedlineAnalyseResult() + { + for (int i = 0; i < globeControl1.Globe.Layers.Count; i++) + { + GSOLayer layer = globeControl1.Globe.Layers[i]; + if (layer.Caption == "tempLgdData") + { + layer.RemoveAllFeature(); + } + } + + layerTemp.RemoveAllFeature(); + globeControl1.Refresh(); + } + /// + /// 已审核的图层 + /// + /// + /// + private void buttonItem132_Click_1(object sender, EventArgs e) + { + //保存日志 + LogManager.saveLog(Utility.userName, this.buttonItem132.Text); + + if (shds == null) + { + //没连的话,直接连接审核库; //审核库配置读配置文件 + string dbIp = Utility.sgdbip; + string database = Utility.sgdbname; + string user = Utility.sgdbuser; + string pass = Utility.sgdbpwd; + + shds = globeControl1.Globe.DataManager.OpenOracleDataSource(dbIp + "/" + database, "", "", user, pass); + if (shds == null) + { + MessageBox.Show("数据库连接失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); + } + } + FrmShLayers frm = new FrmShLayers(globeControl1, shds); + frm.Show(); + + } + /// + /// 审核入库 + /// + /// + /// + private void buttonItem133_Click_1(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "审核入库"); + FrmShRK frmShrk = new FrmShRK(globeControl1); + frmShrk.Show(); + } + /// + /// 模拟设计修改 + /// + /// + /// + private void buttonItem134_Click_1(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "模拟设计修改"); + + frmModify = new FrmMnModify(globeControl1, shlayername, shresultLists); + + if (boolfrmModify == false) + { + frmModify.Owner = this; + frmModify.Location = new Point(this.Width - frmModify.Width - 10, this.Height - frmModify.Height - 50); + frmModify.Show(); + boolfrmModify = true; + } + } + /// + /// 一键审核中调节透明度 + /// + /// + /// + private void sliderItem1_ValueChanged(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, this.sliderItem1.Text); + + globeControl1.Globe.GroundOpaque = 100 - sliderItem1.Value; + GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(roadLayerName); //("180fd"); + + if (layer != null) + layer.Opaque = 100 - sliderItem1.Value; + optiValue = sliderItem1.Value; + } + /// + /// 红线审核中的透明度分析 + /// + /// + /// + private void sliderItem3_ValueChanged(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, this.sliderItem3.Text); + + globeControl1.Globe.GroundOpaque = 100 - sliderItem3.Value; + GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(roadLayerName); //("180fd"); + if (layer != null) + layer.Opaque = 100 - sliderItem3.Value; + optiValue = sliderItem3.Value; + } + #region yanxiaowei + //初始化DataGridViewX1控件 + public delegate void DataGridViewDelegate(DataTable dt, string strLable, string strLayer, bool initDataGrid); + /// + /// 代理函数,操作DatgridViewX1 + /// + /// + /// + public void InitDataGridViewX1(DataTable dt, string strLable, string strLayer, bool initDataGrid) + { + if (initDataGrid == true) + { + dataGridViewX1.DataSource = dt; + panelOfTable.Visible = true; + toolStripNumbers.Text = strLable; + dataGridViewX1.Tag = strLayer; + } + else + { + dataGridViewX1.DataSource = null; + dataGridViewX1.Refresh(); + panelOfTable.Visible = false; + toolStripNumbers.Text = ""; + dataGridViewX1.Tag = ""; + globeControl1.Globe.MemoryLayer.RemoveAllFeature(); //清除双击产生的标注 + } + } + FrmAnalysisGuiHuaResult from; + /// + /// 主窗体下方属性表格 双击定位 功能 + /// + /// + /// + 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 if (dataGridViewX1.Columns.Contains("标识器编号")) + { + featureName = dataGridViewX1.Rows[hittestinfo.RowIndex].Cells["标识器编号"].Value.ToString(); + } + featureName = featureName.Trim(); + + GSOLayer layer = null; + layer = globeControl1.Globe.Layers.GetLayerByCaption(dataGridViewX1.Tag.ToString()); + + if (layer == null) return; + + GSOFeatures features = layer.GetFeatureByName(featureName, false); + if (features.Length == 0) return; + GSOFeature rowFeature = features[0]; + + ClassSearchAnalysis.AddMakerToLineFeature(globeControl1, rowFeature); + + } + } + } + else + { + if (e.Button == MouseButtons.Left) + { + if (from != null && !from.IsDisposed) + { + try + { + from.Close(); + } + catch (Exception ex) + { + LogError.PublishError(ex); + } + } + try + { + DataGridView.HitTestInfo hittestinfo = dataGridViewX1.HitTest(e.X, e.Y); + if (hittestinfo.RowIndex >= 0) + { + string layer = dataGridViewX1.Rows[hittestinfo.RowIndex].Cells["管线类型"].Value.ToString(); + string hxName = dataGridViewX1.Rows[hittestinfo.RowIndex].Cells["红线编号"].Value.ToString(); + FrmAnalysisGuiHuaResult frm = new FrmAnalysisGuiHuaResult(globeControl1, lineStruct, featsList, + panelOfTable, dataGridViewX1, layer, hxName); + frm.Location = new Point(this.Width - frm.Width - 10, this.Height - frm.Height - 20); + frm.Show(this); + + from = frm; + } + } + catch (Exception ex) + { + LogError.PublishError(ex); + } + } + } + } + /// + /// 空间查询 + /// + /// + /// + private void buttonItemSearch1_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, this.buttonItemSearch1.Text); + + trackflag = "PipelineSpatialQuery"; + globeControl1.Globe.Action = EnumAction3D.TrackPolygon; + globeControl1.Globe.TrackPolygonTool.TrackMode = EnumTrackMode.SpaceTrack; + } + /// + /// 关键字查询 + /// + /// + /// + private void buttonItemSearch9_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, this.buttonItemSearch9.Text); + + FrmKeywordQuery.ShowForm(globeControl1, m_PipelineLayerNames, new DataGridViewDelegate(InitDataGridViewX1)); + } + /// + /// 编号查询 + /// + /// + /// + private void buttonItemSearch2_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, this.buttonItemSearch2.Text); + + FrmCodingQuery.ShowForm(globeControl1, m_PipelineLayerNames, new DataGridViewDelegate(InitDataGridViewX1)); + } + /// + /// 坐标查询 + /// + /// + /// + private void buttonItemSearch3_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, this.buttonItemSearch3.Text); + + FrmSetLatLonPos.ShowForm(globeControl1); + } + /// + /// 附属物查询 + /// + /// + /// + private void buttonItemSearch10_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, this.buttonItemSearch10.Text); + + FrmFittingQuery.ShowForm(globeControl1, instrumenLayerNames, new DataGridViewDelegate(InitDataGridViewX1)); + } + /// + /// 管径查询 + /// + /// + /// + private void buttonItemSearch4_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, this.buttonItemSearch4.Text); + + FrmDiameterQuery.ShowForm(globeControl1, m_PipelineLayerNames, new DataGridViewDelegate(InitDataGridViewX1)); + } + /// + /// 材质查询 + /// + /// + /// + private void buttonItemSearch5_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, this.buttonItemSearch5.Text); + + FrmMaterialSel.ShowForm(globeControl1, m_PipelineLayerNames, new DataGridViewDelegate(InitDataGridViewX1)); + } + /// + /// 基本查询 + /// + /// + /// + private void buttonItemSearch6_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, this.buttonItemSearch6.Text); + + FrmBasicQuery.ShowForm(globeControl1, new DataGridViewDelegate(InitDataGridViewX1)); + } + /// + /// 复合查询 + /// + /// + /// + private void buttonItemSearch7_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, this.buttonItemSearch7.Text); + + FrmQuerySQL.ShowForm(globeControl1, new DataGridViewDelegate(InitDataGridViewX1)); + } + /// + /// 关联查询 + /// + /// + /// + private void buttonItemSearch8_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, this.buttonItemSearch8.Text); + + if (globeControl1.Globe.SelObjectCount != 1) + { + MessageBox.Show("请选中一个对象!", "提示"); + return; + } + double valueAllowance = 1.0; + + for (int j = 0; j < globeControl1.Globe.SelObjectCount; j++) + { + GSOFeature feature = null; + GSOLayer layer = null; + globeControl1.Globe.GetSelectObject(j, out feature, out layer); + + if (feature == null && feature.Geometry == null || (feature.Geometry.Type == EnumGeometryType.GeoPolygon3D + || feature.Geometry.Type == EnumGeometryType.GeoWater)) + return; + else + { + ClassSearchAnalysis.ResultRelationAnalysis(globeControl1, feature, valueLayerNames, workwellLayerNames, + instrumenLayerNames, pipefittingLayerNames, m_PipelineLayerNames, valueAllowance); + } + } + } + #endregion + /// + /// 清除分析(完善) + /// + /// + /// + private void buttonItemClear_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, this.buttonItemClear.Text); + + globeControl1.Globe.ClearMeasure(); + layerTemp.RemoveAllFeature(); + layerTemp2.RemoveAllFeature(); + buttonItemLS5.Checked = false; + + dataGridViewX1.DataSource = null; + panelOfTable.Visible = false; + + globeControl1.Globe.MemoryLayer.RemoveAllFeature(); + globeControl1.Globe.ClearAnalysis(); + + + // 清除净距分析结果 + buttonX2_Click(null, null); + buttonX8_Click(null, null); + buttonX15_Click(null, null); + buttonX16_Click(null, null); + buttonClearAnalysisResult_Click(null, null); + + NetworkAnalysisTool.ClearAllTopAnalysis(this.globeControl1); + // ClearConnexityAnalysis();//清除连通性分析 + // 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); + } + } + + GSOFeatures feats = globeControl1.Globe.MemoryLayer.GetFeatureByName("粒子要素", true); + if (feats.Length > 0) + globeControl1.Globe.MemoryLayer.RemoveFeatureByID(feats[0].ID); + + globeControl1.Globe.UnderGroundFloor.Visible = false;//隐藏地下网格线 + + // ClearUpDownTraceAnalysis(); //清除上下游分析 + globeControl1.Globe.RemoveAllPits();//清除所有坑 + + string[] markerStrs = new string[9]; + markerStrs[0] = "标高标注"; + markerStrs[1] = "管径标注"; + markerStrs[2] = "埋深标注"; + markerStrs[3] = "坐标标注"; + markerStrs[4] = "坡度标注"; + markerStrs[5] = "属性标注"; + markerStrs[6] = "自定义标注"; + markerStrs[7] = "距离标注"; + markerStrs[8] = "扯旗标注"; + for (int i = 0; i < markerStrs.Length; i++) + { + GSOLayer markerLayer = globeControl1.Globe.Layers.GetLayerByCaption(markerStrs[i]); + markerLayer.RemoveAllFeature(); + } + if (layerMarkerTree != null && layerMarkerTree.Nodes.Count > 0) + { + for (int i = 0; i < layerMarkerTree.Nodes[0].Nodes.Count; i++) + { + layerMarkerTree.Nodes[0].Nodes[i].Nodes.Clear(); + } + } + + clearFeatureHighLight();//取消管线高亮 + + GSOLayer layerGround = globeControl1.Globe.Layers.GetLayerByCaption(roadLayerName);//("180fd"); + if (layerGround != null) + { + layerGround.Visible = true; + } + globeControl1.Refresh(); + globeControl2.Refresh(); + ClearRedlineAnalyseResult(); + globeControl1.Globe.Action = EnumAction3D.ActionNull; + } + /// + /// 管线长度全区域统计 + /// + /// + /// + private void buttonItemTJ1_ALL_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "管线长度统计"); + FrmAllPipelineStatis frm = new FrmAllPipelineStatis(globeControl1, null, new DataGridViewDelegate(InitDataGridViewX1), m_PipelineLayerNames); + frm.Show(this); + } + /// + /// 管线长度绘制区域统计 + /// + /// + /// + private void buttonItemTJ1_DRAW_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "管线长度统计"); + + trackflag = "PipelineDistanceStatistics"; + globeControl1.Globe.Action = EnumAction3D.TrackPolygon; + globeControl1.Globe.TrackPolygonTool.TrackMode = EnumTrackMode.SpaceTrack; + } + /// + /// 阀门数量全区域统计 + /// + /// + /// + private void buttonItemTJ2_ALL_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "阀门数量统计"); + FrmValveStatistics frm = new FrmValveStatistics(globeControl1, null, new DataGridViewDelegate(InitDataGridViewX1)); + frm.Show(this); + + globeControl1.Globe.Action = EnumAction3D.ActionNull; + } + /// + /// 阀门数量绘制区域统计 + /// + /// + /// + private void buttonItemTJ2_DRAW_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "阀门数量统计"); + + trackflag = "valvequery"; + globeControl1.Globe.Action = EnumAction3D.TrackPolygon; + globeControl1.Globe.TrackPolygonTool.TrackMode = EnumTrackMode.SpaceTrack; + } + /// + /// 井盖数量全区域统计 + /// + /// + /// + private void buttonItemTJ3_ALL_Click(object sender, EventArgs e) + { + FrmAllWorkWellStatis frm = new FrmAllWorkWellStatis(globeControl1, null, new DataGridViewDelegate(InitDataGridViewX1)); + frm.Show(this); + } + /// + /// 井盖数量绘制区域统计 + /// + /// + /// + private void buttonItemTJ3_DRAW_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "井盖数量统计"); + + trackflag = "workwellquery"; + globeControl1.Globe.Action = EnumAction3D.TrackPolygon; + globeControl1.Globe.TrackPolygonTool.TrackMode = EnumTrackMode.SpaceTrack; + } + /// + /// 管径分段统计全区域统计 + /// + /// + /// + private void buttonItemTJ4_ALL_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "管径分段统计"); + + Frmpipediameterstatis.ShowForm(globeControl1, m_PipelineLayerNames, 0); + } + /// + /// 管径分段统计绘制区域统计 + /// + /// + /// + private void buttonItemTJ4_DRAW_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "管径分段统计"); + + trackflag = null; + Frmpipediameterstatis.ShowForm(globeControl1, m_PipelineLayerNames, 1); + } + /// + /// 埋深分段统计全区域统计 + /// + /// + /// + private void buttonItemTJ5_ALL_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "埋深分段统计"); + FrmpipeDeepstatis.ShowForm(globeControl1, m_PipelineLayerNames, 0); + } + /// + /// 埋深分段统计绘制区域统计 + /// + /// + /// + private void buttonItemTJ5_DRAW_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "埋深分段统计"); + trackflag = null; + FrmpipeDeepstatis.ShowForm(globeControl1, m_PipelineLayerNames, 1); + } + /// + /// 管径分类统计全区域统计 + /// + /// + /// + private void buttonItemTJ6_ALL_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "管径分类汇总"); + + FrmpipeDiametergather.ShowForm(globeControl1, m_PipelineLayerNames, 0); + } + /// + /// 管径分类统计绘制区域统计 + /// + /// + /// + private void buttonItemTJ6_DRAW_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "管径分类汇总"); + + trackflag = null; + FrmpipeDiametergather.ShowForm(globeControl1, m_PipelineLayerNames, 1); + } + /// + /// 材质分类统计全区域统计 + /// + /// + /// + private void buttonItemTJ7_ALL_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "材质分类汇总"); + + FrmpipeMaterialGather.ShowForm(globeControl1, m_PipelineLayerNames, 0); + } + /// + /// 材质分类统计绘制区域统计 + /// + /// + /// + private void buttonItemTJ7_DRAW_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "材质分类汇总"); + + trackflag = null; + FrmpipeMaterialGather.ShowForm(globeControl1, m_PipelineLayerNames, 1); + } + /// + /// 附属物分类统计全区域统计 + /// + /// + /// + private void buttonItemTJ8_ALL_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "附属物分类汇总"); + + FrmAccessoriesgather.ShowForm(globeControl1, instrumenLayerNames, 0); + } + /// + /// 附属物分类统计绘制区域统计 + /// + /// + /// + private void buttonItemTJ8_DRAW_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "附属物分类汇总"); + + trackflag = null; + FrmAccessoriesgather.ShowForm(globeControl1, instrumenLayerNames, 1); + } #region Predaotr,断面分析 /// /// 横断面分析 @@ -7365,7 +7062,6 @@ globeControl1.Globe.TrackPolylineTool.VerticalLineVisible = true; globeControl1.Globe.TrackPolylineTool.TrackMode = EnumTrackMode.SpaceTrack; trackPolylineEndMode = EnumTrackPolylineEndMode.HDM_Analysis; - } /// /// 纵断面分析 @@ -7409,7 +7105,6 @@ globeControl1.Globe.TrackPolylineTool.VerticalLineVisible = true; globeControl1.Globe.TrackPolylineTool.TrackMode = EnumTrackMode.SpaceTrack; trackPolylineEndMode = EnumTrackPolylineEndMode.DLDM_Analysis; - } /// /// 基线剖面分析 @@ -7422,9 +7117,7 @@ globeControl1.Globe.TrackPolylineTool.VerticalLineVisible = true; globeControl1.Globe.TrackPolylineTool.TrackMode = EnumTrackMode.SpaceTrack; trackPolylineEndMode = EnumTrackPolylineEndMode.JXPM_Analysis; - } - #endregion /// /// 创建拓扑 @@ -7462,7 +7155,6 @@ LogManager.saveLog(Utility.userName, this.buttonItemFX3_3.Text); NetworkTraceUpDown(false); } - /// /// 上下游追踪 功能 /// @@ -7480,7 +7172,6 @@ NetworkAnalysisTool.TraceUpDownAnalysis(bTraceUp, selLineFeature, selLayer); } - /// /// 流向分析 /// @@ -7533,7 +7224,6 @@ MessageBox.Show("未找到关闭阀门"); } } - /// /// 连通分析 /// @@ -7580,9 +7270,7 @@ NetworkAnalysisTool.ExplodeAnalysis(this.globeControl1, selLineFeature, selLayer); this.buttonItemFX3_5_Click(sender, e); //关阀分析: - } - #endregion /// /// 多边形开挖 @@ -7591,7 +7279,6 @@ /// private void buttonItemFX4_1_Click(object sender, EventArgs e) { - //日志记录 LogManager.saveLog(Utility.userName, this.buttonItemFX4_1.Text); trackflag = "pit"; @@ -7605,7 +7292,6 @@ /// private void buttonItemFX4_2_Click(object sender, EventArgs e) { - //日志记录 LogManager.saveLog(Utility.userName, this.buttonItemFX4_2.Text); trackflag = "digFillAnalysis"; @@ -7620,7 +7306,6 @@ /// private void buttonItemFX4_3_Click(object sender, EventArgs e) { - //日志记录 LogManager.saveLog(Utility.userName, this.buttonItemFX4_3.Text); if (!buttonItemFX4_3.Checked) @@ -7653,12 +7338,13 @@ /// private void buttonItemFX4_4_Click(object sender, EventArgs e) { - //日志记录 LogManager.saveLog(Utility.userName, this.buttonItemFX4_4.Text); globeControl1.Globe.Action = EnumAction3D.DrawPolyline; GSOLayer tunnel = globeControl1.Globe.Layers.GetLayerByCaption("隧道"); - if (tunnel != null) + if (tunnel == null) + MessageBox.Show("场景中未加载隧道图层!", "提示"); + else { globeControl1.Globe.DestLayerFeatureAdd = tunnel; tunnel.Editable = true; @@ -7666,10 +7352,6 @@ m_AddPipeLine = false; m_isDrawCitySevenLine = false; } - else - { - MessageBox.Show("场景中未加载隧道图层!", "提示"); - } } /// /// 隐藏隧道 @@ -7678,7 +7360,6 @@ /// private void buttonItemFX4_5_Click(object sender, EventArgs e) { - //日志记录 LogManager.saveLog(Utility.userName, this.buttonItemFX4_5.Text); GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption("隧道"); @@ -7694,7 +7375,6 @@ /// private void buttonItemFX4_6_Click(object sender, EventArgs e) { - //日志记录 LogManager.saveLog(Utility.userName, this.buttonItemFX4_6.Text); if (globeControl1.Globe.SelObjectCount > 0) @@ -7736,16 +7416,7 @@ //日志记录 LogManager.saveLog(Utility.userName, this.buttonItemFX5_1.Text); - if (globeControl1.Globe.Action != EnumAction3D.VisibilityAnalysis) - { - //btnSpaceVisibilityAnalysis.Checked = true; - globeControl1.Globe.Action = EnumAction3D.VisibilityAnalysis; - } - else - { - globeControl1.Globe.Action = EnumAction3D.ActionNull; - // SetButtonChecked(); - } + globeControl1.Globe.Action = globeControl1.Globe.Action != EnumAction3D.VisibilityAnalysis ? EnumAction3D.VisibilityAnalysis : EnumAction3D.ActionNull; } /// /// 可视域分析 @@ -7754,7 +7425,6 @@ /// private void buttonItemFX5_2_Click(object sender, EventArgs e) { - //日志记录 LogManager.saveLog(Utility.userName, this.buttonItemFX5_2.Text); globeControl1.Globe.Action = EnumAction3D.ViewshedAnalysis; @@ -7766,7 +7436,6 @@ /// private void buttonItemFX5_3_Click(object sender, EventArgs e) { - //日志记录 LogManager.saveLog(Utility.userName, this.buttonItemFX5_3.Text); globeControl1.Globe.Action = EnumAction3D.ViewEnvelopeAnalysis; @@ -7778,7 +7447,6 @@ /// private void buttonItemFX6_1_Click(object sender, EventArgs e) { - //日志记录 LogManager.saveLog(Utility.userName, this.buttonItemFX6_1.Text); GSOFeature feat = globeControl1.Globe.SelectedObject; @@ -7813,7 +7481,6 @@ /// private void buttonItemFX6_2_Click(object sender, EventArgs e) { - //日志记录 LogManager.saveLog(Utility.userName, this.buttonItemFX6_2.Text); globeControl1.Globe.Action = EnumAction3D.ActionNull; @@ -7827,7 +7494,6 @@ /// private void buttonItemFX6_3_Click(object sender, EventArgs e) { - //日志记录 LogManager.saveLog(Utility.userName, this.buttonItemFX6_3.Text); globeControl1.Globe.Action = EnumAction3D.TrackPolygon; @@ -7901,10 +7567,8 @@ globeControl1.Globe.Action = EnumAction3D.ActionNull; buttonItemLS5.Checked = !buttonItemLS5.Checked; - if (buttonItemLS5.Checked) - { - globeControl1.Globe.Action = EnumAction3D.SelectObject; - } + if (!buttonItemLS5.Checked) return; + globeControl1.Globe.Action = EnumAction3D.SelectObject; } /// /// 水平面积 @@ -8197,7 +7861,6 @@ LogManager.saveLog(Utility.userName, this.buttonItemFXGJ1.Text); FrmSetFlytoPos.ShowForm(globeControl1); - } /// /// 自定义飞行 @@ -8262,7 +7925,6 @@ globeControl1.Globe.FlyAroundEye(720, EnumFlyRepeatValueType.Degrees); globeControl1.Globe.CurFlyID = 2; } - /// /// 权限管理 /// @@ -8343,21 +8005,6 @@ appUSERRESET.ShowDialog(); } /// - /// 统计数据 - /// - /// - /// - private void buttonItemZTT1_Click(object sender, EventArgs e) - { - ////日志记录 - //LogManager.saveLog(Utility.userName, this.buttonItemZTT1.Text); - - //PATM patm = new PATM(); - //patm.operation = "Statistic"; - //patm.Text = "统计专题图管理"; - //patm.ShowDialog(); - } - /// /// 热点功能统计 /// /// @@ -8460,137 +8107,6 @@ FrmLayerControl frm = new FrmLayerControl(layerTree, globeControl1, globeControl2); frm.Show(this); } - - /// - /// 碰撞审查 - /// - /// - /// - private void buttonItemSH1_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, this.buttonItemSH1.Text); - - this.dataGridViewX4.Size = new System.Drawing.Size(185, 92); - this.dataGridViewX5.Size = new System.Drawing.Size(185, 120); - - layerTemp.RemoveAllFeature(); - clearFeatureHighLight(); - globeControl1.Refresh(); - - sideBar1.Visible = true; - sideBarPanelItem3.Visible = true; - buttonItem1.Checked = true; - controlContainerItem3.Visible = true; - sideBarPanelItem4.Visible = true; - sideBarPanelItem4.Text = "碰撞审查"; - trackflag = "collision"; - controlContainerItem5.Control = panel2; - panel2.Dock = DockStyle.Fill; - panel2.Visible = true; - sideBar1.ExpandedPanel = sideBarPanelItem4; - sideBar1.Refresh(); - - Refresh(); - } - /// - /// 覆土审查 - /// - /// - /// - private void buttonItemSH2_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, this.buttonItemSH2.Text); - - this.dataGridViewX6.Size = new System.Drawing.Size(185, 92); - this.dataGridViewX7.Size = new System.Drawing.Size(185, 120); - - layerTemp.RemoveAllFeature(); - clearFeatureHighLight(); - globeControl1.Refresh(); - sideBar1.Visible = true; - sideBarPanelItem3.Visible = true; - buttonItem1.Checked = true; - controlContainerItem3.Visible = true; - sideBarPanelItem4.Visible = true; - sideBarPanelItem4.Text = "覆土审查"; - trackflag = "ftAnalysis"; - controlContainerItem5.Control = panel4; - panel4.Visible = true; - panel4.Dock = DockStyle.Fill; - sideBar1.ExpandedPanel = sideBarPanelItem4; - sideBar1.Refresh(); - Refresh(); - } - /// - /// 水平净距审查 - /// - /// - /// - private void buttonItemSH3_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, this.buttonItemSH3.Text); - - this.dataGridViewX8.Size = new System.Drawing.Size(190, 92); - this.dataGridViewX9.Size = new System.Drawing.Size(190, 120); - - layerTemp.RemoveAllFeature(); - clearFeatureHighLight(); - globeControl1.Refresh(); - sideBar1.Visible = true; - sideBarPanelItem3.Visible = true; - buttonItem1.Checked = true; - controlContainerItem3.Visible = true; - sideBarPanelItem4.Visible = true; - sideBarPanelItem4.Text = "水平净距审查"; - trackflag = "horizontal"; - controlContainerItem5.Control = panel5; - panel5.Dock = DockStyle.Fill; - panel5.Visible = true; - sideBar1.ExpandedPanel = sideBarPanelItem4; - sideBar1.Refresh(); - Refresh(); - } - /// - /// 垂直净距审查 - /// - /// - /// - private void buttonItemSH4_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, this.buttonItemSH4.Text); - - this.dataGridViewX2.Visible = true; - this.dataGridViewX3.Visible = true; - this.dataGridViewX2.Size = new System.Drawing.Size(185, 92); - this.dataGridViewX3.Size = new System.Drawing.Size(185, 120); - - layerTemp.RemoveAllFeature(); - clearFeatureHighLight(); - - globeControl1.Refresh(); - sideBar1.Visible = true; - sideBarPanelItem3.Visible = true; - buttonItem1.Checked = true; - controlContainerItem3.Visible = true; - sideBarPanelItem4.Visible = true; - sideBarPanelItem4.Text = "垂直净距审查"; - trackflag = "vertical"; - //globeControl1.Globe.Action = EnumAction3D.SelectObject; - panel2.Visible = false; - panel3.Visible = false; - panel5.Visible = false; - panel4.Visible = false; - controlContainerItem5.Control = panel1; - panel1.Dock = DockStyle.Fill; - panel1.Visible = true; - sideBar1.ExpandedPanel = sideBarPanelItem4; - sideBar1.Refresh(); - Refresh(); - } /// /// 综合规划区域审查 /// @@ -8666,9 +8182,7 @@ } if (ds == null) return; - Cyberpipe.Forms.FrmPipelineModelDB frm = new Cyberpipe.Forms.FrmPipelineModelDB(globeControl1, ds); - - //frm.Show(); + FrmPipelineModelDB frm = new FrmPipelineModelDB(globeControl1, ds, false); if (frm.ShowDialog() == DialogResult.OK) { @@ -8700,7 +8214,6 @@ addNodeToLayerManagerNode(frm.rukuLayer); } } - /// /// 坐标转换 /// @@ -8711,7 +8224,7 @@ //保存日志 LogManager.saveLog(Utility.userName, this.buttonItemSJGL5.Text); - Cyberpipe.Forms.FrmProject frm = new Cyberpipe.Forms.FrmProject(); + FrmProject frm = new FrmProject(); frm.ShowDialog(); } /// @@ -8738,7 +8251,6 @@ LogManager.saveLog(Utility.userName, this.buttonItemSJGL6_2.Text); FrmMetadataStat frmmds = new FrmMetadataStat(); - //frmmds.Show(); frmmds.ShowDialog(); } /// @@ -8814,12 +8326,11 @@ if (frm.ShowDialog() == DialogResult.OK) { GSOLayer featureAddLayer = TreeNodeFeatureLayer(); - if (featureAddLayer == null) + if (featureAddLayer != null) { - return; + FrmAddInstrument dlg = new FrmAddInstrument(globeControl1, featureAddLayer); + dlg.Show(this); } - FrmAddInstrument dlg = new FrmAddInstrument(globeControl1, featureAddLayer); - dlg.Show(this); } } /// @@ -8836,16 +8347,15 @@ if (frm.ShowDialog() == DialogResult.OK) { GSOLayer featureAddLayer = TreeNodeFeatureLayer(); - if (featureAddLayer == null) + if (featureAddLayer != null) { - return; + FrmAddPipeFitting dlg = new FrmAddPipeFitting(globeControl1, featureAddLayer); + dlg.Show(this); } - FrmAddPipeFitting dlg = new FrmAddPipeFitting(globeControl1, featureAddLayer); - dlg.Show(this); } } /// - /// 绘制城市七线 + /// 绘制城市七线(完善) /// /// /// @@ -9082,15 +8592,6 @@ List listVectorNames = new List(); for (int i = 0; i < 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] == "供电") - { - continue; - } - * */ if (listVectorNames.Contains(m_PipelineLayerNames[i]) == false) { listVectorNames.Add(m_PipelineLayerNames[i]); @@ -9142,15 +8643,11 @@ GSOFeature f = null; GSOLayer layer = null; globeControl1.Globe.GetSelectObject(i, out f, out layer); - if (f != null) - { - f.Delete(); - if (layer != null) - { - globeControl1.Globe.AddToEditHistroy(layer, f, EnumEditType.Delete); - } - globeControl1.Refresh(); - } + if (f == null) continue; + f.Delete(); + if (layer != null) + globeControl1.Globe.AddToEditHistroy(layer, f, EnumEditType.Delete); + globeControl1.Refresh(); } MessageBox.Show("删除成功!", "提示"); } @@ -9190,10 +8687,8 @@ for (int i = 0; i < m_PipelineLayerNames.Count; i++) { layer = globeControl1.Globe.Layers.GetLayerByCaption(m_PipelineLayerNames[i]); - if (layer != null) - { - listPipelineLayers.Add(layer); - } + if (layer == null) continue; + listPipelineLayers.Add(layer); } //yanxiaowei 重构 GSOFeatures selectFeatures = new GSOFeatures(); @@ -9208,15 +8703,15 @@ ClassGSOTool.CalculateRedLineResult(out table, redSH, selectFeatures, globeControl1, listPipelineLayers, out lineStruct, out featsList); - if (table.Rows.Count != 0) - AddDatagridView(table); - else + if (table.Rows.Count == 0) { MessageBox.Show("没有侵入地块红线的管线数据!", "提示"); dataGridViewX1.DataSource = null; panelOfTable.Visible = false; return; } + else + AddDatagridView(table); } private void AddDatagridView(DataTable table) @@ -9234,23 +8729,25 @@ /// private void toolStripDropDownButton3_Click(object sender, EventArgs e) { - if (dataGridViewX1.Rows.Count == 0) + if (dataGridViewX1.Rows.Count != 0) + { + string strSaveFile = string.Empty; + SaveFileDialog savefiledialog = new SaveFileDialog(); + savefiledialog.Filter = "Excel文件|*.xls,*.xlsx"; + savefiledialog.AddExtension = true; + savefiledialog.FileName = "红线审核"; + if (savefiledialog.ShowDialog() == DialogResult.OK) + strSaveFile = savefiledialog.FileName; + else return; + + ExpEXCEL.ExpToExcel(dataGridViewX1, strSaveFile, "红线审核", lineStruct, featsList); + MessageBox.Show("导出成功!"); + } + else { MessageBox.Show("表格内容为空!", "提示"); return; } - - string strSaveFile = string.Empty; - SaveFileDialog savefiledialog = new SaveFileDialog(); - savefiledialog.Filter = "Excel文件|*.xls,*.xlsx"; - savefiledialog.AddExtension = true; - savefiledialog.FileName = "红线审核"; - if (savefiledialog.ShowDialog() == DialogResult.OK) - strSaveFile = savefiledialog.FileName; - else return; - - ExpEXCEL.ExpToExcel(dataGridViewX1, strSaveFile, "红线审核", lineStruct, featsList); - MessageBox.Show("导出成功!"); } private void sliderItem2_ValueChanged(object sender, EventArgs e) @@ -9287,31 +8784,39 @@ dlg.Multiselect = true; if (dlg.ShowDialog() == DialogResult.OK) { - //自定义lprj文件名,从程序中复制一lprj文件。 - string filePath = dlg.FileName; - string lastname = Path.GetFileName(filePath); - - for (int i = 0; i < dlg.FileNames.Length; i++) + try { - AddLayerData(dlg.FileNames[i]); + for (int i = 0; i < dlg.FileNames.Length; i++) + { + AddLayerData(dlg.FileNames[i]); + } + layerManagerNode.Expand(); + + //放大到新导入的图层 + GSOLayer lyr = globeControl1.Globe.Layers.GetLayerByCaption(newlayername); + if (newlayername != "") + { + GSOFeatures features = lyr.GetAllFeatures(); + GSORect2d rd = lyr.LatLonBounds; + GSOPoint2d rdcenter = rd.Center; + + globeControl1.Globe.JumpToPosition(new GSOPoint3d(rdcenter.X, rdcenter.Y, 0), + EnumAltitudeMode.Absolute, 100); + + globeControl1.Refresh(); + } } - layerManagerNode.Expand(); - - //放大到新导入的图层 - GSOLayer lyr = globeControl1.Globe.Layers.GetLayerByCaption(newlayername); - if (newlayername != "") + catch (Exception ex) { - GSOFeatures features = lyr.GetAllFeatures(); - GSORect2d rd = lyr.LatLonBounds; - GSOPoint2d rdcenter = rd.Center; - - globeControl1.Globe.JumpToPosition(new GSOPoint3d(rdcenter.X, rdcenter.Y, 0), EnumAltitudeMode.Absolute, 100); - - globeControl1.Refresh(); + LogHelper.WriteLog(typeof(MainFrm), ex); } } } - + /// + /// 导入红线(完善) + /// + /// + /// private void buttonItemHX1_Click(object sender, EventArgs e) { LogManager.saveLog(Utility.userName, this.buttonItemHX1.Text); @@ -9339,7 +8844,6 @@ GSOFeatures RedFeatures = layer.GetAllFeatures(); redlinelayername = layer.Caption; - //objRes = layer; if (layer != null) { layerRedRegion = layer; @@ -9362,9 +8866,7 @@ { GSOFeature f = layer.GetAt(j); if (f != null) - { f.Geometry.AltitudeMode = EnumAltitudeMode.RelativeToGround; - } } } layerManagerNode.Expand(); @@ -9426,7 +8928,7 @@ fly.Show(this); } /// - /// 2015-10-17演示代码 红线审核 + /// 红线审核 /// /// /// @@ -9438,7 +8940,6 @@ globeControl1.BeforeSceneRenderEvent -= new BeforeSceneRenderEventHandler(globeControl1_BeforeSceneRenderEvent); globeControl2.BeforeSceneRenderEvent -= new BeforeSceneRenderEventHandler(globeControl2_BeforeSceneRenderEvent); - globeControl1.Globe.FlyToPosition(new GSOPoint3d(120.610963, 31.188121, 50), EnumAltitudeMode.Absolute, -4, 50, 800); globeControl1.Globe.FlyToPointSpeed = 10000000; globeControl1.Globe.Action = EnumAction3D.SelectObject; @@ -9453,11 +8954,8 @@ legendSC.Visible = false; ClearGZData(); GSOLayer redLayer = globeControl1.Globe.Layers.GetLayerByCaption("红线"); - if (redLayer != null) - { - redLayer.Visible = true; - } - + if (redLayer == null) return; + redLayer.Visible = true; } catch (Exception ex) { @@ -9477,7 +8975,6 @@ globeControl1.BeforeSceneRenderEvent -= new BeforeSceneRenderEventHandler(globeControl1_BeforeSceneRenderEvent); globeControl2.BeforeSceneRenderEvent -= new BeforeSceneRenderEventHandler(globeControl2_BeforeSceneRenderEvent); - globeControl1.Globe.Action = EnumAction3D.ActionNull; dataGridViewX1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells; //zhanshi = false; @@ -9488,12 +8985,8 @@ legendSG.Visible = false; ClearGZData(); GSOLayer redLayer = globeControl1.Globe.Layers.GetLayerByCaption("红线"); - if (redLayer != null) - { - redLayer.Visible = false; - } - - + if (redLayer == null) return; + redLayer.Visible = false; } catch (Exception ex) { @@ -9513,7 +9006,6 @@ globeControl1.BeforeSceneRenderEvent -= new BeforeSceneRenderEventHandler(globeControl1_BeforeSceneRenderEvent); globeControl2.BeforeSceneRenderEvent -= new BeforeSceneRenderEventHandler(globeControl2_BeforeSceneRenderEvent); - globeControl1.Globe.Action = EnumAction3D.ActionNull; //zhanshi = false; redSH = false; @@ -9524,45 +9016,15 @@ legendSG.Visible = false; ClearGZData(); GSOLayer redLayer = globeControl1.Globe.Layers.GetLayerByCaption("红线"); - if (redLayer != null) - { - redLayer.Visible = false; - } - - + if (redLayer == null) return; + redLayer.Visible = false; } catch (Exception ex) { //MessageBox.Show("系统运行错误:" + ex.ToString(), "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); } } - /// - /// 右屏添加冰箱数据 - /// - void AddDataToGlobeControl2() - { - - bool modelDataBool = false; - for (int i = globeControl2.Globe.Layers.Count - 1; i >= 0; i--) - { - GSOLayer layer = globeControl2.Globe.Layers[i]; - if (layer.Name.Contains("fttp:")) - { - modelDataBool = true; - break; - } - } - - if (modelDataBool == false) - { - GSOLayer ly = globeControl1.Globe.Layers.GetLayerByCaption("天地图地图"); - globeControl2.Globe.Layers.Add(ly); - } - else - { - return; - } - } + /// /// 双屏对比 /// @@ -9572,7 +9034,6 @@ { try { - globeControl1.BeforeSceneRenderEvent += new BeforeSceneRenderEventHandler(globeControl1_BeforeSceneRenderEvent); globeControl2.BeforeSceneRenderEvent += new BeforeSceneRenderEventHandler(globeControl2_BeforeSceneRenderEvent); @@ -9590,10 +9051,7 @@ GSOLayer redLayer = globeControl1.Globe.Layers.GetLayerByCaption("红线"); if (redLayer != null) - { redLayer.Visible = false; - } - AddDataToGlobeControl2(); } catch (Exception ex) { @@ -9613,7 +9071,6 @@ globeControl1.BeforeSceneRenderEvent -= new BeforeSceneRenderEventHandler(globeControl1_BeforeSceneRenderEvent); globeControl2.BeforeSceneRenderEvent -= new BeforeSceneRenderEventHandler(globeControl2_BeforeSceneRenderEvent); - globeControl1.Globe.Action = EnumAction3D.ActionNull; panelOfTable.Visible = false; //zhanshi = false; @@ -9625,9 +9082,7 @@ ClearGZData(); GSOLayer redLayer = globeControl1.Globe.Layers.GetLayerByCaption("红线"); if (redLayer != null) - { redLayer.Visible = false; - } } catch (Exception ex) { @@ -9643,11 +9098,9 @@ { try { - globeControl1.BeforeSceneRenderEvent -= new BeforeSceneRenderEventHandler(globeControl1_BeforeSceneRenderEvent); globeControl2.BeforeSceneRenderEvent -= new BeforeSceneRenderEventHandler(globeControl2_BeforeSceneRenderEvent); - globeControl1.Globe.Action = EnumAction3D.ActionNull; panelOfTable.Visible = false; //zhanshi = false; @@ -9660,10 +9113,7 @@ GSOLayer redLayer = globeControl1.Globe.Layers.GetLayerByCaption("红线"); if (redLayer != null) - { redLayer.Visible = false; - } - } catch (Exception ex) { @@ -9679,11 +9129,9 @@ { try { - globeControl1.BeforeSceneRenderEvent -= new BeforeSceneRenderEventHandler(globeControl1_BeforeSceneRenderEvent); globeControl2.BeforeSceneRenderEvent -= new BeforeSceneRenderEventHandler(globeControl2_BeforeSceneRenderEvent); - globeControl1.Globe.Action = EnumAction3D.ActionNull; panelOfTable.Visible = false; //zhanshi = false; @@ -9695,11 +9143,8 @@ ClearGZData(); GSOLayer redLayer = globeControl1.Globe.Layers.GetLayerByCaption("红线"); - if (redLayer != null) - { - redLayer.Visible = false; - } - + if (redLayer == null) return; + redLayer.Visible = false; } catch (Exception ex) { @@ -9717,12 +9162,8 @@ { LogManager.saveLog(Utility.userName, this.buttonItem8.Text); - //FrmCompareFeature frmCompareFeature = new FrmCompareFeature(globeControl1, globeControl2, layerTemp, layerTemp2,m_PipelineLayerNames,sgPipeLayersNames); int width = this.Width; FrmCompareFeature.ShowForm(globeControl1, globeControl2, layerTemp, layerTemp2, m_PipelineLayerNames, sgPipeLayersNames, width); - //frmCompareFeature.Location = new Point((this.Width - frmCompareFeature.Width)/2,50); - //frmCompareFeature.Show(this); - } /// /// 红线审核导出图片 @@ -9735,11 +9176,7 @@ Point pt1 = new Point(Convert.ToInt32(0), Convert.ToInt32(0)); Point pt2 = new Point(Convert.ToInt32(panelEx5.Width), Convert.ToInt32(panelEx5.Height)); - /*Point pt = getUpperLeftPoint(pt1, pt2); - Image myImg = new Bitmap(Convert.ToInt32(panelEx5.Width), Convert.ToInt32(panelEx5.Height)); - Graphics g = Graphics.FromImage(myImg); - g.CopyFromScreen(pt, new Point(0, 0), new Size(Convert.ToInt32(panelEx5.Width), Convert.ToInt32(panelEx5.Height))); - */ + int mapWidth = 0; int mapHeight = 0; Point pt = getUpperLeftPoint(pt1, pt2, out mapWidth, out mapHeight); @@ -9782,7 +9219,6 @@ { globeControl1.Globe.Action = EnumAction3D.ActionNull; FrmBSQStatis bsqStatis = new FrmBSQStatis(globeControl1, null); - //FrmBSQStatis bsqStatis = new FrmBSQStatis(); bsqStatis.Show(this); } /// @@ -9795,20 +9231,15 @@ trackflag = "BSQDuoBianXiangStatis"; globeControl1.Globe.Action = EnumAction3D.TrackPolygon; } - - private void btn_check_history_Click(object sender, EventArgs e) { LogManager.saveLog(Utility.userName, this.btn_check_history.Text); if (FrmCheckHistory.isOpen == true) - { return; - } FrmCheckHistory frm = new FrmCheckHistory(globeControl1, globeControl2); frm.addNode += new AddNodeToLayerManagerNode(addNodeToLayerManagerNode); frm.Show(); - } private void buttonItem查看数据_Click(object sender, EventArgs e) @@ -9840,34 +9271,29 @@ { LogManager.saveLog(Utility.userName, this.btn_user_info.Text); - if (!FrmSysUserInfoManger.IS_OPEN) - { - FrmSysUserInfoManger frm = new FrmSysUserInfoManger(); - frm.ShowDialog(); - } + if (FrmSysUserInfoManger.IS_OPEN) return; + FrmSysUserInfoManger frm = new FrmSysUserInfoManger(); + frm.ShowDialog(); } private void btn_role_info_Click(object sender, EventArgs e) { LogManager.saveLog(Utility.userName, this.btn_role_info.Text); - if (FrmRoleInfoManager.IS_OPEN) + if (!FrmRoleInfoManager.IS_OPEN) { - return; + FrmRoleInfoManager frm = new FrmRoleInfoManager(); + frm.ShowDialog(); } - FrmRoleInfoManager frm = new FrmRoleInfoManager(); - frm.ShowDialog(); } private void btn_resc_info_Click(object sender, EventArgs e) { LogManager.saveLog(Utility.userName, this.btn_resc_info.Text); - if (!SysRescInfoManager.IS_OPEN) - { - SysRescInfoManager frm = new SysRescInfoManager(); - frm.ShowDialog(); - } + if (SysRescInfoManager.IS_OPEN) return; + SysRescInfoManager frm = new SysRescInfoManager(); + frm.ShowDialog(); } private void btn_role_resc_Click(object sender, EventArgs e) @@ -9875,51 +9301,33 @@ LogManager.saveLog(Utility.userName, this.btn_role_resc.Text); - if (!FrmRoleRescManager.IS_OPEN) - { - FrmRoleRescManager frm = new FrmRoleRescManager(); - frm.ShowDialog(); - } + if (FrmRoleRescManager.IS_OPEN) return; + FrmRoleRescManager frm = new FrmRoleRescManager(); + frm.ShowDialog(); } private void btn_user_role_Click(object sender, EventArgs e) { LogManager.saveLog(Utility.userName, this.btn_user_role.Text); - if (FrmUserRole.IS_OPEN) + if (!FrmUserRole.IS_OPEN) { - return; + FrmUserRole frm = new FrmUserRole(); + frm.ShowDialog(); } - FrmUserRole frm = new FrmUserRole(); - frm.ShowDialog(); } private void btn_document_info_Click(object sender, EventArgs e) { LogManager.saveLog(Utility.userName, this.btn_document_info.Text); - - //if (FormDocumentManager.IS_OPEN) - //{ - // return; - //} - //FormDocumentManager frm = new FormDocumentManager(); - //frm.ShowDialog(); - - //if (FormDocumentManager.IS_OPEN) - //{ - // return; - //} - //new FormDocumentManager().ShowDialog(); - if (FormDocumentManager.IS_OPEN) + if (!FormDocumentManager.IS_OPEN) { - return; + this.Cursor = Cursors.WaitCursor; + FormDocumentManager frm = new FormDocumentManager(); + frm.changeCursor += new ChangeCursor(changeCursorToDefault); + frm.ShowDialog(); } - this.Cursor = Cursors.WaitCursor; - FormDocumentManager frm = new FormDocumentManager(); - frm.changeCursor += new ChangeCursor(changeCursorToDefault); - frm.ShowDialog(); - } private void changeCursorToDefault() @@ -9936,58 +9344,9 @@ dlg.Multiselect = true; if (dlg.ShowDialog() == DialogResult.OK) { - for (int i = 0; i < dlg.FileNames.Length; i++) + foreach (string strDataPath in dlg.FileNames) { - //this.Cursor = Cursors.WaitCursor; - string strDataPath = dlg.FileNames[i]; - - #region - //string strDataPathPrj = strDataPath.ToLower().Replace(".dwg", ".lprj"); - - //if (File.Exists(strDataPathPrj) == false) - //{ - // if (MessageBox.Show("数据没有空间参考信息,请设置空间参考信息!", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation) == DialogResult.OK) - // { - // String strPath = Application.StartupPath + "\\Coordinate Systems"; - // OpenFileDialog dlgPrj = new OpenFileDialog(); - // dlgPrj.InitialDirectory = strPath; - // dlgPrj.RestoreDirectory = true; - // dlgPrj.Multiselect = false; - // dlg.Filter = "投影文件|*.prj"; - // if (dlg.ShowDialog() == DialogResult.OK) - // { - // this.Cursor = Cursors.WaitCursor; - // string proj4 = GSODataEngineUtility.ConvertEsriPrjFileToProj4(dlg.FileName); - // using (StreamWriter stream = new StreamWriter(strDataPathPrj, false)) - // { - // stream.WriteLine("0prj4" + proj4 + ""); - // } - // AddLayerData(strDataPath); - // //globeControl1.Globe.Layers.Add(strDataPath); - - // this.Cursor = Cursors.Default; - // } - // else - // { - // AddLayerData(strDataPath); - // //globeControl1.Globe.Layers.Add(strDataPath); - // } - // } - // else - // { - // AddLayerData(strDataPath); - // //globeControl1.Globe.Layers.Add(strDataPath); - // } - - //} - //else - //{ - // //globeControl1.Globe.Layers.Add(strDataPath); - // AddLayerData(strDataPath); - //} - #endregion AddLayerData(strDataPath); - //this.Cursor = Cursors.Default; } } @@ -10008,38 +9367,13 @@ { LogManager.saveLog(Utility.userName, this.btn_password_edit.Text); - if (FrmChangePassword.IS_OPEN) + if (!FrmChangePassword.IS_OPEN) { - return; + FrmChangePassword frm = new FrmChangePassword(); + frm.ShowDialog(); } - FrmChangePassword frm = new FrmChangePassword(); - frm.ShowDialog(); } - /// - /// 多孔管线入库 - /// - /// - /// - private void buttonItem9_Click(object sender, EventArgs e) - { - //保存日志 - LogManager.saveLog(Utility.userName, this.buttonItemSJGL4_2.Text); - if (ds == null) - { - MessageBox.Show("请先连接数据库", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); - ConnectDB(null, null); - } - if (ds == null) - return; - - FrmMultiPipelineModelDB frm = new FrmMultiPipelineModelDB(globeControl1, ds); - if (frm.ShowDialog() == DialogResult.OK) - { - addNodeToLayerManagerNode(frm.rukuLayer); - } - //frm.Show(); - } private void 导出CADToolStripMenuItem1_Click(object sender, EventArgs e) { TreeNode node = layerNodeContexMenu.Tag as TreeNode; @@ -10049,44 +9383,42 @@ return; } GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(node.Text.Trim()); - if (layer == null || layer.GetAllFeatures().Length <= 0) + if (layer != null && layer.GetAllFeatures().Length > 0) { - MessageBox.Show("要导出的图层为空", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); - return; - } - string strProjectName = Utility.projectStr; - if (strProjectName != "") - { + string strProjectName = Utility.projectStr; + if (strProjectName == "") return; SaveFileDialog dlg = new SaveFileDialog(); dlg.Filter = "*.dwg|*.dwg|*.dxf|*.dxf"; dlg.FileName = layer.Caption; - if (dlg.ShowDialog(this) == DialogResult.OK) + if (dlg.ShowDialog(this) != DialogResult.OK) return; + globeControl1.Globe.MemoryLayer.SaveAs(dlg.FileName); + GSOLayer newlayer = globeControl1.Globe.Layers.Add(dlg.FileName); + newlayer.RemoveAllFeature(); + int featureCount = layer.GetAllFeatures().Length; + for (int i = 0; i < featureCount; i++) { - globeControl1.Globe.MemoryLayer.SaveAs(dlg.FileName); - GSOLayer newlayer = globeControl1.Globe.Layers.Add(dlg.FileName); - newlayer.RemoveAllFeature(); - int featureCount = layer.GetAllFeatures().Length; - for (int i = 0; i < featureCount; i++) + GSOFeature feature = layer.GetAt(i); + if (feature == null || feature.Geometry == null) continue; + switch (feature.Geometry.Type) { - GSOFeature feature = layer.GetAt(i); - if (feature != null && feature.Geometry != null) - { - if (feature.Geometry.Type == EnumGeometryType.GeoPolyline3D) - { - feature.Geometry.Style = new GSOSimpleLineStyle3D(); - } - else if (feature.Geometry.Type == EnumGeometryType.GeoPolygon3D) - { - feature.Geometry.Style = new GSOSimplePolygonStyle3D(); - } - newlayer.AddFeature(feature); - } + case EnumGeometryType.GeoPolyline3D: + feature.Geometry.Style = new GSOSimpleLineStyle3D(); + break; + case EnumGeometryType.GeoPolygon3D: + feature.Geometry.Style = new GSOSimplePolygonStyle3D(); + break; } - newlayer.Save(); - newlayer.Dataset.DataSource.RemoveDataset(newlayer.Dataset); - globeControl1.Globe.Layers.Remove(newlayer); - MessageBox.Show("导出CAD完成!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); + newlayer.AddFeature(feature); } + newlayer.Save(); + newlayer.Dataset.DataSource.RemoveDataset(newlayer.Dataset); + globeControl1.Globe.Layers.Remove(newlayer); + MessageBox.Show("导出CAD完成!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); + } + else + { + MessageBox.Show("要导出的图层为空", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); + return; } } diff --git a/MainFrm.designer.cs b/MainFrm.designer.cs index fd0ef22..1022ac7 100644 --- a/MainFrm.designer.cs +++ b/MainFrm.designer.cs @@ -195,10 +195,6 @@ this.缓冲区分析ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.无源淹没分析ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.清除分析ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components); - this.FlyToMenu = new System.Windows.Forms.ToolStripMenuItem(); - this.LightMenu = new System.Windows.Forms.ToolStripMenuItem(); - this.AllLightMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.timer1 = new System.Windows.Forms.Timer(this.components); this.layerNodeContexMenu = new System.Windows.Forms.ContextMenuStrip(this.components); this.RefreshLayerFeatureListMenuItem = new System.Windows.Forms.ToolStripMenuItem(); @@ -644,7 +640,6 @@ this.panelEx3.SuspendLayout(); this.RightScreenToolMenu.SuspendLayout(); this.toolRightMenu.SuspendLayout(); - this.contextMenuStrip1.SuspendLayout(); this.layerNodeContexMenu.SuspendLayout(); this.contextMenuStrip2.SuspendLayout(); this.contextMenuStrip3.SuspendLayout(); @@ -1263,7 +1258,7 @@ this.区域分析ToolStripMenuItem, this.清除分析ToolStripMenuItem}); this.toolRightMenu.Name = "toolRightMenu"; - this.toolRightMenu.Size = new System.Drawing.Size(153, 312); + this.toolRightMenu.Size = new System.Drawing.Size(149, 290); // // 量算ToolStripMenuItem // @@ -1276,7 +1271,7 @@ this.水平面积ToolStripMenuItem1, this.地表面积ToolStripMenuItem1}); this.量算ToolStripMenuItem.Name = "量算ToolStripMenuItem"; - this.量算ToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.量算ToolStripMenuItem.Size = new System.Drawing.Size(148, 22); this.量算ToolStripMenuItem.Text = "量算"; // // 水平距离ToolStripMenuItem1 @@ -1339,7 +1334,7 @@ this.前进ToolStripMenuItem, this.删除模型ToolStripMenuItem}); this.编辑ToolStripMenuItem.Name = "编辑ToolStripMenuItem"; - this.编辑ToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.编辑ToolStripMenuItem.Size = new System.Drawing.Size(148, 22); this.编辑ToolStripMenuItem.Text = "编辑"; // // 平移对象ToolStripMenuItem @@ -1415,7 +1410,7 @@ this.绕中心点飞行ToolStripMenuItem, this.绕眼睛飞行ToolStripMenuItem}); this.飞行ToolStripMenuItem.Name = "飞行ToolStripMenuItem"; - this.飞行ToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.飞行ToolStripMenuItem.Size = new System.Drawing.Size(148, 22); this.飞行ToolStripMenuItem.Text = "飞行"; // // 自定义飞行ToolStripMenuItem @@ -1460,7 +1455,7 @@ this.属性标注ToolStripMenuItem, this.标注管理ToolStripMenuItem}); this.标注ToolStripMenuItem.Name = "标注ToolStripMenuItem"; - this.标注ToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.标注ToolStripMenuItem.Size = new System.Drawing.Size(148, 22); this.标注ToolStripMenuItem.Text = "标注"; // // 标高标注ToolStripMenuItem @@ -1547,7 +1542,7 @@ this.关联查询ToolStripMenuItem, this.关键字查询ToolStripMenuItem}); this.查询ToolStripMenuItem.Name = "查询ToolStripMenuItem"; - this.查询ToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.查询ToolStripMenuItem.Size = new System.Drawing.Size(148, 22); this.查询ToolStripMenuItem.Text = "查询"; // // 空间查询ToolStripMenuItem @@ -1633,7 +1628,7 @@ this.附属物分类统计ToolStripMenuItem, this.标识器分类统计ToolStripMenuItem}); this.全区域统计ToolStripMenuItem.Name = "全区域统计ToolStripMenuItem"; - this.全区域统计ToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.全区域统计ToolStripMenuItem.Size = new System.Drawing.Size(148, 22); this.全区域统计ToolStripMenuItem.Text = "全区域统计"; // // 管线长度统计ToolStripMenuItem @@ -1712,7 +1707,7 @@ this.附属物分类统计ToolStripMenuItem1, this.标识器分类统计ToolStripMenuItem1}); this.绘制区域统计ToolStripMenuItem.Name = "绘制区域统计ToolStripMenuItem"; - this.绘制区域统计ToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.绘制区域统计ToolStripMenuItem.Size = new System.Drawing.Size(148, 22); this.绘制区域统计ToolStripMenuItem.Text = "绘制区域统计"; // // 管线长度统计ToolStripMenuItem1 @@ -1786,7 +1781,7 @@ this.道路断面分析ToolStripMenuItem, this.基线剖面分析ToolStripMenuItem}); this.断面分析ToolStripMenuItem.Name = "断面分析ToolStripMenuItem"; - this.断面分析ToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.断面分析ToolStripMenuItem.Size = new System.Drawing.Size(148, 22); this.断面分析ToolStripMenuItem.Text = "断面分析"; // // 横断面分析ToolStripMenuItem @@ -1828,7 +1823,7 @@ this.连通分析ToolStripMenuItem, this.爆管分析ToolStripMenuItem}); this.拓扑分析ToolStripMenuItem.Name = "拓扑分析ToolStripMenuItem"; - this.拓扑分析ToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.拓扑分析ToolStripMenuItem.Size = new System.Drawing.Size(148, 22); this.拓扑分析ToolStripMenuItem.Text = "拓扑分析"; // // 创建拓扑ToolStripMenuItem @@ -1890,7 +1885,7 @@ this.隐藏隧道ToolStripMenuItem, this.删除隧道ToolStripMenuItem}); this.开挖分析ToolStripMenuItem.Name = "开挖分析ToolStripMenuItem"; - this.开挖分析ToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.开挖分析ToolStripMenuItem.Size = new System.Drawing.Size(148, 22); this.开挖分析ToolStripMenuItem.Text = "开挖分析"; // // 多边形开挖ToolStripMenuItem @@ -1942,7 +1937,7 @@ this.可视域分析ToolStripMenuItem, this.可视包络分析ToolStripMenuItem}); this.视域分析ToolStripMenuItem.Name = "视域分析ToolStripMenuItem"; - this.视域分析ToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.视域分析ToolStripMenuItem.Size = new System.Drawing.Size(148, 22); this.视域分析ToolStripMenuItem.Text = "视域分析"; // // 通视分析ToolStripMenuItem @@ -1973,7 +1968,7 @@ this.缓冲区分析ToolStripMenuItem, this.无源淹没分析ToolStripMenuItem}); this.区域分析ToolStripMenuItem.Name = "区域分析ToolStripMenuItem"; - this.区域分析ToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.区域分析ToolStripMenuItem.Size = new System.Drawing.Size(148, 22); this.区域分析ToolStripMenuItem.Text = "区域分析"; // // 附属物分析ToolStripMenuItem @@ -2000,45 +1995,14 @@ // 清除分析ToolStripMenuItem // this.清除分析ToolStripMenuItem.Name = "清除分析ToolStripMenuItem"; - this.清除分析ToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.清除分析ToolStripMenuItem.Size = new System.Drawing.Size(148, 22); this.清除分析ToolStripMenuItem.Text = "清除分析"; this.清除分析ToolStripMenuItem.Click += new System.EventHandler(this.buttonItemClear_Click); // - // contextMenuStrip1 - // - this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.FlyToMenu, - this.LightMenu, - this.AllLightMenuItem}); - this.contextMenuStrip1.Name = "contextMenuStrip1"; - this.contextMenuStrip1.Size = new System.Drawing.Size(125, 70); - // - // FlyToMenu - // - this.FlyToMenu.Name = "FlyToMenu"; - this.FlyToMenu.Size = new System.Drawing.Size(124, 22); - this.FlyToMenu.Text = "定位"; - this.FlyToMenu.Click += new System.EventHandler(this.FlyToMenu_Click); - // - // LightMenu - // - this.LightMenu.Name = "LightMenu"; - this.LightMenu.Size = new System.Drawing.Size(124, 22); - this.LightMenu.Text = "单个闪烁"; - this.LightMenu.Click += new System.EventHandler(this.LightMenu_Click); - // - // AllLightMenuItem - // - this.AllLightMenuItem.Name = "AllLightMenuItem"; - this.AllLightMenuItem.Size = new System.Drawing.Size(124, 22); - this.AllLightMenuItem.Text = "全部闪烁"; - this.AllLightMenuItem.Visible = false; - this.AllLightMenuItem.Click += new System.EventHandler(this.AllLightMenuItem_Click); - // // timer1 // this.timer1.Interval = 500; - this.timer1.Tick += new System.EventHandler(this.timer1_Tick); + //this.timer1.Tick += new System.EventHandler(this.timer1_Tick); // // layerNodeContexMenu // @@ -2684,7 +2648,6 @@ this.buttonItemZTT1.Name = "buttonItemZTT1"; this.buttonItemZTT1.Text = "统计数据"; this.buttonItemZTT1.Visible = false; - this.buttonItemZTT1.Click += new System.EventHandler(this.buttonItemZTT1_Click); // // buttonItemZTT2 // @@ -5514,7 +5477,7 @@ this.dataGridViewX2.ReadOnly = true; this.dataGridViewX2.RowHeadersVisible = false; this.dataGridViewX2.RowTemplate.Height = 23; - this.dataGridViewX2.Size = new System.Drawing.Size(20983, 92); + this.dataGridViewX2.Size = new System.Drawing.Size(21874, 92); this.dataGridViewX2.TabIndex = 11; // // dataGridViewTextBoxColumn10 @@ -5608,7 +5571,7 @@ this.dataGridViewX3.ReadOnly = true; this.dataGridViewX3.RowHeadersVisible = false; this.dataGridViewX3.RowTemplate.Height = 23; - this.dataGridViewX3.Size = new System.Drawing.Size(20982, 127); + this.dataGridViewX3.Size = new System.Drawing.Size(21873, 127); this.dataGridViewX3.TabIndex = 5; this.dataGridViewX3.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.dataGridViewX3_MouseDoubleClick); // @@ -5866,7 +5829,7 @@ this.dataGridViewX8.ReadOnly = true; this.dataGridViewX8.RowHeadersVisible = false; this.dataGridViewX8.RowTemplate.Height = 23; - this.dataGridViewX8.Size = new System.Drawing.Size(91, 92); + this.dataGridViewX8.Size = new System.Drawing.Size(40, 92); this.dataGridViewX8.TabIndex = 11; // // dataGridViewTextBoxColumn12 @@ -5961,7 +5924,7 @@ this.dataGridViewX9.ReadOnly = true; this.dataGridViewX9.RowHeadersVisible = false; this.dataGridViewX9.RowTemplate.Height = 23; - this.dataGridViewX9.Size = new System.Drawing.Size(90, 127); + this.dataGridViewX9.Size = new System.Drawing.Size(39, 127); this.dataGridViewX9.TabIndex = 5; this.dataGridViewX9.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.dataGridViewX9_MouseDoubleClick); // @@ -6819,7 +6782,6 @@ this.panelEx3.ResumeLayout(false); this.RightScreenToolMenu.ResumeLayout(false); this.toolRightMenu.ResumeLayout(false); - this.contextMenuStrip1.ResumeLayout(false); this.layerNodeContexMenu.ResumeLayout(false); this.contextMenuStrip2.ResumeLayout(false); this.contextMenuStrip3.ResumeLayout(false); @@ -6914,10 +6876,6 @@ private DevComponents.DotNetBar.SideBar sideBar1; private DevComponents.DotNetBar.SideBarPanelItem sideBarPanelItem3; private DevComponents.DotNetBar.ExpandableSplitter expandableSplitter1; - private System.Windows.Forms.ContextMenuStrip contextMenuStrip1; - private System.Windows.Forms.ToolStripMenuItem FlyToMenu; - private System.Windows.Forms.ToolStripMenuItem LightMenu; - private System.Windows.Forms.ToolStripMenuItem AllLightMenuItem; private System.Windows.Forms.Timer timer1; private System.Windows.Forms.ContextMenuStrip layerNodeContexMenu; private System.Windows.Forms.ToolStripMenuItem RefreshLayerFeatureListMenuItem; diff --git a/MainFrm.resx b/MainFrm.resx index b5d8c43..bf053b9 100644 --- a/MainFrm.resx +++ b/MainFrm.resx @@ -154,9 +154,6 @@ 375, 94 - - 17, 54 - 461, 17 diff --git a/bin/x86/Debug/Cyberpipe.exe b/bin/x86/Debug/Cyberpipe.exe index a37517d..511d28f 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 77f4d13..9773759 100644 --- a/bin/x86/Debug/Cyberpipe.pdb +++ b/bin/x86/Debug/Cyberpipe.pdb Binary files differ diff --git a/bin/x86/Debug/log.txt b/bin/x86/Debug/log.txt index 2b8dbfa..af5cf0a 100644 --- a/bin/x86/Debug/log.txt +++ b/bin/x86/Debug/log.txt @@ -964,3 +964,54 @@ exception over ------------------------------------------------------------ + + exception begin -----------------2016/11/8 14:31:15--------------------- + + + + e.Message:未将对象引用设置到对象的实例。 + + e.Source:Cyberpipe + + e.TargetSite:Void .ctor(GeoScene.Globe.GSOGlobeControl, GeoScene.Engine.GSODataSource, Boolean) + + e.StackTrace: 在 Cyberpipe.Forms.FrmPipelineModelDB..ctor(GSOGlobeControl _ctl, GSODataSource _ds, Boolean _isSh) 位置 D:\GHFX\GHFX_REFACTOR\Forms\FrmPipelineModelDataBase.cs:行号 26 + 在 Cyberpipe.MainFrm.buttonItem127_Click_2(Object sender, EventArgs e) 位置 D:\GHFX\GHFX_REFACTOR\MainFrm.cs:行号 6262 + + + + exception over ------------------------------------------------------------ + + exception begin -----------------2016/11/8 14:31:20--------------------- + + + + e.Message:未将对象引用设置到对象的实例。 + + e.Source:Cyberpipe + + e.TargetSite:Void .ctor(GeoScene.Globe.GSOGlobeControl, GeoScene.Engine.GSODataSource, Boolean) + + e.StackTrace: 在 Cyberpipe.Forms.FrmPipelineModelDB..ctor(GSOGlobeControl _ctl, GSODataSource _ds, Boolean _isSh) 位置 D:\GHFX\GHFX_REFACTOR\Forms\FrmPipelineModelDataBase.cs:行号 26 + 在 Cyberpipe.MainFrm.buttonItem127_Click_2(Object sender, EventArgs e) 位置 D:\GHFX\GHFX_REFACTOR\MainFrm.cs:行号 6262 + + + + exception over ------------------------------------------------------------ + + exception begin -----------------2016/11/8 14:31:55--------------------- + + + + e.Message:未将对象引用设置到对象的实例。 + + e.Source:Cyberpipe + + e.TargetSite:Void .ctor(GeoScene.Globe.GSOGlobeControl, GeoScene.Engine.GSODataSource, Boolean) + + e.StackTrace: 在 Cyberpipe.Forms.FrmPipelineModelDB..ctor(GSOGlobeControl _ctl, GSODataSource _ds, Boolean _isSh) 位置 D:\GHFX\GHFX_REFACTOR\Forms\FrmPipelineModelDataBase.cs:行号 26 + 在 Cyberpipe.MainFrm.buttonItem127_Click_2(Object sender, EventArgs e) 位置 D:\GHFX\GHFX_REFACTOR\MainFrm.cs:行号 6262 + + + + exception over ------------------------------------------------------------