diff --git a/Cyberpipe.suo b/Cyberpipe.suo
index 1787b1e..526669a 100644
--- a/Cyberpipe.suo
+++ b/Cyberpipe.suo
Binary files differ
diff --git a/Cyberpipe.suo b/Cyberpipe.suo
index 1787b1e..526669a 100644
--- a/Cyberpipe.suo
+++ b/Cyberpipe.suo
Binary files differ
diff --git a/FeatureStatisticsService.cs b/FeatureStatisticsService.cs
index e833e5f..c7de210 100644
--- a/FeatureStatisticsService.cs
+++ b/FeatureStatisticsService.cs
@@ -273,19 +273,15 @@
/// 获取特定区域图层的管线列表,并将其总长度统计出来
/// TODOLIST:将Intersects_Pipeline在MainFrm中去除
///
- ///
+ ///
+ /// 要统计的长度
///
public static GSOFeatures getLayerPipes(GSOGeoPolygon3D polygon, GSOLayer layer, out double length)
{
length = 0;
if (layer == null) return null;
- GSOFeatureLayer flayer = layer as GSOFeatureLayer;
- GSOFeatureDataset fdataset = flayer.Dataset as GSOFeatureDataset;
- GSOFeatures feats = null;
-
- feats = polygon == null?flayer.GetAllFeatures():flayer.FindFeaturesInPolygon(polygon, false);
-
+ GSOFeatures feats = getLayerFeatures(polygon, layer);
double totallength = 0.00;
for (int i = 0; i < feats.Length; i++)
{
@@ -301,5 +297,17 @@
return feats;
}
+ ///
+ /// 获取区域图层内的feature列表,MainFrm.PolygonIntersectAnalysis和此方法重复,需要整理删除
+ ///
+ ///
+ ///
+ ///
+ public static GSOFeatures getLayerFeatures(GSOGeoPolygon3D polygon, GSOLayer layer)
+ {
+ if (layer == null) return null;
+ GSOFeatureLayer flayer = layer as GSOFeatureLayer;
+ return polygon == null ? flayer.GetAllFeatures() : flayer.FindFeaturesInPolygon(polygon, false);
+ }
}
}
diff --git a/Cyberpipe.suo b/Cyberpipe.suo
index 1787b1e..526669a 100644
--- a/Cyberpipe.suo
+++ b/Cyberpipe.suo
Binary files differ
diff --git a/FeatureStatisticsService.cs b/FeatureStatisticsService.cs
index e833e5f..c7de210 100644
--- a/FeatureStatisticsService.cs
+++ b/FeatureStatisticsService.cs
@@ -273,19 +273,15 @@
/// 获取特定区域图层的管线列表,并将其总长度统计出来
/// TODOLIST:将Intersects_Pipeline在MainFrm中去除
///
- ///
+ ///
+ /// 要统计的长度
///
public static GSOFeatures getLayerPipes(GSOGeoPolygon3D polygon, GSOLayer layer, out double length)
{
length = 0;
if (layer == null) return null;
- GSOFeatureLayer flayer = layer as GSOFeatureLayer;
- GSOFeatureDataset fdataset = flayer.Dataset as GSOFeatureDataset;
- GSOFeatures feats = null;
-
- feats = polygon == null?flayer.GetAllFeatures():flayer.FindFeaturesInPolygon(polygon, false);
-
+ GSOFeatures feats = getLayerFeatures(polygon, layer);
double totallength = 0.00;
for (int i = 0; i < feats.Length; i++)
{
@@ -301,5 +297,17 @@
return feats;
}
+ ///
+ /// 获取区域图层内的feature列表,MainFrm.PolygonIntersectAnalysis和此方法重复,需要整理删除
+ ///
+ ///
+ ///
+ ///
+ public static GSOFeatures getLayerFeatures(GSOGeoPolygon3D polygon, GSOLayer layer)
+ {
+ if (layer == null) return null;
+ GSOFeatureLayer flayer = layer as GSOFeatureLayer;
+ return polygon == null ? flayer.GetAllFeatures() : flayer.FindFeaturesInPolygon(polygon, false);
+ }
}
}
diff --git a/FrmBSQStatis.Designer.cs b/FrmBSQStatis.Designer.cs
index 2509c7d..ee9b1e7 100644
--- a/FrmBSQStatis.Designer.cs
+++ b/FrmBSQStatis.Designer.cs
@@ -57,6 +57,7 @@
this.ShowIcon = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "标识器全区域统计";
+ this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FrmBSQStatis_FormClosing);
this.Load += new System.EventHandler(this.FrmBSQStatis_Load);
((System.ComponentModel.ISupportInitialize)(this.chartStatis)).EndInit();
this.ResumeLayout(false);
diff --git a/Cyberpipe.suo b/Cyberpipe.suo
index 1787b1e..526669a 100644
--- a/Cyberpipe.suo
+++ b/Cyberpipe.suo
Binary files differ
diff --git a/FeatureStatisticsService.cs b/FeatureStatisticsService.cs
index e833e5f..c7de210 100644
--- a/FeatureStatisticsService.cs
+++ b/FeatureStatisticsService.cs
@@ -273,19 +273,15 @@
/// 获取特定区域图层的管线列表,并将其总长度统计出来
/// TODOLIST:将Intersects_Pipeline在MainFrm中去除
///
- ///
+ ///
+ /// 要统计的长度
///
public static GSOFeatures getLayerPipes(GSOGeoPolygon3D polygon, GSOLayer layer, out double length)
{
length = 0;
if (layer == null) return null;
- GSOFeatureLayer flayer = layer as GSOFeatureLayer;
- GSOFeatureDataset fdataset = flayer.Dataset as GSOFeatureDataset;
- GSOFeatures feats = null;
-
- feats = polygon == null?flayer.GetAllFeatures():flayer.FindFeaturesInPolygon(polygon, false);
-
+ GSOFeatures feats = getLayerFeatures(polygon, layer);
double totallength = 0.00;
for (int i = 0; i < feats.Length; i++)
{
@@ -301,5 +297,17 @@
return feats;
}
+ ///
+ /// 获取区域图层内的feature列表,MainFrm.PolygonIntersectAnalysis和此方法重复,需要整理删除
+ ///
+ ///
+ ///
+ ///
+ public static GSOFeatures getLayerFeatures(GSOGeoPolygon3D polygon, GSOLayer layer)
+ {
+ if (layer == null) return null;
+ GSOFeatureLayer flayer = layer as GSOFeatureLayer;
+ return polygon == null ? flayer.GetAllFeatures() : flayer.FindFeaturesInPolygon(polygon, false);
+ }
}
}
diff --git a/FrmBSQStatis.Designer.cs b/FrmBSQStatis.Designer.cs
index 2509c7d..ee9b1e7 100644
--- a/FrmBSQStatis.Designer.cs
+++ b/FrmBSQStatis.Designer.cs
@@ -57,6 +57,7 @@
this.ShowIcon = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "标识器全区域统计";
+ this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FrmBSQStatis_FormClosing);
this.Load += new System.EventHandler(this.FrmBSQStatis_Load);
((System.ComponentModel.ISupportInitialize)(this.chartStatis)).EndInit();
this.ResumeLayout(false);
diff --git a/FrmBSQStatis.cs b/FrmBSQStatis.cs
index a409022..66767ee 100644
--- a/FrmBSQStatis.cs
+++ b/FrmBSQStatis.cs
@@ -19,94 +19,19 @@
public partial class FrmBSQStatis : Office2007Form
{
public Dictionary bsq = new Dictionary();
- //SqlConnection conn;
- //public static List typeLists;
OracleConnection conn;
string connectString;
+ private GSOGlobeControl globeControl1;
+ private GSOGeoPolygon3D polygon;
- public FrmBSQStatis()
+ public FrmBSQStatis(GSOGlobeControl globeControl1,GSOGeoPolygon3D polygon)
{
+ this.globeControl1 = globeControl1;
+ this.polygon = polygon;
InitializeComponent();
- bsq = getBSQNameAndNumMap(null);
- //BSQNumStatis();
+ bsq = getBSQNameAndNumMap(polygon);
}
- string[] codeStr = new string[50];
- string[] nameStr = new string[30];
- public static List pipeLists = new List();
-
- //private void BSQNumStatis()
- //{
- // bool flag2 = false;
- // for (int i = 0; i < Utility.listPipelineType.Count; i++)
- // {
- // for (int j = 0; j < pipeLists.Count; j++)
- // {
- // if (pipeLists[j] == Utility.listPipelineType[i].type)
- // {
- // flag2 = true;
- // break;
- // }
- // }
- // if (!flag2 && Utility.listPipelineType[i].type != "标识器")
- // {
- // pipeLists.Add(Utility.listPipelineType[i].type);
- // }
- // flag2 = false;
- // }
-
- // typeLists = new List();
- // for (int num = 0; num 0)
- // bsq.Add(typeLists[i].type, typeLists[i].num);
- // }
-
- // }
- // catch (Exception ex)
- // {
-
- // }
- //}
private void FrmBSQStatis_Load(object sender, EventArgs e)
{
@@ -137,19 +62,6 @@
}
}
- //public class typeList
- //{
- // public int num;
- // public string type;
-
- // public typeList(int _num, string _type)
- // {
- // num = _num;
- // type = _type;
- // }
- //}
-
-
private Dictionary getBSQNameAndNumMap(GSOGeoPolygon3D polygon)
{
@@ -166,6 +78,12 @@
}
+ return polygon == null ? getAllAreaMap(result, codeAndType) : getBSQMapByPolygon(polygon, result, codeAndType);
+
+ }
+
+ public Dictionary getAllAreaMap(Dictionary typeAndCount,Dictionary codeAndType)
+ {
try
{
conn = OledbHelper.sqlConnection();
@@ -180,8 +98,9 @@
if (str == null) continue;
foreach (string key in codeAndType.Keys)
{
- if (str.Contains(key)) {
- result[codeAndType[key]] += 1;
+ if (str.Contains(key))
+ {
+ typeAndCount[codeAndType[key]] += 1;
}
}
}
@@ -189,10 +108,43 @@
}
catch (Exception ex)
{
-
+ LogHelper.WriteLog(typeof(FrmBSQStatis),ex.Message.ToString());
}
- return result;
+ return typeAndCount;
}
+
+ public Dictionary getBSQMapByPolygon(GSOGeoPolygon3D polygon,Dictionary typeAndCount, Dictionary codeAndType)
+ {
+ GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption("标识器");
+ GSOFeatures bsqFs = FeatureStatisticsService.getLayerFeatures(polygon, layer);
+ if (bsqFs == null || bsqFs.Length <= 0) {
+ LogHelper.WriteLog(typeof(FrmBSQStatis),"标识器图层下的Feature为空");
+ return null;
+ }
+
+ for (int i = 0; i < bsqFs.Length; i++)
+ {
+ string str = bsqFs[i].GetValue("对象名称").ToString();
+
+ foreach (string key in codeAndType.Keys)
+ {
+ if (str.Contains(key))
+ {
+ typeAndCount[codeAndType[key]] += 1;
+ }
+ }
+ }
+
+ return typeAndCount;
+ }
+
+ private void FrmBSQStatis_FormClosing(object sender, FormClosingEventArgs e)
+ {
+ globeControl1.Globe.ClearAnalysis();
+ this.Close();
+ }
+
+
}
}
diff --git a/Cyberpipe.suo b/Cyberpipe.suo
index 1787b1e..526669a 100644
--- a/Cyberpipe.suo
+++ b/Cyberpipe.suo
Binary files differ
diff --git a/FeatureStatisticsService.cs b/FeatureStatisticsService.cs
index e833e5f..c7de210 100644
--- a/FeatureStatisticsService.cs
+++ b/FeatureStatisticsService.cs
@@ -273,19 +273,15 @@
/// 获取特定区域图层的管线列表,并将其总长度统计出来
/// TODOLIST:将Intersects_Pipeline在MainFrm中去除
///
- ///
+ ///
+ /// 要统计的长度
///
public static GSOFeatures getLayerPipes(GSOGeoPolygon3D polygon, GSOLayer layer, out double length)
{
length = 0;
if (layer == null) return null;
- GSOFeatureLayer flayer = layer as GSOFeatureLayer;
- GSOFeatureDataset fdataset = flayer.Dataset as GSOFeatureDataset;
- GSOFeatures feats = null;
-
- feats = polygon == null?flayer.GetAllFeatures():flayer.FindFeaturesInPolygon(polygon, false);
-
+ GSOFeatures feats = getLayerFeatures(polygon, layer);
double totallength = 0.00;
for (int i = 0; i < feats.Length; i++)
{
@@ -301,5 +297,17 @@
return feats;
}
+ ///
+ /// 获取区域图层内的feature列表,MainFrm.PolygonIntersectAnalysis和此方法重复,需要整理删除
+ ///
+ ///
+ ///
+ ///
+ public static GSOFeatures getLayerFeatures(GSOGeoPolygon3D polygon, GSOLayer layer)
+ {
+ if (layer == null) return null;
+ GSOFeatureLayer flayer = layer as GSOFeatureLayer;
+ return polygon == null ? flayer.GetAllFeatures() : flayer.FindFeaturesInPolygon(polygon, false);
+ }
}
}
diff --git a/FrmBSQStatis.Designer.cs b/FrmBSQStatis.Designer.cs
index 2509c7d..ee9b1e7 100644
--- a/FrmBSQStatis.Designer.cs
+++ b/FrmBSQStatis.Designer.cs
@@ -57,6 +57,7 @@
this.ShowIcon = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "标识器全区域统计";
+ this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FrmBSQStatis_FormClosing);
this.Load += new System.EventHandler(this.FrmBSQStatis_Load);
((System.ComponentModel.ISupportInitialize)(this.chartStatis)).EndInit();
this.ResumeLayout(false);
diff --git a/FrmBSQStatis.cs b/FrmBSQStatis.cs
index a409022..66767ee 100644
--- a/FrmBSQStatis.cs
+++ b/FrmBSQStatis.cs
@@ -19,94 +19,19 @@
public partial class FrmBSQStatis : Office2007Form
{
public Dictionary bsq = new Dictionary();
- //SqlConnection conn;
- //public static List typeLists;
OracleConnection conn;
string connectString;
+ private GSOGlobeControl globeControl1;
+ private GSOGeoPolygon3D polygon;
- public FrmBSQStatis()
+ public FrmBSQStatis(GSOGlobeControl globeControl1,GSOGeoPolygon3D polygon)
{
+ this.globeControl1 = globeControl1;
+ this.polygon = polygon;
InitializeComponent();
- bsq = getBSQNameAndNumMap(null);
- //BSQNumStatis();
+ bsq = getBSQNameAndNumMap(polygon);
}
- string[] codeStr = new string[50];
- string[] nameStr = new string[30];
- public static List pipeLists = new List();
-
- //private void BSQNumStatis()
- //{
- // bool flag2 = false;
- // for (int i = 0; i < Utility.listPipelineType.Count; i++)
- // {
- // for (int j = 0; j < pipeLists.Count; j++)
- // {
- // if (pipeLists[j] == Utility.listPipelineType[i].type)
- // {
- // flag2 = true;
- // break;
- // }
- // }
- // if (!flag2 && Utility.listPipelineType[i].type != "标识器")
- // {
- // pipeLists.Add(Utility.listPipelineType[i].type);
- // }
- // flag2 = false;
- // }
-
- // typeLists = new List();
- // for (int num = 0; num 0)
- // bsq.Add(typeLists[i].type, typeLists[i].num);
- // }
-
- // }
- // catch (Exception ex)
- // {
-
- // }
- //}
private void FrmBSQStatis_Load(object sender, EventArgs e)
{
@@ -137,19 +62,6 @@
}
}
- //public class typeList
- //{
- // public int num;
- // public string type;
-
- // public typeList(int _num, string _type)
- // {
- // num = _num;
- // type = _type;
- // }
- //}
-
-
private Dictionary getBSQNameAndNumMap(GSOGeoPolygon3D polygon)
{
@@ -166,6 +78,12 @@
}
+ return polygon == null ? getAllAreaMap(result, codeAndType) : getBSQMapByPolygon(polygon, result, codeAndType);
+
+ }
+
+ public Dictionary getAllAreaMap(Dictionary typeAndCount,Dictionary codeAndType)
+ {
try
{
conn = OledbHelper.sqlConnection();
@@ -180,8 +98,9 @@
if (str == null) continue;
foreach (string key in codeAndType.Keys)
{
- if (str.Contains(key)) {
- result[codeAndType[key]] += 1;
+ if (str.Contains(key))
+ {
+ typeAndCount[codeAndType[key]] += 1;
}
}
}
@@ -189,10 +108,43 @@
}
catch (Exception ex)
{
-
+ LogHelper.WriteLog(typeof(FrmBSQStatis),ex.Message.ToString());
}
- return result;
+ return typeAndCount;
}
+
+ public Dictionary getBSQMapByPolygon(GSOGeoPolygon3D polygon,Dictionary typeAndCount, Dictionary codeAndType)
+ {
+ GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption("标识器");
+ GSOFeatures bsqFs = FeatureStatisticsService.getLayerFeatures(polygon, layer);
+ if (bsqFs == null || bsqFs.Length <= 0) {
+ LogHelper.WriteLog(typeof(FrmBSQStatis),"标识器图层下的Feature为空");
+ return null;
+ }
+
+ for (int i = 0; i < bsqFs.Length; i++)
+ {
+ string str = bsqFs[i].GetValue("对象名称").ToString();
+
+ foreach (string key in codeAndType.Keys)
+ {
+ if (str.Contains(key))
+ {
+ typeAndCount[codeAndType[key]] += 1;
+ }
+ }
+ }
+
+ return typeAndCount;
+ }
+
+ private void FrmBSQStatis_FormClosing(object sender, FormClosingEventArgs e)
+ {
+ globeControl1.Globe.ClearAnalysis();
+ this.Close();
+ }
+
+
}
}
diff --git a/MainFrm.cs b/MainFrm.cs
index e11d0a7..9bfb70e 100644
--- a/MainFrm.cs
+++ b/MainFrm.cs
@@ -2958,18 +2958,19 @@
break;
case "BSQDuoBianXiangStatis":
- GSOFeature f2 = new GSOFeature();
- f2.Geometry = e.Polygon;
- f2.Geometry.AltitudeMode = EnumAltitudeMode.Absolute;
- globeControl1.Globe.MemoryLayer.AddFeature(f2);
- f2.Geometry.MoveZ(3);
- workWellLen.Clear();
- List listBSQ = new List();
+ //GSOFeature f2 = new GSOFeature();
+ //f2.Geometry = e.Polygon;
+ //f2.Geometry.AltitudeMode = EnumAltitudeMode.Absolute;
+ //globeControl1.Globe.MemoryLayer.AddFeature(f2);
+ //f2.Geometry.MoveZ(3);
+ //workWellLen.Clear();
+ //List listBSQ = new List();
- GSOFeatures bsqFeatures = PolygonIntersectAnalysis(e.Polygon, "标识器");
- listBSQ.Add(bsqFeatures);
+ //GSOFeatures bsqFeatures = PolygonIntersectAnalysis(e.Polygon, "标识器");
+ //listBSQ.Add(bsqFeatures);
- FrmBSQDuoBianXingStatis bsqFrm = new FrmBSQDuoBianXingStatis(workWellLen, globeControl1, listBSQ);
+ //FrmBSQDuoBianXingStatis bsqFrm = new FrmBSQDuoBianXingStatis(workWellLen, globeControl1, listBSQ);
+ FrmBSQStatis bsqFrm = new FrmBSQStatis(globeControl1,e.Polygon);
bsqFrm.Show(this);
globeControl1.Globe.Action = EnumAction3D.ActionNull;
break;
@@ -12660,7 +12661,8 @@
private void 标识器分类统计ToolStripMenuItem_Click(object sender, EventArgs e)
{
globeControl1.Globe.Action = EnumAction3D.ActionNull;
- FrmBSQStatis bsqStatis = new FrmBSQStatis();
+ FrmBSQStatis bsqStatis = new FrmBSQStatis(globeControl1,null);
+ //FrmBSQStatis bsqStatis = new FrmBSQStatis();
bsqStatis.Show(this);
}
///
diff --git a/Cyberpipe.suo b/Cyberpipe.suo
index 1787b1e..526669a 100644
--- a/Cyberpipe.suo
+++ b/Cyberpipe.suo
Binary files differ
diff --git a/FeatureStatisticsService.cs b/FeatureStatisticsService.cs
index e833e5f..c7de210 100644
--- a/FeatureStatisticsService.cs
+++ b/FeatureStatisticsService.cs
@@ -273,19 +273,15 @@
/// 获取特定区域图层的管线列表,并将其总长度统计出来
/// TODOLIST:将Intersects_Pipeline在MainFrm中去除
///
- ///
+ ///
+ /// 要统计的长度
///
public static GSOFeatures getLayerPipes(GSOGeoPolygon3D polygon, GSOLayer layer, out double length)
{
length = 0;
if (layer == null) return null;
- GSOFeatureLayer flayer = layer as GSOFeatureLayer;
- GSOFeatureDataset fdataset = flayer.Dataset as GSOFeatureDataset;
- GSOFeatures feats = null;
-
- feats = polygon == null?flayer.GetAllFeatures():flayer.FindFeaturesInPolygon(polygon, false);
-
+ GSOFeatures feats = getLayerFeatures(polygon, layer);
double totallength = 0.00;
for (int i = 0; i < feats.Length; i++)
{
@@ -301,5 +297,17 @@
return feats;
}
+ ///
+ /// 获取区域图层内的feature列表,MainFrm.PolygonIntersectAnalysis和此方法重复,需要整理删除
+ ///
+ ///
+ ///
+ ///
+ public static GSOFeatures getLayerFeatures(GSOGeoPolygon3D polygon, GSOLayer layer)
+ {
+ if (layer == null) return null;
+ GSOFeatureLayer flayer = layer as GSOFeatureLayer;
+ return polygon == null ? flayer.GetAllFeatures() : flayer.FindFeaturesInPolygon(polygon, false);
+ }
}
}
diff --git a/FrmBSQStatis.Designer.cs b/FrmBSQStatis.Designer.cs
index 2509c7d..ee9b1e7 100644
--- a/FrmBSQStatis.Designer.cs
+++ b/FrmBSQStatis.Designer.cs
@@ -57,6 +57,7 @@
this.ShowIcon = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "标识器全区域统计";
+ this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FrmBSQStatis_FormClosing);
this.Load += new System.EventHandler(this.FrmBSQStatis_Load);
((System.ComponentModel.ISupportInitialize)(this.chartStatis)).EndInit();
this.ResumeLayout(false);
diff --git a/FrmBSQStatis.cs b/FrmBSQStatis.cs
index a409022..66767ee 100644
--- a/FrmBSQStatis.cs
+++ b/FrmBSQStatis.cs
@@ -19,94 +19,19 @@
public partial class FrmBSQStatis : Office2007Form
{
public Dictionary bsq = new Dictionary();
- //SqlConnection conn;
- //public static List typeLists;
OracleConnection conn;
string connectString;
+ private GSOGlobeControl globeControl1;
+ private GSOGeoPolygon3D polygon;
- public FrmBSQStatis()
+ public FrmBSQStatis(GSOGlobeControl globeControl1,GSOGeoPolygon3D polygon)
{
+ this.globeControl1 = globeControl1;
+ this.polygon = polygon;
InitializeComponent();
- bsq = getBSQNameAndNumMap(null);
- //BSQNumStatis();
+ bsq = getBSQNameAndNumMap(polygon);
}
- string[] codeStr = new string[50];
- string[] nameStr = new string[30];
- public static List pipeLists = new List();
-
- //private void BSQNumStatis()
- //{
- // bool flag2 = false;
- // for (int i = 0; i < Utility.listPipelineType.Count; i++)
- // {
- // for (int j = 0; j < pipeLists.Count; j++)
- // {
- // if (pipeLists[j] == Utility.listPipelineType[i].type)
- // {
- // flag2 = true;
- // break;
- // }
- // }
- // if (!flag2 && Utility.listPipelineType[i].type != "标识器")
- // {
- // pipeLists.Add(Utility.listPipelineType[i].type);
- // }
- // flag2 = false;
- // }
-
- // typeLists = new List();
- // for (int num = 0; num 0)
- // bsq.Add(typeLists[i].type, typeLists[i].num);
- // }
-
- // }
- // catch (Exception ex)
- // {
-
- // }
- //}
private void FrmBSQStatis_Load(object sender, EventArgs e)
{
@@ -137,19 +62,6 @@
}
}
- //public class typeList
- //{
- // public int num;
- // public string type;
-
- // public typeList(int _num, string _type)
- // {
- // num = _num;
- // type = _type;
- // }
- //}
-
-
private Dictionary getBSQNameAndNumMap(GSOGeoPolygon3D polygon)
{
@@ -166,6 +78,12 @@
}
+ return polygon == null ? getAllAreaMap(result, codeAndType) : getBSQMapByPolygon(polygon, result, codeAndType);
+
+ }
+
+ public Dictionary getAllAreaMap(Dictionary typeAndCount,Dictionary codeAndType)
+ {
try
{
conn = OledbHelper.sqlConnection();
@@ -180,8 +98,9 @@
if (str == null) continue;
foreach (string key in codeAndType.Keys)
{
- if (str.Contains(key)) {
- result[codeAndType[key]] += 1;
+ if (str.Contains(key))
+ {
+ typeAndCount[codeAndType[key]] += 1;
}
}
}
@@ -189,10 +108,43 @@
}
catch (Exception ex)
{
-
+ LogHelper.WriteLog(typeof(FrmBSQStatis),ex.Message.ToString());
}
- return result;
+ return typeAndCount;
}
+
+ public Dictionary getBSQMapByPolygon(GSOGeoPolygon3D polygon,Dictionary typeAndCount, Dictionary codeAndType)
+ {
+ GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption("标识器");
+ GSOFeatures bsqFs = FeatureStatisticsService.getLayerFeatures(polygon, layer);
+ if (bsqFs == null || bsqFs.Length <= 0) {
+ LogHelper.WriteLog(typeof(FrmBSQStatis),"标识器图层下的Feature为空");
+ return null;
+ }
+
+ for (int i = 0; i < bsqFs.Length; i++)
+ {
+ string str = bsqFs[i].GetValue("对象名称").ToString();
+
+ foreach (string key in codeAndType.Keys)
+ {
+ if (str.Contains(key))
+ {
+ typeAndCount[codeAndType[key]] += 1;
+ }
+ }
+ }
+
+ return typeAndCount;
+ }
+
+ private void FrmBSQStatis_FormClosing(object sender, FormClosingEventArgs e)
+ {
+ globeControl1.Globe.ClearAnalysis();
+ this.Close();
+ }
+
+
}
}
diff --git a/MainFrm.cs b/MainFrm.cs
index e11d0a7..9bfb70e 100644
--- a/MainFrm.cs
+++ b/MainFrm.cs
@@ -2958,18 +2958,19 @@
break;
case "BSQDuoBianXiangStatis":
- GSOFeature f2 = new GSOFeature();
- f2.Geometry = e.Polygon;
- f2.Geometry.AltitudeMode = EnumAltitudeMode.Absolute;
- globeControl1.Globe.MemoryLayer.AddFeature(f2);
- f2.Geometry.MoveZ(3);
- workWellLen.Clear();
- List listBSQ = new List();
+ //GSOFeature f2 = new GSOFeature();
+ //f2.Geometry = e.Polygon;
+ //f2.Geometry.AltitudeMode = EnumAltitudeMode.Absolute;
+ //globeControl1.Globe.MemoryLayer.AddFeature(f2);
+ //f2.Geometry.MoveZ(3);
+ //workWellLen.Clear();
+ //List listBSQ = new List();
- GSOFeatures bsqFeatures = PolygonIntersectAnalysis(e.Polygon, "标识器");
- listBSQ.Add(bsqFeatures);
+ //GSOFeatures bsqFeatures = PolygonIntersectAnalysis(e.Polygon, "标识器");
+ //listBSQ.Add(bsqFeatures);
- FrmBSQDuoBianXingStatis bsqFrm = new FrmBSQDuoBianXingStatis(workWellLen, globeControl1, listBSQ);
+ //FrmBSQDuoBianXingStatis bsqFrm = new FrmBSQDuoBianXingStatis(workWellLen, globeControl1, listBSQ);
+ FrmBSQStatis bsqFrm = new FrmBSQStatis(globeControl1,e.Polygon);
bsqFrm.Show(this);
globeControl1.Globe.Action = EnumAction3D.ActionNull;
break;
@@ -12660,7 +12661,8 @@
private void 标识器分类统计ToolStripMenuItem_Click(object sender, EventArgs e)
{
globeControl1.Globe.Action = EnumAction3D.ActionNull;
- FrmBSQStatis bsqStatis = new FrmBSQStatis();
+ FrmBSQStatis bsqStatis = new FrmBSQStatis(globeControl1,null);
+ //FrmBSQStatis bsqStatis = new FrmBSQStatis();
bsqStatis.Show(this);
}
///
diff --git a/bin/x86/Debug/Cyberpipe.exe b/bin/x86/Debug/Cyberpipe.exe
index f720b92..15ba7e2 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 1787b1e..526669a 100644
--- a/Cyberpipe.suo
+++ b/Cyberpipe.suo
Binary files differ
diff --git a/FeatureStatisticsService.cs b/FeatureStatisticsService.cs
index e833e5f..c7de210 100644
--- a/FeatureStatisticsService.cs
+++ b/FeatureStatisticsService.cs
@@ -273,19 +273,15 @@
/// 获取特定区域图层的管线列表,并将其总长度统计出来
/// TODOLIST:将Intersects_Pipeline在MainFrm中去除
///
- ///
+ ///
+ /// 要统计的长度
///
public static GSOFeatures getLayerPipes(GSOGeoPolygon3D polygon, GSOLayer layer, out double length)
{
length = 0;
if (layer == null) return null;
- GSOFeatureLayer flayer = layer as GSOFeatureLayer;
- GSOFeatureDataset fdataset = flayer.Dataset as GSOFeatureDataset;
- GSOFeatures feats = null;
-
- feats = polygon == null?flayer.GetAllFeatures():flayer.FindFeaturesInPolygon(polygon, false);
-
+ GSOFeatures feats = getLayerFeatures(polygon, layer);
double totallength = 0.00;
for (int i = 0; i < feats.Length; i++)
{
@@ -301,5 +297,17 @@
return feats;
}
+ ///
+ /// 获取区域图层内的feature列表,MainFrm.PolygonIntersectAnalysis和此方法重复,需要整理删除
+ ///
+ ///
+ ///
+ ///
+ public static GSOFeatures getLayerFeatures(GSOGeoPolygon3D polygon, GSOLayer layer)
+ {
+ if (layer == null) return null;
+ GSOFeatureLayer flayer = layer as GSOFeatureLayer;
+ return polygon == null ? flayer.GetAllFeatures() : flayer.FindFeaturesInPolygon(polygon, false);
+ }
}
}
diff --git a/FrmBSQStatis.Designer.cs b/FrmBSQStatis.Designer.cs
index 2509c7d..ee9b1e7 100644
--- a/FrmBSQStatis.Designer.cs
+++ b/FrmBSQStatis.Designer.cs
@@ -57,6 +57,7 @@
this.ShowIcon = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "标识器全区域统计";
+ this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FrmBSQStatis_FormClosing);
this.Load += new System.EventHandler(this.FrmBSQStatis_Load);
((System.ComponentModel.ISupportInitialize)(this.chartStatis)).EndInit();
this.ResumeLayout(false);
diff --git a/FrmBSQStatis.cs b/FrmBSQStatis.cs
index a409022..66767ee 100644
--- a/FrmBSQStatis.cs
+++ b/FrmBSQStatis.cs
@@ -19,94 +19,19 @@
public partial class FrmBSQStatis : Office2007Form
{
public Dictionary bsq = new Dictionary();
- //SqlConnection conn;
- //public static List typeLists;
OracleConnection conn;
string connectString;
+ private GSOGlobeControl globeControl1;
+ private GSOGeoPolygon3D polygon;
- public FrmBSQStatis()
+ public FrmBSQStatis(GSOGlobeControl globeControl1,GSOGeoPolygon3D polygon)
{
+ this.globeControl1 = globeControl1;
+ this.polygon = polygon;
InitializeComponent();
- bsq = getBSQNameAndNumMap(null);
- //BSQNumStatis();
+ bsq = getBSQNameAndNumMap(polygon);
}
- string[] codeStr = new string[50];
- string[] nameStr = new string[30];
- public static List pipeLists = new List();
-
- //private void BSQNumStatis()
- //{
- // bool flag2 = false;
- // for (int i = 0; i < Utility.listPipelineType.Count; i++)
- // {
- // for (int j = 0; j < pipeLists.Count; j++)
- // {
- // if (pipeLists[j] == Utility.listPipelineType[i].type)
- // {
- // flag2 = true;
- // break;
- // }
- // }
- // if (!flag2 && Utility.listPipelineType[i].type != "标识器")
- // {
- // pipeLists.Add(Utility.listPipelineType[i].type);
- // }
- // flag2 = false;
- // }
-
- // typeLists = new List();
- // for (int num = 0; num 0)
- // bsq.Add(typeLists[i].type, typeLists[i].num);
- // }
-
- // }
- // catch (Exception ex)
- // {
-
- // }
- //}
private void FrmBSQStatis_Load(object sender, EventArgs e)
{
@@ -137,19 +62,6 @@
}
}
- //public class typeList
- //{
- // public int num;
- // public string type;
-
- // public typeList(int _num, string _type)
- // {
- // num = _num;
- // type = _type;
- // }
- //}
-
-
private Dictionary getBSQNameAndNumMap(GSOGeoPolygon3D polygon)
{
@@ -166,6 +78,12 @@
}
+ return polygon == null ? getAllAreaMap(result, codeAndType) : getBSQMapByPolygon(polygon, result, codeAndType);
+
+ }
+
+ public Dictionary getAllAreaMap(Dictionary typeAndCount,Dictionary codeAndType)
+ {
try
{
conn = OledbHelper.sqlConnection();
@@ -180,8 +98,9 @@
if (str == null) continue;
foreach (string key in codeAndType.Keys)
{
- if (str.Contains(key)) {
- result[codeAndType[key]] += 1;
+ if (str.Contains(key))
+ {
+ typeAndCount[codeAndType[key]] += 1;
}
}
}
@@ -189,10 +108,43 @@
}
catch (Exception ex)
{
-
+ LogHelper.WriteLog(typeof(FrmBSQStatis),ex.Message.ToString());
}
- return result;
+ return typeAndCount;
}
+
+ public Dictionary getBSQMapByPolygon(GSOGeoPolygon3D polygon,Dictionary typeAndCount, Dictionary codeAndType)
+ {
+ GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption("标识器");
+ GSOFeatures bsqFs = FeatureStatisticsService.getLayerFeatures(polygon, layer);
+ if (bsqFs == null || bsqFs.Length <= 0) {
+ LogHelper.WriteLog(typeof(FrmBSQStatis),"标识器图层下的Feature为空");
+ return null;
+ }
+
+ for (int i = 0; i < bsqFs.Length; i++)
+ {
+ string str = bsqFs[i].GetValue("对象名称").ToString();
+
+ foreach (string key in codeAndType.Keys)
+ {
+ if (str.Contains(key))
+ {
+ typeAndCount[codeAndType[key]] += 1;
+ }
+ }
+ }
+
+ return typeAndCount;
+ }
+
+ private void FrmBSQStatis_FormClosing(object sender, FormClosingEventArgs e)
+ {
+ globeControl1.Globe.ClearAnalysis();
+ this.Close();
+ }
+
+
}
}
diff --git a/MainFrm.cs b/MainFrm.cs
index e11d0a7..9bfb70e 100644
--- a/MainFrm.cs
+++ b/MainFrm.cs
@@ -2958,18 +2958,19 @@
break;
case "BSQDuoBianXiangStatis":
- GSOFeature f2 = new GSOFeature();
- f2.Geometry = e.Polygon;
- f2.Geometry.AltitudeMode = EnumAltitudeMode.Absolute;
- globeControl1.Globe.MemoryLayer.AddFeature(f2);
- f2.Geometry.MoveZ(3);
- workWellLen.Clear();
- List listBSQ = new List();
+ //GSOFeature f2 = new GSOFeature();
+ //f2.Geometry = e.Polygon;
+ //f2.Geometry.AltitudeMode = EnumAltitudeMode.Absolute;
+ //globeControl1.Globe.MemoryLayer.AddFeature(f2);
+ //f2.Geometry.MoveZ(3);
+ //workWellLen.Clear();
+ //List listBSQ = new List();
- GSOFeatures bsqFeatures = PolygonIntersectAnalysis(e.Polygon, "标识器");
- listBSQ.Add(bsqFeatures);
+ //GSOFeatures bsqFeatures = PolygonIntersectAnalysis(e.Polygon, "标识器");
+ //listBSQ.Add(bsqFeatures);
- FrmBSQDuoBianXingStatis bsqFrm = new FrmBSQDuoBianXingStatis(workWellLen, globeControl1, listBSQ);
+ //FrmBSQDuoBianXingStatis bsqFrm = new FrmBSQDuoBianXingStatis(workWellLen, globeControl1, listBSQ);
+ FrmBSQStatis bsqFrm = new FrmBSQStatis(globeControl1,e.Polygon);
bsqFrm.Show(this);
globeControl1.Globe.Action = EnumAction3D.ActionNull;
break;
@@ -12660,7 +12661,8 @@
private void 标识器分类统计ToolStripMenuItem_Click(object sender, EventArgs e)
{
globeControl1.Globe.Action = EnumAction3D.ActionNull;
- FrmBSQStatis bsqStatis = new FrmBSQStatis();
+ FrmBSQStatis bsqStatis = new FrmBSQStatis(globeControl1,null);
+ //FrmBSQStatis bsqStatis = new FrmBSQStatis();
bsqStatis.Show(this);
}
///
diff --git a/bin/x86/Debug/Cyberpipe.exe b/bin/x86/Debug/Cyberpipe.exe
index f720b92..15ba7e2 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 4513dbd..111a519 100644
--- a/bin/x86/Debug/Cyberpipe.pdb
+++ b/bin/x86/Debug/Cyberpipe.pdb
Binary files differ