diff --git a/ClassGSOTool.cs b/ClassGSOTool.cs index c62bd08..ee92134 100644 --- a/ClassGSOTool.cs +++ b/ClassGSOTool.cs @@ -87,9 +87,7 @@ for (int j = 0; j < listPipelineLayers.Count; j++) { layer = listPipelineLayers[j]; - - //计算管线附属物 - pointLayer = m_globeControl.Globe.Layers.GetLayerByCaption(layer.Caption + "附属物"); + pointLayer = m_globeControl.Globe.Layers.GetLayerByCaption(layer.Caption + "附属物");//管线附属物计算 GSOFeatures feats = null; if (pointLayer != null) @@ -120,6 +118,9 @@ double lengthTotal = 0.0; double areaMin = 0.0; + areaMin = CalculateMinArea(features, featuresTrue, featurePolygon); + lengthTotal = CalculateLength(features, featuresTrue, featurePolygon); + /* #region 求面积 //获取面中所有对象组成的切割面的长线 GSOFeature polygonFeature = getLineFromGSOFeatures(features, featuresTrue); @@ -145,7 +146,6 @@ } } } - } } #endregion @@ -170,7 +170,6 @@ GSOGeoPolyline3D line = feature.Geometry as GSOGeoPolyline3D; double lineLength = line.GetSpaceLength(false, 6378137); lengthTotal += lineLength; - } else { @@ -187,12 +186,10 @@ GSOGeoPolyline3D lineAnalysis = featureline.Geometry as GSOGeoPolyline3D; double length = lineAnalysis.GetSpaceLength(false, 6378137); lengthTotal += length; - } } } } - } else { @@ -200,6 +197,7 @@ } } #endregion + */ if (areaMin != 0 || lengthTotal != 0) { @@ -219,12 +217,107 @@ row[5] = feats.Length; table.Rows.Add(row); } - } #endregion } } /// + /// 计算侵入面积 + /// + /// + /// + /// + /// + private static double CalculateMinArea(GSOFeatures features, GSOFeatures featuresTrue, GSOFeature featurePolygon) + { + double areaMin = 0; + //获取面中所有对象组成的切割面的长线 + GSOFeature polygonFeature = getLineFromGSOFeatures(features, featuresTrue); + if (polygonFeature != null && polygonFeature.Geometry != null) + { + GSOFeatures polygonFs = new GSOFeatures(); + int polygoRresult = 0; + GSODataEngineUtility.GSLineClipPolygon(polygonFeature, featurePolygon, out polygonFs, out polygoRresult); + ///////////////////////判断面积问题/////////////////////// + if (polygoRresult == 3) + { + areaMin = double.MaxValue; + for (int mm = 0; mm < polygonFs.Length; mm++) + { + GSOFeature featurePolgyon = polygonFs[mm]; + if (featurePolgyon.Geometry.Type == EnumGeometryType.GeoPolygon3D) + { + GSOGeoPolygon3D polygonAnalysis = featurePolgyon.Geometry as GSOGeoPolygon3D; + double areaPolygon = polygonAnalysis.Area; + if (areaPolygon < areaMin) + { + areaMin = areaPolygon; + } + } + } + } + } + return areaMin; + } + /// + /// 计算侵入长度 + /// + /// + /// + /// + /// + private static double CalculateLength(GSOFeatures features, GSOFeatures featuresTrue, GSOFeature featurePolygon) + { + double lengthTotal = 0; + for (int m = 0; m < features.Length; m++) + { + GSOFeature feature = features[m]; + if (feature != null && feature.Geometry != null && feature.Geometry.Type == EnumGeometryType.GeoPolyline3D) + { + bool isFullInPolygon = false; + for (int n = 0; n < featuresTrue.Length; n++) + { + if (feature.ID == featuresTrue[n].ID) + { + isFullInPolygon = true; + break; + } + } + if (isFullInPolygon == true) + { + GSOGeoPolyline3D line = feature.Geometry as GSOGeoPolyline3D; + double lineLength = line.GetSpaceLength(false, 6378137); + lengthTotal += lineLength; + } + else + { + GSOFeatures fs = new GSOFeatures(); + int result = 0; + GSODataEngineUtility.GSPolygonClipLine(feature, featurePolygon, out fs, out result); + if (result == 1) + { + for (int k = 0; k < fs.Length; k++) + { + GSOFeature featureline = fs[k]; + if (featureline != null && featureline.Geometry != null && featureline.Geometry.Type == EnumGeometryType.GeoPolyline3D) + { + GSOGeoPolyline3D lineAnalysis = featureline.Geometry as GSOGeoPolyline3D; + double length = lineAnalysis.GetSpaceLength(false, 6378137); + lengthTotal += length; + } + } + } + } + } + else + { + //MessageBox.Show("没有找到切割面的线对象!"); + } + } + return lengthTotal; + } + + /// /// 去除集合中重复的管线 /// /// diff --git a/ClassGSOTool.cs b/ClassGSOTool.cs index c62bd08..ee92134 100644 --- a/ClassGSOTool.cs +++ b/ClassGSOTool.cs @@ -87,9 +87,7 @@ for (int j = 0; j < listPipelineLayers.Count; j++) { layer = listPipelineLayers[j]; - - //计算管线附属物 - pointLayer = m_globeControl.Globe.Layers.GetLayerByCaption(layer.Caption + "附属物"); + pointLayer = m_globeControl.Globe.Layers.GetLayerByCaption(layer.Caption + "附属物");//管线附属物计算 GSOFeatures feats = null; if (pointLayer != null) @@ -120,6 +118,9 @@ double lengthTotal = 0.0; double areaMin = 0.0; + areaMin = CalculateMinArea(features, featuresTrue, featurePolygon); + lengthTotal = CalculateLength(features, featuresTrue, featurePolygon); + /* #region 求面积 //获取面中所有对象组成的切割面的长线 GSOFeature polygonFeature = getLineFromGSOFeatures(features, featuresTrue); @@ -145,7 +146,6 @@ } } } - } } #endregion @@ -170,7 +170,6 @@ GSOGeoPolyline3D line = feature.Geometry as GSOGeoPolyline3D; double lineLength = line.GetSpaceLength(false, 6378137); lengthTotal += lineLength; - } else { @@ -187,12 +186,10 @@ GSOGeoPolyline3D lineAnalysis = featureline.Geometry as GSOGeoPolyline3D; double length = lineAnalysis.GetSpaceLength(false, 6378137); lengthTotal += length; - } } } } - } else { @@ -200,6 +197,7 @@ } } #endregion + */ if (areaMin != 0 || lengthTotal != 0) { @@ -219,12 +217,107 @@ row[5] = feats.Length; table.Rows.Add(row); } - } #endregion } } /// + /// 计算侵入面积 + /// + /// + /// + /// + /// + private static double CalculateMinArea(GSOFeatures features, GSOFeatures featuresTrue, GSOFeature featurePolygon) + { + double areaMin = 0; + //获取面中所有对象组成的切割面的长线 + GSOFeature polygonFeature = getLineFromGSOFeatures(features, featuresTrue); + if (polygonFeature != null && polygonFeature.Geometry != null) + { + GSOFeatures polygonFs = new GSOFeatures(); + int polygoRresult = 0; + GSODataEngineUtility.GSLineClipPolygon(polygonFeature, featurePolygon, out polygonFs, out polygoRresult); + ///////////////////////判断面积问题/////////////////////// + if (polygoRresult == 3) + { + areaMin = double.MaxValue; + for (int mm = 0; mm < polygonFs.Length; mm++) + { + GSOFeature featurePolgyon = polygonFs[mm]; + if (featurePolgyon.Geometry.Type == EnumGeometryType.GeoPolygon3D) + { + GSOGeoPolygon3D polygonAnalysis = featurePolgyon.Geometry as GSOGeoPolygon3D; + double areaPolygon = polygonAnalysis.Area; + if (areaPolygon < areaMin) + { + areaMin = areaPolygon; + } + } + } + } + } + return areaMin; + } + /// + /// 计算侵入长度 + /// + /// + /// + /// + /// + private static double CalculateLength(GSOFeatures features, GSOFeatures featuresTrue, GSOFeature featurePolygon) + { + double lengthTotal = 0; + for (int m = 0; m < features.Length; m++) + { + GSOFeature feature = features[m]; + if (feature != null && feature.Geometry != null && feature.Geometry.Type == EnumGeometryType.GeoPolyline3D) + { + bool isFullInPolygon = false; + for (int n = 0; n < featuresTrue.Length; n++) + { + if (feature.ID == featuresTrue[n].ID) + { + isFullInPolygon = true; + break; + } + } + if (isFullInPolygon == true) + { + GSOGeoPolyline3D line = feature.Geometry as GSOGeoPolyline3D; + double lineLength = line.GetSpaceLength(false, 6378137); + lengthTotal += lineLength; + } + else + { + GSOFeatures fs = new GSOFeatures(); + int result = 0; + GSODataEngineUtility.GSPolygonClipLine(feature, featurePolygon, out fs, out result); + if (result == 1) + { + for (int k = 0; k < fs.Length; k++) + { + GSOFeature featureline = fs[k]; + if (featureline != null && featureline.Geometry != null && featureline.Geometry.Type == EnumGeometryType.GeoPolyline3D) + { + GSOGeoPolyline3D lineAnalysis = featureline.Geometry as GSOGeoPolyline3D; + double length = lineAnalysis.GetSpaceLength(false, 6378137); + lengthTotal += length; + } + } + } + } + } + else + { + //MessageBox.Show("没有找到切割面的线对象!"); + } + } + return lengthTotal; + } + + /// /// 去除集合中重复的管线 /// /// diff --git a/ClassSearchAnalysis.cs b/ClassSearchAnalysis.cs index 73b46c2..29875ad 100644 --- a/ClassSearchAnalysis.cs +++ b/ClassSearchAnalysis.cs @@ -22,7 +22,7 @@ /// /// /// - public static DataTable ResultDataTable(out DataTable dt,GSOGlobeControl m_globeControl,string layerName, + public static void ResultDataTable(out DataTable dt,GSOGlobeControl m_globeControl,string layerName, string filedObject,string filedValue) { string sql = ""; @@ -38,7 +38,7 @@ + filedValue + "%'"; } dt = OledbHelper.QueryTable(sql); - return dt; + //return dt; } /// /// SQL语句查询 @@ -51,7 +51,7 @@ /// /// /// - public static DataTable ResultDataTable(out DataTable dt, GSOGlobeControl m_globeControl, string layerName, + public static void ResultDataTable(out DataTable dt, GSOGlobeControl m_globeControl, string layerName, string filedObject,string mathT, string leftFiledValue, string rightFiledValue) { string sql = ""; @@ -67,7 +67,7 @@ + " from " + layerName + " where " + filedObject + mathT + rightFiledValue; } dt = OledbHelper.QueryTable(sql); - return dt; + //return dt; } /// /// SQL查询不重复的值 @@ -76,11 +76,11 @@ /// /// /// - public static DataTable ResultDistinctDataTable(out DataTable dt,string layerName,string filedObject) + public static void ResultDistinctDataTable(out DataTable dt,string layerName,string filedObject) { string sql = "select distinct " + filedObject + " from " + layerName + " order by " + filedObject; dt = OledbHelper.QueryTable(sql); - return dt; + //return dt; } /// /// SQL查询,返回包含NULL的Table @@ -91,7 +91,7 @@ /// /// /// - public static DataTable ResultDataTableContainNull(out DataTable dt,GSOGlobeControl m_globeControl, + public static void ResultDataTableContainNull(out DataTable dt,GSOGlobeControl m_globeControl, string layerName,string filedObject,List filedValueList) { string sql = "select " + getpipeLineFields.getFields(layerName, m_globeControl) @@ -124,7 +124,7 @@ } dt = OledbHelper.QueryTable(sql); - return dt; + //return dt; } /// /// SQL查询,参数待有where语句 @@ -134,13 +134,13 @@ /// /// /// - public static DataTable ResultDataTable(out DataTable dt,GSOGlobeControl m_globeControl, string layerName, string whereSql) + public static void ResultDataTable(out DataTable dt,GSOGlobeControl m_globeControl, string layerName, string whereSql) { string sql = "select " + getpipeLineFields.getFields(layerName, m_globeControl) + " from " + layerName + " where " + whereSql; dt = OledbHelper.QueryTable(sql); - return dt; + //return dt; } diff --git a/ClassGSOTool.cs b/ClassGSOTool.cs index c62bd08..ee92134 100644 --- a/ClassGSOTool.cs +++ b/ClassGSOTool.cs @@ -87,9 +87,7 @@ for (int j = 0; j < listPipelineLayers.Count; j++) { layer = listPipelineLayers[j]; - - //计算管线附属物 - pointLayer = m_globeControl.Globe.Layers.GetLayerByCaption(layer.Caption + "附属物"); + pointLayer = m_globeControl.Globe.Layers.GetLayerByCaption(layer.Caption + "附属物");//管线附属物计算 GSOFeatures feats = null; if (pointLayer != null) @@ -120,6 +118,9 @@ double lengthTotal = 0.0; double areaMin = 0.0; + areaMin = CalculateMinArea(features, featuresTrue, featurePolygon); + lengthTotal = CalculateLength(features, featuresTrue, featurePolygon); + /* #region 求面积 //获取面中所有对象组成的切割面的长线 GSOFeature polygonFeature = getLineFromGSOFeatures(features, featuresTrue); @@ -145,7 +146,6 @@ } } } - } } #endregion @@ -170,7 +170,6 @@ GSOGeoPolyline3D line = feature.Geometry as GSOGeoPolyline3D; double lineLength = line.GetSpaceLength(false, 6378137); lengthTotal += lineLength; - } else { @@ -187,12 +186,10 @@ GSOGeoPolyline3D lineAnalysis = featureline.Geometry as GSOGeoPolyline3D; double length = lineAnalysis.GetSpaceLength(false, 6378137); lengthTotal += length; - } } } } - } else { @@ -200,6 +197,7 @@ } } #endregion + */ if (areaMin != 0 || lengthTotal != 0) { @@ -219,12 +217,107 @@ row[5] = feats.Length; table.Rows.Add(row); } - } #endregion } } /// + /// 计算侵入面积 + /// + /// + /// + /// + /// + private static double CalculateMinArea(GSOFeatures features, GSOFeatures featuresTrue, GSOFeature featurePolygon) + { + double areaMin = 0; + //获取面中所有对象组成的切割面的长线 + GSOFeature polygonFeature = getLineFromGSOFeatures(features, featuresTrue); + if (polygonFeature != null && polygonFeature.Geometry != null) + { + GSOFeatures polygonFs = new GSOFeatures(); + int polygoRresult = 0; + GSODataEngineUtility.GSLineClipPolygon(polygonFeature, featurePolygon, out polygonFs, out polygoRresult); + ///////////////////////判断面积问题/////////////////////// + if (polygoRresult == 3) + { + areaMin = double.MaxValue; + for (int mm = 0; mm < polygonFs.Length; mm++) + { + GSOFeature featurePolgyon = polygonFs[mm]; + if (featurePolgyon.Geometry.Type == EnumGeometryType.GeoPolygon3D) + { + GSOGeoPolygon3D polygonAnalysis = featurePolgyon.Geometry as GSOGeoPolygon3D; + double areaPolygon = polygonAnalysis.Area; + if (areaPolygon < areaMin) + { + areaMin = areaPolygon; + } + } + } + } + } + return areaMin; + } + /// + /// 计算侵入长度 + /// + /// + /// + /// + /// + private static double CalculateLength(GSOFeatures features, GSOFeatures featuresTrue, GSOFeature featurePolygon) + { + double lengthTotal = 0; + for (int m = 0; m < features.Length; m++) + { + GSOFeature feature = features[m]; + if (feature != null && feature.Geometry != null && feature.Geometry.Type == EnumGeometryType.GeoPolyline3D) + { + bool isFullInPolygon = false; + for (int n = 0; n < featuresTrue.Length; n++) + { + if (feature.ID == featuresTrue[n].ID) + { + isFullInPolygon = true; + break; + } + } + if (isFullInPolygon == true) + { + GSOGeoPolyline3D line = feature.Geometry as GSOGeoPolyline3D; + double lineLength = line.GetSpaceLength(false, 6378137); + lengthTotal += lineLength; + } + else + { + GSOFeatures fs = new GSOFeatures(); + int result = 0; + GSODataEngineUtility.GSPolygonClipLine(feature, featurePolygon, out fs, out result); + if (result == 1) + { + for (int k = 0; k < fs.Length; k++) + { + GSOFeature featureline = fs[k]; + if (featureline != null && featureline.Geometry != null && featureline.Geometry.Type == EnumGeometryType.GeoPolyline3D) + { + GSOGeoPolyline3D lineAnalysis = featureline.Geometry as GSOGeoPolyline3D; + double length = lineAnalysis.GetSpaceLength(false, 6378137); + lengthTotal += length; + } + } + } + } + } + else + { + //MessageBox.Show("没有找到切割面的线对象!"); + } + } + return lengthTotal; + } + + /// /// 去除集合中重复的管线 /// /// diff --git a/ClassSearchAnalysis.cs b/ClassSearchAnalysis.cs index 73b46c2..29875ad 100644 --- a/ClassSearchAnalysis.cs +++ b/ClassSearchAnalysis.cs @@ -22,7 +22,7 @@ /// /// /// - public static DataTable ResultDataTable(out DataTable dt,GSOGlobeControl m_globeControl,string layerName, + public static void ResultDataTable(out DataTable dt,GSOGlobeControl m_globeControl,string layerName, string filedObject,string filedValue) { string sql = ""; @@ -38,7 +38,7 @@ + filedValue + "%'"; } dt = OledbHelper.QueryTable(sql); - return dt; + //return dt; } /// /// SQL语句查询 @@ -51,7 +51,7 @@ /// /// /// - public static DataTable ResultDataTable(out DataTable dt, GSOGlobeControl m_globeControl, string layerName, + public static void ResultDataTable(out DataTable dt, GSOGlobeControl m_globeControl, string layerName, string filedObject,string mathT, string leftFiledValue, string rightFiledValue) { string sql = ""; @@ -67,7 +67,7 @@ + " from " + layerName + " where " + filedObject + mathT + rightFiledValue; } dt = OledbHelper.QueryTable(sql); - return dt; + //return dt; } /// /// SQL查询不重复的值 @@ -76,11 +76,11 @@ /// /// /// - public static DataTable ResultDistinctDataTable(out DataTable dt,string layerName,string filedObject) + public static void ResultDistinctDataTable(out DataTable dt,string layerName,string filedObject) { string sql = "select distinct " + filedObject + " from " + layerName + " order by " + filedObject; dt = OledbHelper.QueryTable(sql); - return dt; + //return dt; } /// /// SQL查询,返回包含NULL的Table @@ -91,7 +91,7 @@ /// /// /// - public static DataTable ResultDataTableContainNull(out DataTable dt,GSOGlobeControl m_globeControl, + public static void ResultDataTableContainNull(out DataTable dt,GSOGlobeControl m_globeControl, string layerName,string filedObject,List filedValueList) { string sql = "select " + getpipeLineFields.getFields(layerName, m_globeControl) @@ -124,7 +124,7 @@ } dt = OledbHelper.QueryTable(sql); - return dt; + //return dt; } /// /// SQL查询,参数待有where语句 @@ -134,13 +134,13 @@ /// /// /// - public static DataTable ResultDataTable(out DataTable dt,GSOGlobeControl m_globeControl, string layerName, string whereSql) + public static void ResultDataTable(out DataTable dt,GSOGlobeControl m_globeControl, string layerName, string whereSql) { string sql = "select " + getpipeLineFields.getFields(layerName, m_globeControl) + " from " + layerName + " where " + whereSql; dt = OledbHelper.QueryTable(sql); - return dt; + //return dt; } diff --git a/Cyberpipe.suo b/Cyberpipe.suo index a62aae8..9345628 100644 --- a/Cyberpipe.suo +++ b/Cyberpipe.suo Binary files differ diff --git a/ClassGSOTool.cs b/ClassGSOTool.cs index c62bd08..ee92134 100644 --- a/ClassGSOTool.cs +++ b/ClassGSOTool.cs @@ -87,9 +87,7 @@ for (int j = 0; j < listPipelineLayers.Count; j++) { layer = listPipelineLayers[j]; - - //计算管线附属物 - pointLayer = m_globeControl.Globe.Layers.GetLayerByCaption(layer.Caption + "附属物"); + pointLayer = m_globeControl.Globe.Layers.GetLayerByCaption(layer.Caption + "附属物");//管线附属物计算 GSOFeatures feats = null; if (pointLayer != null) @@ -120,6 +118,9 @@ double lengthTotal = 0.0; double areaMin = 0.0; + areaMin = CalculateMinArea(features, featuresTrue, featurePolygon); + lengthTotal = CalculateLength(features, featuresTrue, featurePolygon); + /* #region 求面积 //获取面中所有对象组成的切割面的长线 GSOFeature polygonFeature = getLineFromGSOFeatures(features, featuresTrue); @@ -145,7 +146,6 @@ } } } - } } #endregion @@ -170,7 +170,6 @@ GSOGeoPolyline3D line = feature.Geometry as GSOGeoPolyline3D; double lineLength = line.GetSpaceLength(false, 6378137); lengthTotal += lineLength; - } else { @@ -187,12 +186,10 @@ GSOGeoPolyline3D lineAnalysis = featureline.Geometry as GSOGeoPolyline3D; double length = lineAnalysis.GetSpaceLength(false, 6378137); lengthTotal += length; - } } } } - } else { @@ -200,6 +197,7 @@ } } #endregion + */ if (areaMin != 0 || lengthTotal != 0) { @@ -219,12 +217,107 @@ row[5] = feats.Length; table.Rows.Add(row); } - } #endregion } } /// + /// 计算侵入面积 + /// + /// + /// + /// + /// + private static double CalculateMinArea(GSOFeatures features, GSOFeatures featuresTrue, GSOFeature featurePolygon) + { + double areaMin = 0; + //获取面中所有对象组成的切割面的长线 + GSOFeature polygonFeature = getLineFromGSOFeatures(features, featuresTrue); + if (polygonFeature != null && polygonFeature.Geometry != null) + { + GSOFeatures polygonFs = new GSOFeatures(); + int polygoRresult = 0; + GSODataEngineUtility.GSLineClipPolygon(polygonFeature, featurePolygon, out polygonFs, out polygoRresult); + ///////////////////////判断面积问题/////////////////////// + if (polygoRresult == 3) + { + areaMin = double.MaxValue; + for (int mm = 0; mm < polygonFs.Length; mm++) + { + GSOFeature featurePolgyon = polygonFs[mm]; + if (featurePolgyon.Geometry.Type == EnumGeometryType.GeoPolygon3D) + { + GSOGeoPolygon3D polygonAnalysis = featurePolgyon.Geometry as GSOGeoPolygon3D; + double areaPolygon = polygonAnalysis.Area; + if (areaPolygon < areaMin) + { + areaMin = areaPolygon; + } + } + } + } + } + return areaMin; + } + /// + /// 计算侵入长度 + /// + /// + /// + /// + /// + private static double CalculateLength(GSOFeatures features, GSOFeatures featuresTrue, GSOFeature featurePolygon) + { + double lengthTotal = 0; + for (int m = 0; m < features.Length; m++) + { + GSOFeature feature = features[m]; + if (feature != null && feature.Geometry != null && feature.Geometry.Type == EnumGeometryType.GeoPolyline3D) + { + bool isFullInPolygon = false; + for (int n = 0; n < featuresTrue.Length; n++) + { + if (feature.ID == featuresTrue[n].ID) + { + isFullInPolygon = true; + break; + } + } + if (isFullInPolygon == true) + { + GSOGeoPolyline3D line = feature.Geometry as GSOGeoPolyline3D; + double lineLength = line.GetSpaceLength(false, 6378137); + lengthTotal += lineLength; + } + else + { + GSOFeatures fs = new GSOFeatures(); + int result = 0; + GSODataEngineUtility.GSPolygonClipLine(feature, featurePolygon, out fs, out result); + if (result == 1) + { + for (int k = 0; k < fs.Length; k++) + { + GSOFeature featureline = fs[k]; + if (featureline != null && featureline.Geometry != null && featureline.Geometry.Type == EnumGeometryType.GeoPolyline3D) + { + GSOGeoPolyline3D lineAnalysis = featureline.Geometry as GSOGeoPolyline3D; + double length = lineAnalysis.GetSpaceLength(false, 6378137); + lengthTotal += length; + } + } + } + } + } + else + { + //MessageBox.Show("没有找到切割面的线对象!"); + } + } + return lengthTotal; + } + + /// /// 去除集合中重复的管线 /// /// diff --git a/ClassSearchAnalysis.cs b/ClassSearchAnalysis.cs index 73b46c2..29875ad 100644 --- a/ClassSearchAnalysis.cs +++ b/ClassSearchAnalysis.cs @@ -22,7 +22,7 @@ /// /// /// - public static DataTable ResultDataTable(out DataTable dt,GSOGlobeControl m_globeControl,string layerName, + public static void ResultDataTable(out DataTable dt,GSOGlobeControl m_globeControl,string layerName, string filedObject,string filedValue) { string sql = ""; @@ -38,7 +38,7 @@ + filedValue + "%'"; } dt = OledbHelper.QueryTable(sql); - return dt; + //return dt; } /// /// SQL语句查询 @@ -51,7 +51,7 @@ /// /// /// - public static DataTable ResultDataTable(out DataTable dt, GSOGlobeControl m_globeControl, string layerName, + public static void ResultDataTable(out DataTable dt, GSOGlobeControl m_globeControl, string layerName, string filedObject,string mathT, string leftFiledValue, string rightFiledValue) { string sql = ""; @@ -67,7 +67,7 @@ + " from " + layerName + " where " + filedObject + mathT + rightFiledValue; } dt = OledbHelper.QueryTable(sql); - return dt; + //return dt; } /// /// SQL查询不重复的值 @@ -76,11 +76,11 @@ /// /// /// - public static DataTable ResultDistinctDataTable(out DataTable dt,string layerName,string filedObject) + public static void ResultDistinctDataTable(out DataTable dt,string layerName,string filedObject) { string sql = "select distinct " + filedObject + " from " + layerName + " order by " + filedObject; dt = OledbHelper.QueryTable(sql); - return dt; + //return dt; } /// /// SQL查询,返回包含NULL的Table @@ -91,7 +91,7 @@ /// /// /// - public static DataTable ResultDataTableContainNull(out DataTable dt,GSOGlobeControl m_globeControl, + public static void ResultDataTableContainNull(out DataTable dt,GSOGlobeControl m_globeControl, string layerName,string filedObject,List filedValueList) { string sql = "select " + getpipeLineFields.getFields(layerName, m_globeControl) @@ -124,7 +124,7 @@ } dt = OledbHelper.QueryTable(sql); - return dt; + //return dt; } /// /// SQL查询,参数待有where语句 @@ -134,13 +134,13 @@ /// /// /// - public static DataTable ResultDataTable(out DataTable dt,GSOGlobeControl m_globeControl, string layerName, string whereSql) + public static void ResultDataTable(out DataTable dt,GSOGlobeControl m_globeControl, string layerName, string whereSql) { string sql = "select " + getpipeLineFields.getFields(layerName, m_globeControl) + " from " + layerName + " where " + whereSql; dt = OledbHelper.QueryTable(sql); - return dt; + //return dt; } diff --git a/Cyberpipe.suo b/Cyberpipe.suo index a62aae8..9345628 100644 --- a/Cyberpipe.suo +++ b/Cyberpipe.suo Binary files differ diff --git a/FrmBasicQuery.cs b/FrmBasicQuery.cs index 7e31256..c9c5a6d 100644 --- a/FrmBasicQuery.cs +++ b/FrmBasicQuery.cs @@ -156,7 +156,7 @@ checkBoxX5.Enabled = true; checkBoxX6.Enabled = true; } - else if (table.Rows[0][strFiled].GetType() == typeof(DateTime)) + else if (table.Rows[0][strFiled].GetType() == typeof(decimal)) { checkBoxX1.Enabled = true; checkBoxX2.Enabled = true; diff --git a/ClassGSOTool.cs b/ClassGSOTool.cs index c62bd08..ee92134 100644 --- a/ClassGSOTool.cs +++ b/ClassGSOTool.cs @@ -87,9 +87,7 @@ for (int j = 0; j < listPipelineLayers.Count; j++) { layer = listPipelineLayers[j]; - - //计算管线附属物 - pointLayer = m_globeControl.Globe.Layers.GetLayerByCaption(layer.Caption + "附属物"); + pointLayer = m_globeControl.Globe.Layers.GetLayerByCaption(layer.Caption + "附属物");//管线附属物计算 GSOFeatures feats = null; if (pointLayer != null) @@ -120,6 +118,9 @@ double lengthTotal = 0.0; double areaMin = 0.0; + areaMin = CalculateMinArea(features, featuresTrue, featurePolygon); + lengthTotal = CalculateLength(features, featuresTrue, featurePolygon); + /* #region 求面积 //获取面中所有对象组成的切割面的长线 GSOFeature polygonFeature = getLineFromGSOFeatures(features, featuresTrue); @@ -145,7 +146,6 @@ } } } - } } #endregion @@ -170,7 +170,6 @@ GSOGeoPolyline3D line = feature.Geometry as GSOGeoPolyline3D; double lineLength = line.GetSpaceLength(false, 6378137); lengthTotal += lineLength; - } else { @@ -187,12 +186,10 @@ GSOGeoPolyline3D lineAnalysis = featureline.Geometry as GSOGeoPolyline3D; double length = lineAnalysis.GetSpaceLength(false, 6378137); lengthTotal += length; - } } } } - } else { @@ -200,6 +197,7 @@ } } #endregion + */ if (areaMin != 0 || lengthTotal != 0) { @@ -219,12 +217,107 @@ row[5] = feats.Length; table.Rows.Add(row); } - } #endregion } } /// + /// 计算侵入面积 + /// + /// + /// + /// + /// + private static double CalculateMinArea(GSOFeatures features, GSOFeatures featuresTrue, GSOFeature featurePolygon) + { + double areaMin = 0; + //获取面中所有对象组成的切割面的长线 + GSOFeature polygonFeature = getLineFromGSOFeatures(features, featuresTrue); + if (polygonFeature != null && polygonFeature.Geometry != null) + { + GSOFeatures polygonFs = new GSOFeatures(); + int polygoRresult = 0; + GSODataEngineUtility.GSLineClipPolygon(polygonFeature, featurePolygon, out polygonFs, out polygoRresult); + ///////////////////////判断面积问题/////////////////////// + if (polygoRresult == 3) + { + areaMin = double.MaxValue; + for (int mm = 0; mm < polygonFs.Length; mm++) + { + GSOFeature featurePolgyon = polygonFs[mm]; + if (featurePolgyon.Geometry.Type == EnumGeometryType.GeoPolygon3D) + { + GSOGeoPolygon3D polygonAnalysis = featurePolgyon.Geometry as GSOGeoPolygon3D; + double areaPolygon = polygonAnalysis.Area; + if (areaPolygon < areaMin) + { + areaMin = areaPolygon; + } + } + } + } + } + return areaMin; + } + /// + /// 计算侵入长度 + /// + /// + /// + /// + /// + private static double CalculateLength(GSOFeatures features, GSOFeatures featuresTrue, GSOFeature featurePolygon) + { + double lengthTotal = 0; + for (int m = 0; m < features.Length; m++) + { + GSOFeature feature = features[m]; + if (feature != null && feature.Geometry != null && feature.Geometry.Type == EnumGeometryType.GeoPolyline3D) + { + bool isFullInPolygon = false; + for (int n = 0; n < featuresTrue.Length; n++) + { + if (feature.ID == featuresTrue[n].ID) + { + isFullInPolygon = true; + break; + } + } + if (isFullInPolygon == true) + { + GSOGeoPolyline3D line = feature.Geometry as GSOGeoPolyline3D; + double lineLength = line.GetSpaceLength(false, 6378137); + lengthTotal += lineLength; + } + else + { + GSOFeatures fs = new GSOFeatures(); + int result = 0; + GSODataEngineUtility.GSPolygonClipLine(feature, featurePolygon, out fs, out result); + if (result == 1) + { + for (int k = 0; k < fs.Length; k++) + { + GSOFeature featureline = fs[k]; + if (featureline != null && featureline.Geometry != null && featureline.Geometry.Type == EnumGeometryType.GeoPolyline3D) + { + GSOGeoPolyline3D lineAnalysis = featureline.Geometry as GSOGeoPolyline3D; + double length = lineAnalysis.GetSpaceLength(false, 6378137); + lengthTotal += length; + } + } + } + } + } + else + { + //MessageBox.Show("没有找到切割面的线对象!"); + } + } + return lengthTotal; + } + + /// /// 去除集合中重复的管线 /// /// diff --git a/ClassSearchAnalysis.cs b/ClassSearchAnalysis.cs index 73b46c2..29875ad 100644 --- a/ClassSearchAnalysis.cs +++ b/ClassSearchAnalysis.cs @@ -22,7 +22,7 @@ /// /// /// - public static DataTable ResultDataTable(out DataTable dt,GSOGlobeControl m_globeControl,string layerName, + public static void ResultDataTable(out DataTable dt,GSOGlobeControl m_globeControl,string layerName, string filedObject,string filedValue) { string sql = ""; @@ -38,7 +38,7 @@ + filedValue + "%'"; } dt = OledbHelper.QueryTable(sql); - return dt; + //return dt; } /// /// SQL语句查询 @@ -51,7 +51,7 @@ /// /// /// - public static DataTable ResultDataTable(out DataTable dt, GSOGlobeControl m_globeControl, string layerName, + public static void ResultDataTable(out DataTable dt, GSOGlobeControl m_globeControl, string layerName, string filedObject,string mathT, string leftFiledValue, string rightFiledValue) { string sql = ""; @@ -67,7 +67,7 @@ + " from " + layerName + " where " + filedObject + mathT + rightFiledValue; } dt = OledbHelper.QueryTable(sql); - return dt; + //return dt; } /// /// SQL查询不重复的值 @@ -76,11 +76,11 @@ /// /// /// - public static DataTable ResultDistinctDataTable(out DataTable dt,string layerName,string filedObject) + public static void ResultDistinctDataTable(out DataTable dt,string layerName,string filedObject) { string sql = "select distinct " + filedObject + " from " + layerName + " order by " + filedObject; dt = OledbHelper.QueryTable(sql); - return dt; + //return dt; } /// /// SQL查询,返回包含NULL的Table @@ -91,7 +91,7 @@ /// /// /// - public static DataTable ResultDataTableContainNull(out DataTable dt,GSOGlobeControl m_globeControl, + public static void ResultDataTableContainNull(out DataTable dt,GSOGlobeControl m_globeControl, string layerName,string filedObject,List filedValueList) { string sql = "select " + getpipeLineFields.getFields(layerName, m_globeControl) @@ -124,7 +124,7 @@ } dt = OledbHelper.QueryTable(sql); - return dt; + //return dt; } /// /// SQL查询,参数待有where语句 @@ -134,13 +134,13 @@ /// /// /// - public static DataTable ResultDataTable(out DataTable dt,GSOGlobeControl m_globeControl, string layerName, string whereSql) + public static void ResultDataTable(out DataTable dt,GSOGlobeControl m_globeControl, string layerName, string whereSql) { string sql = "select " + getpipeLineFields.getFields(layerName, m_globeControl) + " from " + layerName + " where " + whereSql; dt = OledbHelper.QueryTable(sql); - return dt; + //return dt; } diff --git a/Cyberpipe.suo b/Cyberpipe.suo index a62aae8..9345628 100644 --- a/Cyberpipe.suo +++ b/Cyberpipe.suo Binary files differ diff --git a/FrmBasicQuery.cs b/FrmBasicQuery.cs index 7e31256..c9c5a6d 100644 --- a/FrmBasicQuery.cs +++ b/FrmBasicQuery.cs @@ -156,7 +156,7 @@ checkBoxX5.Enabled = true; checkBoxX6.Enabled = true; } - else if (table.Rows[0][strFiled].GetType() == typeof(DateTime)) + else if (table.Rows[0][strFiled].GetType() == typeof(decimal)) { checkBoxX1.Enabled = true; checkBoxX2.Enabled = true; diff --git a/MainFrm.cs b/MainFrm.cs index ada84e9..ac2614d 100644 --- a/MainFrm.cs +++ b/MainFrm.cs @@ -9073,15 +9073,6 @@ globeControl1.Globe.MemoryLayer.AddFeature(gf); } /// - /// 红线审核 - /// - /// - /// - private void buttonItem138_Click_2(object sender, EventArgs e) - { - - } - /// /// 比较两个点是否是同一个点 /// /// @@ -9123,10 +9114,6 @@ double tanABC = Math.Abs(xieLvAB - xieLvBC) / (1 + xieLvAB * xieLvBC); double angle = Math.Atan(tanABC); - //if (angle > Math.PI / 2) //落在外边 - //{ - // length = 0; - //} double lengthAD = lengthAB * Math.Sin(angle); length = Math.Abs(lengthAD); double lengthBD = lengthAB * Math.Cos(angle); diff --git a/ClassGSOTool.cs b/ClassGSOTool.cs index c62bd08..ee92134 100644 --- a/ClassGSOTool.cs +++ b/ClassGSOTool.cs @@ -87,9 +87,7 @@ for (int j = 0; j < listPipelineLayers.Count; j++) { layer = listPipelineLayers[j]; - - //计算管线附属物 - pointLayer = m_globeControl.Globe.Layers.GetLayerByCaption(layer.Caption + "附属物"); + pointLayer = m_globeControl.Globe.Layers.GetLayerByCaption(layer.Caption + "附属物");//管线附属物计算 GSOFeatures feats = null; if (pointLayer != null) @@ -120,6 +118,9 @@ double lengthTotal = 0.0; double areaMin = 0.0; + areaMin = CalculateMinArea(features, featuresTrue, featurePolygon); + lengthTotal = CalculateLength(features, featuresTrue, featurePolygon); + /* #region 求面积 //获取面中所有对象组成的切割面的长线 GSOFeature polygonFeature = getLineFromGSOFeatures(features, featuresTrue); @@ -145,7 +146,6 @@ } } } - } } #endregion @@ -170,7 +170,6 @@ GSOGeoPolyline3D line = feature.Geometry as GSOGeoPolyline3D; double lineLength = line.GetSpaceLength(false, 6378137); lengthTotal += lineLength; - } else { @@ -187,12 +186,10 @@ GSOGeoPolyline3D lineAnalysis = featureline.Geometry as GSOGeoPolyline3D; double length = lineAnalysis.GetSpaceLength(false, 6378137); lengthTotal += length; - } } } } - } else { @@ -200,6 +197,7 @@ } } #endregion + */ if (areaMin != 0 || lengthTotal != 0) { @@ -219,12 +217,107 @@ row[5] = feats.Length; table.Rows.Add(row); } - } #endregion } } /// + /// 计算侵入面积 + /// + /// + /// + /// + /// + private static double CalculateMinArea(GSOFeatures features, GSOFeatures featuresTrue, GSOFeature featurePolygon) + { + double areaMin = 0; + //获取面中所有对象组成的切割面的长线 + GSOFeature polygonFeature = getLineFromGSOFeatures(features, featuresTrue); + if (polygonFeature != null && polygonFeature.Geometry != null) + { + GSOFeatures polygonFs = new GSOFeatures(); + int polygoRresult = 0; + GSODataEngineUtility.GSLineClipPolygon(polygonFeature, featurePolygon, out polygonFs, out polygoRresult); + ///////////////////////判断面积问题/////////////////////// + if (polygoRresult == 3) + { + areaMin = double.MaxValue; + for (int mm = 0; mm < polygonFs.Length; mm++) + { + GSOFeature featurePolgyon = polygonFs[mm]; + if (featurePolgyon.Geometry.Type == EnumGeometryType.GeoPolygon3D) + { + GSOGeoPolygon3D polygonAnalysis = featurePolgyon.Geometry as GSOGeoPolygon3D; + double areaPolygon = polygonAnalysis.Area; + if (areaPolygon < areaMin) + { + areaMin = areaPolygon; + } + } + } + } + } + return areaMin; + } + /// + /// 计算侵入长度 + /// + /// + /// + /// + /// + private static double CalculateLength(GSOFeatures features, GSOFeatures featuresTrue, GSOFeature featurePolygon) + { + double lengthTotal = 0; + for (int m = 0; m < features.Length; m++) + { + GSOFeature feature = features[m]; + if (feature != null && feature.Geometry != null && feature.Geometry.Type == EnumGeometryType.GeoPolyline3D) + { + bool isFullInPolygon = false; + for (int n = 0; n < featuresTrue.Length; n++) + { + if (feature.ID == featuresTrue[n].ID) + { + isFullInPolygon = true; + break; + } + } + if (isFullInPolygon == true) + { + GSOGeoPolyline3D line = feature.Geometry as GSOGeoPolyline3D; + double lineLength = line.GetSpaceLength(false, 6378137); + lengthTotal += lineLength; + } + else + { + GSOFeatures fs = new GSOFeatures(); + int result = 0; + GSODataEngineUtility.GSPolygonClipLine(feature, featurePolygon, out fs, out result); + if (result == 1) + { + for (int k = 0; k < fs.Length; k++) + { + GSOFeature featureline = fs[k]; + if (featureline != null && featureline.Geometry != null && featureline.Geometry.Type == EnumGeometryType.GeoPolyline3D) + { + GSOGeoPolyline3D lineAnalysis = featureline.Geometry as GSOGeoPolyline3D; + double length = lineAnalysis.GetSpaceLength(false, 6378137); + lengthTotal += length; + } + } + } + } + } + else + { + //MessageBox.Show("没有找到切割面的线对象!"); + } + } + return lengthTotal; + } + + /// /// 去除集合中重复的管线 /// /// diff --git a/ClassSearchAnalysis.cs b/ClassSearchAnalysis.cs index 73b46c2..29875ad 100644 --- a/ClassSearchAnalysis.cs +++ b/ClassSearchAnalysis.cs @@ -22,7 +22,7 @@ /// /// /// - public static DataTable ResultDataTable(out DataTable dt,GSOGlobeControl m_globeControl,string layerName, + public static void ResultDataTable(out DataTable dt,GSOGlobeControl m_globeControl,string layerName, string filedObject,string filedValue) { string sql = ""; @@ -38,7 +38,7 @@ + filedValue + "%'"; } dt = OledbHelper.QueryTable(sql); - return dt; + //return dt; } /// /// SQL语句查询 @@ -51,7 +51,7 @@ /// /// /// - public static DataTable ResultDataTable(out DataTable dt, GSOGlobeControl m_globeControl, string layerName, + public static void ResultDataTable(out DataTable dt, GSOGlobeControl m_globeControl, string layerName, string filedObject,string mathT, string leftFiledValue, string rightFiledValue) { string sql = ""; @@ -67,7 +67,7 @@ + " from " + layerName + " where " + filedObject + mathT + rightFiledValue; } dt = OledbHelper.QueryTable(sql); - return dt; + //return dt; } /// /// SQL查询不重复的值 @@ -76,11 +76,11 @@ /// /// /// - public static DataTable ResultDistinctDataTable(out DataTable dt,string layerName,string filedObject) + public static void ResultDistinctDataTable(out DataTable dt,string layerName,string filedObject) { string sql = "select distinct " + filedObject + " from " + layerName + " order by " + filedObject; dt = OledbHelper.QueryTable(sql); - return dt; + //return dt; } /// /// SQL查询,返回包含NULL的Table @@ -91,7 +91,7 @@ /// /// /// - public static DataTable ResultDataTableContainNull(out DataTable dt,GSOGlobeControl m_globeControl, + public static void ResultDataTableContainNull(out DataTable dt,GSOGlobeControl m_globeControl, string layerName,string filedObject,List filedValueList) { string sql = "select " + getpipeLineFields.getFields(layerName, m_globeControl) @@ -124,7 +124,7 @@ } dt = OledbHelper.QueryTable(sql); - return dt; + //return dt; } /// /// SQL查询,参数待有where语句 @@ -134,13 +134,13 @@ /// /// /// - public static DataTable ResultDataTable(out DataTable dt,GSOGlobeControl m_globeControl, string layerName, string whereSql) + public static void ResultDataTable(out DataTable dt,GSOGlobeControl m_globeControl, string layerName, string whereSql) { string sql = "select " + getpipeLineFields.getFields(layerName, m_globeControl) + " from " + layerName + " where " + whereSql; dt = OledbHelper.QueryTable(sql); - return dt; + //return dt; } diff --git a/Cyberpipe.suo b/Cyberpipe.suo index a62aae8..9345628 100644 --- a/Cyberpipe.suo +++ b/Cyberpipe.suo Binary files differ diff --git a/FrmBasicQuery.cs b/FrmBasicQuery.cs index 7e31256..c9c5a6d 100644 --- a/FrmBasicQuery.cs +++ b/FrmBasicQuery.cs @@ -156,7 +156,7 @@ checkBoxX5.Enabled = true; checkBoxX6.Enabled = true; } - else if (table.Rows[0][strFiled].GetType() == typeof(DateTime)) + else if (table.Rows[0][strFiled].GetType() == typeof(decimal)) { checkBoxX1.Enabled = true; checkBoxX2.Enabled = true; diff --git a/MainFrm.cs b/MainFrm.cs index ada84e9..ac2614d 100644 --- a/MainFrm.cs +++ b/MainFrm.cs @@ -9073,15 +9073,6 @@ globeControl1.Globe.MemoryLayer.AddFeature(gf); } /// - /// 红线审核 - /// - /// - /// - private void buttonItem138_Click_2(object sender, EventArgs e) - { - - } - /// /// 比较两个点是否是同一个点 /// /// @@ -9123,10 +9114,6 @@ double tanABC = Math.Abs(xieLvAB - xieLvBC) / (1 + xieLvAB * xieLvBC); double angle = Math.Atan(tanABC); - //if (angle > Math.PI / 2) //落在外边 - //{ - // length = 0; - //} double lengthAD = lengthAB * Math.Sin(angle); length = Math.Abs(lengthAD); double lengthBD = lengthAB * Math.Cos(angle); diff --git a/bin/x86/Debug/Config.xml b/bin/x86/Debug/Config.xml index a5a72aa..331685a 100644 --- a/bin/x86/Debug/Config.xml +++ b/bin/x86/Debug/Config.xml @@ -1,11 +1,11 @@  LocaSpace三维地下管线信息系统 - release - SZHTDB2 - 192.168.0.203 - release - 192.168.0.203 + scott + SZDB + 127.0.0.1 + SZDB + 127.0.0.1 1500 http://192.168.0.203/images/ http://192.168.0.203/images/default.jpg diff --git a/ClassGSOTool.cs b/ClassGSOTool.cs index c62bd08..ee92134 100644 --- a/ClassGSOTool.cs +++ b/ClassGSOTool.cs @@ -87,9 +87,7 @@ for (int j = 0; j < listPipelineLayers.Count; j++) { layer = listPipelineLayers[j]; - - //计算管线附属物 - pointLayer = m_globeControl.Globe.Layers.GetLayerByCaption(layer.Caption + "附属物"); + pointLayer = m_globeControl.Globe.Layers.GetLayerByCaption(layer.Caption + "附属物");//管线附属物计算 GSOFeatures feats = null; if (pointLayer != null) @@ -120,6 +118,9 @@ double lengthTotal = 0.0; double areaMin = 0.0; + areaMin = CalculateMinArea(features, featuresTrue, featurePolygon); + lengthTotal = CalculateLength(features, featuresTrue, featurePolygon); + /* #region 求面积 //获取面中所有对象组成的切割面的长线 GSOFeature polygonFeature = getLineFromGSOFeatures(features, featuresTrue); @@ -145,7 +146,6 @@ } } } - } } #endregion @@ -170,7 +170,6 @@ GSOGeoPolyline3D line = feature.Geometry as GSOGeoPolyline3D; double lineLength = line.GetSpaceLength(false, 6378137); lengthTotal += lineLength; - } else { @@ -187,12 +186,10 @@ GSOGeoPolyline3D lineAnalysis = featureline.Geometry as GSOGeoPolyline3D; double length = lineAnalysis.GetSpaceLength(false, 6378137); lengthTotal += length; - } } } } - } else { @@ -200,6 +197,7 @@ } } #endregion + */ if (areaMin != 0 || lengthTotal != 0) { @@ -219,12 +217,107 @@ row[5] = feats.Length; table.Rows.Add(row); } - } #endregion } } /// + /// 计算侵入面积 + /// + /// + /// + /// + /// + private static double CalculateMinArea(GSOFeatures features, GSOFeatures featuresTrue, GSOFeature featurePolygon) + { + double areaMin = 0; + //获取面中所有对象组成的切割面的长线 + GSOFeature polygonFeature = getLineFromGSOFeatures(features, featuresTrue); + if (polygonFeature != null && polygonFeature.Geometry != null) + { + GSOFeatures polygonFs = new GSOFeatures(); + int polygoRresult = 0; + GSODataEngineUtility.GSLineClipPolygon(polygonFeature, featurePolygon, out polygonFs, out polygoRresult); + ///////////////////////判断面积问题/////////////////////// + if (polygoRresult == 3) + { + areaMin = double.MaxValue; + for (int mm = 0; mm < polygonFs.Length; mm++) + { + GSOFeature featurePolgyon = polygonFs[mm]; + if (featurePolgyon.Geometry.Type == EnumGeometryType.GeoPolygon3D) + { + GSOGeoPolygon3D polygonAnalysis = featurePolgyon.Geometry as GSOGeoPolygon3D; + double areaPolygon = polygonAnalysis.Area; + if (areaPolygon < areaMin) + { + areaMin = areaPolygon; + } + } + } + } + } + return areaMin; + } + /// + /// 计算侵入长度 + /// + /// + /// + /// + /// + private static double CalculateLength(GSOFeatures features, GSOFeatures featuresTrue, GSOFeature featurePolygon) + { + double lengthTotal = 0; + for (int m = 0; m < features.Length; m++) + { + GSOFeature feature = features[m]; + if (feature != null && feature.Geometry != null && feature.Geometry.Type == EnumGeometryType.GeoPolyline3D) + { + bool isFullInPolygon = false; + for (int n = 0; n < featuresTrue.Length; n++) + { + if (feature.ID == featuresTrue[n].ID) + { + isFullInPolygon = true; + break; + } + } + if (isFullInPolygon == true) + { + GSOGeoPolyline3D line = feature.Geometry as GSOGeoPolyline3D; + double lineLength = line.GetSpaceLength(false, 6378137); + lengthTotal += lineLength; + } + else + { + GSOFeatures fs = new GSOFeatures(); + int result = 0; + GSODataEngineUtility.GSPolygonClipLine(feature, featurePolygon, out fs, out result); + if (result == 1) + { + for (int k = 0; k < fs.Length; k++) + { + GSOFeature featureline = fs[k]; + if (featureline != null && featureline.Geometry != null && featureline.Geometry.Type == EnumGeometryType.GeoPolyline3D) + { + GSOGeoPolyline3D lineAnalysis = featureline.Geometry as GSOGeoPolyline3D; + double length = lineAnalysis.GetSpaceLength(false, 6378137); + lengthTotal += length; + } + } + } + } + } + else + { + //MessageBox.Show("没有找到切割面的线对象!"); + } + } + return lengthTotal; + } + + /// /// 去除集合中重复的管线 /// /// diff --git a/ClassSearchAnalysis.cs b/ClassSearchAnalysis.cs index 73b46c2..29875ad 100644 --- a/ClassSearchAnalysis.cs +++ b/ClassSearchAnalysis.cs @@ -22,7 +22,7 @@ /// /// /// - public static DataTable ResultDataTable(out DataTable dt,GSOGlobeControl m_globeControl,string layerName, + public static void ResultDataTable(out DataTable dt,GSOGlobeControl m_globeControl,string layerName, string filedObject,string filedValue) { string sql = ""; @@ -38,7 +38,7 @@ + filedValue + "%'"; } dt = OledbHelper.QueryTable(sql); - return dt; + //return dt; } /// /// SQL语句查询 @@ -51,7 +51,7 @@ /// /// /// - public static DataTable ResultDataTable(out DataTable dt, GSOGlobeControl m_globeControl, string layerName, + public static void ResultDataTable(out DataTable dt, GSOGlobeControl m_globeControl, string layerName, string filedObject,string mathT, string leftFiledValue, string rightFiledValue) { string sql = ""; @@ -67,7 +67,7 @@ + " from " + layerName + " where " + filedObject + mathT + rightFiledValue; } dt = OledbHelper.QueryTable(sql); - return dt; + //return dt; } /// /// SQL查询不重复的值 @@ -76,11 +76,11 @@ /// /// /// - public static DataTable ResultDistinctDataTable(out DataTable dt,string layerName,string filedObject) + public static void ResultDistinctDataTable(out DataTable dt,string layerName,string filedObject) { string sql = "select distinct " + filedObject + " from " + layerName + " order by " + filedObject; dt = OledbHelper.QueryTable(sql); - return dt; + //return dt; } /// /// SQL查询,返回包含NULL的Table @@ -91,7 +91,7 @@ /// /// /// - public static DataTable ResultDataTableContainNull(out DataTable dt,GSOGlobeControl m_globeControl, + public static void ResultDataTableContainNull(out DataTable dt,GSOGlobeControl m_globeControl, string layerName,string filedObject,List filedValueList) { string sql = "select " + getpipeLineFields.getFields(layerName, m_globeControl) @@ -124,7 +124,7 @@ } dt = OledbHelper.QueryTable(sql); - return dt; + //return dt; } /// /// SQL查询,参数待有where语句 @@ -134,13 +134,13 @@ /// /// /// - public static DataTable ResultDataTable(out DataTable dt,GSOGlobeControl m_globeControl, string layerName, string whereSql) + public static void ResultDataTable(out DataTable dt,GSOGlobeControl m_globeControl, string layerName, string whereSql) { string sql = "select " + getpipeLineFields.getFields(layerName, m_globeControl) + " from " + layerName + " where " + whereSql; dt = OledbHelper.QueryTable(sql); - return dt; + //return dt; } diff --git a/Cyberpipe.suo b/Cyberpipe.suo index a62aae8..9345628 100644 --- a/Cyberpipe.suo +++ b/Cyberpipe.suo Binary files differ diff --git a/FrmBasicQuery.cs b/FrmBasicQuery.cs index 7e31256..c9c5a6d 100644 --- a/FrmBasicQuery.cs +++ b/FrmBasicQuery.cs @@ -156,7 +156,7 @@ checkBoxX5.Enabled = true; checkBoxX6.Enabled = true; } - else if (table.Rows[0][strFiled].GetType() == typeof(DateTime)) + else if (table.Rows[0][strFiled].GetType() == typeof(decimal)) { checkBoxX1.Enabled = true; checkBoxX2.Enabled = true; diff --git a/MainFrm.cs b/MainFrm.cs index ada84e9..ac2614d 100644 --- a/MainFrm.cs +++ b/MainFrm.cs @@ -9073,15 +9073,6 @@ globeControl1.Globe.MemoryLayer.AddFeature(gf); } /// - /// 红线审核 - /// - /// - /// - private void buttonItem138_Click_2(object sender, EventArgs e) - { - - } - /// /// 比较两个点是否是同一个点 /// /// @@ -9123,10 +9114,6 @@ double tanABC = Math.Abs(xieLvAB - xieLvBC) / (1 + xieLvAB * xieLvBC); double angle = Math.Atan(tanABC); - //if (angle > Math.PI / 2) //落在外边 - //{ - // length = 0; - //} double lengthAD = lengthAB * Math.Sin(angle); length = Math.Abs(lengthAD); double lengthBD = lengthAB * Math.Cos(angle); diff --git a/bin/x86/Debug/Config.xml b/bin/x86/Debug/Config.xml index a5a72aa..331685a 100644 --- a/bin/x86/Debug/Config.xml +++ b/bin/x86/Debug/Config.xml @@ -1,11 +1,11 @@  LocaSpace三维地下管线信息系统 - release - SZHTDB2 - 192.168.0.203 - release - 192.168.0.203 + scott + SZDB + 127.0.0.1 + SZDB + 127.0.0.1 1500 http://192.168.0.203/images/ http://192.168.0.203/images/default.jpg diff --git a/bin/x86/Debug/Cyberpipe.exe b/bin/x86/Debug/Cyberpipe.exe index b204971..f3f5a5c 100644 --- a/bin/x86/Debug/Cyberpipe.exe +++ b/bin/x86/Debug/Cyberpipe.exe Binary files differ diff --git a/ClassGSOTool.cs b/ClassGSOTool.cs index c62bd08..ee92134 100644 --- a/ClassGSOTool.cs +++ b/ClassGSOTool.cs @@ -87,9 +87,7 @@ for (int j = 0; j < listPipelineLayers.Count; j++) { layer = listPipelineLayers[j]; - - //计算管线附属物 - pointLayer = m_globeControl.Globe.Layers.GetLayerByCaption(layer.Caption + "附属物"); + pointLayer = m_globeControl.Globe.Layers.GetLayerByCaption(layer.Caption + "附属物");//管线附属物计算 GSOFeatures feats = null; if (pointLayer != null) @@ -120,6 +118,9 @@ double lengthTotal = 0.0; double areaMin = 0.0; + areaMin = CalculateMinArea(features, featuresTrue, featurePolygon); + lengthTotal = CalculateLength(features, featuresTrue, featurePolygon); + /* #region 求面积 //获取面中所有对象组成的切割面的长线 GSOFeature polygonFeature = getLineFromGSOFeatures(features, featuresTrue); @@ -145,7 +146,6 @@ } } } - } } #endregion @@ -170,7 +170,6 @@ GSOGeoPolyline3D line = feature.Geometry as GSOGeoPolyline3D; double lineLength = line.GetSpaceLength(false, 6378137); lengthTotal += lineLength; - } else { @@ -187,12 +186,10 @@ GSOGeoPolyline3D lineAnalysis = featureline.Geometry as GSOGeoPolyline3D; double length = lineAnalysis.GetSpaceLength(false, 6378137); lengthTotal += length; - } } } } - } else { @@ -200,6 +197,7 @@ } } #endregion + */ if (areaMin != 0 || lengthTotal != 0) { @@ -219,12 +217,107 @@ row[5] = feats.Length; table.Rows.Add(row); } - } #endregion } } /// + /// 计算侵入面积 + /// + /// + /// + /// + /// + private static double CalculateMinArea(GSOFeatures features, GSOFeatures featuresTrue, GSOFeature featurePolygon) + { + double areaMin = 0; + //获取面中所有对象组成的切割面的长线 + GSOFeature polygonFeature = getLineFromGSOFeatures(features, featuresTrue); + if (polygonFeature != null && polygonFeature.Geometry != null) + { + GSOFeatures polygonFs = new GSOFeatures(); + int polygoRresult = 0; + GSODataEngineUtility.GSLineClipPolygon(polygonFeature, featurePolygon, out polygonFs, out polygoRresult); + ///////////////////////判断面积问题/////////////////////// + if (polygoRresult == 3) + { + areaMin = double.MaxValue; + for (int mm = 0; mm < polygonFs.Length; mm++) + { + GSOFeature featurePolgyon = polygonFs[mm]; + if (featurePolgyon.Geometry.Type == EnumGeometryType.GeoPolygon3D) + { + GSOGeoPolygon3D polygonAnalysis = featurePolgyon.Geometry as GSOGeoPolygon3D; + double areaPolygon = polygonAnalysis.Area; + if (areaPolygon < areaMin) + { + areaMin = areaPolygon; + } + } + } + } + } + return areaMin; + } + /// + /// 计算侵入长度 + /// + /// + /// + /// + /// + private static double CalculateLength(GSOFeatures features, GSOFeatures featuresTrue, GSOFeature featurePolygon) + { + double lengthTotal = 0; + for (int m = 0; m < features.Length; m++) + { + GSOFeature feature = features[m]; + if (feature != null && feature.Geometry != null && feature.Geometry.Type == EnumGeometryType.GeoPolyline3D) + { + bool isFullInPolygon = false; + for (int n = 0; n < featuresTrue.Length; n++) + { + if (feature.ID == featuresTrue[n].ID) + { + isFullInPolygon = true; + break; + } + } + if (isFullInPolygon == true) + { + GSOGeoPolyline3D line = feature.Geometry as GSOGeoPolyline3D; + double lineLength = line.GetSpaceLength(false, 6378137); + lengthTotal += lineLength; + } + else + { + GSOFeatures fs = new GSOFeatures(); + int result = 0; + GSODataEngineUtility.GSPolygonClipLine(feature, featurePolygon, out fs, out result); + if (result == 1) + { + for (int k = 0; k < fs.Length; k++) + { + GSOFeature featureline = fs[k]; + if (featureline != null && featureline.Geometry != null && featureline.Geometry.Type == EnumGeometryType.GeoPolyline3D) + { + GSOGeoPolyline3D lineAnalysis = featureline.Geometry as GSOGeoPolyline3D; + double length = lineAnalysis.GetSpaceLength(false, 6378137); + lengthTotal += length; + } + } + } + } + } + else + { + //MessageBox.Show("没有找到切割面的线对象!"); + } + } + return lengthTotal; + } + + /// /// 去除集合中重复的管线 /// /// diff --git a/ClassSearchAnalysis.cs b/ClassSearchAnalysis.cs index 73b46c2..29875ad 100644 --- a/ClassSearchAnalysis.cs +++ b/ClassSearchAnalysis.cs @@ -22,7 +22,7 @@ /// /// /// - public static DataTable ResultDataTable(out DataTable dt,GSOGlobeControl m_globeControl,string layerName, + public static void ResultDataTable(out DataTable dt,GSOGlobeControl m_globeControl,string layerName, string filedObject,string filedValue) { string sql = ""; @@ -38,7 +38,7 @@ + filedValue + "%'"; } dt = OledbHelper.QueryTable(sql); - return dt; + //return dt; } /// /// SQL语句查询 @@ -51,7 +51,7 @@ /// /// /// - public static DataTable ResultDataTable(out DataTable dt, GSOGlobeControl m_globeControl, string layerName, + public static void ResultDataTable(out DataTable dt, GSOGlobeControl m_globeControl, string layerName, string filedObject,string mathT, string leftFiledValue, string rightFiledValue) { string sql = ""; @@ -67,7 +67,7 @@ + " from " + layerName + " where " + filedObject + mathT + rightFiledValue; } dt = OledbHelper.QueryTable(sql); - return dt; + //return dt; } /// /// SQL查询不重复的值 @@ -76,11 +76,11 @@ /// /// /// - public static DataTable ResultDistinctDataTable(out DataTable dt,string layerName,string filedObject) + public static void ResultDistinctDataTable(out DataTable dt,string layerName,string filedObject) { string sql = "select distinct " + filedObject + " from " + layerName + " order by " + filedObject; dt = OledbHelper.QueryTable(sql); - return dt; + //return dt; } /// /// SQL查询,返回包含NULL的Table @@ -91,7 +91,7 @@ /// /// /// - public static DataTable ResultDataTableContainNull(out DataTable dt,GSOGlobeControl m_globeControl, + public static void ResultDataTableContainNull(out DataTable dt,GSOGlobeControl m_globeControl, string layerName,string filedObject,List filedValueList) { string sql = "select " + getpipeLineFields.getFields(layerName, m_globeControl) @@ -124,7 +124,7 @@ } dt = OledbHelper.QueryTable(sql); - return dt; + //return dt; } /// /// SQL查询,参数待有where语句 @@ -134,13 +134,13 @@ /// /// /// - public static DataTable ResultDataTable(out DataTable dt,GSOGlobeControl m_globeControl, string layerName, string whereSql) + public static void ResultDataTable(out DataTable dt,GSOGlobeControl m_globeControl, string layerName, string whereSql) { string sql = "select " + getpipeLineFields.getFields(layerName, m_globeControl) + " from " + layerName + " where " + whereSql; dt = OledbHelper.QueryTable(sql); - return dt; + //return dt; } diff --git a/Cyberpipe.suo b/Cyberpipe.suo index a62aae8..9345628 100644 --- a/Cyberpipe.suo +++ b/Cyberpipe.suo Binary files differ diff --git a/FrmBasicQuery.cs b/FrmBasicQuery.cs index 7e31256..c9c5a6d 100644 --- a/FrmBasicQuery.cs +++ b/FrmBasicQuery.cs @@ -156,7 +156,7 @@ checkBoxX5.Enabled = true; checkBoxX6.Enabled = true; } - else if (table.Rows[0][strFiled].GetType() == typeof(DateTime)) + else if (table.Rows[0][strFiled].GetType() == typeof(decimal)) { checkBoxX1.Enabled = true; checkBoxX2.Enabled = true; diff --git a/MainFrm.cs b/MainFrm.cs index ada84e9..ac2614d 100644 --- a/MainFrm.cs +++ b/MainFrm.cs @@ -9073,15 +9073,6 @@ globeControl1.Globe.MemoryLayer.AddFeature(gf); } /// - /// 红线审核 - /// - /// - /// - private void buttonItem138_Click_2(object sender, EventArgs e) - { - - } - /// /// 比较两个点是否是同一个点 /// /// @@ -9123,10 +9114,6 @@ double tanABC = Math.Abs(xieLvAB - xieLvBC) / (1 + xieLvAB * xieLvBC); double angle = Math.Atan(tanABC); - //if (angle > Math.PI / 2) //落在外边 - //{ - // length = 0; - //} double lengthAD = lengthAB * Math.Sin(angle); length = Math.Abs(lengthAD); double lengthBD = lengthAB * Math.Cos(angle); diff --git a/bin/x86/Debug/Config.xml b/bin/x86/Debug/Config.xml index a5a72aa..331685a 100644 --- a/bin/x86/Debug/Config.xml +++ b/bin/x86/Debug/Config.xml @@ -1,11 +1,11 @@  LocaSpace三维地下管线信息系统 - release - SZHTDB2 - 192.168.0.203 - release - 192.168.0.203 + scott + SZDB + 127.0.0.1 + SZDB + 127.0.0.1 1500 http://192.168.0.203/images/ http://192.168.0.203/images/default.jpg diff --git a/bin/x86/Debug/Cyberpipe.exe b/bin/x86/Debug/Cyberpipe.exe index b204971..f3f5a5c 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 c3bc888..2cd6699 100644 --- a/bin/x86/Debug/Cyberpipe.pdb +++ b/bin/x86/Debug/Cyberpipe.pdb Binary files differ diff --git a/ClassGSOTool.cs b/ClassGSOTool.cs index c62bd08..ee92134 100644 --- a/ClassGSOTool.cs +++ b/ClassGSOTool.cs @@ -87,9 +87,7 @@ for (int j = 0; j < listPipelineLayers.Count; j++) { layer = listPipelineLayers[j]; - - //计算管线附属物 - pointLayer = m_globeControl.Globe.Layers.GetLayerByCaption(layer.Caption + "附属物"); + pointLayer = m_globeControl.Globe.Layers.GetLayerByCaption(layer.Caption + "附属物");//管线附属物计算 GSOFeatures feats = null; if (pointLayer != null) @@ -120,6 +118,9 @@ double lengthTotal = 0.0; double areaMin = 0.0; + areaMin = CalculateMinArea(features, featuresTrue, featurePolygon); + lengthTotal = CalculateLength(features, featuresTrue, featurePolygon); + /* #region 求面积 //获取面中所有对象组成的切割面的长线 GSOFeature polygonFeature = getLineFromGSOFeatures(features, featuresTrue); @@ -145,7 +146,6 @@ } } } - } } #endregion @@ -170,7 +170,6 @@ GSOGeoPolyline3D line = feature.Geometry as GSOGeoPolyline3D; double lineLength = line.GetSpaceLength(false, 6378137); lengthTotal += lineLength; - } else { @@ -187,12 +186,10 @@ GSOGeoPolyline3D lineAnalysis = featureline.Geometry as GSOGeoPolyline3D; double length = lineAnalysis.GetSpaceLength(false, 6378137); lengthTotal += length; - } } } } - } else { @@ -200,6 +197,7 @@ } } #endregion + */ if (areaMin != 0 || lengthTotal != 0) { @@ -219,12 +217,107 @@ row[5] = feats.Length; table.Rows.Add(row); } - } #endregion } } /// + /// 计算侵入面积 + /// + /// + /// + /// + /// + private static double CalculateMinArea(GSOFeatures features, GSOFeatures featuresTrue, GSOFeature featurePolygon) + { + double areaMin = 0; + //获取面中所有对象组成的切割面的长线 + GSOFeature polygonFeature = getLineFromGSOFeatures(features, featuresTrue); + if (polygonFeature != null && polygonFeature.Geometry != null) + { + GSOFeatures polygonFs = new GSOFeatures(); + int polygoRresult = 0; + GSODataEngineUtility.GSLineClipPolygon(polygonFeature, featurePolygon, out polygonFs, out polygoRresult); + ///////////////////////判断面积问题/////////////////////// + if (polygoRresult == 3) + { + areaMin = double.MaxValue; + for (int mm = 0; mm < polygonFs.Length; mm++) + { + GSOFeature featurePolgyon = polygonFs[mm]; + if (featurePolgyon.Geometry.Type == EnumGeometryType.GeoPolygon3D) + { + GSOGeoPolygon3D polygonAnalysis = featurePolgyon.Geometry as GSOGeoPolygon3D; + double areaPolygon = polygonAnalysis.Area; + if (areaPolygon < areaMin) + { + areaMin = areaPolygon; + } + } + } + } + } + return areaMin; + } + /// + /// 计算侵入长度 + /// + /// + /// + /// + /// + private static double CalculateLength(GSOFeatures features, GSOFeatures featuresTrue, GSOFeature featurePolygon) + { + double lengthTotal = 0; + for (int m = 0; m < features.Length; m++) + { + GSOFeature feature = features[m]; + if (feature != null && feature.Geometry != null && feature.Geometry.Type == EnumGeometryType.GeoPolyline3D) + { + bool isFullInPolygon = false; + for (int n = 0; n < featuresTrue.Length; n++) + { + if (feature.ID == featuresTrue[n].ID) + { + isFullInPolygon = true; + break; + } + } + if (isFullInPolygon == true) + { + GSOGeoPolyline3D line = feature.Geometry as GSOGeoPolyline3D; + double lineLength = line.GetSpaceLength(false, 6378137); + lengthTotal += lineLength; + } + else + { + GSOFeatures fs = new GSOFeatures(); + int result = 0; + GSODataEngineUtility.GSPolygonClipLine(feature, featurePolygon, out fs, out result); + if (result == 1) + { + for (int k = 0; k < fs.Length; k++) + { + GSOFeature featureline = fs[k]; + if (featureline != null && featureline.Geometry != null && featureline.Geometry.Type == EnumGeometryType.GeoPolyline3D) + { + GSOGeoPolyline3D lineAnalysis = featureline.Geometry as GSOGeoPolyline3D; + double length = lineAnalysis.GetSpaceLength(false, 6378137); + lengthTotal += length; + } + } + } + } + } + else + { + //MessageBox.Show("没有找到切割面的线对象!"); + } + } + return lengthTotal; + } + + /// /// 去除集合中重复的管线 /// /// diff --git a/ClassSearchAnalysis.cs b/ClassSearchAnalysis.cs index 73b46c2..29875ad 100644 --- a/ClassSearchAnalysis.cs +++ b/ClassSearchAnalysis.cs @@ -22,7 +22,7 @@ /// /// /// - public static DataTable ResultDataTable(out DataTable dt,GSOGlobeControl m_globeControl,string layerName, + public static void ResultDataTable(out DataTable dt,GSOGlobeControl m_globeControl,string layerName, string filedObject,string filedValue) { string sql = ""; @@ -38,7 +38,7 @@ + filedValue + "%'"; } dt = OledbHelper.QueryTable(sql); - return dt; + //return dt; } /// /// SQL语句查询 @@ -51,7 +51,7 @@ /// /// /// - public static DataTable ResultDataTable(out DataTable dt, GSOGlobeControl m_globeControl, string layerName, + public static void ResultDataTable(out DataTable dt, GSOGlobeControl m_globeControl, string layerName, string filedObject,string mathT, string leftFiledValue, string rightFiledValue) { string sql = ""; @@ -67,7 +67,7 @@ + " from " + layerName + " where " + filedObject + mathT + rightFiledValue; } dt = OledbHelper.QueryTable(sql); - return dt; + //return dt; } /// /// SQL查询不重复的值 @@ -76,11 +76,11 @@ /// /// /// - public static DataTable ResultDistinctDataTable(out DataTable dt,string layerName,string filedObject) + public static void ResultDistinctDataTable(out DataTable dt,string layerName,string filedObject) { string sql = "select distinct " + filedObject + " from " + layerName + " order by " + filedObject; dt = OledbHelper.QueryTable(sql); - return dt; + //return dt; } /// /// SQL查询,返回包含NULL的Table @@ -91,7 +91,7 @@ /// /// /// - public static DataTable ResultDataTableContainNull(out DataTable dt,GSOGlobeControl m_globeControl, + public static void ResultDataTableContainNull(out DataTable dt,GSOGlobeControl m_globeControl, string layerName,string filedObject,List filedValueList) { string sql = "select " + getpipeLineFields.getFields(layerName, m_globeControl) @@ -124,7 +124,7 @@ } dt = OledbHelper.QueryTable(sql); - return dt; + //return dt; } /// /// SQL查询,参数待有where语句 @@ -134,13 +134,13 @@ /// /// /// - public static DataTable ResultDataTable(out DataTable dt,GSOGlobeControl m_globeControl, string layerName, string whereSql) + public static void ResultDataTable(out DataTable dt,GSOGlobeControl m_globeControl, string layerName, string whereSql) { string sql = "select " + getpipeLineFields.getFields(layerName, m_globeControl) + " from " + layerName + " where " + whereSql; dt = OledbHelper.QueryTable(sql); - return dt; + //return dt; } diff --git a/Cyberpipe.suo b/Cyberpipe.suo index a62aae8..9345628 100644 --- a/Cyberpipe.suo +++ b/Cyberpipe.suo Binary files differ diff --git a/FrmBasicQuery.cs b/FrmBasicQuery.cs index 7e31256..c9c5a6d 100644 --- a/FrmBasicQuery.cs +++ b/FrmBasicQuery.cs @@ -156,7 +156,7 @@ checkBoxX5.Enabled = true; checkBoxX6.Enabled = true; } - else if (table.Rows[0][strFiled].GetType() == typeof(DateTime)) + else if (table.Rows[0][strFiled].GetType() == typeof(decimal)) { checkBoxX1.Enabled = true; checkBoxX2.Enabled = true; diff --git a/MainFrm.cs b/MainFrm.cs index ada84e9..ac2614d 100644 --- a/MainFrm.cs +++ b/MainFrm.cs @@ -9073,15 +9073,6 @@ globeControl1.Globe.MemoryLayer.AddFeature(gf); } /// - /// 红线审核 - /// - /// - /// - private void buttonItem138_Click_2(object sender, EventArgs e) - { - - } - /// /// 比较两个点是否是同一个点 /// /// @@ -9123,10 +9114,6 @@ double tanABC = Math.Abs(xieLvAB - xieLvBC) / (1 + xieLvAB * xieLvBC); double angle = Math.Atan(tanABC); - //if (angle > Math.PI / 2) //落在外边 - //{ - // length = 0; - //} double lengthAD = lengthAB * Math.Sin(angle); length = Math.Abs(lengthAD); double lengthBD = lengthAB * Math.Cos(angle); diff --git a/bin/x86/Debug/Config.xml b/bin/x86/Debug/Config.xml index a5a72aa..331685a 100644 --- a/bin/x86/Debug/Config.xml +++ b/bin/x86/Debug/Config.xml @@ -1,11 +1,11 @@  LocaSpace三维地下管线信息系统 - release - SZHTDB2 - 192.168.0.203 - release - 192.168.0.203 + scott + SZDB + 127.0.0.1 + SZDB + 127.0.0.1 1500 http://192.168.0.203/images/ http://192.168.0.203/images/default.jpg diff --git a/bin/x86/Debug/Cyberpipe.exe b/bin/x86/Debug/Cyberpipe.exe index b204971..f3f5a5c 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 c3bc888..2cd6699 100644 --- a/bin/x86/Debug/Cyberpipe.pdb +++ b/bin/x86/Debug/Cyberpipe.pdb Binary files differ diff --git a/obj/x64/Debug/Cyberpipe.exe b/obj/x64/Debug/Cyberpipe.exe index b204971..f3f5a5c 100644 --- a/obj/x64/Debug/Cyberpipe.exe +++ b/obj/x64/Debug/Cyberpipe.exe Binary files differ diff --git a/ClassGSOTool.cs b/ClassGSOTool.cs index c62bd08..ee92134 100644 --- a/ClassGSOTool.cs +++ b/ClassGSOTool.cs @@ -87,9 +87,7 @@ for (int j = 0; j < listPipelineLayers.Count; j++) { layer = listPipelineLayers[j]; - - //计算管线附属物 - pointLayer = m_globeControl.Globe.Layers.GetLayerByCaption(layer.Caption + "附属物"); + pointLayer = m_globeControl.Globe.Layers.GetLayerByCaption(layer.Caption + "附属物");//管线附属物计算 GSOFeatures feats = null; if (pointLayer != null) @@ -120,6 +118,9 @@ double lengthTotal = 0.0; double areaMin = 0.0; + areaMin = CalculateMinArea(features, featuresTrue, featurePolygon); + lengthTotal = CalculateLength(features, featuresTrue, featurePolygon); + /* #region 求面积 //获取面中所有对象组成的切割面的长线 GSOFeature polygonFeature = getLineFromGSOFeatures(features, featuresTrue); @@ -145,7 +146,6 @@ } } } - } } #endregion @@ -170,7 +170,6 @@ GSOGeoPolyline3D line = feature.Geometry as GSOGeoPolyline3D; double lineLength = line.GetSpaceLength(false, 6378137); lengthTotal += lineLength; - } else { @@ -187,12 +186,10 @@ GSOGeoPolyline3D lineAnalysis = featureline.Geometry as GSOGeoPolyline3D; double length = lineAnalysis.GetSpaceLength(false, 6378137); lengthTotal += length; - } } } } - } else { @@ -200,6 +197,7 @@ } } #endregion + */ if (areaMin != 0 || lengthTotal != 0) { @@ -219,12 +217,107 @@ row[5] = feats.Length; table.Rows.Add(row); } - } #endregion } } /// + /// 计算侵入面积 + /// + /// + /// + /// + /// + private static double CalculateMinArea(GSOFeatures features, GSOFeatures featuresTrue, GSOFeature featurePolygon) + { + double areaMin = 0; + //获取面中所有对象组成的切割面的长线 + GSOFeature polygonFeature = getLineFromGSOFeatures(features, featuresTrue); + if (polygonFeature != null && polygonFeature.Geometry != null) + { + GSOFeatures polygonFs = new GSOFeatures(); + int polygoRresult = 0; + GSODataEngineUtility.GSLineClipPolygon(polygonFeature, featurePolygon, out polygonFs, out polygoRresult); + ///////////////////////判断面积问题/////////////////////// + if (polygoRresult == 3) + { + areaMin = double.MaxValue; + for (int mm = 0; mm < polygonFs.Length; mm++) + { + GSOFeature featurePolgyon = polygonFs[mm]; + if (featurePolgyon.Geometry.Type == EnumGeometryType.GeoPolygon3D) + { + GSOGeoPolygon3D polygonAnalysis = featurePolgyon.Geometry as GSOGeoPolygon3D; + double areaPolygon = polygonAnalysis.Area; + if (areaPolygon < areaMin) + { + areaMin = areaPolygon; + } + } + } + } + } + return areaMin; + } + /// + /// 计算侵入长度 + /// + /// + /// + /// + /// + private static double CalculateLength(GSOFeatures features, GSOFeatures featuresTrue, GSOFeature featurePolygon) + { + double lengthTotal = 0; + for (int m = 0; m < features.Length; m++) + { + GSOFeature feature = features[m]; + if (feature != null && feature.Geometry != null && feature.Geometry.Type == EnumGeometryType.GeoPolyline3D) + { + bool isFullInPolygon = false; + for (int n = 0; n < featuresTrue.Length; n++) + { + if (feature.ID == featuresTrue[n].ID) + { + isFullInPolygon = true; + break; + } + } + if (isFullInPolygon == true) + { + GSOGeoPolyline3D line = feature.Geometry as GSOGeoPolyline3D; + double lineLength = line.GetSpaceLength(false, 6378137); + lengthTotal += lineLength; + } + else + { + GSOFeatures fs = new GSOFeatures(); + int result = 0; + GSODataEngineUtility.GSPolygonClipLine(feature, featurePolygon, out fs, out result); + if (result == 1) + { + for (int k = 0; k < fs.Length; k++) + { + GSOFeature featureline = fs[k]; + if (featureline != null && featureline.Geometry != null && featureline.Geometry.Type == EnumGeometryType.GeoPolyline3D) + { + GSOGeoPolyline3D lineAnalysis = featureline.Geometry as GSOGeoPolyline3D; + double length = lineAnalysis.GetSpaceLength(false, 6378137); + lengthTotal += length; + } + } + } + } + } + else + { + //MessageBox.Show("没有找到切割面的线对象!"); + } + } + return lengthTotal; + } + + /// /// 去除集合中重复的管线 /// /// diff --git a/ClassSearchAnalysis.cs b/ClassSearchAnalysis.cs index 73b46c2..29875ad 100644 --- a/ClassSearchAnalysis.cs +++ b/ClassSearchAnalysis.cs @@ -22,7 +22,7 @@ /// /// /// - public static DataTable ResultDataTable(out DataTable dt,GSOGlobeControl m_globeControl,string layerName, + public static void ResultDataTable(out DataTable dt,GSOGlobeControl m_globeControl,string layerName, string filedObject,string filedValue) { string sql = ""; @@ -38,7 +38,7 @@ + filedValue + "%'"; } dt = OledbHelper.QueryTable(sql); - return dt; + //return dt; } /// /// SQL语句查询 @@ -51,7 +51,7 @@ /// /// /// - public static DataTable ResultDataTable(out DataTable dt, GSOGlobeControl m_globeControl, string layerName, + public static void ResultDataTable(out DataTable dt, GSOGlobeControl m_globeControl, string layerName, string filedObject,string mathT, string leftFiledValue, string rightFiledValue) { string sql = ""; @@ -67,7 +67,7 @@ + " from " + layerName + " where " + filedObject + mathT + rightFiledValue; } dt = OledbHelper.QueryTable(sql); - return dt; + //return dt; } /// /// SQL查询不重复的值 @@ -76,11 +76,11 @@ /// /// /// - public static DataTable ResultDistinctDataTable(out DataTable dt,string layerName,string filedObject) + public static void ResultDistinctDataTable(out DataTable dt,string layerName,string filedObject) { string sql = "select distinct " + filedObject + " from " + layerName + " order by " + filedObject; dt = OledbHelper.QueryTable(sql); - return dt; + //return dt; } /// /// SQL查询,返回包含NULL的Table @@ -91,7 +91,7 @@ /// /// /// - public static DataTable ResultDataTableContainNull(out DataTable dt,GSOGlobeControl m_globeControl, + public static void ResultDataTableContainNull(out DataTable dt,GSOGlobeControl m_globeControl, string layerName,string filedObject,List filedValueList) { string sql = "select " + getpipeLineFields.getFields(layerName, m_globeControl) @@ -124,7 +124,7 @@ } dt = OledbHelper.QueryTable(sql); - return dt; + //return dt; } /// /// SQL查询,参数待有where语句 @@ -134,13 +134,13 @@ /// /// /// - public static DataTable ResultDataTable(out DataTable dt,GSOGlobeControl m_globeControl, string layerName, string whereSql) + public static void ResultDataTable(out DataTable dt,GSOGlobeControl m_globeControl, string layerName, string whereSql) { string sql = "select " + getpipeLineFields.getFields(layerName, m_globeControl) + " from " + layerName + " where " + whereSql; dt = OledbHelper.QueryTable(sql); - return dt; + //return dt; } diff --git a/Cyberpipe.suo b/Cyberpipe.suo index a62aae8..9345628 100644 --- a/Cyberpipe.suo +++ b/Cyberpipe.suo Binary files differ diff --git a/FrmBasicQuery.cs b/FrmBasicQuery.cs index 7e31256..c9c5a6d 100644 --- a/FrmBasicQuery.cs +++ b/FrmBasicQuery.cs @@ -156,7 +156,7 @@ checkBoxX5.Enabled = true; checkBoxX6.Enabled = true; } - else if (table.Rows[0][strFiled].GetType() == typeof(DateTime)) + else if (table.Rows[0][strFiled].GetType() == typeof(decimal)) { checkBoxX1.Enabled = true; checkBoxX2.Enabled = true; diff --git a/MainFrm.cs b/MainFrm.cs index ada84e9..ac2614d 100644 --- a/MainFrm.cs +++ b/MainFrm.cs @@ -9073,15 +9073,6 @@ globeControl1.Globe.MemoryLayer.AddFeature(gf); } /// - /// 红线审核 - /// - /// - /// - private void buttonItem138_Click_2(object sender, EventArgs e) - { - - } - /// /// 比较两个点是否是同一个点 /// /// @@ -9123,10 +9114,6 @@ double tanABC = Math.Abs(xieLvAB - xieLvBC) / (1 + xieLvAB * xieLvBC); double angle = Math.Atan(tanABC); - //if (angle > Math.PI / 2) //落在外边 - //{ - // length = 0; - //} double lengthAD = lengthAB * Math.Sin(angle); length = Math.Abs(lengthAD); double lengthBD = lengthAB * Math.Cos(angle); diff --git a/bin/x86/Debug/Config.xml b/bin/x86/Debug/Config.xml index a5a72aa..331685a 100644 --- a/bin/x86/Debug/Config.xml +++ b/bin/x86/Debug/Config.xml @@ -1,11 +1,11 @@  LocaSpace三维地下管线信息系统 - release - SZHTDB2 - 192.168.0.203 - release - 192.168.0.203 + scott + SZDB + 127.0.0.1 + SZDB + 127.0.0.1 1500 http://192.168.0.203/images/ http://192.168.0.203/images/default.jpg diff --git a/bin/x86/Debug/Cyberpipe.exe b/bin/x86/Debug/Cyberpipe.exe index b204971..f3f5a5c 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 c3bc888..2cd6699 100644 --- a/bin/x86/Debug/Cyberpipe.pdb +++ b/bin/x86/Debug/Cyberpipe.pdb Binary files differ diff --git a/obj/x64/Debug/Cyberpipe.exe b/obj/x64/Debug/Cyberpipe.exe index b204971..f3f5a5c 100644 --- a/obj/x64/Debug/Cyberpipe.exe +++ b/obj/x64/Debug/Cyberpipe.exe Binary files differ diff --git a/obj/x64/Debug/Cyberpipe.pdb b/obj/x64/Debug/Cyberpipe.pdb index c3bc888..2cd6699 100644 --- a/obj/x64/Debug/Cyberpipe.pdb +++ b/obj/x64/Debug/Cyberpipe.pdb Binary files differ