diff --git a/Cyberpipe.csproj b/Cyberpipe.csproj index d24ccfc..cd0296f 100644 --- a/Cyberpipe.csproj +++ b/Cyberpipe.csproj @@ -228,6 +228,7 @@ F_GKT1添加项目.cs + @@ -938,12 +939,6 @@ FrmRESCMgr.cs - - Form - - - FrmRoadHDM.cs - Form @@ -1166,6 +1161,7 @@ + @@ -1611,10 +1607,6 @@ FrmRESCMgr.cs Designer - - FrmRoadHDM.cs - Designer - FrmRole.cs Designer diff --git a/Cyberpipe.csproj b/Cyberpipe.csproj index d24ccfc..cd0296f 100644 --- a/Cyberpipe.csproj +++ b/Cyberpipe.csproj @@ -228,6 +228,7 @@ F_GKT1添加项目.cs + @@ -938,12 +939,6 @@ FrmRESCMgr.cs - - Form - - - FrmRoadHDM.cs - Form @@ -1166,6 +1161,7 @@ + @@ -1611,10 +1607,6 @@ FrmRESCMgr.cs Designer - - FrmRoadHDM.cs - Designer - FrmRole.cs Designer diff --git a/EnumEventMode.cs b/EnumEventMode.cs new file mode 100644 index 0000000..b5eba59 --- /dev/null +++ b/EnumEventMode.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace Cyberpipe +{ + //横断面分析、基线剖面分析、道路断面分析 + public enum EnumTrackPolylineEndMode + { + Default_Analysis = 0, //无分析 + HDM_Analysis = 1, //横断面分析 + DLDM_Analysis = 2,//道路断面分析 + JXPM_Analysis = 3, //基线剖面分析 + } + + class EnumEventMode + { + } +} diff --git a/Cyberpipe.csproj b/Cyberpipe.csproj index d24ccfc..cd0296f 100644 --- a/Cyberpipe.csproj +++ b/Cyberpipe.csproj @@ -228,6 +228,7 @@ F_GKT1添加项目.cs + @@ -938,12 +939,6 @@ FrmRESCMgr.cs - - Form - - - FrmRoadHDM.cs - Form @@ -1166,6 +1161,7 @@ + @@ -1611,10 +1607,6 @@ FrmRESCMgr.cs Designer - - FrmRoadHDM.cs - Designer - FrmRole.cs Designer diff --git a/EnumEventMode.cs b/EnumEventMode.cs new file mode 100644 index 0000000..b5eba59 --- /dev/null +++ b/EnumEventMode.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace Cyberpipe +{ + //横断面分析、基线剖面分析、道路断面分析 + public enum EnumTrackPolylineEndMode + { + Default_Analysis = 0, //无分析 + HDM_Analysis = 1, //横断面分析 + DLDM_Analysis = 2,//道路断面分析 + JXPM_Analysis = 3, //基线剖面分析 + } + + class EnumEventMode + { + } +} diff --git a/FrmHDMAnalysis3.cs b/FrmHDMAnalysis3.cs index 5e5988c..6405ed7 100644 --- a/FrmHDMAnalysis3.cs +++ b/FrmHDMAnalysis3.cs @@ -16,206 +16,72 @@ { public partial class FrmHDMAnalysis3 : DevComponents.DotNetBar.Office2007Form { - private ArrayList listPoint = new ArrayList(); - private ArrayList listFeat = new ArrayList(); - GSOGeoPolyline3D line = new GSOGeoPolyline3D(); //创建线对象 - - private static FrmHDMAnalysis3 allPipelineAnalysis = null; - public bool isShowFirst = false; - - static ArrayList list = new ArrayList(); + static DataTable table = new DataTable(); - static DataTable showTable = new DataTable(); GSOGlobeControl globeControl1; - object[,] sortIndex; - GSOLayer layerTemp; - private FrmHDMAnalysis3() - { - - } - public static FrmHDMAnalysis3 GetForm(ArrayList arraylistP, ArrayList arraylistF, GSOGeoPolyline3D _line, GSOGlobeControl _ctl) - { - if (allPipelineAnalysis == null) - { - allPipelineAnalysis = new FrmHDMAnalysis3(arraylistP, arraylistF, _line,_ctl); - } - else - { - allPipelineAnalysis.listPoint = arraylistP; - allPipelineAnalysis.listFeat = arraylistF; - allPipelineAnalysis.line = _line; - allPipelineAnalysis.globeControl1 = _ctl; - list = new ArrayList(); - } - return allPipelineAnalysis; - } + EnumTrackPolylineEndMode mode; - public FrmHDMAnalysis3(ArrayList arraylistP, ArrayList arraylistF, GSOGeoPolyline3D _line,GSOGlobeControl _ctl) + Dictionary hdmDic; + + public FrmHDMAnalysis3(Dictionary hdmDic, + GSOGlobeControl globeControl, EnumTrackPolylineEndMode mode) { InitializeComponent(); - this.listPoint = arraylistP; - this.listFeat = arraylistF; - line = _line; - globeControl1 = _ctl; + + this.hdmDic = hdmDic; + this.globeControl1 = globeControl; + this.mode = mode; } - double A_x, A_y, B_x, B_y;//定义坐标点,用来就横断面的长度 - /// - /// 窗体初始化事件处理 - /// - /// - /// - private void Frm_HDMAnalysis_Load(object sender, EventArgs e) + + private void initControls() { - layerTemp = globeControl1.Globe.Layers.Add(Application.StartupPath + "\\tempLgdExport.lgd"); - //chart1.ChartAreas[0].BackImage = Application.StartupPath + "\\Resource\\pipelineBackGround副本.png"; - } - /// - /// 窗体第一次显示事件处理 - /// - /// - /// - void Frm_HDMAnalysis2_Shown(object sender, EventArgs e) - { - isShowFirst = true; - - } - public void LoadChartEvent() - { - try - { - this.Shown += new EventHandler(Frm_HDMAnalysis2_Shown); - - chart1.Series["管线"].ChartType = SeriesChartType.Point; - - chart1.Series["管线"]["DrawingStyle"] = "Cylinder"; - chart1.Series["管线"].MarkerStyle = MarkerStyle.Circle; //点的类型 - - chart1.Series["管线"].MarkerBorderColor = Color.Black; //点的边框颜色 - chart1.ChartAreas[0].AxisX.Minimum = 0; //x轴的起始点大小 - chart1.ChartAreas[0].AxisY.Maximum = 0; //y轴的最大值 - - chart1.ChartAreas[0].AxisX.Title = "距离 (米)"; - chart1.ChartAreas[0].AxisY.Title = "埋深 (米)"; - - //chart1.ChartAreas[0].AxisX.ScrollBar.Enabled = true; - chart1.ChartAreas[0].AxisY2.Title = "高程 (米)"; - double[] depths = new double[listFeat.Count]; - for (int i = 0; i < listFeat.Count; i++) - { - GSOFeature f = listFeat[i] as GSOFeature; - double depth = f.GetFieldAsDouble("起始地面高程"); - depths[i] = depth; - } - double max_Depth = depths[0]; - for (int i = 0; i < listFeat.Count; i++) - { - if (max_Depth < depths[i]) - { - max_Depth = depths[i]; - } - } - chart1.ChartAreas[0].AxisY2.CustomLabels.Clear(); - chart1.ChartAreas[0].AxisY2.CustomLabels.Add(-5.4d, -5.6d, (max_Depth - 5.5).ToString("0.0")); - chart1.ChartAreas[0].AxisY2.CustomLabels.Add(-4.9d, -5.1d, (max_Depth - 5).ToString("0.0")); - chart1.ChartAreas[0].AxisY2.CustomLabels.Add(-4.4d, -4.6d, (max_Depth - 4.5).ToString("0.0")); - chart1.ChartAreas[0].AxisY2.CustomLabels.Add(-3.9d, -4.1d, (max_Depth - 4).ToString("0.0")); - chart1.ChartAreas[0].AxisY2.CustomLabels.Add(-3.4d, -3.6d, (max_Depth - 3.5).ToString("0.0")); - chart1.ChartAreas[0].AxisY2.CustomLabels.Add(-2.9d, -3.1d, (max_Depth - 3).ToString("0.0")); - chart1.ChartAreas[0].AxisY2.CustomLabels.Add(-2.4d, -2.6d, (max_Depth - 2.5).ToString("0.0")); - chart1.ChartAreas[0].AxisY2.CustomLabels.Add(-1.9d, -2.1d, (max_Depth - 2).ToString("0.0")); - chart1.ChartAreas[0].AxisY2.CustomLabels.Add(-1.4d, -1.6d, (max_Depth - 1.5).ToString("0.0")); - chart1.ChartAreas[0].AxisY2.CustomLabels.Add(-0.9d, -1.1d, (max_Depth - 1).ToString("0.0")); - chart1.ChartAreas[0].AxisY2.CustomLabels.Add(-0.4d, -0.6d, (max_Depth - 0.5).ToString("0.0")); - chart1.ChartAreas[0].AxisY2.CustomLabels.Add(-0.1d, 0.1d, max_Depth.ToString("0.0")); - - if (line.PartCount > 0) - { - GSOPoint3ds nodes = line[0]; - if (nodes.Count > 0) - { - GSOPoint3d node = nodes[0]; - A_x = node.X; - A_y = node.Y; - } - } - - DrawCurveGraph(A_x, A_y); - } - catch (Exception ex) - { - LogError.PublishError(ex); - } - } - - /// - /// 创建图表 - /// - /// - /// - private void DrawCurveGraph(double a_x,double a_y) - { - // 遍历线,求距离 - table = new DataTable(); - //showTable.Columns.Clear(); - list.Clear(); + chart1.Series["管线"].ChartType = SeriesChartType.Point; + chart1.Series["管线"]["DrawingStyle"] = "Cylinder"; + chart1.Series["管线"].MarkerStyle = MarkerStyle.Circle; //点的类型 + chart1.Series["管线"].MarkerBorderColor = Color.Black; //点的边框颜色 + //chart1.ChartAreas[0].AxisX.Minimum = 0; //x轴的起始点大小 + chart1.ChartAreas[0].AxisY.Maximum = 0; //y轴的最大值 + chart1.ChartAreas[0].AxisX.Title = "距离 (米)"; + chart1.ChartAreas[0].AxisY.Title = "埋深 (米)"; + chart1.ChartAreas[0].AxisY2.Title = "高程 (米)"; chart1.Series["管线"].Points.Clear(); - chart1.ChartAreas[0].AxisX.Maximum = Math.Round(line.GetSpaceLength(true, 6378137),2); + //chart1.ChartAreas[0].AxisX.Maximum = Math.Round(line.GetSpaceLength(true, 6378137), 2); + table.Columns.Add("编号", typeof(string)); table.Columns.Add("管线类型", typeof(string)); table.Columns.Add("管线编码", typeof(string)); table.Columns.Add("管径_毫米", typeof(string)); table.Columns.Add("材质", typeof(string)); - table.Columns.Add("管线埋深", typeof(string)); + table.Columns.Add("管线埋深", typeof(string)); - sortIndex = new object[listPoint.Count, 2]; - for (int i = 0; i <= listPoint.Count; i++) + if (mode == EnumTrackPolylineEndMode.DLDM_Analysis) { - if (i == listPoint.Count) - { - double maxNum = 0.0; - for (int j = 0; j < listPoint.Count; j++) - { - if (maxNum < Convert.ToDouble(sortIndex[j, 0])) - { - maxNum = Convert.ToDouble(sortIndex[j, 0]); - } - } - chart1.Series["管线"].Points.AddXY(maxNum + 2, 0); - chart1.Series["管线"].Points[i].MarkerBorderWidth = 100; //边框的宽度 - chart1.Series["管线"].Points[i].MarkerColor = Color.Black; - chart1.Series["管线"].Points[i].MarkerSize = 100; - continue; - } - GSOPoint3d geoPoint = (GSOPoint3d)listPoint[i]; - GSOFeature feature = listFeat[i] as GSOFeature; - //坐标投影 - int id = GeoScene.Data.GSOProjectManager.AddProject(Utility.projectStr); + this.pictureBox1.Visible = true; + } + else + { + this.pictureBox1.Visible = false; + } + } - GeoScene.Data.GSOPoint2d a_Point = GeoScene.Data.GSOProjectManager.Forward(new GSOPoint2d(a_x, a_y), id);//user画的线的起始点 + private void draw() + { + int i = 0; + foreach (KeyValuePair kvp in this.hdmDic) + { + GSOFeature feature = kvp.Key; + HDMCoordinate coor = kvp.Value; - GeoScene.Data.GSOPoint2d pt2d = new GeoScene.Data.GSOPoint2d(geoPoint.X, geoPoint.Y); - GeoScene.Data.GSOPoint2d result = GeoScene.Data.GSOProjectManager.Forward(pt2d, id); - B_x = result.X; - B_y = result.Y; + chart1.Series["管线"].Points.AddXY(coor.Dis, coor.Z);//绑定数据 - double x = System.Math.Abs(B_x - a_Point.X); - double y = System.Math.Abs(B_y - a_Point.Y); - double Dis = 0.0; - Dis = Math.Round(Math.Sqrt(x * x + y * y) , 2); - list.Add(geoPoint.Z); - sortIndex[i, 0] = Dis; - sortIndex[i, 1] = i; - - chart1.Series["管线"].Points.AddXY(Dis, geoPoint.Z);//绑定数据 - - string pipeType = feature.Dataset == null ? "" : feature.Dataset.Caption; + string pipeType = feature.Dataset == null ? "" : feature.Dataset.Caption; string number = Convert.ToString(i + 1); - string material = feature.GetFieldAsString("材质"); string diameter = feature.GetFieldAsString("管径_毫米"); - table.Rows.Add(new object[] { number, pipeType, feature.Name.ToString(), diameter, material,Convert.ToDecimal(list[i].ToString()).ToString("f2")});//list[i].ToString().Substring(0,list[i].ToString().IndexOf('.')+3) } - - //chart1.Series["管线"].Points[i].Label = number;//管线的标签 + table.Rows.Add(new object[] { number, + pipeType, feature.Name.ToString(), + diameter, material, + Convert.ToDecimal(coor.Z).ToString("f2") }); chart1.Series["管线"].Points[i].LegendText = number; if (feature.Geometry.Style.GetType() == typeof(GSOPipeLineStyle3D)) { @@ -229,47 +95,12 @@ chart1.Series["管线"].Points[i].MarkerBorderWidth = 3; //边框的宽度 chart1.Series["管线"].Points[i].MarkerColor = Color.Transparent; - chart1.Series["管线"].Points[i].MarkerSize = Convert.ToInt32(Math.Floor((feature.GetFieldAsDouble("管径_毫米") / 0.35 + chart1.Series["管线"].Points[i].MarkerBorderWidth) / 100.0));//点的大小 - + chart1.Series["管线"].Points[i].MarkerSize = Convert.ToInt32(Math.Floor((feature.GetFieldAsDouble("管径_毫米") / 0.35 + + chart1.Series["管线"].Points[i].MarkerBorderWidth) / 100.0)); + i++; } - - string htmlCode = "" + - "" + - "" + - "
管线类型管线编码管径_毫米材质管线埋深
" + - "" + - "" + - "" + - "" + - "
"; - webBrowser1.DocumentText = htmlCode; } + /// /// 图表的鼠标单击事件处理 /// @@ -286,14 +117,11 @@ return; } string number = p.LegendText; - //MessageBox.Show(number); int indexInTableRows = 0; bool isInt = int.TryParse(number, out indexInTableRows); if (isInt) { DataRow row = table.Rows[indexInTableRows - 1]; - //showTable.Rows.Clear(); - //showTable.Rows.Add(new object[] { row[0], row[1], row[2], row[3], row[4], row[5] }); string htmlCode = "" + - "" + - "" + - "
管线类型管线编码管径_毫米材质管线埋深
" + - "" + - "" + - "" + - "" + - "
"; - webBrowser1.DocumentText = htmlCode; } + /// /// 图表的鼠标单击事件处理 /// @@ -286,14 +117,11 @@ return; } string number = p.LegendText; - //MessageBox.Show(number); int indexInTableRows = 0; bool isInt = int.TryParse(number, out indexInTableRows); if (isInt) { DataRow row = table.Rows[indexInTableRows - 1]; - //showTable.Rows.Clear(); - //showTable.Rows.Add(new object[] { row[0], row[1], row[2], row[3], row[4], row[5] }); string htmlCode = "" + - "" + - "" + - "
管线类型管线编码管径_毫米材质管线埋深
" + - "" + - "" + - "" + - "" + - "
"; - webBrowser1.DocumentText = htmlCode; } + /// /// 图表的鼠标单击事件处理 /// @@ -286,14 +117,11 @@ return; } string number = p.LegendText; - //MessageBox.Show(number); int indexInTableRows = 0; bool isInt = int.TryParse(number, out indexInTableRows); if (isInt) { DataRow row = table.Rows[indexInTableRows - 1]; - //showTable.Rows.Clear(); - //showTable.Rows.Add(new object[] { row[0], row[1], row[2], row[3], row[4], row[5] }); string htmlCode = "" + - "" + - "" + - "
管线类型管线编码管径_毫米材质管线埋深
" + - "" + - "" + - "" + - "" + - "
"; - webBrowser1.DocumentText = htmlCode; } + /// /// 图表的鼠标单击事件处理 /// @@ -286,14 +117,11 @@ return; } string number = p.LegendText; - //MessageBox.Show(number); int indexInTableRows = 0; bool isInt = int.TryParse(number, out indexInTableRows); if (isInt) { DataRow row = table.Rows[indexInTableRows - 1]; - //showTable.Rows.Clear(); - //showTable.Rows.Add(new object[] { row[0], row[1], row[2], row[3], row[4], row[5] }); string htmlCode = "" + - "" + - "" + - "
管线类型管线编码管径_毫米材质管线埋深
" + - "" + - "" + - "" + - "" + - "
"; - webBrowser1.DocumentText = htmlCode; - - - } - /// - /// 图表鼠标单击事件处理 - /// - /// - /// - private void chart1_MouseClick(object sender, MouseEventArgs e) - { - HitTestResult result = chart1.HitTest(e.X, e.Y, true); - if (result.PointIndex >= 0) - { - DataPoint p = (DataPoint)result.Object; - if (p == null) - { - return; - } - string number = p.LegendText; - int indexInTableRows = 0; - bool isInt = int.TryParse(number, out indexInTableRows); - if (isInt) - { - DataRow row = table.Rows[indexInTableRows - 1]; - string htmlCode = "" + - "" + - "" + - "
管线类型管线编码管径_毫米材质管线埋深
" + row[1] + - "" + row[2] + - "" + row[3] + - "" + row[4] + - "" + row[5] + - "
"; - webBrowser1.DocumentText = htmlCode; - } - } - } - /// - /// 窗体关闭事件处理 - /// - /// - /// - private void FrmRoadHDM_FormClosing(object sender, FormClosingEventArgs e) - { - allPipelineAnalysis = null; - globeControl1.Globe.MemoryLayer.RemoveAllFeature(); - } - /// - /// 图表鼠标移动事件处理 - /// - /// - /// - private void chart1_MouseMove(object sender, MouseEventArgs e) - { - HitTestResult result = chart1.HitTest(e.X, e.Y, true); - if (result.PointIndex >= 0) - { - this.Cursor = Cursors.Hand; - } - else - { - this.Cursor = Cursors.Default; - } - } - - private void Export(GSOPoint3d _pnt, double r) - { - GSOPoint3ds pnts = new GSOPoint3ds(); - GSOPoint3d pnt = new GSOPoint3d(); - pnt.X = _pnt.X; - pnt.Y = _pnt.Y; - pnt.Z = _pnt.Z; - pnts.Add(pnt); - pnt.X = _pnt.X; - pnt.Y = _pnt.Y - 0.0000000005; - pnt.Z = _pnt.Z; - pnts.Add(pnt); - GSOGeoPolyline3D line = new GSOGeoPolyline3D(); - line.AddPart(pnts); - GSOGeoPolygon3D polygon = line.CreateBuffer(r * 2, true, 5, true, false); - GSOPoint3ds points = polygon[0]; - GSOGeoPolyline3D newLine = new GSOGeoPolyline3D(); - newLine.AddPart(points); - newLine.AltitudeMode = EnumAltitudeMode.RelativeToGround; - GSOFeature newFeature = new GSOFeature(); - newFeature.Geometry = newLine; - globeControl1.Globe.MemoryLayer.AddFeature(newFeature); - } - - private void ExportCAD(double a, double b, double r) - { - GSOPoint3ds pnts = new GSOPoint3ds(); - for (int i = 0; i <= 64; i++) - { - double x = a + r * Math.Cos(i * 5.625 * Math.PI / 180); - double y = b - r * Math.Sin(i * 5.625 * Math.PI / 180); - GSOPoint2d pt2d = new GeoScene.Data.GSOPoint2d(x, y); - GSOPoint3d pnt = new GSOPoint3d(); - pnt.X = pt2d.X; - pnt.Y = pt2d.Y; - pnt.Z = 0; - pnts.Add(pnt); - } - GSOGeoPolyline3D line = new GSOGeoPolyline3D(); - line.AddPart(pnts); - GSOFeature f = new GSOFeature(); - f.Geometry = line; - f.Geometry.LatLonCoord = false; - f.Visible = false; - layerTemp.AddFeature(f); - } - /// - /// 导出CAD按钮事件处理 - /// - /// - /// - private void btnExportCAD_Click(object sender, EventArgs e) - { - layerTemp.RemoveAllFeature(); - for (int i = 0; i < listPoint.Count; i++) - { - GSOPoint3d geoPoint = (GSOPoint3d)listPoint[i]; - GSOFeature feature = listFeat[i] as GSOFeature; - if (feature != null) - { - if (feature.Geometry.Type == EnumGeometryType.GeoPolyline3D) - { - GSOPipeLineStyle3D style = feature.Geometry.Style as GSOPipeLineStyle3D; - double r = style.Radius; - ExportCAD(double.Parse(sortIndex[i, 0].ToString()), geoPoint.Z, r); - } - } - } - layerTemp.Dataset.ImportProjectionRefFromProj4(""); - SaveFileDialog dlg = new SaveFileDialog(); - dlg.Filter = "*.dxf|*.dxf"; - if (dlg.ShowDialog() == DialogResult.OK) - { - layerTemp.SaveAs(dlg.FileName); - MessageBox.Show("导出CAD完成!", "提示"); - } - layerTemp.RemoveAllFeature(); - } - } -} diff --git a/Cyberpipe.csproj b/Cyberpipe.csproj index d24ccfc..cd0296f 100644 --- a/Cyberpipe.csproj +++ b/Cyberpipe.csproj @@ -228,6 +228,7 @@ F_GKT1添加项目.cs
+ @@ -938,12 +939,6 @@ FrmRESCMgr.cs - - Form - - - FrmRoadHDM.cs - Form @@ -1166,6 +1161,7 @@ + @@ -1611,10 +1607,6 @@ FrmRESCMgr.cs Designer - - FrmRoadHDM.cs - Designer - FrmRole.cs Designer diff --git a/EnumEventMode.cs b/EnumEventMode.cs new file mode 100644 index 0000000..b5eba59 --- /dev/null +++ b/EnumEventMode.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace Cyberpipe +{ + //横断面分析、基线剖面分析、道路断面分析 + public enum EnumTrackPolylineEndMode + { + Default_Analysis = 0, //无分析 + HDM_Analysis = 1, //横断面分析 + DLDM_Analysis = 2,//道路断面分析 + JXPM_Analysis = 3, //基线剖面分析 + } + + class EnumEventMode + { + } +} diff --git a/FrmHDMAnalysis3.cs b/FrmHDMAnalysis3.cs index 5e5988c..6405ed7 100644 --- a/FrmHDMAnalysis3.cs +++ b/FrmHDMAnalysis3.cs @@ -16,206 +16,72 @@ { public partial class FrmHDMAnalysis3 : DevComponents.DotNetBar.Office2007Form { - private ArrayList listPoint = new ArrayList(); - private ArrayList listFeat = new ArrayList(); - GSOGeoPolyline3D line = new GSOGeoPolyline3D(); //创建线对象 - - private static FrmHDMAnalysis3 allPipelineAnalysis = null; - public bool isShowFirst = false; - - static ArrayList list = new ArrayList(); + static DataTable table = new DataTable(); - static DataTable showTable = new DataTable(); GSOGlobeControl globeControl1; - object[,] sortIndex; - GSOLayer layerTemp; - private FrmHDMAnalysis3() - { - - } - public static FrmHDMAnalysis3 GetForm(ArrayList arraylistP, ArrayList arraylistF, GSOGeoPolyline3D _line, GSOGlobeControl _ctl) - { - if (allPipelineAnalysis == null) - { - allPipelineAnalysis = new FrmHDMAnalysis3(arraylistP, arraylistF, _line,_ctl); - } - else - { - allPipelineAnalysis.listPoint = arraylistP; - allPipelineAnalysis.listFeat = arraylistF; - allPipelineAnalysis.line = _line; - allPipelineAnalysis.globeControl1 = _ctl; - list = new ArrayList(); - } - return allPipelineAnalysis; - } + EnumTrackPolylineEndMode mode; - public FrmHDMAnalysis3(ArrayList arraylistP, ArrayList arraylistF, GSOGeoPolyline3D _line,GSOGlobeControl _ctl) + Dictionary hdmDic; + + public FrmHDMAnalysis3(Dictionary hdmDic, + GSOGlobeControl globeControl, EnumTrackPolylineEndMode mode) { InitializeComponent(); - this.listPoint = arraylistP; - this.listFeat = arraylistF; - line = _line; - globeControl1 = _ctl; + + this.hdmDic = hdmDic; + this.globeControl1 = globeControl; + this.mode = mode; } - double A_x, A_y, B_x, B_y;//定义坐标点,用来就横断面的长度 - /// - /// 窗体初始化事件处理 - /// - /// - /// - private void Frm_HDMAnalysis_Load(object sender, EventArgs e) + + private void initControls() { - layerTemp = globeControl1.Globe.Layers.Add(Application.StartupPath + "\\tempLgdExport.lgd"); - //chart1.ChartAreas[0].BackImage = Application.StartupPath + "\\Resource\\pipelineBackGround副本.png"; - } - /// - /// 窗体第一次显示事件处理 - /// - /// - /// - void Frm_HDMAnalysis2_Shown(object sender, EventArgs e) - { - isShowFirst = true; - - } - public void LoadChartEvent() - { - try - { - this.Shown += new EventHandler(Frm_HDMAnalysis2_Shown); - - chart1.Series["管线"].ChartType = SeriesChartType.Point; - - chart1.Series["管线"]["DrawingStyle"] = "Cylinder"; - chart1.Series["管线"].MarkerStyle = MarkerStyle.Circle; //点的类型 - - chart1.Series["管线"].MarkerBorderColor = Color.Black; //点的边框颜色 - chart1.ChartAreas[0].AxisX.Minimum = 0; //x轴的起始点大小 - chart1.ChartAreas[0].AxisY.Maximum = 0; //y轴的最大值 - - chart1.ChartAreas[0].AxisX.Title = "距离 (米)"; - chart1.ChartAreas[0].AxisY.Title = "埋深 (米)"; - - //chart1.ChartAreas[0].AxisX.ScrollBar.Enabled = true; - chart1.ChartAreas[0].AxisY2.Title = "高程 (米)"; - double[] depths = new double[listFeat.Count]; - for (int i = 0; i < listFeat.Count; i++) - { - GSOFeature f = listFeat[i] as GSOFeature; - double depth = f.GetFieldAsDouble("起始地面高程"); - depths[i] = depth; - } - double max_Depth = depths[0]; - for (int i = 0; i < listFeat.Count; i++) - { - if (max_Depth < depths[i]) - { - max_Depth = depths[i]; - } - } - chart1.ChartAreas[0].AxisY2.CustomLabels.Clear(); - chart1.ChartAreas[0].AxisY2.CustomLabels.Add(-5.4d, -5.6d, (max_Depth - 5.5).ToString("0.0")); - chart1.ChartAreas[0].AxisY2.CustomLabels.Add(-4.9d, -5.1d, (max_Depth - 5).ToString("0.0")); - chart1.ChartAreas[0].AxisY2.CustomLabels.Add(-4.4d, -4.6d, (max_Depth - 4.5).ToString("0.0")); - chart1.ChartAreas[0].AxisY2.CustomLabels.Add(-3.9d, -4.1d, (max_Depth - 4).ToString("0.0")); - chart1.ChartAreas[0].AxisY2.CustomLabels.Add(-3.4d, -3.6d, (max_Depth - 3.5).ToString("0.0")); - chart1.ChartAreas[0].AxisY2.CustomLabels.Add(-2.9d, -3.1d, (max_Depth - 3).ToString("0.0")); - chart1.ChartAreas[0].AxisY2.CustomLabels.Add(-2.4d, -2.6d, (max_Depth - 2.5).ToString("0.0")); - chart1.ChartAreas[0].AxisY2.CustomLabels.Add(-1.9d, -2.1d, (max_Depth - 2).ToString("0.0")); - chart1.ChartAreas[0].AxisY2.CustomLabels.Add(-1.4d, -1.6d, (max_Depth - 1.5).ToString("0.0")); - chart1.ChartAreas[0].AxisY2.CustomLabels.Add(-0.9d, -1.1d, (max_Depth - 1).ToString("0.0")); - chart1.ChartAreas[0].AxisY2.CustomLabels.Add(-0.4d, -0.6d, (max_Depth - 0.5).ToString("0.0")); - chart1.ChartAreas[0].AxisY2.CustomLabels.Add(-0.1d, 0.1d, max_Depth.ToString("0.0")); - - if (line.PartCount > 0) - { - GSOPoint3ds nodes = line[0]; - if (nodes.Count > 0) - { - GSOPoint3d node = nodes[0]; - A_x = node.X; - A_y = node.Y; - } - } - - DrawCurveGraph(A_x, A_y); - } - catch (Exception ex) - { - LogError.PublishError(ex); - } - } - - /// - /// 创建图表 - /// - /// - /// - private void DrawCurveGraph(double a_x,double a_y) - { - // 遍历线,求距离 - table = new DataTable(); - //showTable.Columns.Clear(); - list.Clear(); + chart1.Series["管线"].ChartType = SeriesChartType.Point; + chart1.Series["管线"]["DrawingStyle"] = "Cylinder"; + chart1.Series["管线"].MarkerStyle = MarkerStyle.Circle; //点的类型 + chart1.Series["管线"].MarkerBorderColor = Color.Black; //点的边框颜色 + //chart1.ChartAreas[0].AxisX.Minimum = 0; //x轴的起始点大小 + chart1.ChartAreas[0].AxisY.Maximum = 0; //y轴的最大值 + chart1.ChartAreas[0].AxisX.Title = "距离 (米)"; + chart1.ChartAreas[0].AxisY.Title = "埋深 (米)"; + chart1.ChartAreas[0].AxisY2.Title = "高程 (米)"; chart1.Series["管线"].Points.Clear(); - chart1.ChartAreas[0].AxisX.Maximum = Math.Round(line.GetSpaceLength(true, 6378137),2); + //chart1.ChartAreas[0].AxisX.Maximum = Math.Round(line.GetSpaceLength(true, 6378137), 2); + table.Columns.Add("编号", typeof(string)); table.Columns.Add("管线类型", typeof(string)); table.Columns.Add("管线编码", typeof(string)); table.Columns.Add("管径_毫米", typeof(string)); table.Columns.Add("材质", typeof(string)); - table.Columns.Add("管线埋深", typeof(string)); + table.Columns.Add("管线埋深", typeof(string)); - sortIndex = new object[listPoint.Count, 2]; - for (int i = 0; i <= listPoint.Count; i++) + if (mode == EnumTrackPolylineEndMode.DLDM_Analysis) { - if (i == listPoint.Count) - { - double maxNum = 0.0; - for (int j = 0; j < listPoint.Count; j++) - { - if (maxNum < Convert.ToDouble(sortIndex[j, 0])) - { - maxNum = Convert.ToDouble(sortIndex[j, 0]); - } - } - chart1.Series["管线"].Points.AddXY(maxNum + 2, 0); - chart1.Series["管线"].Points[i].MarkerBorderWidth = 100; //边框的宽度 - chart1.Series["管线"].Points[i].MarkerColor = Color.Black; - chart1.Series["管线"].Points[i].MarkerSize = 100; - continue; - } - GSOPoint3d geoPoint = (GSOPoint3d)listPoint[i]; - GSOFeature feature = listFeat[i] as GSOFeature; - //坐标投影 - int id = GeoScene.Data.GSOProjectManager.AddProject(Utility.projectStr); + this.pictureBox1.Visible = true; + } + else + { + this.pictureBox1.Visible = false; + } + } - GeoScene.Data.GSOPoint2d a_Point = GeoScene.Data.GSOProjectManager.Forward(new GSOPoint2d(a_x, a_y), id);//user画的线的起始点 + private void draw() + { + int i = 0; + foreach (KeyValuePair kvp in this.hdmDic) + { + GSOFeature feature = kvp.Key; + HDMCoordinate coor = kvp.Value; - GeoScene.Data.GSOPoint2d pt2d = new GeoScene.Data.GSOPoint2d(geoPoint.X, geoPoint.Y); - GeoScene.Data.GSOPoint2d result = GeoScene.Data.GSOProjectManager.Forward(pt2d, id); - B_x = result.X; - B_y = result.Y; + chart1.Series["管线"].Points.AddXY(coor.Dis, coor.Z);//绑定数据 - double x = System.Math.Abs(B_x - a_Point.X); - double y = System.Math.Abs(B_y - a_Point.Y); - double Dis = 0.0; - Dis = Math.Round(Math.Sqrt(x * x + y * y) , 2); - list.Add(geoPoint.Z); - sortIndex[i, 0] = Dis; - sortIndex[i, 1] = i; - - chart1.Series["管线"].Points.AddXY(Dis, geoPoint.Z);//绑定数据 - - string pipeType = feature.Dataset == null ? "" : feature.Dataset.Caption; + string pipeType = feature.Dataset == null ? "" : feature.Dataset.Caption; string number = Convert.ToString(i + 1); - string material = feature.GetFieldAsString("材质"); string diameter = feature.GetFieldAsString("管径_毫米"); - table.Rows.Add(new object[] { number, pipeType, feature.Name.ToString(), diameter, material,Convert.ToDecimal(list[i].ToString()).ToString("f2")});//list[i].ToString().Substring(0,list[i].ToString().IndexOf('.')+3) } - - //chart1.Series["管线"].Points[i].Label = number;//管线的标签 + table.Rows.Add(new object[] { number, + pipeType, feature.Name.ToString(), + diameter, material, + Convert.ToDecimal(coor.Z).ToString("f2") }); chart1.Series["管线"].Points[i].LegendText = number; if (feature.Geometry.Style.GetType() == typeof(GSOPipeLineStyle3D)) { @@ -229,47 +95,12 @@ chart1.Series["管线"].Points[i].MarkerBorderWidth = 3; //边框的宽度 chart1.Series["管线"].Points[i].MarkerColor = Color.Transparent; - chart1.Series["管线"].Points[i].MarkerSize = Convert.ToInt32(Math.Floor((feature.GetFieldAsDouble("管径_毫米") / 0.35 + chart1.Series["管线"].Points[i].MarkerBorderWidth) / 100.0));//点的大小 - + chart1.Series["管线"].Points[i].MarkerSize = Convert.ToInt32(Math.Floor((feature.GetFieldAsDouble("管径_毫米") / 0.35 + + chart1.Series["管线"].Points[i].MarkerBorderWidth) / 100.0)); + i++; } - - string htmlCode = "" + - "" + - "" + - "
管线类型管线编码管径_毫米材质管线埋深
" + - "" + - "" + - "" + - "" + - "
"; - webBrowser1.DocumentText = htmlCode; } + /// /// 图表的鼠标单击事件处理 /// @@ -286,14 +117,11 @@ return; } string number = p.LegendText; - //MessageBox.Show(number); int indexInTableRows = 0; bool isInt = int.TryParse(number, out indexInTableRows); if (isInt) { DataRow row = table.Rows[indexInTableRows - 1]; - //showTable.Rows.Clear(); - //showTable.Rows.Add(new object[] { row[0], row[1], row[2], row[3], row[4], row[5] }); string htmlCode = "" + - "" + - "" + - "
管线类型管线编码管径_毫米材质管线埋深
" + - "" + - "" + - "" + - "" + - "
"; - webBrowser1.DocumentText = htmlCode; - - - } - /// - /// 图表鼠标单击事件处理 - /// - /// - /// - private void chart1_MouseClick(object sender, MouseEventArgs e) - { - HitTestResult result = chart1.HitTest(e.X, e.Y, true); - if (result.PointIndex >= 0) - { - DataPoint p = (DataPoint)result.Object; - if (p == null) - { - return; - } - string number = p.LegendText; - int indexInTableRows = 0; - bool isInt = int.TryParse(number, out indexInTableRows); - if (isInt) - { - DataRow row = table.Rows[indexInTableRows - 1]; - string htmlCode = "" + - "" + - "" + - "
管线类型管线编码管径_毫米材质管线埋深
" + row[1] + - "" + row[2] + - "" + row[3] + - "" + row[4] + - "" + row[5] + - "
"; - webBrowser1.DocumentText = htmlCode; - } - } - } - /// - /// 窗体关闭事件处理 - /// - /// - /// - private void FrmRoadHDM_FormClosing(object sender, FormClosingEventArgs e) - { - allPipelineAnalysis = null; - globeControl1.Globe.MemoryLayer.RemoveAllFeature(); - } - /// - /// 图表鼠标移动事件处理 - /// - /// - /// - private void chart1_MouseMove(object sender, MouseEventArgs e) - { - HitTestResult result = chart1.HitTest(e.X, e.Y, true); - if (result.PointIndex >= 0) - { - this.Cursor = Cursors.Hand; - } - else - { - this.Cursor = Cursors.Default; - } - } - - private void Export(GSOPoint3d _pnt, double r) - { - GSOPoint3ds pnts = new GSOPoint3ds(); - GSOPoint3d pnt = new GSOPoint3d(); - pnt.X = _pnt.X; - pnt.Y = _pnt.Y; - pnt.Z = _pnt.Z; - pnts.Add(pnt); - pnt.X = _pnt.X; - pnt.Y = _pnt.Y - 0.0000000005; - pnt.Z = _pnt.Z; - pnts.Add(pnt); - GSOGeoPolyline3D line = new GSOGeoPolyline3D(); - line.AddPart(pnts); - GSOGeoPolygon3D polygon = line.CreateBuffer(r * 2, true, 5, true, false); - GSOPoint3ds points = polygon[0]; - GSOGeoPolyline3D newLine = new GSOGeoPolyline3D(); - newLine.AddPart(points); - newLine.AltitudeMode = EnumAltitudeMode.RelativeToGround; - GSOFeature newFeature = new GSOFeature(); - newFeature.Geometry = newLine; - globeControl1.Globe.MemoryLayer.AddFeature(newFeature); - } - - private void ExportCAD(double a, double b, double r) - { - GSOPoint3ds pnts = new GSOPoint3ds(); - for (int i = 0; i <= 64; i++) - { - double x = a + r * Math.Cos(i * 5.625 * Math.PI / 180); - double y = b - r * Math.Sin(i * 5.625 * Math.PI / 180); - GSOPoint2d pt2d = new GeoScene.Data.GSOPoint2d(x, y); - GSOPoint3d pnt = new GSOPoint3d(); - pnt.X = pt2d.X; - pnt.Y = pt2d.Y; - pnt.Z = 0; - pnts.Add(pnt); - } - GSOGeoPolyline3D line = new GSOGeoPolyline3D(); - line.AddPart(pnts); - GSOFeature f = new GSOFeature(); - f.Geometry = line; - f.Geometry.LatLonCoord = false; - f.Visible = false; - layerTemp.AddFeature(f); - } - /// - /// 导出CAD按钮事件处理 - /// - /// - /// - private void btnExportCAD_Click(object sender, EventArgs e) - { - layerTemp.RemoveAllFeature(); - for (int i = 0; i < listPoint.Count; i++) - { - GSOPoint3d geoPoint = (GSOPoint3d)listPoint[i]; - GSOFeature feature = listFeat[i] as GSOFeature; - if (feature != null) - { - if (feature.Geometry.Type == EnumGeometryType.GeoPolyline3D) - { - GSOPipeLineStyle3D style = feature.Geometry.Style as GSOPipeLineStyle3D; - double r = style.Radius; - ExportCAD(double.Parse(sortIndex[i, 0].ToString()), geoPoint.Z, r); - } - } - } - layerTemp.Dataset.ImportProjectionRefFromProj4(""); - SaveFileDialog dlg = new SaveFileDialog(); - dlg.Filter = "*.dxf|*.dxf"; - if (dlg.ShowDialog() == DialogResult.OK) - { - layerTemp.SaveAs(dlg.FileName); - MessageBox.Show("导出CAD完成!", "提示"); - } - layerTemp.RemoveAllFeature(); - } - } -} diff --git a/FrmRoadHDM.designer.cs b/FrmRoadHDM.designer.cs deleted file mode 100644 index 23a4c3b..0000000 --- a/FrmRoadHDM.designer.cs +++ /dev/null @@ -1,132 +0,0 @@ -namespace Cyberpipe -{ - partial class FrmRoadHDM - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmRoadHDM)); - System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea1 = new System.Windows.Forms.DataVisualization.Charting.ChartArea(); - System.Windows.Forms.DataVisualization.Charting.Series series1 = new System.Windows.Forms.DataVisualization.Charting.Series(); - this.pictureBox1 = new System.Windows.Forms.PictureBox(); - this.webBrowser1 = new System.Windows.Forms.WebBrowser(); - this.chart1 = new System.Windows.Forms.DataVisualization.Charting.Chart(); - this.btnExportCAD = new DevComponents.DotNetBar.ButtonX(); - ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.chart1)).BeginInit(); - this.SuspendLayout(); - // - // pictureBox1 - // - this.pictureBox1.BackColor = System.Drawing.Color.White; - this.pictureBox1.Dock = System.Windows.Forms.DockStyle.Top; - this.pictureBox1.ErrorImage = null; - this.pictureBox1.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image"))); - this.pictureBox1.ImageLocation = ""; - this.pictureBox1.Location = new System.Drawing.Point(0, 0); - this.pictureBox1.Name = "pictureBox1"; - this.pictureBox1.Size = new System.Drawing.Size(608, 64); - this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; - this.pictureBox1.TabIndex = 1; - this.pictureBox1.TabStop = false; - // - // webBrowser1 - // - this.webBrowser1.Dock = System.Windows.Forms.DockStyle.Bottom; - this.webBrowser1.Location = new System.Drawing.Point(0, 326); - this.webBrowser1.MinimumSize = new System.Drawing.Size(20, 20); - this.webBrowser1.Name = "webBrowser1"; - this.webBrowser1.ScrollBarsEnabled = false; - this.webBrowser1.Size = new System.Drawing.Size(608, 139); - this.webBrowser1.TabIndex = 3; - // - // chart1 - // - chartArea1.AxisX.MajorGrid.Enabled = false; - chartArea1.Name = "ChartArea1"; - this.chart1.ChartAreas.Add(chartArea1); - this.chart1.Location = new System.Drawing.Point(0, 66); - this.chart1.Name = "chart1"; - this.chart1.RightToLeft = System.Windows.Forms.RightToLeft.Yes; - series1.ChartArea = "ChartArea1"; - series1.Name = "管线"; - this.chart1.Series.Add(series1); - this.chart1.Size = new System.Drawing.Size(608, 254); - this.chart1.TabIndex = 2; - this.chart1.Text = "chart1"; - this.chart1.MouseClick += new System.Windows.Forms.MouseEventHandler(this.chart1_MouseClick); - this.chart1.MouseMove += new System.Windows.Forms.MouseEventHandler(this.chart1_MouseMove); - // - // btnExportCAD - // - this.btnExportCAD.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; - this.btnExportCAD.Anchor = System.Windows.Forms.AnchorStyles.Bottom; - this.btnExportCAD.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground; - this.btnExportCAD.Location = new System.Drawing.Point(268, 430); - this.btnExportCAD.Name = "btnExportCAD"; - this.btnExportCAD.Size = new System.Drawing.Size(75, 23); - this.btnExportCAD.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; - this.btnExportCAD.TabIndex = 4; - this.btnExportCAD.Text = "导出CAD"; - this.btnExportCAD.Click += new System.EventHandler(this.btnExportCAD_Click); - // - // FrmRoadHDM - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.BackColor = System.Drawing.Color.White; - this.ClientSize = new System.Drawing.Size(608, 465); - this.Controls.Add(this.btnExportCAD); - this.Controls.Add(this.chart1); - this.Controls.Add(this.webBrowser1); - this.Controls.Add(this.pictureBox1); - this.DoubleBuffered = true; - this.EnableGlass = false; - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; - this.MaximizeBox = false; - this.Name = "FrmRoadHDM"; - this.ShowIcon = false; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; - this.Text = "道路与管线综合横断面"; - this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FrmRoadHDM_FormClosing); - this.Load += new System.EventHandler(this.FrmRoadHDM_Load); - this.Shown += new System.EventHandler(this.FrmRoadHDM_Shown); - ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.chart1)).EndInit(); - this.ResumeLayout(false); - - } - - #endregion - - private System.Windows.Forms.PictureBox pictureBox1; - private System.Windows.Forms.WebBrowser webBrowser1; - private System.Windows.Forms.DataVisualization.Charting.Chart chart1; - private DevComponents.DotNetBar.ButtonX btnExportCAD; - - - } -} \ No newline at end of file diff --git a/Cyberpipe.csproj b/Cyberpipe.csproj index d24ccfc..cd0296f 100644 --- a/Cyberpipe.csproj +++ b/Cyberpipe.csproj @@ -228,6 +228,7 @@ F_GKT1添加项目.cs
+ @@ -938,12 +939,6 @@ FrmRESCMgr.cs - - Form - - - FrmRoadHDM.cs - Form @@ -1166,6 +1161,7 @@ + @@ -1611,10 +1607,6 @@ FrmRESCMgr.cs Designer - - FrmRoadHDM.cs - Designer - FrmRole.cs Designer diff --git a/EnumEventMode.cs b/EnumEventMode.cs new file mode 100644 index 0000000..b5eba59 --- /dev/null +++ b/EnumEventMode.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace Cyberpipe +{ + //横断面分析、基线剖面分析、道路断面分析 + public enum EnumTrackPolylineEndMode + { + Default_Analysis = 0, //无分析 + HDM_Analysis = 1, //横断面分析 + DLDM_Analysis = 2,//道路断面分析 + JXPM_Analysis = 3, //基线剖面分析 + } + + class EnumEventMode + { + } +} diff --git a/FrmHDMAnalysis3.cs b/FrmHDMAnalysis3.cs index 5e5988c..6405ed7 100644 --- a/FrmHDMAnalysis3.cs +++ b/FrmHDMAnalysis3.cs @@ -16,206 +16,72 @@ { public partial class FrmHDMAnalysis3 : DevComponents.DotNetBar.Office2007Form { - private ArrayList listPoint = new ArrayList(); - private ArrayList listFeat = new ArrayList(); - GSOGeoPolyline3D line = new GSOGeoPolyline3D(); //创建线对象 - - private static FrmHDMAnalysis3 allPipelineAnalysis = null; - public bool isShowFirst = false; - - static ArrayList list = new ArrayList(); + static DataTable table = new DataTable(); - static DataTable showTable = new DataTable(); GSOGlobeControl globeControl1; - object[,] sortIndex; - GSOLayer layerTemp; - private FrmHDMAnalysis3() - { - - } - public static FrmHDMAnalysis3 GetForm(ArrayList arraylistP, ArrayList arraylistF, GSOGeoPolyline3D _line, GSOGlobeControl _ctl) - { - if (allPipelineAnalysis == null) - { - allPipelineAnalysis = new FrmHDMAnalysis3(arraylistP, arraylistF, _line,_ctl); - } - else - { - allPipelineAnalysis.listPoint = arraylistP; - allPipelineAnalysis.listFeat = arraylistF; - allPipelineAnalysis.line = _line; - allPipelineAnalysis.globeControl1 = _ctl; - list = new ArrayList(); - } - return allPipelineAnalysis; - } + EnumTrackPolylineEndMode mode; - public FrmHDMAnalysis3(ArrayList arraylistP, ArrayList arraylistF, GSOGeoPolyline3D _line,GSOGlobeControl _ctl) + Dictionary hdmDic; + + public FrmHDMAnalysis3(Dictionary hdmDic, + GSOGlobeControl globeControl, EnumTrackPolylineEndMode mode) { InitializeComponent(); - this.listPoint = arraylistP; - this.listFeat = arraylistF; - line = _line; - globeControl1 = _ctl; + + this.hdmDic = hdmDic; + this.globeControl1 = globeControl; + this.mode = mode; } - double A_x, A_y, B_x, B_y;//定义坐标点,用来就横断面的长度 - /// - /// 窗体初始化事件处理 - /// - /// - /// - private void Frm_HDMAnalysis_Load(object sender, EventArgs e) + + private void initControls() { - layerTemp = globeControl1.Globe.Layers.Add(Application.StartupPath + "\\tempLgdExport.lgd"); - //chart1.ChartAreas[0].BackImage = Application.StartupPath + "\\Resource\\pipelineBackGround副本.png"; - } - /// - /// 窗体第一次显示事件处理 - /// - /// - /// - void Frm_HDMAnalysis2_Shown(object sender, EventArgs e) - { - isShowFirst = true; - - } - public void LoadChartEvent() - { - try - { - this.Shown += new EventHandler(Frm_HDMAnalysis2_Shown); - - chart1.Series["管线"].ChartType = SeriesChartType.Point; - - chart1.Series["管线"]["DrawingStyle"] = "Cylinder"; - chart1.Series["管线"].MarkerStyle = MarkerStyle.Circle; //点的类型 - - chart1.Series["管线"].MarkerBorderColor = Color.Black; //点的边框颜色 - chart1.ChartAreas[0].AxisX.Minimum = 0; //x轴的起始点大小 - chart1.ChartAreas[0].AxisY.Maximum = 0; //y轴的最大值 - - chart1.ChartAreas[0].AxisX.Title = "距离 (米)"; - chart1.ChartAreas[0].AxisY.Title = "埋深 (米)"; - - //chart1.ChartAreas[0].AxisX.ScrollBar.Enabled = true; - chart1.ChartAreas[0].AxisY2.Title = "高程 (米)"; - double[] depths = new double[listFeat.Count]; - for (int i = 0; i < listFeat.Count; i++) - { - GSOFeature f = listFeat[i] as GSOFeature; - double depth = f.GetFieldAsDouble("起始地面高程"); - depths[i] = depth; - } - double max_Depth = depths[0]; - for (int i = 0; i < listFeat.Count; i++) - { - if (max_Depth < depths[i]) - { - max_Depth = depths[i]; - } - } - chart1.ChartAreas[0].AxisY2.CustomLabels.Clear(); - chart1.ChartAreas[0].AxisY2.CustomLabels.Add(-5.4d, -5.6d, (max_Depth - 5.5).ToString("0.0")); - chart1.ChartAreas[0].AxisY2.CustomLabels.Add(-4.9d, -5.1d, (max_Depth - 5).ToString("0.0")); - chart1.ChartAreas[0].AxisY2.CustomLabels.Add(-4.4d, -4.6d, (max_Depth - 4.5).ToString("0.0")); - chart1.ChartAreas[0].AxisY2.CustomLabels.Add(-3.9d, -4.1d, (max_Depth - 4).ToString("0.0")); - chart1.ChartAreas[0].AxisY2.CustomLabels.Add(-3.4d, -3.6d, (max_Depth - 3.5).ToString("0.0")); - chart1.ChartAreas[0].AxisY2.CustomLabels.Add(-2.9d, -3.1d, (max_Depth - 3).ToString("0.0")); - chart1.ChartAreas[0].AxisY2.CustomLabels.Add(-2.4d, -2.6d, (max_Depth - 2.5).ToString("0.0")); - chart1.ChartAreas[0].AxisY2.CustomLabels.Add(-1.9d, -2.1d, (max_Depth - 2).ToString("0.0")); - chart1.ChartAreas[0].AxisY2.CustomLabels.Add(-1.4d, -1.6d, (max_Depth - 1.5).ToString("0.0")); - chart1.ChartAreas[0].AxisY2.CustomLabels.Add(-0.9d, -1.1d, (max_Depth - 1).ToString("0.0")); - chart1.ChartAreas[0].AxisY2.CustomLabels.Add(-0.4d, -0.6d, (max_Depth - 0.5).ToString("0.0")); - chart1.ChartAreas[0].AxisY2.CustomLabels.Add(-0.1d, 0.1d, max_Depth.ToString("0.0")); - - if (line.PartCount > 0) - { - GSOPoint3ds nodes = line[0]; - if (nodes.Count > 0) - { - GSOPoint3d node = nodes[0]; - A_x = node.X; - A_y = node.Y; - } - } - - DrawCurveGraph(A_x, A_y); - } - catch (Exception ex) - { - LogError.PublishError(ex); - } - } - - /// - /// 创建图表 - /// - /// - /// - private void DrawCurveGraph(double a_x,double a_y) - { - // 遍历线,求距离 - table = new DataTable(); - //showTable.Columns.Clear(); - list.Clear(); + chart1.Series["管线"].ChartType = SeriesChartType.Point; + chart1.Series["管线"]["DrawingStyle"] = "Cylinder"; + chart1.Series["管线"].MarkerStyle = MarkerStyle.Circle; //点的类型 + chart1.Series["管线"].MarkerBorderColor = Color.Black; //点的边框颜色 + //chart1.ChartAreas[0].AxisX.Minimum = 0; //x轴的起始点大小 + chart1.ChartAreas[0].AxisY.Maximum = 0; //y轴的最大值 + chart1.ChartAreas[0].AxisX.Title = "距离 (米)"; + chart1.ChartAreas[0].AxisY.Title = "埋深 (米)"; + chart1.ChartAreas[0].AxisY2.Title = "高程 (米)"; chart1.Series["管线"].Points.Clear(); - chart1.ChartAreas[0].AxisX.Maximum = Math.Round(line.GetSpaceLength(true, 6378137),2); + //chart1.ChartAreas[0].AxisX.Maximum = Math.Round(line.GetSpaceLength(true, 6378137), 2); + table.Columns.Add("编号", typeof(string)); table.Columns.Add("管线类型", typeof(string)); table.Columns.Add("管线编码", typeof(string)); table.Columns.Add("管径_毫米", typeof(string)); table.Columns.Add("材质", typeof(string)); - table.Columns.Add("管线埋深", typeof(string)); + table.Columns.Add("管线埋深", typeof(string)); - sortIndex = new object[listPoint.Count, 2]; - for (int i = 0; i <= listPoint.Count; i++) + if (mode == EnumTrackPolylineEndMode.DLDM_Analysis) { - if (i == listPoint.Count) - { - double maxNum = 0.0; - for (int j = 0; j < listPoint.Count; j++) - { - if (maxNum < Convert.ToDouble(sortIndex[j, 0])) - { - maxNum = Convert.ToDouble(sortIndex[j, 0]); - } - } - chart1.Series["管线"].Points.AddXY(maxNum + 2, 0); - chart1.Series["管线"].Points[i].MarkerBorderWidth = 100; //边框的宽度 - chart1.Series["管线"].Points[i].MarkerColor = Color.Black; - chart1.Series["管线"].Points[i].MarkerSize = 100; - continue; - } - GSOPoint3d geoPoint = (GSOPoint3d)listPoint[i]; - GSOFeature feature = listFeat[i] as GSOFeature; - //坐标投影 - int id = GeoScene.Data.GSOProjectManager.AddProject(Utility.projectStr); + this.pictureBox1.Visible = true; + } + else + { + this.pictureBox1.Visible = false; + } + } - GeoScene.Data.GSOPoint2d a_Point = GeoScene.Data.GSOProjectManager.Forward(new GSOPoint2d(a_x, a_y), id);//user画的线的起始点 + private void draw() + { + int i = 0; + foreach (KeyValuePair kvp in this.hdmDic) + { + GSOFeature feature = kvp.Key; + HDMCoordinate coor = kvp.Value; - GeoScene.Data.GSOPoint2d pt2d = new GeoScene.Data.GSOPoint2d(geoPoint.X, geoPoint.Y); - GeoScene.Data.GSOPoint2d result = GeoScene.Data.GSOProjectManager.Forward(pt2d, id); - B_x = result.X; - B_y = result.Y; + chart1.Series["管线"].Points.AddXY(coor.Dis, coor.Z);//绑定数据 - double x = System.Math.Abs(B_x - a_Point.X); - double y = System.Math.Abs(B_y - a_Point.Y); - double Dis = 0.0; - Dis = Math.Round(Math.Sqrt(x * x + y * y) , 2); - list.Add(geoPoint.Z); - sortIndex[i, 0] = Dis; - sortIndex[i, 1] = i; - - chart1.Series["管线"].Points.AddXY(Dis, geoPoint.Z);//绑定数据 - - string pipeType = feature.Dataset == null ? "" : feature.Dataset.Caption; + string pipeType = feature.Dataset == null ? "" : feature.Dataset.Caption; string number = Convert.ToString(i + 1); - string material = feature.GetFieldAsString("材质"); string diameter = feature.GetFieldAsString("管径_毫米"); - table.Rows.Add(new object[] { number, pipeType, feature.Name.ToString(), diameter, material,Convert.ToDecimal(list[i].ToString()).ToString("f2")});//list[i].ToString().Substring(0,list[i].ToString().IndexOf('.')+3) } - - //chart1.Series["管线"].Points[i].Label = number;//管线的标签 + table.Rows.Add(new object[] { number, + pipeType, feature.Name.ToString(), + diameter, material, + Convert.ToDecimal(coor.Z).ToString("f2") }); chart1.Series["管线"].Points[i].LegendText = number; if (feature.Geometry.Style.GetType() == typeof(GSOPipeLineStyle3D)) { @@ -229,47 +95,12 @@ chart1.Series["管线"].Points[i].MarkerBorderWidth = 3; //边框的宽度 chart1.Series["管线"].Points[i].MarkerColor = Color.Transparent; - chart1.Series["管线"].Points[i].MarkerSize = Convert.ToInt32(Math.Floor((feature.GetFieldAsDouble("管径_毫米") / 0.35 + chart1.Series["管线"].Points[i].MarkerBorderWidth) / 100.0));//点的大小 - + chart1.Series["管线"].Points[i].MarkerSize = Convert.ToInt32(Math.Floor((feature.GetFieldAsDouble("管径_毫米") / 0.35 + + chart1.Series["管线"].Points[i].MarkerBorderWidth) / 100.0)); + i++; } - - string htmlCode = "" + - "" + - "" + - "
管线类型管线编码管径_毫米材质管线埋深
" + - "" + - "" + - "" + - "" + - "
"; - webBrowser1.DocumentText = htmlCode; } + /// /// 图表的鼠标单击事件处理 /// @@ -286,14 +117,11 @@ return; } string number = p.LegendText; - //MessageBox.Show(number); int indexInTableRows = 0; bool isInt = int.TryParse(number, out indexInTableRows); if (isInt) { DataRow row = table.Rows[indexInTableRows - 1]; - //showTable.Rows.Clear(); - //showTable.Rows.Add(new object[] { row[0], row[1], row[2], row[3], row[4], row[5] }); string htmlCode = "" + - "" + - "" + - "
管线类型管线编码管径_毫米材质管线埋深
" + - "" + - "" + - "" + - "" + - "
"; - webBrowser1.DocumentText = htmlCode; - - - } - /// - /// 图表鼠标单击事件处理 - /// - /// - /// - private void chart1_MouseClick(object sender, MouseEventArgs e) - { - HitTestResult result = chart1.HitTest(e.X, e.Y, true); - if (result.PointIndex >= 0) - { - DataPoint p = (DataPoint)result.Object; - if (p == null) - { - return; - } - string number = p.LegendText; - int indexInTableRows = 0; - bool isInt = int.TryParse(number, out indexInTableRows); - if (isInt) - { - DataRow row = table.Rows[indexInTableRows - 1]; - string htmlCode = "" + - "" + - "" + - "
管线类型管线编码管径_毫米材质管线埋深
" + row[1] + - "" + row[2] + - "" + row[3] + - "" + row[4] + - "" + row[5] + - "
"; - webBrowser1.DocumentText = htmlCode; - } - } - } - /// - /// 窗体关闭事件处理 - /// - /// - /// - private void FrmRoadHDM_FormClosing(object sender, FormClosingEventArgs e) - { - allPipelineAnalysis = null; - globeControl1.Globe.MemoryLayer.RemoveAllFeature(); - } - /// - /// 图表鼠标移动事件处理 - /// - /// - /// - private void chart1_MouseMove(object sender, MouseEventArgs e) - { - HitTestResult result = chart1.HitTest(e.X, e.Y, true); - if (result.PointIndex >= 0) - { - this.Cursor = Cursors.Hand; - } - else - { - this.Cursor = Cursors.Default; - } - } - - private void Export(GSOPoint3d _pnt, double r) - { - GSOPoint3ds pnts = new GSOPoint3ds(); - GSOPoint3d pnt = new GSOPoint3d(); - pnt.X = _pnt.X; - pnt.Y = _pnt.Y; - pnt.Z = _pnt.Z; - pnts.Add(pnt); - pnt.X = _pnt.X; - pnt.Y = _pnt.Y - 0.0000000005; - pnt.Z = _pnt.Z; - pnts.Add(pnt); - GSOGeoPolyline3D line = new GSOGeoPolyline3D(); - line.AddPart(pnts); - GSOGeoPolygon3D polygon = line.CreateBuffer(r * 2, true, 5, true, false); - GSOPoint3ds points = polygon[0]; - GSOGeoPolyline3D newLine = new GSOGeoPolyline3D(); - newLine.AddPart(points); - newLine.AltitudeMode = EnumAltitudeMode.RelativeToGround; - GSOFeature newFeature = new GSOFeature(); - newFeature.Geometry = newLine; - globeControl1.Globe.MemoryLayer.AddFeature(newFeature); - } - - private void ExportCAD(double a, double b, double r) - { - GSOPoint3ds pnts = new GSOPoint3ds(); - for (int i = 0; i <= 64; i++) - { - double x = a + r * Math.Cos(i * 5.625 * Math.PI / 180); - double y = b - r * Math.Sin(i * 5.625 * Math.PI / 180); - GSOPoint2d pt2d = new GeoScene.Data.GSOPoint2d(x, y); - GSOPoint3d pnt = new GSOPoint3d(); - pnt.X = pt2d.X; - pnt.Y = pt2d.Y; - pnt.Z = 0; - pnts.Add(pnt); - } - GSOGeoPolyline3D line = new GSOGeoPolyline3D(); - line.AddPart(pnts); - GSOFeature f = new GSOFeature(); - f.Geometry = line; - f.Geometry.LatLonCoord = false; - f.Visible = false; - layerTemp.AddFeature(f); - } - /// - /// 导出CAD按钮事件处理 - /// - /// - /// - private void btnExportCAD_Click(object sender, EventArgs e) - { - layerTemp.RemoveAllFeature(); - for (int i = 0; i < listPoint.Count; i++) - { - GSOPoint3d geoPoint = (GSOPoint3d)listPoint[i]; - GSOFeature feature = listFeat[i] as GSOFeature; - if (feature != null) - { - if (feature.Geometry.Type == EnumGeometryType.GeoPolyline3D) - { - GSOPipeLineStyle3D style = feature.Geometry.Style as GSOPipeLineStyle3D; - double r = style.Radius; - ExportCAD(double.Parse(sortIndex[i, 0].ToString()), geoPoint.Z, r); - } - } - } - layerTemp.Dataset.ImportProjectionRefFromProj4(""); - SaveFileDialog dlg = new SaveFileDialog(); - dlg.Filter = "*.dxf|*.dxf"; - if (dlg.ShowDialog() == DialogResult.OK) - { - layerTemp.SaveAs(dlg.FileName); - MessageBox.Show("导出CAD完成!", "提示"); - } - layerTemp.RemoveAllFeature(); - } - } -} diff --git a/FrmRoadHDM.designer.cs b/FrmRoadHDM.designer.cs deleted file mode 100644 index 23a4c3b..0000000 --- a/FrmRoadHDM.designer.cs +++ /dev/null @@ -1,132 +0,0 @@ -namespace Cyberpipe -{ - partial class FrmRoadHDM - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmRoadHDM)); - System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea1 = new System.Windows.Forms.DataVisualization.Charting.ChartArea(); - System.Windows.Forms.DataVisualization.Charting.Series series1 = new System.Windows.Forms.DataVisualization.Charting.Series(); - this.pictureBox1 = new System.Windows.Forms.PictureBox(); - this.webBrowser1 = new System.Windows.Forms.WebBrowser(); - this.chart1 = new System.Windows.Forms.DataVisualization.Charting.Chart(); - this.btnExportCAD = new DevComponents.DotNetBar.ButtonX(); - ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.chart1)).BeginInit(); - this.SuspendLayout(); - // - // pictureBox1 - // - this.pictureBox1.BackColor = System.Drawing.Color.White; - this.pictureBox1.Dock = System.Windows.Forms.DockStyle.Top; - this.pictureBox1.ErrorImage = null; - this.pictureBox1.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image"))); - this.pictureBox1.ImageLocation = ""; - this.pictureBox1.Location = new System.Drawing.Point(0, 0); - this.pictureBox1.Name = "pictureBox1"; - this.pictureBox1.Size = new System.Drawing.Size(608, 64); - this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; - this.pictureBox1.TabIndex = 1; - this.pictureBox1.TabStop = false; - // - // webBrowser1 - // - this.webBrowser1.Dock = System.Windows.Forms.DockStyle.Bottom; - this.webBrowser1.Location = new System.Drawing.Point(0, 326); - this.webBrowser1.MinimumSize = new System.Drawing.Size(20, 20); - this.webBrowser1.Name = "webBrowser1"; - this.webBrowser1.ScrollBarsEnabled = false; - this.webBrowser1.Size = new System.Drawing.Size(608, 139); - this.webBrowser1.TabIndex = 3; - // - // chart1 - // - chartArea1.AxisX.MajorGrid.Enabled = false; - chartArea1.Name = "ChartArea1"; - this.chart1.ChartAreas.Add(chartArea1); - this.chart1.Location = new System.Drawing.Point(0, 66); - this.chart1.Name = "chart1"; - this.chart1.RightToLeft = System.Windows.Forms.RightToLeft.Yes; - series1.ChartArea = "ChartArea1"; - series1.Name = "管线"; - this.chart1.Series.Add(series1); - this.chart1.Size = new System.Drawing.Size(608, 254); - this.chart1.TabIndex = 2; - this.chart1.Text = "chart1"; - this.chart1.MouseClick += new System.Windows.Forms.MouseEventHandler(this.chart1_MouseClick); - this.chart1.MouseMove += new System.Windows.Forms.MouseEventHandler(this.chart1_MouseMove); - // - // btnExportCAD - // - this.btnExportCAD.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; - this.btnExportCAD.Anchor = System.Windows.Forms.AnchorStyles.Bottom; - this.btnExportCAD.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground; - this.btnExportCAD.Location = new System.Drawing.Point(268, 430); - this.btnExportCAD.Name = "btnExportCAD"; - this.btnExportCAD.Size = new System.Drawing.Size(75, 23); - this.btnExportCAD.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; - this.btnExportCAD.TabIndex = 4; - this.btnExportCAD.Text = "导出CAD"; - this.btnExportCAD.Click += new System.EventHandler(this.btnExportCAD_Click); - // - // FrmRoadHDM - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.BackColor = System.Drawing.Color.White; - this.ClientSize = new System.Drawing.Size(608, 465); - this.Controls.Add(this.btnExportCAD); - this.Controls.Add(this.chart1); - this.Controls.Add(this.webBrowser1); - this.Controls.Add(this.pictureBox1); - this.DoubleBuffered = true; - this.EnableGlass = false; - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; - this.MaximizeBox = false; - this.Name = "FrmRoadHDM"; - this.ShowIcon = false; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; - this.Text = "道路与管线综合横断面"; - this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FrmRoadHDM_FormClosing); - this.Load += new System.EventHandler(this.FrmRoadHDM_Load); - this.Shown += new System.EventHandler(this.FrmRoadHDM_Shown); - ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.chart1)).EndInit(); - this.ResumeLayout(false); - - } - - #endregion - - private System.Windows.Forms.PictureBox pictureBox1; - private System.Windows.Forms.WebBrowser webBrowser1; - private System.Windows.Forms.DataVisualization.Charting.Chart chart1; - private DevComponents.DotNetBar.ButtonX btnExportCAD; - - - } -} \ No newline at end of file diff --git a/FrmRoadHDM.resx b/FrmRoadHDM.resx deleted file mode 100644 index 5202d5f..0000000 --- a/FrmRoadHDM.resx +++ /dev/null @@ -1,177 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - - - 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 - iNKUe3NRsLcAAAAASUVORK5CYII= - - - \ No newline at end of file diff --git a/Cyberpipe.csproj b/Cyberpipe.csproj index d24ccfc..cd0296f 100644 --- a/Cyberpipe.csproj +++ b/Cyberpipe.csproj @@ -228,6 +228,7 @@ F_GKT1添加项目.cs
+ @@ -938,12 +939,6 @@ FrmRESCMgr.cs - - Form - - - FrmRoadHDM.cs - Form @@ -1166,6 +1161,7 @@ + @@ -1611,10 +1607,6 @@ FrmRESCMgr.cs Designer - - FrmRoadHDM.cs - Designer - FrmRole.cs Designer diff --git a/EnumEventMode.cs b/EnumEventMode.cs new file mode 100644 index 0000000..b5eba59 --- /dev/null +++ b/EnumEventMode.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace Cyberpipe +{ + //横断面分析、基线剖面分析、道路断面分析 + public enum EnumTrackPolylineEndMode + { + Default_Analysis = 0, //无分析 + HDM_Analysis = 1, //横断面分析 + DLDM_Analysis = 2,//道路断面分析 + JXPM_Analysis = 3, //基线剖面分析 + } + + class EnumEventMode + { + } +} diff --git a/FrmHDMAnalysis3.cs b/FrmHDMAnalysis3.cs index 5e5988c..6405ed7 100644 --- a/FrmHDMAnalysis3.cs +++ b/FrmHDMAnalysis3.cs @@ -16,206 +16,72 @@ { public partial class FrmHDMAnalysis3 : DevComponents.DotNetBar.Office2007Form { - private ArrayList listPoint = new ArrayList(); - private ArrayList listFeat = new ArrayList(); - GSOGeoPolyline3D line = new GSOGeoPolyline3D(); //创建线对象 - - private static FrmHDMAnalysis3 allPipelineAnalysis = null; - public bool isShowFirst = false; - - static ArrayList list = new ArrayList(); + static DataTable table = new DataTable(); - static DataTable showTable = new DataTable(); GSOGlobeControl globeControl1; - object[,] sortIndex; - GSOLayer layerTemp; - private FrmHDMAnalysis3() - { - - } - public static FrmHDMAnalysis3 GetForm(ArrayList arraylistP, ArrayList arraylistF, GSOGeoPolyline3D _line, GSOGlobeControl _ctl) - { - if (allPipelineAnalysis == null) - { - allPipelineAnalysis = new FrmHDMAnalysis3(arraylistP, arraylistF, _line,_ctl); - } - else - { - allPipelineAnalysis.listPoint = arraylistP; - allPipelineAnalysis.listFeat = arraylistF; - allPipelineAnalysis.line = _line; - allPipelineAnalysis.globeControl1 = _ctl; - list = new ArrayList(); - } - return allPipelineAnalysis; - } + EnumTrackPolylineEndMode mode; - public FrmHDMAnalysis3(ArrayList arraylistP, ArrayList arraylistF, GSOGeoPolyline3D _line,GSOGlobeControl _ctl) + Dictionary hdmDic; + + public FrmHDMAnalysis3(Dictionary hdmDic, + GSOGlobeControl globeControl, EnumTrackPolylineEndMode mode) { InitializeComponent(); - this.listPoint = arraylistP; - this.listFeat = arraylistF; - line = _line; - globeControl1 = _ctl; + + this.hdmDic = hdmDic; + this.globeControl1 = globeControl; + this.mode = mode; } - double A_x, A_y, B_x, B_y;//定义坐标点,用来就横断面的长度 - /// - /// 窗体初始化事件处理 - /// - /// - /// - private void Frm_HDMAnalysis_Load(object sender, EventArgs e) + + private void initControls() { - layerTemp = globeControl1.Globe.Layers.Add(Application.StartupPath + "\\tempLgdExport.lgd"); - //chart1.ChartAreas[0].BackImage = Application.StartupPath + "\\Resource\\pipelineBackGround副本.png"; - } - /// - /// 窗体第一次显示事件处理 - /// - /// - /// - void Frm_HDMAnalysis2_Shown(object sender, EventArgs e) - { - isShowFirst = true; - - } - public void LoadChartEvent() - { - try - { - this.Shown += new EventHandler(Frm_HDMAnalysis2_Shown); - - chart1.Series["管线"].ChartType = SeriesChartType.Point; - - chart1.Series["管线"]["DrawingStyle"] = "Cylinder"; - chart1.Series["管线"].MarkerStyle = MarkerStyle.Circle; //点的类型 - - chart1.Series["管线"].MarkerBorderColor = Color.Black; //点的边框颜色 - chart1.ChartAreas[0].AxisX.Minimum = 0; //x轴的起始点大小 - chart1.ChartAreas[0].AxisY.Maximum = 0; //y轴的最大值 - - chart1.ChartAreas[0].AxisX.Title = "距离 (米)"; - chart1.ChartAreas[0].AxisY.Title = "埋深 (米)"; - - //chart1.ChartAreas[0].AxisX.ScrollBar.Enabled = true; - chart1.ChartAreas[0].AxisY2.Title = "高程 (米)"; - double[] depths = new double[listFeat.Count]; - for (int i = 0; i < listFeat.Count; i++) - { - GSOFeature f = listFeat[i] as GSOFeature; - double depth = f.GetFieldAsDouble("起始地面高程"); - depths[i] = depth; - } - double max_Depth = depths[0]; - for (int i = 0; i < listFeat.Count; i++) - { - if (max_Depth < depths[i]) - { - max_Depth = depths[i]; - } - } - chart1.ChartAreas[0].AxisY2.CustomLabels.Clear(); - chart1.ChartAreas[0].AxisY2.CustomLabels.Add(-5.4d, -5.6d, (max_Depth - 5.5).ToString("0.0")); - chart1.ChartAreas[0].AxisY2.CustomLabels.Add(-4.9d, -5.1d, (max_Depth - 5).ToString("0.0")); - chart1.ChartAreas[0].AxisY2.CustomLabels.Add(-4.4d, -4.6d, (max_Depth - 4.5).ToString("0.0")); - chart1.ChartAreas[0].AxisY2.CustomLabels.Add(-3.9d, -4.1d, (max_Depth - 4).ToString("0.0")); - chart1.ChartAreas[0].AxisY2.CustomLabels.Add(-3.4d, -3.6d, (max_Depth - 3.5).ToString("0.0")); - chart1.ChartAreas[0].AxisY2.CustomLabels.Add(-2.9d, -3.1d, (max_Depth - 3).ToString("0.0")); - chart1.ChartAreas[0].AxisY2.CustomLabels.Add(-2.4d, -2.6d, (max_Depth - 2.5).ToString("0.0")); - chart1.ChartAreas[0].AxisY2.CustomLabels.Add(-1.9d, -2.1d, (max_Depth - 2).ToString("0.0")); - chart1.ChartAreas[0].AxisY2.CustomLabels.Add(-1.4d, -1.6d, (max_Depth - 1.5).ToString("0.0")); - chart1.ChartAreas[0].AxisY2.CustomLabels.Add(-0.9d, -1.1d, (max_Depth - 1).ToString("0.0")); - chart1.ChartAreas[0].AxisY2.CustomLabels.Add(-0.4d, -0.6d, (max_Depth - 0.5).ToString("0.0")); - chart1.ChartAreas[0].AxisY2.CustomLabels.Add(-0.1d, 0.1d, max_Depth.ToString("0.0")); - - if (line.PartCount > 0) - { - GSOPoint3ds nodes = line[0]; - if (nodes.Count > 0) - { - GSOPoint3d node = nodes[0]; - A_x = node.X; - A_y = node.Y; - } - } - - DrawCurveGraph(A_x, A_y); - } - catch (Exception ex) - { - LogError.PublishError(ex); - } - } - - /// - /// 创建图表 - /// - /// - /// - private void DrawCurveGraph(double a_x,double a_y) - { - // 遍历线,求距离 - table = new DataTable(); - //showTable.Columns.Clear(); - list.Clear(); + chart1.Series["管线"].ChartType = SeriesChartType.Point; + chart1.Series["管线"]["DrawingStyle"] = "Cylinder"; + chart1.Series["管线"].MarkerStyle = MarkerStyle.Circle; //点的类型 + chart1.Series["管线"].MarkerBorderColor = Color.Black; //点的边框颜色 + //chart1.ChartAreas[0].AxisX.Minimum = 0; //x轴的起始点大小 + chart1.ChartAreas[0].AxisY.Maximum = 0; //y轴的最大值 + chart1.ChartAreas[0].AxisX.Title = "距离 (米)"; + chart1.ChartAreas[0].AxisY.Title = "埋深 (米)"; + chart1.ChartAreas[0].AxisY2.Title = "高程 (米)"; chart1.Series["管线"].Points.Clear(); - chart1.ChartAreas[0].AxisX.Maximum = Math.Round(line.GetSpaceLength(true, 6378137),2); + //chart1.ChartAreas[0].AxisX.Maximum = Math.Round(line.GetSpaceLength(true, 6378137), 2); + table.Columns.Add("编号", typeof(string)); table.Columns.Add("管线类型", typeof(string)); table.Columns.Add("管线编码", typeof(string)); table.Columns.Add("管径_毫米", typeof(string)); table.Columns.Add("材质", typeof(string)); - table.Columns.Add("管线埋深", typeof(string)); + table.Columns.Add("管线埋深", typeof(string)); - sortIndex = new object[listPoint.Count, 2]; - for (int i = 0; i <= listPoint.Count; i++) + if (mode == EnumTrackPolylineEndMode.DLDM_Analysis) { - if (i == listPoint.Count) - { - double maxNum = 0.0; - for (int j = 0; j < listPoint.Count; j++) - { - if (maxNum < Convert.ToDouble(sortIndex[j, 0])) - { - maxNum = Convert.ToDouble(sortIndex[j, 0]); - } - } - chart1.Series["管线"].Points.AddXY(maxNum + 2, 0); - chart1.Series["管线"].Points[i].MarkerBorderWidth = 100; //边框的宽度 - chart1.Series["管线"].Points[i].MarkerColor = Color.Black; - chart1.Series["管线"].Points[i].MarkerSize = 100; - continue; - } - GSOPoint3d geoPoint = (GSOPoint3d)listPoint[i]; - GSOFeature feature = listFeat[i] as GSOFeature; - //坐标投影 - int id = GeoScene.Data.GSOProjectManager.AddProject(Utility.projectStr); + this.pictureBox1.Visible = true; + } + else + { + this.pictureBox1.Visible = false; + } + } - GeoScene.Data.GSOPoint2d a_Point = GeoScene.Data.GSOProjectManager.Forward(new GSOPoint2d(a_x, a_y), id);//user画的线的起始点 + private void draw() + { + int i = 0; + foreach (KeyValuePair kvp in this.hdmDic) + { + GSOFeature feature = kvp.Key; + HDMCoordinate coor = kvp.Value; - GeoScene.Data.GSOPoint2d pt2d = new GeoScene.Data.GSOPoint2d(geoPoint.X, geoPoint.Y); - GeoScene.Data.GSOPoint2d result = GeoScene.Data.GSOProjectManager.Forward(pt2d, id); - B_x = result.X; - B_y = result.Y; + chart1.Series["管线"].Points.AddXY(coor.Dis, coor.Z);//绑定数据 - double x = System.Math.Abs(B_x - a_Point.X); - double y = System.Math.Abs(B_y - a_Point.Y); - double Dis = 0.0; - Dis = Math.Round(Math.Sqrt(x * x + y * y) , 2); - list.Add(geoPoint.Z); - sortIndex[i, 0] = Dis; - sortIndex[i, 1] = i; - - chart1.Series["管线"].Points.AddXY(Dis, geoPoint.Z);//绑定数据 - - string pipeType = feature.Dataset == null ? "" : feature.Dataset.Caption; + string pipeType = feature.Dataset == null ? "" : feature.Dataset.Caption; string number = Convert.ToString(i + 1); - string material = feature.GetFieldAsString("材质"); string diameter = feature.GetFieldAsString("管径_毫米"); - table.Rows.Add(new object[] { number, pipeType, feature.Name.ToString(), diameter, material,Convert.ToDecimal(list[i].ToString()).ToString("f2")});//list[i].ToString().Substring(0,list[i].ToString().IndexOf('.')+3) } - - //chart1.Series["管线"].Points[i].Label = number;//管线的标签 + table.Rows.Add(new object[] { number, + pipeType, feature.Name.ToString(), + diameter, material, + Convert.ToDecimal(coor.Z).ToString("f2") }); chart1.Series["管线"].Points[i].LegendText = number; if (feature.Geometry.Style.GetType() == typeof(GSOPipeLineStyle3D)) { @@ -229,47 +95,12 @@ chart1.Series["管线"].Points[i].MarkerBorderWidth = 3; //边框的宽度 chart1.Series["管线"].Points[i].MarkerColor = Color.Transparent; - chart1.Series["管线"].Points[i].MarkerSize = Convert.ToInt32(Math.Floor((feature.GetFieldAsDouble("管径_毫米") / 0.35 + chart1.Series["管线"].Points[i].MarkerBorderWidth) / 100.0));//点的大小 - + chart1.Series["管线"].Points[i].MarkerSize = Convert.ToInt32(Math.Floor((feature.GetFieldAsDouble("管径_毫米") / 0.35 + + chart1.Series["管线"].Points[i].MarkerBorderWidth) / 100.0)); + i++; } - - string htmlCode = "" + - "" + - "" + - "
管线类型管线编码管径_毫米材质管线埋深
" + - "" + - "" + - "" + - "" + - "
"; - webBrowser1.DocumentText = htmlCode; } + /// /// 图表的鼠标单击事件处理 /// @@ -286,14 +117,11 @@ return; } string number = p.LegendText; - //MessageBox.Show(number); int indexInTableRows = 0; bool isInt = int.TryParse(number, out indexInTableRows); if (isInt) { DataRow row = table.Rows[indexInTableRows - 1]; - //showTable.Rows.Clear(); - //showTable.Rows.Add(new object[] { row[0], row[1], row[2], row[3], row[4], row[5] }); string htmlCode = "" + - "" + - "" + - "
管线类型管线编码管径_毫米材质管线埋深
" + - "" + - "" + - "" + - "" + - "
"; - webBrowser1.DocumentText = htmlCode; - - - } - /// - /// 图表鼠标单击事件处理 - /// - /// - /// - private void chart1_MouseClick(object sender, MouseEventArgs e) - { - HitTestResult result = chart1.HitTest(e.X, e.Y, true); - if (result.PointIndex >= 0) - { - DataPoint p = (DataPoint)result.Object; - if (p == null) - { - return; - } - string number = p.LegendText; - int indexInTableRows = 0; - bool isInt = int.TryParse(number, out indexInTableRows); - if (isInt) - { - DataRow row = table.Rows[indexInTableRows - 1]; - string htmlCode = "" + - "" + - "" + - "
管线类型管线编码管径_毫米材质管线埋深
" + row[1] + - "" + row[2] + - "" + row[3] + - "" + row[4] + - "" + row[5] + - "
"; - webBrowser1.DocumentText = htmlCode; - } - } - } - /// - /// 窗体关闭事件处理 - /// - /// - /// - private void FrmRoadHDM_FormClosing(object sender, FormClosingEventArgs e) - { - allPipelineAnalysis = null; - globeControl1.Globe.MemoryLayer.RemoveAllFeature(); - } - /// - /// 图表鼠标移动事件处理 - /// - /// - /// - private void chart1_MouseMove(object sender, MouseEventArgs e) - { - HitTestResult result = chart1.HitTest(e.X, e.Y, true); - if (result.PointIndex >= 0) - { - this.Cursor = Cursors.Hand; - } - else - { - this.Cursor = Cursors.Default; - } - } - - private void Export(GSOPoint3d _pnt, double r) - { - GSOPoint3ds pnts = new GSOPoint3ds(); - GSOPoint3d pnt = new GSOPoint3d(); - pnt.X = _pnt.X; - pnt.Y = _pnt.Y; - pnt.Z = _pnt.Z; - pnts.Add(pnt); - pnt.X = _pnt.X; - pnt.Y = _pnt.Y - 0.0000000005; - pnt.Z = _pnt.Z; - pnts.Add(pnt); - GSOGeoPolyline3D line = new GSOGeoPolyline3D(); - line.AddPart(pnts); - GSOGeoPolygon3D polygon = line.CreateBuffer(r * 2, true, 5, true, false); - GSOPoint3ds points = polygon[0]; - GSOGeoPolyline3D newLine = new GSOGeoPolyline3D(); - newLine.AddPart(points); - newLine.AltitudeMode = EnumAltitudeMode.RelativeToGround; - GSOFeature newFeature = new GSOFeature(); - newFeature.Geometry = newLine; - globeControl1.Globe.MemoryLayer.AddFeature(newFeature); - } - - private void ExportCAD(double a, double b, double r) - { - GSOPoint3ds pnts = new GSOPoint3ds(); - for (int i = 0; i <= 64; i++) - { - double x = a + r * Math.Cos(i * 5.625 * Math.PI / 180); - double y = b - r * Math.Sin(i * 5.625 * Math.PI / 180); - GSOPoint2d pt2d = new GeoScene.Data.GSOPoint2d(x, y); - GSOPoint3d pnt = new GSOPoint3d(); - pnt.X = pt2d.X; - pnt.Y = pt2d.Y; - pnt.Z = 0; - pnts.Add(pnt); - } - GSOGeoPolyline3D line = new GSOGeoPolyline3D(); - line.AddPart(pnts); - GSOFeature f = new GSOFeature(); - f.Geometry = line; - f.Geometry.LatLonCoord = false; - f.Visible = false; - layerTemp.AddFeature(f); - } - /// - /// 导出CAD按钮事件处理 - /// - /// - /// - private void btnExportCAD_Click(object sender, EventArgs e) - { - layerTemp.RemoveAllFeature(); - for (int i = 0; i < listPoint.Count; i++) - { - GSOPoint3d geoPoint = (GSOPoint3d)listPoint[i]; - GSOFeature feature = listFeat[i] as GSOFeature; - if (feature != null) - { - if (feature.Geometry.Type == EnumGeometryType.GeoPolyline3D) - { - GSOPipeLineStyle3D style = feature.Geometry.Style as GSOPipeLineStyle3D; - double r = style.Radius; - ExportCAD(double.Parse(sortIndex[i, 0].ToString()), geoPoint.Z, r); - } - } - } - layerTemp.Dataset.ImportProjectionRefFromProj4(""); - SaveFileDialog dlg = new SaveFileDialog(); - dlg.Filter = "*.dxf|*.dxf"; - if (dlg.ShowDialog() == DialogResult.OK) - { - layerTemp.SaveAs(dlg.FileName); - MessageBox.Show("导出CAD完成!", "提示"); - } - layerTemp.RemoveAllFeature(); - } - } -} diff --git a/FrmRoadHDM.designer.cs b/FrmRoadHDM.designer.cs deleted file mode 100644 index 23a4c3b..0000000 --- a/FrmRoadHDM.designer.cs +++ /dev/null @@ -1,132 +0,0 @@ -namespace Cyberpipe -{ - partial class FrmRoadHDM - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmRoadHDM)); - System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea1 = new System.Windows.Forms.DataVisualization.Charting.ChartArea(); - System.Windows.Forms.DataVisualization.Charting.Series series1 = new System.Windows.Forms.DataVisualization.Charting.Series(); - this.pictureBox1 = new System.Windows.Forms.PictureBox(); - this.webBrowser1 = new System.Windows.Forms.WebBrowser(); - this.chart1 = new System.Windows.Forms.DataVisualization.Charting.Chart(); - this.btnExportCAD = new DevComponents.DotNetBar.ButtonX(); - ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.chart1)).BeginInit(); - this.SuspendLayout(); - // - // pictureBox1 - // - this.pictureBox1.BackColor = System.Drawing.Color.White; - this.pictureBox1.Dock = System.Windows.Forms.DockStyle.Top; - this.pictureBox1.ErrorImage = null; - this.pictureBox1.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image"))); - this.pictureBox1.ImageLocation = ""; - this.pictureBox1.Location = new System.Drawing.Point(0, 0); - this.pictureBox1.Name = "pictureBox1"; - this.pictureBox1.Size = new System.Drawing.Size(608, 64); - this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; - this.pictureBox1.TabIndex = 1; - this.pictureBox1.TabStop = false; - // - // webBrowser1 - // - this.webBrowser1.Dock = System.Windows.Forms.DockStyle.Bottom; - this.webBrowser1.Location = new System.Drawing.Point(0, 326); - this.webBrowser1.MinimumSize = new System.Drawing.Size(20, 20); - this.webBrowser1.Name = "webBrowser1"; - this.webBrowser1.ScrollBarsEnabled = false; - this.webBrowser1.Size = new System.Drawing.Size(608, 139); - this.webBrowser1.TabIndex = 3; - // - // chart1 - // - chartArea1.AxisX.MajorGrid.Enabled = false; - chartArea1.Name = "ChartArea1"; - this.chart1.ChartAreas.Add(chartArea1); - this.chart1.Location = new System.Drawing.Point(0, 66); - this.chart1.Name = "chart1"; - this.chart1.RightToLeft = System.Windows.Forms.RightToLeft.Yes; - series1.ChartArea = "ChartArea1"; - series1.Name = "管线"; - this.chart1.Series.Add(series1); - this.chart1.Size = new System.Drawing.Size(608, 254); - this.chart1.TabIndex = 2; - this.chart1.Text = "chart1"; - this.chart1.MouseClick += new System.Windows.Forms.MouseEventHandler(this.chart1_MouseClick); - this.chart1.MouseMove += new System.Windows.Forms.MouseEventHandler(this.chart1_MouseMove); - // - // btnExportCAD - // - this.btnExportCAD.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; - this.btnExportCAD.Anchor = System.Windows.Forms.AnchorStyles.Bottom; - this.btnExportCAD.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground; - this.btnExportCAD.Location = new System.Drawing.Point(268, 430); - this.btnExportCAD.Name = "btnExportCAD"; - this.btnExportCAD.Size = new System.Drawing.Size(75, 23); - this.btnExportCAD.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; - this.btnExportCAD.TabIndex = 4; - this.btnExportCAD.Text = "导出CAD"; - this.btnExportCAD.Click += new System.EventHandler(this.btnExportCAD_Click); - // - // FrmRoadHDM - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.BackColor = System.Drawing.Color.White; - this.ClientSize = new System.Drawing.Size(608, 465); - this.Controls.Add(this.btnExportCAD); - this.Controls.Add(this.chart1); - this.Controls.Add(this.webBrowser1); - this.Controls.Add(this.pictureBox1); - this.DoubleBuffered = true; - this.EnableGlass = false; - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; - this.MaximizeBox = false; - this.Name = "FrmRoadHDM"; - this.ShowIcon = false; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; - this.Text = "道路与管线综合横断面"; - this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FrmRoadHDM_FormClosing); - this.Load += new System.EventHandler(this.FrmRoadHDM_Load); - this.Shown += new System.EventHandler(this.FrmRoadHDM_Shown); - ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.chart1)).EndInit(); - this.ResumeLayout(false); - - } - - #endregion - - private System.Windows.Forms.PictureBox pictureBox1; - private System.Windows.Forms.WebBrowser webBrowser1; - private System.Windows.Forms.DataVisualization.Charting.Chart chart1; - private DevComponents.DotNetBar.ButtonX btnExportCAD; - - - } -} \ No newline at end of file diff --git a/FrmRoadHDM.resx b/FrmRoadHDM.resx deleted file mode 100644 index 5202d5f..0000000 --- a/FrmRoadHDM.resx +++ /dev/null @@ -1,177 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - - - 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 - iNKUe3NRsLcAAAAASUVORK5CYII= - - - \ No newline at end of file diff --git a/MainFrm.cs b/MainFrm.cs index e9b6cbe..2df3aac 100644 --- a/MainFrm.cs +++ b/MainFrm.cs @@ -75,15 +75,6 @@ private string trackflag;//定义阀门查询个数 - private GSOFeature m_ConnexityAnalysisFirstFeature; - private GSOFeature m_ConnexityAnaylsisSecondFeature; - private GSOLayer m_ConnexityAnalysisFirstLayer; - private GSOLayer m_COnnexityAnalysisSecondLayer; - private GSOFeatures m_ConnexityAnalyResFeatures; - private GSOFeatures m_TraceUpDownAnalyResFeatures; - private GSOFeatures m_AffectedPipeLines; - private GSOFeatures m_CloseValvesAnalyResFeatures; - private GSOFeatures m_BoosterValvesAnalyResFeatures; //管线间距分析 private GSOFeature disFeature = new GSOFeature(); private GSOFeature featureDis = new GSOFeature(); @@ -2656,8 +2647,37 @@ /// /// /// + private static EnumTrackPolylineEndMode trackPolylineEndMode; + void globeControl1_TrackPolylineEndEvent(object sender, TrackPolylineEndEventArgs e) { + //横断面分析、道路横断面分析 + if (trackPolylineEndMode == EnumTrackPolylineEndMode.HDM_Analysis|| + trackPolylineEndMode == EnumTrackPolylineEndMode.DLDM_Analysis) + { + Dictionary hdmDic = SectionAnalysisTool.HDMAnalysis(this.globeControl1, + e.Polyline, this.m_PipelineLayerNames); + FrmHDMAnalysis3 frm = new FrmHDMAnalysis3(hdmDic, this.globeControl1, + trackPolylineEndMode); + frm.Show(this); + } + //基线剖面分析 + else if (trackPolylineEndMode == EnumTrackPolylineEndMode.JXPM_Analysis) + { + FrmBaseLineProfillAnalysis dlg = new FrmBaseLineProfillAnalysis(globeControl1.Globe, e.Polyline); + dlg.Show(this); + globeControl1.Globe.ClearLastTrackPolyline(); + /* + FrmRoadHDM f = new FrmRoadHDM(); + f.Show() + * **/ + } + else + { + + } + trackPolylineEndMode = EnumTrackPolylineEndMode.Default_Analysis; + /* ArrayList arraylistPoint = new ArrayList(); ArrayList arraylistLine = new ArrayList(); @@ -2835,6 +2855,7 @@ } globeControl1.Globe.Action = EnumAction3D.ActionNull; ActionToolMenuChecked(); + * **/ } #endregion @@ -4962,10 +4983,10 @@ if (globeControl1.Globe.Action != EnumAction3D.NormalHit) { buttonItemFX3_6.Checked = false; - ClearConnexityAnalysis(); + // ClearConnexityAnalysis(); buttonItemFX3_5.Checked = false; - ClearCloseValvesAnalysis(); + // ClearCloseValvesAnalysis(); } if (globeControl1.Globe.Action != EnumAction3D.TrackPolygon) { @@ -4973,131 +4994,7 @@ buttonItemFX4_1.Checked = false; } } - /// - /// 连通性分析 功能 - /// - private void ConnexityAnalysis() - { - GSODataset curCAYDataset = m_ConnexityAnalysisFirstLayer.Dataset; - string srName = curCAYDataset.Name; - GSONetworkDataset curCAYNDataset = curCAYDataset.DataSource.GetDatasetByName(srName + "Network") as GSONetworkDataset; - if (curCAYNDataset == null) - { - MessageBox.Show("该图层没有创建网络拓扑,请先创建网络拓扑信息再进行分析!", "提示"); - return; - } - int[] arryResID; - curCAYNDataset.ConnexityAnalysis(m_ConnexityAnalysisFirstFeature.ID, m_ConnexityAnaylsisSecondFeature.ID, out arryResID, false, true); - m_ConnexityAnalyResFeatures = m_ConnexityAnalysisFirstLayer.GetFeaturesByIDs(arryResID); - if (m_ConnexityAnalyResFeatures == null || m_ConnexityAnalyResFeatures.Length < 1) - { - String strLine1 = "管线:" + m_ConnexityAnalysisFirstFeature.ID; - String strLine2 = "管线:" + m_ConnexityAnaylsisSecondFeature.ID; - MessageBox.Show(strLine1 + " 与 " + strLine2 + " 不连通", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); - } - else - { - int nCount = m_ConnexityAnalyResFeatures.Length; - for (int i = 0; i < nCount; i++) - { - m_ConnexityAnalyResFeatures[i].HighLight = true; - GSOGeoPolyline3D geoline = m_ConnexityAnalyResFeatures[i].Geometry as GSOGeoPolyline3D; - if (geoline != null) - { - GSOLineStyle3D lineStyle = geoline.Style as GSOLineStyle3D; - if (lineStyle != null) - { - if (lineStyle.ArrowStyle == null) - { - lineStyle.ArrowStyle = new GSOArrowStyle(); - - } - lineStyle.ArrowStyle.BodyLen = 8; - lineStyle.ArrowVisible = true; - lineStyle.ArrowStyle.Play(); - } - } - } - globeControl1.Refresh(); - } - } - /// - /// 清除连通性分析结果 功能 - /// - private void ClearConnexityAnalysis() - { - if (m_ConnexityAnalysisFirstFeature != null) - { - m_ConnexityAnalysisFirstFeature.HighLight = false; - m_ConnexityAnalysisFirstFeature.Label = null; - } - if (m_ConnexityAnaylsisSecondFeature != null) - { - m_ConnexityAnaylsisSecondFeature.HighLight = false; - m_ConnexityAnaylsisSecondFeature.Label = null; - } - - m_ConnexityAnalysisFirstFeature = null; - m_ConnexityAnaylsisSecondFeature = null; - m_ConnexityAnalysisFirstLayer = null; - m_COnnexityAnalysisSecondLayer = null; - - if (m_ConnexityAnalyResFeatures != null) - { - int nCount = m_ConnexityAnalyResFeatures.Length; - - for (int i = 0; i < nCount; i++) - { - m_ConnexityAnalyResFeatures[i].HighLight = false; - GSOGeoPolyline3D geoline = m_ConnexityAnalyResFeatures[i].Geometry as GSOGeoPolyline3D; - if (geoline != null) - { - GSOLineStyle3D lineStyle = geoline.Style as GSOLineStyle3D; - if (lineStyle != null) - { - lineStyle.ArrowVisible = false; - } - } - } - m_ConnexityAnalyResFeatures = null; - - } - } - /// - /// 清除阀门分析结果 功能 - /// - private void ClearCloseValvesAnalysis() - { - if (m_CloseValvesAnalyResFeatures != null) - { - for (int i = 0; i < m_CloseValvesList.Count; i++) - { - GSOFeature feature = m_CloseValvesList[i] as GSOFeature; - feature.Label.Text = ""; - } - globeControl1.Refresh(); - m_CloseValvesAnalyResFeatures = null; - m_CloseValvesList = new ArrayList(); - } - } - /// - /// 清除阀门分析结果 功能 - /// - private void ClearBoosterValvesAnalysis() - { - if (m_BoosterValvesAnalyResFeatures != null) - { - for (int i = 0; i < m_BoosterValvesList.Count; i++) - { - GSOFeature feature = m_BoosterValvesList[i] as GSOFeature; - feature.Label.Text = ""; - } - globeControl1.Refresh(); - m_BoosterValvesAnalyResFeatures = null; - m_BoosterValvesList = new ArrayList(); - } - } /// /// 主窗体关闭事件处理 /// @@ -5118,211 +5015,7 @@ //注销id号为103的热键设定 // UnregisterHotKey(Handle, 103); } - /// - /// 清除追踪结果 功能 : Fan 可去掉了! - /// - private void ClearUpDownTraceAnalysis() - { - if (m_TraceUpDownAnalyResFeatures != null) - { - int nCount = m_TraceUpDownAnalyResFeatures.Length; - for (int i = 0; i < nCount; i++) - { - m_TraceUpDownAnalyResFeatures[i].HighLight = false; - GSOGeoPolyline3D geoline = m_TraceUpDownAnalyResFeatures[i].Geometry as GSOGeoPolyline3D; - if (geoline != null) - { - GSOLineStyle3D lineStyle = geoline.Style as GSOLineStyle3D; - if (lineStyle != null) - { - lineStyle.ArrowVisible = false; - } - } - } - m_TraceUpDownAnalyResFeatures = null; - } - } - /// - /// 取消所有高亮管线的高亮状态 - /// - private void ClearAffectedPipeLine() - { - if (m_AffectedPipeLines != null) - { - int nCount = m_AffectedPipeLines.Length; - for (int i = 0; i < nCount; i++) - { - m_AffectedPipeLines[i].HighLight = false; - } - m_AffectedPipeLines = null; - } - } - #region Fan 拓扑分析 - /// - /// 上下游追踪 功能 - /// - /// - private void NetworkTraceUpDown(Boolean bTraceUp) - { - GSOFeature selLineFeature = globeControl1.Globe.SelectedObject; - if (selLineFeature == null || selLineFeature.Geometry == null || selLineFeature.Geometry.Type != EnumGeometryType.GeoPolyline3D) - { - MessageBox.Show("请点击“编辑”—“选中对象”选择一条线!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); - return; - } - GSOLayer selLayer = globeControl1.Globe.SelectedObjectLayer; - - NetworkAnalysisTool.TraceUpDownAnalysis(bTraceUp, - selLineFeature, selLayer); - /* - if (globeControl1.Globe.SelectedObject == null) - { - MessageBox.Show("请点击“编辑”—“选中对象”选择一条线!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); - return; - } - GSOFeature selLineFeature = globeControl1.Globe.SelectedObject; - - if (selLineFeature.Geometry == null || selLineFeature.Geometry.Type != EnumGeometryType.GeoPolyline3D) - { - MessageBox.Show("请点击“编辑”—“选中对象”选择一条线!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); - return; - } - - if (globeControl1.Globe.SelectedObjectLayer == null) - { - MessageBox.Show("选中管线所在图层为空!", "提示"); - return; - } - - GSODataset curCAYDataset = globeControl1.Globe.SelectedObjectLayer.Dataset; - if (curCAYDataset == null || curCAYDataset.DataSource == null) - { - MessageBox.Show("选中管线所在图层不是数据库图层!", "提示"); - return; - } - - string srName = curCAYDataset.Name; - GSONetworkDataset curCAYNDataset = curCAYDataset.DataSource.GetDatasetByName(srName + "Network") as GSONetworkDataset; - - if (curCAYNDataset == null) - { - MessageBox.Show("选中管线所在图层没有创建拓扑!", "提示"); - return; - } - - int[] arryResID; - curCAYNDataset.TraceUpDownAnalysis(selLineFeature.ID, out arryResID, bTraceUp, false, true); - m_TraceUpDownAnalyResFeatures = globeControl1.Globe.SelectedObjectLayer.GetFeaturesByIDs(arryResID); - if (m_TraceUpDownAnalyResFeatures == null || m_TraceUpDownAnalyResFeatures.Length < 1) - { - String strLine1 = "没有上游!"; - if (!bTraceUp) - { - strLine1 = "没有下游!"; - - } - MessageBox.Show(strLine1); - } - else - { - int nCount = m_TraceUpDownAnalyResFeatures.Length; - for (int i = 0; i < nCount; i++) - { - m_TraceUpDownAnalyResFeatures[i].HighLight = true; - GSOGeoPolyline3D geoline = m_TraceUpDownAnalyResFeatures[i].Geometry as GSOGeoPolyline3D; - if (geoline != null) - { - GSOLineStyle3D lineStyle = geoline.Style as GSOLineStyle3D; - if (lineStyle != null) - { - if (lineStyle.ArrowStyle == null) - { - lineStyle.ArrowStyle = new GSOArrowStyle(); - lineStyle.ArrowStyle.BodyWidth = 2; - lineStyle.ArrowStyle.BodyLen = 6; - lineStyle.ArrowStyle.HeadWidth = 8; - lineStyle.ArrowStyle.HeadLen = 10; - lineStyle.ArrowStyle.OutlineVisible = true; - lineStyle.ArrowStyle.OutlineColor = Color.Red; - lineStyle.ArrowStyle.Speed = lineStyle.ArrowStyle.Speed / 2; - } - lineStyle.ArrowVisible = true; - lineStyle.ArrowStyle.Play(); - } - } - } - globeControl1.Refresh(); - } - * **/ - } - - #endregion - /// - /// 上下游追踪 功能 - /// - /// - private void AffectedPipeLine(Boolean bTraceUp) - { - if (globeControl1.Globe.SelectedObject == null) - { - MessageBox.Show("请点击“编辑”—“选中对象”选择一条线!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); - return; - } - GSOFeature selLineFeature = globeControl1.Globe.SelectedObject; - if (selLineFeature.Geometry == null || selLineFeature.Geometry.Type != EnumGeometryType.GeoPolyline3D) - { - MessageBox.Show("请点击“编辑”—“选中对象”选择一条线!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); - - return; - } - - if (globeControl1.Globe.SelectedObjectLayer == null) - { - return; - } - - GSODataset curCAYDataset = globeControl1.Globe.SelectedObjectLayer.Dataset; - if (curCAYDataset == null || curCAYDataset.DataSource == null) - { - return; - } - - string srName = curCAYDataset.Name; - GSONetworkDataset curCAYNDataset = curCAYDataset.DataSource.GetDatasetByName(srName + "Network") as GSONetworkDataset; - - if (curCAYNDataset == null) - { - return; - } - int[] arryResID; - curCAYNDataset.TraceUpDownAnalysis(selLineFeature.ID, out arryResID, bTraceUp, false, true); - m_AffectedPipeLines = globeControl1.Globe.SelectedObjectLayer.GetFeaturesByIDs(arryResID); - if (m_AffectedPipeLines == null || m_AffectedPipeLines.Length < 1) - { - } - else - { - int nCount = m_AffectedPipeLines.Length; - for (int i = 0; i < nCount; i++) - { - m_AffectedPipeLines[i].HighLight = true; - } - globeControl1.Refresh(); - } - } - /// - /// 清除上下游追踪结果 菜单 - /// - /// - /// - //private void buttonItem58_Click(object sender, EventArgs e) - //{ - // //日志记录 - // LogManager.saveLog(Utility.userName, this.buttonItem58.Text); - - // ClearUpDownTraceAnalysis(); - //} - + /// /// 显示流向 功能 /// @@ -5359,158 +5052,8 @@ } FrmCloseValves frm; - /// - /// 关阀分析 功能 - /// - /// - /// - /// - /// - private bool NetworkCloseValvesAnalysis(GSOFeature lineFeature, GSOPoint3d pntBreak, GSOLayer lineLayer) - { - /* - if (lineLayer == null || lineFeature == null || lineFeature.Geometry == null || lineFeature.Geometry.Type != EnumGeometryType.GeoPolyline3D) - { - return false; - } - GSODataset curCAYDataset = lineLayer.Dataset; - if (curCAYDataset == null || curCAYDataset.DataSource == null) - { - MessageBox.Show("该图层不是要素图层!", "提示"); - return false; - } - string srName = curCAYDataset.Name; - GSONetworkDataset curCAYNDataset = curCAYDataset.DataSource.GetDatasetByName(srName + "Network") as GSONetworkDataset; - - if (curCAYNDataset == null) - { - MessageBox.Show("该图层没有创建网络拓扑,请先创建网络拓扑信息再进行分析!", "提示"); - return false; - } - ClearCloseValvesAnalysis(); - - int[] arryResNodeID = null; - int[] arryResValveID = null; - try - { - curCAYNDataset.CloseValveAnalysis(lineFeature.ID, out arryResNodeID, out arryResValveID, false, true); - } - catch (Exception e) - { } - - string valveName = lineLayer.Caption; - valveName = valveName.Substring(0, valveName.IndexOf("管线")); - GSOLayer valveLayer = globeControl1.Globe.Layers[valveName + "阀门"]; - if (valveLayer == null) - { - MessageBox.Show("和选中对象所在管线图层相关联的阀门图层不存在!", "提示"); - return false; - } - - m_CloseValvesAnalyResFeatures = valveLayer.GetFeaturesByIDs(arryResValveID);// curCAYNDataset.NodeDataset.GetFeaturesByIDs(arryResValveID); - - if (m_CloseValvesAnalyResFeatures == null || m_CloseValvesAnalyResFeatures.Length < 1) - { - MessageBox.Show("没有找到要关闭的阀门!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); - if (frm != null) - { - frm.Close(); - } - } - else - { - int nCount = m_CloseValvesAnalyResFeatures.Length; - - if (nCount > 0) - { - frm = FrmCloseValves.getForm(globeControl1, m_CloseValvesAnalyResFeatures, m_CloseValvesList); - - if (!frm.Visible) - { - frm.Show(this); - } - } - }**/ - return true; - } FrmBoosterValvers frmbooster = null; - /// - /// 阀门分析 功能 - /// - /// - /// - /// - /// - private bool NetworkBoosterValvesAnalysis(GSOFeature lineFeature, GSOPoint3d pntBreak, GSOLayer lineLayer) - { - if (lineLayer == null || lineFeature == null || lineFeature.Geometry == null || lineFeature.Geometry.Type != EnumGeometryType.GeoPolyline3D) - { - return false; - } - GSODataset curCAYDataset = lineLayer.Dataset; - - if (curCAYDataset == null || curCAYDataset.DataSource == null) - { - return false; - } - string srName = curCAYDataset.Name; - GSONetworkDataset curCAYNDataset = curCAYDataset.DataSource.GetDatasetByName(srName + "Network") as GSONetworkDataset; - - if (curCAYNDataset == null) - { - MessageBox.Show("该图层没有创建网络拓扑,请先创建网络拓扑信息再进行分析!", "提示"); - return false; - } - ClearBoosterValvesAnalysis(); - ClearAffectedPipeLine(); - - int[] arryResNodeID = null; - int[] arryResValveID = null; - try - { - curCAYNDataset.CloseValveAnalysis(lineFeature.ID, out arryResNodeID, out arryResValveID, false, true); - } - catch (Exception e) - { - - } - //目前只有燃气管线 有阀门 - string valveName = lineLayer.Name; - valveName = valveName.Substring(0, valveName.IndexOf("管线")); - GSOLayer valveLayer = globeControl1.Globe.Layers[valveName + "阀门"]; - if (valveLayer == null) - { - MessageBox.Show("和选中对象所在管线图层相关联的阀门图层不存在!", "提示"); - return false; - } - m_BoosterValvesAnalyResFeatures = valveLayer.GetFeaturesByIDs(arryResValveID); - - if (m_BoosterValvesAnalyResFeatures == null || - m_BoosterValvesAnalyResFeatures.Length < 1) - { - MessageBox.Show("没有找到要关闭的阀门!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); - if (frmbooster != null) - { - frmbooster.Close(); - } - } - else - { - int nCount = m_BoosterValvesAnalyResFeatures.Length; - if (nCount > 0) - { - AffectedPipeLine(false); - frmbooster = FrmBoosterValvers.getForm(globeControl1, m_BoosterValvesAnalyResFeatures, m_BoosterValvesList, m_AffectedPipeLines); - frmbooster.setLstValvesName(); - if (!frmbooster.Visible) - { - frmbooster.Show(this); - } - } - } - return true; - } /// /// 垂直净距分析 功能界面中的 选择图层复选框 选中状态改变事件处理 @@ -7726,69 +7269,6 @@ double distance = lineline.GetSpaceLength(true, 6378137.0); return distance; } - /// - /// 判断管线是否相通 功能 - /// - /// - public bool isInterlinked() - { - if (globeControl1.Globe.SelObjectCount < 2) - { - MessageBox.Show("请选中至少两个管线!!"); - buttonItemFX3_6.Checked = false; - return false; - } - ClearConnexityAnalysis(); - globeControl1.Globe.GetSelectObject(0, out m_ConnexityAnalysisFirstFeature, out m_ConnexityAnalysisFirstLayer); - globeControl1.Globe.GetSelectObject(1, out m_ConnexityAnaylsisSecondFeature, out m_COnnexityAnalysisSecondLayer); - GSOGeoPolyline3D line1 = m_ConnexityAnalysisFirstFeature.Geometry as GSOGeoPolyline3D; - GSOGeoPolyline3D line2 = m_ConnexityAnaylsisSecondFeature.Geometry as GSOGeoPolyline3D; - if (line1 == null || line2 == null) - { - MessageBox.Show("请选择管线!!"); - return false; - } - GSOPipeLineStyle3D pipeStyle1 = line1.Style as GSOPipeLineStyle3D; - GSOPipeLineStyle3D pipeStyle2 = line2.Style as GSOPipeLineStyle3D; - if (pipeStyle1 == null || pipeStyle2 == null) - { - MessageBox.Show("请选择管线!!"); - return false; - } - if (!m_ConnexityAnalysisFirstLayer.IsSameInnerObject(m_COnnexityAnalysisSecondLayer)) - { - MessageBox.Show("不在同一个图层!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); - ClearConnexityAnalysis(); - return false; - } - else - { - GSODataset curCAYDataset = m_ConnexityAnalysisFirstLayer.Dataset; - string srName = curCAYDataset.Name; - GSONetworkDataset curCAYNDataset = curCAYDataset.DataSource.GetDatasetByName(srName + "Network") as GSONetworkDataset; - if (curCAYNDataset == null) - { - MessageBox.Show("该图层没有创建网络拓扑,请先创建网络拓扑信息再进行分析!", "提示"); - return false; - } - - int[] arryResID; - curCAYNDataset.ConnexityAnalysis(m_ConnexityAnalysisFirstFeature.ID, m_ConnexityAnaylsisSecondFeature.ID, out arryResID, false, true); - m_ConnexityAnalyResFeatures = m_ConnexityAnalysisFirstLayer.GetFeaturesByIDs(arryResID); - if (m_ConnexityAnalyResFeatures == null || m_ConnexityAnalyResFeatures.Length < 1) - { - String strLine1 = "管线:" + m_ConnexityAnalysisFirstFeature.ID; - String strLine2 = "管线:" + m_ConnexityAnaylsisSecondFeature.ID; - MessageBox.Show("请选择两条相通的管线!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); - return false; - } - else - { - return true; - } - } - } - /// /// 图层节点树中 节点 右键单击事件处理 @@ -9564,27 +9044,7 @@ } } - /// - /// 清除分析结果 - /// - /// - /// - //private void buttonItem131_Click(object sender, EventArgs e) - //{ - // LogManager.saveLog(Utility.userName, this.buttonItem131.Text); - - // clearFeatureHighLight(); - // //if (boolfrmShResult == true) - // //{ - // // frmShResult.Close(); - // //} - // //else - // //{ - - // //} - - // ClearRedlineAnalyseResult(); - //} + /// /// 清除渲染结果 /// @@ -10728,8 +10188,9 @@ buttonX16_Click(null, null); buttonClearAnalysisResult_Click(null, null); - ClearConnexityAnalysis();//清除连通性分析 - ClearCloseValvesAnalysis();//清除阀门分析 + NetworkAnalysisTool.ClearAllTopAnalysis(this.globeControl1); + // ClearConnexityAnalysis();//清除连通性分析 + // ClearCloseValvesAnalysis();//清除阀门分析 //清除管线间距分析 if (disFeature != null) @@ -10753,7 +10214,7 @@ globeControl1.Globe.UnderGroundFloor.Visible = false;//隐藏地下网格线 - ClearUpDownTraceAnalysis(); //清除上下游分析 + // ClearUpDownTraceAnalysis(); //清除上下游分析 globeControl1.Globe.RemoveAllPits();//清除所有坑 string[] markerStrs = new string[9]; @@ -11206,6 +10667,8 @@ sideBar1.Refresh(); Refresh(); } + + #region Predaotr,断面分析 /// /// 横断面分析 /// @@ -11213,26 +10676,11 @@ /// private void buttonItemFX2_1_Click(object sender, EventArgs e) { - //日志记录 - LogManager.saveLog(Utility.userName, this.buttonItemFX2_1.Text); - - if (!buttonItemFX2_1.Checked) - { - trackflag = "PolylineAnalysis"; - globeControl1.Globe.Action = EnumAction3D.TrackPolyline; - globeControl1.Globe.TrackPolylineTool.VerticalLineVisible = true; - globeControl1.Globe.TrackPolylineTool.TrackMode = EnumTrackMode.SpaceTrack; - buttonItemFX2_1.Checked = true; - buttonItemFX2_3.Checked = false; - buttonItemFX2_4.Checked = false; - } - else - { - globeControl1.Globe.Action = EnumAction3D.ActionNull; - buttonItemFX2_1.Checked = false; - globeControl1.Globe.TrackPolylineTool.VerticalLineVisible = false; - } - ActionToolMenuChecked(); + globeControl1.Globe.Action = EnumAction3D.TrackPolyline; + globeControl1.Globe.TrackPolylineTool.VerticalLineVisible = true; + globeControl1.Globe.TrackPolylineTool.TrackMode = EnumTrackMode.SpaceTrack; + trackPolylineEndMode = EnumTrackPolylineEndMode.HDM_Analysis; + } /// /// 纵断面分析 @@ -11241,235 +10689,28 @@ /// private void buttonItemFX2_2_Click(object sender, EventArgs e) { - //日志记录 - LogManager.saveLog(Utility.userName, this.buttonItemFX2_2.Text); - - if (globeControl1.Globe.SelObjectCount >= 1) + if (globeControl1.Globe.SelObjectCount<1) { - GSOFeatures selectFeatures = new GSOFeatures(); - for (int i = 0; i < globeControl1.Globe.SelObjectCount; i++) + MessageBox.Show("请选择一条或者多条管线!", "提示", MessageBoxButtons.OK, + MessageBoxIcon.Information); + return; + } + GSOFeatures selectFeatures = new GSOFeatures(); + for (int i = 0; i < globeControl1.Globe.SelObjectCount; i++) + { + GSOFeature feature = null; + GSOLayer layer = null; + globeControl1.Globe.GetSelectObject(i, out feature, out layer); + if (feature != null && feature.Geometry != null && feature.Geometry.Type == EnumGeometryType.GeoPolyline3D) { - GSOFeature feature = null; - GSOLayer layer = null; - globeControl1.Globe.GetSelectObject(i, out feature, out layer); - if (feature != null && feature.Geometry != null && feature.Geometry.Type == EnumGeometryType.GeoPolyline3D) - { - selectFeatures.Add(feature); - } - } - if (selectFeatures.Length < 1) - { - MessageBox.Show("请选择一条或者多条管线!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); - return; - } - List listFeature = new List(); - if (selectFeatures.Length == 1) - { - listFeature.Add(selectFeatures[0]); - } - else - { - //求多条管线纵断面 1,2,3 - //1 判断管线是否相连、且没有分叉 - for (int i = 0; i < selectFeatures.Length; i++) - { - GSOGeoPolyline3D line = selectFeatures[i].Geometry as GSOGeoPolyline3D; - bool isConnect = false; - int[] valueCount = new int[2]; - valueCount[0] = 0; - valueCount[1] = 0; - - if (line != null && line.PartCount > 0) - { - for (int j = 0; j < selectFeatures.Length; j++) - { - if (i == j) - { - continue; - } - GSOGeoPolyline3D newLine = selectFeatures[j].Geometry as GSOGeoPolyline3D; - if (newLine != null && newLine.PartCount > 0) - { - int minValueIndex = 0; - double limitValue = 1.0; - double[] value = new double[4]; - value[0] = getDistance(line[line.PartCount - 1][line[line.PartCount - 1].Count - 1], newLine[0][0]); - value[1] = getDistance(line[line.PartCount - 1][line[line.PartCount - 1].Count - 1], newLine[newLine.PartCount - 1][newLine[newLine.PartCount - 1].Count - 1]); - value[2] = getDistance(line[0][0], newLine[0][0]); - value[3] = getDistance(line[0][0], newLine[newLine.PartCount - 1][newLine[newLine.PartCount - 1].Count - 1]); - double minValue = value[0]; - for (int m = 1; m < value.Length; m++) - { - if (minValue > value[m]) - { - minValue = value[m]; - minValueIndex = m; - } - } - if (minValue < limitValue) - { - isConnect = true; - if (minValueIndex > 1) - { - valueCount[1]++; - } - else - { - valueCount[0]++; - } - } - } - } - if (!isConnect || valueCount[0] > 1 || valueCount[1] > 1) - { - MessageBox.Show("请选择相连接的一条线上的管线!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); - return; - } - } - } - //2 记录每一条相连接的管线的起点和终点,并添加到一条管线中 - for (int p = 0; p < selectFeatures.Length; p++) - { - GSOGeoPolyline3D line = selectFeatures[p].Geometry as GSOGeoPolyline3D; - if (line != null && line.PartCount > 0) - { - for (int n = 0; n < selectFeatures.Length; n++) - { - if (p == n) - { - continue; - } - GSOGeoPolyline3D newLine = selectFeatures[n].Geometry as GSOGeoPolyline3D; - if (newLine != null && newLine.PartCount > 0) - { - int minValueIndex = 0; - double limitValue = 1.0; - double[] value = new double[4]; - value[0] = getDistance(line[line.PartCount - 1][line[line.PartCount - 1].Count - 1], newLine[0][0]); - value[1] = getDistance(line[line.PartCount - 1][line[line.PartCount - 1].Count - 1], newLine[newLine.PartCount - 1][newLine[newLine.PartCount - 1].Count - 1]); - value[2] = getDistance(line[0][0], newLine[0][0]); - value[3] = getDistance(line[0][0], newLine[newLine.PartCount - 1][newLine[newLine.PartCount - 1].Count - 1]); - double minValue = value[0]; - for (int m = 1; m < value.Length; m++) - { - if (minValue > value[m]) - { - minValue = value[m]; - minValueIndex = m; - } - } - if (minValue < limitValue) - { - GSOFeature featureFromAllSelectedObj = new GSOFeature(); - GSOGeoPolyline3D lineFromAllSelectedObj = new GSOGeoPolyline3D(); - switch (minValueIndex) - { - case 0: - GSOPoint3ds linePart = new GSOPoint3ds(); - for (int i = 0; i < line.PartCount; i++) - { - for (int j = 0; j < line[i].Count; j++) - { - linePart.Add(line[i][j]); - } - } - for (int i = 0; i < newLine.PartCount; i++) - { - for (int j = 0; j < newLine[i].Count; j++) - { - linePart.Add(newLine[i][j]); - } - } - lineFromAllSelectedObj.AddPart(linePart); - break; - case 1: - linePart = new GSOPoint3ds(); - for (int i = 0; i < line.PartCount; i++) - { - for (int j = 0; j < line[i].Count; j++) - { - linePart.Add(line[i][j]); - } - } - for (int i = newLine.PartCount - 1; i >= 0; i--) - { - for (int j = newLine[i].Count - 1; j >= 0; j--) - { - linePart.Add(newLine[i][j]); - } - } - lineFromAllSelectedObj.AddPart(linePart); - break; - case 2: - linePart = new GSOPoint3ds(); - for (int i = line.PartCount - 1; i >= 0; i--) - { - for (int j = line[i].Count - 1; j >= 0; j--) - { - linePart.Add(line[i][j]); - } - } - for (int i = 0; i < newLine.PartCount; i++) - { - for (int j = 0; j < newLine[i].Count; j++) - { - linePart.Add(newLine[i][j]); - } - } - lineFromAllSelectedObj.AddPart(linePart); - break; - case 3: - linePart = new GSOPoint3ds(); - for (int i = line.PartCount - 1; i >= 0; i--) - { - for (int j = line[i].Count - 1; j >= 0; j--) - { - linePart.Add(line[i][j]); - } - } - for (int i = newLine.PartCount - 1; i >= 0; i--) - { - for (int j = newLine[i].Count - 1; j >= 0; j--) - { - linePart.Add(newLine[i][j]); - } - } - lineFromAllSelectedObj.AddPart(linePart); - break; - } - - featureFromAllSelectedObj.Geometry = lineFromAllSelectedObj; - - selectFeatures.Remove(n); - selectFeatures.Remove(p); - selectFeatures.Add(featureFromAllSelectedObj); - p--; - break; - } - } - } - } - } - //3 将合并之后的管线添加到集合中 - for (int h = 0; h < selectFeatures.Length; h++) - { - listFeature.Add(selectFeatures[h]); - } - } - //将选中的管线展示在窗体中 - if (listFeature.Count > 0) - { - FrmProfileAnalysis frm = new FrmProfileAnalysis(globeControl1, listFeature); - frm.Show(this); - } - else - { - MessageBox.Show("请选择相连接的管线!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); + selectFeatures.Add(feature); } } - else + List feats = SectionAnalysisTool.ZDMAnalysis(selectFeatures); + if (feats != null && feats.Count >= 1) { - MessageBox.Show("请选择一条或者多条管线!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); + FrmProfileAnalysis frm = new FrmProfileAnalysis(globeControl1, feats); + frm.Show(this); } } /// @@ -11479,25 +10720,11 @@ /// private void buttonItemFX2_3_Click(object sender, EventArgs e) { - //日志记录 - LogManager.saveLog(Utility.userName, this.buttonItemFX2_3.Text); + globeControl1.Globe.Action = EnumAction3D.TrackPolyline; + globeControl1.Globe.TrackPolylineTool.VerticalLineVisible = true; + globeControl1.Globe.TrackPolylineTool.TrackMode = EnumTrackMode.SpaceTrack; + trackPolylineEndMode = EnumTrackPolylineEndMode.DLDM_Analysis; - if (!buttonItemFX2_3.Checked) - { - trackflag = "RoadPolylineAnalysis"; - globeControl1.Globe.Action = EnumAction3D.TrackPolyline; - globeControl1.Globe.TrackPolylineTool.VerticalLineVisible = true; - buttonItemFX2_3.Checked = true; - buttonItemFX2_1.Checked = false; - buttonItemFX2_4.Checked = false; - } - else - { - globeControl1.Globe.Action = EnumAction3D.ActionNull; - buttonItemFX2_3.Checked = false; - globeControl1.Globe.TrackPolylineTool.VerticalLineVisible = false; - } - ActionToolMenuChecked(); } /// /// 基线剖面分析 @@ -11506,27 +10733,14 @@ /// private void buttonItemFX2_4_Click(object sender, EventArgs e) { - //日志记录 - LogManager.saveLog(Utility.userName, this.buttonItemFX2_4.Text); - - if (!buttonItemFX2_4.Checked) - { - globeControl1.Globe.Action = EnumAction3D.TrackPolyline; - //globeControl1.Globe.TrackPolylineAnalysis.VerticalLineVisible = true; - globeControl1.Globe.TrackPolylineTool.VerticalLineVisible = true; - buttonItemFX2_4.Checked = true; - buttonItemFX3_6.Checked = false; - buttonItemFX2_1.Checked = false; - } - else - { - globeControl1.Globe.Action = EnumAction3D.ActionNull; - buttonItemFX2_4.Checked = false; - //globeControl1.Globe.TrackPolylineAnalysis.VerticalLineVisible = false; - globeControl1.Globe.TrackPolylineTool.VerticalLineVisible = false; - } - ActionToolMenuChecked(); + globeControl1.Globe.Action = EnumAction3D.TrackPolyline; + globeControl1.Globe.TrackPolylineTool.VerticalLineVisible = true; + globeControl1.Globe.TrackPolylineTool.TrackMode = EnumTrackMode.SpaceTrack; + trackPolylineEndMode = EnumTrackPolylineEndMode.JXPM_Analysis; + } + + #endregion /// /// 创建拓扑 /// @@ -11540,7 +10754,7 @@ FrmGenAndFaMenTopu frm = new FrmGenAndFaMenTopu(globeControl1, m_PipelineLayerNames, valueLayerNames); frm.Show(this); } - #region Fan + #region Predator :拓扑分析 /// /// 上游分析 /// @@ -11550,8 +10764,6 @@ { //日志记录 LogManager.saveLog(Utility.userName, this.buttonItemFX3_2.Text); - - //ClearUpDownTraceAnalysis(); Fan NetworkTraceUpDown(true); } /// @@ -11563,10 +10775,27 @@ { //日志记录 LogManager.saveLog(Utility.userName, this.buttonItemFX3_3.Text); - - // ClearUpDownTraceAnalysis(); Fan NetworkTraceUpDown(false); } + + /// + /// 上下游追踪 功能 + /// + /// + private void NetworkTraceUpDown(Boolean bTraceUp) + { + GSOFeature selLineFeature = globeControl1.Globe.SelectedObject; + if (selLineFeature == null || selLineFeature.Geometry == null || selLineFeature.Geometry.Type != EnumGeometryType.GeoPolyline3D) + { + MessageBox.Show("请点击“编辑”—“选中对象”选择一条线!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); + return; + } + GSOLayer selLayer = globeControl1.Globe.SelectedObjectLayer; + + NetworkAnalysisTool.TraceUpDownAnalysis(bTraceUp, + selLineFeature, selLayer); + } + /// /// 流向分析 /// @@ -11618,43 +10847,6 @@ { MessageBox.Show("未找到关闭阀门"); } - - - //日志记录 - /* - LogManager.saveLog(Utility.userName, this.buttonItemFX3_5.Text); - - ClearCloseValvesAnalysis(); - if (globeControl1.Globe.SelObjectCount < 1) - { - MessageBox.Show("请选中至少一根管线!!"); - buttonItemFX3_5.Checked = false; - return; - } - GSOLayer resLayer = null; - GSOFeature resFeature = null; - globeControl1.Globe.GetSelectObject(0, out resFeature, out resLayer); - - GSOGeoPolyline3D line1 = resFeature.Geometry as GSOGeoPolyline3D; - if (line1 == null) - { - MessageBox.Show("请选择管线!!"); - return; - } - GSOPipeLineStyle3D pipeStyle1 = line1.Style as GSOPipeLineStyle3D; - if (pipeStyle1 == null) - { - MessageBox.Show("请选择管线!!"); - return; - } - GSOPoint3d resIntersetPoint = new GSOPoint3d(); - if (NetworkCloseValvesAnalysis(resFeature, resIntersetPoint, resLayer)) - { - //btnGFFX.Checked = false; - globeControl1.Globe.Action = EnumAction3D.ActionNull; - buttonItemFX3_5.Checked = false; - } - * **/ } /// @@ -11682,47 +10874,6 @@ return; } NetworkAnalysisTool.ConnexityAnalysis(selFeat0, selFeat1, layer0); - /* - //日志记录 - LogManager.saveLog(Utility.userName, this.buttonItemFX3_6.Text); - - if (globeControl1.Globe.SelObjectCount < 2) - { - MessageBox.Show("请选中至少两个管线!!"); - buttonItemFX3_6.Checked = false; - return; - } - ClearConnexityAnalysis(); - globeControl1.Globe.GetSelectObject(0, out m_ConnexityAnalysisFirstFeature, out m_ConnexityAnalysisFirstLayer); - globeControl1.Globe.GetSelectObject(1, out m_ConnexityAnaylsisSecondFeature, out m_COnnexityAnalysisSecondLayer); - GSOGeoPolyline3D line1 = m_ConnexityAnalysisFirstFeature.Geometry as GSOGeoPolyline3D; - GSOGeoPolyline3D line2 = m_ConnexityAnaylsisSecondFeature.Geometry as GSOGeoPolyline3D; - if (line1 == null || line2 == null) - { - MessageBox.Show("请选择管线!!"); - buttonItemFX3_6.Checked = false; - return; - } - - GSOPipeLineStyle3D pipeStyle1 = line1.Style as GSOPipeLineStyle3D; - GSOPipeLineStyle3D pipeStyle2 = line2.Style as GSOPipeLineStyle3D; - if (pipeStyle1 == null || pipeStyle2 == null) - { - MessageBox.Show("请选择管线!!"); - buttonItemFX3_6.Checked = false; - return; - } - if (!m_ConnexityAnalysisFirstLayer.IsSameInnerObject(m_COnnexityAnalysisSecondLayer)) - { - MessageBox.Show("不在同一个图层!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); - buttonItemFX3_6.Checked = false; - ClearConnexityAnalysis(); - } - else - { - ConnexityAnalysis(); - } - * **/ } /// /// 爆管分析 @@ -11731,8 +10882,6 @@ /// private void buttonItemFX3_7_Click(object sender, EventArgs e) { - //TODO LIST:关阀+上游 追踪 - NetworkTraceUpDown(true); //上游追踪: GSOFeature selLineFeature = globeControl1.Globe.SelectedObject; @@ -11747,73 +10896,8 @@ this.buttonItemFX3_5_Click(sender, e); //关阀分析: - //日志记录 - /* - LogManager.saveLog(Utility.userName, this.buttonItemFX3_7.Text); - ClearCloseValvesAnalysis(); - if (globeControl1.Globe.SelObjectCount < 1) - { - MessageBox.Show("请选中至少一个管线!!"); - return; - } - GSOLayer resLayer = null; - GSOFeature resFeature = null; - globeControl1.Globe.GetSelectObject(0, out resFeature, out resLayer); - - GSOGeoPolyline3D line1 = resFeature.Geometry as GSOGeoPolyline3D; - if (line1 == null) - { - MessageBox.Show("请选择管线!!"); - return; - } - GSOPipeLineStyle3D pipeStyle1 = line1.Style as GSOPipeLineStyle3D; - if (pipeStyle1 == null) - { - MessageBox.Show("请选择管线!!"); - return; - } - - GSOFeatures feats = globeControl1.Globe.MemoryLayer.GetFeatureByName("粒子要素", true); - if (feats.Length > 0) - globeControl1.Globe.MemoryLayer.RemoveFeatureByID(feats[0].ID); - //if (emitterFeature != null) - //{ - // globeControl1.Globe.MemoryLayer.RemoveFeatureByID(emitterFeature.ID); - //} - - GSOPoint3d pt = new GSOPoint3d(); - double length = line1.GetSpaceLength(true, 6378137);//线的长度 - GSOGeoPolyline3D lineLine = line1.GetSegment(0, length / 2); - GSOPoint3d point3d = lineLine[lineLine.PartCount - 1][lineLine[lineLine.PartCount - 1].Count - 1]; - pt.X = point3d.X; - pt.Y = point3d.Y; - pt.Z = point3d.Z; - - pt.Z += pipeStyle1.Radius * 2; - - if (resLayer.Caption.Contains("气")) - { - globeControl1.Globe.UnderGroundFloor.Visible = true; - AddFire(pt.X, pt.Y, pt.Z); - } - else if (resLayer.Caption.Contains("给水")) - { - globeControl1.Globe.UnderGroundFloor.Visible = true; - AddFountain(pt.X, pt.Y, pt.Z); - } - else if (resLayer.Caption.Contains("热力")) - { - globeControl1.Globe.UnderGroundFloor.Visible = true; - AddFountain(pt.X, pt.Y, pt.Z); - } - GSOPoint3d resIntersetPoint = new GSOPoint3d(); - if (NetworkBoosterValvesAnalysis(resFeature, resIntersetPoint, resLayer)) - { - globeControl1.Globe.Action = EnumAction3D.ActionNull; - } - * */ - } + #endregion /// /// 多边形开挖 diff --git a/Cyberpipe.csproj b/Cyberpipe.csproj index d24ccfc..cd0296f 100644 --- a/Cyberpipe.csproj +++ b/Cyberpipe.csproj @@ -228,6 +228,7 @@ F_GKT1添加项目.cs + @@ -938,12 +939,6 @@ FrmRESCMgr.cs - - Form - - - FrmRoadHDM.cs - Form @@ -1166,6 +1161,7 @@ + @@ -1611,10 +1607,6 @@ FrmRESCMgr.cs Designer - - FrmRoadHDM.cs - Designer - FrmRole.cs Designer diff --git a/EnumEventMode.cs b/EnumEventMode.cs new file mode 100644 index 0000000..b5eba59 --- /dev/null +++ b/EnumEventMode.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace Cyberpipe +{ + //横断面分析、基线剖面分析、道路断面分析 + public enum EnumTrackPolylineEndMode + { + Default_Analysis = 0, //无分析 + HDM_Analysis = 1, //横断面分析 + DLDM_Analysis = 2,//道路断面分析 + JXPM_Analysis = 3, //基线剖面分析 + } + + class EnumEventMode + { + } +} diff --git a/FrmHDMAnalysis3.cs b/FrmHDMAnalysis3.cs index 5e5988c..6405ed7 100644 --- a/FrmHDMAnalysis3.cs +++ b/FrmHDMAnalysis3.cs @@ -16,206 +16,72 @@ { public partial class FrmHDMAnalysis3 : DevComponents.DotNetBar.Office2007Form { - private ArrayList listPoint = new ArrayList(); - private ArrayList listFeat = new ArrayList(); - GSOGeoPolyline3D line = new GSOGeoPolyline3D(); //创建线对象 - - private static FrmHDMAnalysis3 allPipelineAnalysis = null; - public bool isShowFirst = false; - - static ArrayList list = new ArrayList(); + static DataTable table = new DataTable(); - static DataTable showTable = new DataTable(); GSOGlobeControl globeControl1; - object[,] sortIndex; - GSOLayer layerTemp; - private FrmHDMAnalysis3() - { - - } - public static FrmHDMAnalysis3 GetForm(ArrayList arraylistP, ArrayList arraylistF, GSOGeoPolyline3D _line, GSOGlobeControl _ctl) - { - if (allPipelineAnalysis == null) - { - allPipelineAnalysis = new FrmHDMAnalysis3(arraylistP, arraylistF, _line,_ctl); - } - else - { - allPipelineAnalysis.listPoint = arraylistP; - allPipelineAnalysis.listFeat = arraylistF; - allPipelineAnalysis.line = _line; - allPipelineAnalysis.globeControl1 = _ctl; - list = new ArrayList(); - } - return allPipelineAnalysis; - } + EnumTrackPolylineEndMode mode; - public FrmHDMAnalysis3(ArrayList arraylistP, ArrayList arraylistF, GSOGeoPolyline3D _line,GSOGlobeControl _ctl) + Dictionary hdmDic; + + public FrmHDMAnalysis3(Dictionary hdmDic, + GSOGlobeControl globeControl, EnumTrackPolylineEndMode mode) { InitializeComponent(); - this.listPoint = arraylistP; - this.listFeat = arraylistF; - line = _line; - globeControl1 = _ctl; + + this.hdmDic = hdmDic; + this.globeControl1 = globeControl; + this.mode = mode; } - double A_x, A_y, B_x, B_y;//定义坐标点,用来就横断面的长度 - /// - /// 窗体初始化事件处理 - /// - /// - /// - private void Frm_HDMAnalysis_Load(object sender, EventArgs e) + + private void initControls() { - layerTemp = globeControl1.Globe.Layers.Add(Application.StartupPath + "\\tempLgdExport.lgd"); - //chart1.ChartAreas[0].BackImage = Application.StartupPath + "\\Resource\\pipelineBackGround副本.png"; - } - /// - /// 窗体第一次显示事件处理 - /// - /// - /// - void Frm_HDMAnalysis2_Shown(object sender, EventArgs e) - { - isShowFirst = true; - - } - public void LoadChartEvent() - { - try - { - this.Shown += new EventHandler(Frm_HDMAnalysis2_Shown); - - chart1.Series["管线"].ChartType = SeriesChartType.Point; - - chart1.Series["管线"]["DrawingStyle"] = "Cylinder"; - chart1.Series["管线"].MarkerStyle = MarkerStyle.Circle; //点的类型 - - chart1.Series["管线"].MarkerBorderColor = Color.Black; //点的边框颜色 - chart1.ChartAreas[0].AxisX.Minimum = 0; //x轴的起始点大小 - chart1.ChartAreas[0].AxisY.Maximum = 0; //y轴的最大值 - - chart1.ChartAreas[0].AxisX.Title = "距离 (米)"; - chart1.ChartAreas[0].AxisY.Title = "埋深 (米)"; - - //chart1.ChartAreas[0].AxisX.ScrollBar.Enabled = true; - chart1.ChartAreas[0].AxisY2.Title = "高程 (米)"; - double[] depths = new double[listFeat.Count]; - for (int i = 0; i < listFeat.Count; i++) - { - GSOFeature f = listFeat[i] as GSOFeature; - double depth = f.GetFieldAsDouble("起始地面高程"); - depths[i] = depth; - } - double max_Depth = depths[0]; - for (int i = 0; i < listFeat.Count; i++) - { - if (max_Depth < depths[i]) - { - max_Depth = depths[i]; - } - } - chart1.ChartAreas[0].AxisY2.CustomLabels.Clear(); - chart1.ChartAreas[0].AxisY2.CustomLabels.Add(-5.4d, -5.6d, (max_Depth - 5.5).ToString("0.0")); - chart1.ChartAreas[0].AxisY2.CustomLabels.Add(-4.9d, -5.1d, (max_Depth - 5).ToString("0.0")); - chart1.ChartAreas[0].AxisY2.CustomLabels.Add(-4.4d, -4.6d, (max_Depth - 4.5).ToString("0.0")); - chart1.ChartAreas[0].AxisY2.CustomLabels.Add(-3.9d, -4.1d, (max_Depth - 4).ToString("0.0")); - chart1.ChartAreas[0].AxisY2.CustomLabels.Add(-3.4d, -3.6d, (max_Depth - 3.5).ToString("0.0")); - chart1.ChartAreas[0].AxisY2.CustomLabels.Add(-2.9d, -3.1d, (max_Depth - 3).ToString("0.0")); - chart1.ChartAreas[0].AxisY2.CustomLabels.Add(-2.4d, -2.6d, (max_Depth - 2.5).ToString("0.0")); - chart1.ChartAreas[0].AxisY2.CustomLabels.Add(-1.9d, -2.1d, (max_Depth - 2).ToString("0.0")); - chart1.ChartAreas[0].AxisY2.CustomLabels.Add(-1.4d, -1.6d, (max_Depth - 1.5).ToString("0.0")); - chart1.ChartAreas[0].AxisY2.CustomLabels.Add(-0.9d, -1.1d, (max_Depth - 1).ToString("0.0")); - chart1.ChartAreas[0].AxisY2.CustomLabels.Add(-0.4d, -0.6d, (max_Depth - 0.5).ToString("0.0")); - chart1.ChartAreas[0].AxisY2.CustomLabels.Add(-0.1d, 0.1d, max_Depth.ToString("0.0")); - - if (line.PartCount > 0) - { - GSOPoint3ds nodes = line[0]; - if (nodes.Count > 0) - { - GSOPoint3d node = nodes[0]; - A_x = node.X; - A_y = node.Y; - } - } - - DrawCurveGraph(A_x, A_y); - } - catch (Exception ex) - { - LogError.PublishError(ex); - } - } - - /// - /// 创建图表 - /// - /// - /// - private void DrawCurveGraph(double a_x,double a_y) - { - // 遍历线,求距离 - table = new DataTable(); - //showTable.Columns.Clear(); - list.Clear(); + chart1.Series["管线"].ChartType = SeriesChartType.Point; + chart1.Series["管线"]["DrawingStyle"] = "Cylinder"; + chart1.Series["管线"].MarkerStyle = MarkerStyle.Circle; //点的类型 + chart1.Series["管线"].MarkerBorderColor = Color.Black; //点的边框颜色 + //chart1.ChartAreas[0].AxisX.Minimum = 0; //x轴的起始点大小 + chart1.ChartAreas[0].AxisY.Maximum = 0; //y轴的最大值 + chart1.ChartAreas[0].AxisX.Title = "距离 (米)"; + chart1.ChartAreas[0].AxisY.Title = "埋深 (米)"; + chart1.ChartAreas[0].AxisY2.Title = "高程 (米)"; chart1.Series["管线"].Points.Clear(); - chart1.ChartAreas[0].AxisX.Maximum = Math.Round(line.GetSpaceLength(true, 6378137),2); + //chart1.ChartAreas[0].AxisX.Maximum = Math.Round(line.GetSpaceLength(true, 6378137), 2); + table.Columns.Add("编号", typeof(string)); table.Columns.Add("管线类型", typeof(string)); table.Columns.Add("管线编码", typeof(string)); table.Columns.Add("管径_毫米", typeof(string)); table.Columns.Add("材质", typeof(string)); - table.Columns.Add("管线埋深", typeof(string)); + table.Columns.Add("管线埋深", typeof(string)); - sortIndex = new object[listPoint.Count, 2]; - for (int i = 0; i <= listPoint.Count; i++) + if (mode == EnumTrackPolylineEndMode.DLDM_Analysis) { - if (i == listPoint.Count) - { - double maxNum = 0.0; - for (int j = 0; j < listPoint.Count; j++) - { - if (maxNum < Convert.ToDouble(sortIndex[j, 0])) - { - maxNum = Convert.ToDouble(sortIndex[j, 0]); - } - } - chart1.Series["管线"].Points.AddXY(maxNum + 2, 0); - chart1.Series["管线"].Points[i].MarkerBorderWidth = 100; //边框的宽度 - chart1.Series["管线"].Points[i].MarkerColor = Color.Black; - chart1.Series["管线"].Points[i].MarkerSize = 100; - continue; - } - GSOPoint3d geoPoint = (GSOPoint3d)listPoint[i]; - GSOFeature feature = listFeat[i] as GSOFeature; - //坐标投影 - int id = GeoScene.Data.GSOProjectManager.AddProject(Utility.projectStr); + this.pictureBox1.Visible = true; + } + else + { + this.pictureBox1.Visible = false; + } + } - GeoScene.Data.GSOPoint2d a_Point = GeoScene.Data.GSOProjectManager.Forward(new GSOPoint2d(a_x, a_y), id);//user画的线的起始点 + private void draw() + { + int i = 0; + foreach (KeyValuePair kvp in this.hdmDic) + { + GSOFeature feature = kvp.Key; + HDMCoordinate coor = kvp.Value; - GeoScene.Data.GSOPoint2d pt2d = new GeoScene.Data.GSOPoint2d(geoPoint.X, geoPoint.Y); - GeoScene.Data.GSOPoint2d result = GeoScene.Data.GSOProjectManager.Forward(pt2d, id); - B_x = result.X; - B_y = result.Y; + chart1.Series["管线"].Points.AddXY(coor.Dis, coor.Z);//绑定数据 - double x = System.Math.Abs(B_x - a_Point.X); - double y = System.Math.Abs(B_y - a_Point.Y); - double Dis = 0.0; - Dis = Math.Round(Math.Sqrt(x * x + y * y) , 2); - list.Add(geoPoint.Z); - sortIndex[i, 0] = Dis; - sortIndex[i, 1] = i; - - chart1.Series["管线"].Points.AddXY(Dis, geoPoint.Z);//绑定数据 - - string pipeType = feature.Dataset == null ? "" : feature.Dataset.Caption; + string pipeType = feature.Dataset == null ? "" : feature.Dataset.Caption; string number = Convert.ToString(i + 1); - string material = feature.GetFieldAsString("材质"); string diameter = feature.GetFieldAsString("管径_毫米"); - table.Rows.Add(new object[] { number, pipeType, feature.Name.ToString(), diameter, material,Convert.ToDecimal(list[i].ToString()).ToString("f2")});//list[i].ToString().Substring(0,list[i].ToString().IndexOf('.')+3) } - - //chart1.Series["管线"].Points[i].Label = number;//管线的标签 + table.Rows.Add(new object[] { number, + pipeType, feature.Name.ToString(), + diameter, material, + Convert.ToDecimal(coor.Z).ToString("f2") }); chart1.Series["管线"].Points[i].LegendText = number; if (feature.Geometry.Style.GetType() == typeof(GSOPipeLineStyle3D)) { @@ -229,47 +95,12 @@ chart1.Series["管线"].Points[i].MarkerBorderWidth = 3; //边框的宽度 chart1.Series["管线"].Points[i].MarkerColor = Color.Transparent; - chart1.Series["管线"].Points[i].MarkerSize = Convert.ToInt32(Math.Floor((feature.GetFieldAsDouble("管径_毫米") / 0.35 + chart1.Series["管线"].Points[i].MarkerBorderWidth) / 100.0));//点的大小 - + chart1.Series["管线"].Points[i].MarkerSize = Convert.ToInt32(Math.Floor((feature.GetFieldAsDouble("管径_毫米") / 0.35 + + chart1.Series["管线"].Points[i].MarkerBorderWidth) / 100.0)); + i++; } - - string htmlCode = "" + - "" + - "" + - "
管线类型管线编码管径_毫米材质管线埋深
" + - "" + - "" + - "" + - "" + - "
"; - webBrowser1.DocumentText = htmlCode; } + /// /// 图表的鼠标单击事件处理 /// @@ -286,14 +117,11 @@ return; } string number = p.LegendText; - //MessageBox.Show(number); int indexInTableRows = 0; bool isInt = int.TryParse(number, out indexInTableRows); if (isInt) { DataRow row = table.Rows[indexInTableRows - 1]; - //showTable.Rows.Clear(); - //showTable.Rows.Add(new object[] { row[0], row[1], row[2], row[3], row[4], row[5] }); string htmlCode = "" + - "" + - "" + - "
管线类型管线编码管径_毫米材质管线埋深
" + - "" + - "" + - "" + - "" + - "
"; - webBrowser1.DocumentText = htmlCode; - - - } - /// - /// 图表鼠标单击事件处理 - /// - /// - /// - private void chart1_MouseClick(object sender, MouseEventArgs e) - { - HitTestResult result = chart1.HitTest(e.X, e.Y, true); - if (result.PointIndex >= 0) - { - DataPoint p = (DataPoint)result.Object; - if (p == null) - { - return; - } - string number = p.LegendText; - int indexInTableRows = 0; - bool isInt = int.TryParse(number, out indexInTableRows); - if (isInt) - { - DataRow row = table.Rows[indexInTableRows - 1]; - string htmlCode = "" + - "" + - "" + - "
管线类型管线编码管径_毫米材质管线埋深
" + row[1] + - "" + row[2] + - "" + row[3] + - "" + row[4] + - "" + row[5] + - "
"; - webBrowser1.DocumentText = htmlCode; - } - } - } - /// - /// 窗体关闭事件处理 - /// - /// - /// - private void FrmRoadHDM_FormClosing(object sender, FormClosingEventArgs e) - { - allPipelineAnalysis = null; - globeControl1.Globe.MemoryLayer.RemoveAllFeature(); - } - /// - /// 图表鼠标移动事件处理 - /// - /// - /// - private void chart1_MouseMove(object sender, MouseEventArgs e) - { - HitTestResult result = chart1.HitTest(e.X, e.Y, true); - if (result.PointIndex >= 0) - { - this.Cursor = Cursors.Hand; - } - else - { - this.Cursor = Cursors.Default; - } - } - - private void Export(GSOPoint3d _pnt, double r) - { - GSOPoint3ds pnts = new GSOPoint3ds(); - GSOPoint3d pnt = new GSOPoint3d(); - pnt.X = _pnt.X; - pnt.Y = _pnt.Y; - pnt.Z = _pnt.Z; - pnts.Add(pnt); - pnt.X = _pnt.X; - pnt.Y = _pnt.Y - 0.0000000005; - pnt.Z = _pnt.Z; - pnts.Add(pnt); - GSOGeoPolyline3D line = new GSOGeoPolyline3D(); - line.AddPart(pnts); - GSOGeoPolygon3D polygon = line.CreateBuffer(r * 2, true, 5, true, false); - GSOPoint3ds points = polygon[0]; - GSOGeoPolyline3D newLine = new GSOGeoPolyline3D(); - newLine.AddPart(points); - newLine.AltitudeMode = EnumAltitudeMode.RelativeToGround; - GSOFeature newFeature = new GSOFeature(); - newFeature.Geometry = newLine; - globeControl1.Globe.MemoryLayer.AddFeature(newFeature); - } - - private void ExportCAD(double a, double b, double r) - { - GSOPoint3ds pnts = new GSOPoint3ds(); - for (int i = 0; i <= 64; i++) - { - double x = a + r * Math.Cos(i * 5.625 * Math.PI / 180); - double y = b - r * Math.Sin(i * 5.625 * Math.PI / 180); - GSOPoint2d pt2d = new GeoScene.Data.GSOPoint2d(x, y); - GSOPoint3d pnt = new GSOPoint3d(); - pnt.X = pt2d.X; - pnt.Y = pt2d.Y; - pnt.Z = 0; - pnts.Add(pnt); - } - GSOGeoPolyline3D line = new GSOGeoPolyline3D(); - line.AddPart(pnts); - GSOFeature f = new GSOFeature(); - f.Geometry = line; - f.Geometry.LatLonCoord = false; - f.Visible = false; - layerTemp.AddFeature(f); - } - /// - /// 导出CAD按钮事件处理 - /// - /// - /// - private void btnExportCAD_Click(object sender, EventArgs e) - { - layerTemp.RemoveAllFeature(); - for (int i = 0; i < listPoint.Count; i++) - { - GSOPoint3d geoPoint = (GSOPoint3d)listPoint[i]; - GSOFeature feature = listFeat[i] as GSOFeature; - if (feature != null) - { - if (feature.Geometry.Type == EnumGeometryType.GeoPolyline3D) - { - GSOPipeLineStyle3D style = feature.Geometry.Style as GSOPipeLineStyle3D; - double r = style.Radius; - ExportCAD(double.Parse(sortIndex[i, 0].ToString()), geoPoint.Z, r); - } - } - } - layerTemp.Dataset.ImportProjectionRefFromProj4(""); - SaveFileDialog dlg = new SaveFileDialog(); - dlg.Filter = "*.dxf|*.dxf"; - if (dlg.ShowDialog() == DialogResult.OK) - { - layerTemp.SaveAs(dlg.FileName); - MessageBox.Show("导出CAD完成!", "提示"); - } - layerTemp.RemoveAllFeature(); - } - } -} diff --git a/FrmRoadHDM.designer.cs b/FrmRoadHDM.designer.cs deleted file mode 100644 index 23a4c3b..0000000 --- a/FrmRoadHDM.designer.cs +++ /dev/null @@ -1,132 +0,0 @@ -namespace Cyberpipe -{ - partial class FrmRoadHDM - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmRoadHDM)); - System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea1 = new System.Windows.Forms.DataVisualization.Charting.ChartArea(); - System.Windows.Forms.DataVisualization.Charting.Series series1 = new System.Windows.Forms.DataVisualization.Charting.Series(); - this.pictureBox1 = new System.Windows.Forms.PictureBox(); - this.webBrowser1 = new System.Windows.Forms.WebBrowser(); - this.chart1 = new System.Windows.Forms.DataVisualization.Charting.Chart(); - this.btnExportCAD = new DevComponents.DotNetBar.ButtonX(); - ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.chart1)).BeginInit(); - this.SuspendLayout(); - // - // pictureBox1 - // - this.pictureBox1.BackColor = System.Drawing.Color.White; - this.pictureBox1.Dock = System.Windows.Forms.DockStyle.Top; - this.pictureBox1.ErrorImage = null; - this.pictureBox1.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image"))); - this.pictureBox1.ImageLocation = ""; - this.pictureBox1.Location = new System.Drawing.Point(0, 0); - this.pictureBox1.Name = "pictureBox1"; - this.pictureBox1.Size = new System.Drawing.Size(608, 64); - this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; - this.pictureBox1.TabIndex = 1; - this.pictureBox1.TabStop = false; - // - // webBrowser1 - // - this.webBrowser1.Dock = System.Windows.Forms.DockStyle.Bottom; - this.webBrowser1.Location = new System.Drawing.Point(0, 326); - this.webBrowser1.MinimumSize = new System.Drawing.Size(20, 20); - this.webBrowser1.Name = "webBrowser1"; - this.webBrowser1.ScrollBarsEnabled = false; - this.webBrowser1.Size = new System.Drawing.Size(608, 139); - this.webBrowser1.TabIndex = 3; - // - // chart1 - // - chartArea1.AxisX.MajorGrid.Enabled = false; - chartArea1.Name = "ChartArea1"; - this.chart1.ChartAreas.Add(chartArea1); - this.chart1.Location = new System.Drawing.Point(0, 66); - this.chart1.Name = "chart1"; - this.chart1.RightToLeft = System.Windows.Forms.RightToLeft.Yes; - series1.ChartArea = "ChartArea1"; - series1.Name = "管线"; - this.chart1.Series.Add(series1); - this.chart1.Size = new System.Drawing.Size(608, 254); - this.chart1.TabIndex = 2; - this.chart1.Text = "chart1"; - this.chart1.MouseClick += new System.Windows.Forms.MouseEventHandler(this.chart1_MouseClick); - this.chart1.MouseMove += new System.Windows.Forms.MouseEventHandler(this.chart1_MouseMove); - // - // btnExportCAD - // - this.btnExportCAD.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; - this.btnExportCAD.Anchor = System.Windows.Forms.AnchorStyles.Bottom; - this.btnExportCAD.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground; - this.btnExportCAD.Location = new System.Drawing.Point(268, 430); - this.btnExportCAD.Name = "btnExportCAD"; - this.btnExportCAD.Size = new System.Drawing.Size(75, 23); - this.btnExportCAD.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; - this.btnExportCAD.TabIndex = 4; - this.btnExportCAD.Text = "导出CAD"; - this.btnExportCAD.Click += new System.EventHandler(this.btnExportCAD_Click); - // - // FrmRoadHDM - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.BackColor = System.Drawing.Color.White; - this.ClientSize = new System.Drawing.Size(608, 465); - this.Controls.Add(this.btnExportCAD); - this.Controls.Add(this.chart1); - this.Controls.Add(this.webBrowser1); - this.Controls.Add(this.pictureBox1); - this.DoubleBuffered = true; - this.EnableGlass = false; - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; - this.MaximizeBox = false; - this.Name = "FrmRoadHDM"; - this.ShowIcon = false; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; - this.Text = "道路与管线综合横断面"; - this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FrmRoadHDM_FormClosing); - this.Load += new System.EventHandler(this.FrmRoadHDM_Load); - this.Shown += new System.EventHandler(this.FrmRoadHDM_Shown); - ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.chart1)).EndInit(); - this.ResumeLayout(false); - - } - - #endregion - - private System.Windows.Forms.PictureBox pictureBox1; - private System.Windows.Forms.WebBrowser webBrowser1; - private System.Windows.Forms.DataVisualization.Charting.Chart chart1; - private DevComponents.DotNetBar.ButtonX btnExportCAD; - - - } -} \ No newline at end of file diff --git a/FrmRoadHDM.resx b/FrmRoadHDM.resx deleted file mode 100644 index 5202d5f..0000000 --- a/FrmRoadHDM.resx +++ /dev/null @@ -1,177 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - - - 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 - iNKUe3NRsLcAAAAASUVORK5CYII= - - - \ No newline at end of file diff --git a/MainFrm.cs b/MainFrm.cs index e9b6cbe..2df3aac 100644 --- a/MainFrm.cs +++ b/MainFrm.cs @@ -75,15 +75,6 @@ private string trackflag;//定义阀门查询个数 - private GSOFeature m_ConnexityAnalysisFirstFeature; - private GSOFeature m_ConnexityAnaylsisSecondFeature; - private GSOLayer m_ConnexityAnalysisFirstLayer; - private GSOLayer m_COnnexityAnalysisSecondLayer; - private GSOFeatures m_ConnexityAnalyResFeatures; - private GSOFeatures m_TraceUpDownAnalyResFeatures; - private GSOFeatures m_AffectedPipeLines; - private GSOFeatures m_CloseValvesAnalyResFeatures; - private GSOFeatures m_BoosterValvesAnalyResFeatures; //管线间距分析 private GSOFeature disFeature = new GSOFeature(); private GSOFeature featureDis = new GSOFeature(); @@ -2656,8 +2647,37 @@ ///
/// /// + private static EnumTrackPolylineEndMode trackPolylineEndMode; + void globeControl1_TrackPolylineEndEvent(object sender, TrackPolylineEndEventArgs e) { + //横断面分析、道路横断面分析 + if (trackPolylineEndMode == EnumTrackPolylineEndMode.HDM_Analysis|| + trackPolylineEndMode == EnumTrackPolylineEndMode.DLDM_Analysis) + { + Dictionary hdmDic = SectionAnalysisTool.HDMAnalysis(this.globeControl1, + e.Polyline, this.m_PipelineLayerNames); + FrmHDMAnalysis3 frm = new FrmHDMAnalysis3(hdmDic, this.globeControl1, + trackPolylineEndMode); + frm.Show(this); + } + //基线剖面分析 + else if (trackPolylineEndMode == EnumTrackPolylineEndMode.JXPM_Analysis) + { + FrmBaseLineProfillAnalysis dlg = new FrmBaseLineProfillAnalysis(globeControl1.Globe, e.Polyline); + dlg.Show(this); + globeControl1.Globe.ClearLastTrackPolyline(); + /* + FrmRoadHDM f = new FrmRoadHDM(); + f.Show() + * **/ + } + else + { + + } + trackPolylineEndMode = EnumTrackPolylineEndMode.Default_Analysis; + /* ArrayList arraylistPoint = new ArrayList(); ArrayList arraylistLine = new ArrayList(); @@ -2835,6 +2855,7 @@ } globeControl1.Globe.Action = EnumAction3D.ActionNull; ActionToolMenuChecked(); + * **/ } #endregion @@ -4962,10 +4983,10 @@ if (globeControl1.Globe.Action != EnumAction3D.NormalHit) { buttonItemFX3_6.Checked = false; - ClearConnexityAnalysis(); + // ClearConnexityAnalysis(); buttonItemFX3_5.Checked = false; - ClearCloseValvesAnalysis(); + // ClearCloseValvesAnalysis(); } if (globeControl1.Globe.Action != EnumAction3D.TrackPolygon) { @@ -4973,131 +4994,7 @@ buttonItemFX4_1.Checked = false; } } - /// - /// 连通性分析 功能 - /// - private void ConnexityAnalysis() - { - GSODataset curCAYDataset = m_ConnexityAnalysisFirstLayer.Dataset; - string srName = curCAYDataset.Name; - GSONetworkDataset curCAYNDataset = curCAYDataset.DataSource.GetDatasetByName(srName + "Network") as GSONetworkDataset; - if (curCAYNDataset == null) - { - MessageBox.Show("该图层没有创建网络拓扑,请先创建网络拓扑信息再进行分析!", "提示"); - return; - } - int[] arryResID; - curCAYNDataset.ConnexityAnalysis(m_ConnexityAnalysisFirstFeature.ID, m_ConnexityAnaylsisSecondFeature.ID, out arryResID, false, true); - m_ConnexityAnalyResFeatures = m_ConnexityAnalysisFirstLayer.GetFeaturesByIDs(arryResID); - if (m_ConnexityAnalyResFeatures == null || m_ConnexityAnalyResFeatures.Length < 1) - { - String strLine1 = "管线:" + m_ConnexityAnalysisFirstFeature.ID; - String strLine2 = "管线:" + m_ConnexityAnaylsisSecondFeature.ID; - MessageBox.Show(strLine1 + " 与 " + strLine2 + " 不连通", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); - } - else - { - int nCount = m_ConnexityAnalyResFeatures.Length; - for (int i = 0; i < nCount; i++) - { - m_ConnexityAnalyResFeatures[i].HighLight = true; - GSOGeoPolyline3D geoline = m_ConnexityAnalyResFeatures[i].Geometry as GSOGeoPolyline3D; - if (geoline != null) - { - GSOLineStyle3D lineStyle = geoline.Style as GSOLineStyle3D; - if (lineStyle != null) - { - if (lineStyle.ArrowStyle == null) - { - lineStyle.ArrowStyle = new GSOArrowStyle(); - - } - lineStyle.ArrowStyle.BodyLen = 8; - lineStyle.ArrowVisible = true; - lineStyle.ArrowStyle.Play(); - } - } - } - globeControl1.Refresh(); - } - } - /// - /// 清除连通性分析结果 功能 - /// - private void ClearConnexityAnalysis() - { - if (m_ConnexityAnalysisFirstFeature != null) - { - m_ConnexityAnalysisFirstFeature.HighLight = false; - m_ConnexityAnalysisFirstFeature.Label = null; - } - if (m_ConnexityAnaylsisSecondFeature != null) - { - m_ConnexityAnaylsisSecondFeature.HighLight = false; - m_ConnexityAnaylsisSecondFeature.Label = null; - } - - m_ConnexityAnalysisFirstFeature = null; - m_ConnexityAnaylsisSecondFeature = null; - m_ConnexityAnalysisFirstLayer = null; - m_COnnexityAnalysisSecondLayer = null; - - if (m_ConnexityAnalyResFeatures != null) - { - int nCount = m_ConnexityAnalyResFeatures.Length; - - for (int i = 0; i < nCount; i++) - { - m_ConnexityAnalyResFeatures[i].HighLight = false; - GSOGeoPolyline3D geoline = m_ConnexityAnalyResFeatures[i].Geometry as GSOGeoPolyline3D; - if (geoline != null) - { - GSOLineStyle3D lineStyle = geoline.Style as GSOLineStyle3D; - if (lineStyle != null) - { - lineStyle.ArrowVisible = false; - } - } - } - m_ConnexityAnalyResFeatures = null; - - } - } - /// - /// 清除阀门分析结果 功能 - /// - private void ClearCloseValvesAnalysis() - { - if (m_CloseValvesAnalyResFeatures != null) - { - for (int i = 0; i < m_CloseValvesList.Count; i++) - { - GSOFeature feature = m_CloseValvesList[i] as GSOFeature; - feature.Label.Text = ""; - } - globeControl1.Refresh(); - m_CloseValvesAnalyResFeatures = null; - m_CloseValvesList = new ArrayList(); - } - } - /// - /// 清除阀门分析结果 功能 - /// - private void ClearBoosterValvesAnalysis() - { - if (m_BoosterValvesAnalyResFeatures != null) - { - for (int i = 0; i < m_BoosterValvesList.Count; i++) - { - GSOFeature feature = m_BoosterValvesList[i] as GSOFeature; - feature.Label.Text = ""; - } - globeControl1.Refresh(); - m_BoosterValvesAnalyResFeatures = null; - m_BoosterValvesList = new ArrayList(); - } - } /// /// 主窗体关闭事件处理 /// @@ -5118,211 +5015,7 @@ //注销id号为103的热键设定 // UnregisterHotKey(Handle, 103); } - /// - /// 清除追踪结果 功能 : Fan 可去掉了! - /// - private void ClearUpDownTraceAnalysis() - { - if (m_TraceUpDownAnalyResFeatures != null) - { - int nCount = m_TraceUpDownAnalyResFeatures.Length; - for (int i = 0; i < nCount; i++) - { - m_TraceUpDownAnalyResFeatures[i].HighLight = false; - GSOGeoPolyline3D geoline = m_TraceUpDownAnalyResFeatures[i].Geometry as GSOGeoPolyline3D; - if (geoline != null) - { - GSOLineStyle3D lineStyle = geoline.Style as GSOLineStyle3D; - if (lineStyle != null) - { - lineStyle.ArrowVisible = false; - } - } - } - m_TraceUpDownAnalyResFeatures = null; - } - } - /// - /// 取消所有高亮管线的高亮状态 - /// - private void ClearAffectedPipeLine() - { - if (m_AffectedPipeLines != null) - { - int nCount = m_AffectedPipeLines.Length; - for (int i = 0; i < nCount; i++) - { - m_AffectedPipeLines[i].HighLight = false; - } - m_AffectedPipeLines = null; - } - } - #region Fan 拓扑分析 - /// - /// 上下游追踪 功能 - /// - /// - private void NetworkTraceUpDown(Boolean bTraceUp) - { - GSOFeature selLineFeature = globeControl1.Globe.SelectedObject; - if (selLineFeature == null || selLineFeature.Geometry == null || selLineFeature.Geometry.Type != EnumGeometryType.GeoPolyline3D) - { - MessageBox.Show("请点击“编辑”—“选中对象”选择一条线!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); - return; - } - GSOLayer selLayer = globeControl1.Globe.SelectedObjectLayer; - - NetworkAnalysisTool.TraceUpDownAnalysis(bTraceUp, - selLineFeature, selLayer); - /* - if (globeControl1.Globe.SelectedObject == null) - { - MessageBox.Show("请点击“编辑”—“选中对象”选择一条线!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); - return; - } - GSOFeature selLineFeature = globeControl1.Globe.SelectedObject; - - if (selLineFeature.Geometry == null || selLineFeature.Geometry.Type != EnumGeometryType.GeoPolyline3D) - { - MessageBox.Show("请点击“编辑”—“选中对象”选择一条线!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); - return; - } - - if (globeControl1.Globe.SelectedObjectLayer == null) - { - MessageBox.Show("选中管线所在图层为空!", "提示"); - return; - } - - GSODataset curCAYDataset = globeControl1.Globe.SelectedObjectLayer.Dataset; - if (curCAYDataset == null || curCAYDataset.DataSource == null) - { - MessageBox.Show("选中管线所在图层不是数据库图层!", "提示"); - return; - } - - string srName = curCAYDataset.Name; - GSONetworkDataset curCAYNDataset = curCAYDataset.DataSource.GetDatasetByName(srName + "Network") as GSONetworkDataset; - - if (curCAYNDataset == null) - { - MessageBox.Show("选中管线所在图层没有创建拓扑!", "提示"); - return; - } - - int[] arryResID; - curCAYNDataset.TraceUpDownAnalysis(selLineFeature.ID, out arryResID, bTraceUp, false, true); - m_TraceUpDownAnalyResFeatures = globeControl1.Globe.SelectedObjectLayer.GetFeaturesByIDs(arryResID); - if (m_TraceUpDownAnalyResFeatures == null || m_TraceUpDownAnalyResFeatures.Length < 1) - { - String strLine1 = "没有上游!"; - if (!bTraceUp) - { - strLine1 = "没有下游!"; - - } - MessageBox.Show(strLine1); - } - else - { - int nCount = m_TraceUpDownAnalyResFeatures.Length; - for (int i = 0; i < nCount; i++) - { - m_TraceUpDownAnalyResFeatures[i].HighLight = true; - GSOGeoPolyline3D geoline = m_TraceUpDownAnalyResFeatures[i].Geometry as GSOGeoPolyline3D; - if (geoline != null) - { - GSOLineStyle3D lineStyle = geoline.Style as GSOLineStyle3D; - if (lineStyle != null) - { - if (lineStyle.ArrowStyle == null) - { - lineStyle.ArrowStyle = new GSOArrowStyle(); - lineStyle.ArrowStyle.BodyWidth = 2; - lineStyle.ArrowStyle.BodyLen = 6; - lineStyle.ArrowStyle.HeadWidth = 8; - lineStyle.ArrowStyle.HeadLen = 10; - lineStyle.ArrowStyle.OutlineVisible = true; - lineStyle.ArrowStyle.OutlineColor = Color.Red; - lineStyle.ArrowStyle.Speed = lineStyle.ArrowStyle.Speed / 2; - } - lineStyle.ArrowVisible = true; - lineStyle.ArrowStyle.Play(); - } - } - } - globeControl1.Refresh(); - } - * **/ - } - - #endregion - /// - /// 上下游追踪 功能 - /// - /// - private void AffectedPipeLine(Boolean bTraceUp) - { - if (globeControl1.Globe.SelectedObject == null) - { - MessageBox.Show("请点击“编辑”—“选中对象”选择一条线!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); - return; - } - GSOFeature selLineFeature = globeControl1.Globe.SelectedObject; - if (selLineFeature.Geometry == null || selLineFeature.Geometry.Type != EnumGeometryType.GeoPolyline3D) - { - MessageBox.Show("请点击“编辑”—“选中对象”选择一条线!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); - - return; - } - - if (globeControl1.Globe.SelectedObjectLayer == null) - { - return; - } - - GSODataset curCAYDataset = globeControl1.Globe.SelectedObjectLayer.Dataset; - if (curCAYDataset == null || curCAYDataset.DataSource == null) - { - return; - } - - string srName = curCAYDataset.Name; - GSONetworkDataset curCAYNDataset = curCAYDataset.DataSource.GetDatasetByName(srName + "Network") as GSONetworkDataset; - - if (curCAYNDataset == null) - { - return; - } - int[] arryResID; - curCAYNDataset.TraceUpDownAnalysis(selLineFeature.ID, out arryResID, bTraceUp, false, true); - m_AffectedPipeLines = globeControl1.Globe.SelectedObjectLayer.GetFeaturesByIDs(arryResID); - if (m_AffectedPipeLines == null || m_AffectedPipeLines.Length < 1) - { - } - else - { - int nCount = m_AffectedPipeLines.Length; - for (int i = 0; i < nCount; i++) - { - m_AffectedPipeLines[i].HighLight = true; - } - globeControl1.Refresh(); - } - } - /// - /// 清除上下游追踪结果 菜单 - /// - /// - /// - //private void buttonItem58_Click(object sender, EventArgs e) - //{ - // //日志记录 - // LogManager.saveLog(Utility.userName, this.buttonItem58.Text); - - // ClearUpDownTraceAnalysis(); - //} - + /// /// 显示流向 功能 /// @@ -5359,158 +5052,8 @@ } FrmCloseValves frm; - /// - /// 关阀分析 功能 - /// - /// - /// - /// - /// - private bool NetworkCloseValvesAnalysis(GSOFeature lineFeature, GSOPoint3d pntBreak, GSOLayer lineLayer) - { - /* - if (lineLayer == null || lineFeature == null || lineFeature.Geometry == null || lineFeature.Geometry.Type != EnumGeometryType.GeoPolyline3D) - { - return false; - } - GSODataset curCAYDataset = lineLayer.Dataset; - if (curCAYDataset == null || curCAYDataset.DataSource == null) - { - MessageBox.Show("该图层不是要素图层!", "提示"); - return false; - } - string srName = curCAYDataset.Name; - GSONetworkDataset curCAYNDataset = curCAYDataset.DataSource.GetDatasetByName(srName + "Network") as GSONetworkDataset; - - if (curCAYNDataset == null) - { - MessageBox.Show("该图层没有创建网络拓扑,请先创建网络拓扑信息再进行分析!", "提示"); - return false; - } - ClearCloseValvesAnalysis(); - - int[] arryResNodeID = null; - int[] arryResValveID = null; - try - { - curCAYNDataset.CloseValveAnalysis(lineFeature.ID, out arryResNodeID, out arryResValveID, false, true); - } - catch (Exception e) - { } - - string valveName = lineLayer.Caption; - valveName = valveName.Substring(0, valveName.IndexOf("管线")); - GSOLayer valveLayer = globeControl1.Globe.Layers[valveName + "阀门"]; - if (valveLayer == null) - { - MessageBox.Show("和选中对象所在管线图层相关联的阀门图层不存在!", "提示"); - return false; - } - - m_CloseValvesAnalyResFeatures = valveLayer.GetFeaturesByIDs(arryResValveID);// curCAYNDataset.NodeDataset.GetFeaturesByIDs(arryResValveID); - - if (m_CloseValvesAnalyResFeatures == null || m_CloseValvesAnalyResFeatures.Length < 1) - { - MessageBox.Show("没有找到要关闭的阀门!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); - if (frm != null) - { - frm.Close(); - } - } - else - { - int nCount = m_CloseValvesAnalyResFeatures.Length; - - if (nCount > 0) - { - frm = FrmCloseValves.getForm(globeControl1, m_CloseValvesAnalyResFeatures, m_CloseValvesList); - - if (!frm.Visible) - { - frm.Show(this); - } - } - }**/ - return true; - } FrmBoosterValvers frmbooster = null; - /// - /// 阀门分析 功能 - /// - /// - /// - /// - /// - private bool NetworkBoosterValvesAnalysis(GSOFeature lineFeature, GSOPoint3d pntBreak, GSOLayer lineLayer) - { - if (lineLayer == null || lineFeature == null || lineFeature.Geometry == null || lineFeature.Geometry.Type != EnumGeometryType.GeoPolyline3D) - { - return false; - } - GSODataset curCAYDataset = lineLayer.Dataset; - - if (curCAYDataset == null || curCAYDataset.DataSource == null) - { - return false; - } - string srName = curCAYDataset.Name; - GSONetworkDataset curCAYNDataset = curCAYDataset.DataSource.GetDatasetByName(srName + "Network") as GSONetworkDataset; - - if (curCAYNDataset == null) - { - MessageBox.Show("该图层没有创建网络拓扑,请先创建网络拓扑信息再进行分析!", "提示"); - return false; - } - ClearBoosterValvesAnalysis(); - ClearAffectedPipeLine(); - - int[] arryResNodeID = null; - int[] arryResValveID = null; - try - { - curCAYNDataset.CloseValveAnalysis(lineFeature.ID, out arryResNodeID, out arryResValveID, false, true); - } - catch (Exception e) - { - - } - //目前只有燃气管线 有阀门 - string valveName = lineLayer.Name; - valveName = valveName.Substring(0, valveName.IndexOf("管线")); - GSOLayer valveLayer = globeControl1.Globe.Layers[valveName + "阀门"]; - if (valveLayer == null) - { - MessageBox.Show("和选中对象所在管线图层相关联的阀门图层不存在!", "提示"); - return false; - } - m_BoosterValvesAnalyResFeatures = valveLayer.GetFeaturesByIDs(arryResValveID); - - if (m_BoosterValvesAnalyResFeatures == null || - m_BoosterValvesAnalyResFeatures.Length < 1) - { - MessageBox.Show("没有找到要关闭的阀门!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); - if (frmbooster != null) - { - frmbooster.Close(); - } - } - else - { - int nCount = m_BoosterValvesAnalyResFeatures.Length; - if (nCount > 0) - { - AffectedPipeLine(false); - frmbooster = FrmBoosterValvers.getForm(globeControl1, m_BoosterValvesAnalyResFeatures, m_BoosterValvesList, m_AffectedPipeLines); - frmbooster.setLstValvesName(); - if (!frmbooster.Visible) - { - frmbooster.Show(this); - } - } - } - return true; - } /// /// 垂直净距分析 功能界面中的 选择图层复选框 选中状态改变事件处理 @@ -7726,69 +7269,6 @@ double distance = lineline.GetSpaceLength(true, 6378137.0); return distance; } - /// - /// 判断管线是否相通 功能 - /// - /// - public bool isInterlinked() - { - if (globeControl1.Globe.SelObjectCount < 2) - { - MessageBox.Show("请选中至少两个管线!!"); - buttonItemFX3_6.Checked = false; - return false; - } - ClearConnexityAnalysis(); - globeControl1.Globe.GetSelectObject(0, out m_ConnexityAnalysisFirstFeature, out m_ConnexityAnalysisFirstLayer); - globeControl1.Globe.GetSelectObject(1, out m_ConnexityAnaylsisSecondFeature, out m_COnnexityAnalysisSecondLayer); - GSOGeoPolyline3D line1 = m_ConnexityAnalysisFirstFeature.Geometry as GSOGeoPolyline3D; - GSOGeoPolyline3D line2 = m_ConnexityAnaylsisSecondFeature.Geometry as GSOGeoPolyline3D; - if (line1 == null || line2 == null) - { - MessageBox.Show("请选择管线!!"); - return false; - } - GSOPipeLineStyle3D pipeStyle1 = line1.Style as GSOPipeLineStyle3D; - GSOPipeLineStyle3D pipeStyle2 = line2.Style as GSOPipeLineStyle3D; - if (pipeStyle1 == null || pipeStyle2 == null) - { - MessageBox.Show("请选择管线!!"); - return false; - } - if (!m_ConnexityAnalysisFirstLayer.IsSameInnerObject(m_COnnexityAnalysisSecondLayer)) - { - MessageBox.Show("不在同一个图层!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); - ClearConnexityAnalysis(); - return false; - } - else - { - GSODataset curCAYDataset = m_ConnexityAnalysisFirstLayer.Dataset; - string srName = curCAYDataset.Name; - GSONetworkDataset curCAYNDataset = curCAYDataset.DataSource.GetDatasetByName(srName + "Network") as GSONetworkDataset; - if (curCAYNDataset == null) - { - MessageBox.Show("该图层没有创建网络拓扑,请先创建网络拓扑信息再进行分析!", "提示"); - return false; - } - - int[] arryResID; - curCAYNDataset.ConnexityAnalysis(m_ConnexityAnalysisFirstFeature.ID, m_ConnexityAnaylsisSecondFeature.ID, out arryResID, false, true); - m_ConnexityAnalyResFeatures = m_ConnexityAnalysisFirstLayer.GetFeaturesByIDs(arryResID); - if (m_ConnexityAnalyResFeatures == null || m_ConnexityAnalyResFeatures.Length < 1) - { - String strLine1 = "管线:" + m_ConnexityAnalysisFirstFeature.ID; - String strLine2 = "管线:" + m_ConnexityAnaylsisSecondFeature.ID; - MessageBox.Show("请选择两条相通的管线!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); - return false; - } - else - { - return true; - } - } - } - /// /// 图层节点树中 节点 右键单击事件处理 @@ -9564,27 +9044,7 @@ } } - /// - /// 清除分析结果 - /// - /// - /// - //private void buttonItem131_Click(object sender, EventArgs e) - //{ - // LogManager.saveLog(Utility.userName, this.buttonItem131.Text); - - // clearFeatureHighLight(); - // //if (boolfrmShResult == true) - // //{ - // // frmShResult.Close(); - // //} - // //else - // //{ - - // //} - - // ClearRedlineAnalyseResult(); - //} + /// /// 清除渲染结果 /// @@ -10728,8 +10188,9 @@ buttonX16_Click(null, null); buttonClearAnalysisResult_Click(null, null); - ClearConnexityAnalysis();//清除连通性分析 - ClearCloseValvesAnalysis();//清除阀门分析 + NetworkAnalysisTool.ClearAllTopAnalysis(this.globeControl1); + // ClearConnexityAnalysis();//清除连通性分析 + // ClearCloseValvesAnalysis();//清除阀门分析 //清除管线间距分析 if (disFeature != null) @@ -10753,7 +10214,7 @@ globeControl1.Globe.UnderGroundFloor.Visible = false;//隐藏地下网格线 - ClearUpDownTraceAnalysis(); //清除上下游分析 + // ClearUpDownTraceAnalysis(); //清除上下游分析 globeControl1.Globe.RemoveAllPits();//清除所有坑 string[] markerStrs = new string[9]; @@ -11206,6 +10667,8 @@ sideBar1.Refresh(); Refresh(); } + + #region Predaotr,断面分析 /// /// 横断面分析 /// @@ -11213,26 +10676,11 @@ /// private void buttonItemFX2_1_Click(object sender, EventArgs e) { - //日志记录 - LogManager.saveLog(Utility.userName, this.buttonItemFX2_1.Text); - - if (!buttonItemFX2_1.Checked) - { - trackflag = "PolylineAnalysis"; - globeControl1.Globe.Action = EnumAction3D.TrackPolyline; - globeControl1.Globe.TrackPolylineTool.VerticalLineVisible = true; - globeControl1.Globe.TrackPolylineTool.TrackMode = EnumTrackMode.SpaceTrack; - buttonItemFX2_1.Checked = true; - buttonItemFX2_3.Checked = false; - buttonItemFX2_4.Checked = false; - } - else - { - globeControl1.Globe.Action = EnumAction3D.ActionNull; - buttonItemFX2_1.Checked = false; - globeControl1.Globe.TrackPolylineTool.VerticalLineVisible = false; - } - ActionToolMenuChecked(); + globeControl1.Globe.Action = EnumAction3D.TrackPolyline; + globeControl1.Globe.TrackPolylineTool.VerticalLineVisible = true; + globeControl1.Globe.TrackPolylineTool.TrackMode = EnumTrackMode.SpaceTrack; + trackPolylineEndMode = EnumTrackPolylineEndMode.HDM_Analysis; + } /// /// 纵断面分析 @@ -11241,235 +10689,28 @@ /// private void buttonItemFX2_2_Click(object sender, EventArgs e) { - //日志记录 - LogManager.saveLog(Utility.userName, this.buttonItemFX2_2.Text); - - if (globeControl1.Globe.SelObjectCount >= 1) + if (globeControl1.Globe.SelObjectCount<1) { - GSOFeatures selectFeatures = new GSOFeatures(); - for (int i = 0; i < globeControl1.Globe.SelObjectCount; i++) + MessageBox.Show("请选择一条或者多条管线!", "提示", MessageBoxButtons.OK, + MessageBoxIcon.Information); + return; + } + GSOFeatures selectFeatures = new GSOFeatures(); + for (int i = 0; i < globeControl1.Globe.SelObjectCount; i++) + { + GSOFeature feature = null; + GSOLayer layer = null; + globeControl1.Globe.GetSelectObject(i, out feature, out layer); + if (feature != null && feature.Geometry != null && feature.Geometry.Type == EnumGeometryType.GeoPolyline3D) { - GSOFeature feature = null; - GSOLayer layer = null; - globeControl1.Globe.GetSelectObject(i, out feature, out layer); - if (feature != null && feature.Geometry != null && feature.Geometry.Type == EnumGeometryType.GeoPolyline3D) - { - selectFeatures.Add(feature); - } - } - if (selectFeatures.Length < 1) - { - MessageBox.Show("请选择一条或者多条管线!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); - return; - } - List listFeature = new List(); - if (selectFeatures.Length == 1) - { - listFeature.Add(selectFeatures[0]); - } - else - { - //求多条管线纵断面 1,2,3 - //1 判断管线是否相连、且没有分叉 - for (int i = 0; i < selectFeatures.Length; i++) - { - GSOGeoPolyline3D line = selectFeatures[i].Geometry as GSOGeoPolyline3D; - bool isConnect = false; - int[] valueCount = new int[2]; - valueCount[0] = 0; - valueCount[1] = 0; - - if (line != null && line.PartCount > 0) - { - for (int j = 0; j < selectFeatures.Length; j++) - { - if (i == j) - { - continue; - } - GSOGeoPolyline3D newLine = selectFeatures[j].Geometry as GSOGeoPolyline3D; - if (newLine != null && newLine.PartCount > 0) - { - int minValueIndex = 0; - double limitValue = 1.0; - double[] value = new double[4]; - value[0] = getDistance(line[line.PartCount - 1][line[line.PartCount - 1].Count - 1], newLine[0][0]); - value[1] = getDistance(line[line.PartCount - 1][line[line.PartCount - 1].Count - 1], newLine[newLine.PartCount - 1][newLine[newLine.PartCount - 1].Count - 1]); - value[2] = getDistance(line[0][0], newLine[0][0]); - value[3] = getDistance(line[0][0], newLine[newLine.PartCount - 1][newLine[newLine.PartCount - 1].Count - 1]); - double minValue = value[0]; - for (int m = 1; m < value.Length; m++) - { - if (minValue > value[m]) - { - minValue = value[m]; - minValueIndex = m; - } - } - if (minValue < limitValue) - { - isConnect = true; - if (minValueIndex > 1) - { - valueCount[1]++; - } - else - { - valueCount[0]++; - } - } - } - } - if (!isConnect || valueCount[0] > 1 || valueCount[1] > 1) - { - MessageBox.Show("请选择相连接的一条线上的管线!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); - return; - } - } - } - //2 记录每一条相连接的管线的起点和终点,并添加到一条管线中 - for (int p = 0; p < selectFeatures.Length; p++) - { - GSOGeoPolyline3D line = selectFeatures[p].Geometry as GSOGeoPolyline3D; - if (line != null && line.PartCount > 0) - { - for (int n = 0; n < selectFeatures.Length; n++) - { - if (p == n) - { - continue; - } - GSOGeoPolyline3D newLine = selectFeatures[n].Geometry as GSOGeoPolyline3D; - if (newLine != null && newLine.PartCount > 0) - { - int minValueIndex = 0; - double limitValue = 1.0; - double[] value = new double[4]; - value[0] = getDistance(line[line.PartCount - 1][line[line.PartCount - 1].Count - 1], newLine[0][0]); - value[1] = getDistance(line[line.PartCount - 1][line[line.PartCount - 1].Count - 1], newLine[newLine.PartCount - 1][newLine[newLine.PartCount - 1].Count - 1]); - value[2] = getDistance(line[0][0], newLine[0][0]); - value[3] = getDistance(line[0][0], newLine[newLine.PartCount - 1][newLine[newLine.PartCount - 1].Count - 1]); - double minValue = value[0]; - for (int m = 1; m < value.Length; m++) - { - if (minValue > value[m]) - { - minValue = value[m]; - minValueIndex = m; - } - } - if (minValue < limitValue) - { - GSOFeature featureFromAllSelectedObj = new GSOFeature(); - GSOGeoPolyline3D lineFromAllSelectedObj = new GSOGeoPolyline3D(); - switch (minValueIndex) - { - case 0: - GSOPoint3ds linePart = new GSOPoint3ds(); - for (int i = 0; i < line.PartCount; i++) - { - for (int j = 0; j < line[i].Count; j++) - { - linePart.Add(line[i][j]); - } - } - for (int i = 0; i < newLine.PartCount; i++) - { - for (int j = 0; j < newLine[i].Count; j++) - { - linePart.Add(newLine[i][j]); - } - } - lineFromAllSelectedObj.AddPart(linePart); - break; - case 1: - linePart = new GSOPoint3ds(); - for (int i = 0; i < line.PartCount; i++) - { - for (int j = 0; j < line[i].Count; j++) - { - linePart.Add(line[i][j]); - } - } - for (int i = newLine.PartCount - 1; i >= 0; i--) - { - for (int j = newLine[i].Count - 1; j >= 0; j--) - { - linePart.Add(newLine[i][j]); - } - } - lineFromAllSelectedObj.AddPart(linePart); - break; - case 2: - linePart = new GSOPoint3ds(); - for (int i = line.PartCount - 1; i >= 0; i--) - { - for (int j = line[i].Count - 1; j >= 0; j--) - { - linePart.Add(line[i][j]); - } - } - for (int i = 0; i < newLine.PartCount; i++) - { - for (int j = 0; j < newLine[i].Count; j++) - { - linePart.Add(newLine[i][j]); - } - } - lineFromAllSelectedObj.AddPart(linePart); - break; - case 3: - linePart = new GSOPoint3ds(); - for (int i = line.PartCount - 1; i >= 0; i--) - { - for (int j = line[i].Count - 1; j >= 0; j--) - { - linePart.Add(line[i][j]); - } - } - for (int i = newLine.PartCount - 1; i >= 0; i--) - { - for (int j = newLine[i].Count - 1; j >= 0; j--) - { - linePart.Add(newLine[i][j]); - } - } - lineFromAllSelectedObj.AddPart(linePart); - break; - } - - featureFromAllSelectedObj.Geometry = lineFromAllSelectedObj; - - selectFeatures.Remove(n); - selectFeatures.Remove(p); - selectFeatures.Add(featureFromAllSelectedObj); - p--; - break; - } - } - } - } - } - //3 将合并之后的管线添加到集合中 - for (int h = 0; h < selectFeatures.Length; h++) - { - listFeature.Add(selectFeatures[h]); - } - } - //将选中的管线展示在窗体中 - if (listFeature.Count > 0) - { - FrmProfileAnalysis frm = new FrmProfileAnalysis(globeControl1, listFeature); - frm.Show(this); - } - else - { - MessageBox.Show("请选择相连接的管线!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); + selectFeatures.Add(feature); } } - else + List feats = SectionAnalysisTool.ZDMAnalysis(selectFeatures); + if (feats != null && feats.Count >= 1) { - MessageBox.Show("请选择一条或者多条管线!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); + FrmProfileAnalysis frm = new FrmProfileAnalysis(globeControl1, feats); + frm.Show(this); } } /// @@ -11479,25 +10720,11 @@ /// private void buttonItemFX2_3_Click(object sender, EventArgs e) { - //日志记录 - LogManager.saveLog(Utility.userName, this.buttonItemFX2_3.Text); + globeControl1.Globe.Action = EnumAction3D.TrackPolyline; + globeControl1.Globe.TrackPolylineTool.VerticalLineVisible = true; + globeControl1.Globe.TrackPolylineTool.TrackMode = EnumTrackMode.SpaceTrack; + trackPolylineEndMode = EnumTrackPolylineEndMode.DLDM_Analysis; - if (!buttonItemFX2_3.Checked) - { - trackflag = "RoadPolylineAnalysis"; - globeControl1.Globe.Action = EnumAction3D.TrackPolyline; - globeControl1.Globe.TrackPolylineTool.VerticalLineVisible = true; - buttonItemFX2_3.Checked = true; - buttonItemFX2_1.Checked = false; - buttonItemFX2_4.Checked = false; - } - else - { - globeControl1.Globe.Action = EnumAction3D.ActionNull; - buttonItemFX2_3.Checked = false; - globeControl1.Globe.TrackPolylineTool.VerticalLineVisible = false; - } - ActionToolMenuChecked(); } /// /// 基线剖面分析 @@ -11506,27 +10733,14 @@ /// private void buttonItemFX2_4_Click(object sender, EventArgs e) { - //日志记录 - LogManager.saveLog(Utility.userName, this.buttonItemFX2_4.Text); - - if (!buttonItemFX2_4.Checked) - { - globeControl1.Globe.Action = EnumAction3D.TrackPolyline; - //globeControl1.Globe.TrackPolylineAnalysis.VerticalLineVisible = true; - globeControl1.Globe.TrackPolylineTool.VerticalLineVisible = true; - buttonItemFX2_4.Checked = true; - buttonItemFX3_6.Checked = false; - buttonItemFX2_1.Checked = false; - } - else - { - globeControl1.Globe.Action = EnumAction3D.ActionNull; - buttonItemFX2_4.Checked = false; - //globeControl1.Globe.TrackPolylineAnalysis.VerticalLineVisible = false; - globeControl1.Globe.TrackPolylineTool.VerticalLineVisible = false; - } - ActionToolMenuChecked(); + globeControl1.Globe.Action = EnumAction3D.TrackPolyline; + globeControl1.Globe.TrackPolylineTool.VerticalLineVisible = true; + globeControl1.Globe.TrackPolylineTool.TrackMode = EnumTrackMode.SpaceTrack; + trackPolylineEndMode = EnumTrackPolylineEndMode.JXPM_Analysis; + } + + #endregion /// /// 创建拓扑 /// @@ -11540,7 +10754,7 @@ FrmGenAndFaMenTopu frm = new FrmGenAndFaMenTopu(globeControl1, m_PipelineLayerNames, valueLayerNames); frm.Show(this); } - #region Fan + #region Predator :拓扑分析 /// /// 上游分析 /// @@ -11550,8 +10764,6 @@ { //日志记录 LogManager.saveLog(Utility.userName, this.buttonItemFX3_2.Text); - - //ClearUpDownTraceAnalysis(); Fan NetworkTraceUpDown(true); } /// @@ -11563,10 +10775,27 @@ { //日志记录 LogManager.saveLog(Utility.userName, this.buttonItemFX3_3.Text); - - // ClearUpDownTraceAnalysis(); Fan NetworkTraceUpDown(false); } + + /// + /// 上下游追踪 功能 + /// + /// + private void NetworkTraceUpDown(Boolean bTraceUp) + { + GSOFeature selLineFeature = globeControl1.Globe.SelectedObject; + if (selLineFeature == null || selLineFeature.Geometry == null || selLineFeature.Geometry.Type != EnumGeometryType.GeoPolyline3D) + { + MessageBox.Show("请点击“编辑”—“选中对象”选择一条线!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); + return; + } + GSOLayer selLayer = globeControl1.Globe.SelectedObjectLayer; + + NetworkAnalysisTool.TraceUpDownAnalysis(bTraceUp, + selLineFeature, selLayer); + } + /// /// 流向分析 /// @@ -11618,43 +10847,6 @@ { MessageBox.Show("未找到关闭阀门"); } - - - //日志记录 - /* - LogManager.saveLog(Utility.userName, this.buttonItemFX3_5.Text); - - ClearCloseValvesAnalysis(); - if (globeControl1.Globe.SelObjectCount < 1) - { - MessageBox.Show("请选中至少一根管线!!"); - buttonItemFX3_5.Checked = false; - return; - } - GSOLayer resLayer = null; - GSOFeature resFeature = null; - globeControl1.Globe.GetSelectObject(0, out resFeature, out resLayer); - - GSOGeoPolyline3D line1 = resFeature.Geometry as GSOGeoPolyline3D; - if (line1 == null) - { - MessageBox.Show("请选择管线!!"); - return; - } - GSOPipeLineStyle3D pipeStyle1 = line1.Style as GSOPipeLineStyle3D; - if (pipeStyle1 == null) - { - MessageBox.Show("请选择管线!!"); - return; - } - GSOPoint3d resIntersetPoint = new GSOPoint3d(); - if (NetworkCloseValvesAnalysis(resFeature, resIntersetPoint, resLayer)) - { - //btnGFFX.Checked = false; - globeControl1.Globe.Action = EnumAction3D.ActionNull; - buttonItemFX3_5.Checked = false; - } - * **/ } /// @@ -11682,47 +10874,6 @@ return; } NetworkAnalysisTool.ConnexityAnalysis(selFeat0, selFeat1, layer0); - /* - //日志记录 - LogManager.saveLog(Utility.userName, this.buttonItemFX3_6.Text); - - if (globeControl1.Globe.SelObjectCount < 2) - { - MessageBox.Show("请选中至少两个管线!!"); - buttonItemFX3_6.Checked = false; - return; - } - ClearConnexityAnalysis(); - globeControl1.Globe.GetSelectObject(0, out m_ConnexityAnalysisFirstFeature, out m_ConnexityAnalysisFirstLayer); - globeControl1.Globe.GetSelectObject(1, out m_ConnexityAnaylsisSecondFeature, out m_COnnexityAnalysisSecondLayer); - GSOGeoPolyline3D line1 = m_ConnexityAnalysisFirstFeature.Geometry as GSOGeoPolyline3D; - GSOGeoPolyline3D line2 = m_ConnexityAnaylsisSecondFeature.Geometry as GSOGeoPolyline3D; - if (line1 == null || line2 == null) - { - MessageBox.Show("请选择管线!!"); - buttonItemFX3_6.Checked = false; - return; - } - - GSOPipeLineStyle3D pipeStyle1 = line1.Style as GSOPipeLineStyle3D; - GSOPipeLineStyle3D pipeStyle2 = line2.Style as GSOPipeLineStyle3D; - if (pipeStyle1 == null || pipeStyle2 == null) - { - MessageBox.Show("请选择管线!!"); - buttonItemFX3_6.Checked = false; - return; - } - if (!m_ConnexityAnalysisFirstLayer.IsSameInnerObject(m_COnnexityAnalysisSecondLayer)) - { - MessageBox.Show("不在同一个图层!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); - buttonItemFX3_6.Checked = false; - ClearConnexityAnalysis(); - } - else - { - ConnexityAnalysis(); - } - * **/ } /// /// 爆管分析 @@ -11731,8 +10882,6 @@ /// private void buttonItemFX3_7_Click(object sender, EventArgs e) { - //TODO LIST:关阀+上游 追踪 - NetworkTraceUpDown(true); //上游追踪: GSOFeature selLineFeature = globeControl1.Globe.SelectedObject; @@ -11747,73 +10896,8 @@ this.buttonItemFX3_5_Click(sender, e); //关阀分析: - //日志记录 - /* - LogManager.saveLog(Utility.userName, this.buttonItemFX3_7.Text); - ClearCloseValvesAnalysis(); - if (globeControl1.Globe.SelObjectCount < 1) - { - MessageBox.Show("请选中至少一个管线!!"); - return; - } - GSOLayer resLayer = null; - GSOFeature resFeature = null; - globeControl1.Globe.GetSelectObject(0, out resFeature, out resLayer); - - GSOGeoPolyline3D line1 = resFeature.Geometry as GSOGeoPolyline3D; - if (line1 == null) - { - MessageBox.Show("请选择管线!!"); - return; - } - GSOPipeLineStyle3D pipeStyle1 = line1.Style as GSOPipeLineStyle3D; - if (pipeStyle1 == null) - { - MessageBox.Show("请选择管线!!"); - return; - } - - GSOFeatures feats = globeControl1.Globe.MemoryLayer.GetFeatureByName("粒子要素", true); - if (feats.Length > 0) - globeControl1.Globe.MemoryLayer.RemoveFeatureByID(feats[0].ID); - //if (emitterFeature != null) - //{ - // globeControl1.Globe.MemoryLayer.RemoveFeatureByID(emitterFeature.ID); - //} - - GSOPoint3d pt = new GSOPoint3d(); - double length = line1.GetSpaceLength(true, 6378137);//线的长度 - GSOGeoPolyline3D lineLine = line1.GetSegment(0, length / 2); - GSOPoint3d point3d = lineLine[lineLine.PartCount - 1][lineLine[lineLine.PartCount - 1].Count - 1]; - pt.X = point3d.X; - pt.Y = point3d.Y; - pt.Z = point3d.Z; - - pt.Z += pipeStyle1.Radius * 2; - - if (resLayer.Caption.Contains("气")) - { - globeControl1.Globe.UnderGroundFloor.Visible = true; - AddFire(pt.X, pt.Y, pt.Z); - } - else if (resLayer.Caption.Contains("给水")) - { - globeControl1.Globe.UnderGroundFloor.Visible = true; - AddFountain(pt.X, pt.Y, pt.Z); - } - else if (resLayer.Caption.Contains("热力")) - { - globeControl1.Globe.UnderGroundFloor.Visible = true; - AddFountain(pt.X, pt.Y, pt.Z); - } - GSOPoint3d resIntersetPoint = new GSOPoint3d(); - if (NetworkBoosterValvesAnalysis(resFeature, resIntersetPoint, resLayer)) - { - globeControl1.Globe.Action = EnumAction3D.ActionNull; - } - * */ - } + #endregion /// /// 多边形开挖 diff --git a/NetworkAnalysisTool.cs b/NetworkAnalysisTool.cs index 7709e9d..67e1d2f 100644 --- a/NetworkAnalysisTool.cs +++ b/NetworkAnalysisTool.cs @@ -456,5 +456,15 @@ flowLayer = layer; } + //清除所有分析 + public static void ClearAllTopAnalysis(GSOGlobeControl globeControl) + { + ClearConnexityAnalysis(); + ClearExplodeAnalysis(globeControl); + ClearFlowDirectionAnalysis(); + ClearTraceUpDownAnalysis(); + ClearValvesAnalysis(); + } + } } diff --git a/Cyberpipe.csproj b/Cyberpipe.csproj index d24ccfc..cd0296f 100644 --- a/Cyberpipe.csproj +++ b/Cyberpipe.csproj @@ -228,6 +228,7 @@ F_GKT1添加项目.cs + @@ -938,12 +939,6 @@ FrmRESCMgr.cs - - Form - - - FrmRoadHDM.cs - Form @@ -1166,6 +1161,7 @@ + @@ -1611,10 +1607,6 @@ FrmRESCMgr.cs Designer - - FrmRoadHDM.cs - Designer - FrmRole.cs Designer diff --git a/EnumEventMode.cs b/EnumEventMode.cs new file mode 100644 index 0000000..b5eba59 --- /dev/null +++ b/EnumEventMode.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace Cyberpipe +{ + //横断面分析、基线剖面分析、道路断面分析 + public enum EnumTrackPolylineEndMode + { + Default_Analysis = 0, //无分析 + HDM_Analysis = 1, //横断面分析 + DLDM_Analysis = 2,//道路断面分析 + JXPM_Analysis = 3, //基线剖面分析 + } + + class EnumEventMode + { + } +} diff --git a/FrmHDMAnalysis3.cs b/FrmHDMAnalysis3.cs index 5e5988c..6405ed7 100644 --- a/FrmHDMAnalysis3.cs +++ b/FrmHDMAnalysis3.cs @@ -16,206 +16,72 @@ { public partial class FrmHDMAnalysis3 : DevComponents.DotNetBar.Office2007Form { - private ArrayList listPoint = new ArrayList(); - private ArrayList listFeat = new ArrayList(); - GSOGeoPolyline3D line = new GSOGeoPolyline3D(); //创建线对象 - - private static FrmHDMAnalysis3 allPipelineAnalysis = null; - public bool isShowFirst = false; - - static ArrayList list = new ArrayList(); + static DataTable table = new DataTable(); - static DataTable showTable = new DataTable(); GSOGlobeControl globeControl1; - object[,] sortIndex; - GSOLayer layerTemp; - private FrmHDMAnalysis3() - { - - } - public static FrmHDMAnalysis3 GetForm(ArrayList arraylistP, ArrayList arraylistF, GSOGeoPolyline3D _line, GSOGlobeControl _ctl) - { - if (allPipelineAnalysis == null) - { - allPipelineAnalysis = new FrmHDMAnalysis3(arraylistP, arraylistF, _line,_ctl); - } - else - { - allPipelineAnalysis.listPoint = arraylistP; - allPipelineAnalysis.listFeat = arraylistF; - allPipelineAnalysis.line = _line; - allPipelineAnalysis.globeControl1 = _ctl; - list = new ArrayList(); - } - return allPipelineAnalysis; - } + EnumTrackPolylineEndMode mode; - public FrmHDMAnalysis3(ArrayList arraylistP, ArrayList arraylistF, GSOGeoPolyline3D _line,GSOGlobeControl _ctl) + Dictionary hdmDic; + + public FrmHDMAnalysis3(Dictionary hdmDic, + GSOGlobeControl globeControl, EnumTrackPolylineEndMode mode) { InitializeComponent(); - this.listPoint = arraylistP; - this.listFeat = arraylistF; - line = _line; - globeControl1 = _ctl; + + this.hdmDic = hdmDic; + this.globeControl1 = globeControl; + this.mode = mode; } - double A_x, A_y, B_x, B_y;//定义坐标点,用来就横断面的长度 - /// - /// 窗体初始化事件处理 - /// - /// - /// - private void Frm_HDMAnalysis_Load(object sender, EventArgs e) + + private void initControls() { - layerTemp = globeControl1.Globe.Layers.Add(Application.StartupPath + "\\tempLgdExport.lgd"); - //chart1.ChartAreas[0].BackImage = Application.StartupPath + "\\Resource\\pipelineBackGround副本.png"; - } - /// - /// 窗体第一次显示事件处理 - /// - /// - /// - void Frm_HDMAnalysis2_Shown(object sender, EventArgs e) - { - isShowFirst = true; - - } - public void LoadChartEvent() - { - try - { - this.Shown += new EventHandler(Frm_HDMAnalysis2_Shown); - - chart1.Series["管线"].ChartType = SeriesChartType.Point; - - chart1.Series["管线"]["DrawingStyle"] = "Cylinder"; - chart1.Series["管线"].MarkerStyle = MarkerStyle.Circle; //点的类型 - - chart1.Series["管线"].MarkerBorderColor = Color.Black; //点的边框颜色 - chart1.ChartAreas[0].AxisX.Minimum = 0; //x轴的起始点大小 - chart1.ChartAreas[0].AxisY.Maximum = 0; //y轴的最大值 - - chart1.ChartAreas[0].AxisX.Title = "距离 (米)"; - chart1.ChartAreas[0].AxisY.Title = "埋深 (米)"; - - //chart1.ChartAreas[0].AxisX.ScrollBar.Enabled = true; - chart1.ChartAreas[0].AxisY2.Title = "高程 (米)"; - double[] depths = new double[listFeat.Count]; - for (int i = 0; i < listFeat.Count; i++) - { - GSOFeature f = listFeat[i] as GSOFeature; - double depth = f.GetFieldAsDouble("起始地面高程"); - depths[i] = depth; - } - double max_Depth = depths[0]; - for (int i = 0; i < listFeat.Count; i++) - { - if (max_Depth < depths[i]) - { - max_Depth = depths[i]; - } - } - chart1.ChartAreas[0].AxisY2.CustomLabels.Clear(); - chart1.ChartAreas[0].AxisY2.CustomLabels.Add(-5.4d, -5.6d, (max_Depth - 5.5).ToString("0.0")); - chart1.ChartAreas[0].AxisY2.CustomLabels.Add(-4.9d, -5.1d, (max_Depth - 5).ToString("0.0")); - chart1.ChartAreas[0].AxisY2.CustomLabels.Add(-4.4d, -4.6d, (max_Depth - 4.5).ToString("0.0")); - chart1.ChartAreas[0].AxisY2.CustomLabels.Add(-3.9d, -4.1d, (max_Depth - 4).ToString("0.0")); - chart1.ChartAreas[0].AxisY2.CustomLabels.Add(-3.4d, -3.6d, (max_Depth - 3.5).ToString("0.0")); - chart1.ChartAreas[0].AxisY2.CustomLabels.Add(-2.9d, -3.1d, (max_Depth - 3).ToString("0.0")); - chart1.ChartAreas[0].AxisY2.CustomLabels.Add(-2.4d, -2.6d, (max_Depth - 2.5).ToString("0.0")); - chart1.ChartAreas[0].AxisY2.CustomLabels.Add(-1.9d, -2.1d, (max_Depth - 2).ToString("0.0")); - chart1.ChartAreas[0].AxisY2.CustomLabels.Add(-1.4d, -1.6d, (max_Depth - 1.5).ToString("0.0")); - chart1.ChartAreas[0].AxisY2.CustomLabels.Add(-0.9d, -1.1d, (max_Depth - 1).ToString("0.0")); - chart1.ChartAreas[0].AxisY2.CustomLabels.Add(-0.4d, -0.6d, (max_Depth - 0.5).ToString("0.0")); - chart1.ChartAreas[0].AxisY2.CustomLabels.Add(-0.1d, 0.1d, max_Depth.ToString("0.0")); - - if (line.PartCount > 0) - { - GSOPoint3ds nodes = line[0]; - if (nodes.Count > 0) - { - GSOPoint3d node = nodes[0]; - A_x = node.X; - A_y = node.Y; - } - } - - DrawCurveGraph(A_x, A_y); - } - catch (Exception ex) - { - LogError.PublishError(ex); - } - } - - /// - /// 创建图表 - /// - /// - /// - private void DrawCurveGraph(double a_x,double a_y) - { - // 遍历线,求距离 - table = new DataTable(); - //showTable.Columns.Clear(); - list.Clear(); + chart1.Series["管线"].ChartType = SeriesChartType.Point; + chart1.Series["管线"]["DrawingStyle"] = "Cylinder"; + chart1.Series["管线"].MarkerStyle = MarkerStyle.Circle; //点的类型 + chart1.Series["管线"].MarkerBorderColor = Color.Black; //点的边框颜色 + //chart1.ChartAreas[0].AxisX.Minimum = 0; //x轴的起始点大小 + chart1.ChartAreas[0].AxisY.Maximum = 0; //y轴的最大值 + chart1.ChartAreas[0].AxisX.Title = "距离 (米)"; + chart1.ChartAreas[0].AxisY.Title = "埋深 (米)"; + chart1.ChartAreas[0].AxisY2.Title = "高程 (米)"; chart1.Series["管线"].Points.Clear(); - chart1.ChartAreas[0].AxisX.Maximum = Math.Round(line.GetSpaceLength(true, 6378137),2); + //chart1.ChartAreas[0].AxisX.Maximum = Math.Round(line.GetSpaceLength(true, 6378137), 2); + table.Columns.Add("编号", typeof(string)); table.Columns.Add("管线类型", typeof(string)); table.Columns.Add("管线编码", typeof(string)); table.Columns.Add("管径_毫米", typeof(string)); table.Columns.Add("材质", typeof(string)); - table.Columns.Add("管线埋深", typeof(string)); + table.Columns.Add("管线埋深", typeof(string)); - sortIndex = new object[listPoint.Count, 2]; - for (int i = 0; i <= listPoint.Count; i++) + if (mode == EnumTrackPolylineEndMode.DLDM_Analysis) { - if (i == listPoint.Count) - { - double maxNum = 0.0; - for (int j = 0; j < listPoint.Count; j++) - { - if (maxNum < Convert.ToDouble(sortIndex[j, 0])) - { - maxNum = Convert.ToDouble(sortIndex[j, 0]); - } - } - chart1.Series["管线"].Points.AddXY(maxNum + 2, 0); - chart1.Series["管线"].Points[i].MarkerBorderWidth = 100; //边框的宽度 - chart1.Series["管线"].Points[i].MarkerColor = Color.Black; - chart1.Series["管线"].Points[i].MarkerSize = 100; - continue; - } - GSOPoint3d geoPoint = (GSOPoint3d)listPoint[i]; - GSOFeature feature = listFeat[i] as GSOFeature; - //坐标投影 - int id = GeoScene.Data.GSOProjectManager.AddProject(Utility.projectStr); + this.pictureBox1.Visible = true; + } + else + { + this.pictureBox1.Visible = false; + } + } - GeoScene.Data.GSOPoint2d a_Point = GeoScene.Data.GSOProjectManager.Forward(new GSOPoint2d(a_x, a_y), id);//user画的线的起始点 + private void draw() + { + int i = 0; + foreach (KeyValuePair kvp in this.hdmDic) + { + GSOFeature feature = kvp.Key; + HDMCoordinate coor = kvp.Value; - GeoScene.Data.GSOPoint2d pt2d = new GeoScene.Data.GSOPoint2d(geoPoint.X, geoPoint.Y); - GeoScene.Data.GSOPoint2d result = GeoScene.Data.GSOProjectManager.Forward(pt2d, id); - B_x = result.X; - B_y = result.Y; + chart1.Series["管线"].Points.AddXY(coor.Dis, coor.Z);//绑定数据 - double x = System.Math.Abs(B_x - a_Point.X); - double y = System.Math.Abs(B_y - a_Point.Y); - double Dis = 0.0; - Dis = Math.Round(Math.Sqrt(x * x + y * y) , 2); - list.Add(geoPoint.Z); - sortIndex[i, 0] = Dis; - sortIndex[i, 1] = i; - - chart1.Series["管线"].Points.AddXY(Dis, geoPoint.Z);//绑定数据 - - string pipeType = feature.Dataset == null ? "" : feature.Dataset.Caption; + string pipeType = feature.Dataset == null ? "" : feature.Dataset.Caption; string number = Convert.ToString(i + 1); - string material = feature.GetFieldAsString("材质"); string diameter = feature.GetFieldAsString("管径_毫米"); - table.Rows.Add(new object[] { number, pipeType, feature.Name.ToString(), diameter, material,Convert.ToDecimal(list[i].ToString()).ToString("f2")});//list[i].ToString().Substring(0,list[i].ToString().IndexOf('.')+3) } - - //chart1.Series["管线"].Points[i].Label = number;//管线的标签 + table.Rows.Add(new object[] { number, + pipeType, feature.Name.ToString(), + diameter, material, + Convert.ToDecimal(coor.Z).ToString("f2") }); chart1.Series["管线"].Points[i].LegendText = number; if (feature.Geometry.Style.GetType() == typeof(GSOPipeLineStyle3D)) { @@ -229,47 +95,12 @@ chart1.Series["管线"].Points[i].MarkerBorderWidth = 3; //边框的宽度 chart1.Series["管线"].Points[i].MarkerColor = Color.Transparent; - chart1.Series["管线"].Points[i].MarkerSize = Convert.ToInt32(Math.Floor((feature.GetFieldAsDouble("管径_毫米") / 0.35 + chart1.Series["管线"].Points[i].MarkerBorderWidth) / 100.0));//点的大小 - + chart1.Series["管线"].Points[i].MarkerSize = Convert.ToInt32(Math.Floor((feature.GetFieldAsDouble("管径_毫米") / 0.35 + + chart1.Series["管线"].Points[i].MarkerBorderWidth) / 100.0)); + i++; } - - string htmlCode = "" + - "" + - "" + - "
管线类型管线编码管径_毫米材质管线埋深
" + - "" + - "" + - "" + - "" + - "
"; - webBrowser1.DocumentText = htmlCode; } + /// /// 图表的鼠标单击事件处理 /// @@ -286,14 +117,11 @@ return; } string number = p.LegendText; - //MessageBox.Show(number); int indexInTableRows = 0; bool isInt = int.TryParse(number, out indexInTableRows); if (isInt) { DataRow row = table.Rows[indexInTableRows - 1]; - //showTable.Rows.Clear(); - //showTable.Rows.Add(new object[] { row[0], row[1], row[2], row[3], row[4], row[5] }); string htmlCode = "" + - "" + - "" + - "
管线类型管线编码管径_毫米材质管线埋深
" + - "" + - "" + - "" + - "" + - "
"; - webBrowser1.DocumentText = htmlCode; - - - } - /// - /// 图表鼠标单击事件处理 - /// - /// - /// - private void chart1_MouseClick(object sender, MouseEventArgs e) - { - HitTestResult result = chart1.HitTest(e.X, e.Y, true); - if (result.PointIndex >= 0) - { - DataPoint p = (DataPoint)result.Object; - if (p == null) - { - return; - } - string number = p.LegendText; - int indexInTableRows = 0; - bool isInt = int.TryParse(number, out indexInTableRows); - if (isInt) - { - DataRow row = table.Rows[indexInTableRows - 1]; - string htmlCode = "" + - "" + - "" + - "
管线类型管线编码管径_毫米材质管线埋深
" + row[1] + - "" + row[2] + - "" + row[3] + - "" + row[4] + - "" + row[5] + - "
"; - webBrowser1.DocumentText = htmlCode; - } - } - } - /// - /// 窗体关闭事件处理 - /// - /// - /// - private void FrmRoadHDM_FormClosing(object sender, FormClosingEventArgs e) - { - allPipelineAnalysis = null; - globeControl1.Globe.MemoryLayer.RemoveAllFeature(); - } - /// - /// 图表鼠标移动事件处理 - /// - /// - /// - private void chart1_MouseMove(object sender, MouseEventArgs e) - { - HitTestResult result = chart1.HitTest(e.X, e.Y, true); - if (result.PointIndex >= 0) - { - this.Cursor = Cursors.Hand; - } - else - { - this.Cursor = Cursors.Default; - } - } - - private void Export(GSOPoint3d _pnt, double r) - { - GSOPoint3ds pnts = new GSOPoint3ds(); - GSOPoint3d pnt = new GSOPoint3d(); - pnt.X = _pnt.X; - pnt.Y = _pnt.Y; - pnt.Z = _pnt.Z; - pnts.Add(pnt); - pnt.X = _pnt.X; - pnt.Y = _pnt.Y - 0.0000000005; - pnt.Z = _pnt.Z; - pnts.Add(pnt); - GSOGeoPolyline3D line = new GSOGeoPolyline3D(); - line.AddPart(pnts); - GSOGeoPolygon3D polygon = line.CreateBuffer(r * 2, true, 5, true, false); - GSOPoint3ds points = polygon[0]; - GSOGeoPolyline3D newLine = new GSOGeoPolyline3D(); - newLine.AddPart(points); - newLine.AltitudeMode = EnumAltitudeMode.RelativeToGround; - GSOFeature newFeature = new GSOFeature(); - newFeature.Geometry = newLine; - globeControl1.Globe.MemoryLayer.AddFeature(newFeature); - } - - private void ExportCAD(double a, double b, double r) - { - GSOPoint3ds pnts = new GSOPoint3ds(); - for (int i = 0; i <= 64; i++) - { - double x = a + r * Math.Cos(i * 5.625 * Math.PI / 180); - double y = b - r * Math.Sin(i * 5.625 * Math.PI / 180); - GSOPoint2d pt2d = new GeoScene.Data.GSOPoint2d(x, y); - GSOPoint3d pnt = new GSOPoint3d(); - pnt.X = pt2d.X; - pnt.Y = pt2d.Y; - pnt.Z = 0; - pnts.Add(pnt); - } - GSOGeoPolyline3D line = new GSOGeoPolyline3D(); - line.AddPart(pnts); - GSOFeature f = new GSOFeature(); - f.Geometry = line; - f.Geometry.LatLonCoord = false; - f.Visible = false; - layerTemp.AddFeature(f); - } - /// - /// 导出CAD按钮事件处理 - /// - /// - /// - private void btnExportCAD_Click(object sender, EventArgs e) - { - layerTemp.RemoveAllFeature(); - for (int i = 0; i < listPoint.Count; i++) - { - GSOPoint3d geoPoint = (GSOPoint3d)listPoint[i]; - GSOFeature feature = listFeat[i] as GSOFeature; - if (feature != null) - { - if (feature.Geometry.Type == EnumGeometryType.GeoPolyline3D) - { - GSOPipeLineStyle3D style = feature.Geometry.Style as GSOPipeLineStyle3D; - double r = style.Radius; - ExportCAD(double.Parse(sortIndex[i, 0].ToString()), geoPoint.Z, r); - } - } - } - layerTemp.Dataset.ImportProjectionRefFromProj4(""); - SaveFileDialog dlg = new SaveFileDialog(); - dlg.Filter = "*.dxf|*.dxf"; - if (dlg.ShowDialog() == DialogResult.OK) - { - layerTemp.SaveAs(dlg.FileName); - MessageBox.Show("导出CAD完成!", "提示"); - } - layerTemp.RemoveAllFeature(); - } - } -} diff --git a/FrmRoadHDM.designer.cs b/FrmRoadHDM.designer.cs deleted file mode 100644 index 23a4c3b..0000000 --- a/FrmRoadHDM.designer.cs +++ /dev/null @@ -1,132 +0,0 @@ -namespace Cyberpipe -{ - partial class FrmRoadHDM - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmRoadHDM)); - System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea1 = new System.Windows.Forms.DataVisualization.Charting.ChartArea(); - System.Windows.Forms.DataVisualization.Charting.Series series1 = new System.Windows.Forms.DataVisualization.Charting.Series(); - this.pictureBox1 = new System.Windows.Forms.PictureBox(); - this.webBrowser1 = new System.Windows.Forms.WebBrowser(); - this.chart1 = new System.Windows.Forms.DataVisualization.Charting.Chart(); - this.btnExportCAD = new DevComponents.DotNetBar.ButtonX(); - ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.chart1)).BeginInit(); - this.SuspendLayout(); - // - // pictureBox1 - // - this.pictureBox1.BackColor = System.Drawing.Color.White; - this.pictureBox1.Dock = System.Windows.Forms.DockStyle.Top; - this.pictureBox1.ErrorImage = null; - this.pictureBox1.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image"))); - this.pictureBox1.ImageLocation = ""; - this.pictureBox1.Location = new System.Drawing.Point(0, 0); - this.pictureBox1.Name = "pictureBox1"; - this.pictureBox1.Size = new System.Drawing.Size(608, 64); - this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; - this.pictureBox1.TabIndex = 1; - this.pictureBox1.TabStop = false; - // - // webBrowser1 - // - this.webBrowser1.Dock = System.Windows.Forms.DockStyle.Bottom; - this.webBrowser1.Location = new System.Drawing.Point(0, 326); - this.webBrowser1.MinimumSize = new System.Drawing.Size(20, 20); - this.webBrowser1.Name = "webBrowser1"; - this.webBrowser1.ScrollBarsEnabled = false; - this.webBrowser1.Size = new System.Drawing.Size(608, 139); - this.webBrowser1.TabIndex = 3; - // - // chart1 - // - chartArea1.AxisX.MajorGrid.Enabled = false; - chartArea1.Name = "ChartArea1"; - this.chart1.ChartAreas.Add(chartArea1); - this.chart1.Location = new System.Drawing.Point(0, 66); - this.chart1.Name = "chart1"; - this.chart1.RightToLeft = System.Windows.Forms.RightToLeft.Yes; - series1.ChartArea = "ChartArea1"; - series1.Name = "管线"; - this.chart1.Series.Add(series1); - this.chart1.Size = new System.Drawing.Size(608, 254); - this.chart1.TabIndex = 2; - this.chart1.Text = "chart1"; - this.chart1.MouseClick += new System.Windows.Forms.MouseEventHandler(this.chart1_MouseClick); - this.chart1.MouseMove += new System.Windows.Forms.MouseEventHandler(this.chart1_MouseMove); - // - // btnExportCAD - // - this.btnExportCAD.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; - this.btnExportCAD.Anchor = System.Windows.Forms.AnchorStyles.Bottom; - this.btnExportCAD.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground; - this.btnExportCAD.Location = new System.Drawing.Point(268, 430); - this.btnExportCAD.Name = "btnExportCAD"; - this.btnExportCAD.Size = new System.Drawing.Size(75, 23); - this.btnExportCAD.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; - this.btnExportCAD.TabIndex = 4; - this.btnExportCAD.Text = "导出CAD"; - this.btnExportCAD.Click += new System.EventHandler(this.btnExportCAD_Click); - // - // FrmRoadHDM - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.BackColor = System.Drawing.Color.White; - this.ClientSize = new System.Drawing.Size(608, 465); - this.Controls.Add(this.btnExportCAD); - this.Controls.Add(this.chart1); - this.Controls.Add(this.webBrowser1); - this.Controls.Add(this.pictureBox1); - this.DoubleBuffered = true; - this.EnableGlass = false; - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; - this.MaximizeBox = false; - this.Name = "FrmRoadHDM"; - this.ShowIcon = false; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; - this.Text = "道路与管线综合横断面"; - this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FrmRoadHDM_FormClosing); - this.Load += new System.EventHandler(this.FrmRoadHDM_Load); - this.Shown += new System.EventHandler(this.FrmRoadHDM_Shown); - ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.chart1)).EndInit(); - this.ResumeLayout(false); - - } - - #endregion - - private System.Windows.Forms.PictureBox pictureBox1; - private System.Windows.Forms.WebBrowser webBrowser1; - private System.Windows.Forms.DataVisualization.Charting.Chart chart1; - private DevComponents.DotNetBar.ButtonX btnExportCAD; - - - } -} \ No newline at end of file diff --git a/FrmRoadHDM.resx b/FrmRoadHDM.resx deleted file mode 100644 index 5202d5f..0000000 --- a/FrmRoadHDM.resx +++ /dev/null @@ -1,177 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - - - 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 - iNKUe3NRsLcAAAAASUVORK5CYII= - - - \ No newline at end of file diff --git a/MainFrm.cs b/MainFrm.cs index e9b6cbe..2df3aac 100644 --- a/MainFrm.cs +++ b/MainFrm.cs @@ -75,15 +75,6 @@ private string trackflag;//定义阀门查询个数 - private GSOFeature m_ConnexityAnalysisFirstFeature; - private GSOFeature m_ConnexityAnaylsisSecondFeature; - private GSOLayer m_ConnexityAnalysisFirstLayer; - private GSOLayer m_COnnexityAnalysisSecondLayer; - private GSOFeatures m_ConnexityAnalyResFeatures; - private GSOFeatures m_TraceUpDownAnalyResFeatures; - private GSOFeatures m_AffectedPipeLines; - private GSOFeatures m_CloseValvesAnalyResFeatures; - private GSOFeatures m_BoosterValvesAnalyResFeatures; //管线间距分析 private GSOFeature disFeature = new GSOFeature(); private GSOFeature featureDis = new GSOFeature(); @@ -2656,8 +2647,37 @@ ///
/// /// + private static EnumTrackPolylineEndMode trackPolylineEndMode; + void globeControl1_TrackPolylineEndEvent(object sender, TrackPolylineEndEventArgs e) { + //横断面分析、道路横断面分析 + if (trackPolylineEndMode == EnumTrackPolylineEndMode.HDM_Analysis|| + trackPolylineEndMode == EnumTrackPolylineEndMode.DLDM_Analysis) + { + Dictionary hdmDic = SectionAnalysisTool.HDMAnalysis(this.globeControl1, + e.Polyline, this.m_PipelineLayerNames); + FrmHDMAnalysis3 frm = new FrmHDMAnalysis3(hdmDic, this.globeControl1, + trackPolylineEndMode); + frm.Show(this); + } + //基线剖面分析 + else if (trackPolylineEndMode == EnumTrackPolylineEndMode.JXPM_Analysis) + { + FrmBaseLineProfillAnalysis dlg = new FrmBaseLineProfillAnalysis(globeControl1.Globe, e.Polyline); + dlg.Show(this); + globeControl1.Globe.ClearLastTrackPolyline(); + /* + FrmRoadHDM f = new FrmRoadHDM(); + f.Show() + * **/ + } + else + { + + } + trackPolylineEndMode = EnumTrackPolylineEndMode.Default_Analysis; + /* ArrayList arraylistPoint = new ArrayList(); ArrayList arraylistLine = new ArrayList(); @@ -2835,6 +2855,7 @@ } globeControl1.Globe.Action = EnumAction3D.ActionNull; ActionToolMenuChecked(); + * **/ } #endregion @@ -4962,10 +4983,10 @@ if (globeControl1.Globe.Action != EnumAction3D.NormalHit) { buttonItemFX3_6.Checked = false; - ClearConnexityAnalysis(); + // ClearConnexityAnalysis(); buttonItemFX3_5.Checked = false; - ClearCloseValvesAnalysis(); + // ClearCloseValvesAnalysis(); } if (globeControl1.Globe.Action != EnumAction3D.TrackPolygon) { @@ -4973,131 +4994,7 @@ buttonItemFX4_1.Checked = false; } } - /// - /// 连通性分析 功能 - /// - private void ConnexityAnalysis() - { - GSODataset curCAYDataset = m_ConnexityAnalysisFirstLayer.Dataset; - string srName = curCAYDataset.Name; - GSONetworkDataset curCAYNDataset = curCAYDataset.DataSource.GetDatasetByName(srName + "Network") as GSONetworkDataset; - if (curCAYNDataset == null) - { - MessageBox.Show("该图层没有创建网络拓扑,请先创建网络拓扑信息再进行分析!", "提示"); - return; - } - int[] arryResID; - curCAYNDataset.ConnexityAnalysis(m_ConnexityAnalysisFirstFeature.ID, m_ConnexityAnaylsisSecondFeature.ID, out arryResID, false, true); - m_ConnexityAnalyResFeatures = m_ConnexityAnalysisFirstLayer.GetFeaturesByIDs(arryResID); - if (m_ConnexityAnalyResFeatures == null || m_ConnexityAnalyResFeatures.Length < 1) - { - String strLine1 = "管线:" + m_ConnexityAnalysisFirstFeature.ID; - String strLine2 = "管线:" + m_ConnexityAnaylsisSecondFeature.ID; - MessageBox.Show(strLine1 + " 与 " + strLine2 + " 不连通", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); - } - else - { - int nCount = m_ConnexityAnalyResFeatures.Length; - for (int i = 0; i < nCount; i++) - { - m_ConnexityAnalyResFeatures[i].HighLight = true; - GSOGeoPolyline3D geoline = m_ConnexityAnalyResFeatures[i].Geometry as GSOGeoPolyline3D; - if (geoline != null) - { - GSOLineStyle3D lineStyle = geoline.Style as GSOLineStyle3D; - if (lineStyle != null) - { - if (lineStyle.ArrowStyle == null) - { - lineStyle.ArrowStyle = new GSOArrowStyle(); - - } - lineStyle.ArrowStyle.BodyLen = 8; - lineStyle.ArrowVisible = true; - lineStyle.ArrowStyle.Play(); - } - } - } - globeControl1.Refresh(); - } - } - /// - /// 清除连通性分析结果 功能 - /// - private void ClearConnexityAnalysis() - { - if (m_ConnexityAnalysisFirstFeature != null) - { - m_ConnexityAnalysisFirstFeature.HighLight = false; - m_ConnexityAnalysisFirstFeature.Label = null; - } - if (m_ConnexityAnaylsisSecondFeature != null) - { - m_ConnexityAnaylsisSecondFeature.HighLight = false; - m_ConnexityAnaylsisSecondFeature.Label = null; - } - - m_ConnexityAnalysisFirstFeature = null; - m_ConnexityAnaylsisSecondFeature = null; - m_ConnexityAnalysisFirstLayer = null; - m_COnnexityAnalysisSecondLayer = null; - - if (m_ConnexityAnalyResFeatures != null) - { - int nCount = m_ConnexityAnalyResFeatures.Length; - - for (int i = 0; i < nCount; i++) - { - m_ConnexityAnalyResFeatures[i].HighLight = false; - GSOGeoPolyline3D geoline = m_ConnexityAnalyResFeatures[i].Geometry as GSOGeoPolyline3D; - if (geoline != null) - { - GSOLineStyle3D lineStyle = geoline.Style as GSOLineStyle3D; - if (lineStyle != null) - { - lineStyle.ArrowVisible = false; - } - } - } - m_ConnexityAnalyResFeatures = null; - - } - } - /// - /// 清除阀门分析结果 功能 - /// - private void ClearCloseValvesAnalysis() - { - if (m_CloseValvesAnalyResFeatures != null) - { - for (int i = 0; i < m_CloseValvesList.Count; i++) - { - GSOFeature feature = m_CloseValvesList[i] as GSOFeature; - feature.Label.Text = ""; - } - globeControl1.Refresh(); - m_CloseValvesAnalyResFeatures = null; - m_CloseValvesList = new ArrayList(); - } - } - /// - /// 清除阀门分析结果 功能 - /// - private void ClearBoosterValvesAnalysis() - { - if (m_BoosterValvesAnalyResFeatures != null) - { - for (int i = 0; i < m_BoosterValvesList.Count; i++) - { - GSOFeature feature = m_BoosterValvesList[i] as GSOFeature; - feature.Label.Text = ""; - } - globeControl1.Refresh(); - m_BoosterValvesAnalyResFeatures = null; - m_BoosterValvesList = new ArrayList(); - } - } /// /// 主窗体关闭事件处理 /// @@ -5118,211 +5015,7 @@ //注销id号为103的热键设定 // UnregisterHotKey(Handle, 103); } - /// - /// 清除追踪结果 功能 : Fan 可去掉了! - /// - private void ClearUpDownTraceAnalysis() - { - if (m_TraceUpDownAnalyResFeatures != null) - { - int nCount = m_TraceUpDownAnalyResFeatures.Length; - for (int i = 0; i < nCount; i++) - { - m_TraceUpDownAnalyResFeatures[i].HighLight = false; - GSOGeoPolyline3D geoline = m_TraceUpDownAnalyResFeatures[i].Geometry as GSOGeoPolyline3D; - if (geoline != null) - { - GSOLineStyle3D lineStyle = geoline.Style as GSOLineStyle3D; - if (lineStyle != null) - { - lineStyle.ArrowVisible = false; - } - } - } - m_TraceUpDownAnalyResFeatures = null; - } - } - /// - /// 取消所有高亮管线的高亮状态 - /// - private void ClearAffectedPipeLine() - { - if (m_AffectedPipeLines != null) - { - int nCount = m_AffectedPipeLines.Length; - for (int i = 0; i < nCount; i++) - { - m_AffectedPipeLines[i].HighLight = false; - } - m_AffectedPipeLines = null; - } - } - #region Fan 拓扑分析 - /// - /// 上下游追踪 功能 - /// - /// - private void NetworkTraceUpDown(Boolean bTraceUp) - { - GSOFeature selLineFeature = globeControl1.Globe.SelectedObject; - if (selLineFeature == null || selLineFeature.Geometry == null || selLineFeature.Geometry.Type != EnumGeometryType.GeoPolyline3D) - { - MessageBox.Show("请点击“编辑”—“选中对象”选择一条线!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); - return; - } - GSOLayer selLayer = globeControl1.Globe.SelectedObjectLayer; - - NetworkAnalysisTool.TraceUpDownAnalysis(bTraceUp, - selLineFeature, selLayer); - /* - if (globeControl1.Globe.SelectedObject == null) - { - MessageBox.Show("请点击“编辑”—“选中对象”选择一条线!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); - return; - } - GSOFeature selLineFeature = globeControl1.Globe.SelectedObject; - - if (selLineFeature.Geometry == null || selLineFeature.Geometry.Type != EnumGeometryType.GeoPolyline3D) - { - MessageBox.Show("请点击“编辑”—“选中对象”选择一条线!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); - return; - } - - if (globeControl1.Globe.SelectedObjectLayer == null) - { - MessageBox.Show("选中管线所在图层为空!", "提示"); - return; - } - - GSODataset curCAYDataset = globeControl1.Globe.SelectedObjectLayer.Dataset; - if (curCAYDataset == null || curCAYDataset.DataSource == null) - { - MessageBox.Show("选中管线所在图层不是数据库图层!", "提示"); - return; - } - - string srName = curCAYDataset.Name; - GSONetworkDataset curCAYNDataset = curCAYDataset.DataSource.GetDatasetByName(srName + "Network") as GSONetworkDataset; - - if (curCAYNDataset == null) - { - MessageBox.Show("选中管线所在图层没有创建拓扑!", "提示"); - return; - } - - int[] arryResID; - curCAYNDataset.TraceUpDownAnalysis(selLineFeature.ID, out arryResID, bTraceUp, false, true); - m_TraceUpDownAnalyResFeatures = globeControl1.Globe.SelectedObjectLayer.GetFeaturesByIDs(arryResID); - if (m_TraceUpDownAnalyResFeatures == null || m_TraceUpDownAnalyResFeatures.Length < 1) - { - String strLine1 = "没有上游!"; - if (!bTraceUp) - { - strLine1 = "没有下游!"; - - } - MessageBox.Show(strLine1); - } - else - { - int nCount = m_TraceUpDownAnalyResFeatures.Length; - for (int i = 0; i < nCount; i++) - { - m_TraceUpDownAnalyResFeatures[i].HighLight = true; - GSOGeoPolyline3D geoline = m_TraceUpDownAnalyResFeatures[i].Geometry as GSOGeoPolyline3D; - if (geoline != null) - { - GSOLineStyle3D lineStyle = geoline.Style as GSOLineStyle3D; - if (lineStyle != null) - { - if (lineStyle.ArrowStyle == null) - { - lineStyle.ArrowStyle = new GSOArrowStyle(); - lineStyle.ArrowStyle.BodyWidth = 2; - lineStyle.ArrowStyle.BodyLen = 6; - lineStyle.ArrowStyle.HeadWidth = 8; - lineStyle.ArrowStyle.HeadLen = 10; - lineStyle.ArrowStyle.OutlineVisible = true; - lineStyle.ArrowStyle.OutlineColor = Color.Red; - lineStyle.ArrowStyle.Speed = lineStyle.ArrowStyle.Speed / 2; - } - lineStyle.ArrowVisible = true; - lineStyle.ArrowStyle.Play(); - } - } - } - globeControl1.Refresh(); - } - * **/ - } - - #endregion - /// - /// 上下游追踪 功能 - /// - /// - private void AffectedPipeLine(Boolean bTraceUp) - { - if (globeControl1.Globe.SelectedObject == null) - { - MessageBox.Show("请点击“编辑”—“选中对象”选择一条线!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); - return; - } - GSOFeature selLineFeature = globeControl1.Globe.SelectedObject; - if (selLineFeature.Geometry == null || selLineFeature.Geometry.Type != EnumGeometryType.GeoPolyline3D) - { - MessageBox.Show("请点击“编辑”—“选中对象”选择一条线!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); - - return; - } - - if (globeControl1.Globe.SelectedObjectLayer == null) - { - return; - } - - GSODataset curCAYDataset = globeControl1.Globe.SelectedObjectLayer.Dataset; - if (curCAYDataset == null || curCAYDataset.DataSource == null) - { - return; - } - - string srName = curCAYDataset.Name; - GSONetworkDataset curCAYNDataset = curCAYDataset.DataSource.GetDatasetByName(srName + "Network") as GSONetworkDataset; - - if (curCAYNDataset == null) - { - return; - } - int[] arryResID; - curCAYNDataset.TraceUpDownAnalysis(selLineFeature.ID, out arryResID, bTraceUp, false, true); - m_AffectedPipeLines = globeControl1.Globe.SelectedObjectLayer.GetFeaturesByIDs(arryResID); - if (m_AffectedPipeLines == null || m_AffectedPipeLines.Length < 1) - { - } - else - { - int nCount = m_AffectedPipeLines.Length; - for (int i = 0; i < nCount; i++) - { - m_AffectedPipeLines[i].HighLight = true; - } - globeControl1.Refresh(); - } - } - /// - /// 清除上下游追踪结果 菜单 - /// - /// - /// - //private void buttonItem58_Click(object sender, EventArgs e) - //{ - // //日志记录 - // LogManager.saveLog(Utility.userName, this.buttonItem58.Text); - - // ClearUpDownTraceAnalysis(); - //} - + /// /// 显示流向 功能 /// @@ -5359,158 +5052,8 @@ } FrmCloseValves frm; - /// - /// 关阀分析 功能 - /// - /// - /// - /// - /// - private bool NetworkCloseValvesAnalysis(GSOFeature lineFeature, GSOPoint3d pntBreak, GSOLayer lineLayer) - { - /* - if (lineLayer == null || lineFeature == null || lineFeature.Geometry == null || lineFeature.Geometry.Type != EnumGeometryType.GeoPolyline3D) - { - return false; - } - GSODataset curCAYDataset = lineLayer.Dataset; - if (curCAYDataset == null || curCAYDataset.DataSource == null) - { - MessageBox.Show("该图层不是要素图层!", "提示"); - return false; - } - string srName = curCAYDataset.Name; - GSONetworkDataset curCAYNDataset = curCAYDataset.DataSource.GetDatasetByName(srName + "Network") as GSONetworkDataset; - - if (curCAYNDataset == null) - { - MessageBox.Show("该图层没有创建网络拓扑,请先创建网络拓扑信息再进行分析!", "提示"); - return false; - } - ClearCloseValvesAnalysis(); - - int[] arryResNodeID = null; - int[] arryResValveID = null; - try - { - curCAYNDataset.CloseValveAnalysis(lineFeature.ID, out arryResNodeID, out arryResValveID, false, true); - } - catch (Exception e) - { } - - string valveName = lineLayer.Caption; - valveName = valveName.Substring(0, valveName.IndexOf("管线")); - GSOLayer valveLayer = globeControl1.Globe.Layers[valveName + "阀门"]; - if (valveLayer == null) - { - MessageBox.Show("和选中对象所在管线图层相关联的阀门图层不存在!", "提示"); - return false; - } - - m_CloseValvesAnalyResFeatures = valveLayer.GetFeaturesByIDs(arryResValveID);// curCAYNDataset.NodeDataset.GetFeaturesByIDs(arryResValveID); - - if (m_CloseValvesAnalyResFeatures == null || m_CloseValvesAnalyResFeatures.Length < 1) - { - MessageBox.Show("没有找到要关闭的阀门!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); - if (frm != null) - { - frm.Close(); - } - } - else - { - int nCount = m_CloseValvesAnalyResFeatures.Length; - - if (nCount > 0) - { - frm = FrmCloseValves.getForm(globeControl1, m_CloseValvesAnalyResFeatures, m_CloseValvesList); - - if (!frm.Visible) - { - frm.Show(this); - } - } - }**/ - return true; - } FrmBoosterValvers frmbooster = null; - /// - /// 阀门分析 功能 - /// - /// - /// - /// - /// - private bool NetworkBoosterValvesAnalysis(GSOFeature lineFeature, GSOPoint3d pntBreak, GSOLayer lineLayer) - { - if (lineLayer == null || lineFeature == null || lineFeature.Geometry == null || lineFeature.Geometry.Type != EnumGeometryType.GeoPolyline3D) - { - return false; - } - GSODataset curCAYDataset = lineLayer.Dataset; - - if (curCAYDataset == null || curCAYDataset.DataSource == null) - { - return false; - } - string srName = curCAYDataset.Name; - GSONetworkDataset curCAYNDataset = curCAYDataset.DataSource.GetDatasetByName(srName + "Network") as GSONetworkDataset; - - if (curCAYNDataset == null) - { - MessageBox.Show("该图层没有创建网络拓扑,请先创建网络拓扑信息再进行分析!", "提示"); - return false; - } - ClearBoosterValvesAnalysis(); - ClearAffectedPipeLine(); - - int[] arryResNodeID = null; - int[] arryResValveID = null; - try - { - curCAYNDataset.CloseValveAnalysis(lineFeature.ID, out arryResNodeID, out arryResValveID, false, true); - } - catch (Exception e) - { - - } - //目前只有燃气管线 有阀门 - string valveName = lineLayer.Name; - valveName = valveName.Substring(0, valveName.IndexOf("管线")); - GSOLayer valveLayer = globeControl1.Globe.Layers[valveName + "阀门"]; - if (valveLayer == null) - { - MessageBox.Show("和选中对象所在管线图层相关联的阀门图层不存在!", "提示"); - return false; - } - m_BoosterValvesAnalyResFeatures = valveLayer.GetFeaturesByIDs(arryResValveID); - - if (m_BoosterValvesAnalyResFeatures == null || - m_BoosterValvesAnalyResFeatures.Length < 1) - { - MessageBox.Show("没有找到要关闭的阀门!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); - if (frmbooster != null) - { - frmbooster.Close(); - } - } - else - { - int nCount = m_BoosterValvesAnalyResFeatures.Length; - if (nCount > 0) - { - AffectedPipeLine(false); - frmbooster = FrmBoosterValvers.getForm(globeControl1, m_BoosterValvesAnalyResFeatures, m_BoosterValvesList, m_AffectedPipeLines); - frmbooster.setLstValvesName(); - if (!frmbooster.Visible) - { - frmbooster.Show(this); - } - } - } - return true; - } /// /// 垂直净距分析 功能界面中的 选择图层复选框 选中状态改变事件处理 @@ -7726,69 +7269,6 @@ double distance = lineline.GetSpaceLength(true, 6378137.0); return distance; } - /// - /// 判断管线是否相通 功能 - /// - /// - public bool isInterlinked() - { - if (globeControl1.Globe.SelObjectCount < 2) - { - MessageBox.Show("请选中至少两个管线!!"); - buttonItemFX3_6.Checked = false; - return false; - } - ClearConnexityAnalysis(); - globeControl1.Globe.GetSelectObject(0, out m_ConnexityAnalysisFirstFeature, out m_ConnexityAnalysisFirstLayer); - globeControl1.Globe.GetSelectObject(1, out m_ConnexityAnaylsisSecondFeature, out m_COnnexityAnalysisSecondLayer); - GSOGeoPolyline3D line1 = m_ConnexityAnalysisFirstFeature.Geometry as GSOGeoPolyline3D; - GSOGeoPolyline3D line2 = m_ConnexityAnaylsisSecondFeature.Geometry as GSOGeoPolyline3D; - if (line1 == null || line2 == null) - { - MessageBox.Show("请选择管线!!"); - return false; - } - GSOPipeLineStyle3D pipeStyle1 = line1.Style as GSOPipeLineStyle3D; - GSOPipeLineStyle3D pipeStyle2 = line2.Style as GSOPipeLineStyle3D; - if (pipeStyle1 == null || pipeStyle2 == null) - { - MessageBox.Show("请选择管线!!"); - return false; - } - if (!m_ConnexityAnalysisFirstLayer.IsSameInnerObject(m_COnnexityAnalysisSecondLayer)) - { - MessageBox.Show("不在同一个图层!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); - ClearConnexityAnalysis(); - return false; - } - else - { - GSODataset curCAYDataset = m_ConnexityAnalysisFirstLayer.Dataset; - string srName = curCAYDataset.Name; - GSONetworkDataset curCAYNDataset = curCAYDataset.DataSource.GetDatasetByName(srName + "Network") as GSONetworkDataset; - if (curCAYNDataset == null) - { - MessageBox.Show("该图层没有创建网络拓扑,请先创建网络拓扑信息再进行分析!", "提示"); - return false; - } - - int[] arryResID; - curCAYNDataset.ConnexityAnalysis(m_ConnexityAnalysisFirstFeature.ID, m_ConnexityAnaylsisSecondFeature.ID, out arryResID, false, true); - m_ConnexityAnalyResFeatures = m_ConnexityAnalysisFirstLayer.GetFeaturesByIDs(arryResID); - if (m_ConnexityAnalyResFeatures == null || m_ConnexityAnalyResFeatures.Length < 1) - { - String strLine1 = "管线:" + m_ConnexityAnalysisFirstFeature.ID; - String strLine2 = "管线:" + m_ConnexityAnaylsisSecondFeature.ID; - MessageBox.Show("请选择两条相通的管线!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); - return false; - } - else - { - return true; - } - } - } - /// /// 图层节点树中 节点 右键单击事件处理 @@ -9564,27 +9044,7 @@ } } - /// - /// 清除分析结果 - /// - /// - /// - //private void buttonItem131_Click(object sender, EventArgs e) - //{ - // LogManager.saveLog(Utility.userName, this.buttonItem131.Text); - - // clearFeatureHighLight(); - // //if (boolfrmShResult == true) - // //{ - // // frmShResult.Close(); - // //} - // //else - // //{ - - // //} - - // ClearRedlineAnalyseResult(); - //} + /// /// 清除渲染结果 /// @@ -10728,8 +10188,9 @@ buttonX16_Click(null, null); buttonClearAnalysisResult_Click(null, null); - ClearConnexityAnalysis();//清除连通性分析 - ClearCloseValvesAnalysis();//清除阀门分析 + NetworkAnalysisTool.ClearAllTopAnalysis(this.globeControl1); + // ClearConnexityAnalysis();//清除连通性分析 + // ClearCloseValvesAnalysis();//清除阀门分析 //清除管线间距分析 if (disFeature != null) @@ -10753,7 +10214,7 @@ globeControl1.Globe.UnderGroundFloor.Visible = false;//隐藏地下网格线 - ClearUpDownTraceAnalysis(); //清除上下游分析 + // ClearUpDownTraceAnalysis(); //清除上下游分析 globeControl1.Globe.RemoveAllPits();//清除所有坑 string[] markerStrs = new string[9]; @@ -11206,6 +10667,8 @@ sideBar1.Refresh(); Refresh(); } + + #region Predaotr,断面分析 /// /// 横断面分析 /// @@ -11213,26 +10676,11 @@ /// private void buttonItemFX2_1_Click(object sender, EventArgs e) { - //日志记录 - LogManager.saveLog(Utility.userName, this.buttonItemFX2_1.Text); - - if (!buttonItemFX2_1.Checked) - { - trackflag = "PolylineAnalysis"; - globeControl1.Globe.Action = EnumAction3D.TrackPolyline; - globeControl1.Globe.TrackPolylineTool.VerticalLineVisible = true; - globeControl1.Globe.TrackPolylineTool.TrackMode = EnumTrackMode.SpaceTrack; - buttonItemFX2_1.Checked = true; - buttonItemFX2_3.Checked = false; - buttonItemFX2_4.Checked = false; - } - else - { - globeControl1.Globe.Action = EnumAction3D.ActionNull; - buttonItemFX2_1.Checked = false; - globeControl1.Globe.TrackPolylineTool.VerticalLineVisible = false; - } - ActionToolMenuChecked(); + globeControl1.Globe.Action = EnumAction3D.TrackPolyline; + globeControl1.Globe.TrackPolylineTool.VerticalLineVisible = true; + globeControl1.Globe.TrackPolylineTool.TrackMode = EnumTrackMode.SpaceTrack; + trackPolylineEndMode = EnumTrackPolylineEndMode.HDM_Analysis; + } /// /// 纵断面分析 @@ -11241,235 +10689,28 @@ /// private void buttonItemFX2_2_Click(object sender, EventArgs e) { - //日志记录 - LogManager.saveLog(Utility.userName, this.buttonItemFX2_2.Text); - - if (globeControl1.Globe.SelObjectCount >= 1) + if (globeControl1.Globe.SelObjectCount<1) { - GSOFeatures selectFeatures = new GSOFeatures(); - for (int i = 0; i < globeControl1.Globe.SelObjectCount; i++) + MessageBox.Show("请选择一条或者多条管线!", "提示", MessageBoxButtons.OK, + MessageBoxIcon.Information); + return; + } + GSOFeatures selectFeatures = new GSOFeatures(); + for (int i = 0; i < globeControl1.Globe.SelObjectCount; i++) + { + GSOFeature feature = null; + GSOLayer layer = null; + globeControl1.Globe.GetSelectObject(i, out feature, out layer); + if (feature != null && feature.Geometry != null && feature.Geometry.Type == EnumGeometryType.GeoPolyline3D) { - GSOFeature feature = null; - GSOLayer layer = null; - globeControl1.Globe.GetSelectObject(i, out feature, out layer); - if (feature != null && feature.Geometry != null && feature.Geometry.Type == EnumGeometryType.GeoPolyline3D) - { - selectFeatures.Add(feature); - } - } - if (selectFeatures.Length < 1) - { - MessageBox.Show("请选择一条或者多条管线!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); - return; - } - List listFeature = new List(); - if (selectFeatures.Length == 1) - { - listFeature.Add(selectFeatures[0]); - } - else - { - //求多条管线纵断面 1,2,3 - //1 判断管线是否相连、且没有分叉 - for (int i = 0; i < selectFeatures.Length; i++) - { - GSOGeoPolyline3D line = selectFeatures[i].Geometry as GSOGeoPolyline3D; - bool isConnect = false; - int[] valueCount = new int[2]; - valueCount[0] = 0; - valueCount[1] = 0; - - if (line != null && line.PartCount > 0) - { - for (int j = 0; j < selectFeatures.Length; j++) - { - if (i == j) - { - continue; - } - GSOGeoPolyline3D newLine = selectFeatures[j].Geometry as GSOGeoPolyline3D; - if (newLine != null && newLine.PartCount > 0) - { - int minValueIndex = 0; - double limitValue = 1.0; - double[] value = new double[4]; - value[0] = getDistance(line[line.PartCount - 1][line[line.PartCount - 1].Count - 1], newLine[0][0]); - value[1] = getDistance(line[line.PartCount - 1][line[line.PartCount - 1].Count - 1], newLine[newLine.PartCount - 1][newLine[newLine.PartCount - 1].Count - 1]); - value[2] = getDistance(line[0][0], newLine[0][0]); - value[3] = getDistance(line[0][0], newLine[newLine.PartCount - 1][newLine[newLine.PartCount - 1].Count - 1]); - double minValue = value[0]; - for (int m = 1; m < value.Length; m++) - { - if (minValue > value[m]) - { - minValue = value[m]; - minValueIndex = m; - } - } - if (minValue < limitValue) - { - isConnect = true; - if (minValueIndex > 1) - { - valueCount[1]++; - } - else - { - valueCount[0]++; - } - } - } - } - if (!isConnect || valueCount[0] > 1 || valueCount[1] > 1) - { - MessageBox.Show("请选择相连接的一条线上的管线!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); - return; - } - } - } - //2 记录每一条相连接的管线的起点和终点,并添加到一条管线中 - for (int p = 0; p < selectFeatures.Length; p++) - { - GSOGeoPolyline3D line = selectFeatures[p].Geometry as GSOGeoPolyline3D; - if (line != null && line.PartCount > 0) - { - for (int n = 0; n < selectFeatures.Length; n++) - { - if (p == n) - { - continue; - } - GSOGeoPolyline3D newLine = selectFeatures[n].Geometry as GSOGeoPolyline3D; - if (newLine != null && newLine.PartCount > 0) - { - int minValueIndex = 0; - double limitValue = 1.0; - double[] value = new double[4]; - value[0] = getDistance(line[line.PartCount - 1][line[line.PartCount - 1].Count - 1], newLine[0][0]); - value[1] = getDistance(line[line.PartCount - 1][line[line.PartCount - 1].Count - 1], newLine[newLine.PartCount - 1][newLine[newLine.PartCount - 1].Count - 1]); - value[2] = getDistance(line[0][0], newLine[0][0]); - value[3] = getDistance(line[0][0], newLine[newLine.PartCount - 1][newLine[newLine.PartCount - 1].Count - 1]); - double minValue = value[0]; - for (int m = 1; m < value.Length; m++) - { - if (minValue > value[m]) - { - minValue = value[m]; - minValueIndex = m; - } - } - if (minValue < limitValue) - { - GSOFeature featureFromAllSelectedObj = new GSOFeature(); - GSOGeoPolyline3D lineFromAllSelectedObj = new GSOGeoPolyline3D(); - switch (minValueIndex) - { - case 0: - GSOPoint3ds linePart = new GSOPoint3ds(); - for (int i = 0; i < line.PartCount; i++) - { - for (int j = 0; j < line[i].Count; j++) - { - linePart.Add(line[i][j]); - } - } - for (int i = 0; i < newLine.PartCount; i++) - { - for (int j = 0; j < newLine[i].Count; j++) - { - linePart.Add(newLine[i][j]); - } - } - lineFromAllSelectedObj.AddPart(linePart); - break; - case 1: - linePart = new GSOPoint3ds(); - for (int i = 0; i < line.PartCount; i++) - { - for (int j = 0; j < line[i].Count; j++) - { - linePart.Add(line[i][j]); - } - } - for (int i = newLine.PartCount - 1; i >= 0; i--) - { - for (int j = newLine[i].Count - 1; j >= 0; j--) - { - linePart.Add(newLine[i][j]); - } - } - lineFromAllSelectedObj.AddPart(linePart); - break; - case 2: - linePart = new GSOPoint3ds(); - for (int i = line.PartCount - 1; i >= 0; i--) - { - for (int j = line[i].Count - 1; j >= 0; j--) - { - linePart.Add(line[i][j]); - } - } - for (int i = 0; i < newLine.PartCount; i++) - { - for (int j = 0; j < newLine[i].Count; j++) - { - linePart.Add(newLine[i][j]); - } - } - lineFromAllSelectedObj.AddPart(linePart); - break; - case 3: - linePart = new GSOPoint3ds(); - for (int i = line.PartCount - 1; i >= 0; i--) - { - for (int j = line[i].Count - 1; j >= 0; j--) - { - linePart.Add(line[i][j]); - } - } - for (int i = newLine.PartCount - 1; i >= 0; i--) - { - for (int j = newLine[i].Count - 1; j >= 0; j--) - { - linePart.Add(newLine[i][j]); - } - } - lineFromAllSelectedObj.AddPart(linePart); - break; - } - - featureFromAllSelectedObj.Geometry = lineFromAllSelectedObj; - - selectFeatures.Remove(n); - selectFeatures.Remove(p); - selectFeatures.Add(featureFromAllSelectedObj); - p--; - break; - } - } - } - } - } - //3 将合并之后的管线添加到集合中 - for (int h = 0; h < selectFeatures.Length; h++) - { - listFeature.Add(selectFeatures[h]); - } - } - //将选中的管线展示在窗体中 - if (listFeature.Count > 0) - { - FrmProfileAnalysis frm = new FrmProfileAnalysis(globeControl1, listFeature); - frm.Show(this); - } - else - { - MessageBox.Show("请选择相连接的管线!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); + selectFeatures.Add(feature); } } - else + List feats = SectionAnalysisTool.ZDMAnalysis(selectFeatures); + if (feats != null && feats.Count >= 1) { - MessageBox.Show("请选择一条或者多条管线!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); + FrmProfileAnalysis frm = new FrmProfileAnalysis(globeControl1, feats); + frm.Show(this); } } /// @@ -11479,25 +10720,11 @@ /// private void buttonItemFX2_3_Click(object sender, EventArgs e) { - //日志记录 - LogManager.saveLog(Utility.userName, this.buttonItemFX2_3.Text); + globeControl1.Globe.Action = EnumAction3D.TrackPolyline; + globeControl1.Globe.TrackPolylineTool.VerticalLineVisible = true; + globeControl1.Globe.TrackPolylineTool.TrackMode = EnumTrackMode.SpaceTrack; + trackPolylineEndMode = EnumTrackPolylineEndMode.DLDM_Analysis; - if (!buttonItemFX2_3.Checked) - { - trackflag = "RoadPolylineAnalysis"; - globeControl1.Globe.Action = EnumAction3D.TrackPolyline; - globeControl1.Globe.TrackPolylineTool.VerticalLineVisible = true; - buttonItemFX2_3.Checked = true; - buttonItemFX2_1.Checked = false; - buttonItemFX2_4.Checked = false; - } - else - { - globeControl1.Globe.Action = EnumAction3D.ActionNull; - buttonItemFX2_3.Checked = false; - globeControl1.Globe.TrackPolylineTool.VerticalLineVisible = false; - } - ActionToolMenuChecked(); } /// /// 基线剖面分析 @@ -11506,27 +10733,14 @@ /// private void buttonItemFX2_4_Click(object sender, EventArgs e) { - //日志记录 - LogManager.saveLog(Utility.userName, this.buttonItemFX2_4.Text); - - if (!buttonItemFX2_4.Checked) - { - globeControl1.Globe.Action = EnumAction3D.TrackPolyline; - //globeControl1.Globe.TrackPolylineAnalysis.VerticalLineVisible = true; - globeControl1.Globe.TrackPolylineTool.VerticalLineVisible = true; - buttonItemFX2_4.Checked = true; - buttonItemFX3_6.Checked = false; - buttonItemFX2_1.Checked = false; - } - else - { - globeControl1.Globe.Action = EnumAction3D.ActionNull; - buttonItemFX2_4.Checked = false; - //globeControl1.Globe.TrackPolylineAnalysis.VerticalLineVisible = false; - globeControl1.Globe.TrackPolylineTool.VerticalLineVisible = false; - } - ActionToolMenuChecked(); + globeControl1.Globe.Action = EnumAction3D.TrackPolyline; + globeControl1.Globe.TrackPolylineTool.VerticalLineVisible = true; + globeControl1.Globe.TrackPolylineTool.TrackMode = EnumTrackMode.SpaceTrack; + trackPolylineEndMode = EnumTrackPolylineEndMode.JXPM_Analysis; + } + + #endregion /// /// 创建拓扑 /// @@ -11540,7 +10754,7 @@ FrmGenAndFaMenTopu frm = new FrmGenAndFaMenTopu(globeControl1, m_PipelineLayerNames, valueLayerNames); frm.Show(this); } - #region Fan + #region Predator :拓扑分析 /// /// 上游分析 /// @@ -11550,8 +10764,6 @@ { //日志记录 LogManager.saveLog(Utility.userName, this.buttonItemFX3_2.Text); - - //ClearUpDownTraceAnalysis(); Fan NetworkTraceUpDown(true); } /// @@ -11563,10 +10775,27 @@ { //日志记录 LogManager.saveLog(Utility.userName, this.buttonItemFX3_3.Text); - - // ClearUpDownTraceAnalysis(); Fan NetworkTraceUpDown(false); } + + /// + /// 上下游追踪 功能 + /// + /// + private void NetworkTraceUpDown(Boolean bTraceUp) + { + GSOFeature selLineFeature = globeControl1.Globe.SelectedObject; + if (selLineFeature == null || selLineFeature.Geometry == null || selLineFeature.Geometry.Type != EnumGeometryType.GeoPolyline3D) + { + MessageBox.Show("请点击“编辑”—“选中对象”选择一条线!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); + return; + } + GSOLayer selLayer = globeControl1.Globe.SelectedObjectLayer; + + NetworkAnalysisTool.TraceUpDownAnalysis(bTraceUp, + selLineFeature, selLayer); + } + /// /// 流向分析 /// @@ -11618,43 +10847,6 @@ { MessageBox.Show("未找到关闭阀门"); } - - - //日志记录 - /* - LogManager.saveLog(Utility.userName, this.buttonItemFX3_5.Text); - - ClearCloseValvesAnalysis(); - if (globeControl1.Globe.SelObjectCount < 1) - { - MessageBox.Show("请选中至少一根管线!!"); - buttonItemFX3_5.Checked = false; - return; - } - GSOLayer resLayer = null; - GSOFeature resFeature = null; - globeControl1.Globe.GetSelectObject(0, out resFeature, out resLayer); - - GSOGeoPolyline3D line1 = resFeature.Geometry as GSOGeoPolyline3D; - if (line1 == null) - { - MessageBox.Show("请选择管线!!"); - return; - } - GSOPipeLineStyle3D pipeStyle1 = line1.Style as GSOPipeLineStyle3D; - if (pipeStyle1 == null) - { - MessageBox.Show("请选择管线!!"); - return; - } - GSOPoint3d resIntersetPoint = new GSOPoint3d(); - if (NetworkCloseValvesAnalysis(resFeature, resIntersetPoint, resLayer)) - { - //btnGFFX.Checked = false; - globeControl1.Globe.Action = EnumAction3D.ActionNull; - buttonItemFX3_5.Checked = false; - } - * **/ } /// @@ -11682,47 +10874,6 @@ return; } NetworkAnalysisTool.ConnexityAnalysis(selFeat0, selFeat1, layer0); - /* - //日志记录 - LogManager.saveLog(Utility.userName, this.buttonItemFX3_6.Text); - - if (globeControl1.Globe.SelObjectCount < 2) - { - MessageBox.Show("请选中至少两个管线!!"); - buttonItemFX3_6.Checked = false; - return; - } - ClearConnexityAnalysis(); - globeControl1.Globe.GetSelectObject(0, out m_ConnexityAnalysisFirstFeature, out m_ConnexityAnalysisFirstLayer); - globeControl1.Globe.GetSelectObject(1, out m_ConnexityAnaylsisSecondFeature, out m_COnnexityAnalysisSecondLayer); - GSOGeoPolyline3D line1 = m_ConnexityAnalysisFirstFeature.Geometry as GSOGeoPolyline3D; - GSOGeoPolyline3D line2 = m_ConnexityAnaylsisSecondFeature.Geometry as GSOGeoPolyline3D; - if (line1 == null || line2 == null) - { - MessageBox.Show("请选择管线!!"); - buttonItemFX3_6.Checked = false; - return; - } - - GSOPipeLineStyle3D pipeStyle1 = line1.Style as GSOPipeLineStyle3D; - GSOPipeLineStyle3D pipeStyle2 = line2.Style as GSOPipeLineStyle3D; - if (pipeStyle1 == null || pipeStyle2 == null) - { - MessageBox.Show("请选择管线!!"); - buttonItemFX3_6.Checked = false; - return; - } - if (!m_ConnexityAnalysisFirstLayer.IsSameInnerObject(m_COnnexityAnalysisSecondLayer)) - { - MessageBox.Show("不在同一个图层!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); - buttonItemFX3_6.Checked = false; - ClearConnexityAnalysis(); - } - else - { - ConnexityAnalysis(); - } - * **/ } /// /// 爆管分析 @@ -11731,8 +10882,6 @@ /// private void buttonItemFX3_7_Click(object sender, EventArgs e) { - //TODO LIST:关阀+上游 追踪 - NetworkTraceUpDown(true); //上游追踪: GSOFeature selLineFeature = globeControl1.Globe.SelectedObject; @@ -11747,73 +10896,8 @@ this.buttonItemFX3_5_Click(sender, e); //关阀分析: - //日志记录 - /* - LogManager.saveLog(Utility.userName, this.buttonItemFX3_7.Text); - ClearCloseValvesAnalysis(); - if (globeControl1.Globe.SelObjectCount < 1) - { - MessageBox.Show("请选中至少一个管线!!"); - return; - } - GSOLayer resLayer = null; - GSOFeature resFeature = null; - globeControl1.Globe.GetSelectObject(0, out resFeature, out resLayer); - - GSOGeoPolyline3D line1 = resFeature.Geometry as GSOGeoPolyline3D; - if (line1 == null) - { - MessageBox.Show("请选择管线!!"); - return; - } - GSOPipeLineStyle3D pipeStyle1 = line1.Style as GSOPipeLineStyle3D; - if (pipeStyle1 == null) - { - MessageBox.Show("请选择管线!!"); - return; - } - - GSOFeatures feats = globeControl1.Globe.MemoryLayer.GetFeatureByName("粒子要素", true); - if (feats.Length > 0) - globeControl1.Globe.MemoryLayer.RemoveFeatureByID(feats[0].ID); - //if (emitterFeature != null) - //{ - // globeControl1.Globe.MemoryLayer.RemoveFeatureByID(emitterFeature.ID); - //} - - GSOPoint3d pt = new GSOPoint3d(); - double length = line1.GetSpaceLength(true, 6378137);//线的长度 - GSOGeoPolyline3D lineLine = line1.GetSegment(0, length / 2); - GSOPoint3d point3d = lineLine[lineLine.PartCount - 1][lineLine[lineLine.PartCount - 1].Count - 1]; - pt.X = point3d.X; - pt.Y = point3d.Y; - pt.Z = point3d.Z; - - pt.Z += pipeStyle1.Radius * 2; - - if (resLayer.Caption.Contains("气")) - { - globeControl1.Globe.UnderGroundFloor.Visible = true; - AddFire(pt.X, pt.Y, pt.Z); - } - else if (resLayer.Caption.Contains("给水")) - { - globeControl1.Globe.UnderGroundFloor.Visible = true; - AddFountain(pt.X, pt.Y, pt.Z); - } - else if (resLayer.Caption.Contains("热力")) - { - globeControl1.Globe.UnderGroundFloor.Visible = true; - AddFountain(pt.X, pt.Y, pt.Z); - } - GSOPoint3d resIntersetPoint = new GSOPoint3d(); - if (NetworkBoosterValvesAnalysis(resFeature, resIntersetPoint, resLayer)) - { - globeControl1.Globe.Action = EnumAction3D.ActionNull; - } - * */ - } + #endregion /// /// 多边形开挖 diff --git a/NetworkAnalysisTool.cs b/NetworkAnalysisTool.cs index 7709e9d..67e1d2f 100644 --- a/NetworkAnalysisTool.cs +++ b/NetworkAnalysisTool.cs @@ -456,5 +456,15 @@ flowLayer = layer; } + //清除所有分析 + public static void ClearAllTopAnalysis(GSOGlobeControl globeControl) + { + ClearConnexityAnalysis(); + ClearExplodeAnalysis(globeControl); + ClearFlowDirectionAnalysis(); + ClearTraceUpDownAnalysis(); + ClearValvesAnalysis(); + } + } } diff --git a/SectionAnalysisTool.cs b/SectionAnalysisTool.cs new file mode 100644 index 0000000..9647393 --- /dev/null +++ b/SectionAnalysisTool.cs @@ -0,0 +1,332 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using GeoScene.Data; +using GeoScene.Engine; +using GeoScene.Globe; +using System.Windows.Forms; +namespace Cyberpipe +{ + public class HDMCoordinate + { + private double dis; + private double z; + + public double Dis + { + get { return dis; } + set { dis = value; } + } + public double Z + { + get { return z; } + set { z = value; } + } + } + public class SectionAnalysisTool + { + public static Dictionary hdmDic = new Dictionary(); + + public static void ClearHDMAnalysis(GSOGlobeControl globeControl) + { + hdmDic.Clear(); + globeControl.Globe.ClearLastTrackPolyline(); + globeControl.Globe.Action = EnumAction3D.ActionNull; + } + + /** + * 计算点与三维线之间的距离 + * **/ + private static HDMCoordinate getSpaceDisBetweenLineAndPoint(GSOPoint3d point, + GSOGeoPolyline3D polyLine) + { + double a_x = polyLine[0][0].X; + double a_y = polyLine[0][0].Y; + + int id = GeoScene.Data.GSOProjectManager.AddProject(Utility.projectStr); + GeoScene.Data.GSOPoint2d a_Point = GeoScene.Data.GSOProjectManager.Forward(new GSOPoint2d(a_x, + a_y), id);//user画的线的起始点 + + GeoScene.Data.GSOPoint2d pt2d = new GeoScene.Data.GSOPoint2d(point.X, point.Y); + GeoScene.Data.GSOPoint2d result = GeoScene.Data.GSOProjectManager.Forward(pt2d, id); + double B_x = result.X; + double B_y = result.Y; + + double x = System.Math.Abs(B_x - a_Point.X); + double y = System.Math.Abs(B_y - a_Point.Y); + double Dis = Math.Round(Math.Sqrt(x * x + y * y), 2); + HDMCoordinate coor = new HDMCoordinate(); + coor.Dis = Dis; + coor.Z = point.Z; + return coor; + } + + //横断面分析 + public static Dictionary HDMAnalysis(GSOGlobeControl globeControl, + GSOGeoPolyline3D polyLine, List pipeLayerNames) + { + ClearHDMAnalysis(globeControl); + + if (globeControl == null || polyLine == null|| + pipeLayerNames == null || pipeLayerNames.Count == 0) { return null; } + + globeControl.Globe.ClearLastTrackPolyline(); + globeControl.Globe.Action = EnumAction3D.ActionNull; + + GSOGeoPolygon3D polygon = polyLine.CreateBuffer(0.1, true, + 5, true, false); + + for (int i = 0; i < pipeLayerNames.Count; i++) + { + GSOLayer layer = globeControl.Globe.Layers. + GetLayerByCaption(pipeLayerNames[i]); + if(layer==null || layer.Visible==false|| + layer as GSOFeatureLayer==null) + continue; + + GSOFeatureLayer featurelayer = layer as GSOFeatureLayer; + GSOFeatures feats = featurelayer.FindFeaturesInPolygon(polygon, false); + if(feats==null||feats.Length==0) + continue; + + for (int j = 0; j < feats.Length; j++) + { + GSOFeature feateline = feats[j]; + GSOGeoPolyline3D geoline = feateline.Geometry as GSOGeoPolyline3D; + if(geoline!=null &&geoline.Style!=null&& + geoline.Style.GetType() == typeof(GSOPipeLineStyle3D)) + { + GSOPoint3d pntIntersect1 = new GSOPoint3d(); + GSOPoint3d pntIntersect2 = new GSOPoint3d(); + double honLen; + double verLen; + double dDist = globeControl.Globe.Analysis3D.ComputeTwoGeoPolylineDistance(polyLine, + geoline, out pntIntersect1, out pntIntersect2, out honLen, + out verLen, false, false, 0); + + if (dDist > -1) + { + HDMCoordinate coord = getSpaceDisBetweenLineAndPoint(pntIntersect2, polyLine); + hdmDic.Add(feateline, coord); + } + + } + + } + } + return hdmDic; + } + + //纵断面分析 + public static List ZDMAnalysis(GSOFeatures selectFeatures) + { + List result = new List(); + if (selectFeatures != null && selectFeatures.Length == 1) + { + result.Add(selectFeatures[0]); + return result; + } + + for (int i = 0; i < selectFeatures.Length; i++) + { + GSOGeoPolyline3D line = selectFeatures[i].Geometry as GSOGeoPolyline3D; + bool isConnect = false; + int[] valueCount = new int[2]; + valueCount[0] = 0; + valueCount[1] = 0; + if (line != null && line.PartCount > 0) + { + for (int j = 0; j < selectFeatures.Length; j++) + { + if (i == j) + { + continue; + } + GSOGeoPolyline3D newLine = selectFeatures[j].Geometry as GSOGeoPolyline3D; + if (newLine != null && newLine.PartCount > 0) + { + int minValueIndex = 0; + double limitValue = 1.0; + double[] value = new double[4]; + value[0] = getDistance(line[line.PartCount - 1][line[line.PartCount - 1].Count - 1], newLine[0][0]); + value[1] = getDistance(line[line.PartCount - 1][line[line.PartCount - 1].Count - 1], newLine[newLine.PartCount - 1][newLine[newLine.PartCount - 1].Count - 1]); + value[2] = getDistance(line[0][0], newLine[0][0]); + value[3] = getDistance(line[0][0], newLine[newLine.PartCount - 1][newLine[newLine.PartCount - 1].Count - 1]); + double minValue = value[0]; + for (int m = 1; m < value.Length; m++) + { + if (minValue > value[m]) + { + minValue = value[m]; + minValueIndex = m; + } + } + if (minValue < limitValue) + { + isConnect = true; + if (minValueIndex > 1) + { + valueCount[1]++; + } + else + { + valueCount[0]++; + } + } + } + } + if (!isConnect || valueCount[0] > 1 || valueCount[1] > 1) + { + MessageBox.Show("请选择相连接的一条线上的管线!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); + return null; + } + } + } + //2 记录每一条相连接的管线的起点和终点,并添加到一条管线中 + for (int p = 0; p < selectFeatures.Length; p++) + { + GSOGeoPolyline3D line = selectFeatures[p].Geometry as GSOGeoPolyline3D; + if (line != null && line.PartCount > 0) + { + for (int n = 0; n < selectFeatures.Length; n++) + { + if (p == n) + { + continue; + } + GSOGeoPolyline3D newLine = selectFeatures[n].Geometry as GSOGeoPolyline3D; + if (newLine != null && newLine.PartCount > 0) + { + int minValueIndex = 0; + double limitValue = 1.0; + double[] value = new double[4]; + value[0] = getDistance(line[line.PartCount - 1][line[line.PartCount - 1].Count - 1], newLine[0][0]); + value[1] = getDistance(line[line.PartCount - 1][line[line.PartCount - 1].Count - 1], newLine[newLine.PartCount - 1][newLine[newLine.PartCount - 1].Count - 1]); + value[2] = getDistance(line[0][0], newLine[0][0]); + value[3] = getDistance(line[0][0], newLine[newLine.PartCount - 1][newLine[newLine.PartCount - 1].Count - 1]); + double minValue = value[0]; + for (int m = 1; m < value.Length; m++) + { + if (minValue > value[m]) + { + minValue = value[m]; + minValueIndex = m; + } + } + if (minValue < limitValue) + { + GSOFeature featureFromAllSelectedObj = new GSOFeature(); + GSOGeoPolyline3D lineFromAllSelectedObj = new GSOGeoPolyline3D(); + switch (minValueIndex) + { + case 0: + GSOPoint3ds linePart = new GSOPoint3ds(); + for (int i = 0; i < line.PartCount; i++) + { + for (int j = 0; j < line[i].Count; j++) + { + linePart.Add(line[i][j]); + } + } + for (int i = 0; i < newLine.PartCount; i++) + { + for (int j = 0; j < newLine[i].Count; j++) + { + linePart.Add(newLine[i][j]); + } + } + lineFromAllSelectedObj.AddPart(linePart); + break; + case 1: + linePart = new GSOPoint3ds(); + for (int i = 0; i < line.PartCount; i++) + { + for (int j = 0; j < line[i].Count; j++) + { + linePart.Add(line[i][j]); + } + } + for (int i = newLine.PartCount - 1; i >= 0; i--) + { + for (int j = newLine[i].Count - 1; j >= 0; j--) + { + linePart.Add(newLine[i][j]); + } + } + lineFromAllSelectedObj.AddPart(linePart); + break; + case 2: + linePart = new GSOPoint3ds(); + for (int i = line.PartCount - 1; i >= 0; i--) + { + for (int j = line[i].Count - 1; j >= 0; j--) + { + linePart.Add(line[i][j]); + } + } + for (int i = 0; i < newLine.PartCount; i++) + { + for (int j = 0; j < newLine[i].Count; j++) + { + linePart.Add(newLine[i][j]); + } + } + lineFromAllSelectedObj.AddPart(linePart); + break; + case 3: + linePart = new GSOPoint3ds(); + for (int i = line.PartCount - 1; i >= 0; i--) + { + for (int j = line[i].Count - 1; j >= 0; j--) + { + linePart.Add(line[i][j]); + } + } + for (int i = newLine.PartCount - 1; i >= 0; i--) + { + for (int j = newLine[i].Count - 1; j >= 0; j--) + { + linePart.Add(newLine[i][j]); + } + } + lineFromAllSelectedObj.AddPart(linePart); + break; + } + + featureFromAllSelectedObj.Geometry = lineFromAllSelectedObj; + + selectFeatures.Remove(n); + selectFeatures.Remove(p); + selectFeatures.Add(featureFromAllSelectedObj); + p--; + break; + } + } + } + } + } + + for (int h = 0; h < selectFeatures.Length; h++) + { + result.Add(selectFeatures[h]); + } + return result; + } + + private static double getDistance(GSOPoint3d point1, GSOPoint3d point2) + { + GSOGeoPolyline3D lineline = new GSOGeoPolyline3D(); + GSOPoint3ds point3ds = new GSOPoint3ds(); + point3ds.Add(point1); + point3ds.Add(point2); + lineline.AddPart(point3ds); + + double distance = lineline.GetSpaceLength(true, 6378137.0); + return distance; + } + + + + } +} \ No newline at end of file diff --git a/Cyberpipe.csproj b/Cyberpipe.csproj index d24ccfc..cd0296f 100644 --- a/Cyberpipe.csproj +++ b/Cyberpipe.csproj @@ -228,6 +228,7 @@ F_GKT1添加项目.cs + @@ -938,12 +939,6 @@ FrmRESCMgr.cs - - Form - - - FrmRoadHDM.cs - Form @@ -1166,6 +1161,7 @@ + @@ -1611,10 +1607,6 @@ FrmRESCMgr.cs Designer - - FrmRoadHDM.cs - Designer - FrmRole.cs Designer diff --git a/EnumEventMode.cs b/EnumEventMode.cs new file mode 100644 index 0000000..b5eba59 --- /dev/null +++ b/EnumEventMode.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace Cyberpipe +{ + //横断面分析、基线剖面分析、道路断面分析 + public enum EnumTrackPolylineEndMode + { + Default_Analysis = 0, //无分析 + HDM_Analysis = 1, //横断面分析 + DLDM_Analysis = 2,//道路断面分析 + JXPM_Analysis = 3, //基线剖面分析 + } + + class EnumEventMode + { + } +} diff --git a/FrmHDMAnalysis3.cs b/FrmHDMAnalysis3.cs index 5e5988c..6405ed7 100644 --- a/FrmHDMAnalysis3.cs +++ b/FrmHDMAnalysis3.cs @@ -16,206 +16,72 @@ { public partial class FrmHDMAnalysis3 : DevComponents.DotNetBar.Office2007Form { - private ArrayList listPoint = new ArrayList(); - private ArrayList listFeat = new ArrayList(); - GSOGeoPolyline3D line = new GSOGeoPolyline3D(); //创建线对象 - - private static FrmHDMAnalysis3 allPipelineAnalysis = null; - public bool isShowFirst = false; - - static ArrayList list = new ArrayList(); + static DataTable table = new DataTable(); - static DataTable showTable = new DataTable(); GSOGlobeControl globeControl1; - object[,] sortIndex; - GSOLayer layerTemp; - private FrmHDMAnalysis3() - { - - } - public static FrmHDMAnalysis3 GetForm(ArrayList arraylistP, ArrayList arraylistF, GSOGeoPolyline3D _line, GSOGlobeControl _ctl) - { - if (allPipelineAnalysis == null) - { - allPipelineAnalysis = new FrmHDMAnalysis3(arraylistP, arraylistF, _line,_ctl); - } - else - { - allPipelineAnalysis.listPoint = arraylistP; - allPipelineAnalysis.listFeat = arraylistF; - allPipelineAnalysis.line = _line; - allPipelineAnalysis.globeControl1 = _ctl; - list = new ArrayList(); - } - return allPipelineAnalysis; - } + EnumTrackPolylineEndMode mode; - public FrmHDMAnalysis3(ArrayList arraylistP, ArrayList arraylistF, GSOGeoPolyline3D _line,GSOGlobeControl _ctl) + Dictionary hdmDic; + + public FrmHDMAnalysis3(Dictionary hdmDic, + GSOGlobeControl globeControl, EnumTrackPolylineEndMode mode) { InitializeComponent(); - this.listPoint = arraylistP; - this.listFeat = arraylistF; - line = _line; - globeControl1 = _ctl; + + this.hdmDic = hdmDic; + this.globeControl1 = globeControl; + this.mode = mode; } - double A_x, A_y, B_x, B_y;//定义坐标点,用来就横断面的长度 - /// - /// 窗体初始化事件处理 - /// - /// - /// - private void Frm_HDMAnalysis_Load(object sender, EventArgs e) + + private void initControls() { - layerTemp = globeControl1.Globe.Layers.Add(Application.StartupPath + "\\tempLgdExport.lgd"); - //chart1.ChartAreas[0].BackImage = Application.StartupPath + "\\Resource\\pipelineBackGround副本.png"; - } - /// - /// 窗体第一次显示事件处理 - /// - /// - /// - void Frm_HDMAnalysis2_Shown(object sender, EventArgs e) - { - isShowFirst = true; - - } - public void LoadChartEvent() - { - try - { - this.Shown += new EventHandler(Frm_HDMAnalysis2_Shown); - - chart1.Series["管线"].ChartType = SeriesChartType.Point; - - chart1.Series["管线"]["DrawingStyle"] = "Cylinder"; - chart1.Series["管线"].MarkerStyle = MarkerStyle.Circle; //点的类型 - - chart1.Series["管线"].MarkerBorderColor = Color.Black; //点的边框颜色 - chart1.ChartAreas[0].AxisX.Minimum = 0; //x轴的起始点大小 - chart1.ChartAreas[0].AxisY.Maximum = 0; //y轴的最大值 - - chart1.ChartAreas[0].AxisX.Title = "距离 (米)"; - chart1.ChartAreas[0].AxisY.Title = "埋深 (米)"; - - //chart1.ChartAreas[0].AxisX.ScrollBar.Enabled = true; - chart1.ChartAreas[0].AxisY2.Title = "高程 (米)"; - double[] depths = new double[listFeat.Count]; - for (int i = 0; i < listFeat.Count; i++) - { - GSOFeature f = listFeat[i] as GSOFeature; - double depth = f.GetFieldAsDouble("起始地面高程"); - depths[i] = depth; - } - double max_Depth = depths[0]; - for (int i = 0; i < listFeat.Count; i++) - { - if (max_Depth < depths[i]) - { - max_Depth = depths[i]; - } - } - chart1.ChartAreas[0].AxisY2.CustomLabels.Clear(); - chart1.ChartAreas[0].AxisY2.CustomLabels.Add(-5.4d, -5.6d, (max_Depth - 5.5).ToString("0.0")); - chart1.ChartAreas[0].AxisY2.CustomLabels.Add(-4.9d, -5.1d, (max_Depth - 5).ToString("0.0")); - chart1.ChartAreas[0].AxisY2.CustomLabels.Add(-4.4d, -4.6d, (max_Depth - 4.5).ToString("0.0")); - chart1.ChartAreas[0].AxisY2.CustomLabels.Add(-3.9d, -4.1d, (max_Depth - 4).ToString("0.0")); - chart1.ChartAreas[0].AxisY2.CustomLabels.Add(-3.4d, -3.6d, (max_Depth - 3.5).ToString("0.0")); - chart1.ChartAreas[0].AxisY2.CustomLabels.Add(-2.9d, -3.1d, (max_Depth - 3).ToString("0.0")); - chart1.ChartAreas[0].AxisY2.CustomLabels.Add(-2.4d, -2.6d, (max_Depth - 2.5).ToString("0.0")); - chart1.ChartAreas[0].AxisY2.CustomLabels.Add(-1.9d, -2.1d, (max_Depth - 2).ToString("0.0")); - chart1.ChartAreas[0].AxisY2.CustomLabels.Add(-1.4d, -1.6d, (max_Depth - 1.5).ToString("0.0")); - chart1.ChartAreas[0].AxisY2.CustomLabels.Add(-0.9d, -1.1d, (max_Depth - 1).ToString("0.0")); - chart1.ChartAreas[0].AxisY2.CustomLabels.Add(-0.4d, -0.6d, (max_Depth - 0.5).ToString("0.0")); - chart1.ChartAreas[0].AxisY2.CustomLabels.Add(-0.1d, 0.1d, max_Depth.ToString("0.0")); - - if (line.PartCount > 0) - { - GSOPoint3ds nodes = line[0]; - if (nodes.Count > 0) - { - GSOPoint3d node = nodes[0]; - A_x = node.X; - A_y = node.Y; - } - } - - DrawCurveGraph(A_x, A_y); - } - catch (Exception ex) - { - LogError.PublishError(ex); - } - } - - /// - /// 创建图表 - /// - /// - /// - private void DrawCurveGraph(double a_x,double a_y) - { - // 遍历线,求距离 - table = new DataTable(); - //showTable.Columns.Clear(); - list.Clear(); + chart1.Series["管线"].ChartType = SeriesChartType.Point; + chart1.Series["管线"]["DrawingStyle"] = "Cylinder"; + chart1.Series["管线"].MarkerStyle = MarkerStyle.Circle; //点的类型 + chart1.Series["管线"].MarkerBorderColor = Color.Black; //点的边框颜色 + //chart1.ChartAreas[0].AxisX.Minimum = 0; //x轴的起始点大小 + chart1.ChartAreas[0].AxisY.Maximum = 0; //y轴的最大值 + chart1.ChartAreas[0].AxisX.Title = "距离 (米)"; + chart1.ChartAreas[0].AxisY.Title = "埋深 (米)"; + chart1.ChartAreas[0].AxisY2.Title = "高程 (米)"; chart1.Series["管线"].Points.Clear(); - chart1.ChartAreas[0].AxisX.Maximum = Math.Round(line.GetSpaceLength(true, 6378137),2); + //chart1.ChartAreas[0].AxisX.Maximum = Math.Round(line.GetSpaceLength(true, 6378137), 2); + table.Columns.Add("编号", typeof(string)); table.Columns.Add("管线类型", typeof(string)); table.Columns.Add("管线编码", typeof(string)); table.Columns.Add("管径_毫米", typeof(string)); table.Columns.Add("材质", typeof(string)); - table.Columns.Add("管线埋深", typeof(string)); + table.Columns.Add("管线埋深", typeof(string)); - sortIndex = new object[listPoint.Count, 2]; - for (int i = 0; i <= listPoint.Count; i++) + if (mode == EnumTrackPolylineEndMode.DLDM_Analysis) { - if (i == listPoint.Count) - { - double maxNum = 0.0; - for (int j = 0; j < listPoint.Count; j++) - { - if (maxNum < Convert.ToDouble(sortIndex[j, 0])) - { - maxNum = Convert.ToDouble(sortIndex[j, 0]); - } - } - chart1.Series["管线"].Points.AddXY(maxNum + 2, 0); - chart1.Series["管线"].Points[i].MarkerBorderWidth = 100; //边框的宽度 - chart1.Series["管线"].Points[i].MarkerColor = Color.Black; - chart1.Series["管线"].Points[i].MarkerSize = 100; - continue; - } - GSOPoint3d geoPoint = (GSOPoint3d)listPoint[i]; - GSOFeature feature = listFeat[i] as GSOFeature; - //坐标投影 - int id = GeoScene.Data.GSOProjectManager.AddProject(Utility.projectStr); + this.pictureBox1.Visible = true; + } + else + { + this.pictureBox1.Visible = false; + } + } - GeoScene.Data.GSOPoint2d a_Point = GeoScene.Data.GSOProjectManager.Forward(new GSOPoint2d(a_x, a_y), id);//user画的线的起始点 + private void draw() + { + int i = 0; + foreach (KeyValuePair kvp in this.hdmDic) + { + GSOFeature feature = kvp.Key; + HDMCoordinate coor = kvp.Value; - GeoScene.Data.GSOPoint2d pt2d = new GeoScene.Data.GSOPoint2d(geoPoint.X, geoPoint.Y); - GeoScene.Data.GSOPoint2d result = GeoScene.Data.GSOProjectManager.Forward(pt2d, id); - B_x = result.X; - B_y = result.Y; + chart1.Series["管线"].Points.AddXY(coor.Dis, coor.Z);//绑定数据 - double x = System.Math.Abs(B_x - a_Point.X); - double y = System.Math.Abs(B_y - a_Point.Y); - double Dis = 0.0; - Dis = Math.Round(Math.Sqrt(x * x + y * y) , 2); - list.Add(geoPoint.Z); - sortIndex[i, 0] = Dis; - sortIndex[i, 1] = i; - - chart1.Series["管线"].Points.AddXY(Dis, geoPoint.Z);//绑定数据 - - string pipeType = feature.Dataset == null ? "" : feature.Dataset.Caption; + string pipeType = feature.Dataset == null ? "" : feature.Dataset.Caption; string number = Convert.ToString(i + 1); - string material = feature.GetFieldAsString("材质"); string diameter = feature.GetFieldAsString("管径_毫米"); - table.Rows.Add(new object[] { number, pipeType, feature.Name.ToString(), diameter, material,Convert.ToDecimal(list[i].ToString()).ToString("f2")});//list[i].ToString().Substring(0,list[i].ToString().IndexOf('.')+3) } - - //chart1.Series["管线"].Points[i].Label = number;//管线的标签 + table.Rows.Add(new object[] { number, + pipeType, feature.Name.ToString(), + diameter, material, + Convert.ToDecimal(coor.Z).ToString("f2") }); chart1.Series["管线"].Points[i].LegendText = number; if (feature.Geometry.Style.GetType() == typeof(GSOPipeLineStyle3D)) { @@ -229,47 +95,12 @@ chart1.Series["管线"].Points[i].MarkerBorderWidth = 3; //边框的宽度 chart1.Series["管线"].Points[i].MarkerColor = Color.Transparent; - chart1.Series["管线"].Points[i].MarkerSize = Convert.ToInt32(Math.Floor((feature.GetFieldAsDouble("管径_毫米") / 0.35 + chart1.Series["管线"].Points[i].MarkerBorderWidth) / 100.0));//点的大小 - + chart1.Series["管线"].Points[i].MarkerSize = Convert.ToInt32(Math.Floor((feature.GetFieldAsDouble("管径_毫米") / 0.35 + + chart1.Series["管线"].Points[i].MarkerBorderWidth) / 100.0)); + i++; } - - string htmlCode = "" + - "" + - "" + - "
管线类型管线编码管径_毫米材质管线埋深
" + - "" + - "" + - "" + - "" + - "
"; - webBrowser1.DocumentText = htmlCode; } + /// /// 图表的鼠标单击事件处理 /// @@ -286,14 +117,11 @@ return; } string number = p.LegendText; - //MessageBox.Show(number); int indexInTableRows = 0; bool isInt = int.TryParse(number, out indexInTableRows); if (isInt) { DataRow row = table.Rows[indexInTableRows - 1]; - //showTable.Rows.Clear(); - //showTable.Rows.Add(new object[] { row[0], row[1], row[2], row[3], row[4], row[5] }); string htmlCode = "" + - "" + - "" + - "
管线类型管线编码管径_毫米材质管线埋深
" + - "" + - "" + - "" + - "" + - "
"; - webBrowser1.DocumentText = htmlCode; - - - } - /// - /// 图表鼠标单击事件处理 - /// - /// - /// - private void chart1_MouseClick(object sender, MouseEventArgs e) - { - HitTestResult result = chart1.HitTest(e.X, e.Y, true); - if (result.PointIndex >= 0) - { - DataPoint p = (DataPoint)result.Object; - if (p == null) - { - return; - } - string number = p.LegendText; - int indexInTableRows = 0; - bool isInt = int.TryParse(number, out indexInTableRows); - if (isInt) - { - DataRow row = table.Rows[indexInTableRows - 1]; - string htmlCode = "" + - "" + - "" + - "
管线类型管线编码管径_毫米材质管线埋深
" + row[1] + - "" + row[2] + - "" + row[3] + - "" + row[4] + - "" + row[5] + - "
"; - webBrowser1.DocumentText = htmlCode; - } - } - } - /// - /// 窗体关闭事件处理 - /// - /// - /// - private void FrmRoadHDM_FormClosing(object sender, FormClosingEventArgs e) - { - allPipelineAnalysis = null; - globeControl1.Globe.MemoryLayer.RemoveAllFeature(); - } - /// - /// 图表鼠标移动事件处理 - /// - /// - /// - private void chart1_MouseMove(object sender, MouseEventArgs e) - { - HitTestResult result = chart1.HitTest(e.X, e.Y, true); - if (result.PointIndex >= 0) - { - this.Cursor = Cursors.Hand; - } - else - { - this.Cursor = Cursors.Default; - } - } - - private void Export(GSOPoint3d _pnt, double r) - { - GSOPoint3ds pnts = new GSOPoint3ds(); - GSOPoint3d pnt = new GSOPoint3d(); - pnt.X = _pnt.X; - pnt.Y = _pnt.Y; - pnt.Z = _pnt.Z; - pnts.Add(pnt); - pnt.X = _pnt.X; - pnt.Y = _pnt.Y - 0.0000000005; - pnt.Z = _pnt.Z; - pnts.Add(pnt); - GSOGeoPolyline3D line = new GSOGeoPolyline3D(); - line.AddPart(pnts); - GSOGeoPolygon3D polygon = line.CreateBuffer(r * 2, true, 5, true, false); - GSOPoint3ds points = polygon[0]; - GSOGeoPolyline3D newLine = new GSOGeoPolyline3D(); - newLine.AddPart(points); - newLine.AltitudeMode = EnumAltitudeMode.RelativeToGround; - GSOFeature newFeature = new GSOFeature(); - newFeature.Geometry = newLine; - globeControl1.Globe.MemoryLayer.AddFeature(newFeature); - } - - private void ExportCAD(double a, double b, double r) - { - GSOPoint3ds pnts = new GSOPoint3ds(); - for (int i = 0; i <= 64; i++) - { - double x = a + r * Math.Cos(i * 5.625 * Math.PI / 180); - double y = b - r * Math.Sin(i * 5.625 * Math.PI / 180); - GSOPoint2d pt2d = new GeoScene.Data.GSOPoint2d(x, y); - GSOPoint3d pnt = new GSOPoint3d(); - pnt.X = pt2d.X; - pnt.Y = pt2d.Y; - pnt.Z = 0; - pnts.Add(pnt); - } - GSOGeoPolyline3D line = new GSOGeoPolyline3D(); - line.AddPart(pnts); - GSOFeature f = new GSOFeature(); - f.Geometry = line; - f.Geometry.LatLonCoord = false; - f.Visible = false; - layerTemp.AddFeature(f); - } - /// - /// 导出CAD按钮事件处理 - /// - /// - /// - private void btnExportCAD_Click(object sender, EventArgs e) - { - layerTemp.RemoveAllFeature(); - for (int i = 0; i < listPoint.Count; i++) - { - GSOPoint3d geoPoint = (GSOPoint3d)listPoint[i]; - GSOFeature feature = listFeat[i] as GSOFeature; - if (feature != null) - { - if (feature.Geometry.Type == EnumGeometryType.GeoPolyline3D) - { - GSOPipeLineStyle3D style = feature.Geometry.Style as GSOPipeLineStyle3D; - double r = style.Radius; - ExportCAD(double.Parse(sortIndex[i, 0].ToString()), geoPoint.Z, r); - } - } - } - layerTemp.Dataset.ImportProjectionRefFromProj4(""); - SaveFileDialog dlg = new SaveFileDialog(); - dlg.Filter = "*.dxf|*.dxf"; - if (dlg.ShowDialog() == DialogResult.OK) - { - layerTemp.SaveAs(dlg.FileName); - MessageBox.Show("导出CAD完成!", "提示"); - } - layerTemp.RemoveAllFeature(); - } - } -} diff --git a/FrmRoadHDM.designer.cs b/FrmRoadHDM.designer.cs deleted file mode 100644 index 23a4c3b..0000000 --- a/FrmRoadHDM.designer.cs +++ /dev/null @@ -1,132 +0,0 @@ -namespace Cyberpipe -{ - partial class FrmRoadHDM - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmRoadHDM)); - System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea1 = new System.Windows.Forms.DataVisualization.Charting.ChartArea(); - System.Windows.Forms.DataVisualization.Charting.Series series1 = new System.Windows.Forms.DataVisualization.Charting.Series(); - this.pictureBox1 = new System.Windows.Forms.PictureBox(); - this.webBrowser1 = new System.Windows.Forms.WebBrowser(); - this.chart1 = new System.Windows.Forms.DataVisualization.Charting.Chart(); - this.btnExportCAD = new DevComponents.DotNetBar.ButtonX(); - ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.chart1)).BeginInit(); - this.SuspendLayout(); - // - // pictureBox1 - // - this.pictureBox1.BackColor = System.Drawing.Color.White; - this.pictureBox1.Dock = System.Windows.Forms.DockStyle.Top; - this.pictureBox1.ErrorImage = null; - this.pictureBox1.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image"))); - this.pictureBox1.ImageLocation = ""; - this.pictureBox1.Location = new System.Drawing.Point(0, 0); - this.pictureBox1.Name = "pictureBox1"; - this.pictureBox1.Size = new System.Drawing.Size(608, 64); - this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; - this.pictureBox1.TabIndex = 1; - this.pictureBox1.TabStop = false; - // - // webBrowser1 - // - this.webBrowser1.Dock = System.Windows.Forms.DockStyle.Bottom; - this.webBrowser1.Location = new System.Drawing.Point(0, 326); - this.webBrowser1.MinimumSize = new System.Drawing.Size(20, 20); - this.webBrowser1.Name = "webBrowser1"; - this.webBrowser1.ScrollBarsEnabled = false; - this.webBrowser1.Size = new System.Drawing.Size(608, 139); - this.webBrowser1.TabIndex = 3; - // - // chart1 - // - chartArea1.AxisX.MajorGrid.Enabled = false; - chartArea1.Name = "ChartArea1"; - this.chart1.ChartAreas.Add(chartArea1); - this.chart1.Location = new System.Drawing.Point(0, 66); - this.chart1.Name = "chart1"; - this.chart1.RightToLeft = System.Windows.Forms.RightToLeft.Yes; - series1.ChartArea = "ChartArea1"; - series1.Name = "管线"; - this.chart1.Series.Add(series1); - this.chart1.Size = new System.Drawing.Size(608, 254); - this.chart1.TabIndex = 2; - this.chart1.Text = "chart1"; - this.chart1.MouseClick += new System.Windows.Forms.MouseEventHandler(this.chart1_MouseClick); - this.chart1.MouseMove += new System.Windows.Forms.MouseEventHandler(this.chart1_MouseMove); - // - // btnExportCAD - // - this.btnExportCAD.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; - this.btnExportCAD.Anchor = System.Windows.Forms.AnchorStyles.Bottom; - this.btnExportCAD.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground; - this.btnExportCAD.Location = new System.Drawing.Point(268, 430); - this.btnExportCAD.Name = "btnExportCAD"; - this.btnExportCAD.Size = new System.Drawing.Size(75, 23); - this.btnExportCAD.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; - this.btnExportCAD.TabIndex = 4; - this.btnExportCAD.Text = "导出CAD"; - this.btnExportCAD.Click += new System.EventHandler(this.btnExportCAD_Click); - // - // FrmRoadHDM - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.BackColor = System.Drawing.Color.White; - this.ClientSize = new System.Drawing.Size(608, 465); - this.Controls.Add(this.btnExportCAD); - this.Controls.Add(this.chart1); - this.Controls.Add(this.webBrowser1); - this.Controls.Add(this.pictureBox1); - this.DoubleBuffered = true; - this.EnableGlass = false; - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; - this.MaximizeBox = false; - this.Name = "FrmRoadHDM"; - this.ShowIcon = false; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; - this.Text = "道路与管线综合横断面"; - this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FrmRoadHDM_FormClosing); - this.Load += new System.EventHandler(this.FrmRoadHDM_Load); - this.Shown += new System.EventHandler(this.FrmRoadHDM_Shown); - ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.chart1)).EndInit(); - this.ResumeLayout(false); - - } - - #endregion - - private System.Windows.Forms.PictureBox pictureBox1; - private System.Windows.Forms.WebBrowser webBrowser1; - private System.Windows.Forms.DataVisualization.Charting.Chart chart1; - private DevComponents.DotNetBar.ButtonX btnExportCAD; - - - } -} \ No newline at end of file diff --git a/FrmRoadHDM.resx b/FrmRoadHDM.resx deleted file mode 100644 index 5202d5f..0000000 --- a/FrmRoadHDM.resx +++ /dev/null @@ -1,177 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - - - 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 - iNKUe3NRsLcAAAAASUVORK5CYII= - - - \ No newline at end of file diff --git a/MainFrm.cs b/MainFrm.cs index e9b6cbe..2df3aac 100644 --- a/MainFrm.cs +++ b/MainFrm.cs @@ -75,15 +75,6 @@ private string trackflag;//定义阀门查询个数 - private GSOFeature m_ConnexityAnalysisFirstFeature; - private GSOFeature m_ConnexityAnaylsisSecondFeature; - private GSOLayer m_ConnexityAnalysisFirstLayer; - private GSOLayer m_COnnexityAnalysisSecondLayer; - private GSOFeatures m_ConnexityAnalyResFeatures; - private GSOFeatures m_TraceUpDownAnalyResFeatures; - private GSOFeatures m_AffectedPipeLines; - private GSOFeatures m_CloseValvesAnalyResFeatures; - private GSOFeatures m_BoosterValvesAnalyResFeatures; //管线间距分析 private GSOFeature disFeature = new GSOFeature(); private GSOFeature featureDis = new GSOFeature(); @@ -2656,8 +2647,37 @@ ///
/// /// + private static EnumTrackPolylineEndMode trackPolylineEndMode; + void globeControl1_TrackPolylineEndEvent(object sender, TrackPolylineEndEventArgs e) { + //横断面分析、道路横断面分析 + if (trackPolylineEndMode == EnumTrackPolylineEndMode.HDM_Analysis|| + trackPolylineEndMode == EnumTrackPolylineEndMode.DLDM_Analysis) + { + Dictionary hdmDic = SectionAnalysisTool.HDMAnalysis(this.globeControl1, + e.Polyline, this.m_PipelineLayerNames); + FrmHDMAnalysis3 frm = new FrmHDMAnalysis3(hdmDic, this.globeControl1, + trackPolylineEndMode); + frm.Show(this); + } + //基线剖面分析 + else if (trackPolylineEndMode == EnumTrackPolylineEndMode.JXPM_Analysis) + { + FrmBaseLineProfillAnalysis dlg = new FrmBaseLineProfillAnalysis(globeControl1.Globe, e.Polyline); + dlg.Show(this); + globeControl1.Globe.ClearLastTrackPolyline(); + /* + FrmRoadHDM f = new FrmRoadHDM(); + f.Show() + * **/ + } + else + { + + } + trackPolylineEndMode = EnumTrackPolylineEndMode.Default_Analysis; + /* ArrayList arraylistPoint = new ArrayList(); ArrayList arraylistLine = new ArrayList(); @@ -2835,6 +2855,7 @@ } globeControl1.Globe.Action = EnumAction3D.ActionNull; ActionToolMenuChecked(); + * **/ } #endregion @@ -4962,10 +4983,10 @@ if (globeControl1.Globe.Action != EnumAction3D.NormalHit) { buttonItemFX3_6.Checked = false; - ClearConnexityAnalysis(); + // ClearConnexityAnalysis(); buttonItemFX3_5.Checked = false; - ClearCloseValvesAnalysis(); + // ClearCloseValvesAnalysis(); } if (globeControl1.Globe.Action != EnumAction3D.TrackPolygon) { @@ -4973,131 +4994,7 @@ buttonItemFX4_1.Checked = false; } } - /// - /// 连通性分析 功能 - /// - private void ConnexityAnalysis() - { - GSODataset curCAYDataset = m_ConnexityAnalysisFirstLayer.Dataset; - string srName = curCAYDataset.Name; - GSONetworkDataset curCAYNDataset = curCAYDataset.DataSource.GetDatasetByName(srName + "Network") as GSONetworkDataset; - if (curCAYNDataset == null) - { - MessageBox.Show("该图层没有创建网络拓扑,请先创建网络拓扑信息再进行分析!", "提示"); - return; - } - int[] arryResID; - curCAYNDataset.ConnexityAnalysis(m_ConnexityAnalysisFirstFeature.ID, m_ConnexityAnaylsisSecondFeature.ID, out arryResID, false, true); - m_ConnexityAnalyResFeatures = m_ConnexityAnalysisFirstLayer.GetFeaturesByIDs(arryResID); - if (m_ConnexityAnalyResFeatures == null || m_ConnexityAnalyResFeatures.Length < 1) - { - String strLine1 = "管线:" + m_ConnexityAnalysisFirstFeature.ID; - String strLine2 = "管线:" + m_ConnexityAnaylsisSecondFeature.ID; - MessageBox.Show(strLine1 + " 与 " + strLine2 + " 不连通", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); - } - else - { - int nCount = m_ConnexityAnalyResFeatures.Length; - for (int i = 0; i < nCount; i++) - { - m_ConnexityAnalyResFeatures[i].HighLight = true; - GSOGeoPolyline3D geoline = m_ConnexityAnalyResFeatures[i].Geometry as GSOGeoPolyline3D; - if (geoline != null) - { - GSOLineStyle3D lineStyle = geoline.Style as GSOLineStyle3D; - if (lineStyle != null) - { - if (lineStyle.ArrowStyle == null) - { - lineStyle.ArrowStyle = new GSOArrowStyle(); - - } - lineStyle.ArrowStyle.BodyLen = 8; - lineStyle.ArrowVisible = true; - lineStyle.ArrowStyle.Play(); - } - } - } - globeControl1.Refresh(); - } - } - /// - /// 清除连通性分析结果 功能 - /// - private void ClearConnexityAnalysis() - { - if (m_ConnexityAnalysisFirstFeature != null) - { - m_ConnexityAnalysisFirstFeature.HighLight = false; - m_ConnexityAnalysisFirstFeature.Label = null; - } - if (m_ConnexityAnaylsisSecondFeature != null) - { - m_ConnexityAnaylsisSecondFeature.HighLight = false; - m_ConnexityAnaylsisSecondFeature.Label = null; - } - - m_ConnexityAnalysisFirstFeature = null; - m_ConnexityAnaylsisSecondFeature = null; - m_ConnexityAnalysisFirstLayer = null; - m_COnnexityAnalysisSecondLayer = null; - - if (m_ConnexityAnalyResFeatures != null) - { - int nCount = m_ConnexityAnalyResFeatures.Length; - - for (int i = 0; i < nCount; i++) - { - m_ConnexityAnalyResFeatures[i].HighLight = false; - GSOGeoPolyline3D geoline = m_ConnexityAnalyResFeatures[i].Geometry as GSOGeoPolyline3D; - if (geoline != null) - { - GSOLineStyle3D lineStyle = geoline.Style as GSOLineStyle3D; - if (lineStyle != null) - { - lineStyle.ArrowVisible = false; - } - } - } - m_ConnexityAnalyResFeatures = null; - - } - } - /// - /// 清除阀门分析结果 功能 - /// - private void ClearCloseValvesAnalysis() - { - if (m_CloseValvesAnalyResFeatures != null) - { - for (int i = 0; i < m_CloseValvesList.Count; i++) - { - GSOFeature feature = m_CloseValvesList[i] as GSOFeature; - feature.Label.Text = ""; - } - globeControl1.Refresh(); - m_CloseValvesAnalyResFeatures = null; - m_CloseValvesList = new ArrayList(); - } - } - /// - /// 清除阀门分析结果 功能 - /// - private void ClearBoosterValvesAnalysis() - { - if (m_BoosterValvesAnalyResFeatures != null) - { - for (int i = 0; i < m_BoosterValvesList.Count; i++) - { - GSOFeature feature = m_BoosterValvesList[i] as GSOFeature; - feature.Label.Text = ""; - } - globeControl1.Refresh(); - m_BoosterValvesAnalyResFeatures = null; - m_BoosterValvesList = new ArrayList(); - } - } /// /// 主窗体关闭事件处理 /// @@ -5118,211 +5015,7 @@ //注销id号为103的热键设定 // UnregisterHotKey(Handle, 103); } - /// - /// 清除追踪结果 功能 : Fan 可去掉了! - /// - private void ClearUpDownTraceAnalysis() - { - if (m_TraceUpDownAnalyResFeatures != null) - { - int nCount = m_TraceUpDownAnalyResFeatures.Length; - for (int i = 0; i < nCount; i++) - { - m_TraceUpDownAnalyResFeatures[i].HighLight = false; - GSOGeoPolyline3D geoline = m_TraceUpDownAnalyResFeatures[i].Geometry as GSOGeoPolyline3D; - if (geoline != null) - { - GSOLineStyle3D lineStyle = geoline.Style as GSOLineStyle3D; - if (lineStyle != null) - { - lineStyle.ArrowVisible = false; - } - } - } - m_TraceUpDownAnalyResFeatures = null; - } - } - /// - /// 取消所有高亮管线的高亮状态 - /// - private void ClearAffectedPipeLine() - { - if (m_AffectedPipeLines != null) - { - int nCount = m_AffectedPipeLines.Length; - for (int i = 0; i < nCount; i++) - { - m_AffectedPipeLines[i].HighLight = false; - } - m_AffectedPipeLines = null; - } - } - #region Fan 拓扑分析 - /// - /// 上下游追踪 功能 - /// - /// - private void NetworkTraceUpDown(Boolean bTraceUp) - { - GSOFeature selLineFeature = globeControl1.Globe.SelectedObject; - if (selLineFeature == null || selLineFeature.Geometry == null || selLineFeature.Geometry.Type != EnumGeometryType.GeoPolyline3D) - { - MessageBox.Show("请点击“编辑”—“选中对象”选择一条线!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); - return; - } - GSOLayer selLayer = globeControl1.Globe.SelectedObjectLayer; - - NetworkAnalysisTool.TraceUpDownAnalysis(bTraceUp, - selLineFeature, selLayer); - /* - if (globeControl1.Globe.SelectedObject == null) - { - MessageBox.Show("请点击“编辑”—“选中对象”选择一条线!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); - return; - } - GSOFeature selLineFeature = globeControl1.Globe.SelectedObject; - - if (selLineFeature.Geometry == null || selLineFeature.Geometry.Type != EnumGeometryType.GeoPolyline3D) - { - MessageBox.Show("请点击“编辑”—“选中对象”选择一条线!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); - return; - } - - if (globeControl1.Globe.SelectedObjectLayer == null) - { - MessageBox.Show("选中管线所在图层为空!", "提示"); - return; - } - - GSODataset curCAYDataset = globeControl1.Globe.SelectedObjectLayer.Dataset; - if (curCAYDataset == null || curCAYDataset.DataSource == null) - { - MessageBox.Show("选中管线所在图层不是数据库图层!", "提示"); - return; - } - - string srName = curCAYDataset.Name; - GSONetworkDataset curCAYNDataset = curCAYDataset.DataSource.GetDatasetByName(srName + "Network") as GSONetworkDataset; - - if (curCAYNDataset == null) - { - MessageBox.Show("选中管线所在图层没有创建拓扑!", "提示"); - return; - } - - int[] arryResID; - curCAYNDataset.TraceUpDownAnalysis(selLineFeature.ID, out arryResID, bTraceUp, false, true); - m_TraceUpDownAnalyResFeatures = globeControl1.Globe.SelectedObjectLayer.GetFeaturesByIDs(arryResID); - if (m_TraceUpDownAnalyResFeatures == null || m_TraceUpDownAnalyResFeatures.Length < 1) - { - String strLine1 = "没有上游!"; - if (!bTraceUp) - { - strLine1 = "没有下游!"; - - } - MessageBox.Show(strLine1); - } - else - { - int nCount = m_TraceUpDownAnalyResFeatures.Length; - for (int i = 0; i < nCount; i++) - { - m_TraceUpDownAnalyResFeatures[i].HighLight = true; - GSOGeoPolyline3D geoline = m_TraceUpDownAnalyResFeatures[i].Geometry as GSOGeoPolyline3D; - if (geoline != null) - { - GSOLineStyle3D lineStyle = geoline.Style as GSOLineStyle3D; - if (lineStyle != null) - { - if (lineStyle.ArrowStyle == null) - { - lineStyle.ArrowStyle = new GSOArrowStyle(); - lineStyle.ArrowStyle.BodyWidth = 2; - lineStyle.ArrowStyle.BodyLen = 6; - lineStyle.ArrowStyle.HeadWidth = 8; - lineStyle.ArrowStyle.HeadLen = 10; - lineStyle.ArrowStyle.OutlineVisible = true; - lineStyle.ArrowStyle.OutlineColor = Color.Red; - lineStyle.ArrowStyle.Speed = lineStyle.ArrowStyle.Speed / 2; - } - lineStyle.ArrowVisible = true; - lineStyle.ArrowStyle.Play(); - } - } - } - globeControl1.Refresh(); - } - * **/ - } - - #endregion - /// - /// 上下游追踪 功能 - /// - /// - private void AffectedPipeLine(Boolean bTraceUp) - { - if (globeControl1.Globe.SelectedObject == null) - { - MessageBox.Show("请点击“编辑”—“选中对象”选择一条线!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); - return; - } - GSOFeature selLineFeature = globeControl1.Globe.SelectedObject; - if (selLineFeature.Geometry == null || selLineFeature.Geometry.Type != EnumGeometryType.GeoPolyline3D) - { - MessageBox.Show("请点击“编辑”—“选中对象”选择一条线!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); - - return; - } - - if (globeControl1.Globe.SelectedObjectLayer == null) - { - return; - } - - GSODataset curCAYDataset = globeControl1.Globe.SelectedObjectLayer.Dataset; - if (curCAYDataset == null || curCAYDataset.DataSource == null) - { - return; - } - - string srName = curCAYDataset.Name; - GSONetworkDataset curCAYNDataset = curCAYDataset.DataSource.GetDatasetByName(srName + "Network") as GSONetworkDataset; - - if (curCAYNDataset == null) - { - return; - } - int[] arryResID; - curCAYNDataset.TraceUpDownAnalysis(selLineFeature.ID, out arryResID, bTraceUp, false, true); - m_AffectedPipeLines = globeControl1.Globe.SelectedObjectLayer.GetFeaturesByIDs(arryResID); - if (m_AffectedPipeLines == null || m_AffectedPipeLines.Length < 1) - { - } - else - { - int nCount = m_AffectedPipeLines.Length; - for (int i = 0; i < nCount; i++) - { - m_AffectedPipeLines[i].HighLight = true; - } - globeControl1.Refresh(); - } - } - /// - /// 清除上下游追踪结果 菜单 - /// - /// - /// - //private void buttonItem58_Click(object sender, EventArgs e) - //{ - // //日志记录 - // LogManager.saveLog(Utility.userName, this.buttonItem58.Text); - - // ClearUpDownTraceAnalysis(); - //} - + /// /// 显示流向 功能 /// @@ -5359,158 +5052,8 @@ } FrmCloseValves frm; - /// - /// 关阀分析 功能 - /// - /// - /// - /// - /// - private bool NetworkCloseValvesAnalysis(GSOFeature lineFeature, GSOPoint3d pntBreak, GSOLayer lineLayer) - { - /* - if (lineLayer == null || lineFeature == null || lineFeature.Geometry == null || lineFeature.Geometry.Type != EnumGeometryType.GeoPolyline3D) - { - return false; - } - GSODataset curCAYDataset = lineLayer.Dataset; - if (curCAYDataset == null || curCAYDataset.DataSource == null) - { - MessageBox.Show("该图层不是要素图层!", "提示"); - return false; - } - string srName = curCAYDataset.Name; - GSONetworkDataset curCAYNDataset = curCAYDataset.DataSource.GetDatasetByName(srName + "Network") as GSONetworkDataset; - - if (curCAYNDataset == null) - { - MessageBox.Show("该图层没有创建网络拓扑,请先创建网络拓扑信息再进行分析!", "提示"); - return false; - } - ClearCloseValvesAnalysis(); - - int[] arryResNodeID = null; - int[] arryResValveID = null; - try - { - curCAYNDataset.CloseValveAnalysis(lineFeature.ID, out arryResNodeID, out arryResValveID, false, true); - } - catch (Exception e) - { } - - string valveName = lineLayer.Caption; - valveName = valveName.Substring(0, valveName.IndexOf("管线")); - GSOLayer valveLayer = globeControl1.Globe.Layers[valveName + "阀门"]; - if (valveLayer == null) - { - MessageBox.Show("和选中对象所在管线图层相关联的阀门图层不存在!", "提示"); - return false; - } - - m_CloseValvesAnalyResFeatures = valveLayer.GetFeaturesByIDs(arryResValveID);// curCAYNDataset.NodeDataset.GetFeaturesByIDs(arryResValveID); - - if (m_CloseValvesAnalyResFeatures == null || m_CloseValvesAnalyResFeatures.Length < 1) - { - MessageBox.Show("没有找到要关闭的阀门!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); - if (frm != null) - { - frm.Close(); - } - } - else - { - int nCount = m_CloseValvesAnalyResFeatures.Length; - - if (nCount > 0) - { - frm = FrmCloseValves.getForm(globeControl1, m_CloseValvesAnalyResFeatures, m_CloseValvesList); - - if (!frm.Visible) - { - frm.Show(this); - } - } - }**/ - return true; - } FrmBoosterValvers frmbooster = null; - /// - /// 阀门分析 功能 - /// - /// - /// - /// - /// - private bool NetworkBoosterValvesAnalysis(GSOFeature lineFeature, GSOPoint3d pntBreak, GSOLayer lineLayer) - { - if (lineLayer == null || lineFeature == null || lineFeature.Geometry == null || lineFeature.Geometry.Type != EnumGeometryType.GeoPolyline3D) - { - return false; - } - GSODataset curCAYDataset = lineLayer.Dataset; - - if (curCAYDataset == null || curCAYDataset.DataSource == null) - { - return false; - } - string srName = curCAYDataset.Name; - GSONetworkDataset curCAYNDataset = curCAYDataset.DataSource.GetDatasetByName(srName + "Network") as GSONetworkDataset; - - if (curCAYNDataset == null) - { - MessageBox.Show("该图层没有创建网络拓扑,请先创建网络拓扑信息再进行分析!", "提示"); - return false; - } - ClearBoosterValvesAnalysis(); - ClearAffectedPipeLine(); - - int[] arryResNodeID = null; - int[] arryResValveID = null; - try - { - curCAYNDataset.CloseValveAnalysis(lineFeature.ID, out arryResNodeID, out arryResValveID, false, true); - } - catch (Exception e) - { - - } - //目前只有燃气管线 有阀门 - string valveName = lineLayer.Name; - valveName = valveName.Substring(0, valveName.IndexOf("管线")); - GSOLayer valveLayer = globeControl1.Globe.Layers[valveName + "阀门"]; - if (valveLayer == null) - { - MessageBox.Show("和选中对象所在管线图层相关联的阀门图层不存在!", "提示"); - return false; - } - m_BoosterValvesAnalyResFeatures = valveLayer.GetFeaturesByIDs(arryResValveID); - - if (m_BoosterValvesAnalyResFeatures == null || - m_BoosterValvesAnalyResFeatures.Length < 1) - { - MessageBox.Show("没有找到要关闭的阀门!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); - if (frmbooster != null) - { - frmbooster.Close(); - } - } - else - { - int nCount = m_BoosterValvesAnalyResFeatures.Length; - if (nCount > 0) - { - AffectedPipeLine(false); - frmbooster = FrmBoosterValvers.getForm(globeControl1, m_BoosterValvesAnalyResFeatures, m_BoosterValvesList, m_AffectedPipeLines); - frmbooster.setLstValvesName(); - if (!frmbooster.Visible) - { - frmbooster.Show(this); - } - } - } - return true; - } /// /// 垂直净距分析 功能界面中的 选择图层复选框 选中状态改变事件处理 @@ -7726,69 +7269,6 @@ double distance = lineline.GetSpaceLength(true, 6378137.0); return distance; } - /// - /// 判断管线是否相通 功能 - /// - /// - public bool isInterlinked() - { - if (globeControl1.Globe.SelObjectCount < 2) - { - MessageBox.Show("请选中至少两个管线!!"); - buttonItemFX3_6.Checked = false; - return false; - } - ClearConnexityAnalysis(); - globeControl1.Globe.GetSelectObject(0, out m_ConnexityAnalysisFirstFeature, out m_ConnexityAnalysisFirstLayer); - globeControl1.Globe.GetSelectObject(1, out m_ConnexityAnaylsisSecondFeature, out m_COnnexityAnalysisSecondLayer); - GSOGeoPolyline3D line1 = m_ConnexityAnalysisFirstFeature.Geometry as GSOGeoPolyline3D; - GSOGeoPolyline3D line2 = m_ConnexityAnaylsisSecondFeature.Geometry as GSOGeoPolyline3D; - if (line1 == null || line2 == null) - { - MessageBox.Show("请选择管线!!"); - return false; - } - GSOPipeLineStyle3D pipeStyle1 = line1.Style as GSOPipeLineStyle3D; - GSOPipeLineStyle3D pipeStyle2 = line2.Style as GSOPipeLineStyle3D; - if (pipeStyle1 == null || pipeStyle2 == null) - { - MessageBox.Show("请选择管线!!"); - return false; - } - if (!m_ConnexityAnalysisFirstLayer.IsSameInnerObject(m_COnnexityAnalysisSecondLayer)) - { - MessageBox.Show("不在同一个图层!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); - ClearConnexityAnalysis(); - return false; - } - else - { - GSODataset curCAYDataset = m_ConnexityAnalysisFirstLayer.Dataset; - string srName = curCAYDataset.Name; - GSONetworkDataset curCAYNDataset = curCAYDataset.DataSource.GetDatasetByName(srName + "Network") as GSONetworkDataset; - if (curCAYNDataset == null) - { - MessageBox.Show("该图层没有创建网络拓扑,请先创建网络拓扑信息再进行分析!", "提示"); - return false; - } - - int[] arryResID; - curCAYNDataset.ConnexityAnalysis(m_ConnexityAnalysisFirstFeature.ID, m_ConnexityAnaylsisSecondFeature.ID, out arryResID, false, true); - m_ConnexityAnalyResFeatures = m_ConnexityAnalysisFirstLayer.GetFeaturesByIDs(arryResID); - if (m_ConnexityAnalyResFeatures == null || m_ConnexityAnalyResFeatures.Length < 1) - { - String strLine1 = "管线:" + m_ConnexityAnalysisFirstFeature.ID; - String strLine2 = "管线:" + m_ConnexityAnaylsisSecondFeature.ID; - MessageBox.Show("请选择两条相通的管线!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); - return false; - } - else - { - return true; - } - } - } - /// /// 图层节点树中 节点 右键单击事件处理 @@ -9564,27 +9044,7 @@ } } - /// - /// 清除分析结果 - /// - /// - /// - //private void buttonItem131_Click(object sender, EventArgs e) - //{ - // LogManager.saveLog(Utility.userName, this.buttonItem131.Text); - - // clearFeatureHighLight(); - // //if (boolfrmShResult == true) - // //{ - // // frmShResult.Close(); - // //} - // //else - // //{ - - // //} - - // ClearRedlineAnalyseResult(); - //} + /// /// 清除渲染结果 /// @@ -10728,8 +10188,9 @@ buttonX16_Click(null, null); buttonClearAnalysisResult_Click(null, null); - ClearConnexityAnalysis();//清除连通性分析 - ClearCloseValvesAnalysis();//清除阀门分析 + NetworkAnalysisTool.ClearAllTopAnalysis(this.globeControl1); + // ClearConnexityAnalysis();//清除连通性分析 + // ClearCloseValvesAnalysis();//清除阀门分析 //清除管线间距分析 if (disFeature != null) @@ -10753,7 +10214,7 @@ globeControl1.Globe.UnderGroundFloor.Visible = false;//隐藏地下网格线 - ClearUpDownTraceAnalysis(); //清除上下游分析 + // ClearUpDownTraceAnalysis(); //清除上下游分析 globeControl1.Globe.RemoveAllPits();//清除所有坑 string[] markerStrs = new string[9]; @@ -11206,6 +10667,8 @@ sideBar1.Refresh(); Refresh(); } + + #region Predaotr,断面分析 /// /// 横断面分析 /// @@ -11213,26 +10676,11 @@ /// private void buttonItemFX2_1_Click(object sender, EventArgs e) { - //日志记录 - LogManager.saveLog(Utility.userName, this.buttonItemFX2_1.Text); - - if (!buttonItemFX2_1.Checked) - { - trackflag = "PolylineAnalysis"; - globeControl1.Globe.Action = EnumAction3D.TrackPolyline; - globeControl1.Globe.TrackPolylineTool.VerticalLineVisible = true; - globeControl1.Globe.TrackPolylineTool.TrackMode = EnumTrackMode.SpaceTrack; - buttonItemFX2_1.Checked = true; - buttonItemFX2_3.Checked = false; - buttonItemFX2_4.Checked = false; - } - else - { - globeControl1.Globe.Action = EnumAction3D.ActionNull; - buttonItemFX2_1.Checked = false; - globeControl1.Globe.TrackPolylineTool.VerticalLineVisible = false; - } - ActionToolMenuChecked(); + globeControl1.Globe.Action = EnumAction3D.TrackPolyline; + globeControl1.Globe.TrackPolylineTool.VerticalLineVisible = true; + globeControl1.Globe.TrackPolylineTool.TrackMode = EnumTrackMode.SpaceTrack; + trackPolylineEndMode = EnumTrackPolylineEndMode.HDM_Analysis; + } /// /// 纵断面分析 @@ -11241,235 +10689,28 @@ /// private void buttonItemFX2_2_Click(object sender, EventArgs e) { - //日志记录 - LogManager.saveLog(Utility.userName, this.buttonItemFX2_2.Text); - - if (globeControl1.Globe.SelObjectCount >= 1) + if (globeControl1.Globe.SelObjectCount<1) { - GSOFeatures selectFeatures = new GSOFeatures(); - for (int i = 0; i < globeControl1.Globe.SelObjectCount; i++) + MessageBox.Show("请选择一条或者多条管线!", "提示", MessageBoxButtons.OK, + MessageBoxIcon.Information); + return; + } + GSOFeatures selectFeatures = new GSOFeatures(); + for (int i = 0; i < globeControl1.Globe.SelObjectCount; i++) + { + GSOFeature feature = null; + GSOLayer layer = null; + globeControl1.Globe.GetSelectObject(i, out feature, out layer); + if (feature != null && feature.Geometry != null && feature.Geometry.Type == EnumGeometryType.GeoPolyline3D) { - GSOFeature feature = null; - GSOLayer layer = null; - globeControl1.Globe.GetSelectObject(i, out feature, out layer); - if (feature != null && feature.Geometry != null && feature.Geometry.Type == EnumGeometryType.GeoPolyline3D) - { - selectFeatures.Add(feature); - } - } - if (selectFeatures.Length < 1) - { - MessageBox.Show("请选择一条或者多条管线!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); - return; - } - List listFeature = new List(); - if (selectFeatures.Length == 1) - { - listFeature.Add(selectFeatures[0]); - } - else - { - //求多条管线纵断面 1,2,3 - //1 判断管线是否相连、且没有分叉 - for (int i = 0; i < selectFeatures.Length; i++) - { - GSOGeoPolyline3D line = selectFeatures[i].Geometry as GSOGeoPolyline3D; - bool isConnect = false; - int[] valueCount = new int[2]; - valueCount[0] = 0; - valueCount[1] = 0; - - if (line != null && line.PartCount > 0) - { - for (int j = 0; j < selectFeatures.Length; j++) - { - if (i == j) - { - continue; - } - GSOGeoPolyline3D newLine = selectFeatures[j].Geometry as GSOGeoPolyline3D; - if (newLine != null && newLine.PartCount > 0) - { - int minValueIndex = 0; - double limitValue = 1.0; - double[] value = new double[4]; - value[0] = getDistance(line[line.PartCount - 1][line[line.PartCount - 1].Count - 1], newLine[0][0]); - value[1] = getDistance(line[line.PartCount - 1][line[line.PartCount - 1].Count - 1], newLine[newLine.PartCount - 1][newLine[newLine.PartCount - 1].Count - 1]); - value[2] = getDistance(line[0][0], newLine[0][0]); - value[3] = getDistance(line[0][0], newLine[newLine.PartCount - 1][newLine[newLine.PartCount - 1].Count - 1]); - double minValue = value[0]; - for (int m = 1; m < value.Length; m++) - { - if (minValue > value[m]) - { - minValue = value[m]; - minValueIndex = m; - } - } - if (minValue < limitValue) - { - isConnect = true; - if (minValueIndex > 1) - { - valueCount[1]++; - } - else - { - valueCount[0]++; - } - } - } - } - if (!isConnect || valueCount[0] > 1 || valueCount[1] > 1) - { - MessageBox.Show("请选择相连接的一条线上的管线!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); - return; - } - } - } - //2 记录每一条相连接的管线的起点和终点,并添加到一条管线中 - for (int p = 0; p < selectFeatures.Length; p++) - { - GSOGeoPolyline3D line = selectFeatures[p].Geometry as GSOGeoPolyline3D; - if (line != null && line.PartCount > 0) - { - for (int n = 0; n < selectFeatures.Length; n++) - { - if (p == n) - { - continue; - } - GSOGeoPolyline3D newLine = selectFeatures[n].Geometry as GSOGeoPolyline3D; - if (newLine != null && newLine.PartCount > 0) - { - int minValueIndex = 0; - double limitValue = 1.0; - double[] value = new double[4]; - value[0] = getDistance(line[line.PartCount - 1][line[line.PartCount - 1].Count - 1], newLine[0][0]); - value[1] = getDistance(line[line.PartCount - 1][line[line.PartCount - 1].Count - 1], newLine[newLine.PartCount - 1][newLine[newLine.PartCount - 1].Count - 1]); - value[2] = getDistance(line[0][0], newLine[0][0]); - value[3] = getDistance(line[0][0], newLine[newLine.PartCount - 1][newLine[newLine.PartCount - 1].Count - 1]); - double minValue = value[0]; - for (int m = 1; m < value.Length; m++) - { - if (minValue > value[m]) - { - minValue = value[m]; - minValueIndex = m; - } - } - if (minValue < limitValue) - { - GSOFeature featureFromAllSelectedObj = new GSOFeature(); - GSOGeoPolyline3D lineFromAllSelectedObj = new GSOGeoPolyline3D(); - switch (minValueIndex) - { - case 0: - GSOPoint3ds linePart = new GSOPoint3ds(); - for (int i = 0; i < line.PartCount; i++) - { - for (int j = 0; j < line[i].Count; j++) - { - linePart.Add(line[i][j]); - } - } - for (int i = 0; i < newLine.PartCount; i++) - { - for (int j = 0; j < newLine[i].Count; j++) - { - linePart.Add(newLine[i][j]); - } - } - lineFromAllSelectedObj.AddPart(linePart); - break; - case 1: - linePart = new GSOPoint3ds(); - for (int i = 0; i < line.PartCount; i++) - { - for (int j = 0; j < line[i].Count; j++) - { - linePart.Add(line[i][j]); - } - } - for (int i = newLine.PartCount - 1; i >= 0; i--) - { - for (int j = newLine[i].Count - 1; j >= 0; j--) - { - linePart.Add(newLine[i][j]); - } - } - lineFromAllSelectedObj.AddPart(linePart); - break; - case 2: - linePart = new GSOPoint3ds(); - for (int i = line.PartCount - 1; i >= 0; i--) - { - for (int j = line[i].Count - 1; j >= 0; j--) - { - linePart.Add(line[i][j]); - } - } - for (int i = 0; i < newLine.PartCount; i++) - { - for (int j = 0; j < newLine[i].Count; j++) - { - linePart.Add(newLine[i][j]); - } - } - lineFromAllSelectedObj.AddPart(linePart); - break; - case 3: - linePart = new GSOPoint3ds(); - for (int i = line.PartCount - 1; i >= 0; i--) - { - for (int j = line[i].Count - 1; j >= 0; j--) - { - linePart.Add(line[i][j]); - } - } - for (int i = newLine.PartCount - 1; i >= 0; i--) - { - for (int j = newLine[i].Count - 1; j >= 0; j--) - { - linePart.Add(newLine[i][j]); - } - } - lineFromAllSelectedObj.AddPart(linePart); - break; - } - - featureFromAllSelectedObj.Geometry = lineFromAllSelectedObj; - - selectFeatures.Remove(n); - selectFeatures.Remove(p); - selectFeatures.Add(featureFromAllSelectedObj); - p--; - break; - } - } - } - } - } - //3 将合并之后的管线添加到集合中 - for (int h = 0; h < selectFeatures.Length; h++) - { - listFeature.Add(selectFeatures[h]); - } - } - //将选中的管线展示在窗体中 - if (listFeature.Count > 0) - { - FrmProfileAnalysis frm = new FrmProfileAnalysis(globeControl1, listFeature); - frm.Show(this); - } - else - { - MessageBox.Show("请选择相连接的管线!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); + selectFeatures.Add(feature); } } - else + List feats = SectionAnalysisTool.ZDMAnalysis(selectFeatures); + if (feats != null && feats.Count >= 1) { - MessageBox.Show("请选择一条或者多条管线!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); + FrmProfileAnalysis frm = new FrmProfileAnalysis(globeControl1, feats); + frm.Show(this); } } /// @@ -11479,25 +10720,11 @@ /// private void buttonItemFX2_3_Click(object sender, EventArgs e) { - //日志记录 - LogManager.saveLog(Utility.userName, this.buttonItemFX2_3.Text); + globeControl1.Globe.Action = EnumAction3D.TrackPolyline; + globeControl1.Globe.TrackPolylineTool.VerticalLineVisible = true; + globeControl1.Globe.TrackPolylineTool.TrackMode = EnumTrackMode.SpaceTrack; + trackPolylineEndMode = EnumTrackPolylineEndMode.DLDM_Analysis; - if (!buttonItemFX2_3.Checked) - { - trackflag = "RoadPolylineAnalysis"; - globeControl1.Globe.Action = EnumAction3D.TrackPolyline; - globeControl1.Globe.TrackPolylineTool.VerticalLineVisible = true; - buttonItemFX2_3.Checked = true; - buttonItemFX2_1.Checked = false; - buttonItemFX2_4.Checked = false; - } - else - { - globeControl1.Globe.Action = EnumAction3D.ActionNull; - buttonItemFX2_3.Checked = false; - globeControl1.Globe.TrackPolylineTool.VerticalLineVisible = false; - } - ActionToolMenuChecked(); } /// /// 基线剖面分析 @@ -11506,27 +10733,14 @@ /// private void buttonItemFX2_4_Click(object sender, EventArgs e) { - //日志记录 - LogManager.saveLog(Utility.userName, this.buttonItemFX2_4.Text); - - if (!buttonItemFX2_4.Checked) - { - globeControl1.Globe.Action = EnumAction3D.TrackPolyline; - //globeControl1.Globe.TrackPolylineAnalysis.VerticalLineVisible = true; - globeControl1.Globe.TrackPolylineTool.VerticalLineVisible = true; - buttonItemFX2_4.Checked = true; - buttonItemFX3_6.Checked = false; - buttonItemFX2_1.Checked = false; - } - else - { - globeControl1.Globe.Action = EnumAction3D.ActionNull; - buttonItemFX2_4.Checked = false; - //globeControl1.Globe.TrackPolylineAnalysis.VerticalLineVisible = false; - globeControl1.Globe.TrackPolylineTool.VerticalLineVisible = false; - } - ActionToolMenuChecked(); + globeControl1.Globe.Action = EnumAction3D.TrackPolyline; + globeControl1.Globe.TrackPolylineTool.VerticalLineVisible = true; + globeControl1.Globe.TrackPolylineTool.TrackMode = EnumTrackMode.SpaceTrack; + trackPolylineEndMode = EnumTrackPolylineEndMode.JXPM_Analysis; + } + + #endregion /// /// 创建拓扑 /// @@ -11540,7 +10754,7 @@ FrmGenAndFaMenTopu frm = new FrmGenAndFaMenTopu(globeControl1, m_PipelineLayerNames, valueLayerNames); frm.Show(this); } - #region Fan + #region Predator :拓扑分析 /// /// 上游分析 /// @@ -11550,8 +10764,6 @@ { //日志记录 LogManager.saveLog(Utility.userName, this.buttonItemFX3_2.Text); - - //ClearUpDownTraceAnalysis(); Fan NetworkTraceUpDown(true); } /// @@ -11563,10 +10775,27 @@ { //日志记录 LogManager.saveLog(Utility.userName, this.buttonItemFX3_3.Text); - - // ClearUpDownTraceAnalysis(); Fan NetworkTraceUpDown(false); } + + /// + /// 上下游追踪 功能 + /// + /// + private void NetworkTraceUpDown(Boolean bTraceUp) + { + GSOFeature selLineFeature = globeControl1.Globe.SelectedObject; + if (selLineFeature == null || selLineFeature.Geometry == null || selLineFeature.Geometry.Type != EnumGeometryType.GeoPolyline3D) + { + MessageBox.Show("请点击“编辑”—“选中对象”选择一条线!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); + return; + } + GSOLayer selLayer = globeControl1.Globe.SelectedObjectLayer; + + NetworkAnalysisTool.TraceUpDownAnalysis(bTraceUp, + selLineFeature, selLayer); + } + /// /// 流向分析 /// @@ -11618,43 +10847,6 @@ { MessageBox.Show("未找到关闭阀门"); } - - - //日志记录 - /* - LogManager.saveLog(Utility.userName, this.buttonItemFX3_5.Text); - - ClearCloseValvesAnalysis(); - if (globeControl1.Globe.SelObjectCount < 1) - { - MessageBox.Show("请选中至少一根管线!!"); - buttonItemFX3_5.Checked = false; - return; - } - GSOLayer resLayer = null; - GSOFeature resFeature = null; - globeControl1.Globe.GetSelectObject(0, out resFeature, out resLayer); - - GSOGeoPolyline3D line1 = resFeature.Geometry as GSOGeoPolyline3D; - if (line1 == null) - { - MessageBox.Show("请选择管线!!"); - return; - } - GSOPipeLineStyle3D pipeStyle1 = line1.Style as GSOPipeLineStyle3D; - if (pipeStyle1 == null) - { - MessageBox.Show("请选择管线!!"); - return; - } - GSOPoint3d resIntersetPoint = new GSOPoint3d(); - if (NetworkCloseValvesAnalysis(resFeature, resIntersetPoint, resLayer)) - { - //btnGFFX.Checked = false; - globeControl1.Globe.Action = EnumAction3D.ActionNull; - buttonItemFX3_5.Checked = false; - } - * **/ } /// @@ -11682,47 +10874,6 @@ return; } NetworkAnalysisTool.ConnexityAnalysis(selFeat0, selFeat1, layer0); - /* - //日志记录 - LogManager.saveLog(Utility.userName, this.buttonItemFX3_6.Text); - - if (globeControl1.Globe.SelObjectCount < 2) - { - MessageBox.Show("请选中至少两个管线!!"); - buttonItemFX3_6.Checked = false; - return; - } - ClearConnexityAnalysis(); - globeControl1.Globe.GetSelectObject(0, out m_ConnexityAnalysisFirstFeature, out m_ConnexityAnalysisFirstLayer); - globeControl1.Globe.GetSelectObject(1, out m_ConnexityAnaylsisSecondFeature, out m_COnnexityAnalysisSecondLayer); - GSOGeoPolyline3D line1 = m_ConnexityAnalysisFirstFeature.Geometry as GSOGeoPolyline3D; - GSOGeoPolyline3D line2 = m_ConnexityAnaylsisSecondFeature.Geometry as GSOGeoPolyline3D; - if (line1 == null || line2 == null) - { - MessageBox.Show("请选择管线!!"); - buttonItemFX3_6.Checked = false; - return; - } - - GSOPipeLineStyle3D pipeStyle1 = line1.Style as GSOPipeLineStyle3D; - GSOPipeLineStyle3D pipeStyle2 = line2.Style as GSOPipeLineStyle3D; - if (pipeStyle1 == null || pipeStyle2 == null) - { - MessageBox.Show("请选择管线!!"); - buttonItemFX3_6.Checked = false; - return; - } - if (!m_ConnexityAnalysisFirstLayer.IsSameInnerObject(m_COnnexityAnalysisSecondLayer)) - { - MessageBox.Show("不在同一个图层!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); - buttonItemFX3_6.Checked = false; - ClearConnexityAnalysis(); - } - else - { - ConnexityAnalysis(); - } - * **/ } /// /// 爆管分析 @@ -11731,8 +10882,6 @@ /// private void buttonItemFX3_7_Click(object sender, EventArgs e) { - //TODO LIST:关阀+上游 追踪 - NetworkTraceUpDown(true); //上游追踪: GSOFeature selLineFeature = globeControl1.Globe.SelectedObject; @@ -11747,73 +10896,8 @@ this.buttonItemFX3_5_Click(sender, e); //关阀分析: - //日志记录 - /* - LogManager.saveLog(Utility.userName, this.buttonItemFX3_7.Text); - ClearCloseValvesAnalysis(); - if (globeControl1.Globe.SelObjectCount < 1) - { - MessageBox.Show("请选中至少一个管线!!"); - return; - } - GSOLayer resLayer = null; - GSOFeature resFeature = null; - globeControl1.Globe.GetSelectObject(0, out resFeature, out resLayer); - - GSOGeoPolyline3D line1 = resFeature.Geometry as GSOGeoPolyline3D; - if (line1 == null) - { - MessageBox.Show("请选择管线!!"); - return; - } - GSOPipeLineStyle3D pipeStyle1 = line1.Style as GSOPipeLineStyle3D; - if (pipeStyle1 == null) - { - MessageBox.Show("请选择管线!!"); - return; - } - - GSOFeatures feats = globeControl1.Globe.MemoryLayer.GetFeatureByName("粒子要素", true); - if (feats.Length > 0) - globeControl1.Globe.MemoryLayer.RemoveFeatureByID(feats[0].ID); - //if (emitterFeature != null) - //{ - // globeControl1.Globe.MemoryLayer.RemoveFeatureByID(emitterFeature.ID); - //} - - GSOPoint3d pt = new GSOPoint3d(); - double length = line1.GetSpaceLength(true, 6378137);//线的长度 - GSOGeoPolyline3D lineLine = line1.GetSegment(0, length / 2); - GSOPoint3d point3d = lineLine[lineLine.PartCount - 1][lineLine[lineLine.PartCount - 1].Count - 1]; - pt.X = point3d.X; - pt.Y = point3d.Y; - pt.Z = point3d.Z; - - pt.Z += pipeStyle1.Radius * 2; - - if (resLayer.Caption.Contains("气")) - { - globeControl1.Globe.UnderGroundFloor.Visible = true; - AddFire(pt.X, pt.Y, pt.Z); - } - else if (resLayer.Caption.Contains("给水")) - { - globeControl1.Globe.UnderGroundFloor.Visible = true; - AddFountain(pt.X, pt.Y, pt.Z); - } - else if (resLayer.Caption.Contains("热力")) - { - globeControl1.Globe.UnderGroundFloor.Visible = true; - AddFountain(pt.X, pt.Y, pt.Z); - } - GSOPoint3d resIntersetPoint = new GSOPoint3d(); - if (NetworkBoosterValvesAnalysis(resFeature, resIntersetPoint, resLayer)) - { - globeControl1.Globe.Action = EnumAction3D.ActionNull; - } - * */ - } + #endregion /// /// 多边形开挖 diff --git a/NetworkAnalysisTool.cs b/NetworkAnalysisTool.cs index 7709e9d..67e1d2f 100644 --- a/NetworkAnalysisTool.cs +++ b/NetworkAnalysisTool.cs @@ -456,5 +456,15 @@ flowLayer = layer; } + //清除所有分析 + public static void ClearAllTopAnalysis(GSOGlobeControl globeControl) + { + ClearConnexityAnalysis(); + ClearExplodeAnalysis(globeControl); + ClearFlowDirectionAnalysis(); + ClearTraceUpDownAnalysis(); + ClearValvesAnalysis(); + } + } } diff --git a/SectionAnalysisTool.cs b/SectionAnalysisTool.cs new file mode 100644 index 0000000..9647393 --- /dev/null +++ b/SectionAnalysisTool.cs @@ -0,0 +1,332 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using GeoScene.Data; +using GeoScene.Engine; +using GeoScene.Globe; +using System.Windows.Forms; +namespace Cyberpipe +{ + public class HDMCoordinate + { + private double dis; + private double z; + + public double Dis + { + get { return dis; } + set { dis = value; } + } + public double Z + { + get { return z; } + set { z = value; } + } + } + public class SectionAnalysisTool + { + public static Dictionary hdmDic = new Dictionary(); + + public static void ClearHDMAnalysis(GSOGlobeControl globeControl) + { + hdmDic.Clear(); + globeControl.Globe.ClearLastTrackPolyline(); + globeControl.Globe.Action = EnumAction3D.ActionNull; + } + + /** + * 计算点与三维线之间的距离 + * **/ + private static HDMCoordinate getSpaceDisBetweenLineAndPoint(GSOPoint3d point, + GSOGeoPolyline3D polyLine) + { + double a_x = polyLine[0][0].X; + double a_y = polyLine[0][0].Y; + + int id = GeoScene.Data.GSOProjectManager.AddProject(Utility.projectStr); + GeoScene.Data.GSOPoint2d a_Point = GeoScene.Data.GSOProjectManager.Forward(new GSOPoint2d(a_x, + a_y), id);//user画的线的起始点 + + GeoScene.Data.GSOPoint2d pt2d = new GeoScene.Data.GSOPoint2d(point.X, point.Y); + GeoScene.Data.GSOPoint2d result = GeoScene.Data.GSOProjectManager.Forward(pt2d, id); + double B_x = result.X; + double B_y = result.Y; + + double x = System.Math.Abs(B_x - a_Point.X); + double y = System.Math.Abs(B_y - a_Point.Y); + double Dis = Math.Round(Math.Sqrt(x * x + y * y), 2); + HDMCoordinate coor = new HDMCoordinate(); + coor.Dis = Dis; + coor.Z = point.Z; + return coor; + } + + //横断面分析 + public static Dictionary HDMAnalysis(GSOGlobeControl globeControl, + GSOGeoPolyline3D polyLine, List pipeLayerNames) + { + ClearHDMAnalysis(globeControl); + + if (globeControl == null || polyLine == null|| + pipeLayerNames == null || pipeLayerNames.Count == 0) { return null; } + + globeControl.Globe.ClearLastTrackPolyline(); + globeControl.Globe.Action = EnumAction3D.ActionNull; + + GSOGeoPolygon3D polygon = polyLine.CreateBuffer(0.1, true, + 5, true, false); + + for (int i = 0; i < pipeLayerNames.Count; i++) + { + GSOLayer layer = globeControl.Globe.Layers. + GetLayerByCaption(pipeLayerNames[i]); + if(layer==null || layer.Visible==false|| + layer as GSOFeatureLayer==null) + continue; + + GSOFeatureLayer featurelayer = layer as GSOFeatureLayer; + GSOFeatures feats = featurelayer.FindFeaturesInPolygon(polygon, false); + if(feats==null||feats.Length==0) + continue; + + for (int j = 0; j < feats.Length; j++) + { + GSOFeature feateline = feats[j]; + GSOGeoPolyline3D geoline = feateline.Geometry as GSOGeoPolyline3D; + if(geoline!=null &&geoline.Style!=null&& + geoline.Style.GetType() == typeof(GSOPipeLineStyle3D)) + { + GSOPoint3d pntIntersect1 = new GSOPoint3d(); + GSOPoint3d pntIntersect2 = new GSOPoint3d(); + double honLen; + double verLen; + double dDist = globeControl.Globe.Analysis3D.ComputeTwoGeoPolylineDistance(polyLine, + geoline, out pntIntersect1, out pntIntersect2, out honLen, + out verLen, false, false, 0); + + if (dDist > -1) + { + HDMCoordinate coord = getSpaceDisBetweenLineAndPoint(pntIntersect2, polyLine); + hdmDic.Add(feateline, coord); + } + + } + + } + } + return hdmDic; + } + + //纵断面分析 + public static List ZDMAnalysis(GSOFeatures selectFeatures) + { + List result = new List(); + if (selectFeatures != null && selectFeatures.Length == 1) + { + result.Add(selectFeatures[0]); + return result; + } + + for (int i = 0; i < selectFeatures.Length; i++) + { + GSOGeoPolyline3D line = selectFeatures[i].Geometry as GSOGeoPolyline3D; + bool isConnect = false; + int[] valueCount = new int[2]; + valueCount[0] = 0; + valueCount[1] = 0; + if (line != null && line.PartCount > 0) + { + for (int j = 0; j < selectFeatures.Length; j++) + { + if (i == j) + { + continue; + } + GSOGeoPolyline3D newLine = selectFeatures[j].Geometry as GSOGeoPolyline3D; + if (newLine != null && newLine.PartCount > 0) + { + int minValueIndex = 0; + double limitValue = 1.0; + double[] value = new double[4]; + value[0] = getDistance(line[line.PartCount - 1][line[line.PartCount - 1].Count - 1], newLine[0][0]); + value[1] = getDistance(line[line.PartCount - 1][line[line.PartCount - 1].Count - 1], newLine[newLine.PartCount - 1][newLine[newLine.PartCount - 1].Count - 1]); + value[2] = getDistance(line[0][0], newLine[0][0]); + value[3] = getDistance(line[0][0], newLine[newLine.PartCount - 1][newLine[newLine.PartCount - 1].Count - 1]); + double minValue = value[0]; + for (int m = 1; m < value.Length; m++) + { + if (minValue > value[m]) + { + minValue = value[m]; + minValueIndex = m; + } + } + if (minValue < limitValue) + { + isConnect = true; + if (minValueIndex > 1) + { + valueCount[1]++; + } + else + { + valueCount[0]++; + } + } + } + } + if (!isConnect || valueCount[0] > 1 || valueCount[1] > 1) + { + MessageBox.Show("请选择相连接的一条线上的管线!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); + return null; + } + } + } + //2 记录每一条相连接的管线的起点和终点,并添加到一条管线中 + for (int p = 0; p < selectFeatures.Length; p++) + { + GSOGeoPolyline3D line = selectFeatures[p].Geometry as GSOGeoPolyline3D; + if (line != null && line.PartCount > 0) + { + for (int n = 0; n < selectFeatures.Length; n++) + { + if (p == n) + { + continue; + } + GSOGeoPolyline3D newLine = selectFeatures[n].Geometry as GSOGeoPolyline3D; + if (newLine != null && newLine.PartCount > 0) + { + int minValueIndex = 0; + double limitValue = 1.0; + double[] value = new double[4]; + value[0] = getDistance(line[line.PartCount - 1][line[line.PartCount - 1].Count - 1], newLine[0][0]); + value[1] = getDistance(line[line.PartCount - 1][line[line.PartCount - 1].Count - 1], newLine[newLine.PartCount - 1][newLine[newLine.PartCount - 1].Count - 1]); + value[2] = getDistance(line[0][0], newLine[0][0]); + value[3] = getDistance(line[0][0], newLine[newLine.PartCount - 1][newLine[newLine.PartCount - 1].Count - 1]); + double minValue = value[0]; + for (int m = 1; m < value.Length; m++) + { + if (minValue > value[m]) + { + minValue = value[m]; + minValueIndex = m; + } + } + if (minValue < limitValue) + { + GSOFeature featureFromAllSelectedObj = new GSOFeature(); + GSOGeoPolyline3D lineFromAllSelectedObj = new GSOGeoPolyline3D(); + switch (minValueIndex) + { + case 0: + GSOPoint3ds linePart = new GSOPoint3ds(); + for (int i = 0; i < line.PartCount; i++) + { + for (int j = 0; j < line[i].Count; j++) + { + linePart.Add(line[i][j]); + } + } + for (int i = 0; i < newLine.PartCount; i++) + { + for (int j = 0; j < newLine[i].Count; j++) + { + linePart.Add(newLine[i][j]); + } + } + lineFromAllSelectedObj.AddPart(linePart); + break; + case 1: + linePart = new GSOPoint3ds(); + for (int i = 0; i < line.PartCount; i++) + { + for (int j = 0; j < line[i].Count; j++) + { + linePart.Add(line[i][j]); + } + } + for (int i = newLine.PartCount - 1; i >= 0; i--) + { + for (int j = newLine[i].Count - 1; j >= 0; j--) + { + linePart.Add(newLine[i][j]); + } + } + lineFromAllSelectedObj.AddPart(linePart); + break; + case 2: + linePart = new GSOPoint3ds(); + for (int i = line.PartCount - 1; i >= 0; i--) + { + for (int j = line[i].Count - 1; j >= 0; j--) + { + linePart.Add(line[i][j]); + } + } + for (int i = 0; i < newLine.PartCount; i++) + { + for (int j = 0; j < newLine[i].Count; j++) + { + linePart.Add(newLine[i][j]); + } + } + lineFromAllSelectedObj.AddPart(linePart); + break; + case 3: + linePart = new GSOPoint3ds(); + for (int i = line.PartCount - 1; i >= 0; i--) + { + for (int j = line[i].Count - 1; j >= 0; j--) + { + linePart.Add(line[i][j]); + } + } + for (int i = newLine.PartCount - 1; i >= 0; i--) + { + for (int j = newLine[i].Count - 1; j >= 0; j--) + { + linePart.Add(newLine[i][j]); + } + } + lineFromAllSelectedObj.AddPart(linePart); + break; + } + + featureFromAllSelectedObj.Geometry = lineFromAllSelectedObj; + + selectFeatures.Remove(n); + selectFeatures.Remove(p); + selectFeatures.Add(featureFromAllSelectedObj); + p--; + break; + } + } + } + } + } + + for (int h = 0; h < selectFeatures.Length; h++) + { + result.Add(selectFeatures[h]); + } + return result; + } + + private static double getDistance(GSOPoint3d point1, GSOPoint3d point2) + { + GSOGeoPolyline3D lineline = new GSOGeoPolyline3D(); + GSOPoint3ds point3ds = new GSOPoint3ds(); + point3ds.Add(point1); + point3ds.Add(point2); + lineline.AddPart(point3ds); + + double distance = lineline.GetSpaceLength(true, 6378137.0); + return distance; + } + + + + } +} \ No newline at end of file diff --git a/obj/x64/Debug/Cyberpipe.FrmHDMAnalysis3.resources b/obj/x64/Debug/Cyberpipe.FrmHDMAnalysis3.resources index 6c05a97..3c2db6a 100644 --- a/obj/x64/Debug/Cyberpipe.FrmHDMAnalysis3.resources +++ b/obj/x64/Debug/Cyberpipe.FrmHDMAnalysis3.resources Binary files differ diff --git a/Cyberpipe.csproj b/Cyberpipe.csproj index d24ccfc..cd0296f 100644 --- a/Cyberpipe.csproj +++ b/Cyberpipe.csproj @@ -228,6 +228,7 @@ F_GKT1添加项目.cs + @@ -938,12 +939,6 @@ FrmRESCMgr.cs - - Form - - - FrmRoadHDM.cs - Form @@ -1166,6 +1161,7 @@ + @@ -1611,10 +1607,6 @@ FrmRESCMgr.cs Designer - - FrmRoadHDM.cs - Designer - FrmRole.cs Designer diff --git a/EnumEventMode.cs b/EnumEventMode.cs new file mode 100644 index 0000000..b5eba59 --- /dev/null +++ b/EnumEventMode.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace Cyberpipe +{ + //横断面分析、基线剖面分析、道路断面分析 + public enum EnumTrackPolylineEndMode + { + Default_Analysis = 0, //无分析 + HDM_Analysis = 1, //横断面分析 + DLDM_Analysis = 2,//道路断面分析 + JXPM_Analysis = 3, //基线剖面分析 + } + + class EnumEventMode + { + } +} diff --git a/FrmHDMAnalysis3.cs b/FrmHDMAnalysis3.cs index 5e5988c..6405ed7 100644 --- a/FrmHDMAnalysis3.cs +++ b/FrmHDMAnalysis3.cs @@ -16,206 +16,72 @@ { public partial class FrmHDMAnalysis3 : DevComponents.DotNetBar.Office2007Form { - private ArrayList listPoint = new ArrayList(); - private ArrayList listFeat = new ArrayList(); - GSOGeoPolyline3D line = new GSOGeoPolyline3D(); //创建线对象 - - private static FrmHDMAnalysis3 allPipelineAnalysis = null; - public bool isShowFirst = false; - - static ArrayList list = new ArrayList(); + static DataTable table = new DataTable(); - static DataTable showTable = new DataTable(); GSOGlobeControl globeControl1; - object[,] sortIndex; - GSOLayer layerTemp; - private FrmHDMAnalysis3() - { - - } - public static FrmHDMAnalysis3 GetForm(ArrayList arraylistP, ArrayList arraylistF, GSOGeoPolyline3D _line, GSOGlobeControl _ctl) - { - if (allPipelineAnalysis == null) - { - allPipelineAnalysis = new FrmHDMAnalysis3(arraylistP, arraylistF, _line,_ctl); - } - else - { - allPipelineAnalysis.listPoint = arraylistP; - allPipelineAnalysis.listFeat = arraylistF; - allPipelineAnalysis.line = _line; - allPipelineAnalysis.globeControl1 = _ctl; - list = new ArrayList(); - } - return allPipelineAnalysis; - } + EnumTrackPolylineEndMode mode; - public FrmHDMAnalysis3(ArrayList arraylistP, ArrayList arraylistF, GSOGeoPolyline3D _line,GSOGlobeControl _ctl) + Dictionary hdmDic; + + public FrmHDMAnalysis3(Dictionary hdmDic, + GSOGlobeControl globeControl, EnumTrackPolylineEndMode mode) { InitializeComponent(); - this.listPoint = arraylistP; - this.listFeat = arraylistF; - line = _line; - globeControl1 = _ctl; + + this.hdmDic = hdmDic; + this.globeControl1 = globeControl; + this.mode = mode; } - double A_x, A_y, B_x, B_y;//定义坐标点,用来就横断面的长度 - /// - /// 窗体初始化事件处理 - /// - /// - /// - private void Frm_HDMAnalysis_Load(object sender, EventArgs e) + + private void initControls() { - layerTemp = globeControl1.Globe.Layers.Add(Application.StartupPath + "\\tempLgdExport.lgd"); - //chart1.ChartAreas[0].BackImage = Application.StartupPath + "\\Resource\\pipelineBackGround副本.png"; - } - /// - /// 窗体第一次显示事件处理 - /// - /// - /// - void Frm_HDMAnalysis2_Shown(object sender, EventArgs e) - { - isShowFirst = true; - - } - public void LoadChartEvent() - { - try - { - this.Shown += new EventHandler(Frm_HDMAnalysis2_Shown); - - chart1.Series["管线"].ChartType = SeriesChartType.Point; - - chart1.Series["管线"]["DrawingStyle"] = "Cylinder"; - chart1.Series["管线"].MarkerStyle = MarkerStyle.Circle; //点的类型 - - chart1.Series["管线"].MarkerBorderColor = Color.Black; //点的边框颜色 - chart1.ChartAreas[0].AxisX.Minimum = 0; //x轴的起始点大小 - chart1.ChartAreas[0].AxisY.Maximum = 0; //y轴的最大值 - - chart1.ChartAreas[0].AxisX.Title = "距离 (米)"; - chart1.ChartAreas[0].AxisY.Title = "埋深 (米)"; - - //chart1.ChartAreas[0].AxisX.ScrollBar.Enabled = true; - chart1.ChartAreas[0].AxisY2.Title = "高程 (米)"; - double[] depths = new double[listFeat.Count]; - for (int i = 0; i < listFeat.Count; i++) - { - GSOFeature f = listFeat[i] as GSOFeature; - double depth = f.GetFieldAsDouble("起始地面高程"); - depths[i] = depth; - } - double max_Depth = depths[0]; - for (int i = 0; i < listFeat.Count; i++) - { - if (max_Depth < depths[i]) - { - max_Depth = depths[i]; - } - } - chart1.ChartAreas[0].AxisY2.CustomLabels.Clear(); - chart1.ChartAreas[0].AxisY2.CustomLabels.Add(-5.4d, -5.6d, (max_Depth - 5.5).ToString("0.0")); - chart1.ChartAreas[0].AxisY2.CustomLabels.Add(-4.9d, -5.1d, (max_Depth - 5).ToString("0.0")); - chart1.ChartAreas[0].AxisY2.CustomLabels.Add(-4.4d, -4.6d, (max_Depth - 4.5).ToString("0.0")); - chart1.ChartAreas[0].AxisY2.CustomLabels.Add(-3.9d, -4.1d, (max_Depth - 4).ToString("0.0")); - chart1.ChartAreas[0].AxisY2.CustomLabels.Add(-3.4d, -3.6d, (max_Depth - 3.5).ToString("0.0")); - chart1.ChartAreas[0].AxisY2.CustomLabels.Add(-2.9d, -3.1d, (max_Depth - 3).ToString("0.0")); - chart1.ChartAreas[0].AxisY2.CustomLabels.Add(-2.4d, -2.6d, (max_Depth - 2.5).ToString("0.0")); - chart1.ChartAreas[0].AxisY2.CustomLabels.Add(-1.9d, -2.1d, (max_Depth - 2).ToString("0.0")); - chart1.ChartAreas[0].AxisY2.CustomLabels.Add(-1.4d, -1.6d, (max_Depth - 1.5).ToString("0.0")); - chart1.ChartAreas[0].AxisY2.CustomLabels.Add(-0.9d, -1.1d, (max_Depth - 1).ToString("0.0")); - chart1.ChartAreas[0].AxisY2.CustomLabels.Add(-0.4d, -0.6d, (max_Depth - 0.5).ToString("0.0")); - chart1.ChartAreas[0].AxisY2.CustomLabels.Add(-0.1d, 0.1d, max_Depth.ToString("0.0")); - - if (line.PartCount > 0) - { - GSOPoint3ds nodes = line[0]; - if (nodes.Count > 0) - { - GSOPoint3d node = nodes[0]; - A_x = node.X; - A_y = node.Y; - } - } - - DrawCurveGraph(A_x, A_y); - } - catch (Exception ex) - { - LogError.PublishError(ex); - } - } - - /// - /// 创建图表 - /// - /// - /// - private void DrawCurveGraph(double a_x,double a_y) - { - // 遍历线,求距离 - table = new DataTable(); - //showTable.Columns.Clear(); - list.Clear(); + chart1.Series["管线"].ChartType = SeriesChartType.Point; + chart1.Series["管线"]["DrawingStyle"] = "Cylinder"; + chart1.Series["管线"].MarkerStyle = MarkerStyle.Circle; //点的类型 + chart1.Series["管线"].MarkerBorderColor = Color.Black; //点的边框颜色 + //chart1.ChartAreas[0].AxisX.Minimum = 0; //x轴的起始点大小 + chart1.ChartAreas[0].AxisY.Maximum = 0; //y轴的最大值 + chart1.ChartAreas[0].AxisX.Title = "距离 (米)"; + chart1.ChartAreas[0].AxisY.Title = "埋深 (米)"; + chart1.ChartAreas[0].AxisY2.Title = "高程 (米)"; chart1.Series["管线"].Points.Clear(); - chart1.ChartAreas[0].AxisX.Maximum = Math.Round(line.GetSpaceLength(true, 6378137),2); + //chart1.ChartAreas[0].AxisX.Maximum = Math.Round(line.GetSpaceLength(true, 6378137), 2); + table.Columns.Add("编号", typeof(string)); table.Columns.Add("管线类型", typeof(string)); table.Columns.Add("管线编码", typeof(string)); table.Columns.Add("管径_毫米", typeof(string)); table.Columns.Add("材质", typeof(string)); - table.Columns.Add("管线埋深", typeof(string)); + table.Columns.Add("管线埋深", typeof(string)); - sortIndex = new object[listPoint.Count, 2]; - for (int i = 0; i <= listPoint.Count; i++) + if (mode == EnumTrackPolylineEndMode.DLDM_Analysis) { - if (i == listPoint.Count) - { - double maxNum = 0.0; - for (int j = 0; j < listPoint.Count; j++) - { - if (maxNum < Convert.ToDouble(sortIndex[j, 0])) - { - maxNum = Convert.ToDouble(sortIndex[j, 0]); - } - } - chart1.Series["管线"].Points.AddXY(maxNum + 2, 0); - chart1.Series["管线"].Points[i].MarkerBorderWidth = 100; //边框的宽度 - chart1.Series["管线"].Points[i].MarkerColor = Color.Black; - chart1.Series["管线"].Points[i].MarkerSize = 100; - continue; - } - GSOPoint3d geoPoint = (GSOPoint3d)listPoint[i]; - GSOFeature feature = listFeat[i] as GSOFeature; - //坐标投影 - int id = GeoScene.Data.GSOProjectManager.AddProject(Utility.projectStr); + this.pictureBox1.Visible = true; + } + else + { + this.pictureBox1.Visible = false; + } + } - GeoScene.Data.GSOPoint2d a_Point = GeoScene.Data.GSOProjectManager.Forward(new GSOPoint2d(a_x, a_y), id);//user画的线的起始点 + private void draw() + { + int i = 0; + foreach (KeyValuePair kvp in this.hdmDic) + { + GSOFeature feature = kvp.Key; + HDMCoordinate coor = kvp.Value; - GeoScene.Data.GSOPoint2d pt2d = new GeoScene.Data.GSOPoint2d(geoPoint.X, geoPoint.Y); - GeoScene.Data.GSOPoint2d result = GeoScene.Data.GSOProjectManager.Forward(pt2d, id); - B_x = result.X; - B_y = result.Y; + chart1.Series["管线"].Points.AddXY(coor.Dis, coor.Z);//绑定数据 - double x = System.Math.Abs(B_x - a_Point.X); - double y = System.Math.Abs(B_y - a_Point.Y); - double Dis = 0.0; - Dis = Math.Round(Math.Sqrt(x * x + y * y) , 2); - list.Add(geoPoint.Z); - sortIndex[i, 0] = Dis; - sortIndex[i, 1] = i; - - chart1.Series["管线"].Points.AddXY(Dis, geoPoint.Z);//绑定数据 - - string pipeType = feature.Dataset == null ? "" : feature.Dataset.Caption; + string pipeType = feature.Dataset == null ? "" : feature.Dataset.Caption; string number = Convert.ToString(i + 1); - string material = feature.GetFieldAsString("材质"); string diameter = feature.GetFieldAsString("管径_毫米"); - table.Rows.Add(new object[] { number, pipeType, feature.Name.ToString(), diameter, material,Convert.ToDecimal(list[i].ToString()).ToString("f2")});//list[i].ToString().Substring(0,list[i].ToString().IndexOf('.')+3) } - - //chart1.Series["管线"].Points[i].Label = number;//管线的标签 + table.Rows.Add(new object[] { number, + pipeType, feature.Name.ToString(), + diameter, material, + Convert.ToDecimal(coor.Z).ToString("f2") }); chart1.Series["管线"].Points[i].LegendText = number; if (feature.Geometry.Style.GetType() == typeof(GSOPipeLineStyle3D)) { @@ -229,47 +95,12 @@ chart1.Series["管线"].Points[i].MarkerBorderWidth = 3; //边框的宽度 chart1.Series["管线"].Points[i].MarkerColor = Color.Transparent; - chart1.Series["管线"].Points[i].MarkerSize = Convert.ToInt32(Math.Floor((feature.GetFieldAsDouble("管径_毫米") / 0.35 + chart1.Series["管线"].Points[i].MarkerBorderWidth) / 100.0));//点的大小 - + chart1.Series["管线"].Points[i].MarkerSize = Convert.ToInt32(Math.Floor((feature.GetFieldAsDouble("管径_毫米") / 0.35 + + chart1.Series["管线"].Points[i].MarkerBorderWidth) / 100.0)); + i++; } - - string htmlCode = "" + - "" + - "" + - "
管线类型管线编码管径_毫米材质管线埋深
" + - "" + - "" + - "" + - "" + - "
"; - webBrowser1.DocumentText = htmlCode; } + /// /// 图表的鼠标单击事件处理 /// @@ -286,14 +117,11 @@ return; } string number = p.LegendText; - //MessageBox.Show(number); int indexInTableRows = 0; bool isInt = int.TryParse(number, out indexInTableRows); if (isInt) { DataRow row = table.Rows[indexInTableRows - 1]; - //showTable.Rows.Clear(); - //showTable.Rows.Add(new object[] { row[0], row[1], row[2], row[3], row[4], row[5] }); string htmlCode = "" + - "" + - "" + - "
管线类型管线编码管径_毫米材质管线埋深
" + - "" + - "" + - "" + - "" + - "
"; - webBrowser1.DocumentText = htmlCode; - - - } - /// - /// 图表鼠标单击事件处理 - /// - /// - /// - private void chart1_MouseClick(object sender, MouseEventArgs e) - { - HitTestResult result = chart1.HitTest(e.X, e.Y, true); - if (result.PointIndex >= 0) - { - DataPoint p = (DataPoint)result.Object; - if (p == null) - { - return; - } - string number = p.LegendText; - int indexInTableRows = 0; - bool isInt = int.TryParse(number, out indexInTableRows); - if (isInt) - { - DataRow row = table.Rows[indexInTableRows - 1]; - string htmlCode = "" + - "" + - "" + - "
管线类型管线编码管径_毫米材质管线埋深
" + row[1] + - "" + row[2] + - "" + row[3] + - "" + row[4] + - "" + row[5] + - "
"; - webBrowser1.DocumentText = htmlCode; - } - } - } - /// - /// 窗体关闭事件处理 - /// - /// - /// - private void FrmRoadHDM_FormClosing(object sender, FormClosingEventArgs e) - { - allPipelineAnalysis = null; - globeControl1.Globe.MemoryLayer.RemoveAllFeature(); - } - /// - /// 图表鼠标移动事件处理 - /// - /// - /// - private void chart1_MouseMove(object sender, MouseEventArgs e) - { - HitTestResult result = chart1.HitTest(e.X, e.Y, true); - if (result.PointIndex >= 0) - { - this.Cursor = Cursors.Hand; - } - else - { - this.Cursor = Cursors.Default; - } - } - - private void Export(GSOPoint3d _pnt, double r) - { - GSOPoint3ds pnts = new GSOPoint3ds(); - GSOPoint3d pnt = new GSOPoint3d(); - pnt.X = _pnt.X; - pnt.Y = _pnt.Y; - pnt.Z = _pnt.Z; - pnts.Add(pnt); - pnt.X = _pnt.X; - pnt.Y = _pnt.Y - 0.0000000005; - pnt.Z = _pnt.Z; - pnts.Add(pnt); - GSOGeoPolyline3D line = new GSOGeoPolyline3D(); - line.AddPart(pnts); - GSOGeoPolygon3D polygon = line.CreateBuffer(r * 2, true, 5, true, false); - GSOPoint3ds points = polygon[0]; - GSOGeoPolyline3D newLine = new GSOGeoPolyline3D(); - newLine.AddPart(points); - newLine.AltitudeMode = EnumAltitudeMode.RelativeToGround; - GSOFeature newFeature = new GSOFeature(); - newFeature.Geometry = newLine; - globeControl1.Globe.MemoryLayer.AddFeature(newFeature); - } - - private void ExportCAD(double a, double b, double r) - { - GSOPoint3ds pnts = new GSOPoint3ds(); - for (int i = 0; i <= 64; i++) - { - double x = a + r * Math.Cos(i * 5.625 * Math.PI / 180); - double y = b - r * Math.Sin(i * 5.625 * Math.PI / 180); - GSOPoint2d pt2d = new GeoScene.Data.GSOPoint2d(x, y); - GSOPoint3d pnt = new GSOPoint3d(); - pnt.X = pt2d.X; - pnt.Y = pt2d.Y; - pnt.Z = 0; - pnts.Add(pnt); - } - GSOGeoPolyline3D line = new GSOGeoPolyline3D(); - line.AddPart(pnts); - GSOFeature f = new GSOFeature(); - f.Geometry = line; - f.Geometry.LatLonCoord = false; - f.Visible = false; - layerTemp.AddFeature(f); - } - /// - /// 导出CAD按钮事件处理 - /// - /// - /// - private void btnExportCAD_Click(object sender, EventArgs e) - { - layerTemp.RemoveAllFeature(); - for (int i = 0; i < listPoint.Count; i++) - { - GSOPoint3d geoPoint = (GSOPoint3d)listPoint[i]; - GSOFeature feature = listFeat[i] as GSOFeature; - if (feature != null) - { - if (feature.Geometry.Type == EnumGeometryType.GeoPolyline3D) - { - GSOPipeLineStyle3D style = feature.Geometry.Style as GSOPipeLineStyle3D; - double r = style.Radius; - ExportCAD(double.Parse(sortIndex[i, 0].ToString()), geoPoint.Z, r); - } - } - } - layerTemp.Dataset.ImportProjectionRefFromProj4(""); - SaveFileDialog dlg = new SaveFileDialog(); - dlg.Filter = "*.dxf|*.dxf"; - if (dlg.ShowDialog() == DialogResult.OK) - { - layerTemp.SaveAs(dlg.FileName); - MessageBox.Show("导出CAD完成!", "提示"); - } - layerTemp.RemoveAllFeature(); - } - } -} diff --git a/FrmRoadHDM.designer.cs b/FrmRoadHDM.designer.cs deleted file mode 100644 index 23a4c3b..0000000 --- a/FrmRoadHDM.designer.cs +++ /dev/null @@ -1,132 +0,0 @@ -namespace Cyberpipe -{ - partial class FrmRoadHDM - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmRoadHDM)); - System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea1 = new System.Windows.Forms.DataVisualization.Charting.ChartArea(); - System.Windows.Forms.DataVisualization.Charting.Series series1 = new System.Windows.Forms.DataVisualization.Charting.Series(); - this.pictureBox1 = new System.Windows.Forms.PictureBox(); - this.webBrowser1 = new System.Windows.Forms.WebBrowser(); - this.chart1 = new System.Windows.Forms.DataVisualization.Charting.Chart(); - this.btnExportCAD = new DevComponents.DotNetBar.ButtonX(); - ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.chart1)).BeginInit(); - this.SuspendLayout(); - // - // pictureBox1 - // - this.pictureBox1.BackColor = System.Drawing.Color.White; - this.pictureBox1.Dock = System.Windows.Forms.DockStyle.Top; - this.pictureBox1.ErrorImage = null; - this.pictureBox1.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image"))); - this.pictureBox1.ImageLocation = ""; - this.pictureBox1.Location = new System.Drawing.Point(0, 0); - this.pictureBox1.Name = "pictureBox1"; - this.pictureBox1.Size = new System.Drawing.Size(608, 64); - this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; - this.pictureBox1.TabIndex = 1; - this.pictureBox1.TabStop = false; - // - // webBrowser1 - // - this.webBrowser1.Dock = System.Windows.Forms.DockStyle.Bottom; - this.webBrowser1.Location = new System.Drawing.Point(0, 326); - this.webBrowser1.MinimumSize = new System.Drawing.Size(20, 20); - this.webBrowser1.Name = "webBrowser1"; - this.webBrowser1.ScrollBarsEnabled = false; - this.webBrowser1.Size = new System.Drawing.Size(608, 139); - this.webBrowser1.TabIndex = 3; - // - // chart1 - // - chartArea1.AxisX.MajorGrid.Enabled = false; - chartArea1.Name = "ChartArea1"; - this.chart1.ChartAreas.Add(chartArea1); - this.chart1.Location = new System.Drawing.Point(0, 66); - this.chart1.Name = "chart1"; - this.chart1.RightToLeft = System.Windows.Forms.RightToLeft.Yes; - series1.ChartArea = "ChartArea1"; - series1.Name = "管线"; - this.chart1.Series.Add(series1); - this.chart1.Size = new System.Drawing.Size(608, 254); - this.chart1.TabIndex = 2; - this.chart1.Text = "chart1"; - this.chart1.MouseClick += new System.Windows.Forms.MouseEventHandler(this.chart1_MouseClick); - this.chart1.MouseMove += new System.Windows.Forms.MouseEventHandler(this.chart1_MouseMove); - // - // btnExportCAD - // - this.btnExportCAD.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; - this.btnExportCAD.Anchor = System.Windows.Forms.AnchorStyles.Bottom; - this.btnExportCAD.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground; - this.btnExportCAD.Location = new System.Drawing.Point(268, 430); - this.btnExportCAD.Name = "btnExportCAD"; - this.btnExportCAD.Size = new System.Drawing.Size(75, 23); - this.btnExportCAD.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; - this.btnExportCAD.TabIndex = 4; - this.btnExportCAD.Text = "导出CAD"; - this.btnExportCAD.Click += new System.EventHandler(this.btnExportCAD_Click); - // - // FrmRoadHDM - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.BackColor = System.Drawing.Color.White; - this.ClientSize = new System.Drawing.Size(608, 465); - this.Controls.Add(this.btnExportCAD); - this.Controls.Add(this.chart1); - this.Controls.Add(this.webBrowser1); - this.Controls.Add(this.pictureBox1); - this.DoubleBuffered = true; - this.EnableGlass = false; - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; - this.MaximizeBox = false; - this.Name = "FrmRoadHDM"; - this.ShowIcon = false; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; - this.Text = "道路与管线综合横断面"; - this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FrmRoadHDM_FormClosing); - this.Load += new System.EventHandler(this.FrmRoadHDM_Load); - this.Shown += new System.EventHandler(this.FrmRoadHDM_Shown); - ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.chart1)).EndInit(); - this.ResumeLayout(false); - - } - - #endregion - - private System.Windows.Forms.PictureBox pictureBox1; - private System.Windows.Forms.WebBrowser webBrowser1; - private System.Windows.Forms.DataVisualization.Charting.Chart chart1; - private DevComponents.DotNetBar.ButtonX btnExportCAD; - - - } -} \ No newline at end of file diff --git a/FrmRoadHDM.resx b/FrmRoadHDM.resx deleted file mode 100644 index 5202d5f..0000000 --- a/FrmRoadHDM.resx +++ /dev/null @@ -1,177 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - - - 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 - iNKUe3NRsLcAAAAASUVORK5CYII= - - - \ No newline at end of file diff --git a/MainFrm.cs b/MainFrm.cs index e9b6cbe..2df3aac 100644 --- a/MainFrm.cs +++ b/MainFrm.cs @@ -75,15 +75,6 @@ private string trackflag;//定义阀门查询个数 - private GSOFeature m_ConnexityAnalysisFirstFeature; - private GSOFeature m_ConnexityAnaylsisSecondFeature; - private GSOLayer m_ConnexityAnalysisFirstLayer; - private GSOLayer m_COnnexityAnalysisSecondLayer; - private GSOFeatures m_ConnexityAnalyResFeatures; - private GSOFeatures m_TraceUpDownAnalyResFeatures; - private GSOFeatures m_AffectedPipeLines; - private GSOFeatures m_CloseValvesAnalyResFeatures; - private GSOFeatures m_BoosterValvesAnalyResFeatures; //管线间距分析 private GSOFeature disFeature = new GSOFeature(); private GSOFeature featureDis = new GSOFeature(); @@ -2656,8 +2647,37 @@ ///
/// /// + private static EnumTrackPolylineEndMode trackPolylineEndMode; + void globeControl1_TrackPolylineEndEvent(object sender, TrackPolylineEndEventArgs e) { + //横断面分析、道路横断面分析 + if (trackPolylineEndMode == EnumTrackPolylineEndMode.HDM_Analysis|| + trackPolylineEndMode == EnumTrackPolylineEndMode.DLDM_Analysis) + { + Dictionary hdmDic = SectionAnalysisTool.HDMAnalysis(this.globeControl1, + e.Polyline, this.m_PipelineLayerNames); + FrmHDMAnalysis3 frm = new FrmHDMAnalysis3(hdmDic, this.globeControl1, + trackPolylineEndMode); + frm.Show(this); + } + //基线剖面分析 + else if (trackPolylineEndMode == EnumTrackPolylineEndMode.JXPM_Analysis) + { + FrmBaseLineProfillAnalysis dlg = new FrmBaseLineProfillAnalysis(globeControl1.Globe, e.Polyline); + dlg.Show(this); + globeControl1.Globe.ClearLastTrackPolyline(); + /* + FrmRoadHDM f = new FrmRoadHDM(); + f.Show() + * **/ + } + else + { + + } + trackPolylineEndMode = EnumTrackPolylineEndMode.Default_Analysis; + /* ArrayList arraylistPoint = new ArrayList(); ArrayList arraylistLine = new ArrayList(); @@ -2835,6 +2855,7 @@ } globeControl1.Globe.Action = EnumAction3D.ActionNull; ActionToolMenuChecked(); + * **/ } #endregion @@ -4962,10 +4983,10 @@ if (globeControl1.Globe.Action != EnumAction3D.NormalHit) { buttonItemFX3_6.Checked = false; - ClearConnexityAnalysis(); + // ClearConnexityAnalysis(); buttonItemFX3_5.Checked = false; - ClearCloseValvesAnalysis(); + // ClearCloseValvesAnalysis(); } if (globeControl1.Globe.Action != EnumAction3D.TrackPolygon) { @@ -4973,131 +4994,7 @@ buttonItemFX4_1.Checked = false; } } - /// - /// 连通性分析 功能 - /// - private void ConnexityAnalysis() - { - GSODataset curCAYDataset = m_ConnexityAnalysisFirstLayer.Dataset; - string srName = curCAYDataset.Name; - GSONetworkDataset curCAYNDataset = curCAYDataset.DataSource.GetDatasetByName(srName + "Network") as GSONetworkDataset; - if (curCAYNDataset == null) - { - MessageBox.Show("该图层没有创建网络拓扑,请先创建网络拓扑信息再进行分析!", "提示"); - return; - } - int[] arryResID; - curCAYNDataset.ConnexityAnalysis(m_ConnexityAnalysisFirstFeature.ID, m_ConnexityAnaylsisSecondFeature.ID, out arryResID, false, true); - m_ConnexityAnalyResFeatures = m_ConnexityAnalysisFirstLayer.GetFeaturesByIDs(arryResID); - if (m_ConnexityAnalyResFeatures == null || m_ConnexityAnalyResFeatures.Length < 1) - { - String strLine1 = "管线:" + m_ConnexityAnalysisFirstFeature.ID; - String strLine2 = "管线:" + m_ConnexityAnaylsisSecondFeature.ID; - MessageBox.Show(strLine1 + " 与 " + strLine2 + " 不连通", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); - } - else - { - int nCount = m_ConnexityAnalyResFeatures.Length; - for (int i = 0; i < nCount; i++) - { - m_ConnexityAnalyResFeatures[i].HighLight = true; - GSOGeoPolyline3D geoline = m_ConnexityAnalyResFeatures[i].Geometry as GSOGeoPolyline3D; - if (geoline != null) - { - GSOLineStyle3D lineStyle = geoline.Style as GSOLineStyle3D; - if (lineStyle != null) - { - if (lineStyle.ArrowStyle == null) - { - lineStyle.ArrowStyle = new GSOArrowStyle(); - - } - lineStyle.ArrowStyle.BodyLen = 8; - lineStyle.ArrowVisible = true; - lineStyle.ArrowStyle.Play(); - } - } - } - globeControl1.Refresh(); - } - } - /// - /// 清除连通性分析结果 功能 - /// - private void ClearConnexityAnalysis() - { - if (m_ConnexityAnalysisFirstFeature != null) - { - m_ConnexityAnalysisFirstFeature.HighLight = false; - m_ConnexityAnalysisFirstFeature.Label = null; - } - if (m_ConnexityAnaylsisSecondFeature != null) - { - m_ConnexityAnaylsisSecondFeature.HighLight = false; - m_ConnexityAnaylsisSecondFeature.Label = null; - } - - m_ConnexityAnalysisFirstFeature = null; - m_ConnexityAnaylsisSecondFeature = null; - m_ConnexityAnalysisFirstLayer = null; - m_COnnexityAnalysisSecondLayer = null; - - if (m_ConnexityAnalyResFeatures != null) - { - int nCount = m_ConnexityAnalyResFeatures.Length; - - for (int i = 0; i < nCount; i++) - { - m_ConnexityAnalyResFeatures[i].HighLight = false; - GSOGeoPolyline3D geoline = m_ConnexityAnalyResFeatures[i].Geometry as GSOGeoPolyline3D; - if (geoline != null) - { - GSOLineStyle3D lineStyle = geoline.Style as GSOLineStyle3D; - if (lineStyle != null) - { - lineStyle.ArrowVisible = false; - } - } - } - m_ConnexityAnalyResFeatures = null; - - } - } - /// - /// 清除阀门分析结果 功能 - /// - private void ClearCloseValvesAnalysis() - { - if (m_CloseValvesAnalyResFeatures != null) - { - for (int i = 0; i < m_CloseValvesList.Count; i++) - { - GSOFeature feature = m_CloseValvesList[i] as GSOFeature; - feature.Label.Text = ""; - } - globeControl1.Refresh(); - m_CloseValvesAnalyResFeatures = null; - m_CloseValvesList = new ArrayList(); - } - } - /// - /// 清除阀门分析结果 功能 - /// - private void ClearBoosterValvesAnalysis() - { - if (m_BoosterValvesAnalyResFeatures != null) - { - for (int i = 0; i < m_BoosterValvesList.Count; i++) - { - GSOFeature feature = m_BoosterValvesList[i] as GSOFeature; - feature.Label.Text = ""; - } - globeControl1.Refresh(); - m_BoosterValvesAnalyResFeatures = null; - m_BoosterValvesList = new ArrayList(); - } - } /// /// 主窗体关闭事件处理 /// @@ -5118,211 +5015,7 @@ //注销id号为103的热键设定 // UnregisterHotKey(Handle, 103); } - /// - /// 清除追踪结果 功能 : Fan 可去掉了! - /// - private void ClearUpDownTraceAnalysis() - { - if (m_TraceUpDownAnalyResFeatures != null) - { - int nCount = m_TraceUpDownAnalyResFeatures.Length; - for (int i = 0; i < nCount; i++) - { - m_TraceUpDownAnalyResFeatures[i].HighLight = false; - GSOGeoPolyline3D geoline = m_TraceUpDownAnalyResFeatures[i].Geometry as GSOGeoPolyline3D; - if (geoline != null) - { - GSOLineStyle3D lineStyle = geoline.Style as GSOLineStyle3D; - if (lineStyle != null) - { - lineStyle.ArrowVisible = false; - } - } - } - m_TraceUpDownAnalyResFeatures = null; - } - } - /// - /// 取消所有高亮管线的高亮状态 - /// - private void ClearAffectedPipeLine() - { - if (m_AffectedPipeLines != null) - { - int nCount = m_AffectedPipeLines.Length; - for (int i = 0; i < nCount; i++) - { - m_AffectedPipeLines[i].HighLight = false; - } - m_AffectedPipeLines = null; - } - } - #region Fan 拓扑分析 - /// - /// 上下游追踪 功能 - /// - /// - private void NetworkTraceUpDown(Boolean bTraceUp) - { - GSOFeature selLineFeature = globeControl1.Globe.SelectedObject; - if (selLineFeature == null || selLineFeature.Geometry == null || selLineFeature.Geometry.Type != EnumGeometryType.GeoPolyline3D) - { - MessageBox.Show("请点击“编辑”—“选中对象”选择一条线!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); - return; - } - GSOLayer selLayer = globeControl1.Globe.SelectedObjectLayer; - - NetworkAnalysisTool.TraceUpDownAnalysis(bTraceUp, - selLineFeature, selLayer); - /* - if (globeControl1.Globe.SelectedObject == null) - { - MessageBox.Show("请点击“编辑”—“选中对象”选择一条线!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); - return; - } - GSOFeature selLineFeature = globeControl1.Globe.SelectedObject; - - if (selLineFeature.Geometry == null || selLineFeature.Geometry.Type != EnumGeometryType.GeoPolyline3D) - { - MessageBox.Show("请点击“编辑”—“选中对象”选择一条线!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); - return; - } - - if (globeControl1.Globe.SelectedObjectLayer == null) - { - MessageBox.Show("选中管线所在图层为空!", "提示"); - return; - } - - GSODataset curCAYDataset = globeControl1.Globe.SelectedObjectLayer.Dataset; - if (curCAYDataset == null || curCAYDataset.DataSource == null) - { - MessageBox.Show("选中管线所在图层不是数据库图层!", "提示"); - return; - } - - string srName = curCAYDataset.Name; - GSONetworkDataset curCAYNDataset = curCAYDataset.DataSource.GetDatasetByName(srName + "Network") as GSONetworkDataset; - - if (curCAYNDataset == null) - { - MessageBox.Show("选中管线所在图层没有创建拓扑!", "提示"); - return; - } - - int[] arryResID; - curCAYNDataset.TraceUpDownAnalysis(selLineFeature.ID, out arryResID, bTraceUp, false, true); - m_TraceUpDownAnalyResFeatures = globeControl1.Globe.SelectedObjectLayer.GetFeaturesByIDs(arryResID); - if (m_TraceUpDownAnalyResFeatures == null || m_TraceUpDownAnalyResFeatures.Length < 1) - { - String strLine1 = "没有上游!"; - if (!bTraceUp) - { - strLine1 = "没有下游!"; - - } - MessageBox.Show(strLine1); - } - else - { - int nCount = m_TraceUpDownAnalyResFeatures.Length; - for (int i = 0; i < nCount; i++) - { - m_TraceUpDownAnalyResFeatures[i].HighLight = true; - GSOGeoPolyline3D geoline = m_TraceUpDownAnalyResFeatures[i].Geometry as GSOGeoPolyline3D; - if (geoline != null) - { - GSOLineStyle3D lineStyle = geoline.Style as GSOLineStyle3D; - if (lineStyle != null) - { - if (lineStyle.ArrowStyle == null) - { - lineStyle.ArrowStyle = new GSOArrowStyle(); - lineStyle.ArrowStyle.BodyWidth = 2; - lineStyle.ArrowStyle.BodyLen = 6; - lineStyle.ArrowStyle.HeadWidth = 8; - lineStyle.ArrowStyle.HeadLen = 10; - lineStyle.ArrowStyle.OutlineVisible = true; - lineStyle.ArrowStyle.OutlineColor = Color.Red; - lineStyle.ArrowStyle.Speed = lineStyle.ArrowStyle.Speed / 2; - } - lineStyle.ArrowVisible = true; - lineStyle.ArrowStyle.Play(); - } - } - } - globeControl1.Refresh(); - } - * **/ - } - - #endregion - /// - /// 上下游追踪 功能 - /// - /// - private void AffectedPipeLine(Boolean bTraceUp) - { - if (globeControl1.Globe.SelectedObject == null) - { - MessageBox.Show("请点击“编辑”—“选中对象”选择一条线!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); - return; - } - GSOFeature selLineFeature = globeControl1.Globe.SelectedObject; - if (selLineFeature.Geometry == null || selLineFeature.Geometry.Type != EnumGeometryType.GeoPolyline3D) - { - MessageBox.Show("请点击“编辑”—“选中对象”选择一条线!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); - - return; - } - - if (globeControl1.Globe.SelectedObjectLayer == null) - { - return; - } - - GSODataset curCAYDataset = globeControl1.Globe.SelectedObjectLayer.Dataset; - if (curCAYDataset == null || curCAYDataset.DataSource == null) - { - return; - } - - string srName = curCAYDataset.Name; - GSONetworkDataset curCAYNDataset = curCAYDataset.DataSource.GetDatasetByName(srName + "Network") as GSONetworkDataset; - - if (curCAYNDataset == null) - { - return; - } - int[] arryResID; - curCAYNDataset.TraceUpDownAnalysis(selLineFeature.ID, out arryResID, bTraceUp, false, true); - m_AffectedPipeLines = globeControl1.Globe.SelectedObjectLayer.GetFeaturesByIDs(arryResID); - if (m_AffectedPipeLines == null || m_AffectedPipeLines.Length < 1) - { - } - else - { - int nCount = m_AffectedPipeLines.Length; - for (int i = 0; i < nCount; i++) - { - m_AffectedPipeLines[i].HighLight = true; - } - globeControl1.Refresh(); - } - } - /// - /// 清除上下游追踪结果 菜单 - /// - /// - /// - //private void buttonItem58_Click(object sender, EventArgs e) - //{ - // //日志记录 - // LogManager.saveLog(Utility.userName, this.buttonItem58.Text); - - // ClearUpDownTraceAnalysis(); - //} - + /// /// 显示流向 功能 /// @@ -5359,158 +5052,8 @@ } FrmCloseValves frm; - /// - /// 关阀分析 功能 - /// - /// - /// - /// - /// - private bool NetworkCloseValvesAnalysis(GSOFeature lineFeature, GSOPoint3d pntBreak, GSOLayer lineLayer) - { - /* - if (lineLayer == null || lineFeature == null || lineFeature.Geometry == null || lineFeature.Geometry.Type != EnumGeometryType.GeoPolyline3D) - { - return false; - } - GSODataset curCAYDataset = lineLayer.Dataset; - if (curCAYDataset == null || curCAYDataset.DataSource == null) - { - MessageBox.Show("该图层不是要素图层!", "提示"); - return false; - } - string srName = curCAYDataset.Name; - GSONetworkDataset curCAYNDataset = curCAYDataset.DataSource.GetDatasetByName(srName + "Network") as GSONetworkDataset; - - if (curCAYNDataset == null) - { - MessageBox.Show("该图层没有创建网络拓扑,请先创建网络拓扑信息再进行分析!", "提示"); - return false; - } - ClearCloseValvesAnalysis(); - - int[] arryResNodeID = null; - int[] arryResValveID = null; - try - { - curCAYNDataset.CloseValveAnalysis(lineFeature.ID, out arryResNodeID, out arryResValveID, false, true); - } - catch (Exception e) - { } - - string valveName = lineLayer.Caption; - valveName = valveName.Substring(0, valveName.IndexOf("管线")); - GSOLayer valveLayer = globeControl1.Globe.Layers[valveName + "阀门"]; - if (valveLayer == null) - { - MessageBox.Show("和选中对象所在管线图层相关联的阀门图层不存在!", "提示"); - return false; - } - - m_CloseValvesAnalyResFeatures = valveLayer.GetFeaturesByIDs(arryResValveID);// curCAYNDataset.NodeDataset.GetFeaturesByIDs(arryResValveID); - - if (m_CloseValvesAnalyResFeatures == null || m_CloseValvesAnalyResFeatures.Length < 1) - { - MessageBox.Show("没有找到要关闭的阀门!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); - if (frm != null) - { - frm.Close(); - } - } - else - { - int nCount = m_CloseValvesAnalyResFeatures.Length; - - if (nCount > 0) - { - frm = FrmCloseValves.getForm(globeControl1, m_CloseValvesAnalyResFeatures, m_CloseValvesList); - - if (!frm.Visible) - { - frm.Show(this); - } - } - }**/ - return true; - } FrmBoosterValvers frmbooster = null; - /// - /// 阀门分析 功能 - /// - /// - /// - /// - /// - private bool NetworkBoosterValvesAnalysis(GSOFeature lineFeature, GSOPoint3d pntBreak, GSOLayer lineLayer) - { - if (lineLayer == null || lineFeature == null || lineFeature.Geometry == null || lineFeature.Geometry.Type != EnumGeometryType.GeoPolyline3D) - { - return false; - } - GSODataset curCAYDataset = lineLayer.Dataset; - - if (curCAYDataset == null || curCAYDataset.DataSource == null) - { - return false; - } - string srName = curCAYDataset.Name; - GSONetworkDataset curCAYNDataset = curCAYDataset.DataSource.GetDatasetByName(srName + "Network") as GSONetworkDataset; - - if (curCAYNDataset == null) - { - MessageBox.Show("该图层没有创建网络拓扑,请先创建网络拓扑信息再进行分析!", "提示"); - return false; - } - ClearBoosterValvesAnalysis(); - ClearAffectedPipeLine(); - - int[] arryResNodeID = null; - int[] arryResValveID = null; - try - { - curCAYNDataset.CloseValveAnalysis(lineFeature.ID, out arryResNodeID, out arryResValveID, false, true); - } - catch (Exception e) - { - - } - //目前只有燃气管线 有阀门 - string valveName = lineLayer.Name; - valveName = valveName.Substring(0, valveName.IndexOf("管线")); - GSOLayer valveLayer = globeControl1.Globe.Layers[valveName + "阀门"]; - if (valveLayer == null) - { - MessageBox.Show("和选中对象所在管线图层相关联的阀门图层不存在!", "提示"); - return false; - } - m_BoosterValvesAnalyResFeatures = valveLayer.GetFeaturesByIDs(arryResValveID); - - if (m_BoosterValvesAnalyResFeatures == null || - m_BoosterValvesAnalyResFeatures.Length < 1) - { - MessageBox.Show("没有找到要关闭的阀门!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); - if (frmbooster != null) - { - frmbooster.Close(); - } - } - else - { - int nCount = m_BoosterValvesAnalyResFeatures.Length; - if (nCount > 0) - { - AffectedPipeLine(false); - frmbooster = FrmBoosterValvers.getForm(globeControl1, m_BoosterValvesAnalyResFeatures, m_BoosterValvesList, m_AffectedPipeLines); - frmbooster.setLstValvesName(); - if (!frmbooster.Visible) - { - frmbooster.Show(this); - } - } - } - return true; - } /// /// 垂直净距分析 功能界面中的 选择图层复选框 选中状态改变事件处理 @@ -7726,69 +7269,6 @@ double distance = lineline.GetSpaceLength(true, 6378137.0); return distance; } - /// - /// 判断管线是否相通 功能 - /// - /// - public bool isInterlinked() - { - if (globeControl1.Globe.SelObjectCount < 2) - { - MessageBox.Show("请选中至少两个管线!!"); - buttonItemFX3_6.Checked = false; - return false; - } - ClearConnexityAnalysis(); - globeControl1.Globe.GetSelectObject(0, out m_ConnexityAnalysisFirstFeature, out m_ConnexityAnalysisFirstLayer); - globeControl1.Globe.GetSelectObject(1, out m_ConnexityAnaylsisSecondFeature, out m_COnnexityAnalysisSecondLayer); - GSOGeoPolyline3D line1 = m_ConnexityAnalysisFirstFeature.Geometry as GSOGeoPolyline3D; - GSOGeoPolyline3D line2 = m_ConnexityAnaylsisSecondFeature.Geometry as GSOGeoPolyline3D; - if (line1 == null || line2 == null) - { - MessageBox.Show("请选择管线!!"); - return false; - } - GSOPipeLineStyle3D pipeStyle1 = line1.Style as GSOPipeLineStyle3D; - GSOPipeLineStyle3D pipeStyle2 = line2.Style as GSOPipeLineStyle3D; - if (pipeStyle1 == null || pipeStyle2 == null) - { - MessageBox.Show("请选择管线!!"); - return false; - } - if (!m_ConnexityAnalysisFirstLayer.IsSameInnerObject(m_COnnexityAnalysisSecondLayer)) - { - MessageBox.Show("不在同一个图层!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); - ClearConnexityAnalysis(); - return false; - } - else - { - GSODataset curCAYDataset = m_ConnexityAnalysisFirstLayer.Dataset; - string srName = curCAYDataset.Name; - GSONetworkDataset curCAYNDataset = curCAYDataset.DataSource.GetDatasetByName(srName + "Network") as GSONetworkDataset; - if (curCAYNDataset == null) - { - MessageBox.Show("该图层没有创建网络拓扑,请先创建网络拓扑信息再进行分析!", "提示"); - return false; - } - - int[] arryResID; - curCAYNDataset.ConnexityAnalysis(m_ConnexityAnalysisFirstFeature.ID, m_ConnexityAnaylsisSecondFeature.ID, out arryResID, false, true); - m_ConnexityAnalyResFeatures = m_ConnexityAnalysisFirstLayer.GetFeaturesByIDs(arryResID); - if (m_ConnexityAnalyResFeatures == null || m_ConnexityAnalyResFeatures.Length < 1) - { - String strLine1 = "管线:" + m_ConnexityAnalysisFirstFeature.ID; - String strLine2 = "管线:" + m_ConnexityAnaylsisSecondFeature.ID; - MessageBox.Show("请选择两条相通的管线!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); - return false; - } - else - { - return true; - } - } - } - /// /// 图层节点树中 节点 右键单击事件处理 @@ -9564,27 +9044,7 @@ } } - /// - /// 清除分析结果 - /// - /// - /// - //private void buttonItem131_Click(object sender, EventArgs e) - //{ - // LogManager.saveLog(Utility.userName, this.buttonItem131.Text); - - // clearFeatureHighLight(); - // //if (boolfrmShResult == true) - // //{ - // // frmShResult.Close(); - // //} - // //else - // //{ - - // //} - - // ClearRedlineAnalyseResult(); - //} + /// /// 清除渲染结果 /// @@ -10728,8 +10188,9 @@ buttonX16_Click(null, null); buttonClearAnalysisResult_Click(null, null); - ClearConnexityAnalysis();//清除连通性分析 - ClearCloseValvesAnalysis();//清除阀门分析 + NetworkAnalysisTool.ClearAllTopAnalysis(this.globeControl1); + // ClearConnexityAnalysis();//清除连通性分析 + // ClearCloseValvesAnalysis();//清除阀门分析 //清除管线间距分析 if (disFeature != null) @@ -10753,7 +10214,7 @@ globeControl1.Globe.UnderGroundFloor.Visible = false;//隐藏地下网格线 - ClearUpDownTraceAnalysis(); //清除上下游分析 + // ClearUpDownTraceAnalysis(); //清除上下游分析 globeControl1.Globe.RemoveAllPits();//清除所有坑 string[] markerStrs = new string[9]; @@ -11206,6 +10667,8 @@ sideBar1.Refresh(); Refresh(); } + + #region Predaotr,断面分析 /// /// 横断面分析 /// @@ -11213,26 +10676,11 @@ /// private void buttonItemFX2_1_Click(object sender, EventArgs e) { - //日志记录 - LogManager.saveLog(Utility.userName, this.buttonItemFX2_1.Text); - - if (!buttonItemFX2_1.Checked) - { - trackflag = "PolylineAnalysis"; - globeControl1.Globe.Action = EnumAction3D.TrackPolyline; - globeControl1.Globe.TrackPolylineTool.VerticalLineVisible = true; - globeControl1.Globe.TrackPolylineTool.TrackMode = EnumTrackMode.SpaceTrack; - buttonItemFX2_1.Checked = true; - buttonItemFX2_3.Checked = false; - buttonItemFX2_4.Checked = false; - } - else - { - globeControl1.Globe.Action = EnumAction3D.ActionNull; - buttonItemFX2_1.Checked = false; - globeControl1.Globe.TrackPolylineTool.VerticalLineVisible = false; - } - ActionToolMenuChecked(); + globeControl1.Globe.Action = EnumAction3D.TrackPolyline; + globeControl1.Globe.TrackPolylineTool.VerticalLineVisible = true; + globeControl1.Globe.TrackPolylineTool.TrackMode = EnumTrackMode.SpaceTrack; + trackPolylineEndMode = EnumTrackPolylineEndMode.HDM_Analysis; + } /// /// 纵断面分析 @@ -11241,235 +10689,28 @@ /// private void buttonItemFX2_2_Click(object sender, EventArgs e) { - //日志记录 - LogManager.saveLog(Utility.userName, this.buttonItemFX2_2.Text); - - if (globeControl1.Globe.SelObjectCount >= 1) + if (globeControl1.Globe.SelObjectCount<1) { - GSOFeatures selectFeatures = new GSOFeatures(); - for (int i = 0; i < globeControl1.Globe.SelObjectCount; i++) + MessageBox.Show("请选择一条或者多条管线!", "提示", MessageBoxButtons.OK, + MessageBoxIcon.Information); + return; + } + GSOFeatures selectFeatures = new GSOFeatures(); + for (int i = 0; i < globeControl1.Globe.SelObjectCount; i++) + { + GSOFeature feature = null; + GSOLayer layer = null; + globeControl1.Globe.GetSelectObject(i, out feature, out layer); + if (feature != null && feature.Geometry != null && feature.Geometry.Type == EnumGeometryType.GeoPolyline3D) { - GSOFeature feature = null; - GSOLayer layer = null; - globeControl1.Globe.GetSelectObject(i, out feature, out layer); - if (feature != null && feature.Geometry != null && feature.Geometry.Type == EnumGeometryType.GeoPolyline3D) - { - selectFeatures.Add(feature); - } - } - if (selectFeatures.Length < 1) - { - MessageBox.Show("请选择一条或者多条管线!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); - return; - } - List listFeature = new List(); - if (selectFeatures.Length == 1) - { - listFeature.Add(selectFeatures[0]); - } - else - { - //求多条管线纵断面 1,2,3 - //1 判断管线是否相连、且没有分叉 - for (int i = 0; i < selectFeatures.Length; i++) - { - GSOGeoPolyline3D line = selectFeatures[i].Geometry as GSOGeoPolyline3D; - bool isConnect = false; - int[] valueCount = new int[2]; - valueCount[0] = 0; - valueCount[1] = 0; - - if (line != null && line.PartCount > 0) - { - for (int j = 0; j < selectFeatures.Length; j++) - { - if (i == j) - { - continue; - } - GSOGeoPolyline3D newLine = selectFeatures[j].Geometry as GSOGeoPolyline3D; - if (newLine != null && newLine.PartCount > 0) - { - int minValueIndex = 0; - double limitValue = 1.0; - double[] value = new double[4]; - value[0] = getDistance(line[line.PartCount - 1][line[line.PartCount - 1].Count - 1], newLine[0][0]); - value[1] = getDistance(line[line.PartCount - 1][line[line.PartCount - 1].Count - 1], newLine[newLine.PartCount - 1][newLine[newLine.PartCount - 1].Count - 1]); - value[2] = getDistance(line[0][0], newLine[0][0]); - value[3] = getDistance(line[0][0], newLine[newLine.PartCount - 1][newLine[newLine.PartCount - 1].Count - 1]); - double minValue = value[0]; - for (int m = 1; m < value.Length; m++) - { - if (minValue > value[m]) - { - minValue = value[m]; - minValueIndex = m; - } - } - if (minValue < limitValue) - { - isConnect = true; - if (minValueIndex > 1) - { - valueCount[1]++; - } - else - { - valueCount[0]++; - } - } - } - } - if (!isConnect || valueCount[0] > 1 || valueCount[1] > 1) - { - MessageBox.Show("请选择相连接的一条线上的管线!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); - return; - } - } - } - //2 记录每一条相连接的管线的起点和终点,并添加到一条管线中 - for (int p = 0; p < selectFeatures.Length; p++) - { - GSOGeoPolyline3D line = selectFeatures[p].Geometry as GSOGeoPolyline3D; - if (line != null && line.PartCount > 0) - { - for (int n = 0; n < selectFeatures.Length; n++) - { - if (p == n) - { - continue; - } - GSOGeoPolyline3D newLine = selectFeatures[n].Geometry as GSOGeoPolyline3D; - if (newLine != null && newLine.PartCount > 0) - { - int minValueIndex = 0; - double limitValue = 1.0; - double[] value = new double[4]; - value[0] = getDistance(line[line.PartCount - 1][line[line.PartCount - 1].Count - 1], newLine[0][0]); - value[1] = getDistance(line[line.PartCount - 1][line[line.PartCount - 1].Count - 1], newLine[newLine.PartCount - 1][newLine[newLine.PartCount - 1].Count - 1]); - value[2] = getDistance(line[0][0], newLine[0][0]); - value[3] = getDistance(line[0][0], newLine[newLine.PartCount - 1][newLine[newLine.PartCount - 1].Count - 1]); - double minValue = value[0]; - for (int m = 1; m < value.Length; m++) - { - if (minValue > value[m]) - { - minValue = value[m]; - minValueIndex = m; - } - } - if (minValue < limitValue) - { - GSOFeature featureFromAllSelectedObj = new GSOFeature(); - GSOGeoPolyline3D lineFromAllSelectedObj = new GSOGeoPolyline3D(); - switch (minValueIndex) - { - case 0: - GSOPoint3ds linePart = new GSOPoint3ds(); - for (int i = 0; i < line.PartCount; i++) - { - for (int j = 0; j < line[i].Count; j++) - { - linePart.Add(line[i][j]); - } - } - for (int i = 0; i < newLine.PartCount; i++) - { - for (int j = 0; j < newLine[i].Count; j++) - { - linePart.Add(newLine[i][j]); - } - } - lineFromAllSelectedObj.AddPart(linePart); - break; - case 1: - linePart = new GSOPoint3ds(); - for (int i = 0; i < line.PartCount; i++) - { - for (int j = 0; j < line[i].Count; j++) - { - linePart.Add(line[i][j]); - } - } - for (int i = newLine.PartCount - 1; i >= 0; i--) - { - for (int j = newLine[i].Count - 1; j >= 0; j--) - { - linePart.Add(newLine[i][j]); - } - } - lineFromAllSelectedObj.AddPart(linePart); - break; - case 2: - linePart = new GSOPoint3ds(); - for (int i = line.PartCount - 1; i >= 0; i--) - { - for (int j = line[i].Count - 1; j >= 0; j--) - { - linePart.Add(line[i][j]); - } - } - for (int i = 0; i < newLine.PartCount; i++) - { - for (int j = 0; j < newLine[i].Count; j++) - { - linePart.Add(newLine[i][j]); - } - } - lineFromAllSelectedObj.AddPart(linePart); - break; - case 3: - linePart = new GSOPoint3ds(); - for (int i = line.PartCount - 1; i >= 0; i--) - { - for (int j = line[i].Count - 1; j >= 0; j--) - { - linePart.Add(line[i][j]); - } - } - for (int i = newLine.PartCount - 1; i >= 0; i--) - { - for (int j = newLine[i].Count - 1; j >= 0; j--) - { - linePart.Add(newLine[i][j]); - } - } - lineFromAllSelectedObj.AddPart(linePart); - break; - } - - featureFromAllSelectedObj.Geometry = lineFromAllSelectedObj; - - selectFeatures.Remove(n); - selectFeatures.Remove(p); - selectFeatures.Add(featureFromAllSelectedObj); - p--; - break; - } - } - } - } - } - //3 将合并之后的管线添加到集合中 - for (int h = 0; h < selectFeatures.Length; h++) - { - listFeature.Add(selectFeatures[h]); - } - } - //将选中的管线展示在窗体中 - if (listFeature.Count > 0) - { - FrmProfileAnalysis frm = new FrmProfileAnalysis(globeControl1, listFeature); - frm.Show(this); - } - else - { - MessageBox.Show("请选择相连接的管线!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); + selectFeatures.Add(feature); } } - else + List feats = SectionAnalysisTool.ZDMAnalysis(selectFeatures); + if (feats != null && feats.Count >= 1) { - MessageBox.Show("请选择一条或者多条管线!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); + FrmProfileAnalysis frm = new FrmProfileAnalysis(globeControl1, feats); + frm.Show(this); } } /// @@ -11479,25 +10720,11 @@ /// private void buttonItemFX2_3_Click(object sender, EventArgs e) { - //日志记录 - LogManager.saveLog(Utility.userName, this.buttonItemFX2_3.Text); + globeControl1.Globe.Action = EnumAction3D.TrackPolyline; + globeControl1.Globe.TrackPolylineTool.VerticalLineVisible = true; + globeControl1.Globe.TrackPolylineTool.TrackMode = EnumTrackMode.SpaceTrack; + trackPolylineEndMode = EnumTrackPolylineEndMode.DLDM_Analysis; - if (!buttonItemFX2_3.Checked) - { - trackflag = "RoadPolylineAnalysis"; - globeControl1.Globe.Action = EnumAction3D.TrackPolyline; - globeControl1.Globe.TrackPolylineTool.VerticalLineVisible = true; - buttonItemFX2_3.Checked = true; - buttonItemFX2_1.Checked = false; - buttonItemFX2_4.Checked = false; - } - else - { - globeControl1.Globe.Action = EnumAction3D.ActionNull; - buttonItemFX2_3.Checked = false; - globeControl1.Globe.TrackPolylineTool.VerticalLineVisible = false; - } - ActionToolMenuChecked(); } /// /// 基线剖面分析 @@ -11506,27 +10733,14 @@ /// private void buttonItemFX2_4_Click(object sender, EventArgs e) { - //日志记录 - LogManager.saveLog(Utility.userName, this.buttonItemFX2_4.Text); - - if (!buttonItemFX2_4.Checked) - { - globeControl1.Globe.Action = EnumAction3D.TrackPolyline; - //globeControl1.Globe.TrackPolylineAnalysis.VerticalLineVisible = true; - globeControl1.Globe.TrackPolylineTool.VerticalLineVisible = true; - buttonItemFX2_4.Checked = true; - buttonItemFX3_6.Checked = false; - buttonItemFX2_1.Checked = false; - } - else - { - globeControl1.Globe.Action = EnumAction3D.ActionNull; - buttonItemFX2_4.Checked = false; - //globeControl1.Globe.TrackPolylineAnalysis.VerticalLineVisible = false; - globeControl1.Globe.TrackPolylineTool.VerticalLineVisible = false; - } - ActionToolMenuChecked(); + globeControl1.Globe.Action = EnumAction3D.TrackPolyline; + globeControl1.Globe.TrackPolylineTool.VerticalLineVisible = true; + globeControl1.Globe.TrackPolylineTool.TrackMode = EnumTrackMode.SpaceTrack; + trackPolylineEndMode = EnumTrackPolylineEndMode.JXPM_Analysis; + } + + #endregion /// /// 创建拓扑 /// @@ -11540,7 +10754,7 @@ FrmGenAndFaMenTopu frm = new FrmGenAndFaMenTopu(globeControl1, m_PipelineLayerNames, valueLayerNames); frm.Show(this); } - #region Fan + #region Predator :拓扑分析 /// /// 上游分析 /// @@ -11550,8 +10764,6 @@ { //日志记录 LogManager.saveLog(Utility.userName, this.buttonItemFX3_2.Text); - - //ClearUpDownTraceAnalysis(); Fan NetworkTraceUpDown(true); } /// @@ -11563,10 +10775,27 @@ { //日志记录 LogManager.saveLog(Utility.userName, this.buttonItemFX3_3.Text); - - // ClearUpDownTraceAnalysis(); Fan NetworkTraceUpDown(false); } + + /// + /// 上下游追踪 功能 + /// + /// + private void NetworkTraceUpDown(Boolean bTraceUp) + { + GSOFeature selLineFeature = globeControl1.Globe.SelectedObject; + if (selLineFeature == null || selLineFeature.Geometry == null || selLineFeature.Geometry.Type != EnumGeometryType.GeoPolyline3D) + { + MessageBox.Show("请点击“编辑”—“选中对象”选择一条线!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); + return; + } + GSOLayer selLayer = globeControl1.Globe.SelectedObjectLayer; + + NetworkAnalysisTool.TraceUpDownAnalysis(bTraceUp, + selLineFeature, selLayer); + } + /// /// 流向分析 /// @@ -11618,43 +10847,6 @@ { MessageBox.Show("未找到关闭阀门"); } - - - //日志记录 - /* - LogManager.saveLog(Utility.userName, this.buttonItemFX3_5.Text); - - ClearCloseValvesAnalysis(); - if (globeControl1.Globe.SelObjectCount < 1) - { - MessageBox.Show("请选中至少一根管线!!"); - buttonItemFX3_5.Checked = false; - return; - } - GSOLayer resLayer = null; - GSOFeature resFeature = null; - globeControl1.Globe.GetSelectObject(0, out resFeature, out resLayer); - - GSOGeoPolyline3D line1 = resFeature.Geometry as GSOGeoPolyline3D; - if (line1 == null) - { - MessageBox.Show("请选择管线!!"); - return; - } - GSOPipeLineStyle3D pipeStyle1 = line1.Style as GSOPipeLineStyle3D; - if (pipeStyle1 == null) - { - MessageBox.Show("请选择管线!!"); - return; - } - GSOPoint3d resIntersetPoint = new GSOPoint3d(); - if (NetworkCloseValvesAnalysis(resFeature, resIntersetPoint, resLayer)) - { - //btnGFFX.Checked = false; - globeControl1.Globe.Action = EnumAction3D.ActionNull; - buttonItemFX3_5.Checked = false; - } - * **/ } /// @@ -11682,47 +10874,6 @@ return; } NetworkAnalysisTool.ConnexityAnalysis(selFeat0, selFeat1, layer0); - /* - //日志记录 - LogManager.saveLog(Utility.userName, this.buttonItemFX3_6.Text); - - if (globeControl1.Globe.SelObjectCount < 2) - { - MessageBox.Show("请选中至少两个管线!!"); - buttonItemFX3_6.Checked = false; - return; - } - ClearConnexityAnalysis(); - globeControl1.Globe.GetSelectObject(0, out m_ConnexityAnalysisFirstFeature, out m_ConnexityAnalysisFirstLayer); - globeControl1.Globe.GetSelectObject(1, out m_ConnexityAnaylsisSecondFeature, out m_COnnexityAnalysisSecondLayer); - GSOGeoPolyline3D line1 = m_ConnexityAnalysisFirstFeature.Geometry as GSOGeoPolyline3D; - GSOGeoPolyline3D line2 = m_ConnexityAnaylsisSecondFeature.Geometry as GSOGeoPolyline3D; - if (line1 == null || line2 == null) - { - MessageBox.Show("请选择管线!!"); - buttonItemFX3_6.Checked = false; - return; - } - - GSOPipeLineStyle3D pipeStyle1 = line1.Style as GSOPipeLineStyle3D; - GSOPipeLineStyle3D pipeStyle2 = line2.Style as GSOPipeLineStyle3D; - if (pipeStyle1 == null || pipeStyle2 == null) - { - MessageBox.Show("请选择管线!!"); - buttonItemFX3_6.Checked = false; - return; - } - if (!m_ConnexityAnalysisFirstLayer.IsSameInnerObject(m_COnnexityAnalysisSecondLayer)) - { - MessageBox.Show("不在同一个图层!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); - buttonItemFX3_6.Checked = false; - ClearConnexityAnalysis(); - } - else - { - ConnexityAnalysis(); - } - * **/ } /// /// 爆管分析 @@ -11731,8 +10882,6 @@ /// private void buttonItemFX3_7_Click(object sender, EventArgs e) { - //TODO LIST:关阀+上游 追踪 - NetworkTraceUpDown(true); //上游追踪: GSOFeature selLineFeature = globeControl1.Globe.SelectedObject; @@ -11747,73 +10896,8 @@ this.buttonItemFX3_5_Click(sender, e); //关阀分析: - //日志记录 - /* - LogManager.saveLog(Utility.userName, this.buttonItemFX3_7.Text); - ClearCloseValvesAnalysis(); - if (globeControl1.Globe.SelObjectCount < 1) - { - MessageBox.Show("请选中至少一个管线!!"); - return; - } - GSOLayer resLayer = null; - GSOFeature resFeature = null; - globeControl1.Globe.GetSelectObject(0, out resFeature, out resLayer); - - GSOGeoPolyline3D line1 = resFeature.Geometry as GSOGeoPolyline3D; - if (line1 == null) - { - MessageBox.Show("请选择管线!!"); - return; - } - GSOPipeLineStyle3D pipeStyle1 = line1.Style as GSOPipeLineStyle3D; - if (pipeStyle1 == null) - { - MessageBox.Show("请选择管线!!"); - return; - } - - GSOFeatures feats = globeControl1.Globe.MemoryLayer.GetFeatureByName("粒子要素", true); - if (feats.Length > 0) - globeControl1.Globe.MemoryLayer.RemoveFeatureByID(feats[0].ID); - //if (emitterFeature != null) - //{ - // globeControl1.Globe.MemoryLayer.RemoveFeatureByID(emitterFeature.ID); - //} - - GSOPoint3d pt = new GSOPoint3d(); - double length = line1.GetSpaceLength(true, 6378137);//线的长度 - GSOGeoPolyline3D lineLine = line1.GetSegment(0, length / 2); - GSOPoint3d point3d = lineLine[lineLine.PartCount - 1][lineLine[lineLine.PartCount - 1].Count - 1]; - pt.X = point3d.X; - pt.Y = point3d.Y; - pt.Z = point3d.Z; - - pt.Z += pipeStyle1.Radius * 2; - - if (resLayer.Caption.Contains("气")) - { - globeControl1.Globe.UnderGroundFloor.Visible = true; - AddFire(pt.X, pt.Y, pt.Z); - } - else if (resLayer.Caption.Contains("给水")) - { - globeControl1.Globe.UnderGroundFloor.Visible = true; - AddFountain(pt.X, pt.Y, pt.Z); - } - else if (resLayer.Caption.Contains("热力")) - { - globeControl1.Globe.UnderGroundFloor.Visible = true; - AddFountain(pt.X, pt.Y, pt.Z); - } - GSOPoint3d resIntersetPoint = new GSOPoint3d(); - if (NetworkBoosterValvesAnalysis(resFeature, resIntersetPoint, resLayer)) - { - globeControl1.Globe.Action = EnumAction3D.ActionNull; - } - * */ - } + #endregion /// /// 多边形开挖 diff --git a/NetworkAnalysisTool.cs b/NetworkAnalysisTool.cs index 7709e9d..67e1d2f 100644 --- a/NetworkAnalysisTool.cs +++ b/NetworkAnalysisTool.cs @@ -456,5 +456,15 @@ flowLayer = layer; } + //清除所有分析 + public static void ClearAllTopAnalysis(GSOGlobeControl globeControl) + { + ClearConnexityAnalysis(); + ClearExplodeAnalysis(globeControl); + ClearFlowDirectionAnalysis(); + ClearTraceUpDownAnalysis(); + ClearValvesAnalysis(); + } + } } diff --git a/SectionAnalysisTool.cs b/SectionAnalysisTool.cs new file mode 100644 index 0000000..9647393 --- /dev/null +++ b/SectionAnalysisTool.cs @@ -0,0 +1,332 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using GeoScene.Data; +using GeoScene.Engine; +using GeoScene.Globe; +using System.Windows.Forms; +namespace Cyberpipe +{ + public class HDMCoordinate + { + private double dis; + private double z; + + public double Dis + { + get { return dis; } + set { dis = value; } + } + public double Z + { + get { return z; } + set { z = value; } + } + } + public class SectionAnalysisTool + { + public static Dictionary hdmDic = new Dictionary(); + + public static void ClearHDMAnalysis(GSOGlobeControl globeControl) + { + hdmDic.Clear(); + globeControl.Globe.ClearLastTrackPolyline(); + globeControl.Globe.Action = EnumAction3D.ActionNull; + } + + /** + * 计算点与三维线之间的距离 + * **/ + private static HDMCoordinate getSpaceDisBetweenLineAndPoint(GSOPoint3d point, + GSOGeoPolyline3D polyLine) + { + double a_x = polyLine[0][0].X; + double a_y = polyLine[0][0].Y; + + int id = GeoScene.Data.GSOProjectManager.AddProject(Utility.projectStr); + GeoScene.Data.GSOPoint2d a_Point = GeoScene.Data.GSOProjectManager.Forward(new GSOPoint2d(a_x, + a_y), id);//user画的线的起始点 + + GeoScene.Data.GSOPoint2d pt2d = new GeoScene.Data.GSOPoint2d(point.X, point.Y); + GeoScene.Data.GSOPoint2d result = GeoScene.Data.GSOProjectManager.Forward(pt2d, id); + double B_x = result.X; + double B_y = result.Y; + + double x = System.Math.Abs(B_x - a_Point.X); + double y = System.Math.Abs(B_y - a_Point.Y); + double Dis = Math.Round(Math.Sqrt(x * x + y * y), 2); + HDMCoordinate coor = new HDMCoordinate(); + coor.Dis = Dis; + coor.Z = point.Z; + return coor; + } + + //横断面分析 + public static Dictionary HDMAnalysis(GSOGlobeControl globeControl, + GSOGeoPolyline3D polyLine, List pipeLayerNames) + { + ClearHDMAnalysis(globeControl); + + if (globeControl == null || polyLine == null|| + pipeLayerNames == null || pipeLayerNames.Count == 0) { return null; } + + globeControl.Globe.ClearLastTrackPolyline(); + globeControl.Globe.Action = EnumAction3D.ActionNull; + + GSOGeoPolygon3D polygon = polyLine.CreateBuffer(0.1, true, + 5, true, false); + + for (int i = 0; i < pipeLayerNames.Count; i++) + { + GSOLayer layer = globeControl.Globe.Layers. + GetLayerByCaption(pipeLayerNames[i]); + if(layer==null || layer.Visible==false|| + layer as GSOFeatureLayer==null) + continue; + + GSOFeatureLayer featurelayer = layer as GSOFeatureLayer; + GSOFeatures feats = featurelayer.FindFeaturesInPolygon(polygon, false); + if(feats==null||feats.Length==0) + continue; + + for (int j = 0; j < feats.Length; j++) + { + GSOFeature feateline = feats[j]; + GSOGeoPolyline3D geoline = feateline.Geometry as GSOGeoPolyline3D; + if(geoline!=null &&geoline.Style!=null&& + geoline.Style.GetType() == typeof(GSOPipeLineStyle3D)) + { + GSOPoint3d pntIntersect1 = new GSOPoint3d(); + GSOPoint3d pntIntersect2 = new GSOPoint3d(); + double honLen; + double verLen; + double dDist = globeControl.Globe.Analysis3D.ComputeTwoGeoPolylineDistance(polyLine, + geoline, out pntIntersect1, out pntIntersect2, out honLen, + out verLen, false, false, 0); + + if (dDist > -1) + { + HDMCoordinate coord = getSpaceDisBetweenLineAndPoint(pntIntersect2, polyLine); + hdmDic.Add(feateline, coord); + } + + } + + } + } + return hdmDic; + } + + //纵断面分析 + public static List ZDMAnalysis(GSOFeatures selectFeatures) + { + List result = new List(); + if (selectFeatures != null && selectFeatures.Length == 1) + { + result.Add(selectFeatures[0]); + return result; + } + + for (int i = 0; i < selectFeatures.Length; i++) + { + GSOGeoPolyline3D line = selectFeatures[i].Geometry as GSOGeoPolyline3D; + bool isConnect = false; + int[] valueCount = new int[2]; + valueCount[0] = 0; + valueCount[1] = 0; + if (line != null && line.PartCount > 0) + { + for (int j = 0; j < selectFeatures.Length; j++) + { + if (i == j) + { + continue; + } + GSOGeoPolyline3D newLine = selectFeatures[j].Geometry as GSOGeoPolyline3D; + if (newLine != null && newLine.PartCount > 0) + { + int minValueIndex = 0; + double limitValue = 1.0; + double[] value = new double[4]; + value[0] = getDistance(line[line.PartCount - 1][line[line.PartCount - 1].Count - 1], newLine[0][0]); + value[1] = getDistance(line[line.PartCount - 1][line[line.PartCount - 1].Count - 1], newLine[newLine.PartCount - 1][newLine[newLine.PartCount - 1].Count - 1]); + value[2] = getDistance(line[0][0], newLine[0][0]); + value[3] = getDistance(line[0][0], newLine[newLine.PartCount - 1][newLine[newLine.PartCount - 1].Count - 1]); + double minValue = value[0]; + for (int m = 1; m < value.Length; m++) + { + if (minValue > value[m]) + { + minValue = value[m]; + minValueIndex = m; + } + } + if (minValue < limitValue) + { + isConnect = true; + if (minValueIndex > 1) + { + valueCount[1]++; + } + else + { + valueCount[0]++; + } + } + } + } + if (!isConnect || valueCount[0] > 1 || valueCount[1] > 1) + { + MessageBox.Show("请选择相连接的一条线上的管线!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); + return null; + } + } + } + //2 记录每一条相连接的管线的起点和终点,并添加到一条管线中 + for (int p = 0; p < selectFeatures.Length; p++) + { + GSOGeoPolyline3D line = selectFeatures[p].Geometry as GSOGeoPolyline3D; + if (line != null && line.PartCount > 0) + { + for (int n = 0; n < selectFeatures.Length; n++) + { + if (p == n) + { + continue; + } + GSOGeoPolyline3D newLine = selectFeatures[n].Geometry as GSOGeoPolyline3D; + if (newLine != null && newLine.PartCount > 0) + { + int minValueIndex = 0; + double limitValue = 1.0; + double[] value = new double[4]; + value[0] = getDistance(line[line.PartCount - 1][line[line.PartCount - 1].Count - 1], newLine[0][0]); + value[1] = getDistance(line[line.PartCount - 1][line[line.PartCount - 1].Count - 1], newLine[newLine.PartCount - 1][newLine[newLine.PartCount - 1].Count - 1]); + value[2] = getDistance(line[0][0], newLine[0][0]); + value[3] = getDistance(line[0][0], newLine[newLine.PartCount - 1][newLine[newLine.PartCount - 1].Count - 1]); + double minValue = value[0]; + for (int m = 1; m < value.Length; m++) + { + if (minValue > value[m]) + { + minValue = value[m]; + minValueIndex = m; + } + } + if (minValue < limitValue) + { + GSOFeature featureFromAllSelectedObj = new GSOFeature(); + GSOGeoPolyline3D lineFromAllSelectedObj = new GSOGeoPolyline3D(); + switch (minValueIndex) + { + case 0: + GSOPoint3ds linePart = new GSOPoint3ds(); + for (int i = 0; i < line.PartCount; i++) + { + for (int j = 0; j < line[i].Count; j++) + { + linePart.Add(line[i][j]); + } + } + for (int i = 0; i < newLine.PartCount; i++) + { + for (int j = 0; j < newLine[i].Count; j++) + { + linePart.Add(newLine[i][j]); + } + } + lineFromAllSelectedObj.AddPart(linePart); + break; + case 1: + linePart = new GSOPoint3ds(); + for (int i = 0; i < line.PartCount; i++) + { + for (int j = 0; j < line[i].Count; j++) + { + linePart.Add(line[i][j]); + } + } + for (int i = newLine.PartCount - 1; i >= 0; i--) + { + for (int j = newLine[i].Count - 1; j >= 0; j--) + { + linePart.Add(newLine[i][j]); + } + } + lineFromAllSelectedObj.AddPart(linePart); + break; + case 2: + linePart = new GSOPoint3ds(); + for (int i = line.PartCount - 1; i >= 0; i--) + { + for (int j = line[i].Count - 1; j >= 0; j--) + { + linePart.Add(line[i][j]); + } + } + for (int i = 0; i < newLine.PartCount; i++) + { + for (int j = 0; j < newLine[i].Count; j++) + { + linePart.Add(newLine[i][j]); + } + } + lineFromAllSelectedObj.AddPart(linePart); + break; + case 3: + linePart = new GSOPoint3ds(); + for (int i = line.PartCount - 1; i >= 0; i--) + { + for (int j = line[i].Count - 1; j >= 0; j--) + { + linePart.Add(line[i][j]); + } + } + for (int i = newLine.PartCount - 1; i >= 0; i--) + { + for (int j = newLine[i].Count - 1; j >= 0; j--) + { + linePart.Add(newLine[i][j]); + } + } + lineFromAllSelectedObj.AddPart(linePart); + break; + } + + featureFromAllSelectedObj.Geometry = lineFromAllSelectedObj; + + selectFeatures.Remove(n); + selectFeatures.Remove(p); + selectFeatures.Add(featureFromAllSelectedObj); + p--; + break; + } + } + } + } + } + + for (int h = 0; h < selectFeatures.Length; h++) + { + result.Add(selectFeatures[h]); + } + return result; + } + + private static double getDistance(GSOPoint3d point1, GSOPoint3d point2) + { + GSOGeoPolyline3D lineline = new GSOGeoPolyline3D(); + GSOPoint3ds point3ds = new GSOPoint3ds(); + point3ds.Add(point1); + point3ds.Add(point2); + lineline.AddPart(point3ds); + + double distance = lineline.GetSpaceLength(true, 6378137.0); + return distance; + } + + + + } +} \ No newline at end of file diff --git a/obj/x64/Debug/Cyberpipe.FrmHDMAnalysis3.resources b/obj/x64/Debug/Cyberpipe.FrmHDMAnalysis3.resources index 6c05a97..3c2db6a 100644 --- a/obj/x64/Debug/Cyberpipe.FrmHDMAnalysis3.resources +++ b/obj/x64/Debug/Cyberpipe.FrmHDMAnalysis3.resources Binary files differ diff --git a/obj/x64/Debug/Cyberpipe.csproj.FileListAbsolute.txt b/obj/x64/Debug/Cyberpipe.csproj.FileListAbsolute.txt index 326e5c4..ada21ca 100644 --- a/obj/x64/Debug/Cyberpipe.csproj.FileListAbsolute.txt +++ b/obj/x64/Debug/Cyberpipe.csproj.FileListAbsolute.txt @@ -298,7 +298,6 @@ F:\predator\codeReview\GHFX_SZ_64\obj\x64\Debug\Cyberpipe.FrmRegionTypeMgr.resources F:\predator\codeReview\GHFX_SZ_64\obj\x64\Debug\Cyberpipe.FrmRESC.resources F:\predator\codeReview\GHFX_SZ_64\obj\x64\Debug\Cyberpipe.FrmRESCMgr.resources -F:\predator\codeReview\GHFX_SZ_64\obj\x64\Debug\Cyberpipe.FrmRoadHDM.resources F:\predator\codeReview\GHFX_SZ_64\obj\x64\Debug\Cyberpipe.FrmRole.resources F:\predator\codeReview\GHFX_SZ_64\obj\x64\Debug\Cyberpipe.FrmRoleMgr.resources F:\predator\codeReview\GHFX_SZ_64\obj\x64\Debug\Cyberpipe.FrmSetGoalLayer.resources diff --git a/Cyberpipe.csproj b/Cyberpipe.csproj index d24ccfc..cd0296f 100644 --- a/Cyberpipe.csproj +++ b/Cyberpipe.csproj @@ -228,6 +228,7 @@ F_GKT1添加项目.cs + @@ -938,12 +939,6 @@ FrmRESCMgr.cs - - Form - - - FrmRoadHDM.cs - Form @@ -1166,6 +1161,7 @@ + @@ -1611,10 +1607,6 @@ FrmRESCMgr.cs Designer - - FrmRoadHDM.cs - Designer - FrmRole.cs Designer diff --git a/EnumEventMode.cs b/EnumEventMode.cs new file mode 100644 index 0000000..b5eba59 --- /dev/null +++ b/EnumEventMode.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace Cyberpipe +{ + //横断面分析、基线剖面分析、道路断面分析 + public enum EnumTrackPolylineEndMode + { + Default_Analysis = 0, //无分析 + HDM_Analysis = 1, //横断面分析 + DLDM_Analysis = 2,//道路断面分析 + JXPM_Analysis = 3, //基线剖面分析 + } + + class EnumEventMode + { + } +} diff --git a/FrmHDMAnalysis3.cs b/FrmHDMAnalysis3.cs index 5e5988c..6405ed7 100644 --- a/FrmHDMAnalysis3.cs +++ b/FrmHDMAnalysis3.cs @@ -16,206 +16,72 @@ { public partial class FrmHDMAnalysis3 : DevComponents.DotNetBar.Office2007Form { - private ArrayList listPoint = new ArrayList(); - private ArrayList listFeat = new ArrayList(); - GSOGeoPolyline3D line = new GSOGeoPolyline3D(); //创建线对象 - - private static FrmHDMAnalysis3 allPipelineAnalysis = null; - public bool isShowFirst = false; - - static ArrayList list = new ArrayList(); + static DataTable table = new DataTable(); - static DataTable showTable = new DataTable(); GSOGlobeControl globeControl1; - object[,] sortIndex; - GSOLayer layerTemp; - private FrmHDMAnalysis3() - { - - } - public static FrmHDMAnalysis3 GetForm(ArrayList arraylistP, ArrayList arraylistF, GSOGeoPolyline3D _line, GSOGlobeControl _ctl) - { - if (allPipelineAnalysis == null) - { - allPipelineAnalysis = new FrmHDMAnalysis3(arraylistP, arraylistF, _line,_ctl); - } - else - { - allPipelineAnalysis.listPoint = arraylistP; - allPipelineAnalysis.listFeat = arraylistF; - allPipelineAnalysis.line = _line; - allPipelineAnalysis.globeControl1 = _ctl; - list = new ArrayList(); - } - return allPipelineAnalysis; - } + EnumTrackPolylineEndMode mode; - public FrmHDMAnalysis3(ArrayList arraylistP, ArrayList arraylistF, GSOGeoPolyline3D _line,GSOGlobeControl _ctl) + Dictionary hdmDic; + + public FrmHDMAnalysis3(Dictionary hdmDic, + GSOGlobeControl globeControl, EnumTrackPolylineEndMode mode) { InitializeComponent(); - this.listPoint = arraylistP; - this.listFeat = arraylistF; - line = _line; - globeControl1 = _ctl; + + this.hdmDic = hdmDic; + this.globeControl1 = globeControl; + this.mode = mode; } - double A_x, A_y, B_x, B_y;//定义坐标点,用来就横断面的长度 - /// - /// 窗体初始化事件处理 - /// - /// - /// - private void Frm_HDMAnalysis_Load(object sender, EventArgs e) + + private void initControls() { - layerTemp = globeControl1.Globe.Layers.Add(Application.StartupPath + "\\tempLgdExport.lgd"); - //chart1.ChartAreas[0].BackImage = Application.StartupPath + "\\Resource\\pipelineBackGround副本.png"; - } - /// - /// 窗体第一次显示事件处理 - /// - /// - /// - void Frm_HDMAnalysis2_Shown(object sender, EventArgs e) - { - isShowFirst = true; - - } - public void LoadChartEvent() - { - try - { - this.Shown += new EventHandler(Frm_HDMAnalysis2_Shown); - - chart1.Series["管线"].ChartType = SeriesChartType.Point; - - chart1.Series["管线"]["DrawingStyle"] = "Cylinder"; - chart1.Series["管线"].MarkerStyle = MarkerStyle.Circle; //点的类型 - - chart1.Series["管线"].MarkerBorderColor = Color.Black; //点的边框颜色 - chart1.ChartAreas[0].AxisX.Minimum = 0; //x轴的起始点大小 - chart1.ChartAreas[0].AxisY.Maximum = 0; //y轴的最大值 - - chart1.ChartAreas[0].AxisX.Title = "距离 (米)"; - chart1.ChartAreas[0].AxisY.Title = "埋深 (米)"; - - //chart1.ChartAreas[0].AxisX.ScrollBar.Enabled = true; - chart1.ChartAreas[0].AxisY2.Title = "高程 (米)"; - double[] depths = new double[listFeat.Count]; - for (int i = 0; i < listFeat.Count; i++) - { - GSOFeature f = listFeat[i] as GSOFeature; - double depth = f.GetFieldAsDouble("起始地面高程"); - depths[i] = depth; - } - double max_Depth = depths[0]; - for (int i = 0; i < listFeat.Count; i++) - { - if (max_Depth < depths[i]) - { - max_Depth = depths[i]; - } - } - chart1.ChartAreas[0].AxisY2.CustomLabels.Clear(); - chart1.ChartAreas[0].AxisY2.CustomLabels.Add(-5.4d, -5.6d, (max_Depth - 5.5).ToString("0.0")); - chart1.ChartAreas[0].AxisY2.CustomLabels.Add(-4.9d, -5.1d, (max_Depth - 5).ToString("0.0")); - chart1.ChartAreas[0].AxisY2.CustomLabels.Add(-4.4d, -4.6d, (max_Depth - 4.5).ToString("0.0")); - chart1.ChartAreas[0].AxisY2.CustomLabels.Add(-3.9d, -4.1d, (max_Depth - 4).ToString("0.0")); - chart1.ChartAreas[0].AxisY2.CustomLabels.Add(-3.4d, -3.6d, (max_Depth - 3.5).ToString("0.0")); - chart1.ChartAreas[0].AxisY2.CustomLabels.Add(-2.9d, -3.1d, (max_Depth - 3).ToString("0.0")); - chart1.ChartAreas[0].AxisY2.CustomLabels.Add(-2.4d, -2.6d, (max_Depth - 2.5).ToString("0.0")); - chart1.ChartAreas[0].AxisY2.CustomLabels.Add(-1.9d, -2.1d, (max_Depth - 2).ToString("0.0")); - chart1.ChartAreas[0].AxisY2.CustomLabels.Add(-1.4d, -1.6d, (max_Depth - 1.5).ToString("0.0")); - chart1.ChartAreas[0].AxisY2.CustomLabels.Add(-0.9d, -1.1d, (max_Depth - 1).ToString("0.0")); - chart1.ChartAreas[0].AxisY2.CustomLabels.Add(-0.4d, -0.6d, (max_Depth - 0.5).ToString("0.0")); - chart1.ChartAreas[0].AxisY2.CustomLabels.Add(-0.1d, 0.1d, max_Depth.ToString("0.0")); - - if (line.PartCount > 0) - { - GSOPoint3ds nodes = line[0]; - if (nodes.Count > 0) - { - GSOPoint3d node = nodes[0]; - A_x = node.X; - A_y = node.Y; - } - } - - DrawCurveGraph(A_x, A_y); - } - catch (Exception ex) - { - LogError.PublishError(ex); - } - } - - /// - /// 创建图表 - /// - /// - /// - private void DrawCurveGraph(double a_x,double a_y) - { - // 遍历线,求距离 - table = new DataTable(); - //showTable.Columns.Clear(); - list.Clear(); + chart1.Series["管线"].ChartType = SeriesChartType.Point; + chart1.Series["管线"]["DrawingStyle"] = "Cylinder"; + chart1.Series["管线"].MarkerStyle = MarkerStyle.Circle; //点的类型 + chart1.Series["管线"].MarkerBorderColor = Color.Black; //点的边框颜色 + //chart1.ChartAreas[0].AxisX.Minimum = 0; //x轴的起始点大小 + chart1.ChartAreas[0].AxisY.Maximum = 0; //y轴的最大值 + chart1.ChartAreas[0].AxisX.Title = "距离 (米)"; + chart1.ChartAreas[0].AxisY.Title = "埋深 (米)"; + chart1.ChartAreas[0].AxisY2.Title = "高程 (米)"; chart1.Series["管线"].Points.Clear(); - chart1.ChartAreas[0].AxisX.Maximum = Math.Round(line.GetSpaceLength(true, 6378137),2); + //chart1.ChartAreas[0].AxisX.Maximum = Math.Round(line.GetSpaceLength(true, 6378137), 2); + table.Columns.Add("编号", typeof(string)); table.Columns.Add("管线类型", typeof(string)); table.Columns.Add("管线编码", typeof(string)); table.Columns.Add("管径_毫米", typeof(string)); table.Columns.Add("材质", typeof(string)); - table.Columns.Add("管线埋深", typeof(string)); + table.Columns.Add("管线埋深", typeof(string)); - sortIndex = new object[listPoint.Count, 2]; - for (int i = 0; i <= listPoint.Count; i++) + if (mode == EnumTrackPolylineEndMode.DLDM_Analysis) { - if (i == listPoint.Count) - { - double maxNum = 0.0; - for (int j = 0; j < listPoint.Count; j++) - { - if (maxNum < Convert.ToDouble(sortIndex[j, 0])) - { - maxNum = Convert.ToDouble(sortIndex[j, 0]); - } - } - chart1.Series["管线"].Points.AddXY(maxNum + 2, 0); - chart1.Series["管线"].Points[i].MarkerBorderWidth = 100; //边框的宽度 - chart1.Series["管线"].Points[i].MarkerColor = Color.Black; - chart1.Series["管线"].Points[i].MarkerSize = 100; - continue; - } - GSOPoint3d geoPoint = (GSOPoint3d)listPoint[i]; - GSOFeature feature = listFeat[i] as GSOFeature; - //坐标投影 - int id = GeoScene.Data.GSOProjectManager.AddProject(Utility.projectStr); + this.pictureBox1.Visible = true; + } + else + { + this.pictureBox1.Visible = false; + } + } - GeoScene.Data.GSOPoint2d a_Point = GeoScene.Data.GSOProjectManager.Forward(new GSOPoint2d(a_x, a_y), id);//user画的线的起始点 + private void draw() + { + int i = 0; + foreach (KeyValuePair kvp in this.hdmDic) + { + GSOFeature feature = kvp.Key; + HDMCoordinate coor = kvp.Value; - GeoScene.Data.GSOPoint2d pt2d = new GeoScene.Data.GSOPoint2d(geoPoint.X, geoPoint.Y); - GeoScene.Data.GSOPoint2d result = GeoScene.Data.GSOProjectManager.Forward(pt2d, id); - B_x = result.X; - B_y = result.Y; + chart1.Series["管线"].Points.AddXY(coor.Dis, coor.Z);//绑定数据 - double x = System.Math.Abs(B_x - a_Point.X); - double y = System.Math.Abs(B_y - a_Point.Y); - double Dis = 0.0; - Dis = Math.Round(Math.Sqrt(x * x + y * y) , 2); - list.Add(geoPoint.Z); - sortIndex[i, 0] = Dis; - sortIndex[i, 1] = i; - - chart1.Series["管线"].Points.AddXY(Dis, geoPoint.Z);//绑定数据 - - string pipeType = feature.Dataset == null ? "" : feature.Dataset.Caption; + string pipeType = feature.Dataset == null ? "" : feature.Dataset.Caption; string number = Convert.ToString(i + 1); - string material = feature.GetFieldAsString("材质"); string diameter = feature.GetFieldAsString("管径_毫米"); - table.Rows.Add(new object[] { number, pipeType, feature.Name.ToString(), diameter, material,Convert.ToDecimal(list[i].ToString()).ToString("f2")});//list[i].ToString().Substring(0,list[i].ToString().IndexOf('.')+3) } - - //chart1.Series["管线"].Points[i].Label = number;//管线的标签 + table.Rows.Add(new object[] { number, + pipeType, feature.Name.ToString(), + diameter, material, + Convert.ToDecimal(coor.Z).ToString("f2") }); chart1.Series["管线"].Points[i].LegendText = number; if (feature.Geometry.Style.GetType() == typeof(GSOPipeLineStyle3D)) { @@ -229,47 +95,12 @@ chart1.Series["管线"].Points[i].MarkerBorderWidth = 3; //边框的宽度 chart1.Series["管线"].Points[i].MarkerColor = Color.Transparent; - chart1.Series["管线"].Points[i].MarkerSize = Convert.ToInt32(Math.Floor((feature.GetFieldAsDouble("管径_毫米") / 0.35 + chart1.Series["管线"].Points[i].MarkerBorderWidth) / 100.0));//点的大小 - + chart1.Series["管线"].Points[i].MarkerSize = Convert.ToInt32(Math.Floor((feature.GetFieldAsDouble("管径_毫米") / 0.35 + + chart1.Series["管线"].Points[i].MarkerBorderWidth) / 100.0)); + i++; } - - string htmlCode = "" + - "" + - "" + - "
管线类型管线编码管径_毫米材质管线埋深
" + - "" + - "" + - "" + - "" + - "
"; - webBrowser1.DocumentText = htmlCode; } + /// /// 图表的鼠标单击事件处理 /// @@ -286,14 +117,11 @@ return; } string number = p.LegendText; - //MessageBox.Show(number); int indexInTableRows = 0; bool isInt = int.TryParse(number, out indexInTableRows); if (isInt) { DataRow row = table.Rows[indexInTableRows - 1]; - //showTable.Rows.Clear(); - //showTable.Rows.Add(new object[] { row[0], row[1], row[2], row[3], row[4], row[5] }); string htmlCode = "" + - "" + - "" + - "
管线类型管线编码管径_毫米材质管线埋深
" + - "" + - "" + - "" + - "" + - "
"; - webBrowser1.DocumentText = htmlCode; - - - } - /// - /// 图表鼠标单击事件处理 - /// - /// - /// - private void chart1_MouseClick(object sender, MouseEventArgs e) - { - HitTestResult result = chart1.HitTest(e.X, e.Y, true); - if (result.PointIndex >= 0) - { - DataPoint p = (DataPoint)result.Object; - if (p == null) - { - return; - } - string number = p.LegendText; - int indexInTableRows = 0; - bool isInt = int.TryParse(number, out indexInTableRows); - if (isInt) - { - DataRow row = table.Rows[indexInTableRows - 1]; - string htmlCode = "" + - "" + - "" + - "
管线类型管线编码管径_毫米材质管线埋深
" + row[1] + - "" + row[2] + - "" + row[3] + - "" + row[4] + - "" + row[5] + - "
"; - webBrowser1.DocumentText = htmlCode; - } - } - } - /// - /// 窗体关闭事件处理 - /// - /// - /// - private void FrmRoadHDM_FormClosing(object sender, FormClosingEventArgs e) - { - allPipelineAnalysis = null; - globeControl1.Globe.MemoryLayer.RemoveAllFeature(); - } - /// - /// 图表鼠标移动事件处理 - /// - /// - /// - private void chart1_MouseMove(object sender, MouseEventArgs e) - { - HitTestResult result = chart1.HitTest(e.X, e.Y, true); - if (result.PointIndex >= 0) - { - this.Cursor = Cursors.Hand; - } - else - { - this.Cursor = Cursors.Default; - } - } - - private void Export(GSOPoint3d _pnt, double r) - { - GSOPoint3ds pnts = new GSOPoint3ds(); - GSOPoint3d pnt = new GSOPoint3d(); - pnt.X = _pnt.X; - pnt.Y = _pnt.Y; - pnt.Z = _pnt.Z; - pnts.Add(pnt); - pnt.X = _pnt.X; - pnt.Y = _pnt.Y - 0.0000000005; - pnt.Z = _pnt.Z; - pnts.Add(pnt); - GSOGeoPolyline3D line = new GSOGeoPolyline3D(); - line.AddPart(pnts); - GSOGeoPolygon3D polygon = line.CreateBuffer(r * 2, true, 5, true, false); - GSOPoint3ds points = polygon[0]; - GSOGeoPolyline3D newLine = new GSOGeoPolyline3D(); - newLine.AddPart(points); - newLine.AltitudeMode = EnumAltitudeMode.RelativeToGround; - GSOFeature newFeature = new GSOFeature(); - newFeature.Geometry = newLine; - globeControl1.Globe.MemoryLayer.AddFeature(newFeature); - } - - private void ExportCAD(double a, double b, double r) - { - GSOPoint3ds pnts = new GSOPoint3ds(); - for (int i = 0; i <= 64; i++) - { - double x = a + r * Math.Cos(i * 5.625 * Math.PI / 180); - double y = b - r * Math.Sin(i * 5.625 * Math.PI / 180); - GSOPoint2d pt2d = new GeoScene.Data.GSOPoint2d(x, y); - GSOPoint3d pnt = new GSOPoint3d(); - pnt.X = pt2d.X; - pnt.Y = pt2d.Y; - pnt.Z = 0; - pnts.Add(pnt); - } - GSOGeoPolyline3D line = new GSOGeoPolyline3D(); - line.AddPart(pnts); - GSOFeature f = new GSOFeature(); - f.Geometry = line; - f.Geometry.LatLonCoord = false; - f.Visible = false; - layerTemp.AddFeature(f); - } - /// - /// 导出CAD按钮事件处理 - /// - /// - /// - private void btnExportCAD_Click(object sender, EventArgs e) - { - layerTemp.RemoveAllFeature(); - for (int i = 0; i < listPoint.Count; i++) - { - GSOPoint3d geoPoint = (GSOPoint3d)listPoint[i]; - GSOFeature feature = listFeat[i] as GSOFeature; - if (feature != null) - { - if (feature.Geometry.Type == EnumGeometryType.GeoPolyline3D) - { - GSOPipeLineStyle3D style = feature.Geometry.Style as GSOPipeLineStyle3D; - double r = style.Radius; - ExportCAD(double.Parse(sortIndex[i, 0].ToString()), geoPoint.Z, r); - } - } - } - layerTemp.Dataset.ImportProjectionRefFromProj4(""); - SaveFileDialog dlg = new SaveFileDialog(); - dlg.Filter = "*.dxf|*.dxf"; - if (dlg.ShowDialog() == DialogResult.OK) - { - layerTemp.SaveAs(dlg.FileName); - MessageBox.Show("导出CAD完成!", "提示"); - } - layerTemp.RemoveAllFeature(); - } - } -} diff --git a/FrmRoadHDM.designer.cs b/FrmRoadHDM.designer.cs deleted file mode 100644 index 23a4c3b..0000000 --- a/FrmRoadHDM.designer.cs +++ /dev/null @@ -1,132 +0,0 @@ -namespace Cyberpipe -{ - partial class FrmRoadHDM - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmRoadHDM)); - System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea1 = new System.Windows.Forms.DataVisualization.Charting.ChartArea(); - System.Windows.Forms.DataVisualization.Charting.Series series1 = new System.Windows.Forms.DataVisualization.Charting.Series(); - this.pictureBox1 = new System.Windows.Forms.PictureBox(); - this.webBrowser1 = new System.Windows.Forms.WebBrowser(); - this.chart1 = new System.Windows.Forms.DataVisualization.Charting.Chart(); - this.btnExportCAD = new DevComponents.DotNetBar.ButtonX(); - ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.chart1)).BeginInit(); - this.SuspendLayout(); - // - // pictureBox1 - // - this.pictureBox1.BackColor = System.Drawing.Color.White; - this.pictureBox1.Dock = System.Windows.Forms.DockStyle.Top; - this.pictureBox1.ErrorImage = null; - this.pictureBox1.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image"))); - this.pictureBox1.ImageLocation = ""; - this.pictureBox1.Location = new System.Drawing.Point(0, 0); - this.pictureBox1.Name = "pictureBox1"; - this.pictureBox1.Size = new System.Drawing.Size(608, 64); - this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; - this.pictureBox1.TabIndex = 1; - this.pictureBox1.TabStop = false; - // - // webBrowser1 - // - this.webBrowser1.Dock = System.Windows.Forms.DockStyle.Bottom; - this.webBrowser1.Location = new System.Drawing.Point(0, 326); - this.webBrowser1.MinimumSize = new System.Drawing.Size(20, 20); - this.webBrowser1.Name = "webBrowser1"; - this.webBrowser1.ScrollBarsEnabled = false; - this.webBrowser1.Size = new System.Drawing.Size(608, 139); - this.webBrowser1.TabIndex = 3; - // - // chart1 - // - chartArea1.AxisX.MajorGrid.Enabled = false; - chartArea1.Name = "ChartArea1"; - this.chart1.ChartAreas.Add(chartArea1); - this.chart1.Location = new System.Drawing.Point(0, 66); - this.chart1.Name = "chart1"; - this.chart1.RightToLeft = System.Windows.Forms.RightToLeft.Yes; - series1.ChartArea = "ChartArea1"; - series1.Name = "管线"; - this.chart1.Series.Add(series1); - this.chart1.Size = new System.Drawing.Size(608, 254); - this.chart1.TabIndex = 2; - this.chart1.Text = "chart1"; - this.chart1.MouseClick += new System.Windows.Forms.MouseEventHandler(this.chart1_MouseClick); - this.chart1.MouseMove += new System.Windows.Forms.MouseEventHandler(this.chart1_MouseMove); - // - // btnExportCAD - // - this.btnExportCAD.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; - this.btnExportCAD.Anchor = System.Windows.Forms.AnchorStyles.Bottom; - this.btnExportCAD.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground; - this.btnExportCAD.Location = new System.Drawing.Point(268, 430); - this.btnExportCAD.Name = "btnExportCAD"; - this.btnExportCAD.Size = new System.Drawing.Size(75, 23); - this.btnExportCAD.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; - this.btnExportCAD.TabIndex = 4; - this.btnExportCAD.Text = "导出CAD"; - this.btnExportCAD.Click += new System.EventHandler(this.btnExportCAD_Click); - // - // FrmRoadHDM - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.BackColor = System.Drawing.Color.White; - this.ClientSize = new System.Drawing.Size(608, 465); - this.Controls.Add(this.btnExportCAD); - this.Controls.Add(this.chart1); - this.Controls.Add(this.webBrowser1); - this.Controls.Add(this.pictureBox1); - this.DoubleBuffered = true; - this.EnableGlass = false; - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; - this.MaximizeBox = false; - this.Name = "FrmRoadHDM"; - this.ShowIcon = false; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; - this.Text = "道路与管线综合横断面"; - this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FrmRoadHDM_FormClosing); - this.Load += new System.EventHandler(this.FrmRoadHDM_Load); - this.Shown += new System.EventHandler(this.FrmRoadHDM_Shown); - ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.chart1)).EndInit(); - this.ResumeLayout(false); - - } - - #endregion - - private System.Windows.Forms.PictureBox pictureBox1; - private System.Windows.Forms.WebBrowser webBrowser1; - private System.Windows.Forms.DataVisualization.Charting.Chart chart1; - private DevComponents.DotNetBar.ButtonX btnExportCAD; - - - } -} \ No newline at end of file diff --git a/FrmRoadHDM.resx b/FrmRoadHDM.resx deleted file mode 100644 index 5202d5f..0000000 --- a/FrmRoadHDM.resx +++ /dev/null @@ -1,177 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - - - 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 - iNKUe3NRsLcAAAAASUVORK5CYII= - - - \ No newline at end of file diff --git a/MainFrm.cs b/MainFrm.cs index e9b6cbe..2df3aac 100644 --- a/MainFrm.cs +++ b/MainFrm.cs @@ -75,15 +75,6 @@ private string trackflag;//定义阀门查询个数 - private GSOFeature m_ConnexityAnalysisFirstFeature; - private GSOFeature m_ConnexityAnaylsisSecondFeature; - private GSOLayer m_ConnexityAnalysisFirstLayer; - private GSOLayer m_COnnexityAnalysisSecondLayer; - private GSOFeatures m_ConnexityAnalyResFeatures; - private GSOFeatures m_TraceUpDownAnalyResFeatures; - private GSOFeatures m_AffectedPipeLines; - private GSOFeatures m_CloseValvesAnalyResFeatures; - private GSOFeatures m_BoosterValvesAnalyResFeatures; //管线间距分析 private GSOFeature disFeature = new GSOFeature(); private GSOFeature featureDis = new GSOFeature(); @@ -2656,8 +2647,37 @@ ///
/// /// + private static EnumTrackPolylineEndMode trackPolylineEndMode; + void globeControl1_TrackPolylineEndEvent(object sender, TrackPolylineEndEventArgs e) { + //横断面分析、道路横断面分析 + if (trackPolylineEndMode == EnumTrackPolylineEndMode.HDM_Analysis|| + trackPolylineEndMode == EnumTrackPolylineEndMode.DLDM_Analysis) + { + Dictionary hdmDic = SectionAnalysisTool.HDMAnalysis(this.globeControl1, + e.Polyline, this.m_PipelineLayerNames); + FrmHDMAnalysis3 frm = new FrmHDMAnalysis3(hdmDic, this.globeControl1, + trackPolylineEndMode); + frm.Show(this); + } + //基线剖面分析 + else if (trackPolylineEndMode == EnumTrackPolylineEndMode.JXPM_Analysis) + { + FrmBaseLineProfillAnalysis dlg = new FrmBaseLineProfillAnalysis(globeControl1.Globe, e.Polyline); + dlg.Show(this); + globeControl1.Globe.ClearLastTrackPolyline(); + /* + FrmRoadHDM f = new FrmRoadHDM(); + f.Show() + * **/ + } + else + { + + } + trackPolylineEndMode = EnumTrackPolylineEndMode.Default_Analysis; + /* ArrayList arraylistPoint = new ArrayList(); ArrayList arraylistLine = new ArrayList(); @@ -2835,6 +2855,7 @@ } globeControl1.Globe.Action = EnumAction3D.ActionNull; ActionToolMenuChecked(); + * **/ } #endregion @@ -4962,10 +4983,10 @@ if (globeControl1.Globe.Action != EnumAction3D.NormalHit) { buttonItemFX3_6.Checked = false; - ClearConnexityAnalysis(); + // ClearConnexityAnalysis(); buttonItemFX3_5.Checked = false; - ClearCloseValvesAnalysis(); + // ClearCloseValvesAnalysis(); } if (globeControl1.Globe.Action != EnumAction3D.TrackPolygon) { @@ -4973,131 +4994,7 @@ buttonItemFX4_1.Checked = false; } } - /// - /// 连通性分析 功能 - /// - private void ConnexityAnalysis() - { - GSODataset curCAYDataset = m_ConnexityAnalysisFirstLayer.Dataset; - string srName = curCAYDataset.Name; - GSONetworkDataset curCAYNDataset = curCAYDataset.DataSource.GetDatasetByName(srName + "Network") as GSONetworkDataset; - if (curCAYNDataset == null) - { - MessageBox.Show("该图层没有创建网络拓扑,请先创建网络拓扑信息再进行分析!", "提示"); - return; - } - int[] arryResID; - curCAYNDataset.ConnexityAnalysis(m_ConnexityAnalysisFirstFeature.ID, m_ConnexityAnaylsisSecondFeature.ID, out arryResID, false, true); - m_ConnexityAnalyResFeatures = m_ConnexityAnalysisFirstLayer.GetFeaturesByIDs(arryResID); - if (m_ConnexityAnalyResFeatures == null || m_ConnexityAnalyResFeatures.Length < 1) - { - String strLine1 = "管线:" + m_ConnexityAnalysisFirstFeature.ID; - String strLine2 = "管线:" + m_ConnexityAnaylsisSecondFeature.ID; - MessageBox.Show(strLine1 + " 与 " + strLine2 + " 不连通", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); - } - else - { - int nCount = m_ConnexityAnalyResFeatures.Length; - for (int i = 0; i < nCount; i++) - { - m_ConnexityAnalyResFeatures[i].HighLight = true; - GSOGeoPolyline3D geoline = m_ConnexityAnalyResFeatures[i].Geometry as GSOGeoPolyline3D; - if (geoline != null) - { - GSOLineStyle3D lineStyle = geoline.Style as GSOLineStyle3D; - if (lineStyle != null) - { - if (lineStyle.ArrowStyle == null) - { - lineStyle.ArrowStyle = new GSOArrowStyle(); - - } - lineStyle.ArrowStyle.BodyLen = 8; - lineStyle.ArrowVisible = true; - lineStyle.ArrowStyle.Play(); - } - } - } - globeControl1.Refresh(); - } - } - /// - /// 清除连通性分析结果 功能 - /// - private void ClearConnexityAnalysis() - { - if (m_ConnexityAnalysisFirstFeature != null) - { - m_ConnexityAnalysisFirstFeature.HighLight = false; - m_ConnexityAnalysisFirstFeature.Label = null; - } - if (m_ConnexityAnaylsisSecondFeature != null) - { - m_ConnexityAnaylsisSecondFeature.HighLight = false; - m_ConnexityAnaylsisSecondFeature.Label = null; - } - - m_ConnexityAnalysisFirstFeature = null; - m_ConnexityAnaylsisSecondFeature = null; - m_ConnexityAnalysisFirstLayer = null; - m_COnnexityAnalysisSecondLayer = null; - - if (m_ConnexityAnalyResFeatures != null) - { - int nCount = m_ConnexityAnalyResFeatures.Length; - - for (int i = 0; i < nCount; i++) - { - m_ConnexityAnalyResFeatures[i].HighLight = false; - GSOGeoPolyline3D geoline = m_ConnexityAnalyResFeatures[i].Geometry as GSOGeoPolyline3D; - if (geoline != null) - { - GSOLineStyle3D lineStyle = geoline.Style as GSOLineStyle3D; - if (lineStyle != null) - { - lineStyle.ArrowVisible = false; - } - } - } - m_ConnexityAnalyResFeatures = null; - - } - } - /// - /// 清除阀门分析结果 功能 - /// - private void ClearCloseValvesAnalysis() - { - if (m_CloseValvesAnalyResFeatures != null) - { - for (int i = 0; i < m_CloseValvesList.Count; i++) - { - GSOFeature feature = m_CloseValvesList[i] as GSOFeature; - feature.Label.Text = ""; - } - globeControl1.Refresh(); - m_CloseValvesAnalyResFeatures = null; - m_CloseValvesList = new ArrayList(); - } - } - /// - /// 清除阀门分析结果 功能 - /// - private void ClearBoosterValvesAnalysis() - { - if (m_BoosterValvesAnalyResFeatures != null) - { - for (int i = 0; i < m_BoosterValvesList.Count; i++) - { - GSOFeature feature = m_BoosterValvesList[i] as GSOFeature; - feature.Label.Text = ""; - } - globeControl1.Refresh(); - m_BoosterValvesAnalyResFeatures = null; - m_BoosterValvesList = new ArrayList(); - } - } /// /// 主窗体关闭事件处理 /// @@ -5118,211 +5015,7 @@ //注销id号为103的热键设定 // UnregisterHotKey(Handle, 103); } - /// - /// 清除追踪结果 功能 : Fan 可去掉了! - /// - private void ClearUpDownTraceAnalysis() - { - if (m_TraceUpDownAnalyResFeatures != null) - { - int nCount = m_TraceUpDownAnalyResFeatures.Length; - for (int i = 0; i < nCount; i++) - { - m_TraceUpDownAnalyResFeatures[i].HighLight = false; - GSOGeoPolyline3D geoline = m_TraceUpDownAnalyResFeatures[i].Geometry as GSOGeoPolyline3D; - if (geoline != null) - { - GSOLineStyle3D lineStyle = geoline.Style as GSOLineStyle3D; - if (lineStyle != null) - { - lineStyle.ArrowVisible = false; - } - } - } - m_TraceUpDownAnalyResFeatures = null; - } - } - /// - /// 取消所有高亮管线的高亮状态 - /// - private void ClearAffectedPipeLine() - { - if (m_AffectedPipeLines != null) - { - int nCount = m_AffectedPipeLines.Length; - for (int i = 0; i < nCount; i++) - { - m_AffectedPipeLines[i].HighLight = false; - } - m_AffectedPipeLines = null; - } - } - #region Fan 拓扑分析 - /// - /// 上下游追踪 功能 - /// - /// - private void NetworkTraceUpDown(Boolean bTraceUp) - { - GSOFeature selLineFeature = globeControl1.Globe.SelectedObject; - if (selLineFeature == null || selLineFeature.Geometry == null || selLineFeature.Geometry.Type != EnumGeometryType.GeoPolyline3D) - { - MessageBox.Show("请点击“编辑”—“选中对象”选择一条线!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); - return; - } - GSOLayer selLayer = globeControl1.Globe.SelectedObjectLayer; - - NetworkAnalysisTool.TraceUpDownAnalysis(bTraceUp, - selLineFeature, selLayer); - /* - if (globeControl1.Globe.SelectedObject == null) - { - MessageBox.Show("请点击“编辑”—“选中对象”选择一条线!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); - return; - } - GSOFeature selLineFeature = globeControl1.Globe.SelectedObject; - - if (selLineFeature.Geometry == null || selLineFeature.Geometry.Type != EnumGeometryType.GeoPolyline3D) - { - MessageBox.Show("请点击“编辑”—“选中对象”选择一条线!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); - return; - } - - if (globeControl1.Globe.SelectedObjectLayer == null) - { - MessageBox.Show("选中管线所在图层为空!", "提示"); - return; - } - - GSODataset curCAYDataset = globeControl1.Globe.SelectedObjectLayer.Dataset; - if (curCAYDataset == null || curCAYDataset.DataSource == null) - { - MessageBox.Show("选中管线所在图层不是数据库图层!", "提示"); - return; - } - - string srName = curCAYDataset.Name; - GSONetworkDataset curCAYNDataset = curCAYDataset.DataSource.GetDatasetByName(srName + "Network") as GSONetworkDataset; - - if (curCAYNDataset == null) - { - MessageBox.Show("选中管线所在图层没有创建拓扑!", "提示"); - return; - } - - int[] arryResID; - curCAYNDataset.TraceUpDownAnalysis(selLineFeature.ID, out arryResID, bTraceUp, false, true); - m_TraceUpDownAnalyResFeatures = globeControl1.Globe.SelectedObjectLayer.GetFeaturesByIDs(arryResID); - if (m_TraceUpDownAnalyResFeatures == null || m_TraceUpDownAnalyResFeatures.Length < 1) - { - String strLine1 = "没有上游!"; - if (!bTraceUp) - { - strLine1 = "没有下游!"; - - } - MessageBox.Show(strLine1); - } - else - { - int nCount = m_TraceUpDownAnalyResFeatures.Length; - for (int i = 0; i < nCount; i++) - { - m_TraceUpDownAnalyResFeatures[i].HighLight = true; - GSOGeoPolyline3D geoline = m_TraceUpDownAnalyResFeatures[i].Geometry as GSOGeoPolyline3D; - if (geoline != null) - { - GSOLineStyle3D lineStyle = geoline.Style as GSOLineStyle3D; - if (lineStyle != null) - { - if (lineStyle.ArrowStyle == null) - { - lineStyle.ArrowStyle = new GSOArrowStyle(); - lineStyle.ArrowStyle.BodyWidth = 2; - lineStyle.ArrowStyle.BodyLen = 6; - lineStyle.ArrowStyle.HeadWidth = 8; - lineStyle.ArrowStyle.HeadLen = 10; - lineStyle.ArrowStyle.OutlineVisible = true; - lineStyle.ArrowStyle.OutlineColor = Color.Red; - lineStyle.ArrowStyle.Speed = lineStyle.ArrowStyle.Speed / 2; - } - lineStyle.ArrowVisible = true; - lineStyle.ArrowStyle.Play(); - } - } - } - globeControl1.Refresh(); - } - * **/ - } - - #endregion - /// - /// 上下游追踪 功能 - /// - /// - private void AffectedPipeLine(Boolean bTraceUp) - { - if (globeControl1.Globe.SelectedObject == null) - { - MessageBox.Show("请点击“编辑”—“选中对象”选择一条线!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); - return; - } - GSOFeature selLineFeature = globeControl1.Globe.SelectedObject; - if (selLineFeature.Geometry == null || selLineFeature.Geometry.Type != EnumGeometryType.GeoPolyline3D) - { - MessageBox.Show("请点击“编辑”—“选中对象”选择一条线!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); - - return; - } - - if (globeControl1.Globe.SelectedObjectLayer == null) - { - return; - } - - GSODataset curCAYDataset = globeControl1.Globe.SelectedObjectLayer.Dataset; - if (curCAYDataset == null || curCAYDataset.DataSource == null) - { - return; - } - - string srName = curCAYDataset.Name; - GSONetworkDataset curCAYNDataset = curCAYDataset.DataSource.GetDatasetByName(srName + "Network") as GSONetworkDataset; - - if (curCAYNDataset == null) - { - return; - } - int[] arryResID; - curCAYNDataset.TraceUpDownAnalysis(selLineFeature.ID, out arryResID, bTraceUp, false, true); - m_AffectedPipeLines = globeControl1.Globe.SelectedObjectLayer.GetFeaturesByIDs(arryResID); - if (m_AffectedPipeLines == null || m_AffectedPipeLines.Length < 1) - { - } - else - { - int nCount = m_AffectedPipeLines.Length; - for (int i = 0; i < nCount; i++) - { - m_AffectedPipeLines[i].HighLight = true; - } - globeControl1.Refresh(); - } - } - /// - /// 清除上下游追踪结果 菜单 - /// - /// - /// - //private void buttonItem58_Click(object sender, EventArgs e) - //{ - // //日志记录 - // LogManager.saveLog(Utility.userName, this.buttonItem58.Text); - - // ClearUpDownTraceAnalysis(); - //} - + /// /// 显示流向 功能 /// @@ -5359,158 +5052,8 @@ } FrmCloseValves frm; - /// - /// 关阀分析 功能 - /// - /// - /// - /// - /// - private bool NetworkCloseValvesAnalysis(GSOFeature lineFeature, GSOPoint3d pntBreak, GSOLayer lineLayer) - { - /* - if (lineLayer == null || lineFeature == null || lineFeature.Geometry == null || lineFeature.Geometry.Type != EnumGeometryType.GeoPolyline3D) - { - return false; - } - GSODataset curCAYDataset = lineLayer.Dataset; - if (curCAYDataset == null || curCAYDataset.DataSource == null) - { - MessageBox.Show("该图层不是要素图层!", "提示"); - return false; - } - string srName = curCAYDataset.Name; - GSONetworkDataset curCAYNDataset = curCAYDataset.DataSource.GetDatasetByName(srName + "Network") as GSONetworkDataset; - - if (curCAYNDataset == null) - { - MessageBox.Show("该图层没有创建网络拓扑,请先创建网络拓扑信息再进行分析!", "提示"); - return false; - } - ClearCloseValvesAnalysis(); - - int[] arryResNodeID = null; - int[] arryResValveID = null; - try - { - curCAYNDataset.CloseValveAnalysis(lineFeature.ID, out arryResNodeID, out arryResValveID, false, true); - } - catch (Exception e) - { } - - string valveName = lineLayer.Caption; - valveName = valveName.Substring(0, valveName.IndexOf("管线")); - GSOLayer valveLayer = globeControl1.Globe.Layers[valveName + "阀门"]; - if (valveLayer == null) - { - MessageBox.Show("和选中对象所在管线图层相关联的阀门图层不存在!", "提示"); - return false; - } - - m_CloseValvesAnalyResFeatures = valveLayer.GetFeaturesByIDs(arryResValveID);// curCAYNDataset.NodeDataset.GetFeaturesByIDs(arryResValveID); - - if (m_CloseValvesAnalyResFeatures == null || m_CloseValvesAnalyResFeatures.Length < 1) - { - MessageBox.Show("没有找到要关闭的阀门!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); - if (frm != null) - { - frm.Close(); - } - } - else - { - int nCount = m_CloseValvesAnalyResFeatures.Length; - - if (nCount > 0) - { - frm = FrmCloseValves.getForm(globeControl1, m_CloseValvesAnalyResFeatures, m_CloseValvesList); - - if (!frm.Visible) - { - frm.Show(this); - } - } - }**/ - return true; - } FrmBoosterValvers frmbooster = null; - /// - /// 阀门分析 功能 - /// - /// - /// - /// - /// - private bool NetworkBoosterValvesAnalysis(GSOFeature lineFeature, GSOPoint3d pntBreak, GSOLayer lineLayer) - { - if (lineLayer == null || lineFeature == null || lineFeature.Geometry == null || lineFeature.Geometry.Type != EnumGeometryType.GeoPolyline3D) - { - return false; - } - GSODataset curCAYDataset = lineLayer.Dataset; - - if (curCAYDataset == null || curCAYDataset.DataSource == null) - { - return false; - } - string srName = curCAYDataset.Name; - GSONetworkDataset curCAYNDataset = curCAYDataset.DataSource.GetDatasetByName(srName + "Network") as GSONetworkDataset; - - if (curCAYNDataset == null) - { - MessageBox.Show("该图层没有创建网络拓扑,请先创建网络拓扑信息再进行分析!", "提示"); - return false; - } - ClearBoosterValvesAnalysis(); - ClearAffectedPipeLine(); - - int[] arryResNodeID = null; - int[] arryResValveID = null; - try - { - curCAYNDataset.CloseValveAnalysis(lineFeature.ID, out arryResNodeID, out arryResValveID, false, true); - } - catch (Exception e) - { - - } - //目前只有燃气管线 有阀门 - string valveName = lineLayer.Name; - valveName = valveName.Substring(0, valveName.IndexOf("管线")); - GSOLayer valveLayer = globeControl1.Globe.Layers[valveName + "阀门"]; - if (valveLayer == null) - { - MessageBox.Show("和选中对象所在管线图层相关联的阀门图层不存在!", "提示"); - return false; - } - m_BoosterValvesAnalyResFeatures = valveLayer.GetFeaturesByIDs(arryResValveID); - - if (m_BoosterValvesAnalyResFeatures == null || - m_BoosterValvesAnalyResFeatures.Length < 1) - { - MessageBox.Show("没有找到要关闭的阀门!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); - if (frmbooster != null) - { - frmbooster.Close(); - } - } - else - { - int nCount = m_BoosterValvesAnalyResFeatures.Length; - if (nCount > 0) - { - AffectedPipeLine(false); - frmbooster = FrmBoosterValvers.getForm(globeControl1, m_BoosterValvesAnalyResFeatures, m_BoosterValvesList, m_AffectedPipeLines); - frmbooster.setLstValvesName(); - if (!frmbooster.Visible) - { - frmbooster.Show(this); - } - } - } - return true; - } /// /// 垂直净距分析 功能界面中的 选择图层复选框 选中状态改变事件处理 @@ -7726,69 +7269,6 @@ double distance = lineline.GetSpaceLength(true, 6378137.0); return distance; } - /// - /// 判断管线是否相通 功能 - /// - /// - public bool isInterlinked() - { - if (globeControl1.Globe.SelObjectCount < 2) - { - MessageBox.Show("请选中至少两个管线!!"); - buttonItemFX3_6.Checked = false; - return false; - } - ClearConnexityAnalysis(); - globeControl1.Globe.GetSelectObject(0, out m_ConnexityAnalysisFirstFeature, out m_ConnexityAnalysisFirstLayer); - globeControl1.Globe.GetSelectObject(1, out m_ConnexityAnaylsisSecondFeature, out m_COnnexityAnalysisSecondLayer); - GSOGeoPolyline3D line1 = m_ConnexityAnalysisFirstFeature.Geometry as GSOGeoPolyline3D; - GSOGeoPolyline3D line2 = m_ConnexityAnaylsisSecondFeature.Geometry as GSOGeoPolyline3D; - if (line1 == null || line2 == null) - { - MessageBox.Show("请选择管线!!"); - return false; - } - GSOPipeLineStyle3D pipeStyle1 = line1.Style as GSOPipeLineStyle3D; - GSOPipeLineStyle3D pipeStyle2 = line2.Style as GSOPipeLineStyle3D; - if (pipeStyle1 == null || pipeStyle2 == null) - { - MessageBox.Show("请选择管线!!"); - return false; - } - if (!m_ConnexityAnalysisFirstLayer.IsSameInnerObject(m_COnnexityAnalysisSecondLayer)) - { - MessageBox.Show("不在同一个图层!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); - ClearConnexityAnalysis(); - return false; - } - else - { - GSODataset curCAYDataset = m_ConnexityAnalysisFirstLayer.Dataset; - string srName = curCAYDataset.Name; - GSONetworkDataset curCAYNDataset = curCAYDataset.DataSource.GetDatasetByName(srName + "Network") as GSONetworkDataset; - if (curCAYNDataset == null) - { - MessageBox.Show("该图层没有创建网络拓扑,请先创建网络拓扑信息再进行分析!", "提示"); - return false; - } - - int[] arryResID; - curCAYNDataset.ConnexityAnalysis(m_ConnexityAnalysisFirstFeature.ID, m_ConnexityAnaylsisSecondFeature.ID, out arryResID, false, true); - m_ConnexityAnalyResFeatures = m_ConnexityAnalysisFirstLayer.GetFeaturesByIDs(arryResID); - if (m_ConnexityAnalyResFeatures == null || m_ConnexityAnalyResFeatures.Length < 1) - { - String strLine1 = "管线:" + m_ConnexityAnalysisFirstFeature.ID; - String strLine2 = "管线:" + m_ConnexityAnaylsisSecondFeature.ID; - MessageBox.Show("请选择两条相通的管线!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); - return false; - } - else - { - return true; - } - } - } - /// /// 图层节点树中 节点 右键单击事件处理 @@ -9564,27 +9044,7 @@ } } - /// - /// 清除分析结果 - /// - /// - /// - //private void buttonItem131_Click(object sender, EventArgs e) - //{ - // LogManager.saveLog(Utility.userName, this.buttonItem131.Text); - - // clearFeatureHighLight(); - // //if (boolfrmShResult == true) - // //{ - // // frmShResult.Close(); - // //} - // //else - // //{ - - // //} - - // ClearRedlineAnalyseResult(); - //} + /// /// 清除渲染结果 /// @@ -10728,8 +10188,9 @@ buttonX16_Click(null, null); buttonClearAnalysisResult_Click(null, null); - ClearConnexityAnalysis();//清除连通性分析 - ClearCloseValvesAnalysis();//清除阀门分析 + NetworkAnalysisTool.ClearAllTopAnalysis(this.globeControl1); + // ClearConnexityAnalysis();//清除连通性分析 + // ClearCloseValvesAnalysis();//清除阀门分析 //清除管线间距分析 if (disFeature != null) @@ -10753,7 +10214,7 @@ globeControl1.Globe.UnderGroundFloor.Visible = false;//隐藏地下网格线 - ClearUpDownTraceAnalysis(); //清除上下游分析 + // ClearUpDownTraceAnalysis(); //清除上下游分析 globeControl1.Globe.RemoveAllPits();//清除所有坑 string[] markerStrs = new string[9]; @@ -11206,6 +10667,8 @@ sideBar1.Refresh(); Refresh(); } + + #region Predaotr,断面分析 /// /// 横断面分析 /// @@ -11213,26 +10676,11 @@ /// private void buttonItemFX2_1_Click(object sender, EventArgs e) { - //日志记录 - LogManager.saveLog(Utility.userName, this.buttonItemFX2_1.Text); - - if (!buttonItemFX2_1.Checked) - { - trackflag = "PolylineAnalysis"; - globeControl1.Globe.Action = EnumAction3D.TrackPolyline; - globeControl1.Globe.TrackPolylineTool.VerticalLineVisible = true; - globeControl1.Globe.TrackPolylineTool.TrackMode = EnumTrackMode.SpaceTrack; - buttonItemFX2_1.Checked = true; - buttonItemFX2_3.Checked = false; - buttonItemFX2_4.Checked = false; - } - else - { - globeControl1.Globe.Action = EnumAction3D.ActionNull; - buttonItemFX2_1.Checked = false; - globeControl1.Globe.TrackPolylineTool.VerticalLineVisible = false; - } - ActionToolMenuChecked(); + globeControl1.Globe.Action = EnumAction3D.TrackPolyline; + globeControl1.Globe.TrackPolylineTool.VerticalLineVisible = true; + globeControl1.Globe.TrackPolylineTool.TrackMode = EnumTrackMode.SpaceTrack; + trackPolylineEndMode = EnumTrackPolylineEndMode.HDM_Analysis; + } /// /// 纵断面分析 @@ -11241,235 +10689,28 @@ /// private void buttonItemFX2_2_Click(object sender, EventArgs e) { - //日志记录 - LogManager.saveLog(Utility.userName, this.buttonItemFX2_2.Text); - - if (globeControl1.Globe.SelObjectCount >= 1) + if (globeControl1.Globe.SelObjectCount<1) { - GSOFeatures selectFeatures = new GSOFeatures(); - for (int i = 0; i < globeControl1.Globe.SelObjectCount; i++) + MessageBox.Show("请选择一条或者多条管线!", "提示", MessageBoxButtons.OK, + MessageBoxIcon.Information); + return; + } + GSOFeatures selectFeatures = new GSOFeatures(); + for (int i = 0; i < globeControl1.Globe.SelObjectCount; i++) + { + GSOFeature feature = null; + GSOLayer layer = null; + globeControl1.Globe.GetSelectObject(i, out feature, out layer); + if (feature != null && feature.Geometry != null && feature.Geometry.Type == EnumGeometryType.GeoPolyline3D) { - GSOFeature feature = null; - GSOLayer layer = null; - globeControl1.Globe.GetSelectObject(i, out feature, out layer); - if (feature != null && feature.Geometry != null && feature.Geometry.Type == EnumGeometryType.GeoPolyline3D) - { - selectFeatures.Add(feature); - } - } - if (selectFeatures.Length < 1) - { - MessageBox.Show("请选择一条或者多条管线!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); - return; - } - List listFeature = new List(); - if (selectFeatures.Length == 1) - { - listFeature.Add(selectFeatures[0]); - } - else - { - //求多条管线纵断面 1,2,3 - //1 判断管线是否相连、且没有分叉 - for (int i = 0; i < selectFeatures.Length; i++) - { - GSOGeoPolyline3D line = selectFeatures[i].Geometry as GSOGeoPolyline3D; - bool isConnect = false; - int[] valueCount = new int[2]; - valueCount[0] = 0; - valueCount[1] = 0; - - if (line != null && line.PartCount > 0) - { - for (int j = 0; j < selectFeatures.Length; j++) - { - if (i == j) - { - continue; - } - GSOGeoPolyline3D newLine = selectFeatures[j].Geometry as GSOGeoPolyline3D; - if (newLine != null && newLine.PartCount > 0) - { - int minValueIndex = 0; - double limitValue = 1.0; - double[] value = new double[4]; - value[0] = getDistance(line[line.PartCount - 1][line[line.PartCount - 1].Count - 1], newLine[0][0]); - value[1] = getDistance(line[line.PartCount - 1][line[line.PartCount - 1].Count - 1], newLine[newLine.PartCount - 1][newLine[newLine.PartCount - 1].Count - 1]); - value[2] = getDistance(line[0][0], newLine[0][0]); - value[3] = getDistance(line[0][0], newLine[newLine.PartCount - 1][newLine[newLine.PartCount - 1].Count - 1]); - double minValue = value[0]; - for (int m = 1; m < value.Length; m++) - { - if (minValue > value[m]) - { - minValue = value[m]; - minValueIndex = m; - } - } - if (minValue < limitValue) - { - isConnect = true; - if (minValueIndex > 1) - { - valueCount[1]++; - } - else - { - valueCount[0]++; - } - } - } - } - if (!isConnect || valueCount[0] > 1 || valueCount[1] > 1) - { - MessageBox.Show("请选择相连接的一条线上的管线!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); - return; - } - } - } - //2 记录每一条相连接的管线的起点和终点,并添加到一条管线中 - for (int p = 0; p < selectFeatures.Length; p++) - { - GSOGeoPolyline3D line = selectFeatures[p].Geometry as GSOGeoPolyline3D; - if (line != null && line.PartCount > 0) - { - for (int n = 0; n < selectFeatures.Length; n++) - { - if (p == n) - { - continue; - } - GSOGeoPolyline3D newLine = selectFeatures[n].Geometry as GSOGeoPolyline3D; - if (newLine != null && newLine.PartCount > 0) - { - int minValueIndex = 0; - double limitValue = 1.0; - double[] value = new double[4]; - value[0] = getDistance(line[line.PartCount - 1][line[line.PartCount - 1].Count - 1], newLine[0][0]); - value[1] = getDistance(line[line.PartCount - 1][line[line.PartCount - 1].Count - 1], newLine[newLine.PartCount - 1][newLine[newLine.PartCount - 1].Count - 1]); - value[2] = getDistance(line[0][0], newLine[0][0]); - value[3] = getDistance(line[0][0], newLine[newLine.PartCount - 1][newLine[newLine.PartCount - 1].Count - 1]); - double minValue = value[0]; - for (int m = 1; m < value.Length; m++) - { - if (minValue > value[m]) - { - minValue = value[m]; - minValueIndex = m; - } - } - if (minValue < limitValue) - { - GSOFeature featureFromAllSelectedObj = new GSOFeature(); - GSOGeoPolyline3D lineFromAllSelectedObj = new GSOGeoPolyline3D(); - switch (minValueIndex) - { - case 0: - GSOPoint3ds linePart = new GSOPoint3ds(); - for (int i = 0; i < line.PartCount; i++) - { - for (int j = 0; j < line[i].Count; j++) - { - linePart.Add(line[i][j]); - } - } - for (int i = 0; i < newLine.PartCount; i++) - { - for (int j = 0; j < newLine[i].Count; j++) - { - linePart.Add(newLine[i][j]); - } - } - lineFromAllSelectedObj.AddPart(linePart); - break; - case 1: - linePart = new GSOPoint3ds(); - for (int i = 0; i < line.PartCount; i++) - { - for (int j = 0; j < line[i].Count; j++) - { - linePart.Add(line[i][j]); - } - } - for (int i = newLine.PartCount - 1; i >= 0; i--) - { - for (int j = newLine[i].Count - 1; j >= 0; j--) - { - linePart.Add(newLine[i][j]); - } - } - lineFromAllSelectedObj.AddPart(linePart); - break; - case 2: - linePart = new GSOPoint3ds(); - for (int i = line.PartCount - 1; i >= 0; i--) - { - for (int j = line[i].Count - 1; j >= 0; j--) - { - linePart.Add(line[i][j]); - } - } - for (int i = 0; i < newLine.PartCount; i++) - { - for (int j = 0; j < newLine[i].Count; j++) - { - linePart.Add(newLine[i][j]); - } - } - lineFromAllSelectedObj.AddPart(linePart); - break; - case 3: - linePart = new GSOPoint3ds(); - for (int i = line.PartCount - 1; i >= 0; i--) - { - for (int j = line[i].Count - 1; j >= 0; j--) - { - linePart.Add(line[i][j]); - } - } - for (int i = newLine.PartCount - 1; i >= 0; i--) - { - for (int j = newLine[i].Count - 1; j >= 0; j--) - { - linePart.Add(newLine[i][j]); - } - } - lineFromAllSelectedObj.AddPart(linePart); - break; - } - - featureFromAllSelectedObj.Geometry = lineFromAllSelectedObj; - - selectFeatures.Remove(n); - selectFeatures.Remove(p); - selectFeatures.Add(featureFromAllSelectedObj); - p--; - break; - } - } - } - } - } - //3 将合并之后的管线添加到集合中 - for (int h = 0; h < selectFeatures.Length; h++) - { - listFeature.Add(selectFeatures[h]); - } - } - //将选中的管线展示在窗体中 - if (listFeature.Count > 0) - { - FrmProfileAnalysis frm = new FrmProfileAnalysis(globeControl1, listFeature); - frm.Show(this); - } - else - { - MessageBox.Show("请选择相连接的管线!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); + selectFeatures.Add(feature); } } - else + List feats = SectionAnalysisTool.ZDMAnalysis(selectFeatures); + if (feats != null && feats.Count >= 1) { - MessageBox.Show("请选择一条或者多条管线!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); + FrmProfileAnalysis frm = new FrmProfileAnalysis(globeControl1, feats); + frm.Show(this); } } /// @@ -11479,25 +10720,11 @@ /// private void buttonItemFX2_3_Click(object sender, EventArgs e) { - //日志记录 - LogManager.saveLog(Utility.userName, this.buttonItemFX2_3.Text); + globeControl1.Globe.Action = EnumAction3D.TrackPolyline; + globeControl1.Globe.TrackPolylineTool.VerticalLineVisible = true; + globeControl1.Globe.TrackPolylineTool.TrackMode = EnumTrackMode.SpaceTrack; + trackPolylineEndMode = EnumTrackPolylineEndMode.DLDM_Analysis; - if (!buttonItemFX2_3.Checked) - { - trackflag = "RoadPolylineAnalysis"; - globeControl1.Globe.Action = EnumAction3D.TrackPolyline; - globeControl1.Globe.TrackPolylineTool.VerticalLineVisible = true; - buttonItemFX2_3.Checked = true; - buttonItemFX2_1.Checked = false; - buttonItemFX2_4.Checked = false; - } - else - { - globeControl1.Globe.Action = EnumAction3D.ActionNull; - buttonItemFX2_3.Checked = false; - globeControl1.Globe.TrackPolylineTool.VerticalLineVisible = false; - } - ActionToolMenuChecked(); } /// /// 基线剖面分析 @@ -11506,27 +10733,14 @@ /// private void buttonItemFX2_4_Click(object sender, EventArgs e) { - //日志记录 - LogManager.saveLog(Utility.userName, this.buttonItemFX2_4.Text); - - if (!buttonItemFX2_4.Checked) - { - globeControl1.Globe.Action = EnumAction3D.TrackPolyline; - //globeControl1.Globe.TrackPolylineAnalysis.VerticalLineVisible = true; - globeControl1.Globe.TrackPolylineTool.VerticalLineVisible = true; - buttonItemFX2_4.Checked = true; - buttonItemFX3_6.Checked = false; - buttonItemFX2_1.Checked = false; - } - else - { - globeControl1.Globe.Action = EnumAction3D.ActionNull; - buttonItemFX2_4.Checked = false; - //globeControl1.Globe.TrackPolylineAnalysis.VerticalLineVisible = false; - globeControl1.Globe.TrackPolylineTool.VerticalLineVisible = false; - } - ActionToolMenuChecked(); + globeControl1.Globe.Action = EnumAction3D.TrackPolyline; + globeControl1.Globe.TrackPolylineTool.VerticalLineVisible = true; + globeControl1.Globe.TrackPolylineTool.TrackMode = EnumTrackMode.SpaceTrack; + trackPolylineEndMode = EnumTrackPolylineEndMode.JXPM_Analysis; + } + + #endregion /// /// 创建拓扑 /// @@ -11540,7 +10754,7 @@ FrmGenAndFaMenTopu frm = new FrmGenAndFaMenTopu(globeControl1, m_PipelineLayerNames, valueLayerNames); frm.Show(this); } - #region Fan + #region Predator :拓扑分析 /// /// 上游分析 /// @@ -11550,8 +10764,6 @@ { //日志记录 LogManager.saveLog(Utility.userName, this.buttonItemFX3_2.Text); - - //ClearUpDownTraceAnalysis(); Fan NetworkTraceUpDown(true); } /// @@ -11563,10 +10775,27 @@ { //日志记录 LogManager.saveLog(Utility.userName, this.buttonItemFX3_3.Text); - - // ClearUpDownTraceAnalysis(); Fan NetworkTraceUpDown(false); } + + /// + /// 上下游追踪 功能 + /// + /// + private void NetworkTraceUpDown(Boolean bTraceUp) + { + GSOFeature selLineFeature = globeControl1.Globe.SelectedObject; + if (selLineFeature == null || selLineFeature.Geometry == null || selLineFeature.Geometry.Type != EnumGeometryType.GeoPolyline3D) + { + MessageBox.Show("请点击“编辑”—“选中对象”选择一条线!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); + return; + } + GSOLayer selLayer = globeControl1.Globe.SelectedObjectLayer; + + NetworkAnalysisTool.TraceUpDownAnalysis(bTraceUp, + selLineFeature, selLayer); + } + /// /// 流向分析 /// @@ -11618,43 +10847,6 @@ { MessageBox.Show("未找到关闭阀门"); } - - - //日志记录 - /* - LogManager.saveLog(Utility.userName, this.buttonItemFX3_5.Text); - - ClearCloseValvesAnalysis(); - if (globeControl1.Globe.SelObjectCount < 1) - { - MessageBox.Show("请选中至少一根管线!!"); - buttonItemFX3_5.Checked = false; - return; - } - GSOLayer resLayer = null; - GSOFeature resFeature = null; - globeControl1.Globe.GetSelectObject(0, out resFeature, out resLayer); - - GSOGeoPolyline3D line1 = resFeature.Geometry as GSOGeoPolyline3D; - if (line1 == null) - { - MessageBox.Show("请选择管线!!"); - return; - } - GSOPipeLineStyle3D pipeStyle1 = line1.Style as GSOPipeLineStyle3D; - if (pipeStyle1 == null) - { - MessageBox.Show("请选择管线!!"); - return; - } - GSOPoint3d resIntersetPoint = new GSOPoint3d(); - if (NetworkCloseValvesAnalysis(resFeature, resIntersetPoint, resLayer)) - { - //btnGFFX.Checked = false; - globeControl1.Globe.Action = EnumAction3D.ActionNull; - buttonItemFX3_5.Checked = false; - } - * **/ } /// @@ -11682,47 +10874,6 @@ return; } NetworkAnalysisTool.ConnexityAnalysis(selFeat0, selFeat1, layer0); - /* - //日志记录 - LogManager.saveLog(Utility.userName, this.buttonItemFX3_6.Text); - - if (globeControl1.Globe.SelObjectCount < 2) - { - MessageBox.Show("请选中至少两个管线!!"); - buttonItemFX3_6.Checked = false; - return; - } - ClearConnexityAnalysis(); - globeControl1.Globe.GetSelectObject(0, out m_ConnexityAnalysisFirstFeature, out m_ConnexityAnalysisFirstLayer); - globeControl1.Globe.GetSelectObject(1, out m_ConnexityAnaylsisSecondFeature, out m_COnnexityAnalysisSecondLayer); - GSOGeoPolyline3D line1 = m_ConnexityAnalysisFirstFeature.Geometry as GSOGeoPolyline3D; - GSOGeoPolyline3D line2 = m_ConnexityAnaylsisSecondFeature.Geometry as GSOGeoPolyline3D; - if (line1 == null || line2 == null) - { - MessageBox.Show("请选择管线!!"); - buttonItemFX3_6.Checked = false; - return; - } - - GSOPipeLineStyle3D pipeStyle1 = line1.Style as GSOPipeLineStyle3D; - GSOPipeLineStyle3D pipeStyle2 = line2.Style as GSOPipeLineStyle3D; - if (pipeStyle1 == null || pipeStyle2 == null) - { - MessageBox.Show("请选择管线!!"); - buttonItemFX3_6.Checked = false; - return; - } - if (!m_ConnexityAnalysisFirstLayer.IsSameInnerObject(m_COnnexityAnalysisSecondLayer)) - { - MessageBox.Show("不在同一个图层!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); - buttonItemFX3_6.Checked = false; - ClearConnexityAnalysis(); - } - else - { - ConnexityAnalysis(); - } - * **/ } /// /// 爆管分析 @@ -11731,8 +10882,6 @@ /// private void buttonItemFX3_7_Click(object sender, EventArgs e) { - //TODO LIST:关阀+上游 追踪 - NetworkTraceUpDown(true); //上游追踪: GSOFeature selLineFeature = globeControl1.Globe.SelectedObject; @@ -11747,73 +10896,8 @@ this.buttonItemFX3_5_Click(sender, e); //关阀分析: - //日志记录 - /* - LogManager.saveLog(Utility.userName, this.buttonItemFX3_7.Text); - ClearCloseValvesAnalysis(); - if (globeControl1.Globe.SelObjectCount < 1) - { - MessageBox.Show("请选中至少一个管线!!"); - return; - } - GSOLayer resLayer = null; - GSOFeature resFeature = null; - globeControl1.Globe.GetSelectObject(0, out resFeature, out resLayer); - - GSOGeoPolyline3D line1 = resFeature.Geometry as GSOGeoPolyline3D; - if (line1 == null) - { - MessageBox.Show("请选择管线!!"); - return; - } - GSOPipeLineStyle3D pipeStyle1 = line1.Style as GSOPipeLineStyle3D; - if (pipeStyle1 == null) - { - MessageBox.Show("请选择管线!!"); - return; - } - - GSOFeatures feats = globeControl1.Globe.MemoryLayer.GetFeatureByName("粒子要素", true); - if (feats.Length > 0) - globeControl1.Globe.MemoryLayer.RemoveFeatureByID(feats[0].ID); - //if (emitterFeature != null) - //{ - // globeControl1.Globe.MemoryLayer.RemoveFeatureByID(emitterFeature.ID); - //} - - GSOPoint3d pt = new GSOPoint3d(); - double length = line1.GetSpaceLength(true, 6378137);//线的长度 - GSOGeoPolyline3D lineLine = line1.GetSegment(0, length / 2); - GSOPoint3d point3d = lineLine[lineLine.PartCount - 1][lineLine[lineLine.PartCount - 1].Count - 1]; - pt.X = point3d.X; - pt.Y = point3d.Y; - pt.Z = point3d.Z; - - pt.Z += pipeStyle1.Radius * 2; - - if (resLayer.Caption.Contains("气")) - { - globeControl1.Globe.UnderGroundFloor.Visible = true; - AddFire(pt.X, pt.Y, pt.Z); - } - else if (resLayer.Caption.Contains("给水")) - { - globeControl1.Globe.UnderGroundFloor.Visible = true; - AddFountain(pt.X, pt.Y, pt.Z); - } - else if (resLayer.Caption.Contains("热力")) - { - globeControl1.Globe.UnderGroundFloor.Visible = true; - AddFountain(pt.X, pt.Y, pt.Z); - } - GSOPoint3d resIntersetPoint = new GSOPoint3d(); - if (NetworkBoosterValvesAnalysis(resFeature, resIntersetPoint, resLayer)) - { - globeControl1.Globe.Action = EnumAction3D.ActionNull; - } - * */ - } + #endregion /// /// 多边形开挖 diff --git a/NetworkAnalysisTool.cs b/NetworkAnalysisTool.cs index 7709e9d..67e1d2f 100644 --- a/NetworkAnalysisTool.cs +++ b/NetworkAnalysisTool.cs @@ -456,5 +456,15 @@ flowLayer = layer; } + //清除所有分析 + public static void ClearAllTopAnalysis(GSOGlobeControl globeControl) + { + ClearConnexityAnalysis(); + ClearExplodeAnalysis(globeControl); + ClearFlowDirectionAnalysis(); + ClearTraceUpDownAnalysis(); + ClearValvesAnalysis(); + } + } } diff --git a/SectionAnalysisTool.cs b/SectionAnalysisTool.cs new file mode 100644 index 0000000..9647393 --- /dev/null +++ b/SectionAnalysisTool.cs @@ -0,0 +1,332 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using GeoScene.Data; +using GeoScene.Engine; +using GeoScene.Globe; +using System.Windows.Forms; +namespace Cyberpipe +{ + public class HDMCoordinate + { + private double dis; + private double z; + + public double Dis + { + get { return dis; } + set { dis = value; } + } + public double Z + { + get { return z; } + set { z = value; } + } + } + public class SectionAnalysisTool + { + public static Dictionary hdmDic = new Dictionary(); + + public static void ClearHDMAnalysis(GSOGlobeControl globeControl) + { + hdmDic.Clear(); + globeControl.Globe.ClearLastTrackPolyline(); + globeControl.Globe.Action = EnumAction3D.ActionNull; + } + + /** + * 计算点与三维线之间的距离 + * **/ + private static HDMCoordinate getSpaceDisBetweenLineAndPoint(GSOPoint3d point, + GSOGeoPolyline3D polyLine) + { + double a_x = polyLine[0][0].X; + double a_y = polyLine[0][0].Y; + + int id = GeoScene.Data.GSOProjectManager.AddProject(Utility.projectStr); + GeoScene.Data.GSOPoint2d a_Point = GeoScene.Data.GSOProjectManager.Forward(new GSOPoint2d(a_x, + a_y), id);//user画的线的起始点 + + GeoScene.Data.GSOPoint2d pt2d = new GeoScene.Data.GSOPoint2d(point.X, point.Y); + GeoScene.Data.GSOPoint2d result = GeoScene.Data.GSOProjectManager.Forward(pt2d, id); + double B_x = result.X; + double B_y = result.Y; + + double x = System.Math.Abs(B_x - a_Point.X); + double y = System.Math.Abs(B_y - a_Point.Y); + double Dis = Math.Round(Math.Sqrt(x * x + y * y), 2); + HDMCoordinate coor = new HDMCoordinate(); + coor.Dis = Dis; + coor.Z = point.Z; + return coor; + } + + //横断面分析 + public static Dictionary HDMAnalysis(GSOGlobeControl globeControl, + GSOGeoPolyline3D polyLine, List pipeLayerNames) + { + ClearHDMAnalysis(globeControl); + + if (globeControl == null || polyLine == null|| + pipeLayerNames == null || pipeLayerNames.Count == 0) { return null; } + + globeControl.Globe.ClearLastTrackPolyline(); + globeControl.Globe.Action = EnumAction3D.ActionNull; + + GSOGeoPolygon3D polygon = polyLine.CreateBuffer(0.1, true, + 5, true, false); + + for (int i = 0; i < pipeLayerNames.Count; i++) + { + GSOLayer layer = globeControl.Globe.Layers. + GetLayerByCaption(pipeLayerNames[i]); + if(layer==null || layer.Visible==false|| + layer as GSOFeatureLayer==null) + continue; + + GSOFeatureLayer featurelayer = layer as GSOFeatureLayer; + GSOFeatures feats = featurelayer.FindFeaturesInPolygon(polygon, false); + if(feats==null||feats.Length==0) + continue; + + for (int j = 0; j < feats.Length; j++) + { + GSOFeature feateline = feats[j]; + GSOGeoPolyline3D geoline = feateline.Geometry as GSOGeoPolyline3D; + if(geoline!=null &&geoline.Style!=null&& + geoline.Style.GetType() == typeof(GSOPipeLineStyle3D)) + { + GSOPoint3d pntIntersect1 = new GSOPoint3d(); + GSOPoint3d pntIntersect2 = new GSOPoint3d(); + double honLen; + double verLen; + double dDist = globeControl.Globe.Analysis3D.ComputeTwoGeoPolylineDistance(polyLine, + geoline, out pntIntersect1, out pntIntersect2, out honLen, + out verLen, false, false, 0); + + if (dDist > -1) + { + HDMCoordinate coord = getSpaceDisBetweenLineAndPoint(pntIntersect2, polyLine); + hdmDic.Add(feateline, coord); + } + + } + + } + } + return hdmDic; + } + + //纵断面分析 + public static List ZDMAnalysis(GSOFeatures selectFeatures) + { + List result = new List(); + if (selectFeatures != null && selectFeatures.Length == 1) + { + result.Add(selectFeatures[0]); + return result; + } + + for (int i = 0; i < selectFeatures.Length; i++) + { + GSOGeoPolyline3D line = selectFeatures[i].Geometry as GSOGeoPolyline3D; + bool isConnect = false; + int[] valueCount = new int[2]; + valueCount[0] = 0; + valueCount[1] = 0; + if (line != null && line.PartCount > 0) + { + for (int j = 0; j < selectFeatures.Length; j++) + { + if (i == j) + { + continue; + } + GSOGeoPolyline3D newLine = selectFeatures[j].Geometry as GSOGeoPolyline3D; + if (newLine != null && newLine.PartCount > 0) + { + int minValueIndex = 0; + double limitValue = 1.0; + double[] value = new double[4]; + value[0] = getDistance(line[line.PartCount - 1][line[line.PartCount - 1].Count - 1], newLine[0][0]); + value[1] = getDistance(line[line.PartCount - 1][line[line.PartCount - 1].Count - 1], newLine[newLine.PartCount - 1][newLine[newLine.PartCount - 1].Count - 1]); + value[2] = getDistance(line[0][0], newLine[0][0]); + value[3] = getDistance(line[0][0], newLine[newLine.PartCount - 1][newLine[newLine.PartCount - 1].Count - 1]); + double minValue = value[0]; + for (int m = 1; m < value.Length; m++) + { + if (minValue > value[m]) + { + minValue = value[m]; + minValueIndex = m; + } + } + if (minValue < limitValue) + { + isConnect = true; + if (minValueIndex > 1) + { + valueCount[1]++; + } + else + { + valueCount[0]++; + } + } + } + } + if (!isConnect || valueCount[0] > 1 || valueCount[1] > 1) + { + MessageBox.Show("请选择相连接的一条线上的管线!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); + return null; + } + } + } + //2 记录每一条相连接的管线的起点和终点,并添加到一条管线中 + for (int p = 0; p < selectFeatures.Length; p++) + { + GSOGeoPolyline3D line = selectFeatures[p].Geometry as GSOGeoPolyline3D; + if (line != null && line.PartCount > 0) + { + for (int n = 0; n < selectFeatures.Length; n++) + { + if (p == n) + { + continue; + } + GSOGeoPolyline3D newLine = selectFeatures[n].Geometry as GSOGeoPolyline3D; + if (newLine != null && newLine.PartCount > 0) + { + int minValueIndex = 0; + double limitValue = 1.0; + double[] value = new double[4]; + value[0] = getDistance(line[line.PartCount - 1][line[line.PartCount - 1].Count - 1], newLine[0][0]); + value[1] = getDistance(line[line.PartCount - 1][line[line.PartCount - 1].Count - 1], newLine[newLine.PartCount - 1][newLine[newLine.PartCount - 1].Count - 1]); + value[2] = getDistance(line[0][0], newLine[0][0]); + value[3] = getDistance(line[0][0], newLine[newLine.PartCount - 1][newLine[newLine.PartCount - 1].Count - 1]); + double minValue = value[0]; + for (int m = 1; m < value.Length; m++) + { + if (minValue > value[m]) + { + minValue = value[m]; + minValueIndex = m; + } + } + if (minValue < limitValue) + { + GSOFeature featureFromAllSelectedObj = new GSOFeature(); + GSOGeoPolyline3D lineFromAllSelectedObj = new GSOGeoPolyline3D(); + switch (minValueIndex) + { + case 0: + GSOPoint3ds linePart = new GSOPoint3ds(); + for (int i = 0; i < line.PartCount; i++) + { + for (int j = 0; j < line[i].Count; j++) + { + linePart.Add(line[i][j]); + } + } + for (int i = 0; i < newLine.PartCount; i++) + { + for (int j = 0; j < newLine[i].Count; j++) + { + linePart.Add(newLine[i][j]); + } + } + lineFromAllSelectedObj.AddPart(linePart); + break; + case 1: + linePart = new GSOPoint3ds(); + for (int i = 0; i < line.PartCount; i++) + { + for (int j = 0; j < line[i].Count; j++) + { + linePart.Add(line[i][j]); + } + } + for (int i = newLine.PartCount - 1; i >= 0; i--) + { + for (int j = newLine[i].Count - 1; j >= 0; j--) + { + linePart.Add(newLine[i][j]); + } + } + lineFromAllSelectedObj.AddPart(linePart); + break; + case 2: + linePart = new GSOPoint3ds(); + for (int i = line.PartCount - 1; i >= 0; i--) + { + for (int j = line[i].Count - 1; j >= 0; j--) + { + linePart.Add(line[i][j]); + } + } + for (int i = 0; i < newLine.PartCount; i++) + { + for (int j = 0; j < newLine[i].Count; j++) + { + linePart.Add(newLine[i][j]); + } + } + lineFromAllSelectedObj.AddPart(linePart); + break; + case 3: + linePart = new GSOPoint3ds(); + for (int i = line.PartCount - 1; i >= 0; i--) + { + for (int j = line[i].Count - 1; j >= 0; j--) + { + linePart.Add(line[i][j]); + } + } + for (int i = newLine.PartCount - 1; i >= 0; i--) + { + for (int j = newLine[i].Count - 1; j >= 0; j--) + { + linePart.Add(newLine[i][j]); + } + } + lineFromAllSelectedObj.AddPart(linePart); + break; + } + + featureFromAllSelectedObj.Geometry = lineFromAllSelectedObj; + + selectFeatures.Remove(n); + selectFeatures.Remove(p); + selectFeatures.Add(featureFromAllSelectedObj); + p--; + break; + } + } + } + } + } + + for (int h = 0; h < selectFeatures.Length; h++) + { + result.Add(selectFeatures[h]); + } + return result; + } + + private static double getDistance(GSOPoint3d point1, GSOPoint3d point2) + { + GSOGeoPolyline3D lineline = new GSOGeoPolyline3D(); + GSOPoint3ds point3ds = new GSOPoint3ds(); + point3ds.Add(point1); + point3ds.Add(point2); + lineline.AddPart(point3ds); + + double distance = lineline.GetSpaceLength(true, 6378137.0); + return distance; + } + + + + } +} \ No newline at end of file diff --git a/obj/x64/Debug/Cyberpipe.FrmHDMAnalysis3.resources b/obj/x64/Debug/Cyberpipe.FrmHDMAnalysis3.resources index 6c05a97..3c2db6a 100644 --- a/obj/x64/Debug/Cyberpipe.FrmHDMAnalysis3.resources +++ b/obj/x64/Debug/Cyberpipe.FrmHDMAnalysis3.resources Binary files differ diff --git a/obj/x64/Debug/Cyberpipe.csproj.FileListAbsolute.txt b/obj/x64/Debug/Cyberpipe.csproj.FileListAbsolute.txt index 326e5c4..ada21ca 100644 --- a/obj/x64/Debug/Cyberpipe.csproj.FileListAbsolute.txt +++ b/obj/x64/Debug/Cyberpipe.csproj.FileListAbsolute.txt @@ -298,7 +298,6 @@ F:\predator\codeReview\GHFX_SZ_64\obj\x64\Debug\Cyberpipe.FrmRegionTypeMgr.resources F:\predator\codeReview\GHFX_SZ_64\obj\x64\Debug\Cyberpipe.FrmRESC.resources F:\predator\codeReview\GHFX_SZ_64\obj\x64\Debug\Cyberpipe.FrmRESCMgr.resources -F:\predator\codeReview\GHFX_SZ_64\obj\x64\Debug\Cyberpipe.FrmRoadHDM.resources F:\predator\codeReview\GHFX_SZ_64\obj\x64\Debug\Cyberpipe.FrmRole.resources F:\predator\codeReview\GHFX_SZ_64\obj\x64\Debug\Cyberpipe.FrmRoleMgr.resources F:\predator\codeReview\GHFX_SZ_64\obj\x64\Debug\Cyberpipe.FrmSetGoalLayer.resources diff --git a/obj/x64/Debug/Cyberpipe.csproj.GenerateResource.Cache b/obj/x64/Debug/Cyberpipe.csproj.GenerateResource.Cache index 9f5532e..df4a038 100644 --- a/obj/x64/Debug/Cyberpipe.csproj.GenerateResource.Cache +++ b/obj/x64/Debug/Cyberpipe.csproj.GenerateResource.Cache Binary files differ diff --git a/Cyberpipe.csproj b/Cyberpipe.csproj index d24ccfc..cd0296f 100644 --- a/Cyberpipe.csproj +++ b/Cyberpipe.csproj @@ -228,6 +228,7 @@ F_GKT1添加项目.cs + @@ -938,12 +939,6 @@ FrmRESCMgr.cs - - Form - - - FrmRoadHDM.cs - Form @@ -1166,6 +1161,7 @@ + @@ -1611,10 +1607,6 @@ FrmRESCMgr.cs Designer - - FrmRoadHDM.cs - Designer - FrmRole.cs Designer diff --git a/EnumEventMode.cs b/EnumEventMode.cs new file mode 100644 index 0000000..b5eba59 --- /dev/null +++ b/EnumEventMode.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace Cyberpipe +{ + //横断面分析、基线剖面分析、道路断面分析 + public enum EnumTrackPolylineEndMode + { + Default_Analysis = 0, //无分析 + HDM_Analysis = 1, //横断面分析 + DLDM_Analysis = 2,//道路断面分析 + JXPM_Analysis = 3, //基线剖面分析 + } + + class EnumEventMode + { + } +} diff --git a/FrmHDMAnalysis3.cs b/FrmHDMAnalysis3.cs index 5e5988c..6405ed7 100644 --- a/FrmHDMAnalysis3.cs +++ b/FrmHDMAnalysis3.cs @@ -16,206 +16,72 @@ { public partial class FrmHDMAnalysis3 : DevComponents.DotNetBar.Office2007Form { - private ArrayList listPoint = new ArrayList(); - private ArrayList listFeat = new ArrayList(); - GSOGeoPolyline3D line = new GSOGeoPolyline3D(); //创建线对象 - - private static FrmHDMAnalysis3 allPipelineAnalysis = null; - public bool isShowFirst = false; - - static ArrayList list = new ArrayList(); + static DataTable table = new DataTable(); - static DataTable showTable = new DataTable(); GSOGlobeControl globeControl1; - object[,] sortIndex; - GSOLayer layerTemp; - private FrmHDMAnalysis3() - { - - } - public static FrmHDMAnalysis3 GetForm(ArrayList arraylistP, ArrayList arraylistF, GSOGeoPolyline3D _line, GSOGlobeControl _ctl) - { - if (allPipelineAnalysis == null) - { - allPipelineAnalysis = new FrmHDMAnalysis3(arraylistP, arraylistF, _line,_ctl); - } - else - { - allPipelineAnalysis.listPoint = arraylistP; - allPipelineAnalysis.listFeat = arraylistF; - allPipelineAnalysis.line = _line; - allPipelineAnalysis.globeControl1 = _ctl; - list = new ArrayList(); - } - return allPipelineAnalysis; - } + EnumTrackPolylineEndMode mode; - public FrmHDMAnalysis3(ArrayList arraylistP, ArrayList arraylistF, GSOGeoPolyline3D _line,GSOGlobeControl _ctl) + Dictionary hdmDic; + + public FrmHDMAnalysis3(Dictionary hdmDic, + GSOGlobeControl globeControl, EnumTrackPolylineEndMode mode) { InitializeComponent(); - this.listPoint = arraylistP; - this.listFeat = arraylistF; - line = _line; - globeControl1 = _ctl; + + this.hdmDic = hdmDic; + this.globeControl1 = globeControl; + this.mode = mode; } - double A_x, A_y, B_x, B_y;//定义坐标点,用来就横断面的长度 - /// - /// 窗体初始化事件处理 - /// - /// - /// - private void Frm_HDMAnalysis_Load(object sender, EventArgs e) + + private void initControls() { - layerTemp = globeControl1.Globe.Layers.Add(Application.StartupPath + "\\tempLgdExport.lgd"); - //chart1.ChartAreas[0].BackImage = Application.StartupPath + "\\Resource\\pipelineBackGround副本.png"; - } - /// - /// 窗体第一次显示事件处理 - /// - /// - /// - void Frm_HDMAnalysis2_Shown(object sender, EventArgs e) - { - isShowFirst = true; - - } - public void LoadChartEvent() - { - try - { - this.Shown += new EventHandler(Frm_HDMAnalysis2_Shown); - - chart1.Series["管线"].ChartType = SeriesChartType.Point; - - chart1.Series["管线"]["DrawingStyle"] = "Cylinder"; - chart1.Series["管线"].MarkerStyle = MarkerStyle.Circle; //点的类型 - - chart1.Series["管线"].MarkerBorderColor = Color.Black; //点的边框颜色 - chart1.ChartAreas[0].AxisX.Minimum = 0; //x轴的起始点大小 - chart1.ChartAreas[0].AxisY.Maximum = 0; //y轴的最大值 - - chart1.ChartAreas[0].AxisX.Title = "距离 (米)"; - chart1.ChartAreas[0].AxisY.Title = "埋深 (米)"; - - //chart1.ChartAreas[0].AxisX.ScrollBar.Enabled = true; - chart1.ChartAreas[0].AxisY2.Title = "高程 (米)"; - double[] depths = new double[listFeat.Count]; - for (int i = 0; i < listFeat.Count; i++) - { - GSOFeature f = listFeat[i] as GSOFeature; - double depth = f.GetFieldAsDouble("起始地面高程"); - depths[i] = depth; - } - double max_Depth = depths[0]; - for (int i = 0; i < listFeat.Count; i++) - { - if (max_Depth < depths[i]) - { - max_Depth = depths[i]; - } - } - chart1.ChartAreas[0].AxisY2.CustomLabels.Clear(); - chart1.ChartAreas[0].AxisY2.CustomLabels.Add(-5.4d, -5.6d, (max_Depth - 5.5).ToString("0.0")); - chart1.ChartAreas[0].AxisY2.CustomLabels.Add(-4.9d, -5.1d, (max_Depth - 5).ToString("0.0")); - chart1.ChartAreas[0].AxisY2.CustomLabels.Add(-4.4d, -4.6d, (max_Depth - 4.5).ToString("0.0")); - chart1.ChartAreas[0].AxisY2.CustomLabels.Add(-3.9d, -4.1d, (max_Depth - 4).ToString("0.0")); - chart1.ChartAreas[0].AxisY2.CustomLabels.Add(-3.4d, -3.6d, (max_Depth - 3.5).ToString("0.0")); - chart1.ChartAreas[0].AxisY2.CustomLabels.Add(-2.9d, -3.1d, (max_Depth - 3).ToString("0.0")); - chart1.ChartAreas[0].AxisY2.CustomLabels.Add(-2.4d, -2.6d, (max_Depth - 2.5).ToString("0.0")); - chart1.ChartAreas[0].AxisY2.CustomLabels.Add(-1.9d, -2.1d, (max_Depth - 2).ToString("0.0")); - chart1.ChartAreas[0].AxisY2.CustomLabels.Add(-1.4d, -1.6d, (max_Depth - 1.5).ToString("0.0")); - chart1.ChartAreas[0].AxisY2.CustomLabels.Add(-0.9d, -1.1d, (max_Depth - 1).ToString("0.0")); - chart1.ChartAreas[0].AxisY2.CustomLabels.Add(-0.4d, -0.6d, (max_Depth - 0.5).ToString("0.0")); - chart1.ChartAreas[0].AxisY2.CustomLabels.Add(-0.1d, 0.1d, max_Depth.ToString("0.0")); - - if (line.PartCount > 0) - { - GSOPoint3ds nodes = line[0]; - if (nodes.Count > 0) - { - GSOPoint3d node = nodes[0]; - A_x = node.X; - A_y = node.Y; - } - } - - DrawCurveGraph(A_x, A_y); - } - catch (Exception ex) - { - LogError.PublishError(ex); - } - } - - /// - /// 创建图表 - /// - /// - /// - private void DrawCurveGraph(double a_x,double a_y) - { - // 遍历线,求距离 - table = new DataTable(); - //showTable.Columns.Clear(); - list.Clear(); + chart1.Series["管线"].ChartType = SeriesChartType.Point; + chart1.Series["管线"]["DrawingStyle"] = "Cylinder"; + chart1.Series["管线"].MarkerStyle = MarkerStyle.Circle; //点的类型 + chart1.Series["管线"].MarkerBorderColor = Color.Black; //点的边框颜色 + //chart1.ChartAreas[0].AxisX.Minimum = 0; //x轴的起始点大小 + chart1.ChartAreas[0].AxisY.Maximum = 0; //y轴的最大值 + chart1.ChartAreas[0].AxisX.Title = "距离 (米)"; + chart1.ChartAreas[0].AxisY.Title = "埋深 (米)"; + chart1.ChartAreas[0].AxisY2.Title = "高程 (米)"; chart1.Series["管线"].Points.Clear(); - chart1.ChartAreas[0].AxisX.Maximum = Math.Round(line.GetSpaceLength(true, 6378137),2); + //chart1.ChartAreas[0].AxisX.Maximum = Math.Round(line.GetSpaceLength(true, 6378137), 2); + table.Columns.Add("编号", typeof(string)); table.Columns.Add("管线类型", typeof(string)); table.Columns.Add("管线编码", typeof(string)); table.Columns.Add("管径_毫米", typeof(string)); table.Columns.Add("材质", typeof(string)); - table.Columns.Add("管线埋深", typeof(string)); + table.Columns.Add("管线埋深", typeof(string)); - sortIndex = new object[listPoint.Count, 2]; - for (int i = 0; i <= listPoint.Count; i++) + if (mode == EnumTrackPolylineEndMode.DLDM_Analysis) { - if (i == listPoint.Count) - { - double maxNum = 0.0; - for (int j = 0; j < listPoint.Count; j++) - { - if (maxNum < Convert.ToDouble(sortIndex[j, 0])) - { - maxNum = Convert.ToDouble(sortIndex[j, 0]); - } - } - chart1.Series["管线"].Points.AddXY(maxNum + 2, 0); - chart1.Series["管线"].Points[i].MarkerBorderWidth = 100; //边框的宽度 - chart1.Series["管线"].Points[i].MarkerColor = Color.Black; - chart1.Series["管线"].Points[i].MarkerSize = 100; - continue; - } - GSOPoint3d geoPoint = (GSOPoint3d)listPoint[i]; - GSOFeature feature = listFeat[i] as GSOFeature; - //坐标投影 - int id = GeoScene.Data.GSOProjectManager.AddProject(Utility.projectStr); + this.pictureBox1.Visible = true; + } + else + { + this.pictureBox1.Visible = false; + } + } - GeoScene.Data.GSOPoint2d a_Point = GeoScene.Data.GSOProjectManager.Forward(new GSOPoint2d(a_x, a_y), id);//user画的线的起始点 + private void draw() + { + int i = 0; + foreach (KeyValuePair kvp in this.hdmDic) + { + GSOFeature feature = kvp.Key; + HDMCoordinate coor = kvp.Value; - GeoScene.Data.GSOPoint2d pt2d = new GeoScene.Data.GSOPoint2d(geoPoint.X, geoPoint.Y); - GeoScene.Data.GSOPoint2d result = GeoScene.Data.GSOProjectManager.Forward(pt2d, id); - B_x = result.X; - B_y = result.Y; + chart1.Series["管线"].Points.AddXY(coor.Dis, coor.Z);//绑定数据 - double x = System.Math.Abs(B_x - a_Point.X); - double y = System.Math.Abs(B_y - a_Point.Y); - double Dis = 0.0; - Dis = Math.Round(Math.Sqrt(x * x + y * y) , 2); - list.Add(geoPoint.Z); - sortIndex[i, 0] = Dis; - sortIndex[i, 1] = i; - - chart1.Series["管线"].Points.AddXY(Dis, geoPoint.Z);//绑定数据 - - string pipeType = feature.Dataset == null ? "" : feature.Dataset.Caption; + string pipeType = feature.Dataset == null ? "" : feature.Dataset.Caption; string number = Convert.ToString(i + 1); - string material = feature.GetFieldAsString("材质"); string diameter = feature.GetFieldAsString("管径_毫米"); - table.Rows.Add(new object[] { number, pipeType, feature.Name.ToString(), diameter, material,Convert.ToDecimal(list[i].ToString()).ToString("f2")});//list[i].ToString().Substring(0,list[i].ToString().IndexOf('.')+3) } - - //chart1.Series["管线"].Points[i].Label = number;//管线的标签 + table.Rows.Add(new object[] { number, + pipeType, feature.Name.ToString(), + diameter, material, + Convert.ToDecimal(coor.Z).ToString("f2") }); chart1.Series["管线"].Points[i].LegendText = number; if (feature.Geometry.Style.GetType() == typeof(GSOPipeLineStyle3D)) { @@ -229,47 +95,12 @@ chart1.Series["管线"].Points[i].MarkerBorderWidth = 3; //边框的宽度 chart1.Series["管线"].Points[i].MarkerColor = Color.Transparent; - chart1.Series["管线"].Points[i].MarkerSize = Convert.ToInt32(Math.Floor((feature.GetFieldAsDouble("管径_毫米") / 0.35 + chart1.Series["管线"].Points[i].MarkerBorderWidth) / 100.0));//点的大小 - + chart1.Series["管线"].Points[i].MarkerSize = Convert.ToInt32(Math.Floor((feature.GetFieldAsDouble("管径_毫米") / 0.35 + + chart1.Series["管线"].Points[i].MarkerBorderWidth) / 100.0)); + i++; } - - string htmlCode = "" + - "" + - "" + - "
管线类型管线编码管径_毫米材质管线埋深
" + - "" + - "" + - "" + - "" + - "
"; - webBrowser1.DocumentText = htmlCode; } + /// /// 图表的鼠标单击事件处理 /// @@ -286,14 +117,11 @@ return; } string number = p.LegendText; - //MessageBox.Show(number); int indexInTableRows = 0; bool isInt = int.TryParse(number, out indexInTableRows); if (isInt) { DataRow row = table.Rows[indexInTableRows - 1]; - //showTable.Rows.Clear(); - //showTable.Rows.Add(new object[] { row[0], row[1], row[2], row[3], row[4], row[5] }); string htmlCode = "" + - "" + - "" + - "
管线类型管线编码管径_毫米材质管线埋深
" + - "" + - "" + - "" + - "" + - "
"; - webBrowser1.DocumentText = htmlCode; - - - } - /// - /// 图表鼠标单击事件处理 - /// - /// - /// - private void chart1_MouseClick(object sender, MouseEventArgs e) - { - HitTestResult result = chart1.HitTest(e.X, e.Y, true); - if (result.PointIndex >= 0) - { - DataPoint p = (DataPoint)result.Object; - if (p == null) - { - return; - } - string number = p.LegendText; - int indexInTableRows = 0; - bool isInt = int.TryParse(number, out indexInTableRows); - if (isInt) - { - DataRow row = table.Rows[indexInTableRows - 1]; - string htmlCode = "" + - "" + - "" + - "
管线类型管线编码管径_毫米材质管线埋深
" + row[1] + - "" + row[2] + - "" + row[3] + - "" + row[4] + - "" + row[5] + - "
"; - webBrowser1.DocumentText = htmlCode; - } - } - } - /// - /// 窗体关闭事件处理 - /// - /// - /// - private void FrmRoadHDM_FormClosing(object sender, FormClosingEventArgs e) - { - allPipelineAnalysis = null; - globeControl1.Globe.MemoryLayer.RemoveAllFeature(); - } - /// - /// 图表鼠标移动事件处理 - /// - /// - /// - private void chart1_MouseMove(object sender, MouseEventArgs e) - { - HitTestResult result = chart1.HitTest(e.X, e.Y, true); - if (result.PointIndex >= 0) - { - this.Cursor = Cursors.Hand; - } - else - { - this.Cursor = Cursors.Default; - } - } - - private void Export(GSOPoint3d _pnt, double r) - { - GSOPoint3ds pnts = new GSOPoint3ds(); - GSOPoint3d pnt = new GSOPoint3d(); - pnt.X = _pnt.X; - pnt.Y = _pnt.Y; - pnt.Z = _pnt.Z; - pnts.Add(pnt); - pnt.X = _pnt.X; - pnt.Y = _pnt.Y - 0.0000000005; - pnt.Z = _pnt.Z; - pnts.Add(pnt); - GSOGeoPolyline3D line = new GSOGeoPolyline3D(); - line.AddPart(pnts); - GSOGeoPolygon3D polygon = line.CreateBuffer(r * 2, true, 5, true, false); - GSOPoint3ds points = polygon[0]; - GSOGeoPolyline3D newLine = new GSOGeoPolyline3D(); - newLine.AddPart(points); - newLine.AltitudeMode = EnumAltitudeMode.RelativeToGround; - GSOFeature newFeature = new GSOFeature(); - newFeature.Geometry = newLine; - globeControl1.Globe.MemoryLayer.AddFeature(newFeature); - } - - private void ExportCAD(double a, double b, double r) - { - GSOPoint3ds pnts = new GSOPoint3ds(); - for (int i = 0; i <= 64; i++) - { - double x = a + r * Math.Cos(i * 5.625 * Math.PI / 180); - double y = b - r * Math.Sin(i * 5.625 * Math.PI / 180); - GSOPoint2d pt2d = new GeoScene.Data.GSOPoint2d(x, y); - GSOPoint3d pnt = new GSOPoint3d(); - pnt.X = pt2d.X; - pnt.Y = pt2d.Y; - pnt.Z = 0; - pnts.Add(pnt); - } - GSOGeoPolyline3D line = new GSOGeoPolyline3D(); - line.AddPart(pnts); - GSOFeature f = new GSOFeature(); - f.Geometry = line; - f.Geometry.LatLonCoord = false; - f.Visible = false; - layerTemp.AddFeature(f); - } - /// - /// 导出CAD按钮事件处理 - /// - /// - /// - private void btnExportCAD_Click(object sender, EventArgs e) - { - layerTemp.RemoveAllFeature(); - for (int i = 0; i < listPoint.Count; i++) - { - GSOPoint3d geoPoint = (GSOPoint3d)listPoint[i]; - GSOFeature feature = listFeat[i] as GSOFeature; - if (feature != null) - { - if (feature.Geometry.Type == EnumGeometryType.GeoPolyline3D) - { - GSOPipeLineStyle3D style = feature.Geometry.Style as GSOPipeLineStyle3D; - double r = style.Radius; - ExportCAD(double.Parse(sortIndex[i, 0].ToString()), geoPoint.Z, r); - } - } - } - layerTemp.Dataset.ImportProjectionRefFromProj4(""); - SaveFileDialog dlg = new SaveFileDialog(); - dlg.Filter = "*.dxf|*.dxf"; - if (dlg.ShowDialog() == DialogResult.OK) - { - layerTemp.SaveAs(dlg.FileName); - MessageBox.Show("导出CAD完成!", "提示"); - } - layerTemp.RemoveAllFeature(); - } - } -} diff --git a/FrmRoadHDM.designer.cs b/FrmRoadHDM.designer.cs deleted file mode 100644 index 23a4c3b..0000000 --- a/FrmRoadHDM.designer.cs +++ /dev/null @@ -1,132 +0,0 @@ -namespace Cyberpipe -{ - partial class FrmRoadHDM - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmRoadHDM)); - System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea1 = new System.Windows.Forms.DataVisualization.Charting.ChartArea(); - System.Windows.Forms.DataVisualization.Charting.Series series1 = new System.Windows.Forms.DataVisualization.Charting.Series(); - this.pictureBox1 = new System.Windows.Forms.PictureBox(); - this.webBrowser1 = new System.Windows.Forms.WebBrowser(); - this.chart1 = new System.Windows.Forms.DataVisualization.Charting.Chart(); - this.btnExportCAD = new DevComponents.DotNetBar.ButtonX(); - ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.chart1)).BeginInit(); - this.SuspendLayout(); - // - // pictureBox1 - // - this.pictureBox1.BackColor = System.Drawing.Color.White; - this.pictureBox1.Dock = System.Windows.Forms.DockStyle.Top; - this.pictureBox1.ErrorImage = null; - this.pictureBox1.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image"))); - this.pictureBox1.ImageLocation = ""; - this.pictureBox1.Location = new System.Drawing.Point(0, 0); - this.pictureBox1.Name = "pictureBox1"; - this.pictureBox1.Size = new System.Drawing.Size(608, 64); - this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; - this.pictureBox1.TabIndex = 1; - this.pictureBox1.TabStop = false; - // - // webBrowser1 - // - this.webBrowser1.Dock = System.Windows.Forms.DockStyle.Bottom; - this.webBrowser1.Location = new System.Drawing.Point(0, 326); - this.webBrowser1.MinimumSize = new System.Drawing.Size(20, 20); - this.webBrowser1.Name = "webBrowser1"; - this.webBrowser1.ScrollBarsEnabled = false; - this.webBrowser1.Size = new System.Drawing.Size(608, 139); - this.webBrowser1.TabIndex = 3; - // - // chart1 - // - chartArea1.AxisX.MajorGrid.Enabled = false; - chartArea1.Name = "ChartArea1"; - this.chart1.ChartAreas.Add(chartArea1); - this.chart1.Location = new System.Drawing.Point(0, 66); - this.chart1.Name = "chart1"; - this.chart1.RightToLeft = System.Windows.Forms.RightToLeft.Yes; - series1.ChartArea = "ChartArea1"; - series1.Name = "管线"; - this.chart1.Series.Add(series1); - this.chart1.Size = new System.Drawing.Size(608, 254); - this.chart1.TabIndex = 2; - this.chart1.Text = "chart1"; - this.chart1.MouseClick += new System.Windows.Forms.MouseEventHandler(this.chart1_MouseClick); - this.chart1.MouseMove += new System.Windows.Forms.MouseEventHandler(this.chart1_MouseMove); - // - // btnExportCAD - // - this.btnExportCAD.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; - this.btnExportCAD.Anchor = System.Windows.Forms.AnchorStyles.Bottom; - this.btnExportCAD.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground; - this.btnExportCAD.Location = new System.Drawing.Point(268, 430); - this.btnExportCAD.Name = "btnExportCAD"; - this.btnExportCAD.Size = new System.Drawing.Size(75, 23); - this.btnExportCAD.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; - this.btnExportCAD.TabIndex = 4; - this.btnExportCAD.Text = "导出CAD"; - this.btnExportCAD.Click += new System.EventHandler(this.btnExportCAD_Click); - // - // FrmRoadHDM - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.BackColor = System.Drawing.Color.White; - this.ClientSize = new System.Drawing.Size(608, 465); - this.Controls.Add(this.btnExportCAD); - this.Controls.Add(this.chart1); - this.Controls.Add(this.webBrowser1); - this.Controls.Add(this.pictureBox1); - this.DoubleBuffered = true; - this.EnableGlass = false; - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; - this.MaximizeBox = false; - this.Name = "FrmRoadHDM"; - this.ShowIcon = false; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; - this.Text = "道路与管线综合横断面"; - this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FrmRoadHDM_FormClosing); - this.Load += new System.EventHandler(this.FrmRoadHDM_Load); - this.Shown += new System.EventHandler(this.FrmRoadHDM_Shown); - ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.chart1)).EndInit(); - this.ResumeLayout(false); - - } - - #endregion - - private System.Windows.Forms.PictureBox pictureBox1; - private System.Windows.Forms.WebBrowser webBrowser1; - private System.Windows.Forms.DataVisualization.Charting.Chart chart1; - private DevComponents.DotNetBar.ButtonX btnExportCAD; - - - } -} \ No newline at end of file diff --git a/FrmRoadHDM.resx b/FrmRoadHDM.resx deleted file mode 100644 index 5202d5f..0000000 --- a/FrmRoadHDM.resx +++ /dev/null @@ -1,177 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - - - 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 - iNKUe3NRsLcAAAAASUVORK5CYII= - - - \ No newline at end of file diff --git a/MainFrm.cs b/MainFrm.cs index e9b6cbe..2df3aac 100644 --- a/MainFrm.cs +++ b/MainFrm.cs @@ -75,15 +75,6 @@ private string trackflag;//定义阀门查询个数 - private GSOFeature m_ConnexityAnalysisFirstFeature; - private GSOFeature m_ConnexityAnaylsisSecondFeature; - private GSOLayer m_ConnexityAnalysisFirstLayer; - private GSOLayer m_COnnexityAnalysisSecondLayer; - private GSOFeatures m_ConnexityAnalyResFeatures; - private GSOFeatures m_TraceUpDownAnalyResFeatures; - private GSOFeatures m_AffectedPipeLines; - private GSOFeatures m_CloseValvesAnalyResFeatures; - private GSOFeatures m_BoosterValvesAnalyResFeatures; //管线间距分析 private GSOFeature disFeature = new GSOFeature(); private GSOFeature featureDis = new GSOFeature(); @@ -2656,8 +2647,37 @@ ///
/// /// + private static EnumTrackPolylineEndMode trackPolylineEndMode; + void globeControl1_TrackPolylineEndEvent(object sender, TrackPolylineEndEventArgs e) { + //横断面分析、道路横断面分析 + if (trackPolylineEndMode == EnumTrackPolylineEndMode.HDM_Analysis|| + trackPolylineEndMode == EnumTrackPolylineEndMode.DLDM_Analysis) + { + Dictionary hdmDic = SectionAnalysisTool.HDMAnalysis(this.globeControl1, + e.Polyline, this.m_PipelineLayerNames); + FrmHDMAnalysis3 frm = new FrmHDMAnalysis3(hdmDic, this.globeControl1, + trackPolylineEndMode); + frm.Show(this); + } + //基线剖面分析 + else if (trackPolylineEndMode == EnumTrackPolylineEndMode.JXPM_Analysis) + { + FrmBaseLineProfillAnalysis dlg = new FrmBaseLineProfillAnalysis(globeControl1.Globe, e.Polyline); + dlg.Show(this); + globeControl1.Globe.ClearLastTrackPolyline(); + /* + FrmRoadHDM f = new FrmRoadHDM(); + f.Show() + * **/ + } + else + { + + } + trackPolylineEndMode = EnumTrackPolylineEndMode.Default_Analysis; + /* ArrayList arraylistPoint = new ArrayList(); ArrayList arraylistLine = new ArrayList(); @@ -2835,6 +2855,7 @@ } globeControl1.Globe.Action = EnumAction3D.ActionNull; ActionToolMenuChecked(); + * **/ } #endregion @@ -4962,10 +4983,10 @@ if (globeControl1.Globe.Action != EnumAction3D.NormalHit) { buttonItemFX3_6.Checked = false; - ClearConnexityAnalysis(); + // ClearConnexityAnalysis(); buttonItemFX3_5.Checked = false; - ClearCloseValvesAnalysis(); + // ClearCloseValvesAnalysis(); } if (globeControl1.Globe.Action != EnumAction3D.TrackPolygon) { @@ -4973,131 +4994,7 @@ buttonItemFX4_1.Checked = false; } } - /// - /// 连通性分析 功能 - /// - private void ConnexityAnalysis() - { - GSODataset curCAYDataset = m_ConnexityAnalysisFirstLayer.Dataset; - string srName = curCAYDataset.Name; - GSONetworkDataset curCAYNDataset = curCAYDataset.DataSource.GetDatasetByName(srName + "Network") as GSONetworkDataset; - if (curCAYNDataset == null) - { - MessageBox.Show("该图层没有创建网络拓扑,请先创建网络拓扑信息再进行分析!", "提示"); - return; - } - int[] arryResID; - curCAYNDataset.ConnexityAnalysis(m_ConnexityAnalysisFirstFeature.ID, m_ConnexityAnaylsisSecondFeature.ID, out arryResID, false, true); - m_ConnexityAnalyResFeatures = m_ConnexityAnalysisFirstLayer.GetFeaturesByIDs(arryResID); - if (m_ConnexityAnalyResFeatures == null || m_ConnexityAnalyResFeatures.Length < 1) - { - String strLine1 = "管线:" + m_ConnexityAnalysisFirstFeature.ID; - String strLine2 = "管线:" + m_ConnexityAnaylsisSecondFeature.ID; - MessageBox.Show(strLine1 + " 与 " + strLine2 + " 不连通", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); - } - else - { - int nCount = m_ConnexityAnalyResFeatures.Length; - for (int i = 0; i < nCount; i++) - { - m_ConnexityAnalyResFeatures[i].HighLight = true; - GSOGeoPolyline3D geoline = m_ConnexityAnalyResFeatures[i].Geometry as GSOGeoPolyline3D; - if (geoline != null) - { - GSOLineStyle3D lineStyle = geoline.Style as GSOLineStyle3D; - if (lineStyle != null) - { - if (lineStyle.ArrowStyle == null) - { - lineStyle.ArrowStyle = new GSOArrowStyle(); - - } - lineStyle.ArrowStyle.BodyLen = 8; - lineStyle.ArrowVisible = true; - lineStyle.ArrowStyle.Play(); - } - } - } - globeControl1.Refresh(); - } - } - /// - /// 清除连通性分析结果 功能 - /// - private void ClearConnexityAnalysis() - { - if (m_ConnexityAnalysisFirstFeature != null) - { - m_ConnexityAnalysisFirstFeature.HighLight = false; - m_ConnexityAnalysisFirstFeature.Label = null; - } - if (m_ConnexityAnaylsisSecondFeature != null) - { - m_ConnexityAnaylsisSecondFeature.HighLight = false; - m_ConnexityAnaylsisSecondFeature.Label = null; - } - - m_ConnexityAnalysisFirstFeature = null; - m_ConnexityAnaylsisSecondFeature = null; - m_ConnexityAnalysisFirstLayer = null; - m_COnnexityAnalysisSecondLayer = null; - - if (m_ConnexityAnalyResFeatures != null) - { - int nCount = m_ConnexityAnalyResFeatures.Length; - - for (int i = 0; i < nCount; i++) - { - m_ConnexityAnalyResFeatures[i].HighLight = false; - GSOGeoPolyline3D geoline = m_ConnexityAnalyResFeatures[i].Geometry as GSOGeoPolyline3D; - if (geoline != null) - { - GSOLineStyle3D lineStyle = geoline.Style as GSOLineStyle3D; - if (lineStyle != null) - { - lineStyle.ArrowVisible = false; - } - } - } - m_ConnexityAnalyResFeatures = null; - - } - } - /// - /// 清除阀门分析结果 功能 - /// - private void ClearCloseValvesAnalysis() - { - if (m_CloseValvesAnalyResFeatures != null) - { - for (int i = 0; i < m_CloseValvesList.Count; i++) - { - GSOFeature feature = m_CloseValvesList[i] as GSOFeature; - feature.Label.Text = ""; - } - globeControl1.Refresh(); - m_CloseValvesAnalyResFeatures = null; - m_CloseValvesList = new ArrayList(); - } - } - /// - /// 清除阀门分析结果 功能 - /// - private void ClearBoosterValvesAnalysis() - { - if (m_BoosterValvesAnalyResFeatures != null) - { - for (int i = 0; i < m_BoosterValvesList.Count; i++) - { - GSOFeature feature = m_BoosterValvesList[i] as GSOFeature; - feature.Label.Text = ""; - } - globeControl1.Refresh(); - m_BoosterValvesAnalyResFeatures = null; - m_BoosterValvesList = new ArrayList(); - } - } /// /// 主窗体关闭事件处理 /// @@ -5118,211 +5015,7 @@ //注销id号为103的热键设定 // UnregisterHotKey(Handle, 103); } - /// - /// 清除追踪结果 功能 : Fan 可去掉了! - /// - private void ClearUpDownTraceAnalysis() - { - if (m_TraceUpDownAnalyResFeatures != null) - { - int nCount = m_TraceUpDownAnalyResFeatures.Length; - for (int i = 0; i < nCount; i++) - { - m_TraceUpDownAnalyResFeatures[i].HighLight = false; - GSOGeoPolyline3D geoline = m_TraceUpDownAnalyResFeatures[i].Geometry as GSOGeoPolyline3D; - if (geoline != null) - { - GSOLineStyle3D lineStyle = geoline.Style as GSOLineStyle3D; - if (lineStyle != null) - { - lineStyle.ArrowVisible = false; - } - } - } - m_TraceUpDownAnalyResFeatures = null; - } - } - /// - /// 取消所有高亮管线的高亮状态 - /// - private void ClearAffectedPipeLine() - { - if (m_AffectedPipeLines != null) - { - int nCount = m_AffectedPipeLines.Length; - for (int i = 0; i < nCount; i++) - { - m_AffectedPipeLines[i].HighLight = false; - } - m_AffectedPipeLines = null; - } - } - #region Fan 拓扑分析 - /// - /// 上下游追踪 功能 - /// - /// - private void NetworkTraceUpDown(Boolean bTraceUp) - { - GSOFeature selLineFeature = globeControl1.Globe.SelectedObject; - if (selLineFeature == null || selLineFeature.Geometry == null || selLineFeature.Geometry.Type != EnumGeometryType.GeoPolyline3D) - { - MessageBox.Show("请点击“编辑”—“选中对象”选择一条线!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); - return; - } - GSOLayer selLayer = globeControl1.Globe.SelectedObjectLayer; - - NetworkAnalysisTool.TraceUpDownAnalysis(bTraceUp, - selLineFeature, selLayer); - /* - if (globeControl1.Globe.SelectedObject == null) - { - MessageBox.Show("请点击“编辑”—“选中对象”选择一条线!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); - return; - } - GSOFeature selLineFeature = globeControl1.Globe.SelectedObject; - - if (selLineFeature.Geometry == null || selLineFeature.Geometry.Type != EnumGeometryType.GeoPolyline3D) - { - MessageBox.Show("请点击“编辑”—“选中对象”选择一条线!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); - return; - } - - if (globeControl1.Globe.SelectedObjectLayer == null) - { - MessageBox.Show("选中管线所在图层为空!", "提示"); - return; - } - - GSODataset curCAYDataset = globeControl1.Globe.SelectedObjectLayer.Dataset; - if (curCAYDataset == null || curCAYDataset.DataSource == null) - { - MessageBox.Show("选中管线所在图层不是数据库图层!", "提示"); - return; - } - - string srName = curCAYDataset.Name; - GSONetworkDataset curCAYNDataset = curCAYDataset.DataSource.GetDatasetByName(srName + "Network") as GSONetworkDataset; - - if (curCAYNDataset == null) - { - MessageBox.Show("选中管线所在图层没有创建拓扑!", "提示"); - return; - } - - int[] arryResID; - curCAYNDataset.TraceUpDownAnalysis(selLineFeature.ID, out arryResID, bTraceUp, false, true); - m_TraceUpDownAnalyResFeatures = globeControl1.Globe.SelectedObjectLayer.GetFeaturesByIDs(arryResID); - if (m_TraceUpDownAnalyResFeatures == null || m_TraceUpDownAnalyResFeatures.Length < 1) - { - String strLine1 = "没有上游!"; - if (!bTraceUp) - { - strLine1 = "没有下游!"; - - } - MessageBox.Show(strLine1); - } - else - { - int nCount = m_TraceUpDownAnalyResFeatures.Length; - for (int i = 0; i < nCount; i++) - { - m_TraceUpDownAnalyResFeatures[i].HighLight = true; - GSOGeoPolyline3D geoline = m_TraceUpDownAnalyResFeatures[i].Geometry as GSOGeoPolyline3D; - if (geoline != null) - { - GSOLineStyle3D lineStyle = geoline.Style as GSOLineStyle3D; - if (lineStyle != null) - { - if (lineStyle.ArrowStyle == null) - { - lineStyle.ArrowStyle = new GSOArrowStyle(); - lineStyle.ArrowStyle.BodyWidth = 2; - lineStyle.ArrowStyle.BodyLen = 6; - lineStyle.ArrowStyle.HeadWidth = 8; - lineStyle.ArrowStyle.HeadLen = 10; - lineStyle.ArrowStyle.OutlineVisible = true; - lineStyle.ArrowStyle.OutlineColor = Color.Red; - lineStyle.ArrowStyle.Speed = lineStyle.ArrowStyle.Speed / 2; - } - lineStyle.ArrowVisible = true; - lineStyle.ArrowStyle.Play(); - } - } - } - globeControl1.Refresh(); - } - * **/ - } - - #endregion - /// - /// 上下游追踪 功能 - /// - /// - private void AffectedPipeLine(Boolean bTraceUp) - { - if (globeControl1.Globe.SelectedObject == null) - { - MessageBox.Show("请点击“编辑”—“选中对象”选择一条线!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); - return; - } - GSOFeature selLineFeature = globeControl1.Globe.SelectedObject; - if (selLineFeature.Geometry == null || selLineFeature.Geometry.Type != EnumGeometryType.GeoPolyline3D) - { - MessageBox.Show("请点击“编辑”—“选中对象”选择一条线!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); - - return; - } - - if (globeControl1.Globe.SelectedObjectLayer == null) - { - return; - } - - GSODataset curCAYDataset = globeControl1.Globe.SelectedObjectLayer.Dataset; - if (curCAYDataset == null || curCAYDataset.DataSource == null) - { - return; - } - - string srName = curCAYDataset.Name; - GSONetworkDataset curCAYNDataset = curCAYDataset.DataSource.GetDatasetByName(srName + "Network") as GSONetworkDataset; - - if (curCAYNDataset == null) - { - return; - } - int[] arryResID; - curCAYNDataset.TraceUpDownAnalysis(selLineFeature.ID, out arryResID, bTraceUp, false, true); - m_AffectedPipeLines = globeControl1.Globe.SelectedObjectLayer.GetFeaturesByIDs(arryResID); - if (m_AffectedPipeLines == null || m_AffectedPipeLines.Length < 1) - { - } - else - { - int nCount = m_AffectedPipeLines.Length; - for (int i = 0; i < nCount; i++) - { - m_AffectedPipeLines[i].HighLight = true; - } - globeControl1.Refresh(); - } - } - /// - /// 清除上下游追踪结果 菜单 - /// - /// - /// - //private void buttonItem58_Click(object sender, EventArgs e) - //{ - // //日志记录 - // LogManager.saveLog(Utility.userName, this.buttonItem58.Text); - - // ClearUpDownTraceAnalysis(); - //} - + /// /// 显示流向 功能 /// @@ -5359,158 +5052,8 @@ } FrmCloseValves frm; - /// - /// 关阀分析 功能 - /// - /// - /// - /// - /// - private bool NetworkCloseValvesAnalysis(GSOFeature lineFeature, GSOPoint3d pntBreak, GSOLayer lineLayer) - { - /* - if (lineLayer == null || lineFeature == null || lineFeature.Geometry == null || lineFeature.Geometry.Type != EnumGeometryType.GeoPolyline3D) - { - return false; - } - GSODataset curCAYDataset = lineLayer.Dataset; - if (curCAYDataset == null || curCAYDataset.DataSource == null) - { - MessageBox.Show("该图层不是要素图层!", "提示"); - return false; - } - string srName = curCAYDataset.Name; - GSONetworkDataset curCAYNDataset = curCAYDataset.DataSource.GetDatasetByName(srName + "Network") as GSONetworkDataset; - - if (curCAYNDataset == null) - { - MessageBox.Show("该图层没有创建网络拓扑,请先创建网络拓扑信息再进行分析!", "提示"); - return false; - } - ClearCloseValvesAnalysis(); - - int[] arryResNodeID = null; - int[] arryResValveID = null; - try - { - curCAYNDataset.CloseValveAnalysis(lineFeature.ID, out arryResNodeID, out arryResValveID, false, true); - } - catch (Exception e) - { } - - string valveName = lineLayer.Caption; - valveName = valveName.Substring(0, valveName.IndexOf("管线")); - GSOLayer valveLayer = globeControl1.Globe.Layers[valveName + "阀门"]; - if (valveLayer == null) - { - MessageBox.Show("和选中对象所在管线图层相关联的阀门图层不存在!", "提示"); - return false; - } - - m_CloseValvesAnalyResFeatures = valveLayer.GetFeaturesByIDs(arryResValveID);// curCAYNDataset.NodeDataset.GetFeaturesByIDs(arryResValveID); - - if (m_CloseValvesAnalyResFeatures == null || m_CloseValvesAnalyResFeatures.Length < 1) - { - MessageBox.Show("没有找到要关闭的阀门!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); - if (frm != null) - { - frm.Close(); - } - } - else - { - int nCount = m_CloseValvesAnalyResFeatures.Length; - - if (nCount > 0) - { - frm = FrmCloseValves.getForm(globeControl1, m_CloseValvesAnalyResFeatures, m_CloseValvesList); - - if (!frm.Visible) - { - frm.Show(this); - } - } - }**/ - return true; - } FrmBoosterValvers frmbooster = null; - /// - /// 阀门分析 功能 - /// - /// - /// - /// - /// - private bool NetworkBoosterValvesAnalysis(GSOFeature lineFeature, GSOPoint3d pntBreak, GSOLayer lineLayer) - { - if (lineLayer == null || lineFeature == null || lineFeature.Geometry == null || lineFeature.Geometry.Type != EnumGeometryType.GeoPolyline3D) - { - return false; - } - GSODataset curCAYDataset = lineLayer.Dataset; - - if (curCAYDataset == null || curCAYDataset.DataSource == null) - { - return false; - } - string srName = curCAYDataset.Name; - GSONetworkDataset curCAYNDataset = curCAYDataset.DataSource.GetDatasetByName(srName + "Network") as GSONetworkDataset; - - if (curCAYNDataset == null) - { - MessageBox.Show("该图层没有创建网络拓扑,请先创建网络拓扑信息再进行分析!", "提示"); - return false; - } - ClearBoosterValvesAnalysis(); - ClearAffectedPipeLine(); - - int[] arryResNodeID = null; - int[] arryResValveID = null; - try - { - curCAYNDataset.CloseValveAnalysis(lineFeature.ID, out arryResNodeID, out arryResValveID, false, true); - } - catch (Exception e) - { - - } - //目前只有燃气管线 有阀门 - string valveName = lineLayer.Name; - valveName = valveName.Substring(0, valveName.IndexOf("管线")); - GSOLayer valveLayer = globeControl1.Globe.Layers[valveName + "阀门"]; - if (valveLayer == null) - { - MessageBox.Show("和选中对象所在管线图层相关联的阀门图层不存在!", "提示"); - return false; - } - m_BoosterValvesAnalyResFeatures = valveLayer.GetFeaturesByIDs(arryResValveID); - - if (m_BoosterValvesAnalyResFeatures == null || - m_BoosterValvesAnalyResFeatures.Length < 1) - { - MessageBox.Show("没有找到要关闭的阀门!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); - if (frmbooster != null) - { - frmbooster.Close(); - } - } - else - { - int nCount = m_BoosterValvesAnalyResFeatures.Length; - if (nCount > 0) - { - AffectedPipeLine(false); - frmbooster = FrmBoosterValvers.getForm(globeControl1, m_BoosterValvesAnalyResFeatures, m_BoosterValvesList, m_AffectedPipeLines); - frmbooster.setLstValvesName(); - if (!frmbooster.Visible) - { - frmbooster.Show(this); - } - } - } - return true; - } /// /// 垂直净距分析 功能界面中的 选择图层复选框 选中状态改变事件处理 @@ -7726,69 +7269,6 @@ double distance = lineline.GetSpaceLength(true, 6378137.0); return distance; } - /// - /// 判断管线是否相通 功能 - /// - /// - public bool isInterlinked() - { - if (globeControl1.Globe.SelObjectCount < 2) - { - MessageBox.Show("请选中至少两个管线!!"); - buttonItemFX3_6.Checked = false; - return false; - } - ClearConnexityAnalysis(); - globeControl1.Globe.GetSelectObject(0, out m_ConnexityAnalysisFirstFeature, out m_ConnexityAnalysisFirstLayer); - globeControl1.Globe.GetSelectObject(1, out m_ConnexityAnaylsisSecondFeature, out m_COnnexityAnalysisSecondLayer); - GSOGeoPolyline3D line1 = m_ConnexityAnalysisFirstFeature.Geometry as GSOGeoPolyline3D; - GSOGeoPolyline3D line2 = m_ConnexityAnaylsisSecondFeature.Geometry as GSOGeoPolyline3D; - if (line1 == null || line2 == null) - { - MessageBox.Show("请选择管线!!"); - return false; - } - GSOPipeLineStyle3D pipeStyle1 = line1.Style as GSOPipeLineStyle3D; - GSOPipeLineStyle3D pipeStyle2 = line2.Style as GSOPipeLineStyle3D; - if (pipeStyle1 == null || pipeStyle2 == null) - { - MessageBox.Show("请选择管线!!"); - return false; - } - if (!m_ConnexityAnalysisFirstLayer.IsSameInnerObject(m_COnnexityAnalysisSecondLayer)) - { - MessageBox.Show("不在同一个图层!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); - ClearConnexityAnalysis(); - return false; - } - else - { - GSODataset curCAYDataset = m_ConnexityAnalysisFirstLayer.Dataset; - string srName = curCAYDataset.Name; - GSONetworkDataset curCAYNDataset = curCAYDataset.DataSource.GetDatasetByName(srName + "Network") as GSONetworkDataset; - if (curCAYNDataset == null) - { - MessageBox.Show("该图层没有创建网络拓扑,请先创建网络拓扑信息再进行分析!", "提示"); - return false; - } - - int[] arryResID; - curCAYNDataset.ConnexityAnalysis(m_ConnexityAnalysisFirstFeature.ID, m_ConnexityAnaylsisSecondFeature.ID, out arryResID, false, true); - m_ConnexityAnalyResFeatures = m_ConnexityAnalysisFirstLayer.GetFeaturesByIDs(arryResID); - if (m_ConnexityAnalyResFeatures == null || m_ConnexityAnalyResFeatures.Length < 1) - { - String strLine1 = "管线:" + m_ConnexityAnalysisFirstFeature.ID; - String strLine2 = "管线:" + m_ConnexityAnaylsisSecondFeature.ID; - MessageBox.Show("请选择两条相通的管线!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); - return false; - } - else - { - return true; - } - } - } - /// /// 图层节点树中 节点 右键单击事件处理 @@ -9564,27 +9044,7 @@ } } - /// - /// 清除分析结果 - /// - /// - /// - //private void buttonItem131_Click(object sender, EventArgs e) - //{ - // LogManager.saveLog(Utility.userName, this.buttonItem131.Text); - - // clearFeatureHighLight(); - // //if (boolfrmShResult == true) - // //{ - // // frmShResult.Close(); - // //} - // //else - // //{ - - // //} - - // ClearRedlineAnalyseResult(); - //} + /// /// 清除渲染结果 /// @@ -10728,8 +10188,9 @@ buttonX16_Click(null, null); buttonClearAnalysisResult_Click(null, null); - ClearConnexityAnalysis();//清除连通性分析 - ClearCloseValvesAnalysis();//清除阀门分析 + NetworkAnalysisTool.ClearAllTopAnalysis(this.globeControl1); + // ClearConnexityAnalysis();//清除连通性分析 + // ClearCloseValvesAnalysis();//清除阀门分析 //清除管线间距分析 if (disFeature != null) @@ -10753,7 +10214,7 @@ globeControl1.Globe.UnderGroundFloor.Visible = false;//隐藏地下网格线 - ClearUpDownTraceAnalysis(); //清除上下游分析 + // ClearUpDownTraceAnalysis(); //清除上下游分析 globeControl1.Globe.RemoveAllPits();//清除所有坑 string[] markerStrs = new string[9]; @@ -11206,6 +10667,8 @@ sideBar1.Refresh(); Refresh(); } + + #region Predaotr,断面分析 /// /// 横断面分析 /// @@ -11213,26 +10676,11 @@ /// private void buttonItemFX2_1_Click(object sender, EventArgs e) { - //日志记录 - LogManager.saveLog(Utility.userName, this.buttonItemFX2_1.Text); - - if (!buttonItemFX2_1.Checked) - { - trackflag = "PolylineAnalysis"; - globeControl1.Globe.Action = EnumAction3D.TrackPolyline; - globeControl1.Globe.TrackPolylineTool.VerticalLineVisible = true; - globeControl1.Globe.TrackPolylineTool.TrackMode = EnumTrackMode.SpaceTrack; - buttonItemFX2_1.Checked = true; - buttonItemFX2_3.Checked = false; - buttonItemFX2_4.Checked = false; - } - else - { - globeControl1.Globe.Action = EnumAction3D.ActionNull; - buttonItemFX2_1.Checked = false; - globeControl1.Globe.TrackPolylineTool.VerticalLineVisible = false; - } - ActionToolMenuChecked(); + globeControl1.Globe.Action = EnumAction3D.TrackPolyline; + globeControl1.Globe.TrackPolylineTool.VerticalLineVisible = true; + globeControl1.Globe.TrackPolylineTool.TrackMode = EnumTrackMode.SpaceTrack; + trackPolylineEndMode = EnumTrackPolylineEndMode.HDM_Analysis; + } /// /// 纵断面分析 @@ -11241,235 +10689,28 @@ /// private void buttonItemFX2_2_Click(object sender, EventArgs e) { - //日志记录 - LogManager.saveLog(Utility.userName, this.buttonItemFX2_2.Text); - - if (globeControl1.Globe.SelObjectCount >= 1) + if (globeControl1.Globe.SelObjectCount<1) { - GSOFeatures selectFeatures = new GSOFeatures(); - for (int i = 0; i < globeControl1.Globe.SelObjectCount; i++) + MessageBox.Show("请选择一条或者多条管线!", "提示", MessageBoxButtons.OK, + MessageBoxIcon.Information); + return; + } + GSOFeatures selectFeatures = new GSOFeatures(); + for (int i = 0; i < globeControl1.Globe.SelObjectCount; i++) + { + GSOFeature feature = null; + GSOLayer layer = null; + globeControl1.Globe.GetSelectObject(i, out feature, out layer); + if (feature != null && feature.Geometry != null && feature.Geometry.Type == EnumGeometryType.GeoPolyline3D) { - GSOFeature feature = null; - GSOLayer layer = null; - globeControl1.Globe.GetSelectObject(i, out feature, out layer); - if (feature != null && feature.Geometry != null && feature.Geometry.Type == EnumGeometryType.GeoPolyline3D) - { - selectFeatures.Add(feature); - } - } - if (selectFeatures.Length < 1) - { - MessageBox.Show("请选择一条或者多条管线!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); - return; - } - List listFeature = new List(); - if (selectFeatures.Length == 1) - { - listFeature.Add(selectFeatures[0]); - } - else - { - //求多条管线纵断面 1,2,3 - //1 判断管线是否相连、且没有分叉 - for (int i = 0; i < selectFeatures.Length; i++) - { - GSOGeoPolyline3D line = selectFeatures[i].Geometry as GSOGeoPolyline3D; - bool isConnect = false; - int[] valueCount = new int[2]; - valueCount[0] = 0; - valueCount[1] = 0; - - if (line != null && line.PartCount > 0) - { - for (int j = 0; j < selectFeatures.Length; j++) - { - if (i == j) - { - continue; - } - GSOGeoPolyline3D newLine = selectFeatures[j].Geometry as GSOGeoPolyline3D; - if (newLine != null && newLine.PartCount > 0) - { - int minValueIndex = 0; - double limitValue = 1.0; - double[] value = new double[4]; - value[0] = getDistance(line[line.PartCount - 1][line[line.PartCount - 1].Count - 1], newLine[0][0]); - value[1] = getDistance(line[line.PartCount - 1][line[line.PartCount - 1].Count - 1], newLine[newLine.PartCount - 1][newLine[newLine.PartCount - 1].Count - 1]); - value[2] = getDistance(line[0][0], newLine[0][0]); - value[3] = getDistance(line[0][0], newLine[newLine.PartCount - 1][newLine[newLine.PartCount - 1].Count - 1]); - double minValue = value[0]; - for (int m = 1; m < value.Length; m++) - { - if (minValue > value[m]) - { - minValue = value[m]; - minValueIndex = m; - } - } - if (minValue < limitValue) - { - isConnect = true; - if (minValueIndex > 1) - { - valueCount[1]++; - } - else - { - valueCount[0]++; - } - } - } - } - if (!isConnect || valueCount[0] > 1 || valueCount[1] > 1) - { - MessageBox.Show("请选择相连接的一条线上的管线!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); - return; - } - } - } - //2 记录每一条相连接的管线的起点和终点,并添加到一条管线中 - for (int p = 0; p < selectFeatures.Length; p++) - { - GSOGeoPolyline3D line = selectFeatures[p].Geometry as GSOGeoPolyline3D; - if (line != null && line.PartCount > 0) - { - for (int n = 0; n < selectFeatures.Length; n++) - { - if (p == n) - { - continue; - } - GSOGeoPolyline3D newLine = selectFeatures[n].Geometry as GSOGeoPolyline3D; - if (newLine != null && newLine.PartCount > 0) - { - int minValueIndex = 0; - double limitValue = 1.0; - double[] value = new double[4]; - value[0] = getDistance(line[line.PartCount - 1][line[line.PartCount - 1].Count - 1], newLine[0][0]); - value[1] = getDistance(line[line.PartCount - 1][line[line.PartCount - 1].Count - 1], newLine[newLine.PartCount - 1][newLine[newLine.PartCount - 1].Count - 1]); - value[2] = getDistance(line[0][0], newLine[0][0]); - value[3] = getDistance(line[0][0], newLine[newLine.PartCount - 1][newLine[newLine.PartCount - 1].Count - 1]); - double minValue = value[0]; - for (int m = 1; m < value.Length; m++) - { - if (minValue > value[m]) - { - minValue = value[m]; - minValueIndex = m; - } - } - if (minValue < limitValue) - { - GSOFeature featureFromAllSelectedObj = new GSOFeature(); - GSOGeoPolyline3D lineFromAllSelectedObj = new GSOGeoPolyline3D(); - switch (minValueIndex) - { - case 0: - GSOPoint3ds linePart = new GSOPoint3ds(); - for (int i = 0; i < line.PartCount; i++) - { - for (int j = 0; j < line[i].Count; j++) - { - linePart.Add(line[i][j]); - } - } - for (int i = 0; i < newLine.PartCount; i++) - { - for (int j = 0; j < newLine[i].Count; j++) - { - linePart.Add(newLine[i][j]); - } - } - lineFromAllSelectedObj.AddPart(linePart); - break; - case 1: - linePart = new GSOPoint3ds(); - for (int i = 0; i < line.PartCount; i++) - { - for (int j = 0; j < line[i].Count; j++) - { - linePart.Add(line[i][j]); - } - } - for (int i = newLine.PartCount - 1; i >= 0; i--) - { - for (int j = newLine[i].Count - 1; j >= 0; j--) - { - linePart.Add(newLine[i][j]); - } - } - lineFromAllSelectedObj.AddPart(linePart); - break; - case 2: - linePart = new GSOPoint3ds(); - for (int i = line.PartCount - 1; i >= 0; i--) - { - for (int j = line[i].Count - 1; j >= 0; j--) - { - linePart.Add(line[i][j]); - } - } - for (int i = 0; i < newLine.PartCount; i++) - { - for (int j = 0; j < newLine[i].Count; j++) - { - linePart.Add(newLine[i][j]); - } - } - lineFromAllSelectedObj.AddPart(linePart); - break; - case 3: - linePart = new GSOPoint3ds(); - for (int i = line.PartCount - 1; i >= 0; i--) - { - for (int j = line[i].Count - 1; j >= 0; j--) - { - linePart.Add(line[i][j]); - } - } - for (int i = newLine.PartCount - 1; i >= 0; i--) - { - for (int j = newLine[i].Count - 1; j >= 0; j--) - { - linePart.Add(newLine[i][j]); - } - } - lineFromAllSelectedObj.AddPart(linePart); - break; - } - - featureFromAllSelectedObj.Geometry = lineFromAllSelectedObj; - - selectFeatures.Remove(n); - selectFeatures.Remove(p); - selectFeatures.Add(featureFromAllSelectedObj); - p--; - break; - } - } - } - } - } - //3 将合并之后的管线添加到集合中 - for (int h = 0; h < selectFeatures.Length; h++) - { - listFeature.Add(selectFeatures[h]); - } - } - //将选中的管线展示在窗体中 - if (listFeature.Count > 0) - { - FrmProfileAnalysis frm = new FrmProfileAnalysis(globeControl1, listFeature); - frm.Show(this); - } - else - { - MessageBox.Show("请选择相连接的管线!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); + selectFeatures.Add(feature); } } - else + List feats = SectionAnalysisTool.ZDMAnalysis(selectFeatures); + if (feats != null && feats.Count >= 1) { - MessageBox.Show("请选择一条或者多条管线!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); + FrmProfileAnalysis frm = new FrmProfileAnalysis(globeControl1, feats); + frm.Show(this); } } /// @@ -11479,25 +10720,11 @@ /// private void buttonItemFX2_3_Click(object sender, EventArgs e) { - //日志记录 - LogManager.saveLog(Utility.userName, this.buttonItemFX2_3.Text); + globeControl1.Globe.Action = EnumAction3D.TrackPolyline; + globeControl1.Globe.TrackPolylineTool.VerticalLineVisible = true; + globeControl1.Globe.TrackPolylineTool.TrackMode = EnumTrackMode.SpaceTrack; + trackPolylineEndMode = EnumTrackPolylineEndMode.DLDM_Analysis; - if (!buttonItemFX2_3.Checked) - { - trackflag = "RoadPolylineAnalysis"; - globeControl1.Globe.Action = EnumAction3D.TrackPolyline; - globeControl1.Globe.TrackPolylineTool.VerticalLineVisible = true; - buttonItemFX2_3.Checked = true; - buttonItemFX2_1.Checked = false; - buttonItemFX2_4.Checked = false; - } - else - { - globeControl1.Globe.Action = EnumAction3D.ActionNull; - buttonItemFX2_3.Checked = false; - globeControl1.Globe.TrackPolylineTool.VerticalLineVisible = false; - } - ActionToolMenuChecked(); } /// /// 基线剖面分析 @@ -11506,27 +10733,14 @@ /// private void buttonItemFX2_4_Click(object sender, EventArgs e) { - //日志记录 - LogManager.saveLog(Utility.userName, this.buttonItemFX2_4.Text); - - if (!buttonItemFX2_4.Checked) - { - globeControl1.Globe.Action = EnumAction3D.TrackPolyline; - //globeControl1.Globe.TrackPolylineAnalysis.VerticalLineVisible = true; - globeControl1.Globe.TrackPolylineTool.VerticalLineVisible = true; - buttonItemFX2_4.Checked = true; - buttonItemFX3_6.Checked = false; - buttonItemFX2_1.Checked = false; - } - else - { - globeControl1.Globe.Action = EnumAction3D.ActionNull; - buttonItemFX2_4.Checked = false; - //globeControl1.Globe.TrackPolylineAnalysis.VerticalLineVisible = false; - globeControl1.Globe.TrackPolylineTool.VerticalLineVisible = false; - } - ActionToolMenuChecked(); + globeControl1.Globe.Action = EnumAction3D.TrackPolyline; + globeControl1.Globe.TrackPolylineTool.VerticalLineVisible = true; + globeControl1.Globe.TrackPolylineTool.TrackMode = EnumTrackMode.SpaceTrack; + trackPolylineEndMode = EnumTrackPolylineEndMode.JXPM_Analysis; + } + + #endregion /// /// 创建拓扑 /// @@ -11540,7 +10754,7 @@ FrmGenAndFaMenTopu frm = new FrmGenAndFaMenTopu(globeControl1, m_PipelineLayerNames, valueLayerNames); frm.Show(this); } - #region Fan + #region Predator :拓扑分析 /// /// 上游分析 /// @@ -11550,8 +10764,6 @@ { //日志记录 LogManager.saveLog(Utility.userName, this.buttonItemFX3_2.Text); - - //ClearUpDownTraceAnalysis(); Fan NetworkTraceUpDown(true); } /// @@ -11563,10 +10775,27 @@ { //日志记录 LogManager.saveLog(Utility.userName, this.buttonItemFX3_3.Text); - - // ClearUpDownTraceAnalysis(); Fan NetworkTraceUpDown(false); } + + /// + /// 上下游追踪 功能 + /// + /// + private void NetworkTraceUpDown(Boolean bTraceUp) + { + GSOFeature selLineFeature = globeControl1.Globe.SelectedObject; + if (selLineFeature == null || selLineFeature.Geometry == null || selLineFeature.Geometry.Type != EnumGeometryType.GeoPolyline3D) + { + MessageBox.Show("请点击“编辑”—“选中对象”选择一条线!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); + return; + } + GSOLayer selLayer = globeControl1.Globe.SelectedObjectLayer; + + NetworkAnalysisTool.TraceUpDownAnalysis(bTraceUp, + selLineFeature, selLayer); + } + /// /// 流向分析 /// @@ -11618,43 +10847,6 @@ { MessageBox.Show("未找到关闭阀门"); } - - - //日志记录 - /* - LogManager.saveLog(Utility.userName, this.buttonItemFX3_5.Text); - - ClearCloseValvesAnalysis(); - if (globeControl1.Globe.SelObjectCount < 1) - { - MessageBox.Show("请选中至少一根管线!!"); - buttonItemFX3_5.Checked = false; - return; - } - GSOLayer resLayer = null; - GSOFeature resFeature = null; - globeControl1.Globe.GetSelectObject(0, out resFeature, out resLayer); - - GSOGeoPolyline3D line1 = resFeature.Geometry as GSOGeoPolyline3D; - if (line1 == null) - { - MessageBox.Show("请选择管线!!"); - return; - } - GSOPipeLineStyle3D pipeStyle1 = line1.Style as GSOPipeLineStyle3D; - if (pipeStyle1 == null) - { - MessageBox.Show("请选择管线!!"); - return; - } - GSOPoint3d resIntersetPoint = new GSOPoint3d(); - if (NetworkCloseValvesAnalysis(resFeature, resIntersetPoint, resLayer)) - { - //btnGFFX.Checked = false; - globeControl1.Globe.Action = EnumAction3D.ActionNull; - buttonItemFX3_5.Checked = false; - } - * **/ } /// @@ -11682,47 +10874,6 @@ return; } NetworkAnalysisTool.ConnexityAnalysis(selFeat0, selFeat1, layer0); - /* - //日志记录 - LogManager.saveLog(Utility.userName, this.buttonItemFX3_6.Text); - - if (globeControl1.Globe.SelObjectCount < 2) - { - MessageBox.Show("请选中至少两个管线!!"); - buttonItemFX3_6.Checked = false; - return; - } - ClearConnexityAnalysis(); - globeControl1.Globe.GetSelectObject(0, out m_ConnexityAnalysisFirstFeature, out m_ConnexityAnalysisFirstLayer); - globeControl1.Globe.GetSelectObject(1, out m_ConnexityAnaylsisSecondFeature, out m_COnnexityAnalysisSecondLayer); - GSOGeoPolyline3D line1 = m_ConnexityAnalysisFirstFeature.Geometry as GSOGeoPolyline3D; - GSOGeoPolyline3D line2 = m_ConnexityAnaylsisSecondFeature.Geometry as GSOGeoPolyline3D; - if (line1 == null || line2 == null) - { - MessageBox.Show("请选择管线!!"); - buttonItemFX3_6.Checked = false; - return; - } - - GSOPipeLineStyle3D pipeStyle1 = line1.Style as GSOPipeLineStyle3D; - GSOPipeLineStyle3D pipeStyle2 = line2.Style as GSOPipeLineStyle3D; - if (pipeStyle1 == null || pipeStyle2 == null) - { - MessageBox.Show("请选择管线!!"); - buttonItemFX3_6.Checked = false; - return; - } - if (!m_ConnexityAnalysisFirstLayer.IsSameInnerObject(m_COnnexityAnalysisSecondLayer)) - { - MessageBox.Show("不在同一个图层!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); - buttonItemFX3_6.Checked = false; - ClearConnexityAnalysis(); - } - else - { - ConnexityAnalysis(); - } - * **/ } /// /// 爆管分析 @@ -11731,8 +10882,6 @@ /// private void buttonItemFX3_7_Click(object sender, EventArgs e) { - //TODO LIST:关阀+上游 追踪 - NetworkTraceUpDown(true); //上游追踪: GSOFeature selLineFeature = globeControl1.Globe.SelectedObject; @@ -11747,73 +10896,8 @@ this.buttonItemFX3_5_Click(sender, e); //关阀分析: - //日志记录 - /* - LogManager.saveLog(Utility.userName, this.buttonItemFX3_7.Text); - ClearCloseValvesAnalysis(); - if (globeControl1.Globe.SelObjectCount < 1) - { - MessageBox.Show("请选中至少一个管线!!"); - return; - } - GSOLayer resLayer = null; - GSOFeature resFeature = null; - globeControl1.Globe.GetSelectObject(0, out resFeature, out resLayer); - - GSOGeoPolyline3D line1 = resFeature.Geometry as GSOGeoPolyline3D; - if (line1 == null) - { - MessageBox.Show("请选择管线!!"); - return; - } - GSOPipeLineStyle3D pipeStyle1 = line1.Style as GSOPipeLineStyle3D; - if (pipeStyle1 == null) - { - MessageBox.Show("请选择管线!!"); - return; - } - - GSOFeatures feats = globeControl1.Globe.MemoryLayer.GetFeatureByName("粒子要素", true); - if (feats.Length > 0) - globeControl1.Globe.MemoryLayer.RemoveFeatureByID(feats[0].ID); - //if (emitterFeature != null) - //{ - // globeControl1.Globe.MemoryLayer.RemoveFeatureByID(emitterFeature.ID); - //} - - GSOPoint3d pt = new GSOPoint3d(); - double length = line1.GetSpaceLength(true, 6378137);//线的长度 - GSOGeoPolyline3D lineLine = line1.GetSegment(0, length / 2); - GSOPoint3d point3d = lineLine[lineLine.PartCount - 1][lineLine[lineLine.PartCount - 1].Count - 1]; - pt.X = point3d.X; - pt.Y = point3d.Y; - pt.Z = point3d.Z; - - pt.Z += pipeStyle1.Radius * 2; - - if (resLayer.Caption.Contains("气")) - { - globeControl1.Globe.UnderGroundFloor.Visible = true; - AddFire(pt.X, pt.Y, pt.Z); - } - else if (resLayer.Caption.Contains("给水")) - { - globeControl1.Globe.UnderGroundFloor.Visible = true; - AddFountain(pt.X, pt.Y, pt.Z); - } - else if (resLayer.Caption.Contains("热力")) - { - globeControl1.Globe.UnderGroundFloor.Visible = true; - AddFountain(pt.X, pt.Y, pt.Z); - } - GSOPoint3d resIntersetPoint = new GSOPoint3d(); - if (NetworkBoosterValvesAnalysis(resFeature, resIntersetPoint, resLayer)) - { - globeControl1.Globe.Action = EnumAction3D.ActionNull; - } - * */ - } + #endregion /// /// 多边形开挖 diff --git a/NetworkAnalysisTool.cs b/NetworkAnalysisTool.cs index 7709e9d..67e1d2f 100644 --- a/NetworkAnalysisTool.cs +++ b/NetworkAnalysisTool.cs @@ -456,5 +456,15 @@ flowLayer = layer; } + //清除所有分析 + public static void ClearAllTopAnalysis(GSOGlobeControl globeControl) + { + ClearConnexityAnalysis(); + ClearExplodeAnalysis(globeControl); + ClearFlowDirectionAnalysis(); + ClearTraceUpDownAnalysis(); + ClearValvesAnalysis(); + } + } } diff --git a/SectionAnalysisTool.cs b/SectionAnalysisTool.cs new file mode 100644 index 0000000..9647393 --- /dev/null +++ b/SectionAnalysisTool.cs @@ -0,0 +1,332 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using GeoScene.Data; +using GeoScene.Engine; +using GeoScene.Globe; +using System.Windows.Forms; +namespace Cyberpipe +{ + public class HDMCoordinate + { + private double dis; + private double z; + + public double Dis + { + get { return dis; } + set { dis = value; } + } + public double Z + { + get { return z; } + set { z = value; } + } + } + public class SectionAnalysisTool + { + public static Dictionary hdmDic = new Dictionary(); + + public static void ClearHDMAnalysis(GSOGlobeControl globeControl) + { + hdmDic.Clear(); + globeControl.Globe.ClearLastTrackPolyline(); + globeControl.Globe.Action = EnumAction3D.ActionNull; + } + + /** + * 计算点与三维线之间的距离 + * **/ + private static HDMCoordinate getSpaceDisBetweenLineAndPoint(GSOPoint3d point, + GSOGeoPolyline3D polyLine) + { + double a_x = polyLine[0][0].X; + double a_y = polyLine[0][0].Y; + + int id = GeoScene.Data.GSOProjectManager.AddProject(Utility.projectStr); + GeoScene.Data.GSOPoint2d a_Point = GeoScene.Data.GSOProjectManager.Forward(new GSOPoint2d(a_x, + a_y), id);//user画的线的起始点 + + GeoScene.Data.GSOPoint2d pt2d = new GeoScene.Data.GSOPoint2d(point.X, point.Y); + GeoScene.Data.GSOPoint2d result = GeoScene.Data.GSOProjectManager.Forward(pt2d, id); + double B_x = result.X; + double B_y = result.Y; + + double x = System.Math.Abs(B_x - a_Point.X); + double y = System.Math.Abs(B_y - a_Point.Y); + double Dis = Math.Round(Math.Sqrt(x * x + y * y), 2); + HDMCoordinate coor = new HDMCoordinate(); + coor.Dis = Dis; + coor.Z = point.Z; + return coor; + } + + //横断面分析 + public static Dictionary HDMAnalysis(GSOGlobeControl globeControl, + GSOGeoPolyline3D polyLine, List pipeLayerNames) + { + ClearHDMAnalysis(globeControl); + + if (globeControl == null || polyLine == null|| + pipeLayerNames == null || pipeLayerNames.Count == 0) { return null; } + + globeControl.Globe.ClearLastTrackPolyline(); + globeControl.Globe.Action = EnumAction3D.ActionNull; + + GSOGeoPolygon3D polygon = polyLine.CreateBuffer(0.1, true, + 5, true, false); + + for (int i = 0; i < pipeLayerNames.Count; i++) + { + GSOLayer layer = globeControl.Globe.Layers. + GetLayerByCaption(pipeLayerNames[i]); + if(layer==null || layer.Visible==false|| + layer as GSOFeatureLayer==null) + continue; + + GSOFeatureLayer featurelayer = layer as GSOFeatureLayer; + GSOFeatures feats = featurelayer.FindFeaturesInPolygon(polygon, false); + if(feats==null||feats.Length==0) + continue; + + for (int j = 0; j < feats.Length; j++) + { + GSOFeature feateline = feats[j]; + GSOGeoPolyline3D geoline = feateline.Geometry as GSOGeoPolyline3D; + if(geoline!=null &&geoline.Style!=null&& + geoline.Style.GetType() == typeof(GSOPipeLineStyle3D)) + { + GSOPoint3d pntIntersect1 = new GSOPoint3d(); + GSOPoint3d pntIntersect2 = new GSOPoint3d(); + double honLen; + double verLen; + double dDist = globeControl.Globe.Analysis3D.ComputeTwoGeoPolylineDistance(polyLine, + geoline, out pntIntersect1, out pntIntersect2, out honLen, + out verLen, false, false, 0); + + if (dDist > -1) + { + HDMCoordinate coord = getSpaceDisBetweenLineAndPoint(pntIntersect2, polyLine); + hdmDic.Add(feateline, coord); + } + + } + + } + } + return hdmDic; + } + + //纵断面分析 + public static List ZDMAnalysis(GSOFeatures selectFeatures) + { + List result = new List(); + if (selectFeatures != null && selectFeatures.Length == 1) + { + result.Add(selectFeatures[0]); + return result; + } + + for (int i = 0; i < selectFeatures.Length; i++) + { + GSOGeoPolyline3D line = selectFeatures[i].Geometry as GSOGeoPolyline3D; + bool isConnect = false; + int[] valueCount = new int[2]; + valueCount[0] = 0; + valueCount[1] = 0; + if (line != null && line.PartCount > 0) + { + for (int j = 0; j < selectFeatures.Length; j++) + { + if (i == j) + { + continue; + } + GSOGeoPolyline3D newLine = selectFeatures[j].Geometry as GSOGeoPolyline3D; + if (newLine != null && newLine.PartCount > 0) + { + int minValueIndex = 0; + double limitValue = 1.0; + double[] value = new double[4]; + value[0] = getDistance(line[line.PartCount - 1][line[line.PartCount - 1].Count - 1], newLine[0][0]); + value[1] = getDistance(line[line.PartCount - 1][line[line.PartCount - 1].Count - 1], newLine[newLine.PartCount - 1][newLine[newLine.PartCount - 1].Count - 1]); + value[2] = getDistance(line[0][0], newLine[0][0]); + value[3] = getDistance(line[0][0], newLine[newLine.PartCount - 1][newLine[newLine.PartCount - 1].Count - 1]); + double minValue = value[0]; + for (int m = 1; m < value.Length; m++) + { + if (minValue > value[m]) + { + minValue = value[m]; + minValueIndex = m; + } + } + if (minValue < limitValue) + { + isConnect = true; + if (minValueIndex > 1) + { + valueCount[1]++; + } + else + { + valueCount[0]++; + } + } + } + } + if (!isConnect || valueCount[0] > 1 || valueCount[1] > 1) + { + MessageBox.Show("请选择相连接的一条线上的管线!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); + return null; + } + } + } + //2 记录每一条相连接的管线的起点和终点,并添加到一条管线中 + for (int p = 0; p < selectFeatures.Length; p++) + { + GSOGeoPolyline3D line = selectFeatures[p].Geometry as GSOGeoPolyline3D; + if (line != null && line.PartCount > 0) + { + for (int n = 0; n < selectFeatures.Length; n++) + { + if (p == n) + { + continue; + } + GSOGeoPolyline3D newLine = selectFeatures[n].Geometry as GSOGeoPolyline3D; + if (newLine != null && newLine.PartCount > 0) + { + int minValueIndex = 0; + double limitValue = 1.0; + double[] value = new double[4]; + value[0] = getDistance(line[line.PartCount - 1][line[line.PartCount - 1].Count - 1], newLine[0][0]); + value[1] = getDistance(line[line.PartCount - 1][line[line.PartCount - 1].Count - 1], newLine[newLine.PartCount - 1][newLine[newLine.PartCount - 1].Count - 1]); + value[2] = getDistance(line[0][0], newLine[0][0]); + value[3] = getDistance(line[0][0], newLine[newLine.PartCount - 1][newLine[newLine.PartCount - 1].Count - 1]); + double minValue = value[0]; + for (int m = 1; m < value.Length; m++) + { + if (minValue > value[m]) + { + minValue = value[m]; + minValueIndex = m; + } + } + if (minValue < limitValue) + { + GSOFeature featureFromAllSelectedObj = new GSOFeature(); + GSOGeoPolyline3D lineFromAllSelectedObj = new GSOGeoPolyline3D(); + switch (minValueIndex) + { + case 0: + GSOPoint3ds linePart = new GSOPoint3ds(); + for (int i = 0; i < line.PartCount; i++) + { + for (int j = 0; j < line[i].Count; j++) + { + linePart.Add(line[i][j]); + } + } + for (int i = 0; i < newLine.PartCount; i++) + { + for (int j = 0; j < newLine[i].Count; j++) + { + linePart.Add(newLine[i][j]); + } + } + lineFromAllSelectedObj.AddPart(linePart); + break; + case 1: + linePart = new GSOPoint3ds(); + for (int i = 0; i < line.PartCount; i++) + { + for (int j = 0; j < line[i].Count; j++) + { + linePart.Add(line[i][j]); + } + } + for (int i = newLine.PartCount - 1; i >= 0; i--) + { + for (int j = newLine[i].Count - 1; j >= 0; j--) + { + linePart.Add(newLine[i][j]); + } + } + lineFromAllSelectedObj.AddPart(linePart); + break; + case 2: + linePart = new GSOPoint3ds(); + for (int i = line.PartCount - 1; i >= 0; i--) + { + for (int j = line[i].Count - 1; j >= 0; j--) + { + linePart.Add(line[i][j]); + } + } + for (int i = 0; i < newLine.PartCount; i++) + { + for (int j = 0; j < newLine[i].Count; j++) + { + linePart.Add(newLine[i][j]); + } + } + lineFromAllSelectedObj.AddPart(linePart); + break; + case 3: + linePart = new GSOPoint3ds(); + for (int i = line.PartCount - 1; i >= 0; i--) + { + for (int j = line[i].Count - 1; j >= 0; j--) + { + linePart.Add(line[i][j]); + } + } + for (int i = newLine.PartCount - 1; i >= 0; i--) + { + for (int j = newLine[i].Count - 1; j >= 0; j--) + { + linePart.Add(newLine[i][j]); + } + } + lineFromAllSelectedObj.AddPart(linePart); + break; + } + + featureFromAllSelectedObj.Geometry = lineFromAllSelectedObj; + + selectFeatures.Remove(n); + selectFeatures.Remove(p); + selectFeatures.Add(featureFromAllSelectedObj); + p--; + break; + } + } + } + } + } + + for (int h = 0; h < selectFeatures.Length; h++) + { + result.Add(selectFeatures[h]); + } + return result; + } + + private static double getDistance(GSOPoint3d point1, GSOPoint3d point2) + { + GSOGeoPolyline3D lineline = new GSOGeoPolyline3D(); + GSOPoint3ds point3ds = new GSOPoint3ds(); + point3ds.Add(point1); + point3ds.Add(point2); + lineline.AddPart(point3ds); + + double distance = lineline.GetSpaceLength(true, 6378137.0); + return distance; + } + + + + } +} \ No newline at end of file diff --git a/obj/x64/Debug/Cyberpipe.FrmHDMAnalysis3.resources b/obj/x64/Debug/Cyberpipe.FrmHDMAnalysis3.resources index 6c05a97..3c2db6a 100644 --- a/obj/x64/Debug/Cyberpipe.FrmHDMAnalysis3.resources +++ b/obj/x64/Debug/Cyberpipe.FrmHDMAnalysis3.resources Binary files differ diff --git a/obj/x64/Debug/Cyberpipe.csproj.FileListAbsolute.txt b/obj/x64/Debug/Cyberpipe.csproj.FileListAbsolute.txt index 326e5c4..ada21ca 100644 --- a/obj/x64/Debug/Cyberpipe.csproj.FileListAbsolute.txt +++ b/obj/x64/Debug/Cyberpipe.csproj.FileListAbsolute.txt @@ -298,7 +298,6 @@ F:\predator\codeReview\GHFX_SZ_64\obj\x64\Debug\Cyberpipe.FrmRegionTypeMgr.resources F:\predator\codeReview\GHFX_SZ_64\obj\x64\Debug\Cyberpipe.FrmRESC.resources F:\predator\codeReview\GHFX_SZ_64\obj\x64\Debug\Cyberpipe.FrmRESCMgr.resources -F:\predator\codeReview\GHFX_SZ_64\obj\x64\Debug\Cyberpipe.FrmRoadHDM.resources F:\predator\codeReview\GHFX_SZ_64\obj\x64\Debug\Cyberpipe.FrmRole.resources F:\predator\codeReview\GHFX_SZ_64\obj\x64\Debug\Cyberpipe.FrmRoleMgr.resources F:\predator\codeReview\GHFX_SZ_64\obj\x64\Debug\Cyberpipe.FrmSetGoalLayer.resources diff --git a/obj/x64/Debug/Cyberpipe.csproj.GenerateResource.Cache b/obj/x64/Debug/Cyberpipe.csproj.GenerateResource.Cache index 9f5532e..df4a038 100644 --- a/obj/x64/Debug/Cyberpipe.csproj.GenerateResource.Cache +++ b/obj/x64/Debug/Cyberpipe.csproj.GenerateResource.Cache Binary files differ diff --git a/obj/x64/Debug/Cyberpipe.csprojResolveAssemblyReference.cache b/obj/x64/Debug/Cyberpipe.csprojResolveAssemblyReference.cache index e3d297c..972ba95 100644 --- a/obj/x64/Debug/Cyberpipe.csprojResolveAssemblyReference.cache +++ b/obj/x64/Debug/Cyberpipe.csprojResolveAssemblyReference.cache Binary files differ