diff --git a/Cyberpipe.suo b/Cyberpipe.suo index 3782cd4..0b445f3 100644 --- a/Cyberpipe.suo +++ b/Cyberpipe.suo Binary files differ diff --git a/Cyberpipe.suo b/Cyberpipe.suo index 3782cd4..0b445f3 100644 --- a/Cyberpipe.suo +++ b/Cyberpipe.suo Binary files differ diff --git a/DoublePanelAnalysis.cs b/DoublePanelAnalysis.cs index 6b17012..ddae545 100644 --- a/DoublePanelAnalysis.cs +++ b/DoublePanelAnalysis.cs @@ -49,8 +49,14 @@ } } - static void intalDataTable(DataTable dt) + /// + /// 单Feature对比方法 + /// + /// + /// + public static DataTable lineFeatureCompare(GSOLayer scLayer, GSOLayer sgLayer, string road, GSOGlobeControl globeControl1, GSOGlobeControl globeControl2) { + DataTable dt = new DataTable(); dt.Columns.Add("实测图层"); dt.Columns.Add("实测管段"); dt.Columns.Add("施工图层"); @@ -60,211 +66,201 @@ dt.Columns.Add("垂直距离/m"); dt.Columns.Add("垂直净距国标/m"); dt.Columns.Add("检测结果"); - } - - /// - /// 单Feature对比方法 - /// - /// - /// - public static DataTable lineFeatureCompare(GSOLayer scLayer, GSOLayer sgLayer, string road, GSOGlobeControl globeControl1, GSOGlobeControl globeControl2) - { - DataTable dt = new DataTable(); - intalDataTable(dt); if (scLayer.Caption.Contains("给水") || scLayer.Caption.Contains("雨水") || scLayer.Caption.Contains("污水") || scLayer.Caption.Contains("雨污")) { strLabel = "目标图层包含不符合《给水排水构筑物工程施工及验收规范》(GB50141-2008)要求的管段,具体内容如下:"; - CreateJiPaiShuiDataTable(scLayer, sgLayer, road, dt, globeControl1, globeControl2); +// CreateJiPaiShuiDataTable(scLayer, sgLayer, road, dt, globeControl1, globeControl2); } else if(scLayer.Caption.Contains("燃气")) { strLabel = "目标图层包含不符合《聚乙烯燃气管道工程技术规程》(GJJ63-2008)要求的管段,具体内容如下:"; - CreateRanQiDataTable(scLayer, sgLayer, road, dt, globeControl1, globeControl2); +// CreateRanQiDataTable(scLayer, sgLayer, road, dt, globeControl1, globeControl2); } else if (scLayer.Caption.Contains("供电")) { strLabel = "目标图层包含不符合《电力建设施工及验收技术规范》 (DL5031-94)要求的管段,具体内容如下:"; - CreateGongDianDataTable(scLayer, sgLayer, road, dt, globeControl1, globeControl2); +// CreateGongDianDataTable(scLayer, sgLayer, road, dt, globeControl1, globeControl2); } + GBJCDataTable(scLayer, sgLayer, road, dt, globeControl1, globeControl2); return dt; } - /// - /// 生成给排水监测结果表格 - /// - /// - /// - /// - /// - public static void CreateJiPaiShuiDataTable(GSOLayer scLayer, GSOLayer sgLayer, string road, - DataTable dt, GSOGlobeControl globeControl1, GSOGlobeControl globeControl2) - { - //给排水监测 - for (int i = 0; i < scLayer.GetAllFeatures().Length; i++) - { - GSOFeature scFeature = scLayer.GetAt(i); - if (scFeature.GetFieldAsString("所属道路") != road) continue; - - GSOGeoPolyline3D scLine = scFeature.Geometry as GSOGeoPolyline3D; - GSOGeoPolygon3D bufferPolygon = scLine.CreateBuffer(bufferWidth, true, 5, true, false); - - GSOFeatures sgFeatures = sgLayer.FindFeaturesInPolygon(bufferPolygon, true); - - InsertDataToJSDataTable(sgFeatures, scFeature, scLayer, sgLayer, scLine, globeControl1, - globeControl2, dt); - } - } - static void InsertDataToJSDataTable(GSOFeatures sgFeatures, GSOFeature scFeature, GSOLayer scLayer, GSOLayer sgLayer, - GSOGeoPolyline3D scLine,GSOGlobeControl globeControl1,GSOGlobeControl globeControl2,DataTable dt) - { - GSOFeature sgFeature = null; - //**判断同一个Feature - if (sgFeatures.Length < 1 || GetSameFeature(scFeature, scLayer, sgLayer, bufferWidth) == null) //不存在对应的施工管段 - { - scFeature.HighLight = true; - DataRow dr = dt.NewRow(); - dr[0] = scLayer.Caption; - dr[1] = scFeature.GetFieldAsString("编号"); - dr[2] = sgLayer.Caption; - dr[3] = "无"; - dr[4] = "无"; - dr[5] = scLayer.Caption.Contains("给水") ? "0.03" : "0.015"; - dr[6] = "无"; - - if (scFeature.GetFieldAsDouble("起始管底高程") <= 1) - dr[7] = scLayer.Caption.Contains("给水") ? "0.03" : "0.1"; - else - dr[7] = scLayer.Caption.Contains("给水") ? "0.03" : "0.015"; - dr[8] = "未设计管段"; - dt.Rows.Add(dr); - } - else - { - sgFeature = GetSameFeature(scFeature, scLayer, sgLayer, bufferWidth); - GSOGeoPolyline3D sgLine = sgFeature.Geometry as GSOGeoPolyline3D; - double horizonDistance, verticalDistance; - - CalculateDistance(out verticalDistance, out horizonDistance, scLine, sgLine, globeControl1, - globeControl2); - JiShuiAnalysis(scLayer.Caption, sgLayer.Caption, scFeature, sgFeature, horizonDistance, - verticalDistance, dt); - } - } - /// - /// 生成燃气监测结果表格 - /// - /// - /// - /// - /// - public static void CreateRanQiDataTable(GSOLayer scLayer, GSOLayer sgLayer, string road, - DataTable dt, GSOGlobeControl globeControl1, GSOGlobeControl globeControl2) - { - //燃气监测 - for (int i = 0; i < scLayer.GetAllFeatures().Length; i++) - { - GSOFeature scFeature = scLayer.GetAt(i); - if (scFeature.GetFieldAsString("所属道路") != road) continue; - GSOGeoPolyline3D scLine = scFeature.Geometry as GSOGeoPolyline3D; - GSOGeoPolygon3D bufferPolygon = scLine.CreateBuffer(bufferWidth, true, 5, true, false); - - GSOFeatures sgFeatures = sgLayer.FindFeaturesInPolygon(bufferPolygon, true); - - InsertDataToRQDataTable(sgFeatures, scFeature, scLayer, sgLayer, scLine, globeControl1, - globeControl2, dt); - - } - } - static void InsertDataToRQDataTable(GSOFeatures sgFeatures, GSOFeature scFeature, GSOLayer scLayer, GSOLayer sgLayer, - GSOGeoPolyline3D scLine, GSOGlobeControl globeControl1, GSOGlobeControl globeControl2, DataTable dt) - { - GSOFeature sgFeature = null; - //**判断同一个Feature - if (sgFeatures.Length < 1 || GetSameFeature(scFeature, scLayer, sgLayer, bufferWidth) == null) - { - scFeature.HighLight = true; - DataRow dr = dt.NewRow(); - dr[0] = scLayer.Caption; - dr[1] = scFeature.GetFieldAsString("编号"); - dr[2] = sgLayer.Caption; - dr[3] = "无"; - dr[4] = "无"; - dr[5] = "0.06"; - dr[6] = "无"; - dr[7] = "0.06"; - dr[8] = "未设计管段"; - dt.Rows.Add(dr); - } - else - { - sgFeature = GetSameFeature(scFeature, scLayer, sgLayer, bufferWidth); - - GSOGeoPolyline3D sgLine = sgFeature.Geometry as GSOGeoPolyline3D; - double horizonDistance, verticalDistance; - - CalculateDistance(out verticalDistance, out horizonDistance, scLine, sgLine, globeControl1, - globeControl2); - RanQiAnalysis(scLayer.Caption, sgLayer.Caption, scFeature, sgFeature, horizonDistance, - verticalDistance, dt); - } - } - /// - /// 生成供电监测结果表格 - /// - /// - /// - /// - /// - public static void CreateGongDianDataTable(GSOLayer scLayer, GSOLayer sgLayer, string road, - DataTable dt, GSOGlobeControl globeControl1, GSOGlobeControl globeControl2) - { - //供电监测 - for (int i = 0; i < scLayer.GetAllFeatures().Length; i++) - { - GSOFeature scFeature = scLayer.GetAt(i); - if (scFeature.GetFieldAsString("所属道路") != road) continue; - GSOGeoPolyline3D scLine = scFeature.Geometry as GSOGeoPolyline3D; - GSOGeoPolygon3D bufferPolygon = scLine.CreateBuffer(bufferWidth, true, 5, true, false); - - GSOFeatures sgFeatures = sgLayer.FindFeaturesInPolygon(bufferPolygon, true); - InsertDataToGDDataTable(sgFeatures, scFeature, scLayer, sgLayer, scLine, globeControl1, - globeControl2, dt); - } - } - static void InsertDataToGDDataTable(GSOFeatures sgFeatures, GSOFeature scFeature, GSOLayer scLayer, GSOLayer sgLayer, - GSOGeoPolyline3D scLine, GSOGlobeControl globeControl1, GSOGlobeControl globeControl2, DataTable dt) - { - GSOFeature sgFeature = null; - //**判断同一个Feature - if (sgFeatures.Length < 1 || GetSameFeature(scFeature, scLayer, sgLayer, bufferWidth) == null) - { - scFeature.HighLight = true; - DataRow dr = dt.NewRow(); - dr[0] = scLayer.Caption; - dr[1] = scFeature.GetFieldAsString("编号"); - dr[2] = sgLayer.Caption; - dr[3] = "无"; - dr[4] = "无"; - dr[5] = "0.02"; - dr[6] = "无"; - dr[7] = "0.02"; - dr[8] = "未设计管段"; - dt.Rows.Add(dr); - } - else - { - sgFeature = GetSameFeature(scFeature, scLayer, sgLayer, bufferWidth); - - GSOGeoPolyline3D sgLine = sgFeature.Geometry as GSOGeoPolyline3D; - double horizonDistance, verticalDistance; - - CalculateDistance(out verticalDistance, out horizonDistance, scLine, sgLine, globeControl1, - globeControl2); - GongDianAnalysis(scLayer.Caption, sgLayer.Caption, scFeature, sgFeature, horizonDistance, - verticalDistance, dt); - } - } +// /// +// /// 生成给排水监测结果表格 +// /// +// /// +// /// +// /// +// /// +// public static void CreateJiPaiShuiDataTable(GSOLayer scLayer, GSOLayer sgLayer, string road, +// DataTable dt, GSOGlobeControl globeControl1, GSOGlobeControl globeControl2) +// { +// //给排水监测 +// for (int i = 0; i < scLayer.GetAllFeatures().Length; i++) +// { +// GSOFeature scFeature = scLayer.GetAt(i); +// if (scFeature.GetFieldAsString("所属道路") != road) continue; +// +// GSOGeoPolyline3D scLine = scFeature.Geometry as GSOGeoPolyline3D; +// GSOGeoPolygon3D bufferPolygon = scLine.CreateBuffer(bufferWidth, true, 5, true, false); +// +// GSOFeatures sgFeatures = sgLayer.FindFeaturesInPolygon(bufferPolygon, true); +// +// InsertDataToJSDataTable(sgFeatures, scFeature, scLayer, sgLayer, scLine, globeControl1, +// globeControl2, dt); +// } +// } +// static void InsertDataToJSDataTable(GSOFeatures sgFeatures, GSOFeature scFeature, GSOLayer scLayer, GSOLayer sgLayer, +// GSOGeoPolyline3D scLine,GSOGlobeControl globeControl1,GSOGlobeControl globeControl2,DataTable dt) +// { +// GSOFeature sgFeature = null; +// //**判断同一个Feature +// if (sgFeatures.Length < 1 || GetSameFeature(scFeature, scLayer, sgLayer, bufferWidth) == null) //不存在对应的施工管段 +// { +// scFeature.HighLight = true; +// DataRow dr = dt.NewRow(); +// dr[0] = scLayer.Caption; +// dr[1] = scFeature.GetFieldAsString("编号"); +// dr[2] = sgLayer.Caption; +// dr[3] = "无"; +// dr[4] = "无"; +// dr[5] = scLayer.Caption.Contains("给水") ? "0.03" : "0.015"; +// dr[6] = "无"; +// +// if (scFeature.GetFieldAsDouble("起始管底高程") <= 1) +// dr[7] = scLayer.Caption.Contains("给水") ? "0.03" : "0.1"; +// else +// dr[7] = scLayer.Caption.Contains("给水") ? "0.03" : "0.015"; +// dr[8] = "未设计管段"; +// dt.Rows.Add(dr); +// } +// else +// { +// sgFeature = GetSameFeature(scFeature, scLayer, sgLayer, bufferWidth); +// GSOGeoPolyline3D sgLine = sgFeature.Geometry as GSOGeoPolyline3D; +// double horizonDistance, verticalDistance; +// +// CalculateDistance(out verticalDistance, out horizonDistance, scLine, sgLine, globeControl1, +// globeControl2); +// JiShuiAnalysis(scLayer.Caption, sgLayer.Caption, scFeature, sgFeature, horizonDistance, +// verticalDistance, dt); +// } +// } +// /// +// /// 生成燃气监测结果表格 +// /// +// /// +// /// +// /// +// /// +// public static void CreateRanQiDataTable(GSOLayer scLayer, GSOLayer sgLayer, string road, +// DataTable dt, GSOGlobeControl globeControl1, GSOGlobeControl globeControl2) +// { +// //燃气监测 +// for (int i = 0; i < scLayer.GetAllFeatures().Length; i++) +// { +// GSOFeature scFeature = scLayer.GetAt(i); +// if (scFeature.GetFieldAsString("所属道路") != road) continue; +// GSOGeoPolyline3D scLine = scFeature.Geometry as GSOGeoPolyline3D; +// GSOGeoPolygon3D bufferPolygon = scLine.CreateBuffer(bufferWidth, true, 5, true, false); +// +// GSOFeatures sgFeatures = sgLayer.FindFeaturesInPolygon(bufferPolygon, true); +// +// InsertDataToRQDataTable(sgFeatures, scFeature, scLayer, sgLayer, scLine, globeControl1, +// globeControl2, dt); +// +// } +// } +// static void InsertDataToRQDataTable(GSOFeatures sgFeatures, GSOFeature scFeature, GSOLayer scLayer, GSOLayer sgLayer, +// GSOGeoPolyline3D scLine, GSOGlobeControl globeControl1, GSOGlobeControl globeControl2, DataTable dt) +// { +// GSOFeature sgFeature = null; +// //**判断同一个Feature +// if (sgFeatures.Length < 1 || GetSameFeature(scFeature, scLayer, sgLayer, bufferWidth) == null) +// { +// scFeature.HighLight = true; +// DataRow dr = dt.NewRow(); +// dr[0] = scLayer.Caption; +// dr[1] = scFeature.GetFieldAsString("编号"); +// dr[2] = sgLayer.Caption; +// dr[3] = "无"; +// dr[4] = "无"; +// dr[5] = "0.06"; +// dr[6] = "无"; +// dr[7] = "0.06"; +// dr[8] = "未设计管段"; +// dt.Rows.Add(dr); +// } +// else +// { +// sgFeature = GetSameFeature(scFeature, scLayer, sgLayer, bufferWidth); +// +// GSOGeoPolyline3D sgLine = sgFeature.Geometry as GSOGeoPolyline3D; +// double horizonDistance, verticalDistance; +// +// CalculateDistance(out verticalDistance, out horizonDistance, scLine, sgLine, globeControl1, +// globeControl2); +// RanQiAnalysis(scLayer.Caption, sgLayer.Caption, scFeature, sgFeature, horizonDistance, +// verticalDistance, dt); +// } +// } +// /// +// /// 生成供电监测结果表格 +// /// +// /// +// /// +// /// +// /// +// public static void CreateGongDianDataTable(GSOLayer scLayer, GSOLayer sgLayer, string road, +// DataTable dt, GSOGlobeControl globeControl1, GSOGlobeControl globeControl2) +// { +// //供电监测 +// for (int i = 0; i < scLayer.GetAllFeatures().Length; i++) +// { +// GSOFeature scFeature = scLayer.GetAt(i); +// if (scFeature.GetFieldAsString("所属道路") != road) continue; +// GSOGeoPolyline3D scLine = scFeature.Geometry as GSOGeoPolyline3D; +// GSOGeoPolygon3D bufferPolygon = scLine.CreateBuffer(bufferWidth, true, 5, true, false); +// +// GSOFeatures sgFeatures = sgLayer.FindFeaturesInPolygon(bufferPolygon, true); +// InsertDataToGDDataTable(sgFeatures, scFeature, scLayer, sgLayer, scLine, globeControl1, +// globeControl2, dt); +// } +// } +// static void InsertDataToGDDataTable(GSOFeatures sgFeatures, GSOFeature scFeature, GSOLayer scLayer, GSOLayer sgLayer, +// GSOGeoPolyline3D scLine, GSOGlobeControl globeControl1, GSOGlobeControl globeControl2, DataTable dt) +// { +// GSOFeature sgFeature = null; +// //**判断同一个Feature +// if (sgFeatures.Length < 1 || GetSameFeature(scFeature, scLayer, sgLayer, bufferWidth) == null) +// { +// scFeature.HighLight = true; +// DataRow dr = dt.NewRow(); +// dr[0] = scLayer.Caption; +// dr[1] = scFeature.GetFieldAsString("编号"); +// dr[2] = sgLayer.Caption; +// dr[3] = "无"; +// dr[4] = "无"; +// dr[5] = "0.02"; +// dr[6] = "无"; +// dr[7] = "0.02"; +// dr[8] = "未设计管段"; +// dt.Rows.Add(dr); +// } +// else +// { +// sgFeature = GetSameFeature(scFeature, scLayer, sgLayer, bufferWidth); +// +// GSOGeoPolyline3D sgLine = sgFeature.Geometry as GSOGeoPolyline3D; +// double horizonDistance, verticalDistance; +// +// CalculateDistance(out verticalDistance, out horizonDistance, scLine, sgLine, globeControl1, +// globeControl2); +// GongDianAnalysis(scLayer.Caption, sgLayer.Caption, scFeature, sgFeature, horizonDistance, +// verticalDistance, dt); +// } +// } #region Fan Zhang 重构feature获取 public static double getLineLength(GSOFeature src,GSOLayer srcLayer,GSOGeoPolygon3D bufferPolygon) @@ -352,218 +348,326 @@ return reFeature; } #endregion +// /// +// /// 给排水规范审核 +// /// +// /// +// /// +// /// +// /// +// /// +// /// +// /// +// public static void JiShuiAnalysis(string scLayerName, string sgLayerName, GSOFeature scFeature, +// GSOFeature sgFeature, double horizonDistance, double verticalDistance, DataTable dt) +// { +// bool dtBool = false; +// +// DataRow dr = dt.NewRow(); +// dr[0] = scLayerName; +// dr[1] = scFeature.GetFieldAsString("编号"); +// dr[2] = sgLayerName; +// dr[3] = sgFeature.GetFieldAsString("编号"); +// +// if (scLayerName.Contains("给水")) +// { +// //水平 +// if (horizonDistance > 0.03) +// { +// dr[4] = Math.Round(horizonDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); +// dr[5] = "0.03"; +// dr[8] = dr[8] + "水平净距"; +// scFeature.HighLight = true; +// dtBool = true; +// } +// else +// { +// dr[4] = Math.Round(horizonDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); +// dr[5] = "0.03"; +// } +// //垂直 +// if (Math.Abs(verticalDistance) > 0.03) +// { +// dr[6] = Math.Round(verticalDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); +// dr[7] = "0.03"; +// dr[8] = dr[8] + "垂直净距"; +// scFeature.HighLight = true; +// dtBool = true; +// } +// else +// { +// dr[6] = Math.Round(verticalDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); +// dr[7] = "0.03"; +// } +// dr[8] = dr[8] + "超标"; +// } +// else +// { +// if (horizonDistance > 0.015) +// { +// dr[4] = Math.Round(horizonDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); +// dr[5] = "0.015"; +// scFeature.HighLight = true; +// dr[8] = dr[8] + "水平净距"; +// dtBool = true; +// } +// else +// { +// dr[4] = Math.Round(horizonDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); +// dr[5] = "0.015"; +// } +// if (scFeature.GetFieldAsDouble("起始管底高程") <= 1) +// { +// if (Math.Abs(verticalDistance) > 0.01) +// { +// dr[6] = Math.Round(verticalDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); +// dr[7] = "0.01"; +// scFeature.HighLight = true; +// dr[8] = dr[8] + "垂直净距"; +// dtBool = true; +// } +// else +// { +// dr[6] = Math.Round(verticalDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); +// dr[7] = "0.01"; +// } +// } +// else +// { +// if (Math.Abs(verticalDistance) > 0.015) +// { +// dr[6] = Math.Round(verticalDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); +// dr[7] = "0.015"; +// scFeature.HighLight = true; +// dr[8] = dr[8] + "垂直净距"; +// dtBool = true; +// } +// else +// { +// dr[6] = Math.Round(verticalDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); +// dr[7] = "0.015"; +// } +// } +// +// dr[8] = dr[8] + "超标"; +// } +// +// if (!dtBool) return; +// dt.Rows.Add(dr); +// } +// /// +// /// 燃气规范审核 +// /// +// /// +// /// +// /// +// /// +// /// +// /// +// /// +// public static void RanQiAnalysis(string scLayerName, string sgLayerName, GSOFeature scFeature, GSOFeature sgFeature, double horizonDistance, double verticalDistance, DataTable dt) +// { +// bool dtBool = false; +// +// DataRow dr = dt.NewRow(); +// dr[0] = scLayerName; +// dr[1] = scFeature.GetFieldAsString("编号"); +// dr[2] = sgLayerName; +// dr[3] = sgFeature.GetFieldAsString("编号"); +// +// //水平 +// if (horizonDistance > 0.06) +// { +//// dr[4] = Math.Round(horizonDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); +// dr[5] = "0.06"; +// dr[8] = dr[8] + "水平净距"; +// scFeature.HighLight = true; +// dtBool = true; +// } +// else +// { +// dr[4] = Math.Round(horizonDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); +// dr[5] = "0.06"; +// } +// //垂直 +// if (Math.Abs(verticalDistance) > 0.06) +// { +// dr[6] = Math.Round(verticalDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); +// dr[7] = "0.06"; +// dr[8] = dr[8] + "垂直净距"; +// scFeature.HighLight = true; +// dtBool = true; +// } +// else +// { +// dr[6] = Math.Round(verticalDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); +// dr[7] = "0.06"; +// } +// dr[8] = dr[8] + "超标"; +// +// if (!dtBool) return; +// dt.Rows.Add(dr); +// } +// /// +// /// 供电规范审核 +// /// +// /// +// /// +// /// +// /// +// /// +// /// +// /// +// public static void GongDianAnalysis(string scLayerName, string sgLayerName, GSOFeature scFeature, GSOFeature sgFeature, double horizonDistance, double verticalDistance, DataTable dt) +// { +// bool dtBool = false; +// +// DataRow dr = dt.NewRow(); +// dr[0] = scLayerName; +// dr[1] = scFeature.GetFieldAsString("编号"); +// dr[2] = sgLayerName; +// dr[3] = sgFeature.GetFieldAsString("编号"); +// +// //水平 +// if (horizonDistance > 0.02) +// { +// dr[4] = Math.Round(horizonDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); +// dr[5] = "0.02"; +// dr[8] = dr[8] + "水平净距"; +// scFeature.HighLight = true; +// dtBool = true; +// } +// else +// { +// dr[4] = Math.Round(horizonDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); +// dr[5] = "0.02"; +// } +// //垂直 +// if (Math.Abs(verticalDistance) > 0.02) +// { +// dr[6] = Math.Round(verticalDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); +// dr[7] = "0.02"; +// dr[8] = dr[8] + "垂直净距"; +// scFeature.HighLight = true; +// dtBool = true; +// } +// else +// { +// dr[6] = Math.Round(verticalDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); +// dr[7] = "0.02"; +// } +// dr[8] = dr[8] + "超标"; +// +// if (!dtBool) return; +// dt.Rows.Add(dr); +// } + /// - /// 给排水规范审核 + /// 国标检测table计算,某道路下的施工和实测feature的对比信息 /// - /// - /// - /// - /// - /// - /// + /// + /// + /// /// - public static void JiShuiAnalysis(string scLayerName, string sgLayerName, GSOFeature scFeature, - GSOFeature sgFeature, double horizonDistance, double verticalDistance, DataTable dt) + /// + /// + public static void GBJCDataTable(GSOLayer scLayer, GSOLayer sgLayer, string road, + DataTable dt, GSOGlobeControl globeControl1, GSOGlobeControl globeControl2) { - bool dtBool = false; - - DataRow dr = dt.NewRow(); - dr[0] = scLayerName; - dr[1] = scFeature.GetFieldAsString("编号"); - dr[2] = sgLayerName; - dr[3] = sgFeature.GetFieldAsString("编号"); - - if (scLayerName.Contains("给水")) + GSOFeatures scFeatures = scLayer.GetFeatureByFieldValue("所属道路", road, true); + + for (int i=0;i 0.03) + GSOFeature scFeature = scFeatures[i]; + GSOGeoPolyline3D scLine = scFeature.Geometry as GSOGeoPolyline3D; + if (scLine == null) continue; + GSOGeoPolygon3D bufferPolygon = scLine.CreateBuffer(bufferWidth, true, 5, true, false); + GSOFeatures sgFeatures = sgLayer.FindFeaturesInPolygon(bufferPolygon, true); + GSOFeature sgFeature = GetSameFeature(scFeature, scLayer, sgLayer, bufferWidth); + double hStandard = 0.02, vStandard = 0.02; + if (scLayer.Caption.Contains("给水")) { - dr[4] = Math.Round(horizonDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); - dr[5] = "0.03"; - dr[8] = dr[8] + "水平净距"; - scFeature.HighLight = true; - dtBool = true; - } - else + hStandard = 0.03; + vStandard = 0.03; + }else if (scLayer.Caption.Contains("雨水") || scLayer.Caption.Contains("污水") || scLayer.Caption.Contains("雨污")) { - dr[4] = Math.Round(horizonDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); - dr[5] = "0.03"; - } - //垂直 - if (Math.Abs(verticalDistance) > 0.03) - { - dr[6] = Math.Round(verticalDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); - dr[7] = "0.03"; - dr[8] = dr[8] + "垂直净距"; - scFeature.HighLight = true; - dtBool = true; - } - else - { - dr[6] = Math.Round(verticalDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); - dr[7] = "0.03"; - } - dr[8] = dr[8] + "超标"; - } - else - { - if (horizonDistance > 0.015) - { - dr[4] = Math.Round(horizonDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); - dr[5] = "0.015"; - scFeature.HighLight = true; - dr[8] = dr[8] + "水平净距"; - dtBool = true; - } - else - { - dr[4] = Math.Round(horizonDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); - dr[5] = "0.015"; - } - if (scFeature.GetFieldAsDouble("起始管底高程") <= 1) - { - if (Math.Abs(verticalDistance) > 0.01) + hStandard = 0.015; + vStandard = 0.015; + if (scFeature.GetFieldAsDouble("起始管底高程") <= 1) { - dr[6] = Math.Round(verticalDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); - dr[7] = "0.01"; - scFeature.HighLight = true; - dr[8] = dr[8] + "垂直净距"; - dtBool = true; - } - else - { - dr[6] = Math.Round(verticalDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); - dr[7] = "0.01"; + vStandard = 0.01; } } - else + else if (scLayer.Caption.Contains("燃气")) { - if (Math.Abs(verticalDistance) > 0.015) - { - dr[6] = Math.Round(verticalDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); - dr[7] = "0.015"; - scFeature.HighLight = true; - dr[8] = dr[8] + "垂直净距"; - dtBool = true; - } - else - { - dr[6] = Math.Round(verticalDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); - dr[7] = "0.015"; - } + hStandard = 0.06; + vStandard = 0.06; } - dr[8] = dr[8] + "超标"; + if (sgFeatures.Length < 1 || sgFeature == null) //不存在对应的施工管段 + { + scFeature.HighLight = true; + DataRow dr = dt.NewRow(); + dr[0] = scLayer.Caption; + dr[1] = scFeature.GetFieldAsString("编号"); + dr[2] = sgLayer.Caption; + dr[3] = "无"; + dr[4] = "无"; + dr[5] = hStandard; + dr[6] = "无"; + dr[7] = vStandard; + dr[8] = "未设计管段"; + dt.Rows.Add(dr); + } + else + { + GSOGeoPolyline3D sgLine = sgFeature.Geometry as GSOGeoPolyline3D; + double horizonDistance, verticalDistance; + CalculateDistance(out verticalDistance, out horizonDistance, scLine, sgLine, globeControl1, + globeControl2); + RowValueInsert(scFeature, sgFeature, horizonDistance, + verticalDistance,hStandard,vStandard,dt); + } } - - if (!dtBool) return; - dt.Rows.Add(dr); } /// - /// 燃气规范审核 + /// 填充datatable的行,如果符合标准,则直接返回 /// - /// - /// /// /// /// /// + /// + /// /// - public static void RanQiAnalysis(string scLayerName, string sgLayerName, GSOFeature scFeature, GSOFeature sgFeature, double horizonDistance, double verticalDistance, DataTable dt) + private static void RowValueInsert(GSOFeature scFeature, + GSOFeature sgFeature, double horizonDistance, + double verticalDistance,double hStandard,double vStandard,DataTable dt) { - bool dtBool = false; - + //符合标准 + if (horizonDistance <= hStandard && verticalDistance <= vStandard) return; + string scLayerName = scFeature.Dataset.Caption; DataRow dr = dt.NewRow(); dr[0] = scLayerName; dr[1] = scFeature.GetFieldAsString("编号"); - dr[2] = sgLayerName; + dr[2] = sgFeature.Dataset.Caption; dr[3] = sgFeature.GetFieldAsString("编号"); - - //水平 - if (horizonDistance > 0.06) + dr[4] = Math.Round(horizonDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); + dr[5] = hStandard.ToString(); + dr[6] = Math.Round(verticalDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); + dr[7] = vStandard.ToString(); + if (horizonDistance > hStandard) { - dr[4] = Math.Round(horizonDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); - dr[5] = "0.06"; - dr[8] = dr[8] + "水平净距"; + dr[8] = "水平净距超标"; scFeature.HighLight = true; - dtBool = true; } - else + if (verticalDistance > vStandard) { - dr[4] = Math.Round(horizonDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); - dr[5] = "0.06"; - } - //垂直 - if (Math.Abs(verticalDistance) > 0.06) - { - dr[6] = Math.Round(verticalDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); - dr[7] = "0.06"; - dr[8] = dr[8] + "垂直净距"; scFeature.HighLight = true; - dtBool = true; + dr[8] += " 垂直净距超标"; } - else - { - dr[6] = Math.Round(verticalDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); - dr[7] = "0.06"; - } - dr[8] = dr[8] + "超标"; - - if (!dtBool) return; dt.Rows.Add(dr); - } - /// - /// 供电规范审核 - /// - /// - /// - /// - /// - /// - /// - /// - public static void GongDianAnalysis(string scLayerName, string sgLayerName, GSOFeature scFeature, GSOFeature sgFeature, double horizonDistance, double verticalDistance, DataTable dt) - { - bool dtBool = false; - DataRow dr = dt.NewRow(); - dr[0] = scLayerName; - dr[1] = scFeature.GetFieldAsString("编号"); - dr[2] = sgLayerName; - dr[3] = sgFeature.GetFieldAsString("编号"); - - //水平 - if (horizonDistance > 0.02) - { - dr[4] = Math.Round(horizonDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); - dr[5] = "0.02"; - dr[8] = dr[8] + "水平净距"; - scFeature.HighLight = true; - dtBool = true; - } - else - { - dr[4] = Math.Round(horizonDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); - dr[5] = "0.02"; - } - //垂直 - if (Math.Abs(verticalDistance) > 0.02) - { - dr[6] = Math.Round(verticalDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); - dr[7] = "0.02"; - dr[8] = dr[8] + "垂直净距"; - scFeature.HighLight = true; - dtBool = true; - } - else - { - dr[6] = Math.Round(verticalDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); - dr[7] = "0.02"; - } - dr[8] = dr[8] + "超标"; - - if (!dtBool) return; - dt.Rows.Add(dr); } #region wxl 重构 碰撞审查,覆土审查,水平净距审查,垂直净距审查 diff --git a/Cyberpipe.suo b/Cyberpipe.suo index 3782cd4..0b445f3 100644 --- a/Cyberpipe.suo +++ b/Cyberpipe.suo Binary files differ diff --git a/DoublePanelAnalysis.cs b/DoublePanelAnalysis.cs index 6b17012..ddae545 100644 --- a/DoublePanelAnalysis.cs +++ b/DoublePanelAnalysis.cs @@ -49,8 +49,14 @@ } } - static void intalDataTable(DataTable dt) + /// + /// 单Feature对比方法 + /// + /// + /// + public static DataTable lineFeatureCompare(GSOLayer scLayer, GSOLayer sgLayer, string road, GSOGlobeControl globeControl1, GSOGlobeControl globeControl2) { + DataTable dt = new DataTable(); dt.Columns.Add("实测图层"); dt.Columns.Add("实测管段"); dt.Columns.Add("施工图层"); @@ -60,211 +66,201 @@ dt.Columns.Add("垂直距离/m"); dt.Columns.Add("垂直净距国标/m"); dt.Columns.Add("检测结果"); - } - - /// - /// 单Feature对比方法 - /// - /// - /// - public static DataTable lineFeatureCompare(GSOLayer scLayer, GSOLayer sgLayer, string road, GSOGlobeControl globeControl1, GSOGlobeControl globeControl2) - { - DataTable dt = new DataTable(); - intalDataTable(dt); if (scLayer.Caption.Contains("给水") || scLayer.Caption.Contains("雨水") || scLayer.Caption.Contains("污水") || scLayer.Caption.Contains("雨污")) { strLabel = "目标图层包含不符合《给水排水构筑物工程施工及验收规范》(GB50141-2008)要求的管段,具体内容如下:"; - CreateJiPaiShuiDataTable(scLayer, sgLayer, road, dt, globeControl1, globeControl2); +// CreateJiPaiShuiDataTable(scLayer, sgLayer, road, dt, globeControl1, globeControl2); } else if(scLayer.Caption.Contains("燃气")) { strLabel = "目标图层包含不符合《聚乙烯燃气管道工程技术规程》(GJJ63-2008)要求的管段,具体内容如下:"; - CreateRanQiDataTable(scLayer, sgLayer, road, dt, globeControl1, globeControl2); +// CreateRanQiDataTable(scLayer, sgLayer, road, dt, globeControl1, globeControl2); } else if (scLayer.Caption.Contains("供电")) { strLabel = "目标图层包含不符合《电力建设施工及验收技术规范》 (DL5031-94)要求的管段,具体内容如下:"; - CreateGongDianDataTable(scLayer, sgLayer, road, dt, globeControl1, globeControl2); +// CreateGongDianDataTable(scLayer, sgLayer, road, dt, globeControl1, globeControl2); } + GBJCDataTable(scLayer, sgLayer, road, dt, globeControl1, globeControl2); return dt; } - /// - /// 生成给排水监测结果表格 - /// - /// - /// - /// - /// - public static void CreateJiPaiShuiDataTable(GSOLayer scLayer, GSOLayer sgLayer, string road, - DataTable dt, GSOGlobeControl globeControl1, GSOGlobeControl globeControl2) - { - //给排水监测 - for (int i = 0; i < scLayer.GetAllFeatures().Length; i++) - { - GSOFeature scFeature = scLayer.GetAt(i); - if (scFeature.GetFieldAsString("所属道路") != road) continue; - - GSOGeoPolyline3D scLine = scFeature.Geometry as GSOGeoPolyline3D; - GSOGeoPolygon3D bufferPolygon = scLine.CreateBuffer(bufferWidth, true, 5, true, false); - - GSOFeatures sgFeatures = sgLayer.FindFeaturesInPolygon(bufferPolygon, true); - - InsertDataToJSDataTable(sgFeatures, scFeature, scLayer, sgLayer, scLine, globeControl1, - globeControl2, dt); - } - } - static void InsertDataToJSDataTable(GSOFeatures sgFeatures, GSOFeature scFeature, GSOLayer scLayer, GSOLayer sgLayer, - GSOGeoPolyline3D scLine,GSOGlobeControl globeControl1,GSOGlobeControl globeControl2,DataTable dt) - { - GSOFeature sgFeature = null; - //**判断同一个Feature - if (sgFeatures.Length < 1 || GetSameFeature(scFeature, scLayer, sgLayer, bufferWidth) == null) //不存在对应的施工管段 - { - scFeature.HighLight = true; - DataRow dr = dt.NewRow(); - dr[0] = scLayer.Caption; - dr[1] = scFeature.GetFieldAsString("编号"); - dr[2] = sgLayer.Caption; - dr[3] = "无"; - dr[4] = "无"; - dr[5] = scLayer.Caption.Contains("给水") ? "0.03" : "0.015"; - dr[6] = "无"; - - if (scFeature.GetFieldAsDouble("起始管底高程") <= 1) - dr[7] = scLayer.Caption.Contains("给水") ? "0.03" : "0.1"; - else - dr[7] = scLayer.Caption.Contains("给水") ? "0.03" : "0.015"; - dr[8] = "未设计管段"; - dt.Rows.Add(dr); - } - else - { - sgFeature = GetSameFeature(scFeature, scLayer, sgLayer, bufferWidth); - GSOGeoPolyline3D sgLine = sgFeature.Geometry as GSOGeoPolyline3D; - double horizonDistance, verticalDistance; - - CalculateDistance(out verticalDistance, out horizonDistance, scLine, sgLine, globeControl1, - globeControl2); - JiShuiAnalysis(scLayer.Caption, sgLayer.Caption, scFeature, sgFeature, horizonDistance, - verticalDistance, dt); - } - } - /// - /// 生成燃气监测结果表格 - /// - /// - /// - /// - /// - public static void CreateRanQiDataTable(GSOLayer scLayer, GSOLayer sgLayer, string road, - DataTable dt, GSOGlobeControl globeControl1, GSOGlobeControl globeControl2) - { - //燃气监测 - for (int i = 0; i < scLayer.GetAllFeatures().Length; i++) - { - GSOFeature scFeature = scLayer.GetAt(i); - if (scFeature.GetFieldAsString("所属道路") != road) continue; - GSOGeoPolyline3D scLine = scFeature.Geometry as GSOGeoPolyline3D; - GSOGeoPolygon3D bufferPolygon = scLine.CreateBuffer(bufferWidth, true, 5, true, false); - - GSOFeatures sgFeatures = sgLayer.FindFeaturesInPolygon(bufferPolygon, true); - - InsertDataToRQDataTable(sgFeatures, scFeature, scLayer, sgLayer, scLine, globeControl1, - globeControl2, dt); - - } - } - static void InsertDataToRQDataTable(GSOFeatures sgFeatures, GSOFeature scFeature, GSOLayer scLayer, GSOLayer sgLayer, - GSOGeoPolyline3D scLine, GSOGlobeControl globeControl1, GSOGlobeControl globeControl2, DataTable dt) - { - GSOFeature sgFeature = null; - //**判断同一个Feature - if (sgFeatures.Length < 1 || GetSameFeature(scFeature, scLayer, sgLayer, bufferWidth) == null) - { - scFeature.HighLight = true; - DataRow dr = dt.NewRow(); - dr[0] = scLayer.Caption; - dr[1] = scFeature.GetFieldAsString("编号"); - dr[2] = sgLayer.Caption; - dr[3] = "无"; - dr[4] = "无"; - dr[5] = "0.06"; - dr[6] = "无"; - dr[7] = "0.06"; - dr[8] = "未设计管段"; - dt.Rows.Add(dr); - } - else - { - sgFeature = GetSameFeature(scFeature, scLayer, sgLayer, bufferWidth); - - GSOGeoPolyline3D sgLine = sgFeature.Geometry as GSOGeoPolyline3D; - double horizonDistance, verticalDistance; - - CalculateDistance(out verticalDistance, out horizonDistance, scLine, sgLine, globeControl1, - globeControl2); - RanQiAnalysis(scLayer.Caption, sgLayer.Caption, scFeature, sgFeature, horizonDistance, - verticalDistance, dt); - } - } - /// - /// 生成供电监测结果表格 - /// - /// - /// - /// - /// - public static void CreateGongDianDataTable(GSOLayer scLayer, GSOLayer sgLayer, string road, - DataTable dt, GSOGlobeControl globeControl1, GSOGlobeControl globeControl2) - { - //供电监测 - for (int i = 0; i < scLayer.GetAllFeatures().Length; i++) - { - GSOFeature scFeature = scLayer.GetAt(i); - if (scFeature.GetFieldAsString("所属道路") != road) continue; - GSOGeoPolyline3D scLine = scFeature.Geometry as GSOGeoPolyline3D; - GSOGeoPolygon3D bufferPolygon = scLine.CreateBuffer(bufferWidth, true, 5, true, false); - - GSOFeatures sgFeatures = sgLayer.FindFeaturesInPolygon(bufferPolygon, true); - InsertDataToGDDataTable(sgFeatures, scFeature, scLayer, sgLayer, scLine, globeControl1, - globeControl2, dt); - } - } - static void InsertDataToGDDataTable(GSOFeatures sgFeatures, GSOFeature scFeature, GSOLayer scLayer, GSOLayer sgLayer, - GSOGeoPolyline3D scLine, GSOGlobeControl globeControl1, GSOGlobeControl globeControl2, DataTable dt) - { - GSOFeature sgFeature = null; - //**判断同一个Feature - if (sgFeatures.Length < 1 || GetSameFeature(scFeature, scLayer, sgLayer, bufferWidth) == null) - { - scFeature.HighLight = true; - DataRow dr = dt.NewRow(); - dr[0] = scLayer.Caption; - dr[1] = scFeature.GetFieldAsString("编号"); - dr[2] = sgLayer.Caption; - dr[3] = "无"; - dr[4] = "无"; - dr[5] = "0.02"; - dr[6] = "无"; - dr[7] = "0.02"; - dr[8] = "未设计管段"; - dt.Rows.Add(dr); - } - else - { - sgFeature = GetSameFeature(scFeature, scLayer, sgLayer, bufferWidth); - - GSOGeoPolyline3D sgLine = sgFeature.Geometry as GSOGeoPolyline3D; - double horizonDistance, verticalDistance; - - CalculateDistance(out verticalDistance, out horizonDistance, scLine, sgLine, globeControl1, - globeControl2); - GongDianAnalysis(scLayer.Caption, sgLayer.Caption, scFeature, sgFeature, horizonDistance, - verticalDistance, dt); - } - } +// /// +// /// 生成给排水监测结果表格 +// /// +// /// +// /// +// /// +// /// +// public static void CreateJiPaiShuiDataTable(GSOLayer scLayer, GSOLayer sgLayer, string road, +// DataTable dt, GSOGlobeControl globeControl1, GSOGlobeControl globeControl2) +// { +// //给排水监测 +// for (int i = 0; i < scLayer.GetAllFeatures().Length; i++) +// { +// GSOFeature scFeature = scLayer.GetAt(i); +// if (scFeature.GetFieldAsString("所属道路") != road) continue; +// +// GSOGeoPolyline3D scLine = scFeature.Geometry as GSOGeoPolyline3D; +// GSOGeoPolygon3D bufferPolygon = scLine.CreateBuffer(bufferWidth, true, 5, true, false); +// +// GSOFeatures sgFeatures = sgLayer.FindFeaturesInPolygon(bufferPolygon, true); +// +// InsertDataToJSDataTable(sgFeatures, scFeature, scLayer, sgLayer, scLine, globeControl1, +// globeControl2, dt); +// } +// } +// static void InsertDataToJSDataTable(GSOFeatures sgFeatures, GSOFeature scFeature, GSOLayer scLayer, GSOLayer sgLayer, +// GSOGeoPolyline3D scLine,GSOGlobeControl globeControl1,GSOGlobeControl globeControl2,DataTable dt) +// { +// GSOFeature sgFeature = null; +// //**判断同一个Feature +// if (sgFeatures.Length < 1 || GetSameFeature(scFeature, scLayer, sgLayer, bufferWidth) == null) //不存在对应的施工管段 +// { +// scFeature.HighLight = true; +// DataRow dr = dt.NewRow(); +// dr[0] = scLayer.Caption; +// dr[1] = scFeature.GetFieldAsString("编号"); +// dr[2] = sgLayer.Caption; +// dr[3] = "无"; +// dr[4] = "无"; +// dr[5] = scLayer.Caption.Contains("给水") ? "0.03" : "0.015"; +// dr[6] = "无"; +// +// if (scFeature.GetFieldAsDouble("起始管底高程") <= 1) +// dr[7] = scLayer.Caption.Contains("给水") ? "0.03" : "0.1"; +// else +// dr[7] = scLayer.Caption.Contains("给水") ? "0.03" : "0.015"; +// dr[8] = "未设计管段"; +// dt.Rows.Add(dr); +// } +// else +// { +// sgFeature = GetSameFeature(scFeature, scLayer, sgLayer, bufferWidth); +// GSOGeoPolyline3D sgLine = sgFeature.Geometry as GSOGeoPolyline3D; +// double horizonDistance, verticalDistance; +// +// CalculateDistance(out verticalDistance, out horizonDistance, scLine, sgLine, globeControl1, +// globeControl2); +// JiShuiAnalysis(scLayer.Caption, sgLayer.Caption, scFeature, sgFeature, horizonDistance, +// verticalDistance, dt); +// } +// } +// /// +// /// 生成燃气监测结果表格 +// /// +// /// +// /// +// /// +// /// +// public static void CreateRanQiDataTable(GSOLayer scLayer, GSOLayer sgLayer, string road, +// DataTable dt, GSOGlobeControl globeControl1, GSOGlobeControl globeControl2) +// { +// //燃气监测 +// for (int i = 0; i < scLayer.GetAllFeatures().Length; i++) +// { +// GSOFeature scFeature = scLayer.GetAt(i); +// if (scFeature.GetFieldAsString("所属道路") != road) continue; +// GSOGeoPolyline3D scLine = scFeature.Geometry as GSOGeoPolyline3D; +// GSOGeoPolygon3D bufferPolygon = scLine.CreateBuffer(bufferWidth, true, 5, true, false); +// +// GSOFeatures sgFeatures = sgLayer.FindFeaturesInPolygon(bufferPolygon, true); +// +// InsertDataToRQDataTable(sgFeatures, scFeature, scLayer, sgLayer, scLine, globeControl1, +// globeControl2, dt); +// +// } +// } +// static void InsertDataToRQDataTable(GSOFeatures sgFeatures, GSOFeature scFeature, GSOLayer scLayer, GSOLayer sgLayer, +// GSOGeoPolyline3D scLine, GSOGlobeControl globeControl1, GSOGlobeControl globeControl2, DataTable dt) +// { +// GSOFeature sgFeature = null; +// //**判断同一个Feature +// if (sgFeatures.Length < 1 || GetSameFeature(scFeature, scLayer, sgLayer, bufferWidth) == null) +// { +// scFeature.HighLight = true; +// DataRow dr = dt.NewRow(); +// dr[0] = scLayer.Caption; +// dr[1] = scFeature.GetFieldAsString("编号"); +// dr[2] = sgLayer.Caption; +// dr[3] = "无"; +// dr[4] = "无"; +// dr[5] = "0.06"; +// dr[6] = "无"; +// dr[7] = "0.06"; +// dr[8] = "未设计管段"; +// dt.Rows.Add(dr); +// } +// else +// { +// sgFeature = GetSameFeature(scFeature, scLayer, sgLayer, bufferWidth); +// +// GSOGeoPolyline3D sgLine = sgFeature.Geometry as GSOGeoPolyline3D; +// double horizonDistance, verticalDistance; +// +// CalculateDistance(out verticalDistance, out horizonDistance, scLine, sgLine, globeControl1, +// globeControl2); +// RanQiAnalysis(scLayer.Caption, sgLayer.Caption, scFeature, sgFeature, horizonDistance, +// verticalDistance, dt); +// } +// } +// /// +// /// 生成供电监测结果表格 +// /// +// /// +// /// +// /// +// /// +// public static void CreateGongDianDataTable(GSOLayer scLayer, GSOLayer sgLayer, string road, +// DataTable dt, GSOGlobeControl globeControl1, GSOGlobeControl globeControl2) +// { +// //供电监测 +// for (int i = 0; i < scLayer.GetAllFeatures().Length; i++) +// { +// GSOFeature scFeature = scLayer.GetAt(i); +// if (scFeature.GetFieldAsString("所属道路") != road) continue; +// GSOGeoPolyline3D scLine = scFeature.Geometry as GSOGeoPolyline3D; +// GSOGeoPolygon3D bufferPolygon = scLine.CreateBuffer(bufferWidth, true, 5, true, false); +// +// GSOFeatures sgFeatures = sgLayer.FindFeaturesInPolygon(bufferPolygon, true); +// InsertDataToGDDataTable(sgFeatures, scFeature, scLayer, sgLayer, scLine, globeControl1, +// globeControl2, dt); +// } +// } +// static void InsertDataToGDDataTable(GSOFeatures sgFeatures, GSOFeature scFeature, GSOLayer scLayer, GSOLayer sgLayer, +// GSOGeoPolyline3D scLine, GSOGlobeControl globeControl1, GSOGlobeControl globeControl2, DataTable dt) +// { +// GSOFeature sgFeature = null; +// //**判断同一个Feature +// if (sgFeatures.Length < 1 || GetSameFeature(scFeature, scLayer, sgLayer, bufferWidth) == null) +// { +// scFeature.HighLight = true; +// DataRow dr = dt.NewRow(); +// dr[0] = scLayer.Caption; +// dr[1] = scFeature.GetFieldAsString("编号"); +// dr[2] = sgLayer.Caption; +// dr[3] = "无"; +// dr[4] = "无"; +// dr[5] = "0.02"; +// dr[6] = "无"; +// dr[7] = "0.02"; +// dr[8] = "未设计管段"; +// dt.Rows.Add(dr); +// } +// else +// { +// sgFeature = GetSameFeature(scFeature, scLayer, sgLayer, bufferWidth); +// +// GSOGeoPolyline3D sgLine = sgFeature.Geometry as GSOGeoPolyline3D; +// double horizonDistance, verticalDistance; +// +// CalculateDistance(out verticalDistance, out horizonDistance, scLine, sgLine, globeControl1, +// globeControl2); +// GongDianAnalysis(scLayer.Caption, sgLayer.Caption, scFeature, sgFeature, horizonDistance, +// verticalDistance, dt); +// } +// } #region Fan Zhang 重构feature获取 public static double getLineLength(GSOFeature src,GSOLayer srcLayer,GSOGeoPolygon3D bufferPolygon) @@ -352,218 +348,326 @@ return reFeature; } #endregion +// /// +// /// 给排水规范审核 +// /// +// /// +// /// +// /// +// /// +// /// +// /// +// /// +// public static void JiShuiAnalysis(string scLayerName, string sgLayerName, GSOFeature scFeature, +// GSOFeature sgFeature, double horizonDistance, double verticalDistance, DataTable dt) +// { +// bool dtBool = false; +// +// DataRow dr = dt.NewRow(); +// dr[0] = scLayerName; +// dr[1] = scFeature.GetFieldAsString("编号"); +// dr[2] = sgLayerName; +// dr[3] = sgFeature.GetFieldAsString("编号"); +// +// if (scLayerName.Contains("给水")) +// { +// //水平 +// if (horizonDistance > 0.03) +// { +// dr[4] = Math.Round(horizonDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); +// dr[5] = "0.03"; +// dr[8] = dr[8] + "水平净距"; +// scFeature.HighLight = true; +// dtBool = true; +// } +// else +// { +// dr[4] = Math.Round(horizonDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); +// dr[5] = "0.03"; +// } +// //垂直 +// if (Math.Abs(verticalDistance) > 0.03) +// { +// dr[6] = Math.Round(verticalDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); +// dr[7] = "0.03"; +// dr[8] = dr[8] + "垂直净距"; +// scFeature.HighLight = true; +// dtBool = true; +// } +// else +// { +// dr[6] = Math.Round(verticalDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); +// dr[7] = "0.03"; +// } +// dr[8] = dr[8] + "超标"; +// } +// else +// { +// if (horizonDistance > 0.015) +// { +// dr[4] = Math.Round(horizonDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); +// dr[5] = "0.015"; +// scFeature.HighLight = true; +// dr[8] = dr[8] + "水平净距"; +// dtBool = true; +// } +// else +// { +// dr[4] = Math.Round(horizonDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); +// dr[5] = "0.015"; +// } +// if (scFeature.GetFieldAsDouble("起始管底高程") <= 1) +// { +// if (Math.Abs(verticalDistance) > 0.01) +// { +// dr[6] = Math.Round(verticalDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); +// dr[7] = "0.01"; +// scFeature.HighLight = true; +// dr[8] = dr[8] + "垂直净距"; +// dtBool = true; +// } +// else +// { +// dr[6] = Math.Round(verticalDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); +// dr[7] = "0.01"; +// } +// } +// else +// { +// if (Math.Abs(verticalDistance) > 0.015) +// { +// dr[6] = Math.Round(verticalDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); +// dr[7] = "0.015"; +// scFeature.HighLight = true; +// dr[8] = dr[8] + "垂直净距"; +// dtBool = true; +// } +// else +// { +// dr[6] = Math.Round(verticalDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); +// dr[7] = "0.015"; +// } +// } +// +// dr[8] = dr[8] + "超标"; +// } +// +// if (!dtBool) return; +// dt.Rows.Add(dr); +// } +// /// +// /// 燃气规范审核 +// /// +// /// +// /// +// /// +// /// +// /// +// /// +// /// +// public static void RanQiAnalysis(string scLayerName, string sgLayerName, GSOFeature scFeature, GSOFeature sgFeature, double horizonDistance, double verticalDistance, DataTable dt) +// { +// bool dtBool = false; +// +// DataRow dr = dt.NewRow(); +// dr[0] = scLayerName; +// dr[1] = scFeature.GetFieldAsString("编号"); +// dr[2] = sgLayerName; +// dr[3] = sgFeature.GetFieldAsString("编号"); +// +// //水平 +// if (horizonDistance > 0.06) +// { +//// dr[4] = Math.Round(horizonDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); +// dr[5] = "0.06"; +// dr[8] = dr[8] + "水平净距"; +// scFeature.HighLight = true; +// dtBool = true; +// } +// else +// { +// dr[4] = Math.Round(horizonDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); +// dr[5] = "0.06"; +// } +// //垂直 +// if (Math.Abs(verticalDistance) > 0.06) +// { +// dr[6] = Math.Round(verticalDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); +// dr[7] = "0.06"; +// dr[8] = dr[8] + "垂直净距"; +// scFeature.HighLight = true; +// dtBool = true; +// } +// else +// { +// dr[6] = Math.Round(verticalDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); +// dr[7] = "0.06"; +// } +// dr[8] = dr[8] + "超标"; +// +// if (!dtBool) return; +// dt.Rows.Add(dr); +// } +// /// +// /// 供电规范审核 +// /// +// /// +// /// +// /// +// /// +// /// +// /// +// /// +// public static void GongDianAnalysis(string scLayerName, string sgLayerName, GSOFeature scFeature, GSOFeature sgFeature, double horizonDistance, double verticalDistance, DataTable dt) +// { +// bool dtBool = false; +// +// DataRow dr = dt.NewRow(); +// dr[0] = scLayerName; +// dr[1] = scFeature.GetFieldAsString("编号"); +// dr[2] = sgLayerName; +// dr[3] = sgFeature.GetFieldAsString("编号"); +// +// //水平 +// if (horizonDistance > 0.02) +// { +// dr[4] = Math.Round(horizonDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); +// dr[5] = "0.02"; +// dr[8] = dr[8] + "水平净距"; +// scFeature.HighLight = true; +// dtBool = true; +// } +// else +// { +// dr[4] = Math.Round(horizonDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); +// dr[5] = "0.02"; +// } +// //垂直 +// if (Math.Abs(verticalDistance) > 0.02) +// { +// dr[6] = Math.Round(verticalDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); +// dr[7] = "0.02"; +// dr[8] = dr[8] + "垂直净距"; +// scFeature.HighLight = true; +// dtBool = true; +// } +// else +// { +// dr[6] = Math.Round(verticalDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); +// dr[7] = "0.02"; +// } +// dr[8] = dr[8] + "超标"; +// +// if (!dtBool) return; +// dt.Rows.Add(dr); +// } + /// - /// 给排水规范审核 + /// 国标检测table计算,某道路下的施工和实测feature的对比信息 /// - /// - /// - /// - /// - /// - /// + /// + /// + /// /// - public static void JiShuiAnalysis(string scLayerName, string sgLayerName, GSOFeature scFeature, - GSOFeature sgFeature, double horizonDistance, double verticalDistance, DataTable dt) + /// + /// + public static void GBJCDataTable(GSOLayer scLayer, GSOLayer sgLayer, string road, + DataTable dt, GSOGlobeControl globeControl1, GSOGlobeControl globeControl2) { - bool dtBool = false; - - DataRow dr = dt.NewRow(); - dr[0] = scLayerName; - dr[1] = scFeature.GetFieldAsString("编号"); - dr[2] = sgLayerName; - dr[3] = sgFeature.GetFieldAsString("编号"); - - if (scLayerName.Contains("给水")) + GSOFeatures scFeatures = scLayer.GetFeatureByFieldValue("所属道路", road, true); + + for (int i=0;i 0.03) + GSOFeature scFeature = scFeatures[i]; + GSOGeoPolyline3D scLine = scFeature.Geometry as GSOGeoPolyline3D; + if (scLine == null) continue; + GSOGeoPolygon3D bufferPolygon = scLine.CreateBuffer(bufferWidth, true, 5, true, false); + GSOFeatures sgFeatures = sgLayer.FindFeaturesInPolygon(bufferPolygon, true); + GSOFeature sgFeature = GetSameFeature(scFeature, scLayer, sgLayer, bufferWidth); + double hStandard = 0.02, vStandard = 0.02; + if (scLayer.Caption.Contains("给水")) { - dr[4] = Math.Round(horizonDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); - dr[5] = "0.03"; - dr[8] = dr[8] + "水平净距"; - scFeature.HighLight = true; - dtBool = true; - } - else + hStandard = 0.03; + vStandard = 0.03; + }else if (scLayer.Caption.Contains("雨水") || scLayer.Caption.Contains("污水") || scLayer.Caption.Contains("雨污")) { - dr[4] = Math.Round(horizonDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); - dr[5] = "0.03"; - } - //垂直 - if (Math.Abs(verticalDistance) > 0.03) - { - dr[6] = Math.Round(verticalDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); - dr[7] = "0.03"; - dr[8] = dr[8] + "垂直净距"; - scFeature.HighLight = true; - dtBool = true; - } - else - { - dr[6] = Math.Round(verticalDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); - dr[7] = "0.03"; - } - dr[8] = dr[8] + "超标"; - } - else - { - if (horizonDistance > 0.015) - { - dr[4] = Math.Round(horizonDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); - dr[5] = "0.015"; - scFeature.HighLight = true; - dr[8] = dr[8] + "水平净距"; - dtBool = true; - } - else - { - dr[4] = Math.Round(horizonDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); - dr[5] = "0.015"; - } - if (scFeature.GetFieldAsDouble("起始管底高程") <= 1) - { - if (Math.Abs(verticalDistance) > 0.01) + hStandard = 0.015; + vStandard = 0.015; + if (scFeature.GetFieldAsDouble("起始管底高程") <= 1) { - dr[6] = Math.Round(verticalDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); - dr[7] = "0.01"; - scFeature.HighLight = true; - dr[8] = dr[8] + "垂直净距"; - dtBool = true; - } - else - { - dr[6] = Math.Round(verticalDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); - dr[7] = "0.01"; + vStandard = 0.01; } } - else + else if (scLayer.Caption.Contains("燃气")) { - if (Math.Abs(verticalDistance) > 0.015) - { - dr[6] = Math.Round(verticalDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); - dr[7] = "0.015"; - scFeature.HighLight = true; - dr[8] = dr[8] + "垂直净距"; - dtBool = true; - } - else - { - dr[6] = Math.Round(verticalDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); - dr[7] = "0.015"; - } + hStandard = 0.06; + vStandard = 0.06; } - dr[8] = dr[8] + "超标"; + if (sgFeatures.Length < 1 || sgFeature == null) //不存在对应的施工管段 + { + scFeature.HighLight = true; + DataRow dr = dt.NewRow(); + dr[0] = scLayer.Caption; + dr[1] = scFeature.GetFieldAsString("编号"); + dr[2] = sgLayer.Caption; + dr[3] = "无"; + dr[4] = "无"; + dr[5] = hStandard; + dr[6] = "无"; + dr[7] = vStandard; + dr[8] = "未设计管段"; + dt.Rows.Add(dr); + } + else + { + GSOGeoPolyline3D sgLine = sgFeature.Geometry as GSOGeoPolyline3D; + double horizonDistance, verticalDistance; + CalculateDistance(out verticalDistance, out horizonDistance, scLine, sgLine, globeControl1, + globeControl2); + RowValueInsert(scFeature, sgFeature, horizonDistance, + verticalDistance,hStandard,vStandard,dt); + } } - - if (!dtBool) return; - dt.Rows.Add(dr); } /// - /// 燃气规范审核 + /// 填充datatable的行,如果符合标准,则直接返回 /// - /// - /// /// /// /// /// + /// + /// /// - public static void RanQiAnalysis(string scLayerName, string sgLayerName, GSOFeature scFeature, GSOFeature sgFeature, double horizonDistance, double verticalDistance, DataTable dt) + private static void RowValueInsert(GSOFeature scFeature, + GSOFeature sgFeature, double horizonDistance, + double verticalDistance,double hStandard,double vStandard,DataTable dt) { - bool dtBool = false; - + //符合标准 + if (horizonDistance <= hStandard && verticalDistance <= vStandard) return; + string scLayerName = scFeature.Dataset.Caption; DataRow dr = dt.NewRow(); dr[0] = scLayerName; dr[1] = scFeature.GetFieldAsString("编号"); - dr[2] = sgLayerName; + dr[2] = sgFeature.Dataset.Caption; dr[3] = sgFeature.GetFieldAsString("编号"); - - //水平 - if (horizonDistance > 0.06) + dr[4] = Math.Round(horizonDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); + dr[5] = hStandard.ToString(); + dr[6] = Math.Round(verticalDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); + dr[7] = vStandard.ToString(); + if (horizonDistance > hStandard) { - dr[4] = Math.Round(horizonDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); - dr[5] = "0.06"; - dr[8] = dr[8] + "水平净距"; + dr[8] = "水平净距超标"; scFeature.HighLight = true; - dtBool = true; } - else + if (verticalDistance > vStandard) { - dr[4] = Math.Round(horizonDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); - dr[5] = "0.06"; - } - //垂直 - if (Math.Abs(verticalDistance) > 0.06) - { - dr[6] = Math.Round(verticalDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); - dr[7] = "0.06"; - dr[8] = dr[8] + "垂直净距"; scFeature.HighLight = true; - dtBool = true; + dr[8] += " 垂直净距超标"; } - else - { - dr[6] = Math.Round(verticalDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); - dr[7] = "0.06"; - } - dr[8] = dr[8] + "超标"; - - if (!dtBool) return; dt.Rows.Add(dr); - } - /// - /// 供电规范审核 - /// - /// - /// - /// - /// - /// - /// - /// - public static void GongDianAnalysis(string scLayerName, string sgLayerName, GSOFeature scFeature, GSOFeature sgFeature, double horizonDistance, double verticalDistance, DataTable dt) - { - bool dtBool = false; - DataRow dr = dt.NewRow(); - dr[0] = scLayerName; - dr[1] = scFeature.GetFieldAsString("编号"); - dr[2] = sgLayerName; - dr[3] = sgFeature.GetFieldAsString("编号"); - - //水平 - if (horizonDistance > 0.02) - { - dr[4] = Math.Round(horizonDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); - dr[5] = "0.02"; - dr[8] = dr[8] + "水平净距"; - scFeature.HighLight = true; - dtBool = true; - } - else - { - dr[4] = Math.Round(horizonDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); - dr[5] = "0.02"; - } - //垂直 - if (Math.Abs(verticalDistance) > 0.02) - { - dr[6] = Math.Round(verticalDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); - dr[7] = "0.02"; - dr[8] = dr[8] + "垂直净距"; - scFeature.HighLight = true; - dtBool = true; - } - else - { - dr[6] = Math.Round(verticalDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); - dr[7] = "0.02"; - } - dr[8] = dr[8] + "超标"; - - if (!dtBool) return; - dt.Rows.Add(dr); } #region wxl 重构 碰撞审查,覆土审查,水平净距审查,垂直净距审查 diff --git a/FrmGBJC.cs b/FrmGBJC.cs index fb3c2bc..d7acc30 100644 --- a/FrmGBJC.cs +++ b/FrmGBJC.cs @@ -89,28 +89,30 @@ textBoxSC.Text = listBoxSC.SelectedItem.ToString(); } - void invalParam() + private bool InvalParam() { - if (textBoxSC.Text.Trim() == "") + if (textBoxSC.Text.Trim().Equals("")) { MessageBox.Show("请选择实测管线图层!", "提示"); - return; + return false; } - else if (textBoxSG.Text.Trim() == "") + if (textBoxSG.Text.Trim().Equals("")) { MessageBox.Show("请选择施工图层!", "提示"); - return; + return false; } - else if (comboBoxRoad.SelectedItem == null) + if (comboBoxRoad.SelectedItem == null) { MessageBox.Show("请选择道路!", "提示"); - return; + return false; } + return true; } private void buttonOK_Click(object sender, EventArgs e) { - invalParam(); + bool isvalid = InvalParam(); + if (!isvalid) return; GSOLayer scLayer = globeControl1.Globe.Layers.GetLayerByCaption(textBoxSC.Text); GSOLayer sgLayer = globeControl2.Globe.Layers.GetLayerByCaption(textBoxSG.Text); diff --git a/Cyberpipe.suo b/Cyberpipe.suo index 3782cd4..0b445f3 100644 --- a/Cyberpipe.suo +++ b/Cyberpipe.suo Binary files differ diff --git a/DoublePanelAnalysis.cs b/DoublePanelAnalysis.cs index 6b17012..ddae545 100644 --- a/DoublePanelAnalysis.cs +++ b/DoublePanelAnalysis.cs @@ -49,8 +49,14 @@ } } - static void intalDataTable(DataTable dt) + /// + /// 单Feature对比方法 + /// + /// + /// + public static DataTable lineFeatureCompare(GSOLayer scLayer, GSOLayer sgLayer, string road, GSOGlobeControl globeControl1, GSOGlobeControl globeControl2) { + DataTable dt = new DataTable(); dt.Columns.Add("实测图层"); dt.Columns.Add("实测管段"); dt.Columns.Add("施工图层"); @@ -60,211 +66,201 @@ dt.Columns.Add("垂直距离/m"); dt.Columns.Add("垂直净距国标/m"); dt.Columns.Add("检测结果"); - } - - /// - /// 单Feature对比方法 - /// - /// - /// - public static DataTable lineFeatureCompare(GSOLayer scLayer, GSOLayer sgLayer, string road, GSOGlobeControl globeControl1, GSOGlobeControl globeControl2) - { - DataTable dt = new DataTable(); - intalDataTable(dt); if (scLayer.Caption.Contains("给水") || scLayer.Caption.Contains("雨水") || scLayer.Caption.Contains("污水") || scLayer.Caption.Contains("雨污")) { strLabel = "目标图层包含不符合《给水排水构筑物工程施工及验收规范》(GB50141-2008)要求的管段,具体内容如下:"; - CreateJiPaiShuiDataTable(scLayer, sgLayer, road, dt, globeControl1, globeControl2); +// CreateJiPaiShuiDataTable(scLayer, sgLayer, road, dt, globeControl1, globeControl2); } else if(scLayer.Caption.Contains("燃气")) { strLabel = "目标图层包含不符合《聚乙烯燃气管道工程技术规程》(GJJ63-2008)要求的管段,具体内容如下:"; - CreateRanQiDataTable(scLayer, sgLayer, road, dt, globeControl1, globeControl2); +// CreateRanQiDataTable(scLayer, sgLayer, road, dt, globeControl1, globeControl2); } else if (scLayer.Caption.Contains("供电")) { strLabel = "目标图层包含不符合《电力建设施工及验收技术规范》 (DL5031-94)要求的管段,具体内容如下:"; - CreateGongDianDataTable(scLayer, sgLayer, road, dt, globeControl1, globeControl2); +// CreateGongDianDataTable(scLayer, sgLayer, road, dt, globeControl1, globeControl2); } + GBJCDataTable(scLayer, sgLayer, road, dt, globeControl1, globeControl2); return dt; } - /// - /// 生成给排水监测结果表格 - /// - /// - /// - /// - /// - public static void CreateJiPaiShuiDataTable(GSOLayer scLayer, GSOLayer sgLayer, string road, - DataTable dt, GSOGlobeControl globeControl1, GSOGlobeControl globeControl2) - { - //给排水监测 - for (int i = 0; i < scLayer.GetAllFeatures().Length; i++) - { - GSOFeature scFeature = scLayer.GetAt(i); - if (scFeature.GetFieldAsString("所属道路") != road) continue; - - GSOGeoPolyline3D scLine = scFeature.Geometry as GSOGeoPolyline3D; - GSOGeoPolygon3D bufferPolygon = scLine.CreateBuffer(bufferWidth, true, 5, true, false); - - GSOFeatures sgFeatures = sgLayer.FindFeaturesInPolygon(bufferPolygon, true); - - InsertDataToJSDataTable(sgFeatures, scFeature, scLayer, sgLayer, scLine, globeControl1, - globeControl2, dt); - } - } - static void InsertDataToJSDataTable(GSOFeatures sgFeatures, GSOFeature scFeature, GSOLayer scLayer, GSOLayer sgLayer, - GSOGeoPolyline3D scLine,GSOGlobeControl globeControl1,GSOGlobeControl globeControl2,DataTable dt) - { - GSOFeature sgFeature = null; - //**判断同一个Feature - if (sgFeatures.Length < 1 || GetSameFeature(scFeature, scLayer, sgLayer, bufferWidth) == null) //不存在对应的施工管段 - { - scFeature.HighLight = true; - DataRow dr = dt.NewRow(); - dr[0] = scLayer.Caption; - dr[1] = scFeature.GetFieldAsString("编号"); - dr[2] = sgLayer.Caption; - dr[3] = "无"; - dr[4] = "无"; - dr[5] = scLayer.Caption.Contains("给水") ? "0.03" : "0.015"; - dr[6] = "无"; - - if (scFeature.GetFieldAsDouble("起始管底高程") <= 1) - dr[7] = scLayer.Caption.Contains("给水") ? "0.03" : "0.1"; - else - dr[7] = scLayer.Caption.Contains("给水") ? "0.03" : "0.015"; - dr[8] = "未设计管段"; - dt.Rows.Add(dr); - } - else - { - sgFeature = GetSameFeature(scFeature, scLayer, sgLayer, bufferWidth); - GSOGeoPolyline3D sgLine = sgFeature.Geometry as GSOGeoPolyline3D; - double horizonDistance, verticalDistance; - - CalculateDistance(out verticalDistance, out horizonDistance, scLine, sgLine, globeControl1, - globeControl2); - JiShuiAnalysis(scLayer.Caption, sgLayer.Caption, scFeature, sgFeature, horizonDistance, - verticalDistance, dt); - } - } - /// - /// 生成燃气监测结果表格 - /// - /// - /// - /// - /// - public static void CreateRanQiDataTable(GSOLayer scLayer, GSOLayer sgLayer, string road, - DataTable dt, GSOGlobeControl globeControl1, GSOGlobeControl globeControl2) - { - //燃气监测 - for (int i = 0; i < scLayer.GetAllFeatures().Length; i++) - { - GSOFeature scFeature = scLayer.GetAt(i); - if (scFeature.GetFieldAsString("所属道路") != road) continue; - GSOGeoPolyline3D scLine = scFeature.Geometry as GSOGeoPolyline3D; - GSOGeoPolygon3D bufferPolygon = scLine.CreateBuffer(bufferWidth, true, 5, true, false); - - GSOFeatures sgFeatures = sgLayer.FindFeaturesInPolygon(bufferPolygon, true); - - InsertDataToRQDataTable(sgFeatures, scFeature, scLayer, sgLayer, scLine, globeControl1, - globeControl2, dt); - - } - } - static void InsertDataToRQDataTable(GSOFeatures sgFeatures, GSOFeature scFeature, GSOLayer scLayer, GSOLayer sgLayer, - GSOGeoPolyline3D scLine, GSOGlobeControl globeControl1, GSOGlobeControl globeControl2, DataTable dt) - { - GSOFeature sgFeature = null; - //**判断同一个Feature - if (sgFeatures.Length < 1 || GetSameFeature(scFeature, scLayer, sgLayer, bufferWidth) == null) - { - scFeature.HighLight = true; - DataRow dr = dt.NewRow(); - dr[0] = scLayer.Caption; - dr[1] = scFeature.GetFieldAsString("编号"); - dr[2] = sgLayer.Caption; - dr[3] = "无"; - dr[4] = "无"; - dr[5] = "0.06"; - dr[6] = "无"; - dr[7] = "0.06"; - dr[8] = "未设计管段"; - dt.Rows.Add(dr); - } - else - { - sgFeature = GetSameFeature(scFeature, scLayer, sgLayer, bufferWidth); - - GSOGeoPolyline3D sgLine = sgFeature.Geometry as GSOGeoPolyline3D; - double horizonDistance, verticalDistance; - - CalculateDistance(out verticalDistance, out horizonDistance, scLine, sgLine, globeControl1, - globeControl2); - RanQiAnalysis(scLayer.Caption, sgLayer.Caption, scFeature, sgFeature, horizonDistance, - verticalDistance, dt); - } - } - /// - /// 生成供电监测结果表格 - /// - /// - /// - /// - /// - public static void CreateGongDianDataTable(GSOLayer scLayer, GSOLayer sgLayer, string road, - DataTable dt, GSOGlobeControl globeControl1, GSOGlobeControl globeControl2) - { - //供电监测 - for (int i = 0; i < scLayer.GetAllFeatures().Length; i++) - { - GSOFeature scFeature = scLayer.GetAt(i); - if (scFeature.GetFieldAsString("所属道路") != road) continue; - GSOGeoPolyline3D scLine = scFeature.Geometry as GSOGeoPolyline3D; - GSOGeoPolygon3D bufferPolygon = scLine.CreateBuffer(bufferWidth, true, 5, true, false); - - GSOFeatures sgFeatures = sgLayer.FindFeaturesInPolygon(bufferPolygon, true); - InsertDataToGDDataTable(sgFeatures, scFeature, scLayer, sgLayer, scLine, globeControl1, - globeControl2, dt); - } - } - static void InsertDataToGDDataTable(GSOFeatures sgFeatures, GSOFeature scFeature, GSOLayer scLayer, GSOLayer sgLayer, - GSOGeoPolyline3D scLine, GSOGlobeControl globeControl1, GSOGlobeControl globeControl2, DataTable dt) - { - GSOFeature sgFeature = null; - //**判断同一个Feature - if (sgFeatures.Length < 1 || GetSameFeature(scFeature, scLayer, sgLayer, bufferWidth) == null) - { - scFeature.HighLight = true; - DataRow dr = dt.NewRow(); - dr[0] = scLayer.Caption; - dr[1] = scFeature.GetFieldAsString("编号"); - dr[2] = sgLayer.Caption; - dr[3] = "无"; - dr[4] = "无"; - dr[5] = "0.02"; - dr[6] = "无"; - dr[7] = "0.02"; - dr[8] = "未设计管段"; - dt.Rows.Add(dr); - } - else - { - sgFeature = GetSameFeature(scFeature, scLayer, sgLayer, bufferWidth); - - GSOGeoPolyline3D sgLine = sgFeature.Geometry as GSOGeoPolyline3D; - double horizonDistance, verticalDistance; - - CalculateDistance(out verticalDistance, out horizonDistance, scLine, sgLine, globeControl1, - globeControl2); - GongDianAnalysis(scLayer.Caption, sgLayer.Caption, scFeature, sgFeature, horizonDistance, - verticalDistance, dt); - } - } +// /// +// /// 生成给排水监测结果表格 +// /// +// /// +// /// +// /// +// /// +// public static void CreateJiPaiShuiDataTable(GSOLayer scLayer, GSOLayer sgLayer, string road, +// DataTable dt, GSOGlobeControl globeControl1, GSOGlobeControl globeControl2) +// { +// //给排水监测 +// for (int i = 0; i < scLayer.GetAllFeatures().Length; i++) +// { +// GSOFeature scFeature = scLayer.GetAt(i); +// if (scFeature.GetFieldAsString("所属道路") != road) continue; +// +// GSOGeoPolyline3D scLine = scFeature.Geometry as GSOGeoPolyline3D; +// GSOGeoPolygon3D bufferPolygon = scLine.CreateBuffer(bufferWidth, true, 5, true, false); +// +// GSOFeatures sgFeatures = sgLayer.FindFeaturesInPolygon(bufferPolygon, true); +// +// InsertDataToJSDataTable(sgFeatures, scFeature, scLayer, sgLayer, scLine, globeControl1, +// globeControl2, dt); +// } +// } +// static void InsertDataToJSDataTable(GSOFeatures sgFeatures, GSOFeature scFeature, GSOLayer scLayer, GSOLayer sgLayer, +// GSOGeoPolyline3D scLine,GSOGlobeControl globeControl1,GSOGlobeControl globeControl2,DataTable dt) +// { +// GSOFeature sgFeature = null; +// //**判断同一个Feature +// if (sgFeatures.Length < 1 || GetSameFeature(scFeature, scLayer, sgLayer, bufferWidth) == null) //不存在对应的施工管段 +// { +// scFeature.HighLight = true; +// DataRow dr = dt.NewRow(); +// dr[0] = scLayer.Caption; +// dr[1] = scFeature.GetFieldAsString("编号"); +// dr[2] = sgLayer.Caption; +// dr[3] = "无"; +// dr[4] = "无"; +// dr[5] = scLayer.Caption.Contains("给水") ? "0.03" : "0.015"; +// dr[6] = "无"; +// +// if (scFeature.GetFieldAsDouble("起始管底高程") <= 1) +// dr[7] = scLayer.Caption.Contains("给水") ? "0.03" : "0.1"; +// else +// dr[7] = scLayer.Caption.Contains("给水") ? "0.03" : "0.015"; +// dr[8] = "未设计管段"; +// dt.Rows.Add(dr); +// } +// else +// { +// sgFeature = GetSameFeature(scFeature, scLayer, sgLayer, bufferWidth); +// GSOGeoPolyline3D sgLine = sgFeature.Geometry as GSOGeoPolyline3D; +// double horizonDistance, verticalDistance; +// +// CalculateDistance(out verticalDistance, out horizonDistance, scLine, sgLine, globeControl1, +// globeControl2); +// JiShuiAnalysis(scLayer.Caption, sgLayer.Caption, scFeature, sgFeature, horizonDistance, +// verticalDistance, dt); +// } +// } +// /// +// /// 生成燃气监测结果表格 +// /// +// /// +// /// +// /// +// /// +// public static void CreateRanQiDataTable(GSOLayer scLayer, GSOLayer sgLayer, string road, +// DataTable dt, GSOGlobeControl globeControl1, GSOGlobeControl globeControl2) +// { +// //燃气监测 +// for (int i = 0; i < scLayer.GetAllFeatures().Length; i++) +// { +// GSOFeature scFeature = scLayer.GetAt(i); +// if (scFeature.GetFieldAsString("所属道路") != road) continue; +// GSOGeoPolyline3D scLine = scFeature.Geometry as GSOGeoPolyline3D; +// GSOGeoPolygon3D bufferPolygon = scLine.CreateBuffer(bufferWidth, true, 5, true, false); +// +// GSOFeatures sgFeatures = sgLayer.FindFeaturesInPolygon(bufferPolygon, true); +// +// InsertDataToRQDataTable(sgFeatures, scFeature, scLayer, sgLayer, scLine, globeControl1, +// globeControl2, dt); +// +// } +// } +// static void InsertDataToRQDataTable(GSOFeatures sgFeatures, GSOFeature scFeature, GSOLayer scLayer, GSOLayer sgLayer, +// GSOGeoPolyline3D scLine, GSOGlobeControl globeControl1, GSOGlobeControl globeControl2, DataTable dt) +// { +// GSOFeature sgFeature = null; +// //**判断同一个Feature +// if (sgFeatures.Length < 1 || GetSameFeature(scFeature, scLayer, sgLayer, bufferWidth) == null) +// { +// scFeature.HighLight = true; +// DataRow dr = dt.NewRow(); +// dr[0] = scLayer.Caption; +// dr[1] = scFeature.GetFieldAsString("编号"); +// dr[2] = sgLayer.Caption; +// dr[3] = "无"; +// dr[4] = "无"; +// dr[5] = "0.06"; +// dr[6] = "无"; +// dr[7] = "0.06"; +// dr[8] = "未设计管段"; +// dt.Rows.Add(dr); +// } +// else +// { +// sgFeature = GetSameFeature(scFeature, scLayer, sgLayer, bufferWidth); +// +// GSOGeoPolyline3D sgLine = sgFeature.Geometry as GSOGeoPolyline3D; +// double horizonDistance, verticalDistance; +// +// CalculateDistance(out verticalDistance, out horizonDistance, scLine, sgLine, globeControl1, +// globeControl2); +// RanQiAnalysis(scLayer.Caption, sgLayer.Caption, scFeature, sgFeature, horizonDistance, +// verticalDistance, dt); +// } +// } +// /// +// /// 生成供电监测结果表格 +// /// +// /// +// /// +// /// +// /// +// public static void CreateGongDianDataTable(GSOLayer scLayer, GSOLayer sgLayer, string road, +// DataTable dt, GSOGlobeControl globeControl1, GSOGlobeControl globeControl2) +// { +// //供电监测 +// for (int i = 0; i < scLayer.GetAllFeatures().Length; i++) +// { +// GSOFeature scFeature = scLayer.GetAt(i); +// if (scFeature.GetFieldAsString("所属道路") != road) continue; +// GSOGeoPolyline3D scLine = scFeature.Geometry as GSOGeoPolyline3D; +// GSOGeoPolygon3D bufferPolygon = scLine.CreateBuffer(bufferWidth, true, 5, true, false); +// +// GSOFeatures sgFeatures = sgLayer.FindFeaturesInPolygon(bufferPolygon, true); +// InsertDataToGDDataTable(sgFeatures, scFeature, scLayer, sgLayer, scLine, globeControl1, +// globeControl2, dt); +// } +// } +// static void InsertDataToGDDataTable(GSOFeatures sgFeatures, GSOFeature scFeature, GSOLayer scLayer, GSOLayer sgLayer, +// GSOGeoPolyline3D scLine, GSOGlobeControl globeControl1, GSOGlobeControl globeControl2, DataTable dt) +// { +// GSOFeature sgFeature = null; +// //**判断同一个Feature +// if (sgFeatures.Length < 1 || GetSameFeature(scFeature, scLayer, sgLayer, bufferWidth) == null) +// { +// scFeature.HighLight = true; +// DataRow dr = dt.NewRow(); +// dr[0] = scLayer.Caption; +// dr[1] = scFeature.GetFieldAsString("编号"); +// dr[2] = sgLayer.Caption; +// dr[3] = "无"; +// dr[4] = "无"; +// dr[5] = "0.02"; +// dr[6] = "无"; +// dr[7] = "0.02"; +// dr[8] = "未设计管段"; +// dt.Rows.Add(dr); +// } +// else +// { +// sgFeature = GetSameFeature(scFeature, scLayer, sgLayer, bufferWidth); +// +// GSOGeoPolyline3D sgLine = sgFeature.Geometry as GSOGeoPolyline3D; +// double horizonDistance, verticalDistance; +// +// CalculateDistance(out verticalDistance, out horizonDistance, scLine, sgLine, globeControl1, +// globeControl2); +// GongDianAnalysis(scLayer.Caption, sgLayer.Caption, scFeature, sgFeature, horizonDistance, +// verticalDistance, dt); +// } +// } #region Fan Zhang 重构feature获取 public static double getLineLength(GSOFeature src,GSOLayer srcLayer,GSOGeoPolygon3D bufferPolygon) @@ -352,218 +348,326 @@ return reFeature; } #endregion +// /// +// /// 给排水规范审核 +// /// +// /// +// /// +// /// +// /// +// /// +// /// +// /// +// public static void JiShuiAnalysis(string scLayerName, string sgLayerName, GSOFeature scFeature, +// GSOFeature sgFeature, double horizonDistance, double verticalDistance, DataTable dt) +// { +// bool dtBool = false; +// +// DataRow dr = dt.NewRow(); +// dr[0] = scLayerName; +// dr[1] = scFeature.GetFieldAsString("编号"); +// dr[2] = sgLayerName; +// dr[3] = sgFeature.GetFieldAsString("编号"); +// +// if (scLayerName.Contains("给水")) +// { +// //水平 +// if (horizonDistance > 0.03) +// { +// dr[4] = Math.Round(horizonDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); +// dr[5] = "0.03"; +// dr[8] = dr[8] + "水平净距"; +// scFeature.HighLight = true; +// dtBool = true; +// } +// else +// { +// dr[4] = Math.Round(horizonDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); +// dr[5] = "0.03"; +// } +// //垂直 +// if (Math.Abs(verticalDistance) > 0.03) +// { +// dr[6] = Math.Round(verticalDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); +// dr[7] = "0.03"; +// dr[8] = dr[8] + "垂直净距"; +// scFeature.HighLight = true; +// dtBool = true; +// } +// else +// { +// dr[6] = Math.Round(verticalDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); +// dr[7] = "0.03"; +// } +// dr[8] = dr[8] + "超标"; +// } +// else +// { +// if (horizonDistance > 0.015) +// { +// dr[4] = Math.Round(horizonDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); +// dr[5] = "0.015"; +// scFeature.HighLight = true; +// dr[8] = dr[8] + "水平净距"; +// dtBool = true; +// } +// else +// { +// dr[4] = Math.Round(horizonDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); +// dr[5] = "0.015"; +// } +// if (scFeature.GetFieldAsDouble("起始管底高程") <= 1) +// { +// if (Math.Abs(verticalDistance) > 0.01) +// { +// dr[6] = Math.Round(verticalDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); +// dr[7] = "0.01"; +// scFeature.HighLight = true; +// dr[8] = dr[8] + "垂直净距"; +// dtBool = true; +// } +// else +// { +// dr[6] = Math.Round(verticalDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); +// dr[7] = "0.01"; +// } +// } +// else +// { +// if (Math.Abs(verticalDistance) > 0.015) +// { +// dr[6] = Math.Round(verticalDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); +// dr[7] = "0.015"; +// scFeature.HighLight = true; +// dr[8] = dr[8] + "垂直净距"; +// dtBool = true; +// } +// else +// { +// dr[6] = Math.Round(verticalDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); +// dr[7] = "0.015"; +// } +// } +// +// dr[8] = dr[8] + "超标"; +// } +// +// if (!dtBool) return; +// dt.Rows.Add(dr); +// } +// /// +// /// 燃气规范审核 +// /// +// /// +// /// +// /// +// /// +// /// +// /// +// /// +// public static void RanQiAnalysis(string scLayerName, string sgLayerName, GSOFeature scFeature, GSOFeature sgFeature, double horizonDistance, double verticalDistance, DataTable dt) +// { +// bool dtBool = false; +// +// DataRow dr = dt.NewRow(); +// dr[0] = scLayerName; +// dr[1] = scFeature.GetFieldAsString("编号"); +// dr[2] = sgLayerName; +// dr[3] = sgFeature.GetFieldAsString("编号"); +// +// //水平 +// if (horizonDistance > 0.06) +// { +//// dr[4] = Math.Round(horizonDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); +// dr[5] = "0.06"; +// dr[8] = dr[8] + "水平净距"; +// scFeature.HighLight = true; +// dtBool = true; +// } +// else +// { +// dr[4] = Math.Round(horizonDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); +// dr[5] = "0.06"; +// } +// //垂直 +// if (Math.Abs(verticalDistance) > 0.06) +// { +// dr[6] = Math.Round(verticalDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); +// dr[7] = "0.06"; +// dr[8] = dr[8] + "垂直净距"; +// scFeature.HighLight = true; +// dtBool = true; +// } +// else +// { +// dr[6] = Math.Round(verticalDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); +// dr[7] = "0.06"; +// } +// dr[8] = dr[8] + "超标"; +// +// if (!dtBool) return; +// dt.Rows.Add(dr); +// } +// /// +// /// 供电规范审核 +// /// +// /// +// /// +// /// +// /// +// /// +// /// +// /// +// public static void GongDianAnalysis(string scLayerName, string sgLayerName, GSOFeature scFeature, GSOFeature sgFeature, double horizonDistance, double verticalDistance, DataTable dt) +// { +// bool dtBool = false; +// +// DataRow dr = dt.NewRow(); +// dr[0] = scLayerName; +// dr[1] = scFeature.GetFieldAsString("编号"); +// dr[2] = sgLayerName; +// dr[3] = sgFeature.GetFieldAsString("编号"); +// +// //水平 +// if (horizonDistance > 0.02) +// { +// dr[4] = Math.Round(horizonDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); +// dr[5] = "0.02"; +// dr[8] = dr[8] + "水平净距"; +// scFeature.HighLight = true; +// dtBool = true; +// } +// else +// { +// dr[4] = Math.Round(horizonDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); +// dr[5] = "0.02"; +// } +// //垂直 +// if (Math.Abs(verticalDistance) > 0.02) +// { +// dr[6] = Math.Round(verticalDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); +// dr[7] = "0.02"; +// dr[8] = dr[8] + "垂直净距"; +// scFeature.HighLight = true; +// dtBool = true; +// } +// else +// { +// dr[6] = Math.Round(verticalDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); +// dr[7] = "0.02"; +// } +// dr[8] = dr[8] + "超标"; +// +// if (!dtBool) return; +// dt.Rows.Add(dr); +// } + /// - /// 给排水规范审核 + /// 国标检测table计算,某道路下的施工和实测feature的对比信息 /// - /// - /// - /// - /// - /// - /// + /// + /// + /// /// - public static void JiShuiAnalysis(string scLayerName, string sgLayerName, GSOFeature scFeature, - GSOFeature sgFeature, double horizonDistance, double verticalDistance, DataTable dt) + /// + /// + public static void GBJCDataTable(GSOLayer scLayer, GSOLayer sgLayer, string road, + DataTable dt, GSOGlobeControl globeControl1, GSOGlobeControl globeControl2) { - bool dtBool = false; - - DataRow dr = dt.NewRow(); - dr[0] = scLayerName; - dr[1] = scFeature.GetFieldAsString("编号"); - dr[2] = sgLayerName; - dr[3] = sgFeature.GetFieldAsString("编号"); - - if (scLayerName.Contains("给水")) + GSOFeatures scFeatures = scLayer.GetFeatureByFieldValue("所属道路", road, true); + + for (int i=0;i 0.03) + GSOFeature scFeature = scFeatures[i]; + GSOGeoPolyline3D scLine = scFeature.Geometry as GSOGeoPolyline3D; + if (scLine == null) continue; + GSOGeoPolygon3D bufferPolygon = scLine.CreateBuffer(bufferWidth, true, 5, true, false); + GSOFeatures sgFeatures = sgLayer.FindFeaturesInPolygon(bufferPolygon, true); + GSOFeature sgFeature = GetSameFeature(scFeature, scLayer, sgLayer, bufferWidth); + double hStandard = 0.02, vStandard = 0.02; + if (scLayer.Caption.Contains("给水")) { - dr[4] = Math.Round(horizonDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); - dr[5] = "0.03"; - dr[8] = dr[8] + "水平净距"; - scFeature.HighLight = true; - dtBool = true; - } - else + hStandard = 0.03; + vStandard = 0.03; + }else if (scLayer.Caption.Contains("雨水") || scLayer.Caption.Contains("污水") || scLayer.Caption.Contains("雨污")) { - dr[4] = Math.Round(horizonDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); - dr[5] = "0.03"; - } - //垂直 - if (Math.Abs(verticalDistance) > 0.03) - { - dr[6] = Math.Round(verticalDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); - dr[7] = "0.03"; - dr[8] = dr[8] + "垂直净距"; - scFeature.HighLight = true; - dtBool = true; - } - else - { - dr[6] = Math.Round(verticalDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); - dr[7] = "0.03"; - } - dr[8] = dr[8] + "超标"; - } - else - { - if (horizonDistance > 0.015) - { - dr[4] = Math.Round(horizonDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); - dr[5] = "0.015"; - scFeature.HighLight = true; - dr[8] = dr[8] + "水平净距"; - dtBool = true; - } - else - { - dr[4] = Math.Round(horizonDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); - dr[5] = "0.015"; - } - if (scFeature.GetFieldAsDouble("起始管底高程") <= 1) - { - if (Math.Abs(verticalDistance) > 0.01) + hStandard = 0.015; + vStandard = 0.015; + if (scFeature.GetFieldAsDouble("起始管底高程") <= 1) { - dr[6] = Math.Round(verticalDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); - dr[7] = "0.01"; - scFeature.HighLight = true; - dr[8] = dr[8] + "垂直净距"; - dtBool = true; - } - else - { - dr[6] = Math.Round(verticalDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); - dr[7] = "0.01"; + vStandard = 0.01; } } - else + else if (scLayer.Caption.Contains("燃气")) { - if (Math.Abs(verticalDistance) > 0.015) - { - dr[6] = Math.Round(verticalDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); - dr[7] = "0.015"; - scFeature.HighLight = true; - dr[8] = dr[8] + "垂直净距"; - dtBool = true; - } - else - { - dr[6] = Math.Round(verticalDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); - dr[7] = "0.015"; - } + hStandard = 0.06; + vStandard = 0.06; } - dr[8] = dr[8] + "超标"; + if (sgFeatures.Length < 1 || sgFeature == null) //不存在对应的施工管段 + { + scFeature.HighLight = true; + DataRow dr = dt.NewRow(); + dr[0] = scLayer.Caption; + dr[1] = scFeature.GetFieldAsString("编号"); + dr[2] = sgLayer.Caption; + dr[3] = "无"; + dr[4] = "无"; + dr[5] = hStandard; + dr[6] = "无"; + dr[7] = vStandard; + dr[8] = "未设计管段"; + dt.Rows.Add(dr); + } + else + { + GSOGeoPolyline3D sgLine = sgFeature.Geometry as GSOGeoPolyline3D; + double horizonDistance, verticalDistance; + CalculateDistance(out verticalDistance, out horizonDistance, scLine, sgLine, globeControl1, + globeControl2); + RowValueInsert(scFeature, sgFeature, horizonDistance, + verticalDistance,hStandard,vStandard,dt); + } } - - if (!dtBool) return; - dt.Rows.Add(dr); } /// - /// 燃气规范审核 + /// 填充datatable的行,如果符合标准,则直接返回 /// - /// - /// /// /// /// /// + /// + /// /// - public static void RanQiAnalysis(string scLayerName, string sgLayerName, GSOFeature scFeature, GSOFeature sgFeature, double horizonDistance, double verticalDistance, DataTable dt) + private static void RowValueInsert(GSOFeature scFeature, + GSOFeature sgFeature, double horizonDistance, + double verticalDistance,double hStandard,double vStandard,DataTable dt) { - bool dtBool = false; - + //符合标准 + if (horizonDistance <= hStandard && verticalDistance <= vStandard) return; + string scLayerName = scFeature.Dataset.Caption; DataRow dr = dt.NewRow(); dr[0] = scLayerName; dr[1] = scFeature.GetFieldAsString("编号"); - dr[2] = sgLayerName; + dr[2] = sgFeature.Dataset.Caption; dr[3] = sgFeature.GetFieldAsString("编号"); - - //水平 - if (horizonDistance > 0.06) + dr[4] = Math.Round(horizonDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); + dr[5] = hStandard.ToString(); + dr[6] = Math.Round(verticalDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); + dr[7] = vStandard.ToString(); + if (horizonDistance > hStandard) { - dr[4] = Math.Round(horizonDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); - dr[5] = "0.06"; - dr[8] = dr[8] + "水平净距"; + dr[8] = "水平净距超标"; scFeature.HighLight = true; - dtBool = true; } - else + if (verticalDistance > vStandard) { - dr[4] = Math.Round(horizonDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); - dr[5] = "0.06"; - } - //垂直 - if (Math.Abs(verticalDistance) > 0.06) - { - dr[6] = Math.Round(verticalDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); - dr[7] = "0.06"; - dr[8] = dr[8] + "垂直净距"; scFeature.HighLight = true; - dtBool = true; + dr[8] += " 垂直净距超标"; } - else - { - dr[6] = Math.Round(verticalDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); - dr[7] = "0.06"; - } - dr[8] = dr[8] + "超标"; - - if (!dtBool) return; dt.Rows.Add(dr); - } - /// - /// 供电规范审核 - /// - /// - /// - /// - /// - /// - /// - /// - public static void GongDianAnalysis(string scLayerName, string sgLayerName, GSOFeature scFeature, GSOFeature sgFeature, double horizonDistance, double verticalDistance, DataTable dt) - { - bool dtBool = false; - DataRow dr = dt.NewRow(); - dr[0] = scLayerName; - dr[1] = scFeature.GetFieldAsString("编号"); - dr[2] = sgLayerName; - dr[3] = sgFeature.GetFieldAsString("编号"); - - //水平 - if (horizonDistance > 0.02) - { - dr[4] = Math.Round(horizonDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); - dr[5] = "0.02"; - dr[8] = dr[8] + "水平净距"; - scFeature.HighLight = true; - dtBool = true; - } - else - { - dr[4] = Math.Round(horizonDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); - dr[5] = "0.02"; - } - //垂直 - if (Math.Abs(verticalDistance) > 0.02) - { - dr[6] = Math.Round(verticalDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); - dr[7] = "0.02"; - dr[8] = dr[8] + "垂直净距"; - scFeature.HighLight = true; - dtBool = true; - } - else - { - dr[6] = Math.Round(verticalDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); - dr[7] = "0.02"; - } - dr[8] = dr[8] + "超标"; - - if (!dtBool) return; - dt.Rows.Add(dr); } #region wxl 重构 碰撞审查,覆土审查,水平净距审查,垂直净距审查 diff --git a/FrmGBJC.cs b/FrmGBJC.cs index fb3c2bc..d7acc30 100644 --- a/FrmGBJC.cs +++ b/FrmGBJC.cs @@ -89,28 +89,30 @@ textBoxSC.Text = listBoxSC.SelectedItem.ToString(); } - void invalParam() + private bool InvalParam() { - if (textBoxSC.Text.Trim() == "") + if (textBoxSC.Text.Trim().Equals("")) { MessageBox.Show("请选择实测管线图层!", "提示"); - return; + return false; } - else if (textBoxSG.Text.Trim() == "") + if (textBoxSG.Text.Trim().Equals("")) { MessageBox.Show("请选择施工图层!", "提示"); - return; + return false; } - else if (comboBoxRoad.SelectedItem == null) + if (comboBoxRoad.SelectedItem == null) { MessageBox.Show("请选择道路!", "提示"); - return; + return false; } + return true; } private void buttonOK_Click(object sender, EventArgs e) { - invalParam(); + bool isvalid = InvalParam(); + if (!isvalid) return; GSOLayer scLayer = globeControl1.Globe.Layers.GetLayerByCaption(textBoxSC.Text); GSOLayer sgLayer = globeControl2.Globe.Layers.GetLayerByCaption(textBoxSG.Text); diff --git a/bin/x86/Debug/Cyberpipe.exe b/bin/x86/Debug/Cyberpipe.exe index 541e0a1..32f6c05 100644 --- a/bin/x86/Debug/Cyberpipe.exe +++ b/bin/x86/Debug/Cyberpipe.exe Binary files differ diff --git a/Cyberpipe.suo b/Cyberpipe.suo index 3782cd4..0b445f3 100644 --- a/Cyberpipe.suo +++ b/Cyberpipe.suo Binary files differ diff --git a/DoublePanelAnalysis.cs b/DoublePanelAnalysis.cs index 6b17012..ddae545 100644 --- a/DoublePanelAnalysis.cs +++ b/DoublePanelAnalysis.cs @@ -49,8 +49,14 @@ } } - static void intalDataTable(DataTable dt) + /// + /// 单Feature对比方法 + /// + /// + /// + public static DataTable lineFeatureCompare(GSOLayer scLayer, GSOLayer sgLayer, string road, GSOGlobeControl globeControl1, GSOGlobeControl globeControl2) { + DataTable dt = new DataTable(); dt.Columns.Add("实测图层"); dt.Columns.Add("实测管段"); dt.Columns.Add("施工图层"); @@ -60,211 +66,201 @@ dt.Columns.Add("垂直距离/m"); dt.Columns.Add("垂直净距国标/m"); dt.Columns.Add("检测结果"); - } - - /// - /// 单Feature对比方法 - /// - /// - /// - public static DataTable lineFeatureCompare(GSOLayer scLayer, GSOLayer sgLayer, string road, GSOGlobeControl globeControl1, GSOGlobeControl globeControl2) - { - DataTable dt = new DataTable(); - intalDataTable(dt); if (scLayer.Caption.Contains("给水") || scLayer.Caption.Contains("雨水") || scLayer.Caption.Contains("污水") || scLayer.Caption.Contains("雨污")) { strLabel = "目标图层包含不符合《给水排水构筑物工程施工及验收规范》(GB50141-2008)要求的管段,具体内容如下:"; - CreateJiPaiShuiDataTable(scLayer, sgLayer, road, dt, globeControl1, globeControl2); +// CreateJiPaiShuiDataTable(scLayer, sgLayer, road, dt, globeControl1, globeControl2); } else if(scLayer.Caption.Contains("燃气")) { strLabel = "目标图层包含不符合《聚乙烯燃气管道工程技术规程》(GJJ63-2008)要求的管段,具体内容如下:"; - CreateRanQiDataTable(scLayer, sgLayer, road, dt, globeControl1, globeControl2); +// CreateRanQiDataTable(scLayer, sgLayer, road, dt, globeControl1, globeControl2); } else if (scLayer.Caption.Contains("供电")) { strLabel = "目标图层包含不符合《电力建设施工及验收技术规范》 (DL5031-94)要求的管段,具体内容如下:"; - CreateGongDianDataTable(scLayer, sgLayer, road, dt, globeControl1, globeControl2); +// CreateGongDianDataTable(scLayer, sgLayer, road, dt, globeControl1, globeControl2); } + GBJCDataTable(scLayer, sgLayer, road, dt, globeControl1, globeControl2); return dt; } - /// - /// 生成给排水监测结果表格 - /// - /// - /// - /// - /// - public static void CreateJiPaiShuiDataTable(GSOLayer scLayer, GSOLayer sgLayer, string road, - DataTable dt, GSOGlobeControl globeControl1, GSOGlobeControl globeControl2) - { - //给排水监测 - for (int i = 0; i < scLayer.GetAllFeatures().Length; i++) - { - GSOFeature scFeature = scLayer.GetAt(i); - if (scFeature.GetFieldAsString("所属道路") != road) continue; - - GSOGeoPolyline3D scLine = scFeature.Geometry as GSOGeoPolyline3D; - GSOGeoPolygon3D bufferPolygon = scLine.CreateBuffer(bufferWidth, true, 5, true, false); - - GSOFeatures sgFeatures = sgLayer.FindFeaturesInPolygon(bufferPolygon, true); - - InsertDataToJSDataTable(sgFeatures, scFeature, scLayer, sgLayer, scLine, globeControl1, - globeControl2, dt); - } - } - static void InsertDataToJSDataTable(GSOFeatures sgFeatures, GSOFeature scFeature, GSOLayer scLayer, GSOLayer sgLayer, - GSOGeoPolyline3D scLine,GSOGlobeControl globeControl1,GSOGlobeControl globeControl2,DataTable dt) - { - GSOFeature sgFeature = null; - //**判断同一个Feature - if (sgFeatures.Length < 1 || GetSameFeature(scFeature, scLayer, sgLayer, bufferWidth) == null) //不存在对应的施工管段 - { - scFeature.HighLight = true; - DataRow dr = dt.NewRow(); - dr[0] = scLayer.Caption; - dr[1] = scFeature.GetFieldAsString("编号"); - dr[2] = sgLayer.Caption; - dr[3] = "无"; - dr[4] = "无"; - dr[5] = scLayer.Caption.Contains("给水") ? "0.03" : "0.015"; - dr[6] = "无"; - - if (scFeature.GetFieldAsDouble("起始管底高程") <= 1) - dr[7] = scLayer.Caption.Contains("给水") ? "0.03" : "0.1"; - else - dr[7] = scLayer.Caption.Contains("给水") ? "0.03" : "0.015"; - dr[8] = "未设计管段"; - dt.Rows.Add(dr); - } - else - { - sgFeature = GetSameFeature(scFeature, scLayer, sgLayer, bufferWidth); - GSOGeoPolyline3D sgLine = sgFeature.Geometry as GSOGeoPolyline3D; - double horizonDistance, verticalDistance; - - CalculateDistance(out verticalDistance, out horizonDistance, scLine, sgLine, globeControl1, - globeControl2); - JiShuiAnalysis(scLayer.Caption, sgLayer.Caption, scFeature, sgFeature, horizonDistance, - verticalDistance, dt); - } - } - /// - /// 生成燃气监测结果表格 - /// - /// - /// - /// - /// - public static void CreateRanQiDataTable(GSOLayer scLayer, GSOLayer sgLayer, string road, - DataTable dt, GSOGlobeControl globeControl1, GSOGlobeControl globeControl2) - { - //燃气监测 - for (int i = 0; i < scLayer.GetAllFeatures().Length; i++) - { - GSOFeature scFeature = scLayer.GetAt(i); - if (scFeature.GetFieldAsString("所属道路") != road) continue; - GSOGeoPolyline3D scLine = scFeature.Geometry as GSOGeoPolyline3D; - GSOGeoPolygon3D bufferPolygon = scLine.CreateBuffer(bufferWidth, true, 5, true, false); - - GSOFeatures sgFeatures = sgLayer.FindFeaturesInPolygon(bufferPolygon, true); - - InsertDataToRQDataTable(sgFeatures, scFeature, scLayer, sgLayer, scLine, globeControl1, - globeControl2, dt); - - } - } - static void InsertDataToRQDataTable(GSOFeatures sgFeatures, GSOFeature scFeature, GSOLayer scLayer, GSOLayer sgLayer, - GSOGeoPolyline3D scLine, GSOGlobeControl globeControl1, GSOGlobeControl globeControl2, DataTable dt) - { - GSOFeature sgFeature = null; - //**判断同一个Feature - if (sgFeatures.Length < 1 || GetSameFeature(scFeature, scLayer, sgLayer, bufferWidth) == null) - { - scFeature.HighLight = true; - DataRow dr = dt.NewRow(); - dr[0] = scLayer.Caption; - dr[1] = scFeature.GetFieldAsString("编号"); - dr[2] = sgLayer.Caption; - dr[3] = "无"; - dr[4] = "无"; - dr[5] = "0.06"; - dr[6] = "无"; - dr[7] = "0.06"; - dr[8] = "未设计管段"; - dt.Rows.Add(dr); - } - else - { - sgFeature = GetSameFeature(scFeature, scLayer, sgLayer, bufferWidth); - - GSOGeoPolyline3D sgLine = sgFeature.Geometry as GSOGeoPolyline3D; - double horizonDistance, verticalDistance; - - CalculateDistance(out verticalDistance, out horizonDistance, scLine, sgLine, globeControl1, - globeControl2); - RanQiAnalysis(scLayer.Caption, sgLayer.Caption, scFeature, sgFeature, horizonDistance, - verticalDistance, dt); - } - } - /// - /// 生成供电监测结果表格 - /// - /// - /// - /// - /// - public static void CreateGongDianDataTable(GSOLayer scLayer, GSOLayer sgLayer, string road, - DataTable dt, GSOGlobeControl globeControl1, GSOGlobeControl globeControl2) - { - //供电监测 - for (int i = 0; i < scLayer.GetAllFeatures().Length; i++) - { - GSOFeature scFeature = scLayer.GetAt(i); - if (scFeature.GetFieldAsString("所属道路") != road) continue; - GSOGeoPolyline3D scLine = scFeature.Geometry as GSOGeoPolyline3D; - GSOGeoPolygon3D bufferPolygon = scLine.CreateBuffer(bufferWidth, true, 5, true, false); - - GSOFeatures sgFeatures = sgLayer.FindFeaturesInPolygon(bufferPolygon, true); - InsertDataToGDDataTable(sgFeatures, scFeature, scLayer, sgLayer, scLine, globeControl1, - globeControl2, dt); - } - } - static void InsertDataToGDDataTable(GSOFeatures sgFeatures, GSOFeature scFeature, GSOLayer scLayer, GSOLayer sgLayer, - GSOGeoPolyline3D scLine, GSOGlobeControl globeControl1, GSOGlobeControl globeControl2, DataTable dt) - { - GSOFeature sgFeature = null; - //**判断同一个Feature - if (sgFeatures.Length < 1 || GetSameFeature(scFeature, scLayer, sgLayer, bufferWidth) == null) - { - scFeature.HighLight = true; - DataRow dr = dt.NewRow(); - dr[0] = scLayer.Caption; - dr[1] = scFeature.GetFieldAsString("编号"); - dr[2] = sgLayer.Caption; - dr[3] = "无"; - dr[4] = "无"; - dr[5] = "0.02"; - dr[6] = "无"; - dr[7] = "0.02"; - dr[8] = "未设计管段"; - dt.Rows.Add(dr); - } - else - { - sgFeature = GetSameFeature(scFeature, scLayer, sgLayer, bufferWidth); - - GSOGeoPolyline3D sgLine = sgFeature.Geometry as GSOGeoPolyline3D; - double horizonDistance, verticalDistance; - - CalculateDistance(out verticalDistance, out horizonDistance, scLine, sgLine, globeControl1, - globeControl2); - GongDianAnalysis(scLayer.Caption, sgLayer.Caption, scFeature, sgFeature, horizonDistance, - verticalDistance, dt); - } - } +// /// +// /// 生成给排水监测结果表格 +// /// +// /// +// /// +// /// +// /// +// public static void CreateJiPaiShuiDataTable(GSOLayer scLayer, GSOLayer sgLayer, string road, +// DataTable dt, GSOGlobeControl globeControl1, GSOGlobeControl globeControl2) +// { +// //给排水监测 +// for (int i = 0; i < scLayer.GetAllFeatures().Length; i++) +// { +// GSOFeature scFeature = scLayer.GetAt(i); +// if (scFeature.GetFieldAsString("所属道路") != road) continue; +// +// GSOGeoPolyline3D scLine = scFeature.Geometry as GSOGeoPolyline3D; +// GSOGeoPolygon3D bufferPolygon = scLine.CreateBuffer(bufferWidth, true, 5, true, false); +// +// GSOFeatures sgFeatures = sgLayer.FindFeaturesInPolygon(bufferPolygon, true); +// +// InsertDataToJSDataTable(sgFeatures, scFeature, scLayer, sgLayer, scLine, globeControl1, +// globeControl2, dt); +// } +// } +// static void InsertDataToJSDataTable(GSOFeatures sgFeatures, GSOFeature scFeature, GSOLayer scLayer, GSOLayer sgLayer, +// GSOGeoPolyline3D scLine,GSOGlobeControl globeControl1,GSOGlobeControl globeControl2,DataTable dt) +// { +// GSOFeature sgFeature = null; +// //**判断同一个Feature +// if (sgFeatures.Length < 1 || GetSameFeature(scFeature, scLayer, sgLayer, bufferWidth) == null) //不存在对应的施工管段 +// { +// scFeature.HighLight = true; +// DataRow dr = dt.NewRow(); +// dr[0] = scLayer.Caption; +// dr[1] = scFeature.GetFieldAsString("编号"); +// dr[2] = sgLayer.Caption; +// dr[3] = "无"; +// dr[4] = "无"; +// dr[5] = scLayer.Caption.Contains("给水") ? "0.03" : "0.015"; +// dr[6] = "无"; +// +// if (scFeature.GetFieldAsDouble("起始管底高程") <= 1) +// dr[7] = scLayer.Caption.Contains("给水") ? "0.03" : "0.1"; +// else +// dr[7] = scLayer.Caption.Contains("给水") ? "0.03" : "0.015"; +// dr[8] = "未设计管段"; +// dt.Rows.Add(dr); +// } +// else +// { +// sgFeature = GetSameFeature(scFeature, scLayer, sgLayer, bufferWidth); +// GSOGeoPolyline3D sgLine = sgFeature.Geometry as GSOGeoPolyline3D; +// double horizonDistance, verticalDistance; +// +// CalculateDistance(out verticalDistance, out horizonDistance, scLine, sgLine, globeControl1, +// globeControl2); +// JiShuiAnalysis(scLayer.Caption, sgLayer.Caption, scFeature, sgFeature, horizonDistance, +// verticalDistance, dt); +// } +// } +// /// +// /// 生成燃气监测结果表格 +// /// +// /// +// /// +// /// +// /// +// public static void CreateRanQiDataTable(GSOLayer scLayer, GSOLayer sgLayer, string road, +// DataTable dt, GSOGlobeControl globeControl1, GSOGlobeControl globeControl2) +// { +// //燃气监测 +// for (int i = 0; i < scLayer.GetAllFeatures().Length; i++) +// { +// GSOFeature scFeature = scLayer.GetAt(i); +// if (scFeature.GetFieldAsString("所属道路") != road) continue; +// GSOGeoPolyline3D scLine = scFeature.Geometry as GSOGeoPolyline3D; +// GSOGeoPolygon3D bufferPolygon = scLine.CreateBuffer(bufferWidth, true, 5, true, false); +// +// GSOFeatures sgFeatures = sgLayer.FindFeaturesInPolygon(bufferPolygon, true); +// +// InsertDataToRQDataTable(sgFeatures, scFeature, scLayer, sgLayer, scLine, globeControl1, +// globeControl2, dt); +// +// } +// } +// static void InsertDataToRQDataTable(GSOFeatures sgFeatures, GSOFeature scFeature, GSOLayer scLayer, GSOLayer sgLayer, +// GSOGeoPolyline3D scLine, GSOGlobeControl globeControl1, GSOGlobeControl globeControl2, DataTable dt) +// { +// GSOFeature sgFeature = null; +// //**判断同一个Feature +// if (sgFeatures.Length < 1 || GetSameFeature(scFeature, scLayer, sgLayer, bufferWidth) == null) +// { +// scFeature.HighLight = true; +// DataRow dr = dt.NewRow(); +// dr[0] = scLayer.Caption; +// dr[1] = scFeature.GetFieldAsString("编号"); +// dr[2] = sgLayer.Caption; +// dr[3] = "无"; +// dr[4] = "无"; +// dr[5] = "0.06"; +// dr[6] = "无"; +// dr[7] = "0.06"; +// dr[8] = "未设计管段"; +// dt.Rows.Add(dr); +// } +// else +// { +// sgFeature = GetSameFeature(scFeature, scLayer, sgLayer, bufferWidth); +// +// GSOGeoPolyline3D sgLine = sgFeature.Geometry as GSOGeoPolyline3D; +// double horizonDistance, verticalDistance; +// +// CalculateDistance(out verticalDistance, out horizonDistance, scLine, sgLine, globeControl1, +// globeControl2); +// RanQiAnalysis(scLayer.Caption, sgLayer.Caption, scFeature, sgFeature, horizonDistance, +// verticalDistance, dt); +// } +// } +// /// +// /// 生成供电监测结果表格 +// /// +// /// +// /// +// /// +// /// +// public static void CreateGongDianDataTable(GSOLayer scLayer, GSOLayer sgLayer, string road, +// DataTable dt, GSOGlobeControl globeControl1, GSOGlobeControl globeControl2) +// { +// //供电监测 +// for (int i = 0; i < scLayer.GetAllFeatures().Length; i++) +// { +// GSOFeature scFeature = scLayer.GetAt(i); +// if (scFeature.GetFieldAsString("所属道路") != road) continue; +// GSOGeoPolyline3D scLine = scFeature.Geometry as GSOGeoPolyline3D; +// GSOGeoPolygon3D bufferPolygon = scLine.CreateBuffer(bufferWidth, true, 5, true, false); +// +// GSOFeatures sgFeatures = sgLayer.FindFeaturesInPolygon(bufferPolygon, true); +// InsertDataToGDDataTable(sgFeatures, scFeature, scLayer, sgLayer, scLine, globeControl1, +// globeControl2, dt); +// } +// } +// static void InsertDataToGDDataTable(GSOFeatures sgFeatures, GSOFeature scFeature, GSOLayer scLayer, GSOLayer sgLayer, +// GSOGeoPolyline3D scLine, GSOGlobeControl globeControl1, GSOGlobeControl globeControl2, DataTable dt) +// { +// GSOFeature sgFeature = null; +// //**判断同一个Feature +// if (sgFeatures.Length < 1 || GetSameFeature(scFeature, scLayer, sgLayer, bufferWidth) == null) +// { +// scFeature.HighLight = true; +// DataRow dr = dt.NewRow(); +// dr[0] = scLayer.Caption; +// dr[1] = scFeature.GetFieldAsString("编号"); +// dr[2] = sgLayer.Caption; +// dr[3] = "无"; +// dr[4] = "无"; +// dr[5] = "0.02"; +// dr[6] = "无"; +// dr[7] = "0.02"; +// dr[8] = "未设计管段"; +// dt.Rows.Add(dr); +// } +// else +// { +// sgFeature = GetSameFeature(scFeature, scLayer, sgLayer, bufferWidth); +// +// GSOGeoPolyline3D sgLine = sgFeature.Geometry as GSOGeoPolyline3D; +// double horizonDistance, verticalDistance; +// +// CalculateDistance(out verticalDistance, out horizonDistance, scLine, sgLine, globeControl1, +// globeControl2); +// GongDianAnalysis(scLayer.Caption, sgLayer.Caption, scFeature, sgFeature, horizonDistance, +// verticalDistance, dt); +// } +// } #region Fan Zhang 重构feature获取 public static double getLineLength(GSOFeature src,GSOLayer srcLayer,GSOGeoPolygon3D bufferPolygon) @@ -352,218 +348,326 @@ return reFeature; } #endregion +// /// +// /// 给排水规范审核 +// /// +// /// +// /// +// /// +// /// +// /// +// /// +// /// +// public static void JiShuiAnalysis(string scLayerName, string sgLayerName, GSOFeature scFeature, +// GSOFeature sgFeature, double horizonDistance, double verticalDistance, DataTable dt) +// { +// bool dtBool = false; +// +// DataRow dr = dt.NewRow(); +// dr[0] = scLayerName; +// dr[1] = scFeature.GetFieldAsString("编号"); +// dr[2] = sgLayerName; +// dr[3] = sgFeature.GetFieldAsString("编号"); +// +// if (scLayerName.Contains("给水")) +// { +// //水平 +// if (horizonDistance > 0.03) +// { +// dr[4] = Math.Round(horizonDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); +// dr[5] = "0.03"; +// dr[8] = dr[8] + "水平净距"; +// scFeature.HighLight = true; +// dtBool = true; +// } +// else +// { +// dr[4] = Math.Round(horizonDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); +// dr[5] = "0.03"; +// } +// //垂直 +// if (Math.Abs(verticalDistance) > 0.03) +// { +// dr[6] = Math.Round(verticalDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); +// dr[7] = "0.03"; +// dr[8] = dr[8] + "垂直净距"; +// scFeature.HighLight = true; +// dtBool = true; +// } +// else +// { +// dr[6] = Math.Round(verticalDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); +// dr[7] = "0.03"; +// } +// dr[8] = dr[8] + "超标"; +// } +// else +// { +// if (horizonDistance > 0.015) +// { +// dr[4] = Math.Round(horizonDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); +// dr[5] = "0.015"; +// scFeature.HighLight = true; +// dr[8] = dr[8] + "水平净距"; +// dtBool = true; +// } +// else +// { +// dr[4] = Math.Round(horizonDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); +// dr[5] = "0.015"; +// } +// if (scFeature.GetFieldAsDouble("起始管底高程") <= 1) +// { +// if (Math.Abs(verticalDistance) > 0.01) +// { +// dr[6] = Math.Round(verticalDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); +// dr[7] = "0.01"; +// scFeature.HighLight = true; +// dr[8] = dr[8] + "垂直净距"; +// dtBool = true; +// } +// else +// { +// dr[6] = Math.Round(verticalDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); +// dr[7] = "0.01"; +// } +// } +// else +// { +// if (Math.Abs(verticalDistance) > 0.015) +// { +// dr[6] = Math.Round(verticalDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); +// dr[7] = "0.015"; +// scFeature.HighLight = true; +// dr[8] = dr[8] + "垂直净距"; +// dtBool = true; +// } +// else +// { +// dr[6] = Math.Round(verticalDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); +// dr[7] = "0.015"; +// } +// } +// +// dr[8] = dr[8] + "超标"; +// } +// +// if (!dtBool) return; +// dt.Rows.Add(dr); +// } +// /// +// /// 燃气规范审核 +// /// +// /// +// /// +// /// +// /// +// /// +// /// +// /// +// public static void RanQiAnalysis(string scLayerName, string sgLayerName, GSOFeature scFeature, GSOFeature sgFeature, double horizonDistance, double verticalDistance, DataTable dt) +// { +// bool dtBool = false; +// +// DataRow dr = dt.NewRow(); +// dr[0] = scLayerName; +// dr[1] = scFeature.GetFieldAsString("编号"); +// dr[2] = sgLayerName; +// dr[3] = sgFeature.GetFieldAsString("编号"); +// +// //水平 +// if (horizonDistance > 0.06) +// { +//// dr[4] = Math.Round(horizonDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); +// dr[5] = "0.06"; +// dr[8] = dr[8] + "水平净距"; +// scFeature.HighLight = true; +// dtBool = true; +// } +// else +// { +// dr[4] = Math.Round(horizonDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); +// dr[5] = "0.06"; +// } +// //垂直 +// if (Math.Abs(verticalDistance) > 0.06) +// { +// dr[6] = Math.Round(verticalDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); +// dr[7] = "0.06"; +// dr[8] = dr[8] + "垂直净距"; +// scFeature.HighLight = true; +// dtBool = true; +// } +// else +// { +// dr[6] = Math.Round(verticalDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); +// dr[7] = "0.06"; +// } +// dr[8] = dr[8] + "超标"; +// +// if (!dtBool) return; +// dt.Rows.Add(dr); +// } +// /// +// /// 供电规范审核 +// /// +// /// +// /// +// /// +// /// +// /// +// /// +// /// +// public static void GongDianAnalysis(string scLayerName, string sgLayerName, GSOFeature scFeature, GSOFeature sgFeature, double horizonDistance, double verticalDistance, DataTable dt) +// { +// bool dtBool = false; +// +// DataRow dr = dt.NewRow(); +// dr[0] = scLayerName; +// dr[1] = scFeature.GetFieldAsString("编号"); +// dr[2] = sgLayerName; +// dr[3] = sgFeature.GetFieldAsString("编号"); +// +// //水平 +// if (horizonDistance > 0.02) +// { +// dr[4] = Math.Round(horizonDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); +// dr[5] = "0.02"; +// dr[8] = dr[8] + "水平净距"; +// scFeature.HighLight = true; +// dtBool = true; +// } +// else +// { +// dr[4] = Math.Round(horizonDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); +// dr[5] = "0.02"; +// } +// //垂直 +// if (Math.Abs(verticalDistance) > 0.02) +// { +// dr[6] = Math.Round(verticalDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); +// dr[7] = "0.02"; +// dr[8] = dr[8] + "垂直净距"; +// scFeature.HighLight = true; +// dtBool = true; +// } +// else +// { +// dr[6] = Math.Round(verticalDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); +// dr[7] = "0.02"; +// } +// dr[8] = dr[8] + "超标"; +// +// if (!dtBool) return; +// dt.Rows.Add(dr); +// } + /// - /// 给排水规范审核 + /// 国标检测table计算,某道路下的施工和实测feature的对比信息 /// - /// - /// - /// - /// - /// - /// + /// + /// + /// /// - public static void JiShuiAnalysis(string scLayerName, string sgLayerName, GSOFeature scFeature, - GSOFeature sgFeature, double horizonDistance, double verticalDistance, DataTable dt) + /// + /// + public static void GBJCDataTable(GSOLayer scLayer, GSOLayer sgLayer, string road, + DataTable dt, GSOGlobeControl globeControl1, GSOGlobeControl globeControl2) { - bool dtBool = false; - - DataRow dr = dt.NewRow(); - dr[0] = scLayerName; - dr[1] = scFeature.GetFieldAsString("编号"); - dr[2] = sgLayerName; - dr[3] = sgFeature.GetFieldAsString("编号"); - - if (scLayerName.Contains("给水")) + GSOFeatures scFeatures = scLayer.GetFeatureByFieldValue("所属道路", road, true); + + for (int i=0;i 0.03) + GSOFeature scFeature = scFeatures[i]; + GSOGeoPolyline3D scLine = scFeature.Geometry as GSOGeoPolyline3D; + if (scLine == null) continue; + GSOGeoPolygon3D bufferPolygon = scLine.CreateBuffer(bufferWidth, true, 5, true, false); + GSOFeatures sgFeatures = sgLayer.FindFeaturesInPolygon(bufferPolygon, true); + GSOFeature sgFeature = GetSameFeature(scFeature, scLayer, sgLayer, bufferWidth); + double hStandard = 0.02, vStandard = 0.02; + if (scLayer.Caption.Contains("给水")) { - dr[4] = Math.Round(horizonDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); - dr[5] = "0.03"; - dr[8] = dr[8] + "水平净距"; - scFeature.HighLight = true; - dtBool = true; - } - else + hStandard = 0.03; + vStandard = 0.03; + }else if (scLayer.Caption.Contains("雨水") || scLayer.Caption.Contains("污水") || scLayer.Caption.Contains("雨污")) { - dr[4] = Math.Round(horizonDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); - dr[5] = "0.03"; - } - //垂直 - if (Math.Abs(verticalDistance) > 0.03) - { - dr[6] = Math.Round(verticalDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); - dr[7] = "0.03"; - dr[8] = dr[8] + "垂直净距"; - scFeature.HighLight = true; - dtBool = true; - } - else - { - dr[6] = Math.Round(verticalDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); - dr[7] = "0.03"; - } - dr[8] = dr[8] + "超标"; - } - else - { - if (horizonDistance > 0.015) - { - dr[4] = Math.Round(horizonDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); - dr[5] = "0.015"; - scFeature.HighLight = true; - dr[8] = dr[8] + "水平净距"; - dtBool = true; - } - else - { - dr[4] = Math.Round(horizonDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); - dr[5] = "0.015"; - } - if (scFeature.GetFieldAsDouble("起始管底高程") <= 1) - { - if (Math.Abs(verticalDistance) > 0.01) + hStandard = 0.015; + vStandard = 0.015; + if (scFeature.GetFieldAsDouble("起始管底高程") <= 1) { - dr[6] = Math.Round(verticalDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); - dr[7] = "0.01"; - scFeature.HighLight = true; - dr[8] = dr[8] + "垂直净距"; - dtBool = true; - } - else - { - dr[6] = Math.Round(verticalDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); - dr[7] = "0.01"; + vStandard = 0.01; } } - else + else if (scLayer.Caption.Contains("燃气")) { - if (Math.Abs(verticalDistance) > 0.015) - { - dr[6] = Math.Round(verticalDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); - dr[7] = "0.015"; - scFeature.HighLight = true; - dr[8] = dr[8] + "垂直净距"; - dtBool = true; - } - else - { - dr[6] = Math.Round(verticalDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); - dr[7] = "0.015"; - } + hStandard = 0.06; + vStandard = 0.06; } - dr[8] = dr[8] + "超标"; + if (sgFeatures.Length < 1 || sgFeature == null) //不存在对应的施工管段 + { + scFeature.HighLight = true; + DataRow dr = dt.NewRow(); + dr[0] = scLayer.Caption; + dr[1] = scFeature.GetFieldAsString("编号"); + dr[2] = sgLayer.Caption; + dr[3] = "无"; + dr[4] = "无"; + dr[5] = hStandard; + dr[6] = "无"; + dr[7] = vStandard; + dr[8] = "未设计管段"; + dt.Rows.Add(dr); + } + else + { + GSOGeoPolyline3D sgLine = sgFeature.Geometry as GSOGeoPolyline3D; + double horizonDistance, verticalDistance; + CalculateDistance(out verticalDistance, out horizonDistance, scLine, sgLine, globeControl1, + globeControl2); + RowValueInsert(scFeature, sgFeature, horizonDistance, + verticalDistance,hStandard,vStandard,dt); + } } - - if (!dtBool) return; - dt.Rows.Add(dr); } /// - /// 燃气规范审核 + /// 填充datatable的行,如果符合标准,则直接返回 /// - /// - /// /// /// /// /// + /// + /// /// - public static void RanQiAnalysis(string scLayerName, string sgLayerName, GSOFeature scFeature, GSOFeature sgFeature, double horizonDistance, double verticalDistance, DataTable dt) + private static void RowValueInsert(GSOFeature scFeature, + GSOFeature sgFeature, double horizonDistance, + double verticalDistance,double hStandard,double vStandard,DataTable dt) { - bool dtBool = false; - + //符合标准 + if (horizonDistance <= hStandard && verticalDistance <= vStandard) return; + string scLayerName = scFeature.Dataset.Caption; DataRow dr = dt.NewRow(); dr[0] = scLayerName; dr[1] = scFeature.GetFieldAsString("编号"); - dr[2] = sgLayerName; + dr[2] = sgFeature.Dataset.Caption; dr[3] = sgFeature.GetFieldAsString("编号"); - - //水平 - if (horizonDistance > 0.06) + dr[4] = Math.Round(horizonDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); + dr[5] = hStandard.ToString(); + dr[6] = Math.Round(verticalDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); + dr[7] = vStandard.ToString(); + if (horizonDistance > hStandard) { - dr[4] = Math.Round(horizonDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); - dr[5] = "0.06"; - dr[8] = dr[8] + "水平净距"; + dr[8] = "水平净距超标"; scFeature.HighLight = true; - dtBool = true; } - else + if (verticalDistance > vStandard) { - dr[4] = Math.Round(horizonDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); - dr[5] = "0.06"; - } - //垂直 - if (Math.Abs(verticalDistance) > 0.06) - { - dr[6] = Math.Round(verticalDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); - dr[7] = "0.06"; - dr[8] = dr[8] + "垂直净距"; scFeature.HighLight = true; - dtBool = true; + dr[8] += " 垂直净距超标"; } - else - { - dr[6] = Math.Round(verticalDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); - dr[7] = "0.06"; - } - dr[8] = dr[8] + "超标"; - - if (!dtBool) return; dt.Rows.Add(dr); - } - /// - /// 供电规范审核 - /// - /// - /// - /// - /// - /// - /// - /// - public static void GongDianAnalysis(string scLayerName, string sgLayerName, GSOFeature scFeature, GSOFeature sgFeature, double horizonDistance, double verticalDistance, DataTable dt) - { - bool dtBool = false; - DataRow dr = dt.NewRow(); - dr[0] = scLayerName; - dr[1] = scFeature.GetFieldAsString("编号"); - dr[2] = sgLayerName; - dr[3] = sgFeature.GetFieldAsString("编号"); - - //水平 - if (horizonDistance > 0.02) - { - dr[4] = Math.Round(horizonDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); - dr[5] = "0.02"; - dr[8] = dr[8] + "水平净距"; - scFeature.HighLight = true; - dtBool = true; - } - else - { - dr[4] = Math.Round(horizonDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); - dr[5] = "0.02"; - } - //垂直 - if (Math.Abs(verticalDistance) > 0.02) - { - dr[6] = Math.Round(verticalDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); - dr[7] = "0.02"; - dr[8] = dr[8] + "垂直净距"; - scFeature.HighLight = true; - dtBool = true; - } - else - { - dr[6] = Math.Round(verticalDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); - dr[7] = "0.02"; - } - dr[8] = dr[8] + "超标"; - - if (!dtBool) return; - dt.Rows.Add(dr); } #region wxl 重构 碰撞审查,覆土审查,水平净距审查,垂直净距审查 diff --git a/FrmGBJC.cs b/FrmGBJC.cs index fb3c2bc..d7acc30 100644 --- a/FrmGBJC.cs +++ b/FrmGBJC.cs @@ -89,28 +89,30 @@ textBoxSC.Text = listBoxSC.SelectedItem.ToString(); } - void invalParam() + private bool InvalParam() { - if (textBoxSC.Text.Trim() == "") + if (textBoxSC.Text.Trim().Equals("")) { MessageBox.Show("请选择实测管线图层!", "提示"); - return; + return false; } - else if (textBoxSG.Text.Trim() == "") + if (textBoxSG.Text.Trim().Equals("")) { MessageBox.Show("请选择施工图层!", "提示"); - return; + return false; } - else if (comboBoxRoad.SelectedItem == null) + if (comboBoxRoad.SelectedItem == null) { MessageBox.Show("请选择道路!", "提示"); - return; + return false; } + return true; } private void buttonOK_Click(object sender, EventArgs e) { - invalParam(); + bool isvalid = InvalParam(); + if (!isvalid) return; GSOLayer scLayer = globeControl1.Globe.Layers.GetLayerByCaption(textBoxSC.Text); GSOLayer sgLayer = globeControl2.Globe.Layers.GetLayerByCaption(textBoxSG.Text); diff --git a/bin/x86/Debug/Cyberpipe.exe b/bin/x86/Debug/Cyberpipe.exe index 541e0a1..32f6c05 100644 --- a/bin/x86/Debug/Cyberpipe.exe +++ b/bin/x86/Debug/Cyberpipe.exe Binary files differ diff --git a/bin/x86/Debug/Cyberpipe.pdb b/bin/x86/Debug/Cyberpipe.pdb index 79bcecb..040d409 100644 --- a/bin/x86/Debug/Cyberpipe.pdb +++ b/bin/x86/Debug/Cyberpipe.pdb Binary files differ diff --git a/Cyberpipe.suo b/Cyberpipe.suo index 3782cd4..0b445f3 100644 --- a/Cyberpipe.suo +++ b/Cyberpipe.suo Binary files differ diff --git a/DoublePanelAnalysis.cs b/DoublePanelAnalysis.cs index 6b17012..ddae545 100644 --- a/DoublePanelAnalysis.cs +++ b/DoublePanelAnalysis.cs @@ -49,8 +49,14 @@ } } - static void intalDataTable(DataTable dt) + /// + /// 单Feature对比方法 + /// + /// + /// + public static DataTable lineFeatureCompare(GSOLayer scLayer, GSOLayer sgLayer, string road, GSOGlobeControl globeControl1, GSOGlobeControl globeControl2) { + DataTable dt = new DataTable(); dt.Columns.Add("实测图层"); dt.Columns.Add("实测管段"); dt.Columns.Add("施工图层"); @@ -60,211 +66,201 @@ dt.Columns.Add("垂直距离/m"); dt.Columns.Add("垂直净距国标/m"); dt.Columns.Add("检测结果"); - } - - /// - /// 单Feature对比方法 - /// - /// - /// - public static DataTable lineFeatureCompare(GSOLayer scLayer, GSOLayer sgLayer, string road, GSOGlobeControl globeControl1, GSOGlobeControl globeControl2) - { - DataTable dt = new DataTable(); - intalDataTable(dt); if (scLayer.Caption.Contains("给水") || scLayer.Caption.Contains("雨水") || scLayer.Caption.Contains("污水") || scLayer.Caption.Contains("雨污")) { strLabel = "目标图层包含不符合《给水排水构筑物工程施工及验收规范》(GB50141-2008)要求的管段,具体内容如下:"; - CreateJiPaiShuiDataTable(scLayer, sgLayer, road, dt, globeControl1, globeControl2); +// CreateJiPaiShuiDataTable(scLayer, sgLayer, road, dt, globeControl1, globeControl2); } else if(scLayer.Caption.Contains("燃气")) { strLabel = "目标图层包含不符合《聚乙烯燃气管道工程技术规程》(GJJ63-2008)要求的管段,具体内容如下:"; - CreateRanQiDataTable(scLayer, sgLayer, road, dt, globeControl1, globeControl2); +// CreateRanQiDataTable(scLayer, sgLayer, road, dt, globeControl1, globeControl2); } else if (scLayer.Caption.Contains("供电")) { strLabel = "目标图层包含不符合《电力建设施工及验收技术规范》 (DL5031-94)要求的管段,具体内容如下:"; - CreateGongDianDataTable(scLayer, sgLayer, road, dt, globeControl1, globeControl2); +// CreateGongDianDataTable(scLayer, sgLayer, road, dt, globeControl1, globeControl2); } + GBJCDataTable(scLayer, sgLayer, road, dt, globeControl1, globeControl2); return dt; } - /// - /// 生成给排水监测结果表格 - /// - /// - /// - /// - /// - public static void CreateJiPaiShuiDataTable(GSOLayer scLayer, GSOLayer sgLayer, string road, - DataTable dt, GSOGlobeControl globeControl1, GSOGlobeControl globeControl2) - { - //给排水监测 - for (int i = 0; i < scLayer.GetAllFeatures().Length; i++) - { - GSOFeature scFeature = scLayer.GetAt(i); - if (scFeature.GetFieldAsString("所属道路") != road) continue; - - GSOGeoPolyline3D scLine = scFeature.Geometry as GSOGeoPolyline3D; - GSOGeoPolygon3D bufferPolygon = scLine.CreateBuffer(bufferWidth, true, 5, true, false); - - GSOFeatures sgFeatures = sgLayer.FindFeaturesInPolygon(bufferPolygon, true); - - InsertDataToJSDataTable(sgFeatures, scFeature, scLayer, sgLayer, scLine, globeControl1, - globeControl2, dt); - } - } - static void InsertDataToJSDataTable(GSOFeatures sgFeatures, GSOFeature scFeature, GSOLayer scLayer, GSOLayer sgLayer, - GSOGeoPolyline3D scLine,GSOGlobeControl globeControl1,GSOGlobeControl globeControl2,DataTable dt) - { - GSOFeature sgFeature = null; - //**判断同一个Feature - if (sgFeatures.Length < 1 || GetSameFeature(scFeature, scLayer, sgLayer, bufferWidth) == null) //不存在对应的施工管段 - { - scFeature.HighLight = true; - DataRow dr = dt.NewRow(); - dr[0] = scLayer.Caption; - dr[1] = scFeature.GetFieldAsString("编号"); - dr[2] = sgLayer.Caption; - dr[3] = "无"; - dr[4] = "无"; - dr[5] = scLayer.Caption.Contains("给水") ? "0.03" : "0.015"; - dr[6] = "无"; - - if (scFeature.GetFieldAsDouble("起始管底高程") <= 1) - dr[7] = scLayer.Caption.Contains("给水") ? "0.03" : "0.1"; - else - dr[7] = scLayer.Caption.Contains("给水") ? "0.03" : "0.015"; - dr[8] = "未设计管段"; - dt.Rows.Add(dr); - } - else - { - sgFeature = GetSameFeature(scFeature, scLayer, sgLayer, bufferWidth); - GSOGeoPolyline3D sgLine = sgFeature.Geometry as GSOGeoPolyline3D; - double horizonDistance, verticalDistance; - - CalculateDistance(out verticalDistance, out horizonDistance, scLine, sgLine, globeControl1, - globeControl2); - JiShuiAnalysis(scLayer.Caption, sgLayer.Caption, scFeature, sgFeature, horizonDistance, - verticalDistance, dt); - } - } - /// - /// 生成燃气监测结果表格 - /// - /// - /// - /// - /// - public static void CreateRanQiDataTable(GSOLayer scLayer, GSOLayer sgLayer, string road, - DataTable dt, GSOGlobeControl globeControl1, GSOGlobeControl globeControl2) - { - //燃气监测 - for (int i = 0; i < scLayer.GetAllFeatures().Length; i++) - { - GSOFeature scFeature = scLayer.GetAt(i); - if (scFeature.GetFieldAsString("所属道路") != road) continue; - GSOGeoPolyline3D scLine = scFeature.Geometry as GSOGeoPolyline3D; - GSOGeoPolygon3D bufferPolygon = scLine.CreateBuffer(bufferWidth, true, 5, true, false); - - GSOFeatures sgFeatures = sgLayer.FindFeaturesInPolygon(bufferPolygon, true); - - InsertDataToRQDataTable(sgFeatures, scFeature, scLayer, sgLayer, scLine, globeControl1, - globeControl2, dt); - - } - } - static void InsertDataToRQDataTable(GSOFeatures sgFeatures, GSOFeature scFeature, GSOLayer scLayer, GSOLayer sgLayer, - GSOGeoPolyline3D scLine, GSOGlobeControl globeControl1, GSOGlobeControl globeControl2, DataTable dt) - { - GSOFeature sgFeature = null; - //**判断同一个Feature - if (sgFeatures.Length < 1 || GetSameFeature(scFeature, scLayer, sgLayer, bufferWidth) == null) - { - scFeature.HighLight = true; - DataRow dr = dt.NewRow(); - dr[0] = scLayer.Caption; - dr[1] = scFeature.GetFieldAsString("编号"); - dr[2] = sgLayer.Caption; - dr[3] = "无"; - dr[4] = "无"; - dr[5] = "0.06"; - dr[6] = "无"; - dr[7] = "0.06"; - dr[8] = "未设计管段"; - dt.Rows.Add(dr); - } - else - { - sgFeature = GetSameFeature(scFeature, scLayer, sgLayer, bufferWidth); - - GSOGeoPolyline3D sgLine = sgFeature.Geometry as GSOGeoPolyline3D; - double horizonDistance, verticalDistance; - - CalculateDistance(out verticalDistance, out horizonDistance, scLine, sgLine, globeControl1, - globeControl2); - RanQiAnalysis(scLayer.Caption, sgLayer.Caption, scFeature, sgFeature, horizonDistance, - verticalDistance, dt); - } - } - /// - /// 生成供电监测结果表格 - /// - /// - /// - /// - /// - public static void CreateGongDianDataTable(GSOLayer scLayer, GSOLayer sgLayer, string road, - DataTable dt, GSOGlobeControl globeControl1, GSOGlobeControl globeControl2) - { - //供电监测 - for (int i = 0; i < scLayer.GetAllFeatures().Length; i++) - { - GSOFeature scFeature = scLayer.GetAt(i); - if (scFeature.GetFieldAsString("所属道路") != road) continue; - GSOGeoPolyline3D scLine = scFeature.Geometry as GSOGeoPolyline3D; - GSOGeoPolygon3D bufferPolygon = scLine.CreateBuffer(bufferWidth, true, 5, true, false); - - GSOFeatures sgFeatures = sgLayer.FindFeaturesInPolygon(bufferPolygon, true); - InsertDataToGDDataTable(sgFeatures, scFeature, scLayer, sgLayer, scLine, globeControl1, - globeControl2, dt); - } - } - static void InsertDataToGDDataTable(GSOFeatures sgFeatures, GSOFeature scFeature, GSOLayer scLayer, GSOLayer sgLayer, - GSOGeoPolyline3D scLine, GSOGlobeControl globeControl1, GSOGlobeControl globeControl2, DataTable dt) - { - GSOFeature sgFeature = null; - //**判断同一个Feature - if (sgFeatures.Length < 1 || GetSameFeature(scFeature, scLayer, sgLayer, bufferWidth) == null) - { - scFeature.HighLight = true; - DataRow dr = dt.NewRow(); - dr[0] = scLayer.Caption; - dr[1] = scFeature.GetFieldAsString("编号"); - dr[2] = sgLayer.Caption; - dr[3] = "无"; - dr[4] = "无"; - dr[5] = "0.02"; - dr[6] = "无"; - dr[7] = "0.02"; - dr[8] = "未设计管段"; - dt.Rows.Add(dr); - } - else - { - sgFeature = GetSameFeature(scFeature, scLayer, sgLayer, bufferWidth); - - GSOGeoPolyline3D sgLine = sgFeature.Geometry as GSOGeoPolyline3D; - double horizonDistance, verticalDistance; - - CalculateDistance(out verticalDistance, out horizonDistance, scLine, sgLine, globeControl1, - globeControl2); - GongDianAnalysis(scLayer.Caption, sgLayer.Caption, scFeature, sgFeature, horizonDistance, - verticalDistance, dt); - } - } +// /// +// /// 生成给排水监测结果表格 +// /// +// /// +// /// +// /// +// /// +// public static void CreateJiPaiShuiDataTable(GSOLayer scLayer, GSOLayer sgLayer, string road, +// DataTable dt, GSOGlobeControl globeControl1, GSOGlobeControl globeControl2) +// { +// //给排水监测 +// for (int i = 0; i < scLayer.GetAllFeatures().Length; i++) +// { +// GSOFeature scFeature = scLayer.GetAt(i); +// if (scFeature.GetFieldAsString("所属道路") != road) continue; +// +// GSOGeoPolyline3D scLine = scFeature.Geometry as GSOGeoPolyline3D; +// GSOGeoPolygon3D bufferPolygon = scLine.CreateBuffer(bufferWidth, true, 5, true, false); +// +// GSOFeatures sgFeatures = sgLayer.FindFeaturesInPolygon(bufferPolygon, true); +// +// InsertDataToJSDataTable(sgFeatures, scFeature, scLayer, sgLayer, scLine, globeControl1, +// globeControl2, dt); +// } +// } +// static void InsertDataToJSDataTable(GSOFeatures sgFeatures, GSOFeature scFeature, GSOLayer scLayer, GSOLayer sgLayer, +// GSOGeoPolyline3D scLine,GSOGlobeControl globeControl1,GSOGlobeControl globeControl2,DataTable dt) +// { +// GSOFeature sgFeature = null; +// //**判断同一个Feature +// if (sgFeatures.Length < 1 || GetSameFeature(scFeature, scLayer, sgLayer, bufferWidth) == null) //不存在对应的施工管段 +// { +// scFeature.HighLight = true; +// DataRow dr = dt.NewRow(); +// dr[0] = scLayer.Caption; +// dr[1] = scFeature.GetFieldAsString("编号"); +// dr[2] = sgLayer.Caption; +// dr[3] = "无"; +// dr[4] = "无"; +// dr[5] = scLayer.Caption.Contains("给水") ? "0.03" : "0.015"; +// dr[6] = "无"; +// +// if (scFeature.GetFieldAsDouble("起始管底高程") <= 1) +// dr[7] = scLayer.Caption.Contains("给水") ? "0.03" : "0.1"; +// else +// dr[7] = scLayer.Caption.Contains("给水") ? "0.03" : "0.015"; +// dr[8] = "未设计管段"; +// dt.Rows.Add(dr); +// } +// else +// { +// sgFeature = GetSameFeature(scFeature, scLayer, sgLayer, bufferWidth); +// GSOGeoPolyline3D sgLine = sgFeature.Geometry as GSOGeoPolyline3D; +// double horizonDistance, verticalDistance; +// +// CalculateDistance(out verticalDistance, out horizonDistance, scLine, sgLine, globeControl1, +// globeControl2); +// JiShuiAnalysis(scLayer.Caption, sgLayer.Caption, scFeature, sgFeature, horizonDistance, +// verticalDistance, dt); +// } +// } +// /// +// /// 生成燃气监测结果表格 +// /// +// /// +// /// +// /// +// /// +// public static void CreateRanQiDataTable(GSOLayer scLayer, GSOLayer sgLayer, string road, +// DataTable dt, GSOGlobeControl globeControl1, GSOGlobeControl globeControl2) +// { +// //燃气监测 +// for (int i = 0; i < scLayer.GetAllFeatures().Length; i++) +// { +// GSOFeature scFeature = scLayer.GetAt(i); +// if (scFeature.GetFieldAsString("所属道路") != road) continue; +// GSOGeoPolyline3D scLine = scFeature.Geometry as GSOGeoPolyline3D; +// GSOGeoPolygon3D bufferPolygon = scLine.CreateBuffer(bufferWidth, true, 5, true, false); +// +// GSOFeatures sgFeatures = sgLayer.FindFeaturesInPolygon(bufferPolygon, true); +// +// InsertDataToRQDataTable(sgFeatures, scFeature, scLayer, sgLayer, scLine, globeControl1, +// globeControl2, dt); +// +// } +// } +// static void InsertDataToRQDataTable(GSOFeatures sgFeatures, GSOFeature scFeature, GSOLayer scLayer, GSOLayer sgLayer, +// GSOGeoPolyline3D scLine, GSOGlobeControl globeControl1, GSOGlobeControl globeControl2, DataTable dt) +// { +// GSOFeature sgFeature = null; +// //**判断同一个Feature +// if (sgFeatures.Length < 1 || GetSameFeature(scFeature, scLayer, sgLayer, bufferWidth) == null) +// { +// scFeature.HighLight = true; +// DataRow dr = dt.NewRow(); +// dr[0] = scLayer.Caption; +// dr[1] = scFeature.GetFieldAsString("编号"); +// dr[2] = sgLayer.Caption; +// dr[3] = "无"; +// dr[4] = "无"; +// dr[5] = "0.06"; +// dr[6] = "无"; +// dr[7] = "0.06"; +// dr[8] = "未设计管段"; +// dt.Rows.Add(dr); +// } +// else +// { +// sgFeature = GetSameFeature(scFeature, scLayer, sgLayer, bufferWidth); +// +// GSOGeoPolyline3D sgLine = sgFeature.Geometry as GSOGeoPolyline3D; +// double horizonDistance, verticalDistance; +// +// CalculateDistance(out verticalDistance, out horizonDistance, scLine, sgLine, globeControl1, +// globeControl2); +// RanQiAnalysis(scLayer.Caption, sgLayer.Caption, scFeature, sgFeature, horizonDistance, +// verticalDistance, dt); +// } +// } +// /// +// /// 生成供电监测结果表格 +// /// +// /// +// /// +// /// +// /// +// public static void CreateGongDianDataTable(GSOLayer scLayer, GSOLayer sgLayer, string road, +// DataTable dt, GSOGlobeControl globeControl1, GSOGlobeControl globeControl2) +// { +// //供电监测 +// for (int i = 0; i < scLayer.GetAllFeatures().Length; i++) +// { +// GSOFeature scFeature = scLayer.GetAt(i); +// if (scFeature.GetFieldAsString("所属道路") != road) continue; +// GSOGeoPolyline3D scLine = scFeature.Geometry as GSOGeoPolyline3D; +// GSOGeoPolygon3D bufferPolygon = scLine.CreateBuffer(bufferWidth, true, 5, true, false); +// +// GSOFeatures sgFeatures = sgLayer.FindFeaturesInPolygon(bufferPolygon, true); +// InsertDataToGDDataTable(sgFeatures, scFeature, scLayer, sgLayer, scLine, globeControl1, +// globeControl2, dt); +// } +// } +// static void InsertDataToGDDataTable(GSOFeatures sgFeatures, GSOFeature scFeature, GSOLayer scLayer, GSOLayer sgLayer, +// GSOGeoPolyline3D scLine, GSOGlobeControl globeControl1, GSOGlobeControl globeControl2, DataTable dt) +// { +// GSOFeature sgFeature = null; +// //**判断同一个Feature +// if (sgFeatures.Length < 1 || GetSameFeature(scFeature, scLayer, sgLayer, bufferWidth) == null) +// { +// scFeature.HighLight = true; +// DataRow dr = dt.NewRow(); +// dr[0] = scLayer.Caption; +// dr[1] = scFeature.GetFieldAsString("编号"); +// dr[2] = sgLayer.Caption; +// dr[3] = "无"; +// dr[4] = "无"; +// dr[5] = "0.02"; +// dr[6] = "无"; +// dr[7] = "0.02"; +// dr[8] = "未设计管段"; +// dt.Rows.Add(dr); +// } +// else +// { +// sgFeature = GetSameFeature(scFeature, scLayer, sgLayer, bufferWidth); +// +// GSOGeoPolyline3D sgLine = sgFeature.Geometry as GSOGeoPolyline3D; +// double horizonDistance, verticalDistance; +// +// CalculateDistance(out verticalDistance, out horizonDistance, scLine, sgLine, globeControl1, +// globeControl2); +// GongDianAnalysis(scLayer.Caption, sgLayer.Caption, scFeature, sgFeature, horizonDistance, +// verticalDistance, dt); +// } +// } #region Fan Zhang 重构feature获取 public static double getLineLength(GSOFeature src,GSOLayer srcLayer,GSOGeoPolygon3D bufferPolygon) @@ -352,218 +348,326 @@ return reFeature; } #endregion +// /// +// /// 给排水规范审核 +// /// +// /// +// /// +// /// +// /// +// /// +// /// +// /// +// public static void JiShuiAnalysis(string scLayerName, string sgLayerName, GSOFeature scFeature, +// GSOFeature sgFeature, double horizonDistance, double verticalDistance, DataTable dt) +// { +// bool dtBool = false; +// +// DataRow dr = dt.NewRow(); +// dr[0] = scLayerName; +// dr[1] = scFeature.GetFieldAsString("编号"); +// dr[2] = sgLayerName; +// dr[3] = sgFeature.GetFieldAsString("编号"); +// +// if (scLayerName.Contains("给水")) +// { +// //水平 +// if (horizonDistance > 0.03) +// { +// dr[4] = Math.Round(horizonDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); +// dr[5] = "0.03"; +// dr[8] = dr[8] + "水平净距"; +// scFeature.HighLight = true; +// dtBool = true; +// } +// else +// { +// dr[4] = Math.Round(horizonDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); +// dr[5] = "0.03"; +// } +// //垂直 +// if (Math.Abs(verticalDistance) > 0.03) +// { +// dr[6] = Math.Round(verticalDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); +// dr[7] = "0.03"; +// dr[8] = dr[8] + "垂直净距"; +// scFeature.HighLight = true; +// dtBool = true; +// } +// else +// { +// dr[6] = Math.Round(verticalDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); +// dr[7] = "0.03"; +// } +// dr[8] = dr[8] + "超标"; +// } +// else +// { +// if (horizonDistance > 0.015) +// { +// dr[4] = Math.Round(horizonDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); +// dr[5] = "0.015"; +// scFeature.HighLight = true; +// dr[8] = dr[8] + "水平净距"; +// dtBool = true; +// } +// else +// { +// dr[4] = Math.Round(horizonDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); +// dr[5] = "0.015"; +// } +// if (scFeature.GetFieldAsDouble("起始管底高程") <= 1) +// { +// if (Math.Abs(verticalDistance) > 0.01) +// { +// dr[6] = Math.Round(verticalDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); +// dr[7] = "0.01"; +// scFeature.HighLight = true; +// dr[8] = dr[8] + "垂直净距"; +// dtBool = true; +// } +// else +// { +// dr[6] = Math.Round(verticalDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); +// dr[7] = "0.01"; +// } +// } +// else +// { +// if (Math.Abs(verticalDistance) > 0.015) +// { +// dr[6] = Math.Round(verticalDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); +// dr[7] = "0.015"; +// scFeature.HighLight = true; +// dr[8] = dr[8] + "垂直净距"; +// dtBool = true; +// } +// else +// { +// dr[6] = Math.Round(verticalDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); +// dr[7] = "0.015"; +// } +// } +// +// dr[8] = dr[8] + "超标"; +// } +// +// if (!dtBool) return; +// dt.Rows.Add(dr); +// } +// /// +// /// 燃气规范审核 +// /// +// /// +// /// +// /// +// /// +// /// +// /// +// /// +// public static void RanQiAnalysis(string scLayerName, string sgLayerName, GSOFeature scFeature, GSOFeature sgFeature, double horizonDistance, double verticalDistance, DataTable dt) +// { +// bool dtBool = false; +// +// DataRow dr = dt.NewRow(); +// dr[0] = scLayerName; +// dr[1] = scFeature.GetFieldAsString("编号"); +// dr[2] = sgLayerName; +// dr[3] = sgFeature.GetFieldAsString("编号"); +// +// //水平 +// if (horizonDistance > 0.06) +// { +//// dr[4] = Math.Round(horizonDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); +// dr[5] = "0.06"; +// dr[8] = dr[8] + "水平净距"; +// scFeature.HighLight = true; +// dtBool = true; +// } +// else +// { +// dr[4] = Math.Round(horizonDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); +// dr[5] = "0.06"; +// } +// //垂直 +// if (Math.Abs(verticalDistance) > 0.06) +// { +// dr[6] = Math.Round(verticalDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); +// dr[7] = "0.06"; +// dr[8] = dr[8] + "垂直净距"; +// scFeature.HighLight = true; +// dtBool = true; +// } +// else +// { +// dr[6] = Math.Round(verticalDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); +// dr[7] = "0.06"; +// } +// dr[8] = dr[8] + "超标"; +// +// if (!dtBool) return; +// dt.Rows.Add(dr); +// } +// /// +// /// 供电规范审核 +// /// +// /// +// /// +// /// +// /// +// /// +// /// +// /// +// public static void GongDianAnalysis(string scLayerName, string sgLayerName, GSOFeature scFeature, GSOFeature sgFeature, double horizonDistance, double verticalDistance, DataTable dt) +// { +// bool dtBool = false; +// +// DataRow dr = dt.NewRow(); +// dr[0] = scLayerName; +// dr[1] = scFeature.GetFieldAsString("编号"); +// dr[2] = sgLayerName; +// dr[3] = sgFeature.GetFieldAsString("编号"); +// +// //水平 +// if (horizonDistance > 0.02) +// { +// dr[4] = Math.Round(horizonDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); +// dr[5] = "0.02"; +// dr[8] = dr[8] + "水平净距"; +// scFeature.HighLight = true; +// dtBool = true; +// } +// else +// { +// dr[4] = Math.Round(horizonDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); +// dr[5] = "0.02"; +// } +// //垂直 +// if (Math.Abs(verticalDistance) > 0.02) +// { +// dr[6] = Math.Round(verticalDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); +// dr[7] = "0.02"; +// dr[8] = dr[8] + "垂直净距"; +// scFeature.HighLight = true; +// dtBool = true; +// } +// else +// { +// dr[6] = Math.Round(verticalDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); +// dr[7] = "0.02"; +// } +// dr[8] = dr[8] + "超标"; +// +// if (!dtBool) return; +// dt.Rows.Add(dr); +// } + /// - /// 给排水规范审核 + /// 国标检测table计算,某道路下的施工和实测feature的对比信息 /// - /// - /// - /// - /// - /// - /// + /// + /// + /// /// - public static void JiShuiAnalysis(string scLayerName, string sgLayerName, GSOFeature scFeature, - GSOFeature sgFeature, double horizonDistance, double verticalDistance, DataTable dt) + /// + /// + public static void GBJCDataTable(GSOLayer scLayer, GSOLayer sgLayer, string road, + DataTable dt, GSOGlobeControl globeControl1, GSOGlobeControl globeControl2) { - bool dtBool = false; - - DataRow dr = dt.NewRow(); - dr[0] = scLayerName; - dr[1] = scFeature.GetFieldAsString("编号"); - dr[2] = sgLayerName; - dr[3] = sgFeature.GetFieldAsString("编号"); - - if (scLayerName.Contains("给水")) + GSOFeatures scFeatures = scLayer.GetFeatureByFieldValue("所属道路", road, true); + + for (int i=0;i 0.03) + GSOFeature scFeature = scFeatures[i]; + GSOGeoPolyline3D scLine = scFeature.Geometry as GSOGeoPolyline3D; + if (scLine == null) continue; + GSOGeoPolygon3D bufferPolygon = scLine.CreateBuffer(bufferWidth, true, 5, true, false); + GSOFeatures sgFeatures = sgLayer.FindFeaturesInPolygon(bufferPolygon, true); + GSOFeature sgFeature = GetSameFeature(scFeature, scLayer, sgLayer, bufferWidth); + double hStandard = 0.02, vStandard = 0.02; + if (scLayer.Caption.Contains("给水")) { - dr[4] = Math.Round(horizonDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); - dr[5] = "0.03"; - dr[8] = dr[8] + "水平净距"; - scFeature.HighLight = true; - dtBool = true; - } - else + hStandard = 0.03; + vStandard = 0.03; + }else if (scLayer.Caption.Contains("雨水") || scLayer.Caption.Contains("污水") || scLayer.Caption.Contains("雨污")) { - dr[4] = Math.Round(horizonDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); - dr[5] = "0.03"; - } - //垂直 - if (Math.Abs(verticalDistance) > 0.03) - { - dr[6] = Math.Round(verticalDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); - dr[7] = "0.03"; - dr[8] = dr[8] + "垂直净距"; - scFeature.HighLight = true; - dtBool = true; - } - else - { - dr[6] = Math.Round(verticalDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); - dr[7] = "0.03"; - } - dr[8] = dr[8] + "超标"; - } - else - { - if (horizonDistance > 0.015) - { - dr[4] = Math.Round(horizonDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); - dr[5] = "0.015"; - scFeature.HighLight = true; - dr[8] = dr[8] + "水平净距"; - dtBool = true; - } - else - { - dr[4] = Math.Round(horizonDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); - dr[5] = "0.015"; - } - if (scFeature.GetFieldAsDouble("起始管底高程") <= 1) - { - if (Math.Abs(verticalDistance) > 0.01) + hStandard = 0.015; + vStandard = 0.015; + if (scFeature.GetFieldAsDouble("起始管底高程") <= 1) { - dr[6] = Math.Round(verticalDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); - dr[7] = "0.01"; - scFeature.HighLight = true; - dr[8] = dr[8] + "垂直净距"; - dtBool = true; - } - else - { - dr[6] = Math.Round(verticalDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); - dr[7] = "0.01"; + vStandard = 0.01; } } - else + else if (scLayer.Caption.Contains("燃气")) { - if (Math.Abs(verticalDistance) > 0.015) - { - dr[6] = Math.Round(verticalDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); - dr[7] = "0.015"; - scFeature.HighLight = true; - dr[8] = dr[8] + "垂直净距"; - dtBool = true; - } - else - { - dr[6] = Math.Round(verticalDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); - dr[7] = "0.015"; - } + hStandard = 0.06; + vStandard = 0.06; } - dr[8] = dr[8] + "超标"; + if (sgFeatures.Length < 1 || sgFeature == null) //不存在对应的施工管段 + { + scFeature.HighLight = true; + DataRow dr = dt.NewRow(); + dr[0] = scLayer.Caption; + dr[1] = scFeature.GetFieldAsString("编号"); + dr[2] = sgLayer.Caption; + dr[3] = "无"; + dr[4] = "无"; + dr[5] = hStandard; + dr[6] = "无"; + dr[7] = vStandard; + dr[8] = "未设计管段"; + dt.Rows.Add(dr); + } + else + { + GSOGeoPolyline3D sgLine = sgFeature.Geometry as GSOGeoPolyline3D; + double horizonDistance, verticalDistance; + CalculateDistance(out verticalDistance, out horizonDistance, scLine, sgLine, globeControl1, + globeControl2); + RowValueInsert(scFeature, sgFeature, horizonDistance, + verticalDistance,hStandard,vStandard,dt); + } } - - if (!dtBool) return; - dt.Rows.Add(dr); } /// - /// 燃气规范审核 + /// 填充datatable的行,如果符合标准,则直接返回 /// - /// - /// /// /// /// /// + /// + /// /// - public static void RanQiAnalysis(string scLayerName, string sgLayerName, GSOFeature scFeature, GSOFeature sgFeature, double horizonDistance, double verticalDistance, DataTable dt) + private static void RowValueInsert(GSOFeature scFeature, + GSOFeature sgFeature, double horizonDistance, + double verticalDistance,double hStandard,double vStandard,DataTable dt) { - bool dtBool = false; - + //符合标准 + if (horizonDistance <= hStandard && verticalDistance <= vStandard) return; + string scLayerName = scFeature.Dataset.Caption; DataRow dr = dt.NewRow(); dr[0] = scLayerName; dr[1] = scFeature.GetFieldAsString("编号"); - dr[2] = sgLayerName; + dr[2] = sgFeature.Dataset.Caption; dr[3] = sgFeature.GetFieldAsString("编号"); - - //水平 - if (horizonDistance > 0.06) + dr[4] = Math.Round(horizonDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); + dr[5] = hStandard.ToString(); + dr[6] = Math.Round(verticalDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); + dr[7] = vStandard.ToString(); + if (horizonDistance > hStandard) { - dr[4] = Math.Round(horizonDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); - dr[5] = "0.06"; - dr[8] = dr[8] + "水平净距"; + dr[8] = "水平净距超标"; scFeature.HighLight = true; - dtBool = true; } - else + if (verticalDistance > vStandard) { - dr[4] = Math.Round(horizonDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); - dr[5] = "0.06"; - } - //垂直 - if (Math.Abs(verticalDistance) > 0.06) - { - dr[6] = Math.Round(verticalDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); - dr[7] = "0.06"; - dr[8] = dr[8] + "垂直净距"; scFeature.HighLight = true; - dtBool = true; + dr[8] += " 垂直净距超标"; } - else - { - dr[6] = Math.Round(verticalDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); - dr[7] = "0.06"; - } - dr[8] = dr[8] + "超标"; - - if (!dtBool) return; dt.Rows.Add(dr); - } - /// - /// 供电规范审核 - /// - /// - /// - /// - /// - /// - /// - /// - public static void GongDianAnalysis(string scLayerName, string sgLayerName, GSOFeature scFeature, GSOFeature sgFeature, double horizonDistance, double verticalDistance, DataTable dt) - { - bool dtBool = false; - DataRow dr = dt.NewRow(); - dr[0] = scLayerName; - dr[1] = scFeature.GetFieldAsString("编号"); - dr[2] = sgLayerName; - dr[3] = sgFeature.GetFieldAsString("编号"); - - //水平 - if (horizonDistance > 0.02) - { - dr[4] = Math.Round(horizonDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); - dr[5] = "0.02"; - dr[8] = dr[8] + "水平净距"; - scFeature.HighLight = true; - dtBool = true; - } - else - { - dr[4] = Math.Round(horizonDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); - dr[5] = "0.02"; - } - //垂直 - if (Math.Abs(verticalDistance) > 0.02) - { - dr[6] = Math.Round(verticalDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); - dr[7] = "0.02"; - dr[8] = dr[8] + "垂直净距"; - scFeature.HighLight = true; - dtBool = true; - } - else - { - dr[6] = Math.Round(verticalDistance, 2, MidpointRounding.AwayFromZero).ToString("0.00"); - dr[7] = "0.02"; - } - dr[8] = dr[8] + "超标"; - - if (!dtBool) return; - dt.Rows.Add(dr); } #region wxl 重构 碰撞审查,覆土审查,水平净距审查,垂直净距审查 diff --git a/FrmGBJC.cs b/FrmGBJC.cs index fb3c2bc..d7acc30 100644 --- a/FrmGBJC.cs +++ b/FrmGBJC.cs @@ -89,28 +89,30 @@ textBoxSC.Text = listBoxSC.SelectedItem.ToString(); } - void invalParam() + private bool InvalParam() { - if (textBoxSC.Text.Trim() == "") + if (textBoxSC.Text.Trim().Equals("")) { MessageBox.Show("请选择实测管线图层!", "提示"); - return; + return false; } - else if (textBoxSG.Text.Trim() == "") + if (textBoxSG.Text.Trim().Equals("")) { MessageBox.Show("请选择施工图层!", "提示"); - return; + return false; } - else if (comboBoxRoad.SelectedItem == null) + if (comboBoxRoad.SelectedItem == null) { MessageBox.Show("请选择道路!", "提示"); - return; + return false; } + return true; } private void buttonOK_Click(object sender, EventArgs e) { - invalParam(); + bool isvalid = InvalParam(); + if (!isvalid) return; GSOLayer scLayer = globeControl1.Globe.Layers.GetLayerByCaption(textBoxSC.Text); GSOLayer sgLayer = globeControl2.Globe.Layers.GetLayerByCaption(textBoxSG.Text); diff --git a/bin/x86/Debug/Cyberpipe.exe b/bin/x86/Debug/Cyberpipe.exe index 541e0a1..32f6c05 100644 --- a/bin/x86/Debug/Cyberpipe.exe +++ b/bin/x86/Debug/Cyberpipe.exe Binary files differ diff --git a/bin/x86/Debug/Cyberpipe.pdb b/bin/x86/Debug/Cyberpipe.pdb index 79bcecb..040d409 100644 --- a/bin/x86/Debug/Cyberpipe.pdb +++ b/bin/x86/Debug/Cyberpipe.pdb Binary files differ diff --git a/bin/x86/Debug/glVersion.txt b/bin/x86/Debug/glVersion.txt index 06a7613..1fc46d0 100644 --- a/bin/x86/Debug/glVersion.txt +++ b/bin/x86/Debug/glVersion.txt Binary files differ