diff --git a/Cyberpipe.suo b/Cyberpipe.suo index a56b834..2eccd5b 100644 --- a/Cyberpipe.suo +++ b/Cyberpipe.suo Binary files differ diff --git a/Cyberpipe.suo b/Cyberpipe.suo index a56b834..2eccd5b 100644 --- a/Cyberpipe.suo +++ b/Cyberpipe.suo Binary files differ diff --git a/DoublePanelAnalysis.cs b/DoublePanelAnalysis.cs index 2c45db6..90466dd 100644 --- a/DoublePanelAnalysis.cs +++ b/DoublePanelAnalysis.cs @@ -776,7 +776,7 @@ if (caption == _pipelineLayerNames[i]) continue;//排除本图层 GSOLayer layer2 = globeControl1.Globe.Layers.GetLayerByCaption(_pipelineLayerNames[i]); if (layer2 == null) continue; - GSOFeatures feats2 = FeatureStatisticsService.getLayerFeatures(polygon, layer2); + GSOFeatures feats2 = FeatureStatisticsService.GetLayerFeatures(polygon, layer2); if (feats2 == null) continue; for (int j = 0; j < feats2.Length; j++) { @@ -819,7 +819,7 @@ if (caption == _pipelineLayerNames[i]) continue; GSOLayer layer2 = globeControl1.Globe.Layers.GetLayerByCaption(_pipelineLayerNames[i]); if (layer2 == null) continue; - GSOFeatures feats2 = FeatureStatisticsService.getLayerFeatures(polygon, layer2); + GSOFeatures feats2 = FeatureStatisticsService.GetLayerFeatures(polygon, layer2); for (int j = 0; j < feats2.Length; j++) { GSOFeature feat2 = feats2[j]; @@ -858,7 +858,7 @@ if (caption == _pipelineLayerNames[i]) continue;//排除本图层 GSOLayer layer2 = globeControl1.Globe.Layers.GetLayerByCaption(_pipelineLayerNames[i]); if (layer2 == null) continue; - GSOFeatures feats2 = FeatureStatisticsService.getLayerFeatures(polygon, layer2); + GSOFeatures feats2 = FeatureStatisticsService.GetLayerFeatures(polygon, layer2); if (feats2 == null) continue; for (int j = 0; j < feats2.Length; j++) { diff --git a/Cyberpipe.suo b/Cyberpipe.suo index a56b834..2eccd5b 100644 --- a/Cyberpipe.suo +++ b/Cyberpipe.suo Binary files differ diff --git a/DoublePanelAnalysis.cs b/DoublePanelAnalysis.cs index 2c45db6..90466dd 100644 --- a/DoublePanelAnalysis.cs +++ b/DoublePanelAnalysis.cs @@ -776,7 +776,7 @@ if (caption == _pipelineLayerNames[i]) continue;//排除本图层 GSOLayer layer2 = globeControl1.Globe.Layers.GetLayerByCaption(_pipelineLayerNames[i]); if (layer2 == null) continue; - GSOFeatures feats2 = FeatureStatisticsService.getLayerFeatures(polygon, layer2); + GSOFeatures feats2 = FeatureStatisticsService.GetLayerFeatures(polygon, layer2); if (feats2 == null) continue; for (int j = 0; j < feats2.Length; j++) { @@ -819,7 +819,7 @@ if (caption == _pipelineLayerNames[i]) continue; GSOLayer layer2 = globeControl1.Globe.Layers.GetLayerByCaption(_pipelineLayerNames[i]); if (layer2 == null) continue; - GSOFeatures feats2 = FeatureStatisticsService.getLayerFeatures(polygon, layer2); + GSOFeatures feats2 = FeatureStatisticsService.GetLayerFeatures(polygon, layer2); for (int j = 0; j < feats2.Length; j++) { GSOFeature feat2 = feats2[j]; @@ -858,7 +858,7 @@ if (caption == _pipelineLayerNames[i]) continue;//排除本图层 GSOLayer layer2 = globeControl1.Globe.Layers.GetLayerByCaption(_pipelineLayerNames[i]); if (layer2 == null) continue; - GSOFeatures feats2 = FeatureStatisticsService.getLayerFeatures(polygon, layer2); + GSOFeatures feats2 = FeatureStatisticsService.GetLayerFeatures(polygon, layer2); if (feats2 == null) continue; for (int j = 0; j < feats2.Length; j++) { diff --git a/FeatureStatisticsService.cs b/FeatureStatisticsService.cs index fe32265..c147e55 100644 --- a/FeatureStatisticsService.cs +++ b/FeatureStatisticsService.cs @@ -48,7 +48,7 @@ /// ///附属物列表 /// - public Dictionary getFeatureCountByFeatures(GSOFeatures feats) + public Dictionary GetFeatureCountByFeatures(GSOFeatures feats) { if (feats == null || feats.Length == 0) return null; Dictionary result = new Dictionary(); @@ -64,13 +64,13 @@ /// /// /// - public FeaturesClassfyResult getPipesInfoByValueSection(GSOGeoPolygon3D polygon, GSOLayer layer, double? min, double? max, string fieldName) + public FeaturesClassfyResult GetPipesInfoByValueSection(GSOGeoPolygon3D polygon, GSOLayer layer, double? min, double? max, string fieldName) { if (layer == null) return null; FeaturesClassfyResult result = new FeaturesClassfyResult(); double totalLength = 0.0; int ncount = 0; - GSOFeatures features = getPipesByValueSection(polygon, layer, min, max, fieldName); + GSOFeatures features = GetPipesByValueSection(polygon, layer, min, max, fieldName); for (int i = 0; i < features.Length; i++) { GSOGeoPolyline3D line = features[i].Geometry as GSOGeoPolyline3D; @@ -98,7 +98,7 @@ /// 上限 /// 统计类型:"起始埋深"或"管径_毫米" /// - public GSOFeatures getPipesByValueSection(GSOGeoPolygon3D polygon, GSOLayer layer, double? min, double? max, string fieldName) + public GSOFeatures GetPipesByValueSection(GSOGeoPolygon3D polygon, GSOLayer layer, double? min, double? max, string fieldName) { if (layer == null) return null; GSOFeatures result = new GSOFeatures(); @@ -127,7 +127,7 @@ } //图层名称、管径、条数、总长度 - public List groupPipeByDiameter(GSOGeoPolygon3D polygon, GSOLayer layer) + public List GroupPipeByDiameter(GSOGeoPolygon3D polygon, GSOLayer layer) { if (layer == null) return null; List result = new List(); @@ -181,7 +181,7 @@ /// /// /// - public List groupAccessories(GSOGeoPolygon3D polygon, GSOLayer layer) + public List GroupAccessories(GSOGeoPolygon3D polygon, GSOLayer layer) { if (layer == null) return null; List result = new List(); @@ -230,7 +230,7 @@ /// /// 材质 /// - public FeaturesClassfyResult groupPipeByMaterial(GSOGeoPolygon3D polygon, GSOLayer layer, string material) + public FeaturesClassfyResult GroupPipeByMaterial(GSOGeoPolygon3D polygon, GSOLayer layer, string material) { if (layer == null) return null; FeaturesClassfyResult result = new FeaturesClassfyResult(); @@ -245,16 +245,12 @@ int ncount = 0; for (int i = 0; i < feats.Length; i++) { - if (feats[i].GetFieldAsString("材质").Equals(fixedMaterial)) - { - GSOGeoPolyline3D line = feats[i].Geometry as GSOGeoPolyline3D; - if (line != null) - { - double length = line.GetSpaceLength(true, 6378137); - totalLength += length; - ncount += 1; - } - } + if (!feats[i].GetFieldAsString("材质").Equals(fixedMaterial)) continue; + GSOGeoPolyline3D line = feats[i].Geometry as GSOGeoPolyline3D; + if (line == null) continue; + double length = line.GetSpaceLength(true, 6378137); + totalLength += length; + ncount += 1; } result.layerName = layer.Caption; @@ -271,12 +267,12 @@ /// /// 要统计的长度 /// - public static GSOFeatures getLayerPipes(GSOGeoPolygon3D polygon, GSOLayer layer, out double length) + public static GSOFeatures GetLayerPipes(GSOGeoPolygon3D polygon, GSOLayer layer, out double length) { length = 0; if (layer == null) return null; - GSOFeatures feats = getLayerFeatures(polygon, layer); + GSOFeatures feats = GetLayerFeatures(polygon, layer); double totallength = 0.00; for (int i = 0; i < feats.Length; i++) { @@ -298,10 +294,10 @@ /// /// /// - public static GSOFeatures getLayerFeatures(GSOGeoPolygon3D polygon, GSOLayer layer) + public static GSOFeatures GetLayerFeatures(GSOGeoPolygon3D polygon, GSOLayer layer) { - if (layer == null) return null; GSOFeatureLayer flayer = layer as GSOFeatureLayer; + if (flayer == null) return null; return polygon == null ? flayer.GetAllFeatures() : flayer.FindFeaturesInPolygon(polygon, false); } diff --git a/Cyberpipe.suo b/Cyberpipe.suo index a56b834..2eccd5b 100644 --- a/Cyberpipe.suo +++ b/Cyberpipe.suo Binary files differ diff --git a/DoublePanelAnalysis.cs b/DoublePanelAnalysis.cs index 2c45db6..90466dd 100644 --- a/DoublePanelAnalysis.cs +++ b/DoublePanelAnalysis.cs @@ -776,7 +776,7 @@ if (caption == _pipelineLayerNames[i]) continue;//排除本图层 GSOLayer layer2 = globeControl1.Globe.Layers.GetLayerByCaption(_pipelineLayerNames[i]); if (layer2 == null) continue; - GSOFeatures feats2 = FeatureStatisticsService.getLayerFeatures(polygon, layer2); + GSOFeatures feats2 = FeatureStatisticsService.GetLayerFeatures(polygon, layer2); if (feats2 == null) continue; for (int j = 0; j < feats2.Length; j++) { @@ -819,7 +819,7 @@ if (caption == _pipelineLayerNames[i]) continue; GSOLayer layer2 = globeControl1.Globe.Layers.GetLayerByCaption(_pipelineLayerNames[i]); if (layer2 == null) continue; - GSOFeatures feats2 = FeatureStatisticsService.getLayerFeatures(polygon, layer2); + GSOFeatures feats2 = FeatureStatisticsService.GetLayerFeatures(polygon, layer2); for (int j = 0; j < feats2.Length; j++) { GSOFeature feat2 = feats2[j]; @@ -858,7 +858,7 @@ if (caption == _pipelineLayerNames[i]) continue;//排除本图层 GSOLayer layer2 = globeControl1.Globe.Layers.GetLayerByCaption(_pipelineLayerNames[i]); if (layer2 == null) continue; - GSOFeatures feats2 = FeatureStatisticsService.getLayerFeatures(polygon, layer2); + GSOFeatures feats2 = FeatureStatisticsService.GetLayerFeatures(polygon, layer2); if (feats2 == null) continue; for (int j = 0; j < feats2.Length; j++) { diff --git a/FeatureStatisticsService.cs b/FeatureStatisticsService.cs index fe32265..c147e55 100644 --- a/FeatureStatisticsService.cs +++ b/FeatureStatisticsService.cs @@ -48,7 +48,7 @@ /// ///附属物列表 /// - public Dictionary getFeatureCountByFeatures(GSOFeatures feats) + public Dictionary GetFeatureCountByFeatures(GSOFeatures feats) { if (feats == null || feats.Length == 0) return null; Dictionary result = new Dictionary(); @@ -64,13 +64,13 @@ /// /// /// - public FeaturesClassfyResult getPipesInfoByValueSection(GSOGeoPolygon3D polygon, GSOLayer layer, double? min, double? max, string fieldName) + public FeaturesClassfyResult GetPipesInfoByValueSection(GSOGeoPolygon3D polygon, GSOLayer layer, double? min, double? max, string fieldName) { if (layer == null) return null; FeaturesClassfyResult result = new FeaturesClassfyResult(); double totalLength = 0.0; int ncount = 0; - GSOFeatures features = getPipesByValueSection(polygon, layer, min, max, fieldName); + GSOFeatures features = GetPipesByValueSection(polygon, layer, min, max, fieldName); for (int i = 0; i < features.Length; i++) { GSOGeoPolyline3D line = features[i].Geometry as GSOGeoPolyline3D; @@ -98,7 +98,7 @@ /// 上限 /// 统计类型:"起始埋深"或"管径_毫米" /// - public GSOFeatures getPipesByValueSection(GSOGeoPolygon3D polygon, GSOLayer layer, double? min, double? max, string fieldName) + public GSOFeatures GetPipesByValueSection(GSOGeoPolygon3D polygon, GSOLayer layer, double? min, double? max, string fieldName) { if (layer == null) return null; GSOFeatures result = new GSOFeatures(); @@ -127,7 +127,7 @@ } //图层名称、管径、条数、总长度 - public List groupPipeByDiameter(GSOGeoPolygon3D polygon, GSOLayer layer) + public List GroupPipeByDiameter(GSOGeoPolygon3D polygon, GSOLayer layer) { if (layer == null) return null; List result = new List(); @@ -181,7 +181,7 @@ /// /// /// - public List groupAccessories(GSOGeoPolygon3D polygon, GSOLayer layer) + public List GroupAccessories(GSOGeoPolygon3D polygon, GSOLayer layer) { if (layer == null) return null; List result = new List(); @@ -230,7 +230,7 @@ /// /// 材质 /// - public FeaturesClassfyResult groupPipeByMaterial(GSOGeoPolygon3D polygon, GSOLayer layer, string material) + public FeaturesClassfyResult GroupPipeByMaterial(GSOGeoPolygon3D polygon, GSOLayer layer, string material) { if (layer == null) return null; FeaturesClassfyResult result = new FeaturesClassfyResult(); @@ -245,16 +245,12 @@ int ncount = 0; for (int i = 0; i < feats.Length; i++) { - if (feats[i].GetFieldAsString("材质").Equals(fixedMaterial)) - { - GSOGeoPolyline3D line = feats[i].Geometry as GSOGeoPolyline3D; - if (line != null) - { - double length = line.GetSpaceLength(true, 6378137); - totalLength += length; - ncount += 1; - } - } + if (!feats[i].GetFieldAsString("材质").Equals(fixedMaterial)) continue; + GSOGeoPolyline3D line = feats[i].Geometry as GSOGeoPolyline3D; + if (line == null) continue; + double length = line.GetSpaceLength(true, 6378137); + totalLength += length; + ncount += 1; } result.layerName = layer.Caption; @@ -271,12 +267,12 @@ /// /// 要统计的长度 /// - public static GSOFeatures getLayerPipes(GSOGeoPolygon3D polygon, GSOLayer layer, out double length) + public static GSOFeatures GetLayerPipes(GSOGeoPolygon3D polygon, GSOLayer layer, out double length) { length = 0; if (layer == null) return null; - GSOFeatures feats = getLayerFeatures(polygon, layer); + GSOFeatures feats = GetLayerFeatures(polygon, layer); double totallength = 0.00; for (int i = 0; i < feats.Length; i++) { @@ -298,10 +294,10 @@ /// /// /// - public static GSOFeatures getLayerFeatures(GSOGeoPolygon3D polygon, GSOLayer layer) + public static GSOFeatures GetLayerFeatures(GSOGeoPolygon3D polygon, GSOLayer layer) { - if (layer == null) return null; GSOFeatureLayer flayer = layer as GSOFeatureLayer; + if (flayer == null) return null; return polygon == null ? flayer.GetAllFeatures() : flayer.FindFeaturesInPolygon(polygon, false); } diff --git a/FrmAccessoriesgather.cs b/FrmAccessoriesgather.cs index c7787f7..e1d176e 100644 --- a/FrmAccessoriesgather.cs +++ b/FrmAccessoriesgather.cs @@ -213,7 +213,7 @@ { FeatureStatisticsService featureService = new FeatureStatisticsService(); GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(layertype); - List accessoriesResult = featureService.groupAccessories(polygon, layer); + List accessoriesResult = featureService.GroupAccessories(polygon, layer); if (accessoriesResult == null || accessoriesResult.Count == 0) { diff --git a/Cyberpipe.suo b/Cyberpipe.suo index a56b834..2eccd5b 100644 --- a/Cyberpipe.suo +++ b/Cyberpipe.suo Binary files differ diff --git a/DoublePanelAnalysis.cs b/DoublePanelAnalysis.cs index 2c45db6..90466dd 100644 --- a/DoublePanelAnalysis.cs +++ b/DoublePanelAnalysis.cs @@ -776,7 +776,7 @@ if (caption == _pipelineLayerNames[i]) continue;//排除本图层 GSOLayer layer2 = globeControl1.Globe.Layers.GetLayerByCaption(_pipelineLayerNames[i]); if (layer2 == null) continue; - GSOFeatures feats2 = FeatureStatisticsService.getLayerFeatures(polygon, layer2); + GSOFeatures feats2 = FeatureStatisticsService.GetLayerFeatures(polygon, layer2); if (feats2 == null) continue; for (int j = 0; j < feats2.Length; j++) { @@ -819,7 +819,7 @@ if (caption == _pipelineLayerNames[i]) continue; GSOLayer layer2 = globeControl1.Globe.Layers.GetLayerByCaption(_pipelineLayerNames[i]); if (layer2 == null) continue; - GSOFeatures feats2 = FeatureStatisticsService.getLayerFeatures(polygon, layer2); + GSOFeatures feats2 = FeatureStatisticsService.GetLayerFeatures(polygon, layer2); for (int j = 0; j < feats2.Length; j++) { GSOFeature feat2 = feats2[j]; @@ -858,7 +858,7 @@ if (caption == _pipelineLayerNames[i]) continue;//排除本图层 GSOLayer layer2 = globeControl1.Globe.Layers.GetLayerByCaption(_pipelineLayerNames[i]); if (layer2 == null) continue; - GSOFeatures feats2 = FeatureStatisticsService.getLayerFeatures(polygon, layer2); + GSOFeatures feats2 = FeatureStatisticsService.GetLayerFeatures(polygon, layer2); if (feats2 == null) continue; for (int j = 0; j < feats2.Length; j++) { diff --git a/FeatureStatisticsService.cs b/FeatureStatisticsService.cs index fe32265..c147e55 100644 --- a/FeatureStatisticsService.cs +++ b/FeatureStatisticsService.cs @@ -48,7 +48,7 @@ /// ///附属物列表 /// - public Dictionary getFeatureCountByFeatures(GSOFeatures feats) + public Dictionary GetFeatureCountByFeatures(GSOFeatures feats) { if (feats == null || feats.Length == 0) return null; Dictionary result = new Dictionary(); @@ -64,13 +64,13 @@ /// /// /// - public FeaturesClassfyResult getPipesInfoByValueSection(GSOGeoPolygon3D polygon, GSOLayer layer, double? min, double? max, string fieldName) + public FeaturesClassfyResult GetPipesInfoByValueSection(GSOGeoPolygon3D polygon, GSOLayer layer, double? min, double? max, string fieldName) { if (layer == null) return null; FeaturesClassfyResult result = new FeaturesClassfyResult(); double totalLength = 0.0; int ncount = 0; - GSOFeatures features = getPipesByValueSection(polygon, layer, min, max, fieldName); + GSOFeatures features = GetPipesByValueSection(polygon, layer, min, max, fieldName); for (int i = 0; i < features.Length; i++) { GSOGeoPolyline3D line = features[i].Geometry as GSOGeoPolyline3D; @@ -98,7 +98,7 @@ /// 上限 /// 统计类型:"起始埋深"或"管径_毫米" /// - public GSOFeatures getPipesByValueSection(GSOGeoPolygon3D polygon, GSOLayer layer, double? min, double? max, string fieldName) + public GSOFeatures GetPipesByValueSection(GSOGeoPolygon3D polygon, GSOLayer layer, double? min, double? max, string fieldName) { if (layer == null) return null; GSOFeatures result = new GSOFeatures(); @@ -127,7 +127,7 @@ } //图层名称、管径、条数、总长度 - public List groupPipeByDiameter(GSOGeoPolygon3D polygon, GSOLayer layer) + public List GroupPipeByDiameter(GSOGeoPolygon3D polygon, GSOLayer layer) { if (layer == null) return null; List result = new List(); @@ -181,7 +181,7 @@ /// /// /// - public List groupAccessories(GSOGeoPolygon3D polygon, GSOLayer layer) + public List GroupAccessories(GSOGeoPolygon3D polygon, GSOLayer layer) { if (layer == null) return null; List result = new List(); @@ -230,7 +230,7 @@ /// /// 材质 /// - public FeaturesClassfyResult groupPipeByMaterial(GSOGeoPolygon3D polygon, GSOLayer layer, string material) + public FeaturesClassfyResult GroupPipeByMaterial(GSOGeoPolygon3D polygon, GSOLayer layer, string material) { if (layer == null) return null; FeaturesClassfyResult result = new FeaturesClassfyResult(); @@ -245,16 +245,12 @@ int ncount = 0; for (int i = 0; i < feats.Length; i++) { - if (feats[i].GetFieldAsString("材质").Equals(fixedMaterial)) - { - GSOGeoPolyline3D line = feats[i].Geometry as GSOGeoPolyline3D; - if (line != null) - { - double length = line.GetSpaceLength(true, 6378137); - totalLength += length; - ncount += 1; - } - } + if (!feats[i].GetFieldAsString("材质").Equals(fixedMaterial)) continue; + GSOGeoPolyline3D line = feats[i].Geometry as GSOGeoPolyline3D; + if (line == null) continue; + double length = line.GetSpaceLength(true, 6378137); + totalLength += length; + ncount += 1; } result.layerName = layer.Caption; @@ -271,12 +267,12 @@ /// /// 要统计的长度 /// - public static GSOFeatures getLayerPipes(GSOGeoPolygon3D polygon, GSOLayer layer, out double length) + public static GSOFeatures GetLayerPipes(GSOGeoPolygon3D polygon, GSOLayer layer, out double length) { length = 0; if (layer == null) return null; - GSOFeatures feats = getLayerFeatures(polygon, layer); + GSOFeatures feats = GetLayerFeatures(polygon, layer); double totallength = 0.00; for (int i = 0; i < feats.Length; i++) { @@ -298,10 +294,10 @@ /// /// /// - public static GSOFeatures getLayerFeatures(GSOGeoPolygon3D polygon, GSOLayer layer) + public static GSOFeatures GetLayerFeatures(GSOGeoPolygon3D polygon, GSOLayer layer) { - if (layer == null) return null; GSOFeatureLayer flayer = layer as GSOFeatureLayer; + if (flayer == null) return null; return polygon == null ? flayer.GetAllFeatures() : flayer.FindFeaturesInPolygon(polygon, false); } diff --git a/FrmAccessoriesgather.cs b/FrmAccessoriesgather.cs index c7787f7..e1d176e 100644 --- a/FrmAccessoriesgather.cs +++ b/FrmAccessoriesgather.cs @@ -213,7 +213,7 @@ { FeatureStatisticsService featureService = new FeatureStatisticsService(); GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(layertype); - List accessoriesResult = featureService.groupAccessories(polygon, layer); + List accessoriesResult = featureService.GroupAccessories(polygon, layer); if (accessoriesResult == null || accessoriesResult.Count == 0) { diff --git a/FrmAllPipelineStatis.cs b/FrmAllPipelineStatis.cs index 60805ba..0911557 100644 --- a/FrmAllPipelineStatis.cs +++ b/FrmAllPipelineStatis.cs @@ -205,7 +205,7 @@ { GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(pipeLayerNames[i]); double totalLength = 0.0; - GSOFeatures fs = FeatureStatisticsService.getLayerPipes(polygon, layer,out totalLength); + GSOFeatures fs = FeatureStatisticsService.GetLayerPipes(polygon, layer,out totalLength); if (fs == null) continue; nameAndPipeMap.Add(pipeLayerNames[i], fs); nameAndLengthMap.Add(pipeLayerNames[i],totalLength); diff --git a/Cyberpipe.suo b/Cyberpipe.suo index a56b834..2eccd5b 100644 --- a/Cyberpipe.suo +++ b/Cyberpipe.suo Binary files differ diff --git a/DoublePanelAnalysis.cs b/DoublePanelAnalysis.cs index 2c45db6..90466dd 100644 --- a/DoublePanelAnalysis.cs +++ b/DoublePanelAnalysis.cs @@ -776,7 +776,7 @@ if (caption == _pipelineLayerNames[i]) continue;//排除本图层 GSOLayer layer2 = globeControl1.Globe.Layers.GetLayerByCaption(_pipelineLayerNames[i]); if (layer2 == null) continue; - GSOFeatures feats2 = FeatureStatisticsService.getLayerFeatures(polygon, layer2); + GSOFeatures feats2 = FeatureStatisticsService.GetLayerFeatures(polygon, layer2); if (feats2 == null) continue; for (int j = 0; j < feats2.Length; j++) { @@ -819,7 +819,7 @@ if (caption == _pipelineLayerNames[i]) continue; GSOLayer layer2 = globeControl1.Globe.Layers.GetLayerByCaption(_pipelineLayerNames[i]); if (layer2 == null) continue; - GSOFeatures feats2 = FeatureStatisticsService.getLayerFeatures(polygon, layer2); + GSOFeatures feats2 = FeatureStatisticsService.GetLayerFeatures(polygon, layer2); for (int j = 0; j < feats2.Length; j++) { GSOFeature feat2 = feats2[j]; @@ -858,7 +858,7 @@ if (caption == _pipelineLayerNames[i]) continue;//排除本图层 GSOLayer layer2 = globeControl1.Globe.Layers.GetLayerByCaption(_pipelineLayerNames[i]); if (layer2 == null) continue; - GSOFeatures feats2 = FeatureStatisticsService.getLayerFeatures(polygon, layer2); + GSOFeatures feats2 = FeatureStatisticsService.GetLayerFeatures(polygon, layer2); if (feats2 == null) continue; for (int j = 0; j < feats2.Length; j++) { diff --git a/FeatureStatisticsService.cs b/FeatureStatisticsService.cs index fe32265..c147e55 100644 --- a/FeatureStatisticsService.cs +++ b/FeatureStatisticsService.cs @@ -48,7 +48,7 @@ /// ///附属物列表 /// - public Dictionary getFeatureCountByFeatures(GSOFeatures feats) + public Dictionary GetFeatureCountByFeatures(GSOFeatures feats) { if (feats == null || feats.Length == 0) return null; Dictionary result = new Dictionary(); @@ -64,13 +64,13 @@ /// /// /// - public FeaturesClassfyResult getPipesInfoByValueSection(GSOGeoPolygon3D polygon, GSOLayer layer, double? min, double? max, string fieldName) + public FeaturesClassfyResult GetPipesInfoByValueSection(GSOGeoPolygon3D polygon, GSOLayer layer, double? min, double? max, string fieldName) { if (layer == null) return null; FeaturesClassfyResult result = new FeaturesClassfyResult(); double totalLength = 0.0; int ncount = 0; - GSOFeatures features = getPipesByValueSection(polygon, layer, min, max, fieldName); + GSOFeatures features = GetPipesByValueSection(polygon, layer, min, max, fieldName); for (int i = 0; i < features.Length; i++) { GSOGeoPolyline3D line = features[i].Geometry as GSOGeoPolyline3D; @@ -98,7 +98,7 @@ /// 上限 /// 统计类型:"起始埋深"或"管径_毫米" /// - public GSOFeatures getPipesByValueSection(GSOGeoPolygon3D polygon, GSOLayer layer, double? min, double? max, string fieldName) + public GSOFeatures GetPipesByValueSection(GSOGeoPolygon3D polygon, GSOLayer layer, double? min, double? max, string fieldName) { if (layer == null) return null; GSOFeatures result = new GSOFeatures(); @@ -127,7 +127,7 @@ } //图层名称、管径、条数、总长度 - public List groupPipeByDiameter(GSOGeoPolygon3D polygon, GSOLayer layer) + public List GroupPipeByDiameter(GSOGeoPolygon3D polygon, GSOLayer layer) { if (layer == null) return null; List result = new List(); @@ -181,7 +181,7 @@ /// /// /// - public List groupAccessories(GSOGeoPolygon3D polygon, GSOLayer layer) + public List GroupAccessories(GSOGeoPolygon3D polygon, GSOLayer layer) { if (layer == null) return null; List result = new List(); @@ -230,7 +230,7 @@ /// /// 材质 /// - public FeaturesClassfyResult groupPipeByMaterial(GSOGeoPolygon3D polygon, GSOLayer layer, string material) + public FeaturesClassfyResult GroupPipeByMaterial(GSOGeoPolygon3D polygon, GSOLayer layer, string material) { if (layer == null) return null; FeaturesClassfyResult result = new FeaturesClassfyResult(); @@ -245,16 +245,12 @@ int ncount = 0; for (int i = 0; i < feats.Length; i++) { - if (feats[i].GetFieldAsString("材质").Equals(fixedMaterial)) - { - GSOGeoPolyline3D line = feats[i].Geometry as GSOGeoPolyline3D; - if (line != null) - { - double length = line.GetSpaceLength(true, 6378137); - totalLength += length; - ncount += 1; - } - } + if (!feats[i].GetFieldAsString("材质").Equals(fixedMaterial)) continue; + GSOGeoPolyline3D line = feats[i].Geometry as GSOGeoPolyline3D; + if (line == null) continue; + double length = line.GetSpaceLength(true, 6378137); + totalLength += length; + ncount += 1; } result.layerName = layer.Caption; @@ -271,12 +267,12 @@ /// /// 要统计的长度 /// - public static GSOFeatures getLayerPipes(GSOGeoPolygon3D polygon, GSOLayer layer, out double length) + public static GSOFeatures GetLayerPipes(GSOGeoPolygon3D polygon, GSOLayer layer, out double length) { length = 0; if (layer == null) return null; - GSOFeatures feats = getLayerFeatures(polygon, layer); + GSOFeatures feats = GetLayerFeatures(polygon, layer); double totallength = 0.00; for (int i = 0; i < feats.Length; i++) { @@ -298,10 +294,10 @@ /// /// /// - public static GSOFeatures getLayerFeatures(GSOGeoPolygon3D polygon, GSOLayer layer) + public static GSOFeatures GetLayerFeatures(GSOGeoPolygon3D polygon, GSOLayer layer) { - if (layer == null) return null; GSOFeatureLayer flayer = layer as GSOFeatureLayer; + if (flayer == null) return null; return polygon == null ? flayer.GetAllFeatures() : flayer.FindFeaturesInPolygon(polygon, false); } diff --git a/FrmAccessoriesgather.cs b/FrmAccessoriesgather.cs index c7787f7..e1d176e 100644 --- a/FrmAccessoriesgather.cs +++ b/FrmAccessoriesgather.cs @@ -213,7 +213,7 @@ { FeatureStatisticsService featureService = new FeatureStatisticsService(); GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(layertype); - List accessoriesResult = featureService.groupAccessories(polygon, layer); + List accessoriesResult = featureService.GroupAccessories(polygon, layer); if (accessoriesResult == null || accessoriesResult.Count == 0) { diff --git a/FrmAllPipelineStatis.cs b/FrmAllPipelineStatis.cs index 60805ba..0911557 100644 --- a/FrmAllPipelineStatis.cs +++ b/FrmAllPipelineStatis.cs @@ -205,7 +205,7 @@ { GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(pipeLayerNames[i]); double totalLength = 0.0; - GSOFeatures fs = FeatureStatisticsService.getLayerPipes(polygon, layer,out totalLength); + GSOFeatures fs = FeatureStatisticsService.GetLayerPipes(polygon, layer,out totalLength); if (fs == null) continue; nameAndPipeMap.Add(pipeLayerNames[i], fs); nameAndLengthMap.Add(pipeLayerNames[i],totalLength); diff --git a/FrmBSQStatis.cs b/FrmBSQStatis.cs index 6f7838f..dd63f62 100644 --- a/FrmBSQStatis.cs +++ b/FrmBSQStatis.cs @@ -108,7 +108,7 @@ public Dictionary getBSQMapByPolygon(GSOGeoPolygon3D polygon,Dictionary typeAndCount, Dictionary codeAndType) { GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption("标识器"); - GSOFeatures bsqFs = FeatureStatisticsService.getLayerFeatures(polygon, layer); + GSOFeatures bsqFs = FeatureStatisticsService.GetLayerFeatures(polygon, layer); if (bsqFs == null || bsqFs.Length <= 0) { LogHelper.WriteLog(typeof(FrmBSQStatis),"标识器图层下的Feature为空"); return null; diff --git a/Cyberpipe.suo b/Cyberpipe.suo index a56b834..2eccd5b 100644 --- a/Cyberpipe.suo +++ b/Cyberpipe.suo Binary files differ diff --git a/DoublePanelAnalysis.cs b/DoublePanelAnalysis.cs index 2c45db6..90466dd 100644 --- a/DoublePanelAnalysis.cs +++ b/DoublePanelAnalysis.cs @@ -776,7 +776,7 @@ if (caption == _pipelineLayerNames[i]) continue;//排除本图层 GSOLayer layer2 = globeControl1.Globe.Layers.GetLayerByCaption(_pipelineLayerNames[i]); if (layer2 == null) continue; - GSOFeatures feats2 = FeatureStatisticsService.getLayerFeatures(polygon, layer2); + GSOFeatures feats2 = FeatureStatisticsService.GetLayerFeatures(polygon, layer2); if (feats2 == null) continue; for (int j = 0; j < feats2.Length; j++) { @@ -819,7 +819,7 @@ if (caption == _pipelineLayerNames[i]) continue; GSOLayer layer2 = globeControl1.Globe.Layers.GetLayerByCaption(_pipelineLayerNames[i]); if (layer2 == null) continue; - GSOFeatures feats2 = FeatureStatisticsService.getLayerFeatures(polygon, layer2); + GSOFeatures feats2 = FeatureStatisticsService.GetLayerFeatures(polygon, layer2); for (int j = 0; j < feats2.Length; j++) { GSOFeature feat2 = feats2[j]; @@ -858,7 +858,7 @@ if (caption == _pipelineLayerNames[i]) continue;//排除本图层 GSOLayer layer2 = globeControl1.Globe.Layers.GetLayerByCaption(_pipelineLayerNames[i]); if (layer2 == null) continue; - GSOFeatures feats2 = FeatureStatisticsService.getLayerFeatures(polygon, layer2); + GSOFeatures feats2 = FeatureStatisticsService.GetLayerFeatures(polygon, layer2); if (feats2 == null) continue; for (int j = 0; j < feats2.Length; j++) { diff --git a/FeatureStatisticsService.cs b/FeatureStatisticsService.cs index fe32265..c147e55 100644 --- a/FeatureStatisticsService.cs +++ b/FeatureStatisticsService.cs @@ -48,7 +48,7 @@ /// ///附属物列表 /// - public Dictionary getFeatureCountByFeatures(GSOFeatures feats) + public Dictionary GetFeatureCountByFeatures(GSOFeatures feats) { if (feats == null || feats.Length == 0) return null; Dictionary result = new Dictionary(); @@ -64,13 +64,13 @@ /// /// /// - public FeaturesClassfyResult getPipesInfoByValueSection(GSOGeoPolygon3D polygon, GSOLayer layer, double? min, double? max, string fieldName) + public FeaturesClassfyResult GetPipesInfoByValueSection(GSOGeoPolygon3D polygon, GSOLayer layer, double? min, double? max, string fieldName) { if (layer == null) return null; FeaturesClassfyResult result = new FeaturesClassfyResult(); double totalLength = 0.0; int ncount = 0; - GSOFeatures features = getPipesByValueSection(polygon, layer, min, max, fieldName); + GSOFeatures features = GetPipesByValueSection(polygon, layer, min, max, fieldName); for (int i = 0; i < features.Length; i++) { GSOGeoPolyline3D line = features[i].Geometry as GSOGeoPolyline3D; @@ -98,7 +98,7 @@ /// 上限 /// 统计类型:"起始埋深"或"管径_毫米" /// - public GSOFeatures getPipesByValueSection(GSOGeoPolygon3D polygon, GSOLayer layer, double? min, double? max, string fieldName) + public GSOFeatures GetPipesByValueSection(GSOGeoPolygon3D polygon, GSOLayer layer, double? min, double? max, string fieldName) { if (layer == null) return null; GSOFeatures result = new GSOFeatures(); @@ -127,7 +127,7 @@ } //图层名称、管径、条数、总长度 - public List groupPipeByDiameter(GSOGeoPolygon3D polygon, GSOLayer layer) + public List GroupPipeByDiameter(GSOGeoPolygon3D polygon, GSOLayer layer) { if (layer == null) return null; List result = new List(); @@ -181,7 +181,7 @@ /// /// /// - public List groupAccessories(GSOGeoPolygon3D polygon, GSOLayer layer) + public List GroupAccessories(GSOGeoPolygon3D polygon, GSOLayer layer) { if (layer == null) return null; List result = new List(); @@ -230,7 +230,7 @@ /// /// 材质 /// - public FeaturesClassfyResult groupPipeByMaterial(GSOGeoPolygon3D polygon, GSOLayer layer, string material) + public FeaturesClassfyResult GroupPipeByMaterial(GSOGeoPolygon3D polygon, GSOLayer layer, string material) { if (layer == null) return null; FeaturesClassfyResult result = new FeaturesClassfyResult(); @@ -245,16 +245,12 @@ int ncount = 0; for (int i = 0; i < feats.Length; i++) { - if (feats[i].GetFieldAsString("材质").Equals(fixedMaterial)) - { - GSOGeoPolyline3D line = feats[i].Geometry as GSOGeoPolyline3D; - if (line != null) - { - double length = line.GetSpaceLength(true, 6378137); - totalLength += length; - ncount += 1; - } - } + if (!feats[i].GetFieldAsString("材质").Equals(fixedMaterial)) continue; + GSOGeoPolyline3D line = feats[i].Geometry as GSOGeoPolyline3D; + if (line == null) continue; + double length = line.GetSpaceLength(true, 6378137); + totalLength += length; + ncount += 1; } result.layerName = layer.Caption; @@ -271,12 +267,12 @@ /// /// 要统计的长度 /// - public static GSOFeatures getLayerPipes(GSOGeoPolygon3D polygon, GSOLayer layer, out double length) + public static GSOFeatures GetLayerPipes(GSOGeoPolygon3D polygon, GSOLayer layer, out double length) { length = 0; if (layer == null) return null; - GSOFeatures feats = getLayerFeatures(polygon, layer); + GSOFeatures feats = GetLayerFeatures(polygon, layer); double totallength = 0.00; for (int i = 0; i < feats.Length; i++) { @@ -298,10 +294,10 @@ /// /// /// - public static GSOFeatures getLayerFeatures(GSOGeoPolygon3D polygon, GSOLayer layer) + public static GSOFeatures GetLayerFeatures(GSOGeoPolygon3D polygon, GSOLayer layer) { - if (layer == null) return null; GSOFeatureLayer flayer = layer as GSOFeatureLayer; + if (flayer == null) return null; return polygon == null ? flayer.GetAllFeatures() : flayer.FindFeaturesInPolygon(polygon, false); } diff --git a/FrmAccessoriesgather.cs b/FrmAccessoriesgather.cs index c7787f7..e1d176e 100644 --- a/FrmAccessoriesgather.cs +++ b/FrmAccessoriesgather.cs @@ -213,7 +213,7 @@ { FeatureStatisticsService featureService = new FeatureStatisticsService(); GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(layertype); - List accessoriesResult = featureService.groupAccessories(polygon, layer); + List accessoriesResult = featureService.GroupAccessories(polygon, layer); if (accessoriesResult == null || accessoriesResult.Count == 0) { diff --git a/FrmAllPipelineStatis.cs b/FrmAllPipelineStatis.cs index 60805ba..0911557 100644 --- a/FrmAllPipelineStatis.cs +++ b/FrmAllPipelineStatis.cs @@ -205,7 +205,7 @@ { GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(pipeLayerNames[i]); double totalLength = 0.0; - GSOFeatures fs = FeatureStatisticsService.getLayerPipes(polygon, layer,out totalLength); + GSOFeatures fs = FeatureStatisticsService.GetLayerPipes(polygon, layer,out totalLength); if (fs == null) continue; nameAndPipeMap.Add(pipeLayerNames[i], fs); nameAndLengthMap.Add(pipeLayerNames[i],totalLength); diff --git a/FrmBSQStatis.cs b/FrmBSQStatis.cs index 6f7838f..dd63f62 100644 --- a/FrmBSQStatis.cs +++ b/FrmBSQStatis.cs @@ -108,7 +108,7 @@ public Dictionary getBSQMapByPolygon(GSOGeoPolygon3D polygon,Dictionary typeAndCount, Dictionary codeAndType) { GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption("标识器"); - GSOFeatures bsqFs = FeatureStatisticsService.getLayerFeatures(polygon, layer); + GSOFeatures bsqFs = FeatureStatisticsService.GetLayerFeatures(polygon, layer); if (bsqFs == null || bsqFs.Length <= 0) { LogHelper.WriteLog(typeof(FrmBSQStatis),"标识器图层下的Feature为空"); return null; diff --git a/FrmpipeDeepstatis.cs b/FrmpipeDeepstatis.cs index e00a1dc..6a5c895 100644 --- a/FrmpipeDeepstatis.cs +++ b/FrmpipeDeepstatis.cs @@ -148,7 +148,7 @@ //Double downLimit = Convert.ToDouble(dataGridViewX2.Rows[j].Cells["下限"].Value); if (upLimit == null && downLimit == null) continue;//空行过滤 //获取符合条件的管线 - FeaturesClassfyResult result = service.getPipesInfoByValueSection(polygon, layer, downLimit, upLimit, "起始埋深"); + FeaturesClassfyResult result = service.GetPipesInfoByValueSection(polygon, layer, downLimit, upLimit, "起始埋深"); DataGridViewRow row = new DataGridViewRow(); int index = dataGridViewX1.Rows.Add(row); row = dataGridViewX1.Rows[index]; diff --git a/Cyberpipe.suo b/Cyberpipe.suo index a56b834..2eccd5b 100644 --- a/Cyberpipe.suo +++ b/Cyberpipe.suo Binary files differ diff --git a/DoublePanelAnalysis.cs b/DoublePanelAnalysis.cs index 2c45db6..90466dd 100644 --- a/DoublePanelAnalysis.cs +++ b/DoublePanelAnalysis.cs @@ -776,7 +776,7 @@ if (caption == _pipelineLayerNames[i]) continue;//排除本图层 GSOLayer layer2 = globeControl1.Globe.Layers.GetLayerByCaption(_pipelineLayerNames[i]); if (layer2 == null) continue; - GSOFeatures feats2 = FeatureStatisticsService.getLayerFeatures(polygon, layer2); + GSOFeatures feats2 = FeatureStatisticsService.GetLayerFeatures(polygon, layer2); if (feats2 == null) continue; for (int j = 0; j < feats2.Length; j++) { @@ -819,7 +819,7 @@ if (caption == _pipelineLayerNames[i]) continue; GSOLayer layer2 = globeControl1.Globe.Layers.GetLayerByCaption(_pipelineLayerNames[i]); if (layer2 == null) continue; - GSOFeatures feats2 = FeatureStatisticsService.getLayerFeatures(polygon, layer2); + GSOFeatures feats2 = FeatureStatisticsService.GetLayerFeatures(polygon, layer2); for (int j = 0; j < feats2.Length; j++) { GSOFeature feat2 = feats2[j]; @@ -858,7 +858,7 @@ if (caption == _pipelineLayerNames[i]) continue;//排除本图层 GSOLayer layer2 = globeControl1.Globe.Layers.GetLayerByCaption(_pipelineLayerNames[i]); if (layer2 == null) continue; - GSOFeatures feats2 = FeatureStatisticsService.getLayerFeatures(polygon, layer2); + GSOFeatures feats2 = FeatureStatisticsService.GetLayerFeatures(polygon, layer2); if (feats2 == null) continue; for (int j = 0; j < feats2.Length; j++) { diff --git a/FeatureStatisticsService.cs b/FeatureStatisticsService.cs index fe32265..c147e55 100644 --- a/FeatureStatisticsService.cs +++ b/FeatureStatisticsService.cs @@ -48,7 +48,7 @@ /// ///附属物列表 /// - public Dictionary getFeatureCountByFeatures(GSOFeatures feats) + public Dictionary GetFeatureCountByFeatures(GSOFeatures feats) { if (feats == null || feats.Length == 0) return null; Dictionary result = new Dictionary(); @@ -64,13 +64,13 @@ /// /// /// - public FeaturesClassfyResult getPipesInfoByValueSection(GSOGeoPolygon3D polygon, GSOLayer layer, double? min, double? max, string fieldName) + public FeaturesClassfyResult GetPipesInfoByValueSection(GSOGeoPolygon3D polygon, GSOLayer layer, double? min, double? max, string fieldName) { if (layer == null) return null; FeaturesClassfyResult result = new FeaturesClassfyResult(); double totalLength = 0.0; int ncount = 0; - GSOFeatures features = getPipesByValueSection(polygon, layer, min, max, fieldName); + GSOFeatures features = GetPipesByValueSection(polygon, layer, min, max, fieldName); for (int i = 0; i < features.Length; i++) { GSOGeoPolyline3D line = features[i].Geometry as GSOGeoPolyline3D; @@ -98,7 +98,7 @@ /// 上限 /// 统计类型:"起始埋深"或"管径_毫米" /// - public GSOFeatures getPipesByValueSection(GSOGeoPolygon3D polygon, GSOLayer layer, double? min, double? max, string fieldName) + public GSOFeatures GetPipesByValueSection(GSOGeoPolygon3D polygon, GSOLayer layer, double? min, double? max, string fieldName) { if (layer == null) return null; GSOFeatures result = new GSOFeatures(); @@ -127,7 +127,7 @@ } //图层名称、管径、条数、总长度 - public List groupPipeByDiameter(GSOGeoPolygon3D polygon, GSOLayer layer) + public List GroupPipeByDiameter(GSOGeoPolygon3D polygon, GSOLayer layer) { if (layer == null) return null; List result = new List(); @@ -181,7 +181,7 @@ /// /// /// - public List groupAccessories(GSOGeoPolygon3D polygon, GSOLayer layer) + public List GroupAccessories(GSOGeoPolygon3D polygon, GSOLayer layer) { if (layer == null) return null; List result = new List(); @@ -230,7 +230,7 @@ /// /// 材质 /// - public FeaturesClassfyResult groupPipeByMaterial(GSOGeoPolygon3D polygon, GSOLayer layer, string material) + public FeaturesClassfyResult GroupPipeByMaterial(GSOGeoPolygon3D polygon, GSOLayer layer, string material) { if (layer == null) return null; FeaturesClassfyResult result = new FeaturesClassfyResult(); @@ -245,16 +245,12 @@ int ncount = 0; for (int i = 0; i < feats.Length; i++) { - if (feats[i].GetFieldAsString("材质").Equals(fixedMaterial)) - { - GSOGeoPolyline3D line = feats[i].Geometry as GSOGeoPolyline3D; - if (line != null) - { - double length = line.GetSpaceLength(true, 6378137); - totalLength += length; - ncount += 1; - } - } + if (!feats[i].GetFieldAsString("材质").Equals(fixedMaterial)) continue; + GSOGeoPolyline3D line = feats[i].Geometry as GSOGeoPolyline3D; + if (line == null) continue; + double length = line.GetSpaceLength(true, 6378137); + totalLength += length; + ncount += 1; } result.layerName = layer.Caption; @@ -271,12 +267,12 @@ /// /// 要统计的长度 /// - public static GSOFeatures getLayerPipes(GSOGeoPolygon3D polygon, GSOLayer layer, out double length) + public static GSOFeatures GetLayerPipes(GSOGeoPolygon3D polygon, GSOLayer layer, out double length) { length = 0; if (layer == null) return null; - GSOFeatures feats = getLayerFeatures(polygon, layer); + GSOFeatures feats = GetLayerFeatures(polygon, layer); double totallength = 0.00; for (int i = 0; i < feats.Length; i++) { @@ -298,10 +294,10 @@ /// /// /// - public static GSOFeatures getLayerFeatures(GSOGeoPolygon3D polygon, GSOLayer layer) + public static GSOFeatures GetLayerFeatures(GSOGeoPolygon3D polygon, GSOLayer layer) { - if (layer == null) return null; GSOFeatureLayer flayer = layer as GSOFeatureLayer; + if (flayer == null) return null; return polygon == null ? flayer.GetAllFeatures() : flayer.FindFeaturesInPolygon(polygon, false); } diff --git a/FrmAccessoriesgather.cs b/FrmAccessoriesgather.cs index c7787f7..e1d176e 100644 --- a/FrmAccessoriesgather.cs +++ b/FrmAccessoriesgather.cs @@ -213,7 +213,7 @@ { FeatureStatisticsService featureService = new FeatureStatisticsService(); GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(layertype); - List accessoriesResult = featureService.groupAccessories(polygon, layer); + List accessoriesResult = featureService.GroupAccessories(polygon, layer); if (accessoriesResult == null || accessoriesResult.Count == 0) { diff --git a/FrmAllPipelineStatis.cs b/FrmAllPipelineStatis.cs index 60805ba..0911557 100644 --- a/FrmAllPipelineStatis.cs +++ b/FrmAllPipelineStatis.cs @@ -205,7 +205,7 @@ { GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(pipeLayerNames[i]); double totalLength = 0.0; - GSOFeatures fs = FeatureStatisticsService.getLayerPipes(polygon, layer,out totalLength); + GSOFeatures fs = FeatureStatisticsService.GetLayerPipes(polygon, layer,out totalLength); if (fs == null) continue; nameAndPipeMap.Add(pipeLayerNames[i], fs); nameAndLengthMap.Add(pipeLayerNames[i],totalLength); diff --git a/FrmBSQStatis.cs b/FrmBSQStatis.cs index 6f7838f..dd63f62 100644 --- a/FrmBSQStatis.cs +++ b/FrmBSQStatis.cs @@ -108,7 +108,7 @@ public Dictionary getBSQMapByPolygon(GSOGeoPolygon3D polygon,Dictionary typeAndCount, Dictionary codeAndType) { GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption("标识器"); - GSOFeatures bsqFs = FeatureStatisticsService.getLayerFeatures(polygon, layer); + GSOFeatures bsqFs = FeatureStatisticsService.GetLayerFeatures(polygon, layer); if (bsqFs == null || bsqFs.Length <= 0) { LogHelper.WriteLog(typeof(FrmBSQStatis),"标识器图层下的Feature为空"); return null; diff --git a/FrmpipeDeepstatis.cs b/FrmpipeDeepstatis.cs index e00a1dc..6a5c895 100644 --- a/FrmpipeDeepstatis.cs +++ b/FrmpipeDeepstatis.cs @@ -148,7 +148,7 @@ //Double downLimit = Convert.ToDouble(dataGridViewX2.Rows[j].Cells["下限"].Value); if (upLimit == null && downLimit == null) continue;//空行过滤 //获取符合条件的管线 - FeaturesClassfyResult result = service.getPipesInfoByValueSection(polygon, layer, downLimit, upLimit, "起始埋深"); + FeaturesClassfyResult result = service.GetPipesInfoByValueSection(polygon, layer, downLimit, upLimit, "起始埋深"); DataGridViewRow row = new DataGridViewRow(); int index = dataGridViewX1.Rows.Add(row); row = dataGridViewX1.Rows[index]; diff --git a/FrmpipeDiametergather.cs b/FrmpipeDiametergather.cs index 132ab7f..a9d96fa 100644 --- a/FrmpipeDiametergather.cs +++ b/FrmpipeDiametergather.cs @@ -176,7 +176,7 @@ for (int i = 0; i < clbPipeLine.CheckedItems.Count; i++) { GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(clbPipeLine.CheckedItems[i].ToString()); - List results = service.groupPipeByDiameter(polygon,layer); + List results = service.GroupPipeByDiameter(polygon,layer); foreach(FeaturesClassfyResult result in results){ DataGridViewRow row = new DataGridViewRow(); diff --git a/Cyberpipe.suo b/Cyberpipe.suo index a56b834..2eccd5b 100644 --- a/Cyberpipe.suo +++ b/Cyberpipe.suo Binary files differ diff --git a/DoublePanelAnalysis.cs b/DoublePanelAnalysis.cs index 2c45db6..90466dd 100644 --- a/DoublePanelAnalysis.cs +++ b/DoublePanelAnalysis.cs @@ -776,7 +776,7 @@ if (caption == _pipelineLayerNames[i]) continue;//排除本图层 GSOLayer layer2 = globeControl1.Globe.Layers.GetLayerByCaption(_pipelineLayerNames[i]); if (layer2 == null) continue; - GSOFeatures feats2 = FeatureStatisticsService.getLayerFeatures(polygon, layer2); + GSOFeatures feats2 = FeatureStatisticsService.GetLayerFeatures(polygon, layer2); if (feats2 == null) continue; for (int j = 0; j < feats2.Length; j++) { @@ -819,7 +819,7 @@ if (caption == _pipelineLayerNames[i]) continue; GSOLayer layer2 = globeControl1.Globe.Layers.GetLayerByCaption(_pipelineLayerNames[i]); if (layer2 == null) continue; - GSOFeatures feats2 = FeatureStatisticsService.getLayerFeatures(polygon, layer2); + GSOFeatures feats2 = FeatureStatisticsService.GetLayerFeatures(polygon, layer2); for (int j = 0; j < feats2.Length; j++) { GSOFeature feat2 = feats2[j]; @@ -858,7 +858,7 @@ if (caption == _pipelineLayerNames[i]) continue;//排除本图层 GSOLayer layer2 = globeControl1.Globe.Layers.GetLayerByCaption(_pipelineLayerNames[i]); if (layer2 == null) continue; - GSOFeatures feats2 = FeatureStatisticsService.getLayerFeatures(polygon, layer2); + GSOFeatures feats2 = FeatureStatisticsService.GetLayerFeatures(polygon, layer2); if (feats2 == null) continue; for (int j = 0; j < feats2.Length; j++) { diff --git a/FeatureStatisticsService.cs b/FeatureStatisticsService.cs index fe32265..c147e55 100644 --- a/FeatureStatisticsService.cs +++ b/FeatureStatisticsService.cs @@ -48,7 +48,7 @@ /// ///附属物列表 /// - public Dictionary getFeatureCountByFeatures(GSOFeatures feats) + public Dictionary GetFeatureCountByFeatures(GSOFeatures feats) { if (feats == null || feats.Length == 0) return null; Dictionary result = new Dictionary(); @@ -64,13 +64,13 @@ /// /// /// - public FeaturesClassfyResult getPipesInfoByValueSection(GSOGeoPolygon3D polygon, GSOLayer layer, double? min, double? max, string fieldName) + public FeaturesClassfyResult GetPipesInfoByValueSection(GSOGeoPolygon3D polygon, GSOLayer layer, double? min, double? max, string fieldName) { if (layer == null) return null; FeaturesClassfyResult result = new FeaturesClassfyResult(); double totalLength = 0.0; int ncount = 0; - GSOFeatures features = getPipesByValueSection(polygon, layer, min, max, fieldName); + GSOFeatures features = GetPipesByValueSection(polygon, layer, min, max, fieldName); for (int i = 0; i < features.Length; i++) { GSOGeoPolyline3D line = features[i].Geometry as GSOGeoPolyline3D; @@ -98,7 +98,7 @@ /// 上限 /// 统计类型:"起始埋深"或"管径_毫米" /// - public GSOFeatures getPipesByValueSection(GSOGeoPolygon3D polygon, GSOLayer layer, double? min, double? max, string fieldName) + public GSOFeatures GetPipesByValueSection(GSOGeoPolygon3D polygon, GSOLayer layer, double? min, double? max, string fieldName) { if (layer == null) return null; GSOFeatures result = new GSOFeatures(); @@ -127,7 +127,7 @@ } //图层名称、管径、条数、总长度 - public List groupPipeByDiameter(GSOGeoPolygon3D polygon, GSOLayer layer) + public List GroupPipeByDiameter(GSOGeoPolygon3D polygon, GSOLayer layer) { if (layer == null) return null; List result = new List(); @@ -181,7 +181,7 @@ /// /// /// - public List groupAccessories(GSOGeoPolygon3D polygon, GSOLayer layer) + public List GroupAccessories(GSOGeoPolygon3D polygon, GSOLayer layer) { if (layer == null) return null; List result = new List(); @@ -230,7 +230,7 @@ /// /// 材质 /// - public FeaturesClassfyResult groupPipeByMaterial(GSOGeoPolygon3D polygon, GSOLayer layer, string material) + public FeaturesClassfyResult GroupPipeByMaterial(GSOGeoPolygon3D polygon, GSOLayer layer, string material) { if (layer == null) return null; FeaturesClassfyResult result = new FeaturesClassfyResult(); @@ -245,16 +245,12 @@ int ncount = 0; for (int i = 0; i < feats.Length; i++) { - if (feats[i].GetFieldAsString("材质").Equals(fixedMaterial)) - { - GSOGeoPolyline3D line = feats[i].Geometry as GSOGeoPolyline3D; - if (line != null) - { - double length = line.GetSpaceLength(true, 6378137); - totalLength += length; - ncount += 1; - } - } + if (!feats[i].GetFieldAsString("材质").Equals(fixedMaterial)) continue; + GSOGeoPolyline3D line = feats[i].Geometry as GSOGeoPolyline3D; + if (line == null) continue; + double length = line.GetSpaceLength(true, 6378137); + totalLength += length; + ncount += 1; } result.layerName = layer.Caption; @@ -271,12 +267,12 @@ /// /// 要统计的长度 /// - public static GSOFeatures getLayerPipes(GSOGeoPolygon3D polygon, GSOLayer layer, out double length) + public static GSOFeatures GetLayerPipes(GSOGeoPolygon3D polygon, GSOLayer layer, out double length) { length = 0; if (layer == null) return null; - GSOFeatures feats = getLayerFeatures(polygon, layer); + GSOFeatures feats = GetLayerFeatures(polygon, layer); double totallength = 0.00; for (int i = 0; i < feats.Length; i++) { @@ -298,10 +294,10 @@ /// /// /// - public static GSOFeatures getLayerFeatures(GSOGeoPolygon3D polygon, GSOLayer layer) + public static GSOFeatures GetLayerFeatures(GSOGeoPolygon3D polygon, GSOLayer layer) { - if (layer == null) return null; GSOFeatureLayer flayer = layer as GSOFeatureLayer; + if (flayer == null) return null; return polygon == null ? flayer.GetAllFeatures() : flayer.FindFeaturesInPolygon(polygon, false); } diff --git a/FrmAccessoriesgather.cs b/FrmAccessoriesgather.cs index c7787f7..e1d176e 100644 --- a/FrmAccessoriesgather.cs +++ b/FrmAccessoriesgather.cs @@ -213,7 +213,7 @@ { FeatureStatisticsService featureService = new FeatureStatisticsService(); GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(layertype); - List accessoriesResult = featureService.groupAccessories(polygon, layer); + List accessoriesResult = featureService.GroupAccessories(polygon, layer); if (accessoriesResult == null || accessoriesResult.Count == 0) { diff --git a/FrmAllPipelineStatis.cs b/FrmAllPipelineStatis.cs index 60805ba..0911557 100644 --- a/FrmAllPipelineStatis.cs +++ b/FrmAllPipelineStatis.cs @@ -205,7 +205,7 @@ { GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(pipeLayerNames[i]); double totalLength = 0.0; - GSOFeatures fs = FeatureStatisticsService.getLayerPipes(polygon, layer,out totalLength); + GSOFeatures fs = FeatureStatisticsService.GetLayerPipes(polygon, layer,out totalLength); if (fs == null) continue; nameAndPipeMap.Add(pipeLayerNames[i], fs); nameAndLengthMap.Add(pipeLayerNames[i],totalLength); diff --git a/FrmBSQStatis.cs b/FrmBSQStatis.cs index 6f7838f..dd63f62 100644 --- a/FrmBSQStatis.cs +++ b/FrmBSQStatis.cs @@ -108,7 +108,7 @@ public Dictionary getBSQMapByPolygon(GSOGeoPolygon3D polygon,Dictionary typeAndCount, Dictionary codeAndType) { GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption("标识器"); - GSOFeatures bsqFs = FeatureStatisticsService.getLayerFeatures(polygon, layer); + GSOFeatures bsqFs = FeatureStatisticsService.GetLayerFeatures(polygon, layer); if (bsqFs == null || bsqFs.Length <= 0) { LogHelper.WriteLog(typeof(FrmBSQStatis),"标识器图层下的Feature为空"); return null; diff --git a/FrmpipeDeepstatis.cs b/FrmpipeDeepstatis.cs index e00a1dc..6a5c895 100644 --- a/FrmpipeDeepstatis.cs +++ b/FrmpipeDeepstatis.cs @@ -148,7 +148,7 @@ //Double downLimit = Convert.ToDouble(dataGridViewX2.Rows[j].Cells["下限"].Value); if (upLimit == null && downLimit == null) continue;//空行过滤 //获取符合条件的管线 - FeaturesClassfyResult result = service.getPipesInfoByValueSection(polygon, layer, downLimit, upLimit, "起始埋深"); + FeaturesClassfyResult result = service.GetPipesInfoByValueSection(polygon, layer, downLimit, upLimit, "起始埋深"); DataGridViewRow row = new DataGridViewRow(); int index = dataGridViewX1.Rows.Add(row); row = dataGridViewX1.Rows[index]; diff --git a/FrmpipeDiametergather.cs b/FrmpipeDiametergather.cs index 132ab7f..a9d96fa 100644 --- a/FrmpipeDiametergather.cs +++ b/FrmpipeDiametergather.cs @@ -176,7 +176,7 @@ for (int i = 0; i < clbPipeLine.CheckedItems.Count; i++) { GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(clbPipeLine.CheckedItems[i].ToString()); - List results = service.groupPipeByDiameter(polygon,layer); + List results = service.GroupPipeByDiameter(polygon,layer); foreach(FeaturesClassfyResult result in results){ DataGridViewRow row = new DataGridViewRow(); diff --git a/FrmpipeMaterialGather.cs b/FrmpipeMaterialGather.cs index ec71951..44e7f24 100644 --- a/FrmpipeMaterialGather.cs +++ b/FrmpipeMaterialGather.cs @@ -164,7 +164,7 @@ for (int j = 0; j < clbmaterials.CheckedItems.Count; j++) { - FeaturesClassfyResult featureResult = featureService.groupPipeByMaterial(polygon, layer, clbmaterials.CheckedItems[j].ToString()); + FeaturesClassfyResult featureResult = featureService.GroupPipeByMaterial(polygon, layer, clbmaterials.CheckedItems[j].ToString()); DataGridViewRow row = new DataGridViewRow(); int index = dataGridViewX1.Rows.Add(row); row = dataGridViewX1.Rows[index]; diff --git a/Cyberpipe.suo b/Cyberpipe.suo index a56b834..2eccd5b 100644 --- a/Cyberpipe.suo +++ b/Cyberpipe.suo Binary files differ diff --git a/DoublePanelAnalysis.cs b/DoublePanelAnalysis.cs index 2c45db6..90466dd 100644 --- a/DoublePanelAnalysis.cs +++ b/DoublePanelAnalysis.cs @@ -776,7 +776,7 @@ if (caption == _pipelineLayerNames[i]) continue;//排除本图层 GSOLayer layer2 = globeControl1.Globe.Layers.GetLayerByCaption(_pipelineLayerNames[i]); if (layer2 == null) continue; - GSOFeatures feats2 = FeatureStatisticsService.getLayerFeatures(polygon, layer2); + GSOFeatures feats2 = FeatureStatisticsService.GetLayerFeatures(polygon, layer2); if (feats2 == null) continue; for (int j = 0; j < feats2.Length; j++) { @@ -819,7 +819,7 @@ if (caption == _pipelineLayerNames[i]) continue; GSOLayer layer2 = globeControl1.Globe.Layers.GetLayerByCaption(_pipelineLayerNames[i]); if (layer2 == null) continue; - GSOFeatures feats2 = FeatureStatisticsService.getLayerFeatures(polygon, layer2); + GSOFeatures feats2 = FeatureStatisticsService.GetLayerFeatures(polygon, layer2); for (int j = 0; j < feats2.Length; j++) { GSOFeature feat2 = feats2[j]; @@ -858,7 +858,7 @@ if (caption == _pipelineLayerNames[i]) continue;//排除本图层 GSOLayer layer2 = globeControl1.Globe.Layers.GetLayerByCaption(_pipelineLayerNames[i]); if (layer2 == null) continue; - GSOFeatures feats2 = FeatureStatisticsService.getLayerFeatures(polygon, layer2); + GSOFeatures feats2 = FeatureStatisticsService.GetLayerFeatures(polygon, layer2); if (feats2 == null) continue; for (int j = 0; j < feats2.Length; j++) { diff --git a/FeatureStatisticsService.cs b/FeatureStatisticsService.cs index fe32265..c147e55 100644 --- a/FeatureStatisticsService.cs +++ b/FeatureStatisticsService.cs @@ -48,7 +48,7 @@ /// ///附属物列表 /// - public Dictionary getFeatureCountByFeatures(GSOFeatures feats) + public Dictionary GetFeatureCountByFeatures(GSOFeatures feats) { if (feats == null || feats.Length == 0) return null; Dictionary result = new Dictionary(); @@ -64,13 +64,13 @@ /// /// /// - public FeaturesClassfyResult getPipesInfoByValueSection(GSOGeoPolygon3D polygon, GSOLayer layer, double? min, double? max, string fieldName) + public FeaturesClassfyResult GetPipesInfoByValueSection(GSOGeoPolygon3D polygon, GSOLayer layer, double? min, double? max, string fieldName) { if (layer == null) return null; FeaturesClassfyResult result = new FeaturesClassfyResult(); double totalLength = 0.0; int ncount = 0; - GSOFeatures features = getPipesByValueSection(polygon, layer, min, max, fieldName); + GSOFeatures features = GetPipesByValueSection(polygon, layer, min, max, fieldName); for (int i = 0; i < features.Length; i++) { GSOGeoPolyline3D line = features[i].Geometry as GSOGeoPolyline3D; @@ -98,7 +98,7 @@ /// 上限 /// 统计类型:"起始埋深"或"管径_毫米" /// - public GSOFeatures getPipesByValueSection(GSOGeoPolygon3D polygon, GSOLayer layer, double? min, double? max, string fieldName) + public GSOFeatures GetPipesByValueSection(GSOGeoPolygon3D polygon, GSOLayer layer, double? min, double? max, string fieldName) { if (layer == null) return null; GSOFeatures result = new GSOFeatures(); @@ -127,7 +127,7 @@ } //图层名称、管径、条数、总长度 - public List groupPipeByDiameter(GSOGeoPolygon3D polygon, GSOLayer layer) + public List GroupPipeByDiameter(GSOGeoPolygon3D polygon, GSOLayer layer) { if (layer == null) return null; List result = new List(); @@ -181,7 +181,7 @@ /// /// /// - public List groupAccessories(GSOGeoPolygon3D polygon, GSOLayer layer) + public List GroupAccessories(GSOGeoPolygon3D polygon, GSOLayer layer) { if (layer == null) return null; List result = new List(); @@ -230,7 +230,7 @@ /// /// 材质 /// - public FeaturesClassfyResult groupPipeByMaterial(GSOGeoPolygon3D polygon, GSOLayer layer, string material) + public FeaturesClassfyResult GroupPipeByMaterial(GSOGeoPolygon3D polygon, GSOLayer layer, string material) { if (layer == null) return null; FeaturesClassfyResult result = new FeaturesClassfyResult(); @@ -245,16 +245,12 @@ int ncount = 0; for (int i = 0; i < feats.Length; i++) { - if (feats[i].GetFieldAsString("材质").Equals(fixedMaterial)) - { - GSOGeoPolyline3D line = feats[i].Geometry as GSOGeoPolyline3D; - if (line != null) - { - double length = line.GetSpaceLength(true, 6378137); - totalLength += length; - ncount += 1; - } - } + if (!feats[i].GetFieldAsString("材质").Equals(fixedMaterial)) continue; + GSOGeoPolyline3D line = feats[i].Geometry as GSOGeoPolyline3D; + if (line == null) continue; + double length = line.GetSpaceLength(true, 6378137); + totalLength += length; + ncount += 1; } result.layerName = layer.Caption; @@ -271,12 +267,12 @@ /// /// 要统计的长度 /// - public static GSOFeatures getLayerPipes(GSOGeoPolygon3D polygon, GSOLayer layer, out double length) + public static GSOFeatures GetLayerPipes(GSOGeoPolygon3D polygon, GSOLayer layer, out double length) { length = 0; if (layer == null) return null; - GSOFeatures feats = getLayerFeatures(polygon, layer); + GSOFeatures feats = GetLayerFeatures(polygon, layer); double totallength = 0.00; for (int i = 0; i < feats.Length; i++) { @@ -298,10 +294,10 @@ /// /// /// - public static GSOFeatures getLayerFeatures(GSOGeoPolygon3D polygon, GSOLayer layer) + public static GSOFeatures GetLayerFeatures(GSOGeoPolygon3D polygon, GSOLayer layer) { - if (layer == null) return null; GSOFeatureLayer flayer = layer as GSOFeatureLayer; + if (flayer == null) return null; return polygon == null ? flayer.GetAllFeatures() : flayer.FindFeaturesInPolygon(polygon, false); } diff --git a/FrmAccessoriesgather.cs b/FrmAccessoriesgather.cs index c7787f7..e1d176e 100644 --- a/FrmAccessoriesgather.cs +++ b/FrmAccessoriesgather.cs @@ -213,7 +213,7 @@ { FeatureStatisticsService featureService = new FeatureStatisticsService(); GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(layertype); - List accessoriesResult = featureService.groupAccessories(polygon, layer); + List accessoriesResult = featureService.GroupAccessories(polygon, layer); if (accessoriesResult == null || accessoriesResult.Count == 0) { diff --git a/FrmAllPipelineStatis.cs b/FrmAllPipelineStatis.cs index 60805ba..0911557 100644 --- a/FrmAllPipelineStatis.cs +++ b/FrmAllPipelineStatis.cs @@ -205,7 +205,7 @@ { GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(pipeLayerNames[i]); double totalLength = 0.0; - GSOFeatures fs = FeatureStatisticsService.getLayerPipes(polygon, layer,out totalLength); + GSOFeatures fs = FeatureStatisticsService.GetLayerPipes(polygon, layer,out totalLength); if (fs == null) continue; nameAndPipeMap.Add(pipeLayerNames[i], fs); nameAndLengthMap.Add(pipeLayerNames[i],totalLength); diff --git a/FrmBSQStatis.cs b/FrmBSQStatis.cs index 6f7838f..dd63f62 100644 --- a/FrmBSQStatis.cs +++ b/FrmBSQStatis.cs @@ -108,7 +108,7 @@ public Dictionary getBSQMapByPolygon(GSOGeoPolygon3D polygon,Dictionary typeAndCount, Dictionary codeAndType) { GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption("标识器"); - GSOFeatures bsqFs = FeatureStatisticsService.getLayerFeatures(polygon, layer); + GSOFeatures bsqFs = FeatureStatisticsService.GetLayerFeatures(polygon, layer); if (bsqFs == null || bsqFs.Length <= 0) { LogHelper.WriteLog(typeof(FrmBSQStatis),"标识器图层下的Feature为空"); return null; diff --git a/FrmpipeDeepstatis.cs b/FrmpipeDeepstatis.cs index e00a1dc..6a5c895 100644 --- a/FrmpipeDeepstatis.cs +++ b/FrmpipeDeepstatis.cs @@ -148,7 +148,7 @@ //Double downLimit = Convert.ToDouble(dataGridViewX2.Rows[j].Cells["下限"].Value); if (upLimit == null && downLimit == null) continue;//空行过滤 //获取符合条件的管线 - FeaturesClassfyResult result = service.getPipesInfoByValueSection(polygon, layer, downLimit, upLimit, "起始埋深"); + FeaturesClassfyResult result = service.GetPipesInfoByValueSection(polygon, layer, downLimit, upLimit, "起始埋深"); DataGridViewRow row = new DataGridViewRow(); int index = dataGridViewX1.Rows.Add(row); row = dataGridViewX1.Rows[index]; diff --git a/FrmpipeDiametergather.cs b/FrmpipeDiametergather.cs index 132ab7f..a9d96fa 100644 --- a/FrmpipeDiametergather.cs +++ b/FrmpipeDiametergather.cs @@ -176,7 +176,7 @@ for (int i = 0; i < clbPipeLine.CheckedItems.Count; i++) { GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(clbPipeLine.CheckedItems[i].ToString()); - List results = service.groupPipeByDiameter(polygon,layer); + List results = service.GroupPipeByDiameter(polygon,layer); foreach(FeaturesClassfyResult result in results){ DataGridViewRow row = new DataGridViewRow(); diff --git a/FrmpipeMaterialGather.cs b/FrmpipeMaterialGather.cs index ec71951..44e7f24 100644 --- a/FrmpipeMaterialGather.cs +++ b/FrmpipeMaterialGather.cs @@ -164,7 +164,7 @@ for (int j = 0; j < clbmaterials.CheckedItems.Count; j++) { - FeaturesClassfyResult featureResult = featureService.groupPipeByMaterial(polygon, layer, clbmaterials.CheckedItems[j].ToString()); + FeaturesClassfyResult featureResult = featureService.GroupPipeByMaterial(polygon, layer, clbmaterials.CheckedItems[j].ToString()); DataGridViewRow row = new DataGridViewRow(); int index = dataGridViewX1.Rows.Add(row); row = dataGridViewX1.Rows[index]; diff --git a/Frmpipediameterstatis.cs b/Frmpipediameterstatis.cs index 2f5e00e..4fb25a8 100644 --- a/Frmpipediameterstatis.cs +++ b/Frmpipediameterstatis.cs @@ -184,7 +184,7 @@ if (tempDown != null) downLimit = Convert.ToDouble(tempDown); if (upLimit == null && downLimit == null) continue;//空行过滤 //获取符合条件的管线 - FeaturesClassfyResult result = service.getPipesInfoByValueSection(polygon, layer, downLimit, upLimit, "管径_毫米"); + FeaturesClassfyResult result = service.GetPipesInfoByValueSection(polygon, layer, downLimit, upLimit, "管径_毫米"); DataGridViewRow row = new DataGridViewRow(); int index = dataGridViewX1.Rows.Add(row); row = dataGridViewX1.Rows[index]; diff --git a/Cyberpipe.suo b/Cyberpipe.suo index a56b834..2eccd5b 100644 --- a/Cyberpipe.suo +++ b/Cyberpipe.suo Binary files differ diff --git a/DoublePanelAnalysis.cs b/DoublePanelAnalysis.cs index 2c45db6..90466dd 100644 --- a/DoublePanelAnalysis.cs +++ b/DoublePanelAnalysis.cs @@ -776,7 +776,7 @@ if (caption == _pipelineLayerNames[i]) continue;//排除本图层 GSOLayer layer2 = globeControl1.Globe.Layers.GetLayerByCaption(_pipelineLayerNames[i]); if (layer2 == null) continue; - GSOFeatures feats2 = FeatureStatisticsService.getLayerFeatures(polygon, layer2); + GSOFeatures feats2 = FeatureStatisticsService.GetLayerFeatures(polygon, layer2); if (feats2 == null) continue; for (int j = 0; j < feats2.Length; j++) { @@ -819,7 +819,7 @@ if (caption == _pipelineLayerNames[i]) continue; GSOLayer layer2 = globeControl1.Globe.Layers.GetLayerByCaption(_pipelineLayerNames[i]); if (layer2 == null) continue; - GSOFeatures feats2 = FeatureStatisticsService.getLayerFeatures(polygon, layer2); + GSOFeatures feats2 = FeatureStatisticsService.GetLayerFeatures(polygon, layer2); for (int j = 0; j < feats2.Length; j++) { GSOFeature feat2 = feats2[j]; @@ -858,7 +858,7 @@ if (caption == _pipelineLayerNames[i]) continue;//排除本图层 GSOLayer layer2 = globeControl1.Globe.Layers.GetLayerByCaption(_pipelineLayerNames[i]); if (layer2 == null) continue; - GSOFeatures feats2 = FeatureStatisticsService.getLayerFeatures(polygon, layer2); + GSOFeatures feats2 = FeatureStatisticsService.GetLayerFeatures(polygon, layer2); if (feats2 == null) continue; for (int j = 0; j < feats2.Length; j++) { diff --git a/FeatureStatisticsService.cs b/FeatureStatisticsService.cs index fe32265..c147e55 100644 --- a/FeatureStatisticsService.cs +++ b/FeatureStatisticsService.cs @@ -48,7 +48,7 @@ /// ///附属物列表 /// - public Dictionary getFeatureCountByFeatures(GSOFeatures feats) + public Dictionary GetFeatureCountByFeatures(GSOFeatures feats) { if (feats == null || feats.Length == 0) return null; Dictionary result = new Dictionary(); @@ -64,13 +64,13 @@ /// /// /// - public FeaturesClassfyResult getPipesInfoByValueSection(GSOGeoPolygon3D polygon, GSOLayer layer, double? min, double? max, string fieldName) + public FeaturesClassfyResult GetPipesInfoByValueSection(GSOGeoPolygon3D polygon, GSOLayer layer, double? min, double? max, string fieldName) { if (layer == null) return null; FeaturesClassfyResult result = new FeaturesClassfyResult(); double totalLength = 0.0; int ncount = 0; - GSOFeatures features = getPipesByValueSection(polygon, layer, min, max, fieldName); + GSOFeatures features = GetPipesByValueSection(polygon, layer, min, max, fieldName); for (int i = 0; i < features.Length; i++) { GSOGeoPolyline3D line = features[i].Geometry as GSOGeoPolyline3D; @@ -98,7 +98,7 @@ /// 上限 /// 统计类型:"起始埋深"或"管径_毫米" /// - public GSOFeatures getPipesByValueSection(GSOGeoPolygon3D polygon, GSOLayer layer, double? min, double? max, string fieldName) + public GSOFeatures GetPipesByValueSection(GSOGeoPolygon3D polygon, GSOLayer layer, double? min, double? max, string fieldName) { if (layer == null) return null; GSOFeatures result = new GSOFeatures(); @@ -127,7 +127,7 @@ } //图层名称、管径、条数、总长度 - public List groupPipeByDiameter(GSOGeoPolygon3D polygon, GSOLayer layer) + public List GroupPipeByDiameter(GSOGeoPolygon3D polygon, GSOLayer layer) { if (layer == null) return null; List result = new List(); @@ -181,7 +181,7 @@ /// /// /// - public List groupAccessories(GSOGeoPolygon3D polygon, GSOLayer layer) + public List GroupAccessories(GSOGeoPolygon3D polygon, GSOLayer layer) { if (layer == null) return null; List result = new List(); @@ -230,7 +230,7 @@ /// /// 材质 /// - public FeaturesClassfyResult groupPipeByMaterial(GSOGeoPolygon3D polygon, GSOLayer layer, string material) + public FeaturesClassfyResult GroupPipeByMaterial(GSOGeoPolygon3D polygon, GSOLayer layer, string material) { if (layer == null) return null; FeaturesClassfyResult result = new FeaturesClassfyResult(); @@ -245,16 +245,12 @@ int ncount = 0; for (int i = 0; i < feats.Length; i++) { - if (feats[i].GetFieldAsString("材质").Equals(fixedMaterial)) - { - GSOGeoPolyline3D line = feats[i].Geometry as GSOGeoPolyline3D; - if (line != null) - { - double length = line.GetSpaceLength(true, 6378137); - totalLength += length; - ncount += 1; - } - } + if (!feats[i].GetFieldAsString("材质").Equals(fixedMaterial)) continue; + GSOGeoPolyline3D line = feats[i].Geometry as GSOGeoPolyline3D; + if (line == null) continue; + double length = line.GetSpaceLength(true, 6378137); + totalLength += length; + ncount += 1; } result.layerName = layer.Caption; @@ -271,12 +267,12 @@ /// /// 要统计的长度 /// - public static GSOFeatures getLayerPipes(GSOGeoPolygon3D polygon, GSOLayer layer, out double length) + public static GSOFeatures GetLayerPipes(GSOGeoPolygon3D polygon, GSOLayer layer, out double length) { length = 0; if (layer == null) return null; - GSOFeatures feats = getLayerFeatures(polygon, layer); + GSOFeatures feats = GetLayerFeatures(polygon, layer); double totallength = 0.00; for (int i = 0; i < feats.Length; i++) { @@ -298,10 +294,10 @@ /// /// /// - public static GSOFeatures getLayerFeatures(GSOGeoPolygon3D polygon, GSOLayer layer) + public static GSOFeatures GetLayerFeatures(GSOGeoPolygon3D polygon, GSOLayer layer) { - if (layer == null) return null; GSOFeatureLayer flayer = layer as GSOFeatureLayer; + if (flayer == null) return null; return polygon == null ? flayer.GetAllFeatures() : flayer.FindFeaturesInPolygon(polygon, false); } diff --git a/FrmAccessoriesgather.cs b/FrmAccessoriesgather.cs index c7787f7..e1d176e 100644 --- a/FrmAccessoriesgather.cs +++ b/FrmAccessoriesgather.cs @@ -213,7 +213,7 @@ { FeatureStatisticsService featureService = new FeatureStatisticsService(); GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(layertype); - List accessoriesResult = featureService.groupAccessories(polygon, layer); + List accessoriesResult = featureService.GroupAccessories(polygon, layer); if (accessoriesResult == null || accessoriesResult.Count == 0) { diff --git a/FrmAllPipelineStatis.cs b/FrmAllPipelineStatis.cs index 60805ba..0911557 100644 --- a/FrmAllPipelineStatis.cs +++ b/FrmAllPipelineStatis.cs @@ -205,7 +205,7 @@ { GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(pipeLayerNames[i]); double totalLength = 0.0; - GSOFeatures fs = FeatureStatisticsService.getLayerPipes(polygon, layer,out totalLength); + GSOFeatures fs = FeatureStatisticsService.GetLayerPipes(polygon, layer,out totalLength); if (fs == null) continue; nameAndPipeMap.Add(pipeLayerNames[i], fs); nameAndLengthMap.Add(pipeLayerNames[i],totalLength); diff --git a/FrmBSQStatis.cs b/FrmBSQStatis.cs index 6f7838f..dd63f62 100644 --- a/FrmBSQStatis.cs +++ b/FrmBSQStatis.cs @@ -108,7 +108,7 @@ public Dictionary getBSQMapByPolygon(GSOGeoPolygon3D polygon,Dictionary typeAndCount, Dictionary codeAndType) { GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption("标识器"); - GSOFeatures bsqFs = FeatureStatisticsService.getLayerFeatures(polygon, layer); + GSOFeatures bsqFs = FeatureStatisticsService.GetLayerFeatures(polygon, layer); if (bsqFs == null || bsqFs.Length <= 0) { LogHelper.WriteLog(typeof(FrmBSQStatis),"标识器图层下的Feature为空"); return null; diff --git a/FrmpipeDeepstatis.cs b/FrmpipeDeepstatis.cs index e00a1dc..6a5c895 100644 --- a/FrmpipeDeepstatis.cs +++ b/FrmpipeDeepstatis.cs @@ -148,7 +148,7 @@ //Double downLimit = Convert.ToDouble(dataGridViewX2.Rows[j].Cells["下限"].Value); if (upLimit == null && downLimit == null) continue;//空行过滤 //获取符合条件的管线 - FeaturesClassfyResult result = service.getPipesInfoByValueSection(polygon, layer, downLimit, upLimit, "起始埋深"); + FeaturesClassfyResult result = service.GetPipesInfoByValueSection(polygon, layer, downLimit, upLimit, "起始埋深"); DataGridViewRow row = new DataGridViewRow(); int index = dataGridViewX1.Rows.Add(row); row = dataGridViewX1.Rows[index]; diff --git a/FrmpipeDiametergather.cs b/FrmpipeDiametergather.cs index 132ab7f..a9d96fa 100644 --- a/FrmpipeDiametergather.cs +++ b/FrmpipeDiametergather.cs @@ -176,7 +176,7 @@ for (int i = 0; i < clbPipeLine.CheckedItems.Count; i++) { GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(clbPipeLine.CheckedItems[i].ToString()); - List results = service.groupPipeByDiameter(polygon,layer); + List results = service.GroupPipeByDiameter(polygon,layer); foreach(FeaturesClassfyResult result in results){ DataGridViewRow row = new DataGridViewRow(); diff --git a/FrmpipeMaterialGather.cs b/FrmpipeMaterialGather.cs index ec71951..44e7f24 100644 --- a/FrmpipeMaterialGather.cs +++ b/FrmpipeMaterialGather.cs @@ -164,7 +164,7 @@ for (int j = 0; j < clbmaterials.CheckedItems.Count; j++) { - FeaturesClassfyResult featureResult = featureService.groupPipeByMaterial(polygon, layer, clbmaterials.CheckedItems[j].ToString()); + FeaturesClassfyResult featureResult = featureService.GroupPipeByMaterial(polygon, layer, clbmaterials.CheckedItems[j].ToString()); DataGridViewRow row = new DataGridViewRow(); int index = dataGridViewX1.Rows.Add(row); row = dataGridViewX1.Rows[index]; diff --git a/Frmpipediameterstatis.cs b/Frmpipediameterstatis.cs index 2f5e00e..4fb25a8 100644 --- a/Frmpipediameterstatis.cs +++ b/Frmpipediameterstatis.cs @@ -184,7 +184,7 @@ if (tempDown != null) downLimit = Convert.ToDouble(tempDown); if (upLimit == null && downLimit == null) continue;//空行过滤 //获取符合条件的管线 - FeaturesClassfyResult result = service.getPipesInfoByValueSection(polygon, layer, downLimit, upLimit, "管径_毫米"); + FeaturesClassfyResult result = service.GetPipesInfoByValueSection(polygon, layer, downLimit, upLimit, "管径_毫米"); DataGridViewRow row = new DataGridViewRow(); int index = dataGridViewX1.Rows.Add(row); row = dataGridViewX1.Rows[index]; diff --git a/MainFrm.cs b/MainFrm.cs index ad9e1c7..f4bd7ca 100644 --- a/MainFrm.cs +++ b/MainFrm.cs @@ -1321,7 +1321,6 @@ #endregion - //Dictionary Utility.dictionaryNetLayerNameAndCaption = new Dictionary(); void globeControl1_AfterNetLayerAddEvent(object sender, AfterNetLayerAddEventArgs e) { if (e.Layer != null && Utility.dictionaryNetLayerNameAndCaption.ContainsKey(e.Layer.Caption)) @@ -1372,7 +1371,7 @@ tempnode.Text = feature.Name; tempnode.ImageIndex = 1; tempnode.SelectedImageIndex = 1; - tempnode.Checked = node.Checked ? feature.Visible : false; + tempnode.Checked = node.Checked && feature.Visible; tempnode.Tag = feature; node.Nodes.Add(tempnode); GSOFeatureFolder featureFolder = (GSOFeatureFolder) feature; @@ -1380,8 +1379,7 @@ } else { - TreeNode tempnode = new TreeNode(); - tempnode.Text = feature.Name; + TreeNode tempnode = new TreeNode {Text = feature.Name}; if (feature.Geometry != null) { switch (feature.Geometry.Type) @@ -1422,7 +1420,7 @@ } } - tempnode.Checked = node.Checked ? feature.Visible : false; + tempnode.Checked = node.Checked && feature.Visible; tempnode.Tag = feature; node.Nodes.Add(tempnode); } @@ -1583,7 +1581,6 @@ layerTree.SelectedNode = e.Node; if (e.Node.Tag == null || e.Node.Parent == null) return; //排除无图层节点和第一级节点 - //来自locaserver的数据,直接返回就行了,目前只有一个180fd,暂时单独处理 GSOLayer gsoLayer = e.Node.Tag as GSOLayer; if (gsoLayer == null || gsoLayer.Caption.Equals(Utility.roadLayerName)) return; if (e.Node.Parent.Text.Equals("临时图层") || e.Node.Parent.Text.Equals("我的地标")) @@ -1606,7 +1603,7 @@ } } - + //wxl Tag更正 /// /// 删除临时添加的本地数据图层 /// @@ -1633,7 +1630,7 @@ } } - + //wxl Tag更正 private void 可编辑ToolStripMenuItem_Click(object sender, EventArgs e) { TreeNode node = layerTree.SelectedNode; @@ -1644,17 +1641,16 @@ 可编辑ToolStripMenuItem.Checked = !可编辑ToolStripMenuItem.Checked; layer.Editable = 可编辑ToolStripMenuItem.Checked; } - + //wxl Tag更正 private void 保存ToolStripMenuItem_Click(object sender, EventArgs e) { -// TreeNode node = contextMenuStripDeleteLayerNode.Tag as TreeNode; TreeNode node = layerTree.SelectedNode; if (node == null||node.Tag==null) return; GSOLayer layer = node.Tag as GSOLayer; if (layer == null) return; layer.Dataset.Save(); } - //TODO LIST: wxl? Tag更正 + //wxl Tag更正 private void 定位ToolStripMenuItem_Click(object sender, EventArgs e) { TreeNode node = layerTree.SelectedNode; @@ -1697,7 +1693,7 @@ } } } - //TODO LIST: wxl? Tag更正 + //wxl Tag更正 private void layerTree_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e) { TreeNode node = layerTree.SelectedNode; @@ -2234,7 +2230,7 @@ { WebRequest req = WebRequest.Create(fileUrl); response = req.GetResponse(); - result = response == null ? false : true; + result = true; } catch (Exception ex) { @@ -2253,20 +2249,14 @@ string featureIDFieldName = "编号"; private bool isFeatureContainsBianhao(GSOFeature feature) { - bool isContains = true; - if (feature.GetFieldDefn("编号") == null && feature.GetFieldDefn("标识器编号") == null) - { - isContains = false; - } - else if (feature.GetFieldDefn("标识器编号") != null) + if (feature.GetFieldDefn("标识器编号") != null) { featureIDFieldName = "标识器编号"; + return true; } - else if (feature.GetFieldDefn("编号") != null) - { - featureIDFieldName = "编号"; - } - return isContains; + if (feature.GetFieldDefn("编号") == null) return false; + featureIDFieldName = "编号"; + return true; } /// @@ -2362,9 +2352,8 @@ { if (Utility.listPipelineType != null) { - for (int i = 0; i < Utility.listPipelineType.Count; i++) + foreach (PipelineType pipelineType in Utility.listPipelineType) { - PipelineType pipelineType = Utility.listPipelineType[i]; if (pipelineType == null || pipelineType.code.Trim() != pipelinecode.Trim()) continue; title = pipelineType.type + " " + pipelineType.name; if (pipelineType.type == pipelineType.name) @@ -2524,78 +2513,6 @@ return str; } - /// - /// 获取目标图层 - /// - /// -// private GSOLayer TreeNodeFeatureLayer() -// { -// TreeNode featureAddPipeFitTreenode = GetDestLayerFeatureAddTreeNode(); -// GSOLayer featureAddLayer = globeControl1.Globe.Layers.GetLayerByCaption(featureAddPipeFitTreenode.Tag.ToString().Split('|')[1]); -// -// return featureAddLayer; -// } - //TODO LIST: wxl11? 待更正,Node的Tag现在都已经统一为gsolayer对象了 -// private TreeNode GetDestLayerFeatureAddTreeNode() -// { -// for (int i = 0; i < layerTree.Nodes.Count; i++) -// { -// TreeNode tempNode = layerTree.Nodes[i]; -// for (int j = 0; j < tempNode.Nodes.Count; j++) -// { -// TreeNode tempChildNode = tempNode.Nodes[j]; -// if (tempChildNode.Tag.ToString().Split('|').Length > 1) // Config配置文件配置的图层 -// {//本层节点Tag记录layer -// GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(tempChildNode.Tag.ToString().Split('|')[1]); -// if (layer == null) -// { -// continue; -// } -// if (tempChildNode.Tag != null && layer.IsDestLayerFeatureAdd()) -// { -// return tempChildNode; -// } -// } -// else //临时添加的本地图层 -// {//子层节点的Tag记录layer -// for (int m = 0; m < tempChildNode.Nodes.Count; m++) -// { -// TreeNode tempChildNode1 = tempChildNode.Nodes[m]; -// if (tempChildNode1.Tag.ToString().Split('|').Length > 1) -// { -// GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(tempChildNode1.Tag.ToString().Split('|')[1]); -// if (layer == null) -// { -// continue; -// } -// if (tempChildNode1.Tag != null && layer.IsDestLayerFeatureAdd()) -// { -// return tempChildNode1; -// } -// } -// else -// { -// for (int n = 0; n < tempChildNode1.Nodes.Count; n++) -// { -// TreeNode tempChildNode2 = tempChildNode1.Nodes[n]; -// if (tempChildNode2.Tag.ToString().Split('|').Length <= 1) continue; -// GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(tempChildNode2.Tag.ToString().Split('|')[1]); -// if (layer == null) -// { -// continue; -// } -// if (tempChildNode2.Tag != null && layer.IsDestLayerFeatureAdd()) -// { -// return tempChildNode2; -// } -// } -// } -// } -// } -// } -// } -// return null; -// } private GSOLayer TreeNodeFeatureLayer() { TreeNode featureAddPipeFitTreenode = GetDestLayerFeatureAddTreeNode(); @@ -2613,9 +2530,19 @@ { foreach (TreeNode node in layerTreeNode.Nodes) { - GSOLayer gsoLayer = node.Tag as GSOLayer; - if (gsoLayer != null && gsoLayer.IsDestLayerFeatureAdd()) return node; - + if (node.Tag == null & node.Nodes.Count > 0) + { + foreach (TreeNode nodeNode in node.Nodes) + { + GSOLayer gsoLayer = nodeNode.Tag as GSOLayer; + if (gsoLayer != null && gsoLayer.IsDestLayerFeatureAdd()) return nodeNode; + } + } + else + { + GSOLayer gsoLayer = node.Tag as GSOLayer; + if (gsoLayer != null && gsoLayer.IsDestLayerFeatureAdd()) return node; + } } } else @@ -3036,7 +2963,7 @@ } } } - //TODO LIST: wxl? Tag更正 + //wxl Tag更正 /// /// 图层目录树 右键菜单中的 目标图层 菜单 /// @@ -3047,12 +2974,11 @@ if (FeatureAddLayerMenuItem.Checked) return; TreeNode node = layerNodeContexMenu.Tag as TreeNode; FeatureAddLayerMenuItem.Checked = true; -// GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(node.Tag.ToString().Split('|')[1]); if (node == null) return; GSOLayer layer = node.Tag as GSOLayer; globeControl1.Globe.DestLayerFeatureAdd = layer; } - //TODO LIST: wxl? Tag更正 + //wxl Tag更正 /// /// 图层目录树 右键菜单中的 可选择 菜单 /// @@ -3061,13 +2987,12 @@ private void LayerSelectableMenuItem_Click(object sender, EventArgs e) { TreeNode node = layerNodeContexMenu.Tag as TreeNode; -// GSOLayer layer = globeControl1.Globe.Layers[nIndex]; if (node == null) return; GSOLayer layer = node.Tag as GSOLayer; LayerSelectableMenuItem.Checked = !LayerSelectableMenuItem.Checked; if (layer != null) layer.Selectable = LayerSelectableMenuItem.Checked; } - //TODO LIST: wxl? Tag更正 + //wxl Tag更正 /// /// 图层目录树 右键菜单中的 可编辑 菜单 /// @@ -3076,7 +3001,6 @@ private void LayerEditableMenuItem_Click(object sender, EventArgs e) { TreeNode node = layerNodeContexMenu.Tag as TreeNode; -// GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(node.Tag.ToString().Split('|')[1]); if (node == null) return; GSOLayer layer = node.Tag as GSOLayer; LayerEditableMenuItem.Checked = !LayerEditableMenuItem.Checked; @@ -3087,36 +3011,15 @@ /// /// /// - //TODO LIST: wxl? Tag更正 + //wxl Tag更正 private void SaveLayerMenuItem_Click(object sender, EventArgs e) { TreeNode node = layerNodeContexMenu.Tag as TreeNode; - -// string layerCaption = node.Tag.ToString().Split('|')[1]; -// GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(layerCaption); if (node == null) return; GSOLayer layer = node.Tag as GSOLayer; if (layer != null) layer.Dataset.Save(); } - #region wxl feature的公共方法 - /// - /// 查找指定图层中在 指定范围内的feature对象集合 - /// - /// - /// - /// - private GSOFeatures Polygon_Contain_PointAnalysis(GSOGeoPolygon3D polygon, string layername) - { - GSOFeatures feats = new GSOFeatures(); - GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(layername); - if (layer == null)return feats; - GSOFeatureLayer flayer = layer as GSOFeatureLayer; - if (flayer == null) return feats; - feats = polygon == null ? flayer.GetAllFeatures() : flayer.FindFeaturesInPolygon(polygon, false); - return feats; - } - #endregion /// /// 清除结果 菜单 /// @@ -3313,7 +3216,7 @@ Dictionary featCount = new Dictionary(); Dictionary featLenth = new Dictionary(); Dictionary m_FeaturesWithBianhao = new Dictionary();//记录编号和对应的标注点的位置 - //GSOFeatures polygonJingJuAnalysises = new GSOFeatures(); + /// /// 垂直净距分析 功能界面中的 开始分析按钮 事件处理 /// @@ -3417,10 +3320,10 @@ return new GSOPoint3d(); } GSOGeoPolyline3D disline = new GSOGeoPolyline3D(); - GSOPoint3ds point3ds = new GSOPoint3ds(); - point3ds.Add(pntIntersect1); - point3ds.Add(pntIntersect2); - disline.AddPart(point3ds); + GSOPoint3ds point3Ds = new GSOPoint3ds(); + point3Ds.Add(pntIntersect1); + point3Ds.Add(pntIntersect2); + disline.AddPart(point3Ds); GSOSimpleLineStyle3D style = new GSOSimpleLineStyle3D(); //创建线的风格 //设置透明度及颜色,FromArgb()中的四个参数分别为alpha、red、green、blue,取值范围为0到255 style.LineColor = Color.GreenYellow; @@ -3497,15 +3400,12 @@ GSOPoint3d pntProIntersect2 = new GSOPoint3d(); for (int i = 0; i < _pipelineLayerNames.Count; i++) { - if (caption == _pipelineLayerNames[i]) - { - continue; - } + if (caption == _pipelineLayerNames[i]) continue; GSOLayer layer2 = globeControl1.Globe.Layers.GetLayerByCaption(_pipelineLayerNames[i]); if (layer2 == null) continue; - GSOFeatureLayer flayer2 = layer2 as GSOFeatureLayer; - GSOFeatureDataset fdataset2 = flayer2.Dataset as GSOFeatureDataset; - GSOFeatures feats2 = Polygon_Contain_PointAnalysis(polygon, _pipelineLayerNames[i]); + GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(_pipelineLayerNames[i]); + GSOFeatures feats2 = FeatureStatisticsService.GetLayerFeatures(polygon,layer); + if (feats2 == null) continue; for (int j = 0; j < feats2.Length; j++) { GSOFeature feat2 = feats2[j]; @@ -3923,9 +3823,8 @@ else if (checkBoxX4.Checked) // 选择图层 { GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(comboBoxEx2.SelectedItem.ToString()); - if (layer == null) return; - GSOFeatureLayer flayer = layer as GSOFeatureLayer; + if (flayer == null) return; //GSOFeatureDataset fdataset = flayer.Dataset as GSOFeatureDataset; GSOFeatures feats = flayer.GetAllFeatures(); for (int i = 0; i < feats.Length; i++) @@ -3937,11 +3836,11 @@ if (featCount.Count > 0) { - for (int i = 0; i < Utility.m_PipelineLayerNames.Count; i++) + foreach (string pipelineLayer in Utility.m_PipelineLayerNames) { - if (featCount.ContainsKey(Utility.m_PipelineLayerNames[i]) && featLenth.ContainsKey(Utility.m_PipelineLayerNames[i])) + if (featCount.ContainsKey(pipelineLayer) && featLenth.ContainsKey(pipelineLayer)) { - listBox2.Items.Add(Utility.m_PipelineLayerNames[i] + ":" + featCount[Utility.m_PipelineLayerNames[i]] + "条,共" + featLenth[Utility.m_PipelineLayerNames[i]].ToString("0.00") + "米"); + listBox2.Items.Add(pipelineLayer + ":" + featCount[pipelineLayer] + "条,共" + featLenth[pipelineLayer].ToString("0.00") + "米"); } } } @@ -4037,7 +3936,6 @@ return; GSOFeatureLayer flayer = layer as GSOFeatureLayer; - GSOFeatureDataset fdataset = flayer.Dataset as GSOFeatureDataset; GSOFeatures feats = flayer.GetAllFeatures(); for (int i = 0; i < feats.Length; i++) @@ -4078,8 +3976,6 @@ clearFeatureHighLight(); Cursor = Cursors.WaitCursor; - - GSOPoint3d markerPosition = new GSOPoint3d(); if (checkBoxX5.Checked) // 覆土分析 选择管线 { for (int i = 0; i < dataGridViewX6.Rows.Count; i++) @@ -4116,7 +4012,7 @@ pt.X = pts[m].X; pt.Y = pts[m].Y; pt.Z = 0; - markerPosition = LabelVerticalDistance(layerTemp, pts[m], pt, Convert.ToDouble(dataGridViewX7.Rows[idx].Cells[2].Value), true); + LabelVerticalDistance(layerTemp, pts[m], pt, Convert.ToDouble(dataGridViewX7.Rows[idx].Cells[2].Value), true); break; } } @@ -4125,24 +4021,14 @@ else if (checkBoxX6.Checked) // 覆土分析 选择图层 { GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(comboBoxEx3.SelectedItem.ToString()); - if (layer == null) - return; - GSOFeatureLayer flayer = layer as GSOFeatureLayer; - GSOFeatureDataset fdataset = flayer.Dataset as GSOFeatureDataset; + if (flayer == null)return; GSOFeatures feats = flayer.GetAllFeatures(); for (int i = 0; i < feats.Length; i++) { GSOFeature f = feats[i]; string featureName = ""; - if (isFeatureContainsBianhao(feats[i])) - { - featureName = feats[i].GetValue(featureIDFieldName).ToString(); - } - else - { - featureName = feats[i].Name; - } + featureName = isFeatureContainsBianhao(feats[i]) ? feats[i].GetValue(featureIDFieldName).ToString() : feats[i].Name; GSOGeoPolyline3D line = f.Geometry as GSOGeoPolyline3D; if (line == null) continue; GSOPipeLineStyle3D style = line.Style as GSOPipeLineStyle3D; @@ -4163,7 +4049,7 @@ pt.X = pts[m].X; pt.Y = pts[m].Y; pt.Z = 0; - markerPosition = LabelVerticalDistance(layerTemp, pts[m], pt, Convert.ToDouble(dataGridViewX7.Rows[idx].Cells[2].Value), true); + LabelVerticalDistance(layerTemp, pts[m], pt, Convert.ToDouble(dataGridViewX7.Rows[idx].Cells[2].Value), true); break; } @@ -4197,11 +4083,12 @@ if (rowFeature.Geometry != null && rowFeature.Geometry.Type == EnumGeometryType.GeoPolyline3D) { GSOGeoPolyline3D line = rowFeature.Geometry as GSOGeoPolyline3D; + if (line == null) return; double length = line.GetSpaceLength(true, 6378137); GSOGeoPolyline3D lineLine = line.GetSegment(0, length / 2); - GSOPoint3d point3d = lineLine[lineLine.PartCount - 1][lineLine[lineLine.PartCount - 1].Count - 1]; + GSOPoint3d point3D = lineLine[lineLine.PartCount - 1][lineLine[lineLine.PartCount - 1].Count - 1]; - globeControl1.Globe.JumpToPosition(point3d, EnumAltitudeMode.Absolute, 5); + globeControl1.Globe.JumpToPosition(point3D, EnumAltitudeMode.Absolute, 5); } else { @@ -4376,8 +4263,7 @@ dlg.FileName = type + "-" + DateTime.Now.ToString("yyyyMMdd") + ".xls"; if (dlg.ShowDialog() == DialogResult.OK) { - Stream myStream; - myStream = dlg.OpenFile(); + Stream myStream = dlg.OpenFile(); StreamWriter sw = new StreamWriter(myStream, Encoding.GetEncoding(-0)); string columnTitle = ""; try @@ -4542,7 +4428,6 @@ return; GSOFeatureLayer flayer = layer as GSOFeatureLayer; - GSOFeatureDataset fdataset = flayer.Dataset as GSOFeatureDataset; GSOFeatures feats = flayer.GetAllFeatures(); for (int i = 0; i < feats.Length; i++) { @@ -4586,7 +4471,6 @@ if (globeControl1.Globe.Action == EnumAction3D.SelectObject) { globeControl1.Globe.Action = EnumAction3D.ActionNull; - //globeControl1.Globe.Action = EnumAction3D.SelectObject; } } /// @@ -4852,6 +4736,7 @@ if (rowFeature.Geometry != null && rowFeature.Geometry.Type == EnumGeometryType.GeoPolyline3D) { GSOGeoPolyline3D line = rowFeature.Geometry as GSOGeoPolyline3D; + if (line == null) return; double length = line.GetSpaceLength(true, 6378137); GSOGeoPolyline3D lineLine = line.GetSegment(0, length / 2); GSOPoint3d point3d = lineLine[lineLine.PartCount - 1][lineLine[lineLine.PartCount - 1].Count - 1]; @@ -4923,9 +4808,6 @@ dataGridViewAnalysisResult.Rows.Clear(); listBoxStasticsResult.Items.Clear(); GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(comboBoxLayer.SelectedItem.ToString()); - if (layer == null) - return; - GSOFeatureLayer flayer = layer as GSOFeatureLayer; if (flayer == null) return; @@ -5232,56 +5114,50 @@ private object AddLayerData(string strDataPath) { object objRes = null; - if (Path.GetExtension(strDataPath).ToLower().Equals(".kml")) + string extension = Path.GetExtension(strDataPath); + if (extension != null && extension.ToLower().Equals(".kml")) { GSOLayer layer = globeControl1.Globe.Layers.Add(strDataPath); objRes = layer; - if (layer != null) - { - CheckDatasetGeoReference(layer.Dataset, ""); - TreeNode node = new TreeNode(); - node.Tag = layer; - node.Text = layer.Dataset.Caption; - node.ImageIndex = 0; - node.SelectedImageIndex = 0; - node.Checked = layer.Visible; - layerManagerNode.Nodes.Insert(0, node); - } + if (layer == null) return objRes; + CheckDatasetGeoReference(layer.Dataset, ""); + TreeNode node = new TreeNode(); + node.Tag = layer; + node.Text = layer.Dataset.Caption; + node.ImageIndex = 0; + node.SelectedImageIndex = 0; + node.Checked = layer.Visible; + layerManagerNode.Nodes.Insert(0, node); newlayername = layer.Caption; } else if (GSOUtility.IsDatasetSupportTerrain(strDataPath)) { GSOTerrain terrain = globeControl1.Globe.Terrains.Add(strDataPath); objRes = terrain; - if (terrain != null) - { - TreeNode node = new TreeNode(); - node.Tag = terrain; - node.Text = terrain.Caption; - node.ImageIndex = 0; - node.SelectedImageIndex = 0; - node.Checked = terrain.Visible; - layerManagerNode.Nodes.Insert(0, node); - } + if (terrain == null) return objRes; + TreeNode node = new TreeNode(); + node.Tag = terrain; + node.Text = terrain.Caption; + node.ImageIndex = 0; + node.SelectedImageIndex = 0; + node.Checked = terrain.Visible; + layerManagerNode.Nodes.Insert(0, node); newlayername = terrain.Caption; } - else if (Path.GetExtension(strDataPath).ToLower().Equals(".dxf")) + else if (extension != null && extension.ToLower().Equals(".dxf")) { GSOLayer layer = globeControl1.Globe.Layers.Add(strDataPath); objRes = layer; - if (layer != null) - { - GSODataset dataset = layer.Dataset; - CheckDatasetGeoReference(layer.Dataset, strDataPath); - CheckDatasetGeoReference(layer.Dataset, strDataPath); - TreeNode node = new TreeNode(); - node.Tag = layer; - node.Text = layer.Dataset.Caption; - node.ImageIndex = 0; - node.SelectedImageIndex = 0; - node.Checked = layer.Visible; - layerManagerNode.Nodes.Insert(0, node); - } + if (layer == null) return objRes; + CheckDatasetGeoReference(layer.Dataset, strDataPath); + CheckDatasetGeoReference(layer.Dataset, strDataPath); + TreeNode node = new TreeNode(); + node.Tag = layer; + node.Text = layer.Dataset.Caption; + node.ImageIndex = 0; + node.SelectedImageIndex = 0; + node.Checked = layer.Visible; + layerManagerNode.Nodes.Insert(0, node); newlayername = layer.Caption; } else @@ -5290,8 +5166,10 @@ objRes = layer; if (layer == null) + { MessageBox.Show("layer is null"); - + return objRes; + } CheckDatasetGeoReference(layer.Dataset, strDataPath); TreeNode node = new TreeNode(); node.Tag = layer; @@ -5300,7 +5178,6 @@ node.SelectedImageIndex = 0; node.Checked = layer.Visible; layerManagerNode.Nodes.Insert(0, node); - newlayername = layer.Caption; } return objRes; @@ -5342,27 +5219,6 @@ layerManagerNode.Nodes.Insert(0, node); layerManagerNode.Expand(); } - /// - /// 获取指定图层中最后一个feature对象的名称对应的整数 - /// - /// - /// -// public int getLabelName(GSOLayer layer) -// { -// int nid = -1; -// if (layer.GetAllFeatures().Length > 0) -// { -// string id = layer.GetAllFeatures()[layer.GetAllFeatures().Length - 1].Name; -// -// int.TryParse(id, out nid); -// } -// else -// { -// nid = 0; -// } -// return nid; -// } - /// /// 图层节点树中 节点 右键单击事件处理 @@ -5371,39 +5227,33 @@ /// private void layerMarkerTree_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e) { - if (e.Button == MouseButtons.Right) + if (e.Button != MouseButtons.Right||e.Node.Parent==null) return; + if (e.Node.Parent.Text.Equals("标注管理") ) { - if (e.Node.Text == "标注管理" || e.Node.Text == "传感器管理") - return; - if (e.Node.Parent.Text == "标注管理") + layerMarkerTree.SelectedNode = e.Node; + contextMenuStrip2.Show(layerMarkerTree, e.X, e.Y); + contextMenuStrip2.Tag = e.Node; + } + else if (e.Node.Parent.Text.Equals("传感器管理")) + { + layerSensorTree.SelectedNode = e.Node; + contextMenuStrip2.Show(layerSensorTree, e.X, e.Y); + contextMenuStrip2.Tag = e.Node; + } + else + { + if (!(e.Node.Tag is GSOFeature)||e.Node.Parent.Parent==null) return; + if (e.Node.Parent.Parent.Text.Equals("标注管理")) { layerMarkerTree.SelectedNode = e.Node; - contextMenuStrip2.Show(layerMarkerTree, e.X, e.Y); - contextMenuStrip2.Tag = e.Node; + contextMenuStrip3.Show(layerMarkerTree, e.X, e.Y); + contextMenuStrip3.Tag = e.Node; } - else if (e.Node.Parent.Text == "传感器管理") + else if (e.Node.Parent.Parent.Text.Equals("传感器管理")) { layerSensorTree.SelectedNode = e.Node; - contextMenuStrip2.Show(layerSensorTree, e.X, e.Y); - contextMenuStrip2.Tag = e.Node; - } - else - { - if (e.Node.Tag is GSOFeature) - { - if (e.Node.Parent.Parent.Text == "标注管理") - { - layerMarkerTree.SelectedNode = e.Node; - contextMenuStrip3.Show(layerMarkerTree, e.X, e.Y); - contextMenuStrip3.Tag = e.Node; - } - else if (e.Node.Parent.Parent.Text == "传感器管理") - { - layerSensorTree.SelectedNode = e.Node; - contextMenuStrip3.Show(layerSensorTree, e.X, e.Y); - contextMenuStrip3.Tag = e.Node; - } - } + contextMenuStrip3.Show(layerSensorTree, e.X, e.Y); + contextMenuStrip3.Tag = e.Node; } } } @@ -5415,16 +5265,15 @@ private void toolStripMenuItem1_Click(object sender, EventArgs e) { TreeNode node = contextMenuStrip2.Tag as TreeNode; + if (node == null) return; TreeNode parentNode = node.Parent; - if (parentNode.Text == "标注管理" || parentNode.Text == "传感器管理") + if (parentNode.Text.Equals("标注管理") || parentNode.Text.Equals("传感器管理")) { RefreshTreeNodeLayerFeatureList(node); } } - #region wxl? VisitFeature3Ds的作用,重构后,是否对其有影响 - /// /// 给指定的图层节点添加代表feature对象的子节点 /// @@ -5439,8 +5288,6 @@ VisitFeature3Ds(layer.GetAllFeatures(), layerTreeNode); } } - - #endregion /// /// 标注管理、传感器管理 图层目录树的右键菜单中的 移除所有 菜单 @@ -5451,9 +5298,9 @@ { TreeNode node = contextMenuStrip3.Tag as TreeNode; if (node == null) return; - GSOFeature feature3d = node.Tag as GSOFeature; - if (feature3d == null) return; - feature3d.Delete(); + GSOFeature feature3D = node.Tag as GSOFeature; + if (feature3D == null) return; + feature3D.Delete(); globeControl1.Globe.Refresh(); node.Remove(); } @@ -5625,21 +5472,6 @@ shlayername = frmSh.rukuLayer.Name; globeControl1.Refresh(); } - //#region wxl 下面unreachable - //if (frmShResult != null && !frmShResult.IsDisposed) - //{ - // try - // { - // clearFeatureHighLight(); - // ClearRedlineAnalyseResult(); - // frmShResult.Close(); - // } - // catch (Exception ex) - // { - // MessageBox.Show(ex.Message); - // } - //} - //#endregion wxl frmShResult = new FrmShResult(dVerticalJingJuBiaoZhun, dHorizontalJingJuBiaoZhun, shlayername, globeControl1, Utility.m_PipelineLayerNames); @@ -6043,10 +5875,6 @@ NetworkAnalysisTool.ClearAllTopAnalysis(globeControl1); -// GSOFeatures feats = globeControl1.Globe.MemoryLayer.GetFeatureByName("粒子要素", true); -// if (feats.Length > 0) -// globeControl1.Globe.MemoryLayer.RemoveFeatureByID(feats[0].ID); - globeControl1.Globe.UnderGroundFloor.Visible = false;//隐藏地下网格线 // ClearUpDownTraceAnalysis(); //清除上下游分析 @@ -7196,8 +7024,8 @@ //日志记录 LogManager.saveLog(Utility.userName, buttonItemXT4_2.Text); - FrmAppUSER appUSER = new FrmAppUSER(); - appUSER.ShowDialog(); + FrmAppUSER appUser = new FrmAppUSER(); + appUser.ShowDialog(); } /// /// 增加人员 @@ -7209,8 +7037,8 @@ //日志记录 LogManager.saveLog(Utility.userName, buttonItemXT4_1.Text); - FrmAppUSERRESET appUSERRESET = new FrmAppUSERRESET(); - appUSERRESET.ShowDialog(); + FrmAppUSERRESET appUserReset = new FrmAppUSERRESET(); + appUserReset.ShowDialog(); } /// /// 热点功能统计 @@ -8499,7 +8327,7 @@ GSOLayer lyr = globeControl1.Globe.Layers.GetLayerByCaption(newlayername); if (newlayername != "") { - GSOFeatures features = lyr.GetAllFeatures(); + lyr.GetAllFeatures(); GSORect2d rd = lyr.LatLonBounds; GSOPoint2d rdcenter = rd.Center; diff --git a/Cyberpipe.suo b/Cyberpipe.suo index a56b834..2eccd5b 100644 --- a/Cyberpipe.suo +++ b/Cyberpipe.suo Binary files differ diff --git a/DoublePanelAnalysis.cs b/DoublePanelAnalysis.cs index 2c45db6..90466dd 100644 --- a/DoublePanelAnalysis.cs +++ b/DoublePanelAnalysis.cs @@ -776,7 +776,7 @@ if (caption == _pipelineLayerNames[i]) continue;//排除本图层 GSOLayer layer2 = globeControl1.Globe.Layers.GetLayerByCaption(_pipelineLayerNames[i]); if (layer2 == null) continue; - GSOFeatures feats2 = FeatureStatisticsService.getLayerFeatures(polygon, layer2); + GSOFeatures feats2 = FeatureStatisticsService.GetLayerFeatures(polygon, layer2); if (feats2 == null) continue; for (int j = 0; j < feats2.Length; j++) { @@ -819,7 +819,7 @@ if (caption == _pipelineLayerNames[i]) continue; GSOLayer layer2 = globeControl1.Globe.Layers.GetLayerByCaption(_pipelineLayerNames[i]); if (layer2 == null) continue; - GSOFeatures feats2 = FeatureStatisticsService.getLayerFeatures(polygon, layer2); + GSOFeatures feats2 = FeatureStatisticsService.GetLayerFeatures(polygon, layer2); for (int j = 0; j < feats2.Length; j++) { GSOFeature feat2 = feats2[j]; @@ -858,7 +858,7 @@ if (caption == _pipelineLayerNames[i]) continue;//排除本图层 GSOLayer layer2 = globeControl1.Globe.Layers.GetLayerByCaption(_pipelineLayerNames[i]); if (layer2 == null) continue; - GSOFeatures feats2 = FeatureStatisticsService.getLayerFeatures(polygon, layer2); + GSOFeatures feats2 = FeatureStatisticsService.GetLayerFeatures(polygon, layer2); if (feats2 == null) continue; for (int j = 0; j < feats2.Length; j++) { diff --git a/FeatureStatisticsService.cs b/FeatureStatisticsService.cs index fe32265..c147e55 100644 --- a/FeatureStatisticsService.cs +++ b/FeatureStatisticsService.cs @@ -48,7 +48,7 @@ /// ///附属物列表 /// - public Dictionary getFeatureCountByFeatures(GSOFeatures feats) + public Dictionary GetFeatureCountByFeatures(GSOFeatures feats) { if (feats == null || feats.Length == 0) return null; Dictionary result = new Dictionary(); @@ -64,13 +64,13 @@ /// /// /// - public FeaturesClassfyResult getPipesInfoByValueSection(GSOGeoPolygon3D polygon, GSOLayer layer, double? min, double? max, string fieldName) + public FeaturesClassfyResult GetPipesInfoByValueSection(GSOGeoPolygon3D polygon, GSOLayer layer, double? min, double? max, string fieldName) { if (layer == null) return null; FeaturesClassfyResult result = new FeaturesClassfyResult(); double totalLength = 0.0; int ncount = 0; - GSOFeatures features = getPipesByValueSection(polygon, layer, min, max, fieldName); + GSOFeatures features = GetPipesByValueSection(polygon, layer, min, max, fieldName); for (int i = 0; i < features.Length; i++) { GSOGeoPolyline3D line = features[i].Geometry as GSOGeoPolyline3D; @@ -98,7 +98,7 @@ /// 上限 /// 统计类型:"起始埋深"或"管径_毫米" /// - public GSOFeatures getPipesByValueSection(GSOGeoPolygon3D polygon, GSOLayer layer, double? min, double? max, string fieldName) + public GSOFeatures GetPipesByValueSection(GSOGeoPolygon3D polygon, GSOLayer layer, double? min, double? max, string fieldName) { if (layer == null) return null; GSOFeatures result = new GSOFeatures(); @@ -127,7 +127,7 @@ } //图层名称、管径、条数、总长度 - public List groupPipeByDiameter(GSOGeoPolygon3D polygon, GSOLayer layer) + public List GroupPipeByDiameter(GSOGeoPolygon3D polygon, GSOLayer layer) { if (layer == null) return null; List result = new List(); @@ -181,7 +181,7 @@ /// /// /// - public List groupAccessories(GSOGeoPolygon3D polygon, GSOLayer layer) + public List GroupAccessories(GSOGeoPolygon3D polygon, GSOLayer layer) { if (layer == null) return null; List result = new List(); @@ -230,7 +230,7 @@ /// /// 材质 /// - public FeaturesClassfyResult groupPipeByMaterial(GSOGeoPolygon3D polygon, GSOLayer layer, string material) + public FeaturesClassfyResult GroupPipeByMaterial(GSOGeoPolygon3D polygon, GSOLayer layer, string material) { if (layer == null) return null; FeaturesClassfyResult result = new FeaturesClassfyResult(); @@ -245,16 +245,12 @@ int ncount = 0; for (int i = 0; i < feats.Length; i++) { - if (feats[i].GetFieldAsString("材质").Equals(fixedMaterial)) - { - GSOGeoPolyline3D line = feats[i].Geometry as GSOGeoPolyline3D; - if (line != null) - { - double length = line.GetSpaceLength(true, 6378137); - totalLength += length; - ncount += 1; - } - } + if (!feats[i].GetFieldAsString("材质").Equals(fixedMaterial)) continue; + GSOGeoPolyline3D line = feats[i].Geometry as GSOGeoPolyline3D; + if (line == null) continue; + double length = line.GetSpaceLength(true, 6378137); + totalLength += length; + ncount += 1; } result.layerName = layer.Caption; @@ -271,12 +267,12 @@ /// /// 要统计的长度 /// - public static GSOFeatures getLayerPipes(GSOGeoPolygon3D polygon, GSOLayer layer, out double length) + public static GSOFeatures GetLayerPipes(GSOGeoPolygon3D polygon, GSOLayer layer, out double length) { length = 0; if (layer == null) return null; - GSOFeatures feats = getLayerFeatures(polygon, layer); + GSOFeatures feats = GetLayerFeatures(polygon, layer); double totallength = 0.00; for (int i = 0; i < feats.Length; i++) { @@ -298,10 +294,10 @@ /// /// /// - public static GSOFeatures getLayerFeatures(GSOGeoPolygon3D polygon, GSOLayer layer) + public static GSOFeatures GetLayerFeatures(GSOGeoPolygon3D polygon, GSOLayer layer) { - if (layer == null) return null; GSOFeatureLayer flayer = layer as GSOFeatureLayer; + if (flayer == null) return null; return polygon == null ? flayer.GetAllFeatures() : flayer.FindFeaturesInPolygon(polygon, false); } diff --git a/FrmAccessoriesgather.cs b/FrmAccessoriesgather.cs index c7787f7..e1d176e 100644 --- a/FrmAccessoriesgather.cs +++ b/FrmAccessoriesgather.cs @@ -213,7 +213,7 @@ { FeatureStatisticsService featureService = new FeatureStatisticsService(); GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(layertype); - List accessoriesResult = featureService.groupAccessories(polygon, layer); + List accessoriesResult = featureService.GroupAccessories(polygon, layer); if (accessoriesResult == null || accessoriesResult.Count == 0) { diff --git a/FrmAllPipelineStatis.cs b/FrmAllPipelineStatis.cs index 60805ba..0911557 100644 --- a/FrmAllPipelineStatis.cs +++ b/FrmAllPipelineStatis.cs @@ -205,7 +205,7 @@ { GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(pipeLayerNames[i]); double totalLength = 0.0; - GSOFeatures fs = FeatureStatisticsService.getLayerPipes(polygon, layer,out totalLength); + GSOFeatures fs = FeatureStatisticsService.GetLayerPipes(polygon, layer,out totalLength); if (fs == null) continue; nameAndPipeMap.Add(pipeLayerNames[i], fs); nameAndLengthMap.Add(pipeLayerNames[i],totalLength); diff --git a/FrmBSQStatis.cs b/FrmBSQStatis.cs index 6f7838f..dd63f62 100644 --- a/FrmBSQStatis.cs +++ b/FrmBSQStatis.cs @@ -108,7 +108,7 @@ public Dictionary getBSQMapByPolygon(GSOGeoPolygon3D polygon,Dictionary typeAndCount, Dictionary codeAndType) { GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption("标识器"); - GSOFeatures bsqFs = FeatureStatisticsService.getLayerFeatures(polygon, layer); + GSOFeatures bsqFs = FeatureStatisticsService.GetLayerFeatures(polygon, layer); if (bsqFs == null || bsqFs.Length <= 0) { LogHelper.WriteLog(typeof(FrmBSQStatis),"标识器图层下的Feature为空"); return null; diff --git a/FrmpipeDeepstatis.cs b/FrmpipeDeepstatis.cs index e00a1dc..6a5c895 100644 --- a/FrmpipeDeepstatis.cs +++ b/FrmpipeDeepstatis.cs @@ -148,7 +148,7 @@ //Double downLimit = Convert.ToDouble(dataGridViewX2.Rows[j].Cells["下限"].Value); if (upLimit == null && downLimit == null) continue;//空行过滤 //获取符合条件的管线 - FeaturesClassfyResult result = service.getPipesInfoByValueSection(polygon, layer, downLimit, upLimit, "起始埋深"); + FeaturesClassfyResult result = service.GetPipesInfoByValueSection(polygon, layer, downLimit, upLimit, "起始埋深"); DataGridViewRow row = new DataGridViewRow(); int index = dataGridViewX1.Rows.Add(row); row = dataGridViewX1.Rows[index]; diff --git a/FrmpipeDiametergather.cs b/FrmpipeDiametergather.cs index 132ab7f..a9d96fa 100644 --- a/FrmpipeDiametergather.cs +++ b/FrmpipeDiametergather.cs @@ -176,7 +176,7 @@ for (int i = 0; i < clbPipeLine.CheckedItems.Count; i++) { GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(clbPipeLine.CheckedItems[i].ToString()); - List results = service.groupPipeByDiameter(polygon,layer); + List results = service.GroupPipeByDiameter(polygon,layer); foreach(FeaturesClassfyResult result in results){ DataGridViewRow row = new DataGridViewRow(); diff --git a/FrmpipeMaterialGather.cs b/FrmpipeMaterialGather.cs index ec71951..44e7f24 100644 --- a/FrmpipeMaterialGather.cs +++ b/FrmpipeMaterialGather.cs @@ -164,7 +164,7 @@ for (int j = 0; j < clbmaterials.CheckedItems.Count; j++) { - FeaturesClassfyResult featureResult = featureService.groupPipeByMaterial(polygon, layer, clbmaterials.CheckedItems[j].ToString()); + FeaturesClassfyResult featureResult = featureService.GroupPipeByMaterial(polygon, layer, clbmaterials.CheckedItems[j].ToString()); DataGridViewRow row = new DataGridViewRow(); int index = dataGridViewX1.Rows.Add(row); row = dataGridViewX1.Rows[index]; diff --git a/Frmpipediameterstatis.cs b/Frmpipediameterstatis.cs index 2f5e00e..4fb25a8 100644 --- a/Frmpipediameterstatis.cs +++ b/Frmpipediameterstatis.cs @@ -184,7 +184,7 @@ if (tempDown != null) downLimit = Convert.ToDouble(tempDown); if (upLimit == null && downLimit == null) continue;//空行过滤 //获取符合条件的管线 - FeaturesClassfyResult result = service.getPipesInfoByValueSection(polygon, layer, downLimit, upLimit, "管径_毫米"); + FeaturesClassfyResult result = service.GetPipesInfoByValueSection(polygon, layer, downLimit, upLimit, "管径_毫米"); DataGridViewRow row = new DataGridViewRow(); int index = dataGridViewX1.Rows.Add(row); row = dataGridViewX1.Rows[index]; diff --git a/MainFrm.cs b/MainFrm.cs index ad9e1c7..f4bd7ca 100644 --- a/MainFrm.cs +++ b/MainFrm.cs @@ -1321,7 +1321,6 @@ #endregion - //Dictionary Utility.dictionaryNetLayerNameAndCaption = new Dictionary(); void globeControl1_AfterNetLayerAddEvent(object sender, AfterNetLayerAddEventArgs e) { if (e.Layer != null && Utility.dictionaryNetLayerNameAndCaption.ContainsKey(e.Layer.Caption)) @@ -1372,7 +1371,7 @@ tempnode.Text = feature.Name; tempnode.ImageIndex = 1; tempnode.SelectedImageIndex = 1; - tempnode.Checked = node.Checked ? feature.Visible : false; + tempnode.Checked = node.Checked && feature.Visible; tempnode.Tag = feature; node.Nodes.Add(tempnode); GSOFeatureFolder featureFolder = (GSOFeatureFolder) feature; @@ -1380,8 +1379,7 @@ } else { - TreeNode tempnode = new TreeNode(); - tempnode.Text = feature.Name; + TreeNode tempnode = new TreeNode {Text = feature.Name}; if (feature.Geometry != null) { switch (feature.Geometry.Type) @@ -1422,7 +1420,7 @@ } } - tempnode.Checked = node.Checked ? feature.Visible : false; + tempnode.Checked = node.Checked && feature.Visible; tempnode.Tag = feature; node.Nodes.Add(tempnode); } @@ -1583,7 +1581,6 @@ layerTree.SelectedNode = e.Node; if (e.Node.Tag == null || e.Node.Parent == null) return; //排除无图层节点和第一级节点 - //来自locaserver的数据,直接返回就行了,目前只有一个180fd,暂时单独处理 GSOLayer gsoLayer = e.Node.Tag as GSOLayer; if (gsoLayer == null || gsoLayer.Caption.Equals(Utility.roadLayerName)) return; if (e.Node.Parent.Text.Equals("临时图层") || e.Node.Parent.Text.Equals("我的地标")) @@ -1606,7 +1603,7 @@ } } - + //wxl Tag更正 /// /// 删除临时添加的本地数据图层 /// @@ -1633,7 +1630,7 @@ } } - + //wxl Tag更正 private void 可编辑ToolStripMenuItem_Click(object sender, EventArgs e) { TreeNode node = layerTree.SelectedNode; @@ -1644,17 +1641,16 @@ 可编辑ToolStripMenuItem.Checked = !可编辑ToolStripMenuItem.Checked; layer.Editable = 可编辑ToolStripMenuItem.Checked; } - + //wxl Tag更正 private void 保存ToolStripMenuItem_Click(object sender, EventArgs e) { -// TreeNode node = contextMenuStripDeleteLayerNode.Tag as TreeNode; TreeNode node = layerTree.SelectedNode; if (node == null||node.Tag==null) return; GSOLayer layer = node.Tag as GSOLayer; if (layer == null) return; layer.Dataset.Save(); } - //TODO LIST: wxl? Tag更正 + //wxl Tag更正 private void 定位ToolStripMenuItem_Click(object sender, EventArgs e) { TreeNode node = layerTree.SelectedNode; @@ -1697,7 +1693,7 @@ } } } - //TODO LIST: wxl? Tag更正 + //wxl Tag更正 private void layerTree_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e) { TreeNode node = layerTree.SelectedNode; @@ -2234,7 +2230,7 @@ { WebRequest req = WebRequest.Create(fileUrl); response = req.GetResponse(); - result = response == null ? false : true; + result = true; } catch (Exception ex) { @@ -2253,20 +2249,14 @@ string featureIDFieldName = "编号"; private bool isFeatureContainsBianhao(GSOFeature feature) { - bool isContains = true; - if (feature.GetFieldDefn("编号") == null && feature.GetFieldDefn("标识器编号") == null) - { - isContains = false; - } - else if (feature.GetFieldDefn("标识器编号") != null) + if (feature.GetFieldDefn("标识器编号") != null) { featureIDFieldName = "标识器编号"; + return true; } - else if (feature.GetFieldDefn("编号") != null) - { - featureIDFieldName = "编号"; - } - return isContains; + if (feature.GetFieldDefn("编号") == null) return false; + featureIDFieldName = "编号"; + return true; } /// @@ -2362,9 +2352,8 @@ { if (Utility.listPipelineType != null) { - for (int i = 0; i < Utility.listPipelineType.Count; i++) + foreach (PipelineType pipelineType in Utility.listPipelineType) { - PipelineType pipelineType = Utility.listPipelineType[i]; if (pipelineType == null || pipelineType.code.Trim() != pipelinecode.Trim()) continue; title = pipelineType.type + " " + pipelineType.name; if (pipelineType.type == pipelineType.name) @@ -2524,78 +2513,6 @@ return str; } - /// - /// 获取目标图层 - /// - /// -// private GSOLayer TreeNodeFeatureLayer() -// { -// TreeNode featureAddPipeFitTreenode = GetDestLayerFeatureAddTreeNode(); -// GSOLayer featureAddLayer = globeControl1.Globe.Layers.GetLayerByCaption(featureAddPipeFitTreenode.Tag.ToString().Split('|')[1]); -// -// return featureAddLayer; -// } - //TODO LIST: wxl11? 待更正,Node的Tag现在都已经统一为gsolayer对象了 -// private TreeNode GetDestLayerFeatureAddTreeNode() -// { -// for (int i = 0; i < layerTree.Nodes.Count; i++) -// { -// TreeNode tempNode = layerTree.Nodes[i]; -// for (int j = 0; j < tempNode.Nodes.Count; j++) -// { -// TreeNode tempChildNode = tempNode.Nodes[j]; -// if (tempChildNode.Tag.ToString().Split('|').Length > 1) // Config配置文件配置的图层 -// {//本层节点Tag记录layer -// GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(tempChildNode.Tag.ToString().Split('|')[1]); -// if (layer == null) -// { -// continue; -// } -// if (tempChildNode.Tag != null && layer.IsDestLayerFeatureAdd()) -// { -// return tempChildNode; -// } -// } -// else //临时添加的本地图层 -// {//子层节点的Tag记录layer -// for (int m = 0; m < tempChildNode.Nodes.Count; m++) -// { -// TreeNode tempChildNode1 = tempChildNode.Nodes[m]; -// if (tempChildNode1.Tag.ToString().Split('|').Length > 1) -// { -// GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(tempChildNode1.Tag.ToString().Split('|')[1]); -// if (layer == null) -// { -// continue; -// } -// if (tempChildNode1.Tag != null && layer.IsDestLayerFeatureAdd()) -// { -// return tempChildNode1; -// } -// } -// else -// { -// for (int n = 0; n < tempChildNode1.Nodes.Count; n++) -// { -// TreeNode tempChildNode2 = tempChildNode1.Nodes[n]; -// if (tempChildNode2.Tag.ToString().Split('|').Length <= 1) continue; -// GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(tempChildNode2.Tag.ToString().Split('|')[1]); -// if (layer == null) -// { -// continue; -// } -// if (tempChildNode2.Tag != null && layer.IsDestLayerFeatureAdd()) -// { -// return tempChildNode2; -// } -// } -// } -// } -// } -// } -// } -// return null; -// } private GSOLayer TreeNodeFeatureLayer() { TreeNode featureAddPipeFitTreenode = GetDestLayerFeatureAddTreeNode(); @@ -2613,9 +2530,19 @@ { foreach (TreeNode node in layerTreeNode.Nodes) { - GSOLayer gsoLayer = node.Tag as GSOLayer; - if (gsoLayer != null && gsoLayer.IsDestLayerFeatureAdd()) return node; - + if (node.Tag == null & node.Nodes.Count > 0) + { + foreach (TreeNode nodeNode in node.Nodes) + { + GSOLayer gsoLayer = nodeNode.Tag as GSOLayer; + if (gsoLayer != null && gsoLayer.IsDestLayerFeatureAdd()) return nodeNode; + } + } + else + { + GSOLayer gsoLayer = node.Tag as GSOLayer; + if (gsoLayer != null && gsoLayer.IsDestLayerFeatureAdd()) return node; + } } } else @@ -3036,7 +2963,7 @@ } } } - //TODO LIST: wxl? Tag更正 + //wxl Tag更正 /// /// 图层目录树 右键菜单中的 目标图层 菜单 /// @@ -3047,12 +2974,11 @@ if (FeatureAddLayerMenuItem.Checked) return; TreeNode node = layerNodeContexMenu.Tag as TreeNode; FeatureAddLayerMenuItem.Checked = true; -// GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(node.Tag.ToString().Split('|')[1]); if (node == null) return; GSOLayer layer = node.Tag as GSOLayer; globeControl1.Globe.DestLayerFeatureAdd = layer; } - //TODO LIST: wxl? Tag更正 + //wxl Tag更正 /// /// 图层目录树 右键菜单中的 可选择 菜单 /// @@ -3061,13 +2987,12 @@ private void LayerSelectableMenuItem_Click(object sender, EventArgs e) { TreeNode node = layerNodeContexMenu.Tag as TreeNode; -// GSOLayer layer = globeControl1.Globe.Layers[nIndex]; if (node == null) return; GSOLayer layer = node.Tag as GSOLayer; LayerSelectableMenuItem.Checked = !LayerSelectableMenuItem.Checked; if (layer != null) layer.Selectable = LayerSelectableMenuItem.Checked; } - //TODO LIST: wxl? Tag更正 + //wxl Tag更正 /// /// 图层目录树 右键菜单中的 可编辑 菜单 /// @@ -3076,7 +3001,6 @@ private void LayerEditableMenuItem_Click(object sender, EventArgs e) { TreeNode node = layerNodeContexMenu.Tag as TreeNode; -// GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(node.Tag.ToString().Split('|')[1]); if (node == null) return; GSOLayer layer = node.Tag as GSOLayer; LayerEditableMenuItem.Checked = !LayerEditableMenuItem.Checked; @@ -3087,36 +3011,15 @@ /// /// /// - //TODO LIST: wxl? Tag更正 + //wxl Tag更正 private void SaveLayerMenuItem_Click(object sender, EventArgs e) { TreeNode node = layerNodeContexMenu.Tag as TreeNode; - -// string layerCaption = node.Tag.ToString().Split('|')[1]; -// GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(layerCaption); if (node == null) return; GSOLayer layer = node.Tag as GSOLayer; if (layer != null) layer.Dataset.Save(); } - #region wxl feature的公共方法 - /// - /// 查找指定图层中在 指定范围内的feature对象集合 - /// - /// - /// - /// - private GSOFeatures Polygon_Contain_PointAnalysis(GSOGeoPolygon3D polygon, string layername) - { - GSOFeatures feats = new GSOFeatures(); - GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(layername); - if (layer == null)return feats; - GSOFeatureLayer flayer = layer as GSOFeatureLayer; - if (flayer == null) return feats; - feats = polygon == null ? flayer.GetAllFeatures() : flayer.FindFeaturesInPolygon(polygon, false); - return feats; - } - #endregion /// /// 清除结果 菜单 /// @@ -3313,7 +3216,7 @@ Dictionary featCount = new Dictionary(); Dictionary featLenth = new Dictionary(); Dictionary m_FeaturesWithBianhao = new Dictionary();//记录编号和对应的标注点的位置 - //GSOFeatures polygonJingJuAnalysises = new GSOFeatures(); + /// /// 垂直净距分析 功能界面中的 开始分析按钮 事件处理 /// @@ -3417,10 +3320,10 @@ return new GSOPoint3d(); } GSOGeoPolyline3D disline = new GSOGeoPolyline3D(); - GSOPoint3ds point3ds = new GSOPoint3ds(); - point3ds.Add(pntIntersect1); - point3ds.Add(pntIntersect2); - disline.AddPart(point3ds); + GSOPoint3ds point3Ds = new GSOPoint3ds(); + point3Ds.Add(pntIntersect1); + point3Ds.Add(pntIntersect2); + disline.AddPart(point3Ds); GSOSimpleLineStyle3D style = new GSOSimpleLineStyle3D(); //创建线的风格 //设置透明度及颜色,FromArgb()中的四个参数分别为alpha、red、green、blue,取值范围为0到255 style.LineColor = Color.GreenYellow; @@ -3497,15 +3400,12 @@ GSOPoint3d pntProIntersect2 = new GSOPoint3d(); for (int i = 0; i < _pipelineLayerNames.Count; i++) { - if (caption == _pipelineLayerNames[i]) - { - continue; - } + if (caption == _pipelineLayerNames[i]) continue; GSOLayer layer2 = globeControl1.Globe.Layers.GetLayerByCaption(_pipelineLayerNames[i]); if (layer2 == null) continue; - GSOFeatureLayer flayer2 = layer2 as GSOFeatureLayer; - GSOFeatureDataset fdataset2 = flayer2.Dataset as GSOFeatureDataset; - GSOFeatures feats2 = Polygon_Contain_PointAnalysis(polygon, _pipelineLayerNames[i]); + GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(_pipelineLayerNames[i]); + GSOFeatures feats2 = FeatureStatisticsService.GetLayerFeatures(polygon,layer); + if (feats2 == null) continue; for (int j = 0; j < feats2.Length; j++) { GSOFeature feat2 = feats2[j]; @@ -3923,9 +3823,8 @@ else if (checkBoxX4.Checked) // 选择图层 { GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(comboBoxEx2.SelectedItem.ToString()); - if (layer == null) return; - GSOFeatureLayer flayer = layer as GSOFeatureLayer; + if (flayer == null) return; //GSOFeatureDataset fdataset = flayer.Dataset as GSOFeatureDataset; GSOFeatures feats = flayer.GetAllFeatures(); for (int i = 0; i < feats.Length; i++) @@ -3937,11 +3836,11 @@ if (featCount.Count > 0) { - for (int i = 0; i < Utility.m_PipelineLayerNames.Count; i++) + foreach (string pipelineLayer in Utility.m_PipelineLayerNames) { - if (featCount.ContainsKey(Utility.m_PipelineLayerNames[i]) && featLenth.ContainsKey(Utility.m_PipelineLayerNames[i])) + if (featCount.ContainsKey(pipelineLayer) && featLenth.ContainsKey(pipelineLayer)) { - listBox2.Items.Add(Utility.m_PipelineLayerNames[i] + ":" + featCount[Utility.m_PipelineLayerNames[i]] + "条,共" + featLenth[Utility.m_PipelineLayerNames[i]].ToString("0.00") + "米"); + listBox2.Items.Add(pipelineLayer + ":" + featCount[pipelineLayer] + "条,共" + featLenth[pipelineLayer].ToString("0.00") + "米"); } } } @@ -4037,7 +3936,6 @@ return; GSOFeatureLayer flayer = layer as GSOFeatureLayer; - GSOFeatureDataset fdataset = flayer.Dataset as GSOFeatureDataset; GSOFeatures feats = flayer.GetAllFeatures(); for (int i = 0; i < feats.Length; i++) @@ -4078,8 +3976,6 @@ clearFeatureHighLight(); Cursor = Cursors.WaitCursor; - - GSOPoint3d markerPosition = new GSOPoint3d(); if (checkBoxX5.Checked) // 覆土分析 选择管线 { for (int i = 0; i < dataGridViewX6.Rows.Count; i++) @@ -4116,7 +4012,7 @@ pt.X = pts[m].X; pt.Y = pts[m].Y; pt.Z = 0; - markerPosition = LabelVerticalDistance(layerTemp, pts[m], pt, Convert.ToDouble(dataGridViewX7.Rows[idx].Cells[2].Value), true); + LabelVerticalDistance(layerTemp, pts[m], pt, Convert.ToDouble(dataGridViewX7.Rows[idx].Cells[2].Value), true); break; } } @@ -4125,24 +4021,14 @@ else if (checkBoxX6.Checked) // 覆土分析 选择图层 { GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(comboBoxEx3.SelectedItem.ToString()); - if (layer == null) - return; - GSOFeatureLayer flayer = layer as GSOFeatureLayer; - GSOFeatureDataset fdataset = flayer.Dataset as GSOFeatureDataset; + if (flayer == null)return; GSOFeatures feats = flayer.GetAllFeatures(); for (int i = 0; i < feats.Length; i++) { GSOFeature f = feats[i]; string featureName = ""; - if (isFeatureContainsBianhao(feats[i])) - { - featureName = feats[i].GetValue(featureIDFieldName).ToString(); - } - else - { - featureName = feats[i].Name; - } + featureName = isFeatureContainsBianhao(feats[i]) ? feats[i].GetValue(featureIDFieldName).ToString() : feats[i].Name; GSOGeoPolyline3D line = f.Geometry as GSOGeoPolyline3D; if (line == null) continue; GSOPipeLineStyle3D style = line.Style as GSOPipeLineStyle3D; @@ -4163,7 +4049,7 @@ pt.X = pts[m].X; pt.Y = pts[m].Y; pt.Z = 0; - markerPosition = LabelVerticalDistance(layerTemp, pts[m], pt, Convert.ToDouble(dataGridViewX7.Rows[idx].Cells[2].Value), true); + LabelVerticalDistance(layerTemp, pts[m], pt, Convert.ToDouble(dataGridViewX7.Rows[idx].Cells[2].Value), true); break; } @@ -4197,11 +4083,12 @@ if (rowFeature.Geometry != null && rowFeature.Geometry.Type == EnumGeometryType.GeoPolyline3D) { GSOGeoPolyline3D line = rowFeature.Geometry as GSOGeoPolyline3D; + if (line == null) return; double length = line.GetSpaceLength(true, 6378137); GSOGeoPolyline3D lineLine = line.GetSegment(0, length / 2); - GSOPoint3d point3d = lineLine[lineLine.PartCount - 1][lineLine[lineLine.PartCount - 1].Count - 1]; + GSOPoint3d point3D = lineLine[lineLine.PartCount - 1][lineLine[lineLine.PartCount - 1].Count - 1]; - globeControl1.Globe.JumpToPosition(point3d, EnumAltitudeMode.Absolute, 5); + globeControl1.Globe.JumpToPosition(point3D, EnumAltitudeMode.Absolute, 5); } else { @@ -4376,8 +4263,7 @@ dlg.FileName = type + "-" + DateTime.Now.ToString("yyyyMMdd") + ".xls"; if (dlg.ShowDialog() == DialogResult.OK) { - Stream myStream; - myStream = dlg.OpenFile(); + Stream myStream = dlg.OpenFile(); StreamWriter sw = new StreamWriter(myStream, Encoding.GetEncoding(-0)); string columnTitle = ""; try @@ -4542,7 +4428,6 @@ return; GSOFeatureLayer flayer = layer as GSOFeatureLayer; - GSOFeatureDataset fdataset = flayer.Dataset as GSOFeatureDataset; GSOFeatures feats = flayer.GetAllFeatures(); for (int i = 0; i < feats.Length; i++) { @@ -4586,7 +4471,6 @@ if (globeControl1.Globe.Action == EnumAction3D.SelectObject) { globeControl1.Globe.Action = EnumAction3D.ActionNull; - //globeControl1.Globe.Action = EnumAction3D.SelectObject; } } /// @@ -4852,6 +4736,7 @@ if (rowFeature.Geometry != null && rowFeature.Geometry.Type == EnumGeometryType.GeoPolyline3D) { GSOGeoPolyline3D line = rowFeature.Geometry as GSOGeoPolyline3D; + if (line == null) return; double length = line.GetSpaceLength(true, 6378137); GSOGeoPolyline3D lineLine = line.GetSegment(0, length / 2); GSOPoint3d point3d = lineLine[lineLine.PartCount - 1][lineLine[lineLine.PartCount - 1].Count - 1]; @@ -4923,9 +4808,6 @@ dataGridViewAnalysisResult.Rows.Clear(); listBoxStasticsResult.Items.Clear(); GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(comboBoxLayer.SelectedItem.ToString()); - if (layer == null) - return; - GSOFeatureLayer flayer = layer as GSOFeatureLayer; if (flayer == null) return; @@ -5232,56 +5114,50 @@ private object AddLayerData(string strDataPath) { object objRes = null; - if (Path.GetExtension(strDataPath).ToLower().Equals(".kml")) + string extension = Path.GetExtension(strDataPath); + if (extension != null && extension.ToLower().Equals(".kml")) { GSOLayer layer = globeControl1.Globe.Layers.Add(strDataPath); objRes = layer; - if (layer != null) - { - CheckDatasetGeoReference(layer.Dataset, ""); - TreeNode node = new TreeNode(); - node.Tag = layer; - node.Text = layer.Dataset.Caption; - node.ImageIndex = 0; - node.SelectedImageIndex = 0; - node.Checked = layer.Visible; - layerManagerNode.Nodes.Insert(0, node); - } + if (layer == null) return objRes; + CheckDatasetGeoReference(layer.Dataset, ""); + TreeNode node = new TreeNode(); + node.Tag = layer; + node.Text = layer.Dataset.Caption; + node.ImageIndex = 0; + node.SelectedImageIndex = 0; + node.Checked = layer.Visible; + layerManagerNode.Nodes.Insert(0, node); newlayername = layer.Caption; } else if (GSOUtility.IsDatasetSupportTerrain(strDataPath)) { GSOTerrain terrain = globeControl1.Globe.Terrains.Add(strDataPath); objRes = terrain; - if (terrain != null) - { - TreeNode node = new TreeNode(); - node.Tag = terrain; - node.Text = terrain.Caption; - node.ImageIndex = 0; - node.SelectedImageIndex = 0; - node.Checked = terrain.Visible; - layerManagerNode.Nodes.Insert(0, node); - } + if (terrain == null) return objRes; + TreeNode node = new TreeNode(); + node.Tag = terrain; + node.Text = terrain.Caption; + node.ImageIndex = 0; + node.SelectedImageIndex = 0; + node.Checked = terrain.Visible; + layerManagerNode.Nodes.Insert(0, node); newlayername = terrain.Caption; } - else if (Path.GetExtension(strDataPath).ToLower().Equals(".dxf")) + else if (extension != null && extension.ToLower().Equals(".dxf")) { GSOLayer layer = globeControl1.Globe.Layers.Add(strDataPath); objRes = layer; - if (layer != null) - { - GSODataset dataset = layer.Dataset; - CheckDatasetGeoReference(layer.Dataset, strDataPath); - CheckDatasetGeoReference(layer.Dataset, strDataPath); - TreeNode node = new TreeNode(); - node.Tag = layer; - node.Text = layer.Dataset.Caption; - node.ImageIndex = 0; - node.SelectedImageIndex = 0; - node.Checked = layer.Visible; - layerManagerNode.Nodes.Insert(0, node); - } + if (layer == null) return objRes; + CheckDatasetGeoReference(layer.Dataset, strDataPath); + CheckDatasetGeoReference(layer.Dataset, strDataPath); + TreeNode node = new TreeNode(); + node.Tag = layer; + node.Text = layer.Dataset.Caption; + node.ImageIndex = 0; + node.SelectedImageIndex = 0; + node.Checked = layer.Visible; + layerManagerNode.Nodes.Insert(0, node); newlayername = layer.Caption; } else @@ -5290,8 +5166,10 @@ objRes = layer; if (layer == null) + { MessageBox.Show("layer is null"); - + return objRes; + } CheckDatasetGeoReference(layer.Dataset, strDataPath); TreeNode node = new TreeNode(); node.Tag = layer; @@ -5300,7 +5178,6 @@ node.SelectedImageIndex = 0; node.Checked = layer.Visible; layerManagerNode.Nodes.Insert(0, node); - newlayername = layer.Caption; } return objRes; @@ -5342,27 +5219,6 @@ layerManagerNode.Nodes.Insert(0, node); layerManagerNode.Expand(); } - /// - /// 获取指定图层中最后一个feature对象的名称对应的整数 - /// - /// - /// -// public int getLabelName(GSOLayer layer) -// { -// int nid = -1; -// if (layer.GetAllFeatures().Length > 0) -// { -// string id = layer.GetAllFeatures()[layer.GetAllFeatures().Length - 1].Name; -// -// int.TryParse(id, out nid); -// } -// else -// { -// nid = 0; -// } -// return nid; -// } - /// /// 图层节点树中 节点 右键单击事件处理 @@ -5371,39 +5227,33 @@ /// private void layerMarkerTree_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e) { - if (e.Button == MouseButtons.Right) + if (e.Button != MouseButtons.Right||e.Node.Parent==null) return; + if (e.Node.Parent.Text.Equals("标注管理") ) { - if (e.Node.Text == "标注管理" || e.Node.Text == "传感器管理") - return; - if (e.Node.Parent.Text == "标注管理") + layerMarkerTree.SelectedNode = e.Node; + contextMenuStrip2.Show(layerMarkerTree, e.X, e.Y); + contextMenuStrip2.Tag = e.Node; + } + else if (e.Node.Parent.Text.Equals("传感器管理")) + { + layerSensorTree.SelectedNode = e.Node; + contextMenuStrip2.Show(layerSensorTree, e.X, e.Y); + contextMenuStrip2.Tag = e.Node; + } + else + { + if (!(e.Node.Tag is GSOFeature)||e.Node.Parent.Parent==null) return; + if (e.Node.Parent.Parent.Text.Equals("标注管理")) { layerMarkerTree.SelectedNode = e.Node; - contextMenuStrip2.Show(layerMarkerTree, e.X, e.Y); - contextMenuStrip2.Tag = e.Node; + contextMenuStrip3.Show(layerMarkerTree, e.X, e.Y); + contextMenuStrip3.Tag = e.Node; } - else if (e.Node.Parent.Text == "传感器管理") + else if (e.Node.Parent.Parent.Text.Equals("传感器管理")) { layerSensorTree.SelectedNode = e.Node; - contextMenuStrip2.Show(layerSensorTree, e.X, e.Y); - contextMenuStrip2.Tag = e.Node; - } - else - { - if (e.Node.Tag is GSOFeature) - { - if (e.Node.Parent.Parent.Text == "标注管理") - { - layerMarkerTree.SelectedNode = e.Node; - contextMenuStrip3.Show(layerMarkerTree, e.X, e.Y); - contextMenuStrip3.Tag = e.Node; - } - else if (e.Node.Parent.Parent.Text == "传感器管理") - { - layerSensorTree.SelectedNode = e.Node; - contextMenuStrip3.Show(layerSensorTree, e.X, e.Y); - contextMenuStrip3.Tag = e.Node; - } - } + contextMenuStrip3.Show(layerSensorTree, e.X, e.Y); + contextMenuStrip3.Tag = e.Node; } } } @@ -5415,16 +5265,15 @@ private void toolStripMenuItem1_Click(object sender, EventArgs e) { TreeNode node = contextMenuStrip2.Tag as TreeNode; + if (node == null) return; TreeNode parentNode = node.Parent; - if (parentNode.Text == "标注管理" || parentNode.Text == "传感器管理") + if (parentNode.Text.Equals("标注管理") || parentNode.Text.Equals("传感器管理")) { RefreshTreeNodeLayerFeatureList(node); } } - #region wxl? VisitFeature3Ds的作用,重构后,是否对其有影响 - /// /// 给指定的图层节点添加代表feature对象的子节点 /// @@ -5439,8 +5288,6 @@ VisitFeature3Ds(layer.GetAllFeatures(), layerTreeNode); } } - - #endregion /// /// 标注管理、传感器管理 图层目录树的右键菜单中的 移除所有 菜单 @@ -5451,9 +5298,9 @@ { TreeNode node = contextMenuStrip3.Tag as TreeNode; if (node == null) return; - GSOFeature feature3d = node.Tag as GSOFeature; - if (feature3d == null) return; - feature3d.Delete(); + GSOFeature feature3D = node.Tag as GSOFeature; + if (feature3D == null) return; + feature3D.Delete(); globeControl1.Globe.Refresh(); node.Remove(); } @@ -5625,21 +5472,6 @@ shlayername = frmSh.rukuLayer.Name; globeControl1.Refresh(); } - //#region wxl 下面unreachable - //if (frmShResult != null && !frmShResult.IsDisposed) - //{ - // try - // { - // clearFeatureHighLight(); - // ClearRedlineAnalyseResult(); - // frmShResult.Close(); - // } - // catch (Exception ex) - // { - // MessageBox.Show(ex.Message); - // } - //} - //#endregion wxl frmShResult = new FrmShResult(dVerticalJingJuBiaoZhun, dHorizontalJingJuBiaoZhun, shlayername, globeControl1, Utility.m_PipelineLayerNames); @@ -6043,10 +5875,6 @@ NetworkAnalysisTool.ClearAllTopAnalysis(globeControl1); -// GSOFeatures feats = globeControl1.Globe.MemoryLayer.GetFeatureByName("粒子要素", true); -// if (feats.Length > 0) -// globeControl1.Globe.MemoryLayer.RemoveFeatureByID(feats[0].ID); - globeControl1.Globe.UnderGroundFloor.Visible = false;//隐藏地下网格线 // ClearUpDownTraceAnalysis(); //清除上下游分析 @@ -7196,8 +7024,8 @@ //日志记录 LogManager.saveLog(Utility.userName, buttonItemXT4_2.Text); - FrmAppUSER appUSER = new FrmAppUSER(); - appUSER.ShowDialog(); + FrmAppUSER appUser = new FrmAppUSER(); + appUser.ShowDialog(); } /// /// 增加人员 @@ -7209,8 +7037,8 @@ //日志记录 LogManager.saveLog(Utility.userName, buttonItemXT4_1.Text); - FrmAppUSERRESET appUSERRESET = new FrmAppUSERRESET(); - appUSERRESET.ShowDialog(); + FrmAppUSERRESET appUserReset = new FrmAppUSERRESET(); + appUserReset.ShowDialog(); } /// /// 热点功能统计 @@ -8499,7 +8327,7 @@ GSOLayer lyr = globeControl1.Globe.Layers.GetLayerByCaption(newlayername); if (newlayername != "") { - GSOFeatures features = lyr.GetAllFeatures(); + lyr.GetAllFeatures(); GSORect2d rd = lyr.LatLonBounds; GSOPoint2d rdcenter = rd.Center; diff --git a/bin/x86/Debug/Cyberpipe.exe b/bin/x86/Debug/Cyberpipe.exe index d81e34f..a94e24f 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 a56b834..2eccd5b 100644 --- a/Cyberpipe.suo +++ b/Cyberpipe.suo Binary files differ diff --git a/DoublePanelAnalysis.cs b/DoublePanelAnalysis.cs index 2c45db6..90466dd 100644 --- a/DoublePanelAnalysis.cs +++ b/DoublePanelAnalysis.cs @@ -776,7 +776,7 @@ if (caption == _pipelineLayerNames[i]) continue;//排除本图层 GSOLayer layer2 = globeControl1.Globe.Layers.GetLayerByCaption(_pipelineLayerNames[i]); if (layer2 == null) continue; - GSOFeatures feats2 = FeatureStatisticsService.getLayerFeatures(polygon, layer2); + GSOFeatures feats2 = FeatureStatisticsService.GetLayerFeatures(polygon, layer2); if (feats2 == null) continue; for (int j = 0; j < feats2.Length; j++) { @@ -819,7 +819,7 @@ if (caption == _pipelineLayerNames[i]) continue; GSOLayer layer2 = globeControl1.Globe.Layers.GetLayerByCaption(_pipelineLayerNames[i]); if (layer2 == null) continue; - GSOFeatures feats2 = FeatureStatisticsService.getLayerFeatures(polygon, layer2); + GSOFeatures feats2 = FeatureStatisticsService.GetLayerFeatures(polygon, layer2); for (int j = 0; j < feats2.Length; j++) { GSOFeature feat2 = feats2[j]; @@ -858,7 +858,7 @@ if (caption == _pipelineLayerNames[i]) continue;//排除本图层 GSOLayer layer2 = globeControl1.Globe.Layers.GetLayerByCaption(_pipelineLayerNames[i]); if (layer2 == null) continue; - GSOFeatures feats2 = FeatureStatisticsService.getLayerFeatures(polygon, layer2); + GSOFeatures feats2 = FeatureStatisticsService.GetLayerFeatures(polygon, layer2); if (feats2 == null) continue; for (int j = 0; j < feats2.Length; j++) { diff --git a/FeatureStatisticsService.cs b/FeatureStatisticsService.cs index fe32265..c147e55 100644 --- a/FeatureStatisticsService.cs +++ b/FeatureStatisticsService.cs @@ -48,7 +48,7 @@ /// ///附属物列表 /// - public Dictionary getFeatureCountByFeatures(GSOFeatures feats) + public Dictionary GetFeatureCountByFeatures(GSOFeatures feats) { if (feats == null || feats.Length == 0) return null; Dictionary result = new Dictionary(); @@ -64,13 +64,13 @@ /// /// /// - public FeaturesClassfyResult getPipesInfoByValueSection(GSOGeoPolygon3D polygon, GSOLayer layer, double? min, double? max, string fieldName) + public FeaturesClassfyResult GetPipesInfoByValueSection(GSOGeoPolygon3D polygon, GSOLayer layer, double? min, double? max, string fieldName) { if (layer == null) return null; FeaturesClassfyResult result = new FeaturesClassfyResult(); double totalLength = 0.0; int ncount = 0; - GSOFeatures features = getPipesByValueSection(polygon, layer, min, max, fieldName); + GSOFeatures features = GetPipesByValueSection(polygon, layer, min, max, fieldName); for (int i = 0; i < features.Length; i++) { GSOGeoPolyline3D line = features[i].Geometry as GSOGeoPolyline3D; @@ -98,7 +98,7 @@ /// 上限 /// 统计类型:"起始埋深"或"管径_毫米" /// - public GSOFeatures getPipesByValueSection(GSOGeoPolygon3D polygon, GSOLayer layer, double? min, double? max, string fieldName) + public GSOFeatures GetPipesByValueSection(GSOGeoPolygon3D polygon, GSOLayer layer, double? min, double? max, string fieldName) { if (layer == null) return null; GSOFeatures result = new GSOFeatures(); @@ -127,7 +127,7 @@ } //图层名称、管径、条数、总长度 - public List groupPipeByDiameter(GSOGeoPolygon3D polygon, GSOLayer layer) + public List GroupPipeByDiameter(GSOGeoPolygon3D polygon, GSOLayer layer) { if (layer == null) return null; List result = new List(); @@ -181,7 +181,7 @@ /// /// /// - public List groupAccessories(GSOGeoPolygon3D polygon, GSOLayer layer) + public List GroupAccessories(GSOGeoPolygon3D polygon, GSOLayer layer) { if (layer == null) return null; List result = new List(); @@ -230,7 +230,7 @@ /// /// 材质 /// - public FeaturesClassfyResult groupPipeByMaterial(GSOGeoPolygon3D polygon, GSOLayer layer, string material) + public FeaturesClassfyResult GroupPipeByMaterial(GSOGeoPolygon3D polygon, GSOLayer layer, string material) { if (layer == null) return null; FeaturesClassfyResult result = new FeaturesClassfyResult(); @@ -245,16 +245,12 @@ int ncount = 0; for (int i = 0; i < feats.Length; i++) { - if (feats[i].GetFieldAsString("材质").Equals(fixedMaterial)) - { - GSOGeoPolyline3D line = feats[i].Geometry as GSOGeoPolyline3D; - if (line != null) - { - double length = line.GetSpaceLength(true, 6378137); - totalLength += length; - ncount += 1; - } - } + if (!feats[i].GetFieldAsString("材质").Equals(fixedMaterial)) continue; + GSOGeoPolyline3D line = feats[i].Geometry as GSOGeoPolyline3D; + if (line == null) continue; + double length = line.GetSpaceLength(true, 6378137); + totalLength += length; + ncount += 1; } result.layerName = layer.Caption; @@ -271,12 +267,12 @@ /// /// 要统计的长度 /// - public static GSOFeatures getLayerPipes(GSOGeoPolygon3D polygon, GSOLayer layer, out double length) + public static GSOFeatures GetLayerPipes(GSOGeoPolygon3D polygon, GSOLayer layer, out double length) { length = 0; if (layer == null) return null; - GSOFeatures feats = getLayerFeatures(polygon, layer); + GSOFeatures feats = GetLayerFeatures(polygon, layer); double totallength = 0.00; for (int i = 0; i < feats.Length; i++) { @@ -298,10 +294,10 @@ /// /// /// - public static GSOFeatures getLayerFeatures(GSOGeoPolygon3D polygon, GSOLayer layer) + public static GSOFeatures GetLayerFeatures(GSOGeoPolygon3D polygon, GSOLayer layer) { - if (layer == null) return null; GSOFeatureLayer flayer = layer as GSOFeatureLayer; + if (flayer == null) return null; return polygon == null ? flayer.GetAllFeatures() : flayer.FindFeaturesInPolygon(polygon, false); } diff --git a/FrmAccessoriesgather.cs b/FrmAccessoriesgather.cs index c7787f7..e1d176e 100644 --- a/FrmAccessoriesgather.cs +++ b/FrmAccessoriesgather.cs @@ -213,7 +213,7 @@ { FeatureStatisticsService featureService = new FeatureStatisticsService(); GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(layertype); - List accessoriesResult = featureService.groupAccessories(polygon, layer); + List accessoriesResult = featureService.GroupAccessories(polygon, layer); if (accessoriesResult == null || accessoriesResult.Count == 0) { diff --git a/FrmAllPipelineStatis.cs b/FrmAllPipelineStatis.cs index 60805ba..0911557 100644 --- a/FrmAllPipelineStatis.cs +++ b/FrmAllPipelineStatis.cs @@ -205,7 +205,7 @@ { GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(pipeLayerNames[i]); double totalLength = 0.0; - GSOFeatures fs = FeatureStatisticsService.getLayerPipes(polygon, layer,out totalLength); + GSOFeatures fs = FeatureStatisticsService.GetLayerPipes(polygon, layer,out totalLength); if (fs == null) continue; nameAndPipeMap.Add(pipeLayerNames[i], fs); nameAndLengthMap.Add(pipeLayerNames[i],totalLength); diff --git a/FrmBSQStatis.cs b/FrmBSQStatis.cs index 6f7838f..dd63f62 100644 --- a/FrmBSQStatis.cs +++ b/FrmBSQStatis.cs @@ -108,7 +108,7 @@ public Dictionary getBSQMapByPolygon(GSOGeoPolygon3D polygon,Dictionary typeAndCount, Dictionary codeAndType) { GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption("标识器"); - GSOFeatures bsqFs = FeatureStatisticsService.getLayerFeatures(polygon, layer); + GSOFeatures bsqFs = FeatureStatisticsService.GetLayerFeatures(polygon, layer); if (bsqFs == null || bsqFs.Length <= 0) { LogHelper.WriteLog(typeof(FrmBSQStatis),"标识器图层下的Feature为空"); return null; diff --git a/FrmpipeDeepstatis.cs b/FrmpipeDeepstatis.cs index e00a1dc..6a5c895 100644 --- a/FrmpipeDeepstatis.cs +++ b/FrmpipeDeepstatis.cs @@ -148,7 +148,7 @@ //Double downLimit = Convert.ToDouble(dataGridViewX2.Rows[j].Cells["下限"].Value); if (upLimit == null && downLimit == null) continue;//空行过滤 //获取符合条件的管线 - FeaturesClassfyResult result = service.getPipesInfoByValueSection(polygon, layer, downLimit, upLimit, "起始埋深"); + FeaturesClassfyResult result = service.GetPipesInfoByValueSection(polygon, layer, downLimit, upLimit, "起始埋深"); DataGridViewRow row = new DataGridViewRow(); int index = dataGridViewX1.Rows.Add(row); row = dataGridViewX1.Rows[index]; diff --git a/FrmpipeDiametergather.cs b/FrmpipeDiametergather.cs index 132ab7f..a9d96fa 100644 --- a/FrmpipeDiametergather.cs +++ b/FrmpipeDiametergather.cs @@ -176,7 +176,7 @@ for (int i = 0; i < clbPipeLine.CheckedItems.Count; i++) { GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(clbPipeLine.CheckedItems[i].ToString()); - List results = service.groupPipeByDiameter(polygon,layer); + List results = service.GroupPipeByDiameter(polygon,layer); foreach(FeaturesClassfyResult result in results){ DataGridViewRow row = new DataGridViewRow(); diff --git a/FrmpipeMaterialGather.cs b/FrmpipeMaterialGather.cs index ec71951..44e7f24 100644 --- a/FrmpipeMaterialGather.cs +++ b/FrmpipeMaterialGather.cs @@ -164,7 +164,7 @@ for (int j = 0; j < clbmaterials.CheckedItems.Count; j++) { - FeaturesClassfyResult featureResult = featureService.groupPipeByMaterial(polygon, layer, clbmaterials.CheckedItems[j].ToString()); + FeaturesClassfyResult featureResult = featureService.GroupPipeByMaterial(polygon, layer, clbmaterials.CheckedItems[j].ToString()); DataGridViewRow row = new DataGridViewRow(); int index = dataGridViewX1.Rows.Add(row); row = dataGridViewX1.Rows[index]; diff --git a/Frmpipediameterstatis.cs b/Frmpipediameterstatis.cs index 2f5e00e..4fb25a8 100644 --- a/Frmpipediameterstatis.cs +++ b/Frmpipediameterstatis.cs @@ -184,7 +184,7 @@ if (tempDown != null) downLimit = Convert.ToDouble(tempDown); if (upLimit == null && downLimit == null) continue;//空行过滤 //获取符合条件的管线 - FeaturesClassfyResult result = service.getPipesInfoByValueSection(polygon, layer, downLimit, upLimit, "管径_毫米"); + FeaturesClassfyResult result = service.GetPipesInfoByValueSection(polygon, layer, downLimit, upLimit, "管径_毫米"); DataGridViewRow row = new DataGridViewRow(); int index = dataGridViewX1.Rows.Add(row); row = dataGridViewX1.Rows[index]; diff --git a/MainFrm.cs b/MainFrm.cs index ad9e1c7..f4bd7ca 100644 --- a/MainFrm.cs +++ b/MainFrm.cs @@ -1321,7 +1321,6 @@ #endregion - //Dictionary Utility.dictionaryNetLayerNameAndCaption = new Dictionary(); void globeControl1_AfterNetLayerAddEvent(object sender, AfterNetLayerAddEventArgs e) { if (e.Layer != null && Utility.dictionaryNetLayerNameAndCaption.ContainsKey(e.Layer.Caption)) @@ -1372,7 +1371,7 @@ tempnode.Text = feature.Name; tempnode.ImageIndex = 1; tempnode.SelectedImageIndex = 1; - tempnode.Checked = node.Checked ? feature.Visible : false; + tempnode.Checked = node.Checked && feature.Visible; tempnode.Tag = feature; node.Nodes.Add(tempnode); GSOFeatureFolder featureFolder = (GSOFeatureFolder) feature; @@ -1380,8 +1379,7 @@ } else { - TreeNode tempnode = new TreeNode(); - tempnode.Text = feature.Name; + TreeNode tempnode = new TreeNode {Text = feature.Name}; if (feature.Geometry != null) { switch (feature.Geometry.Type) @@ -1422,7 +1420,7 @@ } } - tempnode.Checked = node.Checked ? feature.Visible : false; + tempnode.Checked = node.Checked && feature.Visible; tempnode.Tag = feature; node.Nodes.Add(tempnode); } @@ -1583,7 +1581,6 @@ layerTree.SelectedNode = e.Node; if (e.Node.Tag == null || e.Node.Parent == null) return; //排除无图层节点和第一级节点 - //来自locaserver的数据,直接返回就行了,目前只有一个180fd,暂时单独处理 GSOLayer gsoLayer = e.Node.Tag as GSOLayer; if (gsoLayer == null || gsoLayer.Caption.Equals(Utility.roadLayerName)) return; if (e.Node.Parent.Text.Equals("临时图层") || e.Node.Parent.Text.Equals("我的地标")) @@ -1606,7 +1603,7 @@ } } - + //wxl Tag更正 /// /// 删除临时添加的本地数据图层 /// @@ -1633,7 +1630,7 @@ } } - + //wxl Tag更正 private void 可编辑ToolStripMenuItem_Click(object sender, EventArgs e) { TreeNode node = layerTree.SelectedNode; @@ -1644,17 +1641,16 @@ 可编辑ToolStripMenuItem.Checked = !可编辑ToolStripMenuItem.Checked; layer.Editable = 可编辑ToolStripMenuItem.Checked; } - + //wxl Tag更正 private void 保存ToolStripMenuItem_Click(object sender, EventArgs e) { -// TreeNode node = contextMenuStripDeleteLayerNode.Tag as TreeNode; TreeNode node = layerTree.SelectedNode; if (node == null||node.Tag==null) return; GSOLayer layer = node.Tag as GSOLayer; if (layer == null) return; layer.Dataset.Save(); } - //TODO LIST: wxl? Tag更正 + //wxl Tag更正 private void 定位ToolStripMenuItem_Click(object sender, EventArgs e) { TreeNode node = layerTree.SelectedNode; @@ -1697,7 +1693,7 @@ } } } - //TODO LIST: wxl? Tag更正 + //wxl Tag更正 private void layerTree_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e) { TreeNode node = layerTree.SelectedNode; @@ -2234,7 +2230,7 @@ { WebRequest req = WebRequest.Create(fileUrl); response = req.GetResponse(); - result = response == null ? false : true; + result = true; } catch (Exception ex) { @@ -2253,20 +2249,14 @@ string featureIDFieldName = "编号"; private bool isFeatureContainsBianhao(GSOFeature feature) { - bool isContains = true; - if (feature.GetFieldDefn("编号") == null && feature.GetFieldDefn("标识器编号") == null) - { - isContains = false; - } - else if (feature.GetFieldDefn("标识器编号") != null) + if (feature.GetFieldDefn("标识器编号") != null) { featureIDFieldName = "标识器编号"; + return true; } - else if (feature.GetFieldDefn("编号") != null) - { - featureIDFieldName = "编号"; - } - return isContains; + if (feature.GetFieldDefn("编号") == null) return false; + featureIDFieldName = "编号"; + return true; } /// @@ -2362,9 +2352,8 @@ { if (Utility.listPipelineType != null) { - for (int i = 0; i < Utility.listPipelineType.Count; i++) + foreach (PipelineType pipelineType in Utility.listPipelineType) { - PipelineType pipelineType = Utility.listPipelineType[i]; if (pipelineType == null || pipelineType.code.Trim() != pipelinecode.Trim()) continue; title = pipelineType.type + " " + pipelineType.name; if (pipelineType.type == pipelineType.name) @@ -2524,78 +2513,6 @@ return str; } - /// - /// 获取目标图层 - /// - /// -// private GSOLayer TreeNodeFeatureLayer() -// { -// TreeNode featureAddPipeFitTreenode = GetDestLayerFeatureAddTreeNode(); -// GSOLayer featureAddLayer = globeControl1.Globe.Layers.GetLayerByCaption(featureAddPipeFitTreenode.Tag.ToString().Split('|')[1]); -// -// return featureAddLayer; -// } - //TODO LIST: wxl11? 待更正,Node的Tag现在都已经统一为gsolayer对象了 -// private TreeNode GetDestLayerFeatureAddTreeNode() -// { -// for (int i = 0; i < layerTree.Nodes.Count; i++) -// { -// TreeNode tempNode = layerTree.Nodes[i]; -// for (int j = 0; j < tempNode.Nodes.Count; j++) -// { -// TreeNode tempChildNode = tempNode.Nodes[j]; -// if (tempChildNode.Tag.ToString().Split('|').Length > 1) // Config配置文件配置的图层 -// {//本层节点Tag记录layer -// GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(tempChildNode.Tag.ToString().Split('|')[1]); -// if (layer == null) -// { -// continue; -// } -// if (tempChildNode.Tag != null && layer.IsDestLayerFeatureAdd()) -// { -// return tempChildNode; -// } -// } -// else //临时添加的本地图层 -// {//子层节点的Tag记录layer -// for (int m = 0; m < tempChildNode.Nodes.Count; m++) -// { -// TreeNode tempChildNode1 = tempChildNode.Nodes[m]; -// if (tempChildNode1.Tag.ToString().Split('|').Length > 1) -// { -// GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(tempChildNode1.Tag.ToString().Split('|')[1]); -// if (layer == null) -// { -// continue; -// } -// if (tempChildNode1.Tag != null && layer.IsDestLayerFeatureAdd()) -// { -// return tempChildNode1; -// } -// } -// else -// { -// for (int n = 0; n < tempChildNode1.Nodes.Count; n++) -// { -// TreeNode tempChildNode2 = tempChildNode1.Nodes[n]; -// if (tempChildNode2.Tag.ToString().Split('|').Length <= 1) continue; -// GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(tempChildNode2.Tag.ToString().Split('|')[1]); -// if (layer == null) -// { -// continue; -// } -// if (tempChildNode2.Tag != null && layer.IsDestLayerFeatureAdd()) -// { -// return tempChildNode2; -// } -// } -// } -// } -// } -// } -// } -// return null; -// } private GSOLayer TreeNodeFeatureLayer() { TreeNode featureAddPipeFitTreenode = GetDestLayerFeatureAddTreeNode(); @@ -2613,9 +2530,19 @@ { foreach (TreeNode node in layerTreeNode.Nodes) { - GSOLayer gsoLayer = node.Tag as GSOLayer; - if (gsoLayer != null && gsoLayer.IsDestLayerFeatureAdd()) return node; - + if (node.Tag == null & node.Nodes.Count > 0) + { + foreach (TreeNode nodeNode in node.Nodes) + { + GSOLayer gsoLayer = nodeNode.Tag as GSOLayer; + if (gsoLayer != null && gsoLayer.IsDestLayerFeatureAdd()) return nodeNode; + } + } + else + { + GSOLayer gsoLayer = node.Tag as GSOLayer; + if (gsoLayer != null && gsoLayer.IsDestLayerFeatureAdd()) return node; + } } } else @@ -3036,7 +2963,7 @@ } } } - //TODO LIST: wxl? Tag更正 + //wxl Tag更正 /// /// 图层目录树 右键菜单中的 目标图层 菜单 /// @@ -3047,12 +2974,11 @@ if (FeatureAddLayerMenuItem.Checked) return; TreeNode node = layerNodeContexMenu.Tag as TreeNode; FeatureAddLayerMenuItem.Checked = true; -// GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(node.Tag.ToString().Split('|')[1]); if (node == null) return; GSOLayer layer = node.Tag as GSOLayer; globeControl1.Globe.DestLayerFeatureAdd = layer; } - //TODO LIST: wxl? Tag更正 + //wxl Tag更正 /// /// 图层目录树 右键菜单中的 可选择 菜单 /// @@ -3061,13 +2987,12 @@ private void LayerSelectableMenuItem_Click(object sender, EventArgs e) { TreeNode node = layerNodeContexMenu.Tag as TreeNode; -// GSOLayer layer = globeControl1.Globe.Layers[nIndex]; if (node == null) return; GSOLayer layer = node.Tag as GSOLayer; LayerSelectableMenuItem.Checked = !LayerSelectableMenuItem.Checked; if (layer != null) layer.Selectable = LayerSelectableMenuItem.Checked; } - //TODO LIST: wxl? Tag更正 + //wxl Tag更正 /// /// 图层目录树 右键菜单中的 可编辑 菜单 /// @@ -3076,7 +3001,6 @@ private void LayerEditableMenuItem_Click(object sender, EventArgs e) { TreeNode node = layerNodeContexMenu.Tag as TreeNode; -// GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(node.Tag.ToString().Split('|')[1]); if (node == null) return; GSOLayer layer = node.Tag as GSOLayer; LayerEditableMenuItem.Checked = !LayerEditableMenuItem.Checked; @@ -3087,36 +3011,15 @@ /// /// /// - //TODO LIST: wxl? Tag更正 + //wxl Tag更正 private void SaveLayerMenuItem_Click(object sender, EventArgs e) { TreeNode node = layerNodeContexMenu.Tag as TreeNode; - -// string layerCaption = node.Tag.ToString().Split('|')[1]; -// GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(layerCaption); if (node == null) return; GSOLayer layer = node.Tag as GSOLayer; if (layer != null) layer.Dataset.Save(); } - #region wxl feature的公共方法 - /// - /// 查找指定图层中在 指定范围内的feature对象集合 - /// - /// - /// - /// - private GSOFeatures Polygon_Contain_PointAnalysis(GSOGeoPolygon3D polygon, string layername) - { - GSOFeatures feats = new GSOFeatures(); - GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(layername); - if (layer == null)return feats; - GSOFeatureLayer flayer = layer as GSOFeatureLayer; - if (flayer == null) return feats; - feats = polygon == null ? flayer.GetAllFeatures() : flayer.FindFeaturesInPolygon(polygon, false); - return feats; - } - #endregion /// /// 清除结果 菜单 /// @@ -3313,7 +3216,7 @@ Dictionary featCount = new Dictionary(); Dictionary featLenth = new Dictionary(); Dictionary m_FeaturesWithBianhao = new Dictionary();//记录编号和对应的标注点的位置 - //GSOFeatures polygonJingJuAnalysises = new GSOFeatures(); + /// /// 垂直净距分析 功能界面中的 开始分析按钮 事件处理 /// @@ -3417,10 +3320,10 @@ return new GSOPoint3d(); } GSOGeoPolyline3D disline = new GSOGeoPolyline3D(); - GSOPoint3ds point3ds = new GSOPoint3ds(); - point3ds.Add(pntIntersect1); - point3ds.Add(pntIntersect2); - disline.AddPart(point3ds); + GSOPoint3ds point3Ds = new GSOPoint3ds(); + point3Ds.Add(pntIntersect1); + point3Ds.Add(pntIntersect2); + disline.AddPart(point3Ds); GSOSimpleLineStyle3D style = new GSOSimpleLineStyle3D(); //创建线的风格 //设置透明度及颜色,FromArgb()中的四个参数分别为alpha、red、green、blue,取值范围为0到255 style.LineColor = Color.GreenYellow; @@ -3497,15 +3400,12 @@ GSOPoint3d pntProIntersect2 = new GSOPoint3d(); for (int i = 0; i < _pipelineLayerNames.Count; i++) { - if (caption == _pipelineLayerNames[i]) - { - continue; - } + if (caption == _pipelineLayerNames[i]) continue; GSOLayer layer2 = globeControl1.Globe.Layers.GetLayerByCaption(_pipelineLayerNames[i]); if (layer2 == null) continue; - GSOFeatureLayer flayer2 = layer2 as GSOFeatureLayer; - GSOFeatureDataset fdataset2 = flayer2.Dataset as GSOFeatureDataset; - GSOFeatures feats2 = Polygon_Contain_PointAnalysis(polygon, _pipelineLayerNames[i]); + GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(_pipelineLayerNames[i]); + GSOFeatures feats2 = FeatureStatisticsService.GetLayerFeatures(polygon,layer); + if (feats2 == null) continue; for (int j = 0; j < feats2.Length; j++) { GSOFeature feat2 = feats2[j]; @@ -3923,9 +3823,8 @@ else if (checkBoxX4.Checked) // 选择图层 { GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(comboBoxEx2.SelectedItem.ToString()); - if (layer == null) return; - GSOFeatureLayer flayer = layer as GSOFeatureLayer; + if (flayer == null) return; //GSOFeatureDataset fdataset = flayer.Dataset as GSOFeatureDataset; GSOFeatures feats = flayer.GetAllFeatures(); for (int i = 0; i < feats.Length; i++) @@ -3937,11 +3836,11 @@ if (featCount.Count > 0) { - for (int i = 0; i < Utility.m_PipelineLayerNames.Count; i++) + foreach (string pipelineLayer in Utility.m_PipelineLayerNames) { - if (featCount.ContainsKey(Utility.m_PipelineLayerNames[i]) && featLenth.ContainsKey(Utility.m_PipelineLayerNames[i])) + if (featCount.ContainsKey(pipelineLayer) && featLenth.ContainsKey(pipelineLayer)) { - listBox2.Items.Add(Utility.m_PipelineLayerNames[i] + ":" + featCount[Utility.m_PipelineLayerNames[i]] + "条,共" + featLenth[Utility.m_PipelineLayerNames[i]].ToString("0.00") + "米"); + listBox2.Items.Add(pipelineLayer + ":" + featCount[pipelineLayer] + "条,共" + featLenth[pipelineLayer].ToString("0.00") + "米"); } } } @@ -4037,7 +3936,6 @@ return; GSOFeatureLayer flayer = layer as GSOFeatureLayer; - GSOFeatureDataset fdataset = flayer.Dataset as GSOFeatureDataset; GSOFeatures feats = flayer.GetAllFeatures(); for (int i = 0; i < feats.Length; i++) @@ -4078,8 +3976,6 @@ clearFeatureHighLight(); Cursor = Cursors.WaitCursor; - - GSOPoint3d markerPosition = new GSOPoint3d(); if (checkBoxX5.Checked) // 覆土分析 选择管线 { for (int i = 0; i < dataGridViewX6.Rows.Count; i++) @@ -4116,7 +4012,7 @@ pt.X = pts[m].X; pt.Y = pts[m].Y; pt.Z = 0; - markerPosition = LabelVerticalDistance(layerTemp, pts[m], pt, Convert.ToDouble(dataGridViewX7.Rows[idx].Cells[2].Value), true); + LabelVerticalDistance(layerTemp, pts[m], pt, Convert.ToDouble(dataGridViewX7.Rows[idx].Cells[2].Value), true); break; } } @@ -4125,24 +4021,14 @@ else if (checkBoxX6.Checked) // 覆土分析 选择图层 { GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(comboBoxEx3.SelectedItem.ToString()); - if (layer == null) - return; - GSOFeatureLayer flayer = layer as GSOFeatureLayer; - GSOFeatureDataset fdataset = flayer.Dataset as GSOFeatureDataset; + if (flayer == null)return; GSOFeatures feats = flayer.GetAllFeatures(); for (int i = 0; i < feats.Length; i++) { GSOFeature f = feats[i]; string featureName = ""; - if (isFeatureContainsBianhao(feats[i])) - { - featureName = feats[i].GetValue(featureIDFieldName).ToString(); - } - else - { - featureName = feats[i].Name; - } + featureName = isFeatureContainsBianhao(feats[i]) ? feats[i].GetValue(featureIDFieldName).ToString() : feats[i].Name; GSOGeoPolyline3D line = f.Geometry as GSOGeoPolyline3D; if (line == null) continue; GSOPipeLineStyle3D style = line.Style as GSOPipeLineStyle3D; @@ -4163,7 +4049,7 @@ pt.X = pts[m].X; pt.Y = pts[m].Y; pt.Z = 0; - markerPosition = LabelVerticalDistance(layerTemp, pts[m], pt, Convert.ToDouble(dataGridViewX7.Rows[idx].Cells[2].Value), true); + LabelVerticalDistance(layerTemp, pts[m], pt, Convert.ToDouble(dataGridViewX7.Rows[idx].Cells[2].Value), true); break; } @@ -4197,11 +4083,12 @@ if (rowFeature.Geometry != null && rowFeature.Geometry.Type == EnumGeometryType.GeoPolyline3D) { GSOGeoPolyline3D line = rowFeature.Geometry as GSOGeoPolyline3D; + if (line == null) return; double length = line.GetSpaceLength(true, 6378137); GSOGeoPolyline3D lineLine = line.GetSegment(0, length / 2); - GSOPoint3d point3d = lineLine[lineLine.PartCount - 1][lineLine[lineLine.PartCount - 1].Count - 1]; + GSOPoint3d point3D = lineLine[lineLine.PartCount - 1][lineLine[lineLine.PartCount - 1].Count - 1]; - globeControl1.Globe.JumpToPosition(point3d, EnumAltitudeMode.Absolute, 5); + globeControl1.Globe.JumpToPosition(point3D, EnumAltitudeMode.Absolute, 5); } else { @@ -4376,8 +4263,7 @@ dlg.FileName = type + "-" + DateTime.Now.ToString("yyyyMMdd") + ".xls"; if (dlg.ShowDialog() == DialogResult.OK) { - Stream myStream; - myStream = dlg.OpenFile(); + Stream myStream = dlg.OpenFile(); StreamWriter sw = new StreamWriter(myStream, Encoding.GetEncoding(-0)); string columnTitle = ""; try @@ -4542,7 +4428,6 @@ return; GSOFeatureLayer flayer = layer as GSOFeatureLayer; - GSOFeatureDataset fdataset = flayer.Dataset as GSOFeatureDataset; GSOFeatures feats = flayer.GetAllFeatures(); for (int i = 0; i < feats.Length; i++) { @@ -4586,7 +4471,6 @@ if (globeControl1.Globe.Action == EnumAction3D.SelectObject) { globeControl1.Globe.Action = EnumAction3D.ActionNull; - //globeControl1.Globe.Action = EnumAction3D.SelectObject; } } /// @@ -4852,6 +4736,7 @@ if (rowFeature.Geometry != null && rowFeature.Geometry.Type == EnumGeometryType.GeoPolyline3D) { GSOGeoPolyline3D line = rowFeature.Geometry as GSOGeoPolyline3D; + if (line == null) return; double length = line.GetSpaceLength(true, 6378137); GSOGeoPolyline3D lineLine = line.GetSegment(0, length / 2); GSOPoint3d point3d = lineLine[lineLine.PartCount - 1][lineLine[lineLine.PartCount - 1].Count - 1]; @@ -4923,9 +4808,6 @@ dataGridViewAnalysisResult.Rows.Clear(); listBoxStasticsResult.Items.Clear(); GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(comboBoxLayer.SelectedItem.ToString()); - if (layer == null) - return; - GSOFeatureLayer flayer = layer as GSOFeatureLayer; if (flayer == null) return; @@ -5232,56 +5114,50 @@ private object AddLayerData(string strDataPath) { object objRes = null; - if (Path.GetExtension(strDataPath).ToLower().Equals(".kml")) + string extension = Path.GetExtension(strDataPath); + if (extension != null && extension.ToLower().Equals(".kml")) { GSOLayer layer = globeControl1.Globe.Layers.Add(strDataPath); objRes = layer; - if (layer != null) - { - CheckDatasetGeoReference(layer.Dataset, ""); - TreeNode node = new TreeNode(); - node.Tag = layer; - node.Text = layer.Dataset.Caption; - node.ImageIndex = 0; - node.SelectedImageIndex = 0; - node.Checked = layer.Visible; - layerManagerNode.Nodes.Insert(0, node); - } + if (layer == null) return objRes; + CheckDatasetGeoReference(layer.Dataset, ""); + TreeNode node = new TreeNode(); + node.Tag = layer; + node.Text = layer.Dataset.Caption; + node.ImageIndex = 0; + node.SelectedImageIndex = 0; + node.Checked = layer.Visible; + layerManagerNode.Nodes.Insert(0, node); newlayername = layer.Caption; } else if (GSOUtility.IsDatasetSupportTerrain(strDataPath)) { GSOTerrain terrain = globeControl1.Globe.Terrains.Add(strDataPath); objRes = terrain; - if (terrain != null) - { - TreeNode node = new TreeNode(); - node.Tag = terrain; - node.Text = terrain.Caption; - node.ImageIndex = 0; - node.SelectedImageIndex = 0; - node.Checked = terrain.Visible; - layerManagerNode.Nodes.Insert(0, node); - } + if (terrain == null) return objRes; + TreeNode node = new TreeNode(); + node.Tag = terrain; + node.Text = terrain.Caption; + node.ImageIndex = 0; + node.SelectedImageIndex = 0; + node.Checked = terrain.Visible; + layerManagerNode.Nodes.Insert(0, node); newlayername = terrain.Caption; } - else if (Path.GetExtension(strDataPath).ToLower().Equals(".dxf")) + else if (extension != null && extension.ToLower().Equals(".dxf")) { GSOLayer layer = globeControl1.Globe.Layers.Add(strDataPath); objRes = layer; - if (layer != null) - { - GSODataset dataset = layer.Dataset; - CheckDatasetGeoReference(layer.Dataset, strDataPath); - CheckDatasetGeoReference(layer.Dataset, strDataPath); - TreeNode node = new TreeNode(); - node.Tag = layer; - node.Text = layer.Dataset.Caption; - node.ImageIndex = 0; - node.SelectedImageIndex = 0; - node.Checked = layer.Visible; - layerManagerNode.Nodes.Insert(0, node); - } + if (layer == null) return objRes; + CheckDatasetGeoReference(layer.Dataset, strDataPath); + CheckDatasetGeoReference(layer.Dataset, strDataPath); + TreeNode node = new TreeNode(); + node.Tag = layer; + node.Text = layer.Dataset.Caption; + node.ImageIndex = 0; + node.SelectedImageIndex = 0; + node.Checked = layer.Visible; + layerManagerNode.Nodes.Insert(0, node); newlayername = layer.Caption; } else @@ -5290,8 +5166,10 @@ objRes = layer; if (layer == null) + { MessageBox.Show("layer is null"); - + return objRes; + } CheckDatasetGeoReference(layer.Dataset, strDataPath); TreeNode node = new TreeNode(); node.Tag = layer; @@ -5300,7 +5178,6 @@ node.SelectedImageIndex = 0; node.Checked = layer.Visible; layerManagerNode.Nodes.Insert(0, node); - newlayername = layer.Caption; } return objRes; @@ -5342,27 +5219,6 @@ layerManagerNode.Nodes.Insert(0, node); layerManagerNode.Expand(); } - /// - /// 获取指定图层中最后一个feature对象的名称对应的整数 - /// - /// - /// -// public int getLabelName(GSOLayer layer) -// { -// int nid = -1; -// if (layer.GetAllFeatures().Length > 0) -// { -// string id = layer.GetAllFeatures()[layer.GetAllFeatures().Length - 1].Name; -// -// int.TryParse(id, out nid); -// } -// else -// { -// nid = 0; -// } -// return nid; -// } - /// /// 图层节点树中 节点 右键单击事件处理 @@ -5371,39 +5227,33 @@ /// private void layerMarkerTree_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e) { - if (e.Button == MouseButtons.Right) + if (e.Button != MouseButtons.Right||e.Node.Parent==null) return; + if (e.Node.Parent.Text.Equals("标注管理") ) { - if (e.Node.Text == "标注管理" || e.Node.Text == "传感器管理") - return; - if (e.Node.Parent.Text == "标注管理") + layerMarkerTree.SelectedNode = e.Node; + contextMenuStrip2.Show(layerMarkerTree, e.X, e.Y); + contextMenuStrip2.Tag = e.Node; + } + else if (e.Node.Parent.Text.Equals("传感器管理")) + { + layerSensorTree.SelectedNode = e.Node; + contextMenuStrip2.Show(layerSensorTree, e.X, e.Y); + contextMenuStrip2.Tag = e.Node; + } + else + { + if (!(e.Node.Tag is GSOFeature)||e.Node.Parent.Parent==null) return; + if (e.Node.Parent.Parent.Text.Equals("标注管理")) { layerMarkerTree.SelectedNode = e.Node; - contextMenuStrip2.Show(layerMarkerTree, e.X, e.Y); - contextMenuStrip2.Tag = e.Node; + contextMenuStrip3.Show(layerMarkerTree, e.X, e.Y); + contextMenuStrip3.Tag = e.Node; } - else if (e.Node.Parent.Text == "传感器管理") + else if (e.Node.Parent.Parent.Text.Equals("传感器管理")) { layerSensorTree.SelectedNode = e.Node; - contextMenuStrip2.Show(layerSensorTree, e.X, e.Y); - contextMenuStrip2.Tag = e.Node; - } - else - { - if (e.Node.Tag is GSOFeature) - { - if (e.Node.Parent.Parent.Text == "标注管理") - { - layerMarkerTree.SelectedNode = e.Node; - contextMenuStrip3.Show(layerMarkerTree, e.X, e.Y); - contextMenuStrip3.Tag = e.Node; - } - else if (e.Node.Parent.Parent.Text == "传感器管理") - { - layerSensorTree.SelectedNode = e.Node; - contextMenuStrip3.Show(layerSensorTree, e.X, e.Y); - contextMenuStrip3.Tag = e.Node; - } - } + contextMenuStrip3.Show(layerSensorTree, e.X, e.Y); + contextMenuStrip3.Tag = e.Node; } } } @@ -5415,16 +5265,15 @@ private void toolStripMenuItem1_Click(object sender, EventArgs e) { TreeNode node = contextMenuStrip2.Tag as TreeNode; + if (node == null) return; TreeNode parentNode = node.Parent; - if (parentNode.Text == "标注管理" || parentNode.Text == "传感器管理") + if (parentNode.Text.Equals("标注管理") || parentNode.Text.Equals("传感器管理")) { RefreshTreeNodeLayerFeatureList(node); } } - #region wxl? VisitFeature3Ds的作用,重构后,是否对其有影响 - /// /// 给指定的图层节点添加代表feature对象的子节点 /// @@ -5439,8 +5288,6 @@ VisitFeature3Ds(layer.GetAllFeatures(), layerTreeNode); } } - - #endregion /// /// 标注管理、传感器管理 图层目录树的右键菜单中的 移除所有 菜单 @@ -5451,9 +5298,9 @@ { TreeNode node = contextMenuStrip3.Tag as TreeNode; if (node == null) return; - GSOFeature feature3d = node.Tag as GSOFeature; - if (feature3d == null) return; - feature3d.Delete(); + GSOFeature feature3D = node.Tag as GSOFeature; + if (feature3D == null) return; + feature3D.Delete(); globeControl1.Globe.Refresh(); node.Remove(); } @@ -5625,21 +5472,6 @@ shlayername = frmSh.rukuLayer.Name; globeControl1.Refresh(); } - //#region wxl 下面unreachable - //if (frmShResult != null && !frmShResult.IsDisposed) - //{ - // try - // { - // clearFeatureHighLight(); - // ClearRedlineAnalyseResult(); - // frmShResult.Close(); - // } - // catch (Exception ex) - // { - // MessageBox.Show(ex.Message); - // } - //} - //#endregion wxl frmShResult = new FrmShResult(dVerticalJingJuBiaoZhun, dHorizontalJingJuBiaoZhun, shlayername, globeControl1, Utility.m_PipelineLayerNames); @@ -6043,10 +5875,6 @@ NetworkAnalysisTool.ClearAllTopAnalysis(globeControl1); -// GSOFeatures feats = globeControl1.Globe.MemoryLayer.GetFeatureByName("粒子要素", true); -// if (feats.Length > 0) -// globeControl1.Globe.MemoryLayer.RemoveFeatureByID(feats[0].ID); - globeControl1.Globe.UnderGroundFloor.Visible = false;//隐藏地下网格线 // ClearUpDownTraceAnalysis(); //清除上下游分析 @@ -7196,8 +7024,8 @@ //日志记录 LogManager.saveLog(Utility.userName, buttonItemXT4_2.Text); - FrmAppUSER appUSER = new FrmAppUSER(); - appUSER.ShowDialog(); + FrmAppUSER appUser = new FrmAppUSER(); + appUser.ShowDialog(); } /// /// 增加人员 @@ -7209,8 +7037,8 @@ //日志记录 LogManager.saveLog(Utility.userName, buttonItemXT4_1.Text); - FrmAppUSERRESET appUSERRESET = new FrmAppUSERRESET(); - appUSERRESET.ShowDialog(); + FrmAppUSERRESET appUserReset = new FrmAppUSERRESET(); + appUserReset.ShowDialog(); } /// /// 热点功能统计 @@ -8499,7 +8327,7 @@ GSOLayer lyr = globeControl1.Globe.Layers.GetLayerByCaption(newlayername); if (newlayername != "") { - GSOFeatures features = lyr.GetAllFeatures(); + lyr.GetAllFeatures(); GSORect2d rd = lyr.LatLonBounds; GSOPoint2d rdcenter = rd.Center; diff --git a/bin/x86/Debug/Cyberpipe.exe b/bin/x86/Debug/Cyberpipe.exe index d81e34f..a94e24f 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 1e4e6f8..5e29f6e 100644 --- a/bin/x86/Debug/Cyberpipe.pdb +++ b/bin/x86/Debug/Cyberpipe.pdb Binary files differ