diff --git a/Cyberpipe.suo b/Cyberpipe.suo
index 9a3c1e6..b66c3fa 100644
--- a/Cyberpipe.suo
+++ b/Cyberpipe.suo
Binary files differ
diff --git a/Cyberpipe.suo b/Cyberpipe.suo
index 9a3c1e6..b66c3fa 100644
--- a/Cyberpipe.suo
+++ b/Cyberpipe.suo
Binary files differ
diff --git a/FeatureStatisticsService.cs b/FeatureStatisticsService.cs
index 8686f85..7b5caad 100644
--- a/FeatureStatisticsService.cs
+++ b/FeatureStatisticsService.cs
@@ -6,6 +6,8 @@
using GeoScene.Globe;
using GeoScene.Engine;
+using System.Windows.Forms;
+
namespace Cyberpipe
{
class FeatureStatisticsService
@@ -18,7 +20,7 @@
///
///
- private GSOFeatures Intersect_PointLayerByType(GSOGeoPolygon3D polygon, GSOLayer layer, string type)
+ public GSOFeatures Intersect_PointLayerByType(GSOGeoPolygon3D polygon, GSOLayer layer, string type)
{
if (layer == null) return null;
@@ -43,8 +45,8 @@
return newfeats;
}
-
-
+
+
///
///
/// 根据附属物列表,统计该类附属物个数
@@ -55,7 +57,7 @@
{
if (feats == null || feats.Length == 0) return null;
Dictionary result = new Dictionary();
- result.Add(feats[0].GetFieldAsString("附属物名称"),feats.Length);
+ result.Add(feats[0].GetFieldAsString("附属物名称"), feats.Length);
return result;
}
///
@@ -73,14 +75,15 @@
FeaturesClassfyResult result = new FeaturesClassfyResult();
double totalLength = 0.0;
int ncount = 0;
- GSOFeatures features = getPipesByValueSection( polygon, layer, min, max, fieldName);
- for (int i = 0; i < features.Length;i++ ) {
+ GSOFeatures features = getPipesByValueSection(polygon, layer, min, max, fieldName);
+ for (int i = 0; i < features.Length; i++)
+ {
GSOGeoPolyline3D line = features[i].Geometry as GSOGeoPolyline3D;
double length = line.GetSpaceLength(true, 6378137);
totalLength += length;
ncount += 1;
}
- string filedValue = (min == null) ? "不限":min+"-";
+ string filedValue = (min == null) ? "不限" : min + "-";
filedValue += (max == null) ? "不限" : max + "";
result.layerName = layer.Caption;
result.groupFieldValue = filedValue;//上下限的拼接
@@ -99,20 +102,21 @@
/// 上限
/// 统计类型:"起始埋深"或"管径_毫米"
///
- 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();
GSOFeatureLayer flayer = layer as GSOFeatureLayer;
//TODOLIST:优化为只获取管线,目前不清楚调用方式
- GSOFeatures feats = ( polygon == null )? flayer.GetAllFeatures() : flayer.FindFeaturesInPolygon(polygon, false);
+ GSOFeatures feats = (polygon == null) ? flayer.GetAllFeatures() : flayer.FindFeaturesInPolygon(polygon, false);
- double minValue = min ?? Double.MinValue ;
+ double minValue = min ?? Double.MinValue;
double maxValue = max ?? Double.MaxValue;
-
+
//筛选出符合条件的
- for (int i = 0; i < feats.Length;i++ )
+ for (int i = 0; i < feats.Length; i++)
{
double radius = feats[i].GetFieldAsDouble(fieldName);
if (radius >= min && radius <= max)
@@ -121,17 +125,17 @@
}
}
-
+
return result;
-
+
}
//图层名称、管径、条数、总长度
public List groupPipeByDiameter(GSOGeoPolygon3D polygon, GSOLayer layer)
{
if (layer == null) return null;
- List result = new List() ;
-
+ List result = new List();
+
GSOFeatureLayer flayer = layer as GSOFeatureLayer;
//TODOLIST:优化为只获取管线,目前不清楚调用方式
@@ -173,7 +177,7 @@
}
}
return result;
-
+
}
//图层名称、附属物个数
///
@@ -208,7 +212,7 @@
//过滤
for (int n = 0; n < feats.Length; n++)
{
- if (feats[n].GetFieldAsString("附属物名称").Contains(accessStrs[j])) newfeats.Add(feats[n]);
+ if (feats[n].GetFieldAsString("附属物名称").Contains(accessStrs[j])) newfeats.Add(feats[n]);
}
ncount = newfeats.Length;
}
@@ -218,10 +222,10 @@
featuresClass.layerName = accessStrs[j];
featuresClass.ncount = ncount;
- result.Add(featuresClass);
+ result.Add(featuresClass);
}
return result;
-
+
}
///
@@ -231,11 +235,11 @@
///
/// 材质
///
- public FeaturesClassfyResult groupPipeByMaterial(GSOGeoPolygon3D polygon, GSOLayer layer,string material)
- {
- if (layer == null) return null;
- FeaturesClassfyResult result = new FeaturesClassfyResult() ;
-
+ public FeaturesClassfyResult groupPipeByMaterial(GSOGeoPolygon3D polygon, GSOLayer layer, string material)
+ {
+ if (layer == null) return null;
+ FeaturesClassfyResult result = new FeaturesClassfyResult();
+
GSOFeatureLayer flayer = layer as GSOFeatureLayer;
//TODOLIST:优化为只获取管线,目前不清楚调用方式
@@ -244,7 +248,7 @@
string fixedMaterial = material == "无" ? "" : material;
double totalLength = 0.00;
int ncount = 0;
- for (int i = 0; i < feats.Length;i++ )
+ for (int i = 0; i < feats.Length; i++)
{
if (feats[i].GetFieldAsString("材质").Equals(fixedMaterial))
{
@@ -255,7 +259,7 @@
totalLength += length;
ncount += 1;
}
- }
+ }
}
result.layerName = layer.Caption;
@@ -264,13 +268,9 @@
result.sum = totalLength;
return result;
}
-
-
-
-
}
}
diff --git a/Cyberpipe.suo b/Cyberpipe.suo
index 9a3c1e6..b66c3fa 100644
--- a/Cyberpipe.suo
+++ b/Cyberpipe.suo
Binary files differ
diff --git a/FeatureStatisticsService.cs b/FeatureStatisticsService.cs
index 8686f85..7b5caad 100644
--- a/FeatureStatisticsService.cs
+++ b/FeatureStatisticsService.cs
@@ -6,6 +6,8 @@
using GeoScene.Globe;
using GeoScene.Engine;
+using System.Windows.Forms;
+
namespace Cyberpipe
{
class FeatureStatisticsService
@@ -18,7 +20,7 @@
///
///
- private GSOFeatures Intersect_PointLayerByType(GSOGeoPolygon3D polygon, GSOLayer layer, string type)
+ public GSOFeatures Intersect_PointLayerByType(GSOGeoPolygon3D polygon, GSOLayer layer, string type)
{
if (layer == null) return null;
@@ -43,8 +45,8 @@
return newfeats;
}
-
-
+
+
///
///
/// 根据附属物列表,统计该类附属物个数
@@ -55,7 +57,7 @@
{
if (feats == null || feats.Length == 0) return null;
Dictionary result = new Dictionary();
- result.Add(feats[0].GetFieldAsString("附属物名称"),feats.Length);
+ result.Add(feats[0].GetFieldAsString("附属物名称"), feats.Length);
return result;
}
///
@@ -73,14 +75,15 @@
FeaturesClassfyResult result = new FeaturesClassfyResult();
double totalLength = 0.0;
int ncount = 0;
- GSOFeatures features = getPipesByValueSection( polygon, layer, min, max, fieldName);
- for (int i = 0; i < features.Length;i++ ) {
+ GSOFeatures features = getPipesByValueSection(polygon, layer, min, max, fieldName);
+ for (int i = 0; i < features.Length; i++)
+ {
GSOGeoPolyline3D line = features[i].Geometry as GSOGeoPolyline3D;
double length = line.GetSpaceLength(true, 6378137);
totalLength += length;
ncount += 1;
}
- string filedValue = (min == null) ? "不限":min+"-";
+ string filedValue = (min == null) ? "不限" : min + "-";
filedValue += (max == null) ? "不限" : max + "";
result.layerName = layer.Caption;
result.groupFieldValue = filedValue;//上下限的拼接
@@ -99,20 +102,21 @@
/// 上限
/// 统计类型:"起始埋深"或"管径_毫米"
///
- 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();
GSOFeatureLayer flayer = layer as GSOFeatureLayer;
//TODOLIST:优化为只获取管线,目前不清楚调用方式
- GSOFeatures feats = ( polygon == null )? flayer.GetAllFeatures() : flayer.FindFeaturesInPolygon(polygon, false);
+ GSOFeatures feats = (polygon == null) ? flayer.GetAllFeatures() : flayer.FindFeaturesInPolygon(polygon, false);
- double minValue = min ?? Double.MinValue ;
+ double minValue = min ?? Double.MinValue;
double maxValue = max ?? Double.MaxValue;
-
+
//筛选出符合条件的
- for (int i = 0; i < feats.Length;i++ )
+ for (int i = 0; i < feats.Length; i++)
{
double radius = feats[i].GetFieldAsDouble(fieldName);
if (radius >= min && radius <= max)
@@ -121,17 +125,17 @@
}
}
-
+
return result;
-
+
}
//图层名称、管径、条数、总长度
public List groupPipeByDiameter(GSOGeoPolygon3D polygon, GSOLayer layer)
{
if (layer == null) return null;
- List result = new List() ;
-
+ List result = new List();
+
GSOFeatureLayer flayer = layer as GSOFeatureLayer;
//TODOLIST:优化为只获取管线,目前不清楚调用方式
@@ -173,7 +177,7 @@
}
}
return result;
-
+
}
//图层名称、附属物个数
///
@@ -208,7 +212,7 @@
//过滤
for (int n = 0; n < feats.Length; n++)
{
- if (feats[n].GetFieldAsString("附属物名称").Contains(accessStrs[j])) newfeats.Add(feats[n]);
+ if (feats[n].GetFieldAsString("附属物名称").Contains(accessStrs[j])) newfeats.Add(feats[n]);
}
ncount = newfeats.Length;
}
@@ -218,10 +222,10 @@
featuresClass.layerName = accessStrs[j];
featuresClass.ncount = ncount;
- result.Add(featuresClass);
+ result.Add(featuresClass);
}
return result;
-
+
}
///
@@ -231,11 +235,11 @@
///
/// 材质
///
- public FeaturesClassfyResult groupPipeByMaterial(GSOGeoPolygon3D polygon, GSOLayer layer,string material)
- {
- if (layer == null) return null;
- FeaturesClassfyResult result = new FeaturesClassfyResult() ;
-
+ public FeaturesClassfyResult groupPipeByMaterial(GSOGeoPolygon3D polygon, GSOLayer layer, string material)
+ {
+ if (layer == null) return null;
+ FeaturesClassfyResult result = new FeaturesClassfyResult();
+
GSOFeatureLayer flayer = layer as GSOFeatureLayer;
//TODOLIST:优化为只获取管线,目前不清楚调用方式
@@ -244,7 +248,7 @@
string fixedMaterial = material == "无" ? "" : material;
double totalLength = 0.00;
int ncount = 0;
- for (int i = 0; i < feats.Length;i++ )
+ for (int i = 0; i < feats.Length; i++)
{
if (feats[i].GetFieldAsString("材质").Equals(fixedMaterial))
{
@@ -255,7 +259,7 @@
totalLength += length;
ncount += 1;
}
- }
+ }
}
result.layerName = layer.Caption;
@@ -264,13 +268,9 @@
result.sum = totalLength;
return result;
}
-
-
-
-
}
}
diff --git a/FrmAllWorkWellStatis.cs b/FrmAllWorkWellStatis.cs
index 4f0593d..fe2b7f8 100644
--- a/FrmAllWorkWellStatis.cs
+++ b/FrmAllWorkWellStatis.cs
@@ -9,30 +9,45 @@
using GeoScene.Data;
using GeoScene.Globe;
using DevComponents.DotNetBar;
+using System.Collections;
namespace Cyberpipe
{
public partial class FrmAllWorkWellStatis : DevComponents.DotNetBar.Office2007Form
{
- Dictionary workWellLengthAndType = new Dictionary();
- List list = new List();
+
+ private MainFrm.DataGridViewDelegate m_InitDataGridViewX1;
+ private Dictionary map = null;
DataGridView dataGridViewX1;
ToolStripStatusLabel toolStripNumbers;
GSOGlobeControl globeControl1;
PanelEx panel;
- public FrmAllWorkWellStatis(Dictionary wellLen, List _list, DataGridView dataGridViewX11, ToolStripStatusLabel toolStripNumbers1, GSOGlobeControl ctl, PanelEx p)
+ //TODOLIST:用晓伟的代理进行操作,功能拆分细化
+ public FrmAllWorkWellStatis(GSOGeoPolygon3D polygon, DataGridView dataGridViewX11, ToolStripStatusLabel toolStripNumbers1, GSOGlobeControl ctl, PanelEx p)
{
InitializeComponent();
panel = p;
- workWellLengthAndType = wellLen;
- list = _list;
dataGridViewX1 = dataGridViewX11;
toolStripNumbers = toolStripNumbers1;
-
globeControl1 = ctl;
+ map = getAccsMap(polygon);
+
+ }
+ public FrmAllWorkWellStatis(GSOGeoPolygon3D polygon, MainFrm.DataGridViewDelegate InitDataGridViewX1, GSOGlobeControl ctl)
+ {
+ InitializeComponent();
+ globeControl1 = ctl;
+ m_InitDataGridViewX1 = InitDataGridViewX1;
+ map = getAccsMap(polygon);
+
}
private void FrmAllPipelineStatis_Load(object sender, EventArgs e)
{
+ drawChart();
+ }
+
+ public void drawChart()
+ {
try
{
// Set axis title
@@ -49,6 +64,11 @@
chartAllAreaPipeline.Series["井盖"]["DrawingStyle"] = "Cylinder";
//chartAllAreaPipeline.Series[0].IsValueShownAsLabel = true;
+ Dictionary workWellLengthAndType = new Dictionary();
+ foreach (KeyValuePair kv in map)
+ {
+ workWellLengthAndType.Add(kv.Key, kv.Value.Length);
+ }
chartAllAreaPipeline.Series["井盖"].Points.DataBindXY(workWellLengthAndType.Keys, workWellLengthAndType.Values);
for (int m = 0; m < workWellLengthAndType.Values.Count; m++)
{
@@ -71,11 +91,11 @@
if (indexHit >= 0)
{
- GSOFeatures fs = list[indexHit];
+ //GSOFeatures fs = list[indexHit];
string sql = "";
string pipetype = chartAllAreaPipeline.Series["井盖"].Points[indexHit].AxisLabel;
-
+ GSOFeatures fs = map[pipetype];
string layername = "";
if (pipetype.EndsWith("窖井") || pipetype.EndsWith("表井") ||
(pipetype.EndsWith("窨井")) || pipetype.EndsWith("孔") ||
@@ -93,6 +113,23 @@
{
return;
}
+ //从图层获取datatable数据,不涉及数据库操作,速度会快一些
+ //string [] fieldNames = GSOFeatureUtils.getFields(layername, globeControl1);
+ //DataTable dt = GSOFeatureUtils.convertGSOFeatures2DataTable(fs,fieldNames);
+ //if (dt.Rows.Count > 0)
+ //{
+ // dataGridViewX1.DataSource = dt;
+ // panel.Visible = true;
+ // toolStripNumbers.Text = " 井盖类型:" + pipetype + "||共有:" + Convert.ToString(dt.Rows.Count) + "条记录";
+ //}
+ //else
+ //{
+ // panel.Visible = false;
+ // dataGridViewX1.DataSource = null;
+ // dataGridViewX1.Refresh();
+ // toolStripNumbers.Text = "类型:";
+ //}
+ //数据库获取数据
if (fs.Length > 0)
{
sql = "select " + getpipeLineFields.getFields(layername, globeControl1) + " from " + layer.Name;
@@ -120,8 +157,8 @@
{
dataGridViewX1.DataSource = dt;
panel.Visible = true;
- //toolStripNumbers.Text = " 井盖类型:" + MainFrm.m_CurrentQueryLayer + "||共有:" + Convert.ToString(dt.Rows.Count) + "条记录";
- toolStripNumbers.Text = " 井盖类型:" + pipetype + "||共有:" + Convert.ToString(dt.Rows.Count) + "条记录";
+ string strLable = toolStripNumbers.Text = " 井盖类型:" + pipetype + "||共有:" + Convert.ToString(dt.Rows.Count) + "条记录";
+ //m_InitDataGridViewX1(dt, strLable, "", true);
}
else
{
@@ -131,7 +168,6 @@
toolStripNumbers.Text = "类型:";
}
- //}
}
@@ -174,7 +210,7 @@
}
}
}
-
+ //m_InitDataGridViewX1(null,"","" , false);
globeControl1.Globe.MemoryLayer.RemoveAllFeature();
}
@@ -183,5 +219,63 @@
PATM_Forms.F_PATMTitle frm = new PATM_Forms.F_PATMTitle("S", chartAllAreaPipeline);
frm.Show();
}
+
+ //获取指定layer类型的附属物名称列表
+ public string[] getLayerAccNames(string layerType)
+ {
+ GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(layerType + "管线附属物");
+ if (layer == null) return null;
+
+ string sql = "select 附属物名称 from " + layerType + "管线附属物 group by 附属物名称";
+ DataSet dataset = OledbHelper.getDataSet(sql, layerType + "管线附属物");
+ if (dataset == null) return null;
+
+ int count = dataset.Tables[0].Rows.Count;
+
+
+ string[] result = new string[count];
+ for (int i = 0; i < count; i++)
+ {
+ result[i] = dataset.Tables[0].Rows[i][0].ToString();
+ }
+ return result;
+ }
+
+ ///
+ /// 获取区域内各图层的井、孔、蓖的map
+ ///
+ /// 区域
+ /// 要查找的附属物名称数组、如井、孔、蓖
+ /// 返回值为:<图层+附属物名称,附属物列表>
+
+ public Dictionary getAccsMap(GSOGeoPolygon3D polygon)
+ {
+ //List list = new List();
+ Dictionary map = new Dictionary();
+ ArrayList listpt = Utility.LayerNamesList;
+ if (listpt == null || listpt.Count == 0) return null;
+ FeatureStatisticsService service = new FeatureStatisticsService();
+ for (int i = 0; i < listpt.Count; i++)
+ {
+ GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(listpt[i] + "管线附属物");
+ string[] accNames = getLayerAccNames(listpt[i] as string);
+ if (accNames == null || accNames.Length == 0) continue;//排除不合法的值
+ for (int j = 0; j < accNames.Length; j++)
+ {
+ if (accNames[j].Contains("井") || accNames[j].Contains("孔") || accNames[j].Contains("篦"))
+ {
+
+ GSOFeatures features = service.Intersect_PointLayerByType(polygon, layer, accNames[j]);
+ if (features == null) continue;
+ map.Add(listpt[i] + accNames[j], features);
+ }
+
+ }
+
+ }
+ return map;
+
+ }
+
}
}
diff --git a/Cyberpipe.suo b/Cyberpipe.suo
index 9a3c1e6..b66c3fa 100644
--- a/Cyberpipe.suo
+++ b/Cyberpipe.suo
Binary files differ
diff --git a/FeatureStatisticsService.cs b/FeatureStatisticsService.cs
index 8686f85..7b5caad 100644
--- a/FeatureStatisticsService.cs
+++ b/FeatureStatisticsService.cs
@@ -6,6 +6,8 @@
using GeoScene.Globe;
using GeoScene.Engine;
+using System.Windows.Forms;
+
namespace Cyberpipe
{
class FeatureStatisticsService
@@ -18,7 +20,7 @@
///
///
- private GSOFeatures Intersect_PointLayerByType(GSOGeoPolygon3D polygon, GSOLayer layer, string type)
+ public GSOFeatures Intersect_PointLayerByType(GSOGeoPolygon3D polygon, GSOLayer layer, string type)
{
if (layer == null) return null;
@@ -43,8 +45,8 @@
return newfeats;
}
-
-
+
+
///
///
/// 根据附属物列表,统计该类附属物个数
@@ -55,7 +57,7 @@
{
if (feats == null || feats.Length == 0) return null;
Dictionary result = new Dictionary();
- result.Add(feats[0].GetFieldAsString("附属物名称"),feats.Length);
+ result.Add(feats[0].GetFieldAsString("附属物名称"), feats.Length);
return result;
}
///
@@ -73,14 +75,15 @@
FeaturesClassfyResult result = new FeaturesClassfyResult();
double totalLength = 0.0;
int ncount = 0;
- GSOFeatures features = getPipesByValueSection( polygon, layer, min, max, fieldName);
- for (int i = 0; i < features.Length;i++ ) {
+ GSOFeatures features = getPipesByValueSection(polygon, layer, min, max, fieldName);
+ for (int i = 0; i < features.Length; i++)
+ {
GSOGeoPolyline3D line = features[i].Geometry as GSOGeoPolyline3D;
double length = line.GetSpaceLength(true, 6378137);
totalLength += length;
ncount += 1;
}
- string filedValue = (min == null) ? "不限":min+"-";
+ string filedValue = (min == null) ? "不限" : min + "-";
filedValue += (max == null) ? "不限" : max + "";
result.layerName = layer.Caption;
result.groupFieldValue = filedValue;//上下限的拼接
@@ -99,20 +102,21 @@
/// 上限
/// 统计类型:"起始埋深"或"管径_毫米"
///
- 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();
GSOFeatureLayer flayer = layer as GSOFeatureLayer;
//TODOLIST:优化为只获取管线,目前不清楚调用方式
- GSOFeatures feats = ( polygon == null )? flayer.GetAllFeatures() : flayer.FindFeaturesInPolygon(polygon, false);
+ GSOFeatures feats = (polygon == null) ? flayer.GetAllFeatures() : flayer.FindFeaturesInPolygon(polygon, false);
- double minValue = min ?? Double.MinValue ;
+ double minValue = min ?? Double.MinValue;
double maxValue = max ?? Double.MaxValue;
-
+
//筛选出符合条件的
- for (int i = 0; i < feats.Length;i++ )
+ for (int i = 0; i < feats.Length; i++)
{
double radius = feats[i].GetFieldAsDouble(fieldName);
if (radius >= min && radius <= max)
@@ -121,17 +125,17 @@
}
}
-
+
return result;
-
+
}
//图层名称、管径、条数、总长度
public List groupPipeByDiameter(GSOGeoPolygon3D polygon, GSOLayer layer)
{
if (layer == null) return null;
- List result = new List() ;
-
+ List result = new List();
+
GSOFeatureLayer flayer = layer as GSOFeatureLayer;
//TODOLIST:优化为只获取管线,目前不清楚调用方式
@@ -173,7 +177,7 @@
}
}
return result;
-
+
}
//图层名称、附属物个数
///
@@ -208,7 +212,7 @@
//过滤
for (int n = 0; n < feats.Length; n++)
{
- if (feats[n].GetFieldAsString("附属物名称").Contains(accessStrs[j])) newfeats.Add(feats[n]);
+ if (feats[n].GetFieldAsString("附属物名称").Contains(accessStrs[j])) newfeats.Add(feats[n]);
}
ncount = newfeats.Length;
}
@@ -218,10 +222,10 @@
featuresClass.layerName = accessStrs[j];
featuresClass.ncount = ncount;
- result.Add(featuresClass);
+ result.Add(featuresClass);
}
return result;
-
+
}
///
@@ -231,11 +235,11 @@
///
/// 材质
///
- public FeaturesClassfyResult groupPipeByMaterial(GSOGeoPolygon3D polygon, GSOLayer layer,string material)
- {
- if (layer == null) return null;
- FeaturesClassfyResult result = new FeaturesClassfyResult() ;
-
+ public FeaturesClassfyResult groupPipeByMaterial(GSOGeoPolygon3D polygon, GSOLayer layer, string material)
+ {
+ if (layer == null) return null;
+ FeaturesClassfyResult result = new FeaturesClassfyResult();
+
GSOFeatureLayer flayer = layer as GSOFeatureLayer;
//TODOLIST:优化为只获取管线,目前不清楚调用方式
@@ -244,7 +248,7 @@
string fixedMaterial = material == "无" ? "" : material;
double totalLength = 0.00;
int ncount = 0;
- for (int i = 0; i < feats.Length;i++ )
+ for (int i = 0; i < feats.Length; i++)
{
if (feats[i].GetFieldAsString("材质").Equals(fixedMaterial))
{
@@ -255,7 +259,7 @@
totalLength += length;
ncount += 1;
}
- }
+ }
}
result.layerName = layer.Caption;
@@ -264,13 +268,9 @@
result.sum = totalLength;
return result;
}
-
-
-
-
}
}
diff --git a/FrmAllWorkWellStatis.cs b/FrmAllWorkWellStatis.cs
index 4f0593d..fe2b7f8 100644
--- a/FrmAllWorkWellStatis.cs
+++ b/FrmAllWorkWellStatis.cs
@@ -9,30 +9,45 @@
using GeoScene.Data;
using GeoScene.Globe;
using DevComponents.DotNetBar;
+using System.Collections;
namespace Cyberpipe
{
public partial class FrmAllWorkWellStatis : DevComponents.DotNetBar.Office2007Form
{
- Dictionary workWellLengthAndType = new Dictionary();
- List list = new List();
+
+ private MainFrm.DataGridViewDelegate m_InitDataGridViewX1;
+ private Dictionary map = null;
DataGridView dataGridViewX1;
ToolStripStatusLabel toolStripNumbers;
GSOGlobeControl globeControl1;
PanelEx panel;
- public FrmAllWorkWellStatis(Dictionary wellLen, List _list, DataGridView dataGridViewX11, ToolStripStatusLabel toolStripNumbers1, GSOGlobeControl ctl, PanelEx p)
+ //TODOLIST:用晓伟的代理进行操作,功能拆分细化
+ public FrmAllWorkWellStatis(GSOGeoPolygon3D polygon, DataGridView dataGridViewX11, ToolStripStatusLabel toolStripNumbers1, GSOGlobeControl ctl, PanelEx p)
{
InitializeComponent();
panel = p;
- workWellLengthAndType = wellLen;
- list = _list;
dataGridViewX1 = dataGridViewX11;
toolStripNumbers = toolStripNumbers1;
-
globeControl1 = ctl;
+ map = getAccsMap(polygon);
+
+ }
+ public FrmAllWorkWellStatis(GSOGeoPolygon3D polygon, MainFrm.DataGridViewDelegate InitDataGridViewX1, GSOGlobeControl ctl)
+ {
+ InitializeComponent();
+ globeControl1 = ctl;
+ m_InitDataGridViewX1 = InitDataGridViewX1;
+ map = getAccsMap(polygon);
+
}
private void FrmAllPipelineStatis_Load(object sender, EventArgs e)
{
+ drawChart();
+ }
+
+ public void drawChart()
+ {
try
{
// Set axis title
@@ -49,6 +64,11 @@
chartAllAreaPipeline.Series["井盖"]["DrawingStyle"] = "Cylinder";
//chartAllAreaPipeline.Series[0].IsValueShownAsLabel = true;
+ Dictionary workWellLengthAndType = new Dictionary();
+ foreach (KeyValuePair kv in map)
+ {
+ workWellLengthAndType.Add(kv.Key, kv.Value.Length);
+ }
chartAllAreaPipeline.Series["井盖"].Points.DataBindXY(workWellLengthAndType.Keys, workWellLengthAndType.Values);
for (int m = 0; m < workWellLengthAndType.Values.Count; m++)
{
@@ -71,11 +91,11 @@
if (indexHit >= 0)
{
- GSOFeatures fs = list[indexHit];
+ //GSOFeatures fs = list[indexHit];
string sql = "";
string pipetype = chartAllAreaPipeline.Series["井盖"].Points[indexHit].AxisLabel;
-
+ GSOFeatures fs = map[pipetype];
string layername = "";
if (pipetype.EndsWith("窖井") || pipetype.EndsWith("表井") ||
(pipetype.EndsWith("窨井")) || pipetype.EndsWith("孔") ||
@@ -93,6 +113,23 @@
{
return;
}
+ //从图层获取datatable数据,不涉及数据库操作,速度会快一些
+ //string [] fieldNames = GSOFeatureUtils.getFields(layername, globeControl1);
+ //DataTable dt = GSOFeatureUtils.convertGSOFeatures2DataTable(fs,fieldNames);
+ //if (dt.Rows.Count > 0)
+ //{
+ // dataGridViewX1.DataSource = dt;
+ // panel.Visible = true;
+ // toolStripNumbers.Text = " 井盖类型:" + pipetype + "||共有:" + Convert.ToString(dt.Rows.Count) + "条记录";
+ //}
+ //else
+ //{
+ // panel.Visible = false;
+ // dataGridViewX1.DataSource = null;
+ // dataGridViewX1.Refresh();
+ // toolStripNumbers.Text = "类型:";
+ //}
+ //数据库获取数据
if (fs.Length > 0)
{
sql = "select " + getpipeLineFields.getFields(layername, globeControl1) + " from " + layer.Name;
@@ -120,8 +157,8 @@
{
dataGridViewX1.DataSource = dt;
panel.Visible = true;
- //toolStripNumbers.Text = " 井盖类型:" + MainFrm.m_CurrentQueryLayer + "||共有:" + Convert.ToString(dt.Rows.Count) + "条记录";
- toolStripNumbers.Text = " 井盖类型:" + pipetype + "||共有:" + Convert.ToString(dt.Rows.Count) + "条记录";
+ string strLable = toolStripNumbers.Text = " 井盖类型:" + pipetype + "||共有:" + Convert.ToString(dt.Rows.Count) + "条记录";
+ //m_InitDataGridViewX1(dt, strLable, "", true);
}
else
{
@@ -131,7 +168,6 @@
toolStripNumbers.Text = "类型:";
}
- //}
}
@@ -174,7 +210,7 @@
}
}
}
-
+ //m_InitDataGridViewX1(null,"","" , false);
globeControl1.Globe.MemoryLayer.RemoveAllFeature();
}
@@ -183,5 +219,63 @@
PATM_Forms.F_PATMTitle frm = new PATM_Forms.F_PATMTitle("S", chartAllAreaPipeline);
frm.Show();
}
+
+ //获取指定layer类型的附属物名称列表
+ public string[] getLayerAccNames(string layerType)
+ {
+ GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(layerType + "管线附属物");
+ if (layer == null) return null;
+
+ string sql = "select 附属物名称 from " + layerType + "管线附属物 group by 附属物名称";
+ DataSet dataset = OledbHelper.getDataSet(sql, layerType + "管线附属物");
+ if (dataset == null) return null;
+
+ int count = dataset.Tables[0].Rows.Count;
+
+
+ string[] result = new string[count];
+ for (int i = 0; i < count; i++)
+ {
+ result[i] = dataset.Tables[0].Rows[i][0].ToString();
+ }
+ return result;
+ }
+
+ ///
+ /// 获取区域内各图层的井、孔、蓖的map
+ ///
+ /// 区域
+ /// 要查找的附属物名称数组、如井、孔、蓖
+ /// 返回值为:<图层+附属物名称,附属物列表>
+
+ public Dictionary getAccsMap(GSOGeoPolygon3D polygon)
+ {
+ //List list = new List();
+ Dictionary map = new Dictionary();
+ ArrayList listpt = Utility.LayerNamesList;
+ if (listpt == null || listpt.Count == 0) return null;
+ FeatureStatisticsService service = new FeatureStatisticsService();
+ for (int i = 0; i < listpt.Count; i++)
+ {
+ GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(listpt[i] + "管线附属物");
+ string[] accNames = getLayerAccNames(listpt[i] as string);
+ if (accNames == null || accNames.Length == 0) continue;//排除不合法的值
+ for (int j = 0; j < accNames.Length; j++)
+ {
+ if (accNames[j].Contains("井") || accNames[j].Contains("孔") || accNames[j].Contains("篦"))
+ {
+
+ GSOFeatures features = service.Intersect_PointLayerByType(polygon, layer, accNames[j]);
+ if (features == null) continue;
+ map.Add(listpt[i] + accNames[j], features);
+ }
+
+ }
+
+ }
+ return map;
+
+ }
+
}
}
diff --git a/MainFrm.cs b/MainFrm.cs
index ac2614d..b584749 100644
--- a/MainFrm.cs
+++ b/MainFrm.cs
@@ -2951,35 +2951,35 @@
break;
case "workwellquery":
- workWellLen.Clear();
- List listWell = new List();
- //找到所有井
- if (Utility.LayerNamesList != null)
- {
- ArrayList listpt = Utility.LayerNamesList;
+ //workWellLen.Clear();
+ //List listWell = new List();
+ ////找到所有井
+ //if (Utility.LayerNamesList != null)
+ //{
+ // ArrayList listpt = Utility.LayerNamesList;
- for (int i = 0; i < listpt.Count; i++)
- {
- string pipelineType = (string)Utility.LayerNamesList[i];
+ // for (int i = 0; i < listpt.Count; i++)
+ // {
+ // string pipelineType = (string)Utility.LayerNamesList[i];
- string sql = "select 附属物名称 from " + pipelineType + "管线附属物 group by 附属物名称";
- DataSet dataset = OledbHelper.getDataSet(sql, pipelineType + "管线附属物");
- if (dataset != null)
- {
- for (int j = 0; j < dataset.Tables[0].Rows.Count; j++)
- {
- string accname = dataset.Tables[0].Rows[j][0].ToString();
- if ((accname.IndexOf("井") > 0) || (accname.IndexOf("孔") > 0) || (accname.IndexOf("篦") > 0))
- {
- GSOFeatures fs = Intersect_PointLayerByType(polygon, pipelineType, dataset.Tables[0].Rows[j][0].ToString());
- listWell.Add(fs);
- }
- }
- }
- }
- }
+ // string sql = "select 附属物名称 from " + pipelineType + "管线附属物 group by 附属物名称";
+ // DataSet dataset = OledbHelper.getDataSet(sql, pipelineType + "管线附属物");
+ // if (dataset != null)
+ // {
+ // for (int j = 0; j < dataset.Tables[0].Rows.Count; j++)
+ // {
+ // string accname = dataset.Tables[0].Rows[j][0].ToString();
+ // if ((accname.IndexOf("井") > 0) || (accname.IndexOf("孔") > 0) || (accname.IndexOf("篦") > 0))
+ // {
+ // GSOFeatures fs = Intersect_PointLayerByType(polygon, pipelineType, dataset.Tables[0].Rows[j][0].ToString());
+ // listWell.Add(fs);
+ // }
+ // }
+ // }
+ // }
+ //}
- FrmAllWorkWellStatis frmWell = new FrmAllWorkWellStatis(workWellLen, listWell, dataGridViewX1, toolStripNumbers, globeControl1, panelOfTable);
+ FrmAllWorkWellStatis frmWell = new FrmAllWorkWellStatis(polygon, dataGridViewX1, toolStripNumbers, globeControl1, panelOfTable);
frmWell.Show(this);
globeControl1.Globe.Action = EnumAction3D.ActionNull;
@@ -9740,37 +9740,37 @@
private void buttonItemTJ3_ALL_Click(object sender, EventArgs e)
{
//日志记录
- LogManager.saveLog(Utility.userName, "井盖数量统计");
+ //LogManager.saveLog(Utility.userName, "井盖数量统计");
- workWellLen.Clear();
- List list = new List();
+ //workWellLen.Clear();
+ //List list = new List();
- if (Utility.LayerNamesList != null)
- {
- ArrayList listpt = Utility.LayerNamesList;
+ //if (Utility.LayerNamesList != null)
+ //{
+ // ArrayList listpt = Utility.LayerNamesList;
- for (int i = 0; i < listpt.Count; i++)
- {
- string pipelineType = (string)Utility.LayerNamesList[i];
+ // for (int i = 0; i < listpt.Count; i++)
+ // {
+ // string pipelineType = (string)Utility.LayerNamesList[i];
- string sql = "select 附属物名称 from " + pipelineType + "管线附属物 group by 附属物名称";
- DataSet dataset = OledbHelper.getDataSet(sql, pipelineType + "管线附属物");
- if (dataset != null)
- {
- for (int j = 0; j < dataset.Tables[0].Rows.Count; j++)
- {
- string accname = dataset.Tables[0].Rows[j][0].ToString();
- if ((accname.IndexOf("井") > 0) || (accname.IndexOf("孔") > 0) || (accname.IndexOf("篦") > 0))
- {
- GSOFeatures fs = Intersect_PointLayerByType(null, pipelineType, dataset.Tables[0].Rows[j][0].ToString());
- list.Add(fs);
- }
- }
- }
- }
- }
+ // string sql = "select 附属物名称 from " + pipelineType + "管线附属物 group by 附属物名称";
+ // DataSet dataset = OledbHelper.getDataSet(sql, pipelineType + "管线附属物");
+ // if (dataset != null)
+ // {
+ // for (int j = 0; j < dataset.Tables[0].Rows.Count; j++)
+ // {
+ // string accname = dataset.Tables[0].Rows[j][0].ToString();
+ // if ((accname.IndexOf("井") > 0) || (accname.IndexOf("孔") > 0) || (accname.IndexOf("篦") > 0))
+ // {
+ // GSOFeatures fs = Intersect_PointLayerByType(null, pipelineType, dataset.Tables[0].Rows[j][0].ToString());
+ // list.Add(fs);
+ // }
+ // }
+ // }
+ // }
+ //}
- FrmAllWorkWellStatis frm = new FrmAllWorkWellStatis(workWellLen, list, dataGridViewX1, toolStripNumbers, globeControl1, panelOfTable);
+ FrmAllWorkWellStatis frm = new FrmAllWorkWellStatis(null, dataGridViewX1, toolStripNumbers, globeControl1, panelOfTable);
frm.Show(this);
}
///
diff --git a/Cyberpipe.suo b/Cyberpipe.suo
index 9a3c1e6..b66c3fa 100644
--- a/Cyberpipe.suo
+++ b/Cyberpipe.suo
Binary files differ
diff --git a/FeatureStatisticsService.cs b/FeatureStatisticsService.cs
index 8686f85..7b5caad 100644
--- a/FeatureStatisticsService.cs
+++ b/FeatureStatisticsService.cs
@@ -6,6 +6,8 @@
using GeoScene.Globe;
using GeoScene.Engine;
+using System.Windows.Forms;
+
namespace Cyberpipe
{
class FeatureStatisticsService
@@ -18,7 +20,7 @@
///
///
- private GSOFeatures Intersect_PointLayerByType(GSOGeoPolygon3D polygon, GSOLayer layer, string type)
+ public GSOFeatures Intersect_PointLayerByType(GSOGeoPolygon3D polygon, GSOLayer layer, string type)
{
if (layer == null) return null;
@@ -43,8 +45,8 @@
return newfeats;
}
-
-
+
+
///
///
/// 根据附属物列表,统计该类附属物个数
@@ -55,7 +57,7 @@
{
if (feats == null || feats.Length == 0) return null;
Dictionary result = new Dictionary();
- result.Add(feats[0].GetFieldAsString("附属物名称"),feats.Length);
+ result.Add(feats[0].GetFieldAsString("附属物名称"), feats.Length);
return result;
}
///
@@ -73,14 +75,15 @@
FeaturesClassfyResult result = new FeaturesClassfyResult();
double totalLength = 0.0;
int ncount = 0;
- GSOFeatures features = getPipesByValueSection( polygon, layer, min, max, fieldName);
- for (int i = 0; i < features.Length;i++ ) {
+ GSOFeatures features = getPipesByValueSection(polygon, layer, min, max, fieldName);
+ for (int i = 0; i < features.Length; i++)
+ {
GSOGeoPolyline3D line = features[i].Geometry as GSOGeoPolyline3D;
double length = line.GetSpaceLength(true, 6378137);
totalLength += length;
ncount += 1;
}
- string filedValue = (min == null) ? "不限":min+"-";
+ string filedValue = (min == null) ? "不限" : min + "-";
filedValue += (max == null) ? "不限" : max + "";
result.layerName = layer.Caption;
result.groupFieldValue = filedValue;//上下限的拼接
@@ -99,20 +102,21 @@
/// 上限
/// 统计类型:"起始埋深"或"管径_毫米"
///
- 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();
GSOFeatureLayer flayer = layer as GSOFeatureLayer;
//TODOLIST:优化为只获取管线,目前不清楚调用方式
- GSOFeatures feats = ( polygon == null )? flayer.GetAllFeatures() : flayer.FindFeaturesInPolygon(polygon, false);
+ GSOFeatures feats = (polygon == null) ? flayer.GetAllFeatures() : flayer.FindFeaturesInPolygon(polygon, false);
- double minValue = min ?? Double.MinValue ;
+ double minValue = min ?? Double.MinValue;
double maxValue = max ?? Double.MaxValue;
-
+
//筛选出符合条件的
- for (int i = 0; i < feats.Length;i++ )
+ for (int i = 0; i < feats.Length; i++)
{
double radius = feats[i].GetFieldAsDouble(fieldName);
if (radius >= min && radius <= max)
@@ -121,17 +125,17 @@
}
}
-
+
return result;
-
+
}
//图层名称、管径、条数、总长度
public List groupPipeByDiameter(GSOGeoPolygon3D polygon, GSOLayer layer)
{
if (layer == null) return null;
- List result = new List() ;
-
+ List result = new List();
+
GSOFeatureLayer flayer = layer as GSOFeatureLayer;
//TODOLIST:优化为只获取管线,目前不清楚调用方式
@@ -173,7 +177,7 @@
}
}
return result;
-
+
}
//图层名称、附属物个数
///
@@ -208,7 +212,7 @@
//过滤
for (int n = 0; n < feats.Length; n++)
{
- if (feats[n].GetFieldAsString("附属物名称").Contains(accessStrs[j])) newfeats.Add(feats[n]);
+ if (feats[n].GetFieldAsString("附属物名称").Contains(accessStrs[j])) newfeats.Add(feats[n]);
}
ncount = newfeats.Length;
}
@@ -218,10 +222,10 @@
featuresClass.layerName = accessStrs[j];
featuresClass.ncount = ncount;
- result.Add(featuresClass);
+ result.Add(featuresClass);
}
return result;
-
+
}
///
@@ -231,11 +235,11 @@
///
/// 材质
///
- public FeaturesClassfyResult groupPipeByMaterial(GSOGeoPolygon3D polygon, GSOLayer layer,string material)
- {
- if (layer == null) return null;
- FeaturesClassfyResult result = new FeaturesClassfyResult() ;
-
+ public FeaturesClassfyResult groupPipeByMaterial(GSOGeoPolygon3D polygon, GSOLayer layer, string material)
+ {
+ if (layer == null) return null;
+ FeaturesClassfyResult result = new FeaturesClassfyResult();
+
GSOFeatureLayer flayer = layer as GSOFeatureLayer;
//TODOLIST:优化为只获取管线,目前不清楚调用方式
@@ -244,7 +248,7 @@
string fixedMaterial = material == "无" ? "" : material;
double totalLength = 0.00;
int ncount = 0;
- for (int i = 0; i < feats.Length;i++ )
+ for (int i = 0; i < feats.Length; i++)
{
if (feats[i].GetFieldAsString("材质").Equals(fixedMaterial))
{
@@ -255,7 +259,7 @@
totalLength += length;
ncount += 1;
}
- }
+ }
}
result.layerName = layer.Caption;
@@ -264,13 +268,9 @@
result.sum = totalLength;
return result;
}
-
-
-
-
}
}
diff --git a/FrmAllWorkWellStatis.cs b/FrmAllWorkWellStatis.cs
index 4f0593d..fe2b7f8 100644
--- a/FrmAllWorkWellStatis.cs
+++ b/FrmAllWorkWellStatis.cs
@@ -9,30 +9,45 @@
using GeoScene.Data;
using GeoScene.Globe;
using DevComponents.DotNetBar;
+using System.Collections;
namespace Cyberpipe
{
public partial class FrmAllWorkWellStatis : DevComponents.DotNetBar.Office2007Form
{
- Dictionary workWellLengthAndType = new Dictionary();
- List list = new List();
+
+ private MainFrm.DataGridViewDelegate m_InitDataGridViewX1;
+ private Dictionary map = null;
DataGridView dataGridViewX1;
ToolStripStatusLabel toolStripNumbers;
GSOGlobeControl globeControl1;
PanelEx panel;
- public FrmAllWorkWellStatis(Dictionary wellLen, List _list, DataGridView dataGridViewX11, ToolStripStatusLabel toolStripNumbers1, GSOGlobeControl ctl, PanelEx p)
+ //TODOLIST:用晓伟的代理进行操作,功能拆分细化
+ public FrmAllWorkWellStatis(GSOGeoPolygon3D polygon, DataGridView dataGridViewX11, ToolStripStatusLabel toolStripNumbers1, GSOGlobeControl ctl, PanelEx p)
{
InitializeComponent();
panel = p;
- workWellLengthAndType = wellLen;
- list = _list;
dataGridViewX1 = dataGridViewX11;
toolStripNumbers = toolStripNumbers1;
-
globeControl1 = ctl;
+ map = getAccsMap(polygon);
+
+ }
+ public FrmAllWorkWellStatis(GSOGeoPolygon3D polygon, MainFrm.DataGridViewDelegate InitDataGridViewX1, GSOGlobeControl ctl)
+ {
+ InitializeComponent();
+ globeControl1 = ctl;
+ m_InitDataGridViewX1 = InitDataGridViewX1;
+ map = getAccsMap(polygon);
+
}
private void FrmAllPipelineStatis_Load(object sender, EventArgs e)
{
+ drawChart();
+ }
+
+ public void drawChart()
+ {
try
{
// Set axis title
@@ -49,6 +64,11 @@
chartAllAreaPipeline.Series["井盖"]["DrawingStyle"] = "Cylinder";
//chartAllAreaPipeline.Series[0].IsValueShownAsLabel = true;
+ Dictionary workWellLengthAndType = new Dictionary();
+ foreach (KeyValuePair kv in map)
+ {
+ workWellLengthAndType.Add(kv.Key, kv.Value.Length);
+ }
chartAllAreaPipeline.Series["井盖"].Points.DataBindXY(workWellLengthAndType.Keys, workWellLengthAndType.Values);
for (int m = 0; m < workWellLengthAndType.Values.Count; m++)
{
@@ -71,11 +91,11 @@
if (indexHit >= 0)
{
- GSOFeatures fs = list[indexHit];
+ //GSOFeatures fs = list[indexHit];
string sql = "";
string pipetype = chartAllAreaPipeline.Series["井盖"].Points[indexHit].AxisLabel;
-
+ GSOFeatures fs = map[pipetype];
string layername = "";
if (pipetype.EndsWith("窖井") || pipetype.EndsWith("表井") ||
(pipetype.EndsWith("窨井")) || pipetype.EndsWith("孔") ||
@@ -93,6 +113,23 @@
{
return;
}
+ //从图层获取datatable数据,不涉及数据库操作,速度会快一些
+ //string [] fieldNames = GSOFeatureUtils.getFields(layername, globeControl1);
+ //DataTable dt = GSOFeatureUtils.convertGSOFeatures2DataTable(fs,fieldNames);
+ //if (dt.Rows.Count > 0)
+ //{
+ // dataGridViewX1.DataSource = dt;
+ // panel.Visible = true;
+ // toolStripNumbers.Text = " 井盖类型:" + pipetype + "||共有:" + Convert.ToString(dt.Rows.Count) + "条记录";
+ //}
+ //else
+ //{
+ // panel.Visible = false;
+ // dataGridViewX1.DataSource = null;
+ // dataGridViewX1.Refresh();
+ // toolStripNumbers.Text = "类型:";
+ //}
+ //数据库获取数据
if (fs.Length > 0)
{
sql = "select " + getpipeLineFields.getFields(layername, globeControl1) + " from " + layer.Name;
@@ -120,8 +157,8 @@
{
dataGridViewX1.DataSource = dt;
panel.Visible = true;
- //toolStripNumbers.Text = " 井盖类型:" + MainFrm.m_CurrentQueryLayer + "||共有:" + Convert.ToString(dt.Rows.Count) + "条记录";
- toolStripNumbers.Text = " 井盖类型:" + pipetype + "||共有:" + Convert.ToString(dt.Rows.Count) + "条记录";
+ string strLable = toolStripNumbers.Text = " 井盖类型:" + pipetype + "||共有:" + Convert.ToString(dt.Rows.Count) + "条记录";
+ //m_InitDataGridViewX1(dt, strLable, "", true);
}
else
{
@@ -131,7 +168,6 @@
toolStripNumbers.Text = "类型:";
}
- //}
}
@@ -174,7 +210,7 @@
}
}
}
-
+ //m_InitDataGridViewX1(null,"","" , false);
globeControl1.Globe.MemoryLayer.RemoveAllFeature();
}
@@ -183,5 +219,63 @@
PATM_Forms.F_PATMTitle frm = new PATM_Forms.F_PATMTitle("S", chartAllAreaPipeline);
frm.Show();
}
+
+ //获取指定layer类型的附属物名称列表
+ public string[] getLayerAccNames(string layerType)
+ {
+ GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(layerType + "管线附属物");
+ if (layer == null) return null;
+
+ string sql = "select 附属物名称 from " + layerType + "管线附属物 group by 附属物名称";
+ DataSet dataset = OledbHelper.getDataSet(sql, layerType + "管线附属物");
+ if (dataset == null) return null;
+
+ int count = dataset.Tables[0].Rows.Count;
+
+
+ string[] result = new string[count];
+ for (int i = 0; i < count; i++)
+ {
+ result[i] = dataset.Tables[0].Rows[i][0].ToString();
+ }
+ return result;
+ }
+
+ ///
+ /// 获取区域内各图层的井、孔、蓖的map
+ ///
+ /// 区域
+ /// 要查找的附属物名称数组、如井、孔、蓖
+ /// 返回值为:<图层+附属物名称,附属物列表>
+
+ public Dictionary getAccsMap(GSOGeoPolygon3D polygon)
+ {
+ //List list = new List();
+ Dictionary map = new Dictionary();
+ ArrayList listpt = Utility.LayerNamesList;
+ if (listpt == null || listpt.Count == 0) return null;
+ FeatureStatisticsService service = new FeatureStatisticsService();
+ for (int i = 0; i < listpt.Count; i++)
+ {
+ GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(listpt[i] + "管线附属物");
+ string[] accNames = getLayerAccNames(listpt[i] as string);
+ if (accNames == null || accNames.Length == 0) continue;//排除不合法的值
+ for (int j = 0; j < accNames.Length; j++)
+ {
+ if (accNames[j].Contains("井") || accNames[j].Contains("孔") || accNames[j].Contains("篦"))
+ {
+
+ GSOFeatures features = service.Intersect_PointLayerByType(polygon, layer, accNames[j]);
+ if (features == null) continue;
+ map.Add(listpt[i] + accNames[j], features);
+ }
+
+ }
+
+ }
+ return map;
+
+ }
+
}
}
diff --git a/MainFrm.cs b/MainFrm.cs
index ac2614d..b584749 100644
--- a/MainFrm.cs
+++ b/MainFrm.cs
@@ -2951,35 +2951,35 @@
break;
case "workwellquery":
- workWellLen.Clear();
- List listWell = new List();
- //找到所有井
- if (Utility.LayerNamesList != null)
- {
- ArrayList listpt = Utility.LayerNamesList;
+ //workWellLen.Clear();
+ //List listWell = new List();
+ ////找到所有井
+ //if (Utility.LayerNamesList != null)
+ //{
+ // ArrayList listpt = Utility.LayerNamesList;
- for (int i = 0; i < listpt.Count; i++)
- {
- string pipelineType = (string)Utility.LayerNamesList[i];
+ // for (int i = 0; i < listpt.Count; i++)
+ // {
+ // string pipelineType = (string)Utility.LayerNamesList[i];
- string sql = "select 附属物名称 from " + pipelineType + "管线附属物 group by 附属物名称";
- DataSet dataset = OledbHelper.getDataSet(sql, pipelineType + "管线附属物");
- if (dataset != null)
- {
- for (int j = 0; j < dataset.Tables[0].Rows.Count; j++)
- {
- string accname = dataset.Tables[0].Rows[j][0].ToString();
- if ((accname.IndexOf("井") > 0) || (accname.IndexOf("孔") > 0) || (accname.IndexOf("篦") > 0))
- {
- GSOFeatures fs = Intersect_PointLayerByType(polygon, pipelineType, dataset.Tables[0].Rows[j][0].ToString());
- listWell.Add(fs);
- }
- }
- }
- }
- }
+ // string sql = "select 附属物名称 from " + pipelineType + "管线附属物 group by 附属物名称";
+ // DataSet dataset = OledbHelper.getDataSet(sql, pipelineType + "管线附属物");
+ // if (dataset != null)
+ // {
+ // for (int j = 0; j < dataset.Tables[0].Rows.Count; j++)
+ // {
+ // string accname = dataset.Tables[0].Rows[j][0].ToString();
+ // if ((accname.IndexOf("井") > 0) || (accname.IndexOf("孔") > 0) || (accname.IndexOf("篦") > 0))
+ // {
+ // GSOFeatures fs = Intersect_PointLayerByType(polygon, pipelineType, dataset.Tables[0].Rows[j][0].ToString());
+ // listWell.Add(fs);
+ // }
+ // }
+ // }
+ // }
+ //}
- FrmAllWorkWellStatis frmWell = new FrmAllWorkWellStatis(workWellLen, listWell, dataGridViewX1, toolStripNumbers, globeControl1, panelOfTable);
+ FrmAllWorkWellStatis frmWell = new FrmAllWorkWellStatis(polygon, dataGridViewX1, toolStripNumbers, globeControl1, panelOfTable);
frmWell.Show(this);
globeControl1.Globe.Action = EnumAction3D.ActionNull;
@@ -9740,37 +9740,37 @@
private void buttonItemTJ3_ALL_Click(object sender, EventArgs e)
{
//日志记录
- LogManager.saveLog(Utility.userName, "井盖数量统计");
+ //LogManager.saveLog(Utility.userName, "井盖数量统计");
- workWellLen.Clear();
- List list = new List();
+ //workWellLen.Clear();
+ //List list = new List();
- if (Utility.LayerNamesList != null)
- {
- ArrayList listpt = Utility.LayerNamesList;
+ //if (Utility.LayerNamesList != null)
+ //{
+ // ArrayList listpt = Utility.LayerNamesList;
- for (int i = 0; i < listpt.Count; i++)
- {
- string pipelineType = (string)Utility.LayerNamesList[i];
+ // for (int i = 0; i < listpt.Count; i++)
+ // {
+ // string pipelineType = (string)Utility.LayerNamesList[i];
- string sql = "select 附属物名称 from " + pipelineType + "管线附属物 group by 附属物名称";
- DataSet dataset = OledbHelper.getDataSet(sql, pipelineType + "管线附属物");
- if (dataset != null)
- {
- for (int j = 0; j < dataset.Tables[0].Rows.Count; j++)
- {
- string accname = dataset.Tables[0].Rows[j][0].ToString();
- if ((accname.IndexOf("井") > 0) || (accname.IndexOf("孔") > 0) || (accname.IndexOf("篦") > 0))
- {
- GSOFeatures fs = Intersect_PointLayerByType(null, pipelineType, dataset.Tables[0].Rows[j][0].ToString());
- list.Add(fs);
- }
- }
- }
- }
- }
+ // string sql = "select 附属物名称 from " + pipelineType + "管线附属物 group by 附属物名称";
+ // DataSet dataset = OledbHelper.getDataSet(sql, pipelineType + "管线附属物");
+ // if (dataset != null)
+ // {
+ // for (int j = 0; j < dataset.Tables[0].Rows.Count; j++)
+ // {
+ // string accname = dataset.Tables[0].Rows[j][0].ToString();
+ // if ((accname.IndexOf("井") > 0) || (accname.IndexOf("孔") > 0) || (accname.IndexOf("篦") > 0))
+ // {
+ // GSOFeatures fs = Intersect_PointLayerByType(null, pipelineType, dataset.Tables[0].Rows[j][0].ToString());
+ // list.Add(fs);
+ // }
+ // }
+ // }
+ // }
+ //}
- FrmAllWorkWellStatis frm = new FrmAllWorkWellStatis(workWellLen, list, dataGridViewX1, toolStripNumbers, globeControl1, panelOfTable);
+ FrmAllWorkWellStatis frm = new FrmAllWorkWellStatis(null, dataGridViewX1, toolStripNumbers, globeControl1, panelOfTable);
frm.Show(this);
}
///
diff --git a/obj/x64/Debug/Cyberpipe.FrmLogin.resources b/obj/x64/Debug/Cyberpipe.FrmLogin.resources
index 1f91e9b..ddd5756 100644
--- a/obj/x64/Debug/Cyberpipe.FrmLogin.resources
+++ b/obj/x64/Debug/Cyberpipe.FrmLogin.resources
Binary files differ
diff --git a/Cyberpipe.suo b/Cyberpipe.suo
index 9a3c1e6..b66c3fa 100644
--- a/Cyberpipe.suo
+++ b/Cyberpipe.suo
Binary files differ
diff --git a/FeatureStatisticsService.cs b/FeatureStatisticsService.cs
index 8686f85..7b5caad 100644
--- a/FeatureStatisticsService.cs
+++ b/FeatureStatisticsService.cs
@@ -6,6 +6,8 @@
using GeoScene.Globe;
using GeoScene.Engine;
+using System.Windows.Forms;
+
namespace Cyberpipe
{
class FeatureStatisticsService
@@ -18,7 +20,7 @@
///
///
- private GSOFeatures Intersect_PointLayerByType(GSOGeoPolygon3D polygon, GSOLayer layer, string type)
+ public GSOFeatures Intersect_PointLayerByType(GSOGeoPolygon3D polygon, GSOLayer layer, string type)
{
if (layer == null) return null;
@@ -43,8 +45,8 @@
return newfeats;
}
-
-
+
+
///
///
/// 根据附属物列表,统计该类附属物个数
@@ -55,7 +57,7 @@
{
if (feats == null || feats.Length == 0) return null;
Dictionary result = new Dictionary();
- result.Add(feats[0].GetFieldAsString("附属物名称"),feats.Length);
+ result.Add(feats[0].GetFieldAsString("附属物名称"), feats.Length);
return result;
}
///
@@ -73,14 +75,15 @@
FeaturesClassfyResult result = new FeaturesClassfyResult();
double totalLength = 0.0;
int ncount = 0;
- GSOFeatures features = getPipesByValueSection( polygon, layer, min, max, fieldName);
- for (int i = 0; i < features.Length;i++ ) {
+ GSOFeatures features = getPipesByValueSection(polygon, layer, min, max, fieldName);
+ for (int i = 0; i < features.Length; i++)
+ {
GSOGeoPolyline3D line = features[i].Geometry as GSOGeoPolyline3D;
double length = line.GetSpaceLength(true, 6378137);
totalLength += length;
ncount += 1;
}
- string filedValue = (min == null) ? "不限":min+"-";
+ string filedValue = (min == null) ? "不限" : min + "-";
filedValue += (max == null) ? "不限" : max + "";
result.layerName = layer.Caption;
result.groupFieldValue = filedValue;//上下限的拼接
@@ -99,20 +102,21 @@
/// 上限
/// 统计类型:"起始埋深"或"管径_毫米"
///
- 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();
GSOFeatureLayer flayer = layer as GSOFeatureLayer;
//TODOLIST:优化为只获取管线,目前不清楚调用方式
- GSOFeatures feats = ( polygon == null )? flayer.GetAllFeatures() : flayer.FindFeaturesInPolygon(polygon, false);
+ GSOFeatures feats = (polygon == null) ? flayer.GetAllFeatures() : flayer.FindFeaturesInPolygon(polygon, false);
- double minValue = min ?? Double.MinValue ;
+ double minValue = min ?? Double.MinValue;
double maxValue = max ?? Double.MaxValue;
-
+
//筛选出符合条件的
- for (int i = 0; i < feats.Length;i++ )
+ for (int i = 0; i < feats.Length; i++)
{
double radius = feats[i].GetFieldAsDouble(fieldName);
if (radius >= min && radius <= max)
@@ -121,17 +125,17 @@
}
}
-
+
return result;
-
+
}
//图层名称、管径、条数、总长度
public List groupPipeByDiameter(GSOGeoPolygon3D polygon, GSOLayer layer)
{
if (layer == null) return null;
- List result = new List() ;
-
+ List result = new List();
+
GSOFeatureLayer flayer = layer as GSOFeatureLayer;
//TODOLIST:优化为只获取管线,目前不清楚调用方式
@@ -173,7 +177,7 @@
}
}
return result;
-
+
}
//图层名称、附属物个数
///
@@ -208,7 +212,7 @@
//过滤
for (int n = 0; n < feats.Length; n++)
{
- if (feats[n].GetFieldAsString("附属物名称").Contains(accessStrs[j])) newfeats.Add(feats[n]);
+ if (feats[n].GetFieldAsString("附属物名称").Contains(accessStrs[j])) newfeats.Add(feats[n]);
}
ncount = newfeats.Length;
}
@@ -218,10 +222,10 @@
featuresClass.layerName = accessStrs[j];
featuresClass.ncount = ncount;
- result.Add(featuresClass);
+ result.Add(featuresClass);
}
return result;
-
+
}
///
@@ -231,11 +235,11 @@
///
/// 材质
///
- public FeaturesClassfyResult groupPipeByMaterial(GSOGeoPolygon3D polygon, GSOLayer layer,string material)
- {
- if (layer == null) return null;
- FeaturesClassfyResult result = new FeaturesClassfyResult() ;
-
+ public FeaturesClassfyResult groupPipeByMaterial(GSOGeoPolygon3D polygon, GSOLayer layer, string material)
+ {
+ if (layer == null) return null;
+ FeaturesClassfyResult result = new FeaturesClassfyResult();
+
GSOFeatureLayer flayer = layer as GSOFeatureLayer;
//TODOLIST:优化为只获取管线,目前不清楚调用方式
@@ -244,7 +248,7 @@
string fixedMaterial = material == "无" ? "" : material;
double totalLength = 0.00;
int ncount = 0;
- for (int i = 0; i < feats.Length;i++ )
+ for (int i = 0; i < feats.Length; i++)
{
if (feats[i].GetFieldAsString("材质").Equals(fixedMaterial))
{
@@ -255,7 +259,7 @@
totalLength += length;
ncount += 1;
}
- }
+ }
}
result.layerName = layer.Caption;
@@ -264,13 +268,9 @@
result.sum = totalLength;
return result;
}
-
-
-
-
}
}
diff --git a/FrmAllWorkWellStatis.cs b/FrmAllWorkWellStatis.cs
index 4f0593d..fe2b7f8 100644
--- a/FrmAllWorkWellStatis.cs
+++ b/FrmAllWorkWellStatis.cs
@@ -9,30 +9,45 @@
using GeoScene.Data;
using GeoScene.Globe;
using DevComponents.DotNetBar;
+using System.Collections;
namespace Cyberpipe
{
public partial class FrmAllWorkWellStatis : DevComponents.DotNetBar.Office2007Form
{
- Dictionary workWellLengthAndType = new Dictionary();
- List list = new List();
+
+ private MainFrm.DataGridViewDelegate m_InitDataGridViewX1;
+ private Dictionary map = null;
DataGridView dataGridViewX1;
ToolStripStatusLabel toolStripNumbers;
GSOGlobeControl globeControl1;
PanelEx panel;
- public FrmAllWorkWellStatis(Dictionary wellLen, List _list, DataGridView dataGridViewX11, ToolStripStatusLabel toolStripNumbers1, GSOGlobeControl ctl, PanelEx p)
+ //TODOLIST:用晓伟的代理进行操作,功能拆分细化
+ public FrmAllWorkWellStatis(GSOGeoPolygon3D polygon, DataGridView dataGridViewX11, ToolStripStatusLabel toolStripNumbers1, GSOGlobeControl ctl, PanelEx p)
{
InitializeComponent();
panel = p;
- workWellLengthAndType = wellLen;
- list = _list;
dataGridViewX1 = dataGridViewX11;
toolStripNumbers = toolStripNumbers1;
-
globeControl1 = ctl;
+ map = getAccsMap(polygon);
+
+ }
+ public FrmAllWorkWellStatis(GSOGeoPolygon3D polygon, MainFrm.DataGridViewDelegate InitDataGridViewX1, GSOGlobeControl ctl)
+ {
+ InitializeComponent();
+ globeControl1 = ctl;
+ m_InitDataGridViewX1 = InitDataGridViewX1;
+ map = getAccsMap(polygon);
+
}
private void FrmAllPipelineStatis_Load(object sender, EventArgs e)
{
+ drawChart();
+ }
+
+ public void drawChart()
+ {
try
{
// Set axis title
@@ -49,6 +64,11 @@
chartAllAreaPipeline.Series["井盖"]["DrawingStyle"] = "Cylinder";
//chartAllAreaPipeline.Series[0].IsValueShownAsLabel = true;
+ Dictionary workWellLengthAndType = new Dictionary();
+ foreach (KeyValuePair kv in map)
+ {
+ workWellLengthAndType.Add(kv.Key, kv.Value.Length);
+ }
chartAllAreaPipeline.Series["井盖"].Points.DataBindXY(workWellLengthAndType.Keys, workWellLengthAndType.Values);
for (int m = 0; m < workWellLengthAndType.Values.Count; m++)
{
@@ -71,11 +91,11 @@
if (indexHit >= 0)
{
- GSOFeatures fs = list[indexHit];
+ //GSOFeatures fs = list[indexHit];
string sql = "";
string pipetype = chartAllAreaPipeline.Series["井盖"].Points[indexHit].AxisLabel;
-
+ GSOFeatures fs = map[pipetype];
string layername = "";
if (pipetype.EndsWith("窖井") || pipetype.EndsWith("表井") ||
(pipetype.EndsWith("窨井")) || pipetype.EndsWith("孔") ||
@@ -93,6 +113,23 @@
{
return;
}
+ //从图层获取datatable数据,不涉及数据库操作,速度会快一些
+ //string [] fieldNames = GSOFeatureUtils.getFields(layername, globeControl1);
+ //DataTable dt = GSOFeatureUtils.convertGSOFeatures2DataTable(fs,fieldNames);
+ //if (dt.Rows.Count > 0)
+ //{
+ // dataGridViewX1.DataSource = dt;
+ // panel.Visible = true;
+ // toolStripNumbers.Text = " 井盖类型:" + pipetype + "||共有:" + Convert.ToString(dt.Rows.Count) + "条记录";
+ //}
+ //else
+ //{
+ // panel.Visible = false;
+ // dataGridViewX1.DataSource = null;
+ // dataGridViewX1.Refresh();
+ // toolStripNumbers.Text = "类型:";
+ //}
+ //数据库获取数据
if (fs.Length > 0)
{
sql = "select " + getpipeLineFields.getFields(layername, globeControl1) + " from " + layer.Name;
@@ -120,8 +157,8 @@
{
dataGridViewX1.DataSource = dt;
panel.Visible = true;
- //toolStripNumbers.Text = " 井盖类型:" + MainFrm.m_CurrentQueryLayer + "||共有:" + Convert.ToString(dt.Rows.Count) + "条记录";
- toolStripNumbers.Text = " 井盖类型:" + pipetype + "||共有:" + Convert.ToString(dt.Rows.Count) + "条记录";
+ string strLable = toolStripNumbers.Text = " 井盖类型:" + pipetype + "||共有:" + Convert.ToString(dt.Rows.Count) + "条记录";
+ //m_InitDataGridViewX1(dt, strLable, "", true);
}
else
{
@@ -131,7 +168,6 @@
toolStripNumbers.Text = "类型:";
}
- //}
}
@@ -174,7 +210,7 @@
}
}
}
-
+ //m_InitDataGridViewX1(null,"","" , false);
globeControl1.Globe.MemoryLayer.RemoveAllFeature();
}
@@ -183,5 +219,63 @@
PATM_Forms.F_PATMTitle frm = new PATM_Forms.F_PATMTitle("S", chartAllAreaPipeline);
frm.Show();
}
+
+ //获取指定layer类型的附属物名称列表
+ public string[] getLayerAccNames(string layerType)
+ {
+ GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(layerType + "管线附属物");
+ if (layer == null) return null;
+
+ string sql = "select 附属物名称 from " + layerType + "管线附属物 group by 附属物名称";
+ DataSet dataset = OledbHelper.getDataSet(sql, layerType + "管线附属物");
+ if (dataset == null) return null;
+
+ int count = dataset.Tables[0].Rows.Count;
+
+
+ string[] result = new string[count];
+ for (int i = 0; i < count; i++)
+ {
+ result[i] = dataset.Tables[0].Rows[i][0].ToString();
+ }
+ return result;
+ }
+
+ ///
+ /// 获取区域内各图层的井、孔、蓖的map
+ ///
+ /// 区域
+ /// 要查找的附属物名称数组、如井、孔、蓖
+ /// 返回值为:<图层+附属物名称,附属物列表>
+
+ public Dictionary getAccsMap(GSOGeoPolygon3D polygon)
+ {
+ //List list = new List();
+ Dictionary map = new Dictionary();
+ ArrayList listpt = Utility.LayerNamesList;
+ if (listpt == null || listpt.Count == 0) return null;
+ FeatureStatisticsService service = new FeatureStatisticsService();
+ for (int i = 0; i < listpt.Count; i++)
+ {
+ GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(listpt[i] + "管线附属物");
+ string[] accNames = getLayerAccNames(listpt[i] as string);
+ if (accNames == null || accNames.Length == 0) continue;//排除不合法的值
+ for (int j = 0; j < accNames.Length; j++)
+ {
+ if (accNames[j].Contains("井") || accNames[j].Contains("孔") || accNames[j].Contains("篦"))
+ {
+
+ GSOFeatures features = service.Intersect_PointLayerByType(polygon, layer, accNames[j]);
+ if (features == null) continue;
+ map.Add(listpt[i] + accNames[j], features);
+ }
+
+ }
+
+ }
+ return map;
+
+ }
+
}
}
diff --git a/MainFrm.cs b/MainFrm.cs
index ac2614d..b584749 100644
--- a/MainFrm.cs
+++ b/MainFrm.cs
@@ -2951,35 +2951,35 @@
break;
case "workwellquery":
- workWellLen.Clear();
- List listWell = new List();
- //找到所有井
- if (Utility.LayerNamesList != null)
- {
- ArrayList listpt = Utility.LayerNamesList;
+ //workWellLen.Clear();
+ //List listWell = new List();
+ ////找到所有井
+ //if (Utility.LayerNamesList != null)
+ //{
+ // ArrayList listpt = Utility.LayerNamesList;
- for (int i = 0; i < listpt.Count; i++)
- {
- string pipelineType = (string)Utility.LayerNamesList[i];
+ // for (int i = 0; i < listpt.Count; i++)
+ // {
+ // string pipelineType = (string)Utility.LayerNamesList[i];
- string sql = "select 附属物名称 from " + pipelineType + "管线附属物 group by 附属物名称";
- DataSet dataset = OledbHelper.getDataSet(sql, pipelineType + "管线附属物");
- if (dataset != null)
- {
- for (int j = 0; j < dataset.Tables[0].Rows.Count; j++)
- {
- string accname = dataset.Tables[0].Rows[j][0].ToString();
- if ((accname.IndexOf("井") > 0) || (accname.IndexOf("孔") > 0) || (accname.IndexOf("篦") > 0))
- {
- GSOFeatures fs = Intersect_PointLayerByType(polygon, pipelineType, dataset.Tables[0].Rows[j][0].ToString());
- listWell.Add(fs);
- }
- }
- }
- }
- }
+ // string sql = "select 附属物名称 from " + pipelineType + "管线附属物 group by 附属物名称";
+ // DataSet dataset = OledbHelper.getDataSet(sql, pipelineType + "管线附属物");
+ // if (dataset != null)
+ // {
+ // for (int j = 0; j < dataset.Tables[0].Rows.Count; j++)
+ // {
+ // string accname = dataset.Tables[0].Rows[j][0].ToString();
+ // if ((accname.IndexOf("井") > 0) || (accname.IndexOf("孔") > 0) || (accname.IndexOf("篦") > 0))
+ // {
+ // GSOFeatures fs = Intersect_PointLayerByType(polygon, pipelineType, dataset.Tables[0].Rows[j][0].ToString());
+ // listWell.Add(fs);
+ // }
+ // }
+ // }
+ // }
+ //}
- FrmAllWorkWellStatis frmWell = new FrmAllWorkWellStatis(workWellLen, listWell, dataGridViewX1, toolStripNumbers, globeControl1, panelOfTable);
+ FrmAllWorkWellStatis frmWell = new FrmAllWorkWellStatis(polygon, dataGridViewX1, toolStripNumbers, globeControl1, panelOfTable);
frmWell.Show(this);
globeControl1.Globe.Action = EnumAction3D.ActionNull;
@@ -9740,37 +9740,37 @@
private void buttonItemTJ3_ALL_Click(object sender, EventArgs e)
{
//日志记录
- LogManager.saveLog(Utility.userName, "井盖数量统计");
+ //LogManager.saveLog(Utility.userName, "井盖数量统计");
- workWellLen.Clear();
- List list = new List();
+ //workWellLen.Clear();
+ //List list = new List();
- if (Utility.LayerNamesList != null)
- {
- ArrayList listpt = Utility.LayerNamesList;
+ //if (Utility.LayerNamesList != null)
+ //{
+ // ArrayList listpt = Utility.LayerNamesList;
- for (int i = 0; i < listpt.Count; i++)
- {
- string pipelineType = (string)Utility.LayerNamesList[i];
+ // for (int i = 0; i < listpt.Count; i++)
+ // {
+ // string pipelineType = (string)Utility.LayerNamesList[i];
- string sql = "select 附属物名称 from " + pipelineType + "管线附属物 group by 附属物名称";
- DataSet dataset = OledbHelper.getDataSet(sql, pipelineType + "管线附属物");
- if (dataset != null)
- {
- for (int j = 0; j < dataset.Tables[0].Rows.Count; j++)
- {
- string accname = dataset.Tables[0].Rows[j][0].ToString();
- if ((accname.IndexOf("井") > 0) || (accname.IndexOf("孔") > 0) || (accname.IndexOf("篦") > 0))
- {
- GSOFeatures fs = Intersect_PointLayerByType(null, pipelineType, dataset.Tables[0].Rows[j][0].ToString());
- list.Add(fs);
- }
- }
- }
- }
- }
+ // string sql = "select 附属物名称 from " + pipelineType + "管线附属物 group by 附属物名称";
+ // DataSet dataset = OledbHelper.getDataSet(sql, pipelineType + "管线附属物");
+ // if (dataset != null)
+ // {
+ // for (int j = 0; j < dataset.Tables[0].Rows.Count; j++)
+ // {
+ // string accname = dataset.Tables[0].Rows[j][0].ToString();
+ // if ((accname.IndexOf("井") > 0) || (accname.IndexOf("孔") > 0) || (accname.IndexOf("篦") > 0))
+ // {
+ // GSOFeatures fs = Intersect_PointLayerByType(null, pipelineType, dataset.Tables[0].Rows[j][0].ToString());
+ // list.Add(fs);
+ // }
+ // }
+ // }
+ // }
+ //}
- FrmAllWorkWellStatis frm = new FrmAllWorkWellStatis(workWellLen, list, dataGridViewX1, toolStripNumbers, globeControl1, panelOfTable);
+ FrmAllWorkWellStatis frm = new FrmAllWorkWellStatis(null, dataGridViewX1, toolStripNumbers, globeControl1, panelOfTable);
frm.Show(this);
}
///
diff --git a/obj/x64/Debug/Cyberpipe.FrmLogin.resources b/obj/x64/Debug/Cyberpipe.FrmLogin.resources
index 1f91e9b..ddd5756 100644
--- a/obj/x64/Debug/Cyberpipe.FrmLogin.resources
+++ b/obj/x64/Debug/Cyberpipe.FrmLogin.resources
Binary files differ
diff --git a/obj/x64/Debug/Cyberpipe.HFS_Forms.Frm_HFSinout.resources b/obj/x64/Debug/Cyberpipe.HFS_Forms.Frm_HFSinout.resources
index 5f1e50e..f1256ed 100644
--- a/obj/x64/Debug/Cyberpipe.HFS_Forms.Frm_HFSinout.resources
+++ b/obj/x64/Debug/Cyberpipe.HFS_Forms.Frm_HFSinout.resources
Binary files differ
diff --git a/Cyberpipe.suo b/Cyberpipe.suo
index 9a3c1e6..b66c3fa 100644
--- a/Cyberpipe.suo
+++ b/Cyberpipe.suo
Binary files differ
diff --git a/FeatureStatisticsService.cs b/FeatureStatisticsService.cs
index 8686f85..7b5caad 100644
--- a/FeatureStatisticsService.cs
+++ b/FeatureStatisticsService.cs
@@ -6,6 +6,8 @@
using GeoScene.Globe;
using GeoScene.Engine;
+using System.Windows.Forms;
+
namespace Cyberpipe
{
class FeatureStatisticsService
@@ -18,7 +20,7 @@
///
///
- private GSOFeatures Intersect_PointLayerByType(GSOGeoPolygon3D polygon, GSOLayer layer, string type)
+ public GSOFeatures Intersect_PointLayerByType(GSOGeoPolygon3D polygon, GSOLayer layer, string type)
{
if (layer == null) return null;
@@ -43,8 +45,8 @@
return newfeats;
}
-
-
+
+
///
///
/// 根据附属物列表,统计该类附属物个数
@@ -55,7 +57,7 @@
{
if (feats == null || feats.Length == 0) return null;
Dictionary result = new Dictionary();
- result.Add(feats[0].GetFieldAsString("附属物名称"),feats.Length);
+ result.Add(feats[0].GetFieldAsString("附属物名称"), feats.Length);
return result;
}
///
@@ -73,14 +75,15 @@
FeaturesClassfyResult result = new FeaturesClassfyResult();
double totalLength = 0.0;
int ncount = 0;
- GSOFeatures features = getPipesByValueSection( polygon, layer, min, max, fieldName);
- for (int i = 0; i < features.Length;i++ ) {
+ GSOFeatures features = getPipesByValueSection(polygon, layer, min, max, fieldName);
+ for (int i = 0; i < features.Length; i++)
+ {
GSOGeoPolyline3D line = features[i].Geometry as GSOGeoPolyline3D;
double length = line.GetSpaceLength(true, 6378137);
totalLength += length;
ncount += 1;
}
- string filedValue = (min == null) ? "不限":min+"-";
+ string filedValue = (min == null) ? "不限" : min + "-";
filedValue += (max == null) ? "不限" : max + "";
result.layerName = layer.Caption;
result.groupFieldValue = filedValue;//上下限的拼接
@@ -99,20 +102,21 @@
/// 上限
/// 统计类型:"起始埋深"或"管径_毫米"
///
- 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();
GSOFeatureLayer flayer = layer as GSOFeatureLayer;
//TODOLIST:优化为只获取管线,目前不清楚调用方式
- GSOFeatures feats = ( polygon == null )? flayer.GetAllFeatures() : flayer.FindFeaturesInPolygon(polygon, false);
+ GSOFeatures feats = (polygon == null) ? flayer.GetAllFeatures() : flayer.FindFeaturesInPolygon(polygon, false);
- double minValue = min ?? Double.MinValue ;
+ double minValue = min ?? Double.MinValue;
double maxValue = max ?? Double.MaxValue;
-
+
//筛选出符合条件的
- for (int i = 0; i < feats.Length;i++ )
+ for (int i = 0; i < feats.Length; i++)
{
double radius = feats[i].GetFieldAsDouble(fieldName);
if (radius >= min && radius <= max)
@@ -121,17 +125,17 @@
}
}
-
+
return result;
-
+
}
//图层名称、管径、条数、总长度
public List groupPipeByDiameter(GSOGeoPolygon3D polygon, GSOLayer layer)
{
if (layer == null) return null;
- List result = new List() ;
-
+ List result = new List();
+
GSOFeatureLayer flayer = layer as GSOFeatureLayer;
//TODOLIST:优化为只获取管线,目前不清楚调用方式
@@ -173,7 +177,7 @@
}
}
return result;
-
+
}
//图层名称、附属物个数
///
@@ -208,7 +212,7 @@
//过滤
for (int n = 0; n < feats.Length; n++)
{
- if (feats[n].GetFieldAsString("附属物名称").Contains(accessStrs[j])) newfeats.Add(feats[n]);
+ if (feats[n].GetFieldAsString("附属物名称").Contains(accessStrs[j])) newfeats.Add(feats[n]);
}
ncount = newfeats.Length;
}
@@ -218,10 +222,10 @@
featuresClass.layerName = accessStrs[j];
featuresClass.ncount = ncount;
- result.Add(featuresClass);
+ result.Add(featuresClass);
}
return result;
-
+
}
///
@@ -231,11 +235,11 @@
///
/// 材质
///
- public FeaturesClassfyResult groupPipeByMaterial(GSOGeoPolygon3D polygon, GSOLayer layer,string material)
- {
- if (layer == null) return null;
- FeaturesClassfyResult result = new FeaturesClassfyResult() ;
-
+ public FeaturesClassfyResult groupPipeByMaterial(GSOGeoPolygon3D polygon, GSOLayer layer, string material)
+ {
+ if (layer == null) return null;
+ FeaturesClassfyResult result = new FeaturesClassfyResult();
+
GSOFeatureLayer flayer = layer as GSOFeatureLayer;
//TODOLIST:优化为只获取管线,目前不清楚调用方式
@@ -244,7 +248,7 @@
string fixedMaterial = material == "无" ? "" : material;
double totalLength = 0.00;
int ncount = 0;
- for (int i = 0; i < feats.Length;i++ )
+ for (int i = 0; i < feats.Length; i++)
{
if (feats[i].GetFieldAsString("材质").Equals(fixedMaterial))
{
@@ -255,7 +259,7 @@
totalLength += length;
ncount += 1;
}
- }
+ }
}
result.layerName = layer.Caption;
@@ -264,13 +268,9 @@
result.sum = totalLength;
return result;
}
-
-
-
-
}
}
diff --git a/FrmAllWorkWellStatis.cs b/FrmAllWorkWellStatis.cs
index 4f0593d..fe2b7f8 100644
--- a/FrmAllWorkWellStatis.cs
+++ b/FrmAllWorkWellStatis.cs
@@ -9,30 +9,45 @@
using GeoScene.Data;
using GeoScene.Globe;
using DevComponents.DotNetBar;
+using System.Collections;
namespace Cyberpipe
{
public partial class FrmAllWorkWellStatis : DevComponents.DotNetBar.Office2007Form
{
- Dictionary workWellLengthAndType = new Dictionary();
- List list = new List();
+
+ private MainFrm.DataGridViewDelegate m_InitDataGridViewX1;
+ private Dictionary map = null;
DataGridView dataGridViewX1;
ToolStripStatusLabel toolStripNumbers;
GSOGlobeControl globeControl1;
PanelEx panel;
- public FrmAllWorkWellStatis(Dictionary wellLen, List _list, DataGridView dataGridViewX11, ToolStripStatusLabel toolStripNumbers1, GSOGlobeControl ctl, PanelEx p)
+ //TODOLIST:用晓伟的代理进行操作,功能拆分细化
+ public FrmAllWorkWellStatis(GSOGeoPolygon3D polygon, DataGridView dataGridViewX11, ToolStripStatusLabel toolStripNumbers1, GSOGlobeControl ctl, PanelEx p)
{
InitializeComponent();
panel = p;
- workWellLengthAndType = wellLen;
- list = _list;
dataGridViewX1 = dataGridViewX11;
toolStripNumbers = toolStripNumbers1;
-
globeControl1 = ctl;
+ map = getAccsMap(polygon);
+
+ }
+ public FrmAllWorkWellStatis(GSOGeoPolygon3D polygon, MainFrm.DataGridViewDelegate InitDataGridViewX1, GSOGlobeControl ctl)
+ {
+ InitializeComponent();
+ globeControl1 = ctl;
+ m_InitDataGridViewX1 = InitDataGridViewX1;
+ map = getAccsMap(polygon);
+
}
private void FrmAllPipelineStatis_Load(object sender, EventArgs e)
{
+ drawChart();
+ }
+
+ public void drawChart()
+ {
try
{
// Set axis title
@@ -49,6 +64,11 @@
chartAllAreaPipeline.Series["井盖"]["DrawingStyle"] = "Cylinder";
//chartAllAreaPipeline.Series[0].IsValueShownAsLabel = true;
+ Dictionary workWellLengthAndType = new Dictionary();
+ foreach (KeyValuePair kv in map)
+ {
+ workWellLengthAndType.Add(kv.Key, kv.Value.Length);
+ }
chartAllAreaPipeline.Series["井盖"].Points.DataBindXY(workWellLengthAndType.Keys, workWellLengthAndType.Values);
for (int m = 0; m < workWellLengthAndType.Values.Count; m++)
{
@@ -71,11 +91,11 @@
if (indexHit >= 0)
{
- GSOFeatures fs = list[indexHit];
+ //GSOFeatures fs = list[indexHit];
string sql = "";
string pipetype = chartAllAreaPipeline.Series["井盖"].Points[indexHit].AxisLabel;
-
+ GSOFeatures fs = map[pipetype];
string layername = "";
if (pipetype.EndsWith("窖井") || pipetype.EndsWith("表井") ||
(pipetype.EndsWith("窨井")) || pipetype.EndsWith("孔") ||
@@ -93,6 +113,23 @@
{
return;
}
+ //从图层获取datatable数据,不涉及数据库操作,速度会快一些
+ //string [] fieldNames = GSOFeatureUtils.getFields(layername, globeControl1);
+ //DataTable dt = GSOFeatureUtils.convertGSOFeatures2DataTable(fs,fieldNames);
+ //if (dt.Rows.Count > 0)
+ //{
+ // dataGridViewX1.DataSource = dt;
+ // panel.Visible = true;
+ // toolStripNumbers.Text = " 井盖类型:" + pipetype + "||共有:" + Convert.ToString(dt.Rows.Count) + "条记录";
+ //}
+ //else
+ //{
+ // panel.Visible = false;
+ // dataGridViewX1.DataSource = null;
+ // dataGridViewX1.Refresh();
+ // toolStripNumbers.Text = "类型:";
+ //}
+ //数据库获取数据
if (fs.Length > 0)
{
sql = "select " + getpipeLineFields.getFields(layername, globeControl1) + " from " + layer.Name;
@@ -120,8 +157,8 @@
{
dataGridViewX1.DataSource = dt;
panel.Visible = true;
- //toolStripNumbers.Text = " 井盖类型:" + MainFrm.m_CurrentQueryLayer + "||共有:" + Convert.ToString(dt.Rows.Count) + "条记录";
- toolStripNumbers.Text = " 井盖类型:" + pipetype + "||共有:" + Convert.ToString(dt.Rows.Count) + "条记录";
+ string strLable = toolStripNumbers.Text = " 井盖类型:" + pipetype + "||共有:" + Convert.ToString(dt.Rows.Count) + "条记录";
+ //m_InitDataGridViewX1(dt, strLable, "", true);
}
else
{
@@ -131,7 +168,6 @@
toolStripNumbers.Text = "类型:";
}
- //}
}
@@ -174,7 +210,7 @@
}
}
}
-
+ //m_InitDataGridViewX1(null,"","" , false);
globeControl1.Globe.MemoryLayer.RemoveAllFeature();
}
@@ -183,5 +219,63 @@
PATM_Forms.F_PATMTitle frm = new PATM_Forms.F_PATMTitle("S", chartAllAreaPipeline);
frm.Show();
}
+
+ //获取指定layer类型的附属物名称列表
+ public string[] getLayerAccNames(string layerType)
+ {
+ GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(layerType + "管线附属物");
+ if (layer == null) return null;
+
+ string sql = "select 附属物名称 from " + layerType + "管线附属物 group by 附属物名称";
+ DataSet dataset = OledbHelper.getDataSet(sql, layerType + "管线附属物");
+ if (dataset == null) return null;
+
+ int count = dataset.Tables[0].Rows.Count;
+
+
+ string[] result = new string[count];
+ for (int i = 0; i < count; i++)
+ {
+ result[i] = dataset.Tables[0].Rows[i][0].ToString();
+ }
+ return result;
+ }
+
+ ///
+ /// 获取区域内各图层的井、孔、蓖的map
+ ///
+ /// 区域
+ /// 要查找的附属物名称数组、如井、孔、蓖
+ /// 返回值为:<图层+附属物名称,附属物列表>
+
+ public Dictionary getAccsMap(GSOGeoPolygon3D polygon)
+ {
+ //List list = new List();
+ Dictionary map = new Dictionary();
+ ArrayList listpt = Utility.LayerNamesList;
+ if (listpt == null || listpt.Count == 0) return null;
+ FeatureStatisticsService service = new FeatureStatisticsService();
+ for (int i = 0; i < listpt.Count; i++)
+ {
+ GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(listpt[i] + "管线附属物");
+ string[] accNames = getLayerAccNames(listpt[i] as string);
+ if (accNames == null || accNames.Length == 0) continue;//排除不合法的值
+ for (int j = 0; j < accNames.Length; j++)
+ {
+ if (accNames[j].Contains("井") || accNames[j].Contains("孔") || accNames[j].Contains("篦"))
+ {
+
+ GSOFeatures features = service.Intersect_PointLayerByType(polygon, layer, accNames[j]);
+ if (features == null) continue;
+ map.Add(listpt[i] + accNames[j], features);
+ }
+
+ }
+
+ }
+ return map;
+
+ }
+
}
}
diff --git a/MainFrm.cs b/MainFrm.cs
index ac2614d..b584749 100644
--- a/MainFrm.cs
+++ b/MainFrm.cs
@@ -2951,35 +2951,35 @@
break;
case "workwellquery":
- workWellLen.Clear();
- List listWell = new List();
- //找到所有井
- if (Utility.LayerNamesList != null)
- {
- ArrayList listpt = Utility.LayerNamesList;
+ //workWellLen.Clear();
+ //List listWell = new List();
+ ////找到所有井
+ //if (Utility.LayerNamesList != null)
+ //{
+ // ArrayList listpt = Utility.LayerNamesList;
- for (int i = 0; i < listpt.Count; i++)
- {
- string pipelineType = (string)Utility.LayerNamesList[i];
+ // for (int i = 0; i < listpt.Count; i++)
+ // {
+ // string pipelineType = (string)Utility.LayerNamesList[i];
- string sql = "select 附属物名称 from " + pipelineType + "管线附属物 group by 附属物名称";
- DataSet dataset = OledbHelper.getDataSet(sql, pipelineType + "管线附属物");
- if (dataset != null)
- {
- for (int j = 0; j < dataset.Tables[0].Rows.Count; j++)
- {
- string accname = dataset.Tables[0].Rows[j][0].ToString();
- if ((accname.IndexOf("井") > 0) || (accname.IndexOf("孔") > 0) || (accname.IndexOf("篦") > 0))
- {
- GSOFeatures fs = Intersect_PointLayerByType(polygon, pipelineType, dataset.Tables[0].Rows[j][0].ToString());
- listWell.Add(fs);
- }
- }
- }
- }
- }
+ // string sql = "select 附属物名称 from " + pipelineType + "管线附属物 group by 附属物名称";
+ // DataSet dataset = OledbHelper.getDataSet(sql, pipelineType + "管线附属物");
+ // if (dataset != null)
+ // {
+ // for (int j = 0; j < dataset.Tables[0].Rows.Count; j++)
+ // {
+ // string accname = dataset.Tables[0].Rows[j][0].ToString();
+ // if ((accname.IndexOf("井") > 0) || (accname.IndexOf("孔") > 0) || (accname.IndexOf("篦") > 0))
+ // {
+ // GSOFeatures fs = Intersect_PointLayerByType(polygon, pipelineType, dataset.Tables[0].Rows[j][0].ToString());
+ // listWell.Add(fs);
+ // }
+ // }
+ // }
+ // }
+ //}
- FrmAllWorkWellStatis frmWell = new FrmAllWorkWellStatis(workWellLen, listWell, dataGridViewX1, toolStripNumbers, globeControl1, panelOfTable);
+ FrmAllWorkWellStatis frmWell = new FrmAllWorkWellStatis(polygon, dataGridViewX1, toolStripNumbers, globeControl1, panelOfTable);
frmWell.Show(this);
globeControl1.Globe.Action = EnumAction3D.ActionNull;
@@ -9740,37 +9740,37 @@
private void buttonItemTJ3_ALL_Click(object sender, EventArgs e)
{
//日志记录
- LogManager.saveLog(Utility.userName, "井盖数量统计");
+ //LogManager.saveLog(Utility.userName, "井盖数量统计");
- workWellLen.Clear();
- List list = new List();
+ //workWellLen.Clear();
+ //List list = new List();
- if (Utility.LayerNamesList != null)
- {
- ArrayList listpt = Utility.LayerNamesList;
+ //if (Utility.LayerNamesList != null)
+ //{
+ // ArrayList listpt = Utility.LayerNamesList;
- for (int i = 0; i < listpt.Count; i++)
- {
- string pipelineType = (string)Utility.LayerNamesList[i];
+ // for (int i = 0; i < listpt.Count; i++)
+ // {
+ // string pipelineType = (string)Utility.LayerNamesList[i];
- string sql = "select 附属物名称 from " + pipelineType + "管线附属物 group by 附属物名称";
- DataSet dataset = OledbHelper.getDataSet(sql, pipelineType + "管线附属物");
- if (dataset != null)
- {
- for (int j = 0; j < dataset.Tables[0].Rows.Count; j++)
- {
- string accname = dataset.Tables[0].Rows[j][0].ToString();
- if ((accname.IndexOf("井") > 0) || (accname.IndexOf("孔") > 0) || (accname.IndexOf("篦") > 0))
- {
- GSOFeatures fs = Intersect_PointLayerByType(null, pipelineType, dataset.Tables[0].Rows[j][0].ToString());
- list.Add(fs);
- }
- }
- }
- }
- }
+ // string sql = "select 附属物名称 from " + pipelineType + "管线附属物 group by 附属物名称";
+ // DataSet dataset = OledbHelper.getDataSet(sql, pipelineType + "管线附属物");
+ // if (dataset != null)
+ // {
+ // for (int j = 0; j < dataset.Tables[0].Rows.Count; j++)
+ // {
+ // string accname = dataset.Tables[0].Rows[j][0].ToString();
+ // if ((accname.IndexOf("井") > 0) || (accname.IndexOf("孔") > 0) || (accname.IndexOf("篦") > 0))
+ // {
+ // GSOFeatures fs = Intersect_PointLayerByType(null, pipelineType, dataset.Tables[0].Rows[j][0].ToString());
+ // list.Add(fs);
+ // }
+ // }
+ // }
+ // }
+ //}
- FrmAllWorkWellStatis frm = new FrmAllWorkWellStatis(workWellLen, list, dataGridViewX1, toolStripNumbers, globeControl1, panelOfTable);
+ FrmAllWorkWellStatis frm = new FrmAllWorkWellStatis(null, dataGridViewX1, toolStripNumbers, globeControl1, panelOfTable);
frm.Show(this);
}
///
diff --git a/obj/x64/Debug/Cyberpipe.FrmLogin.resources b/obj/x64/Debug/Cyberpipe.FrmLogin.resources
index 1f91e9b..ddd5756 100644
--- a/obj/x64/Debug/Cyberpipe.FrmLogin.resources
+++ b/obj/x64/Debug/Cyberpipe.FrmLogin.resources
Binary files differ
diff --git a/obj/x64/Debug/Cyberpipe.HFS_Forms.Frm_HFSinout.resources b/obj/x64/Debug/Cyberpipe.HFS_Forms.Frm_HFSinout.resources
index 5f1e50e..f1256ed 100644
--- a/obj/x64/Debug/Cyberpipe.HFS_Forms.Frm_HFSinout.resources
+++ b/obj/x64/Debug/Cyberpipe.HFS_Forms.Frm_HFSinout.resources
Binary files differ
diff --git a/obj/x64/Debug/Cyberpipe.MainFrm.resources b/obj/x64/Debug/Cyberpipe.MainFrm.resources
index 2c6b8c1..1d7970c 100644
--- a/obj/x64/Debug/Cyberpipe.MainFrm.resources
+++ b/obj/x64/Debug/Cyberpipe.MainFrm.resources
Binary files differ
diff --git a/Cyberpipe.suo b/Cyberpipe.suo
index 9a3c1e6..b66c3fa 100644
--- a/Cyberpipe.suo
+++ b/Cyberpipe.suo
Binary files differ
diff --git a/FeatureStatisticsService.cs b/FeatureStatisticsService.cs
index 8686f85..7b5caad 100644
--- a/FeatureStatisticsService.cs
+++ b/FeatureStatisticsService.cs
@@ -6,6 +6,8 @@
using GeoScene.Globe;
using GeoScene.Engine;
+using System.Windows.Forms;
+
namespace Cyberpipe
{
class FeatureStatisticsService
@@ -18,7 +20,7 @@
///
///
- private GSOFeatures Intersect_PointLayerByType(GSOGeoPolygon3D polygon, GSOLayer layer, string type)
+ public GSOFeatures Intersect_PointLayerByType(GSOGeoPolygon3D polygon, GSOLayer layer, string type)
{
if (layer == null) return null;
@@ -43,8 +45,8 @@
return newfeats;
}
-
-
+
+
///
///
/// 根据附属物列表,统计该类附属物个数
@@ -55,7 +57,7 @@
{
if (feats == null || feats.Length == 0) return null;
Dictionary result = new Dictionary();
- result.Add(feats[0].GetFieldAsString("附属物名称"),feats.Length);
+ result.Add(feats[0].GetFieldAsString("附属物名称"), feats.Length);
return result;
}
///
@@ -73,14 +75,15 @@
FeaturesClassfyResult result = new FeaturesClassfyResult();
double totalLength = 0.0;
int ncount = 0;
- GSOFeatures features = getPipesByValueSection( polygon, layer, min, max, fieldName);
- for (int i = 0; i < features.Length;i++ ) {
+ GSOFeatures features = getPipesByValueSection(polygon, layer, min, max, fieldName);
+ for (int i = 0; i < features.Length; i++)
+ {
GSOGeoPolyline3D line = features[i].Geometry as GSOGeoPolyline3D;
double length = line.GetSpaceLength(true, 6378137);
totalLength += length;
ncount += 1;
}
- string filedValue = (min == null) ? "不限":min+"-";
+ string filedValue = (min == null) ? "不限" : min + "-";
filedValue += (max == null) ? "不限" : max + "";
result.layerName = layer.Caption;
result.groupFieldValue = filedValue;//上下限的拼接
@@ -99,20 +102,21 @@
/// 上限
/// 统计类型:"起始埋深"或"管径_毫米"
///
- 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();
GSOFeatureLayer flayer = layer as GSOFeatureLayer;
//TODOLIST:优化为只获取管线,目前不清楚调用方式
- GSOFeatures feats = ( polygon == null )? flayer.GetAllFeatures() : flayer.FindFeaturesInPolygon(polygon, false);
+ GSOFeatures feats = (polygon == null) ? flayer.GetAllFeatures() : flayer.FindFeaturesInPolygon(polygon, false);
- double minValue = min ?? Double.MinValue ;
+ double minValue = min ?? Double.MinValue;
double maxValue = max ?? Double.MaxValue;
-
+
//筛选出符合条件的
- for (int i = 0; i < feats.Length;i++ )
+ for (int i = 0; i < feats.Length; i++)
{
double radius = feats[i].GetFieldAsDouble(fieldName);
if (radius >= min && radius <= max)
@@ -121,17 +125,17 @@
}
}
-
+
return result;
-
+
}
//图层名称、管径、条数、总长度
public List groupPipeByDiameter(GSOGeoPolygon3D polygon, GSOLayer layer)
{
if (layer == null) return null;
- List result = new List() ;
-
+ List result = new List();
+
GSOFeatureLayer flayer = layer as GSOFeatureLayer;
//TODOLIST:优化为只获取管线,目前不清楚调用方式
@@ -173,7 +177,7 @@
}
}
return result;
-
+
}
//图层名称、附属物个数
///
@@ -208,7 +212,7 @@
//过滤
for (int n = 0; n < feats.Length; n++)
{
- if (feats[n].GetFieldAsString("附属物名称").Contains(accessStrs[j])) newfeats.Add(feats[n]);
+ if (feats[n].GetFieldAsString("附属物名称").Contains(accessStrs[j])) newfeats.Add(feats[n]);
}
ncount = newfeats.Length;
}
@@ -218,10 +222,10 @@
featuresClass.layerName = accessStrs[j];
featuresClass.ncount = ncount;
- result.Add(featuresClass);
+ result.Add(featuresClass);
}
return result;
-
+
}
///
@@ -231,11 +235,11 @@
///
/// 材质
///
- public FeaturesClassfyResult groupPipeByMaterial(GSOGeoPolygon3D polygon, GSOLayer layer,string material)
- {
- if (layer == null) return null;
- FeaturesClassfyResult result = new FeaturesClassfyResult() ;
-
+ public FeaturesClassfyResult groupPipeByMaterial(GSOGeoPolygon3D polygon, GSOLayer layer, string material)
+ {
+ if (layer == null) return null;
+ FeaturesClassfyResult result = new FeaturesClassfyResult();
+
GSOFeatureLayer flayer = layer as GSOFeatureLayer;
//TODOLIST:优化为只获取管线,目前不清楚调用方式
@@ -244,7 +248,7 @@
string fixedMaterial = material == "无" ? "" : material;
double totalLength = 0.00;
int ncount = 0;
- for (int i = 0; i < feats.Length;i++ )
+ for (int i = 0; i < feats.Length; i++)
{
if (feats[i].GetFieldAsString("材质").Equals(fixedMaterial))
{
@@ -255,7 +259,7 @@
totalLength += length;
ncount += 1;
}
- }
+ }
}
result.layerName = layer.Caption;
@@ -264,13 +268,9 @@
result.sum = totalLength;
return result;
}
-
-
-
-
}
}
diff --git a/FrmAllWorkWellStatis.cs b/FrmAllWorkWellStatis.cs
index 4f0593d..fe2b7f8 100644
--- a/FrmAllWorkWellStatis.cs
+++ b/FrmAllWorkWellStatis.cs
@@ -9,30 +9,45 @@
using GeoScene.Data;
using GeoScene.Globe;
using DevComponents.DotNetBar;
+using System.Collections;
namespace Cyberpipe
{
public partial class FrmAllWorkWellStatis : DevComponents.DotNetBar.Office2007Form
{
- Dictionary workWellLengthAndType = new Dictionary();
- List list = new List();
+
+ private MainFrm.DataGridViewDelegate m_InitDataGridViewX1;
+ private Dictionary map = null;
DataGridView dataGridViewX1;
ToolStripStatusLabel toolStripNumbers;
GSOGlobeControl globeControl1;
PanelEx panel;
- public FrmAllWorkWellStatis(Dictionary wellLen, List _list, DataGridView dataGridViewX11, ToolStripStatusLabel toolStripNumbers1, GSOGlobeControl ctl, PanelEx p)
+ //TODOLIST:用晓伟的代理进行操作,功能拆分细化
+ public FrmAllWorkWellStatis(GSOGeoPolygon3D polygon, DataGridView dataGridViewX11, ToolStripStatusLabel toolStripNumbers1, GSOGlobeControl ctl, PanelEx p)
{
InitializeComponent();
panel = p;
- workWellLengthAndType = wellLen;
- list = _list;
dataGridViewX1 = dataGridViewX11;
toolStripNumbers = toolStripNumbers1;
-
globeControl1 = ctl;
+ map = getAccsMap(polygon);
+
+ }
+ public FrmAllWorkWellStatis(GSOGeoPolygon3D polygon, MainFrm.DataGridViewDelegate InitDataGridViewX1, GSOGlobeControl ctl)
+ {
+ InitializeComponent();
+ globeControl1 = ctl;
+ m_InitDataGridViewX1 = InitDataGridViewX1;
+ map = getAccsMap(polygon);
+
}
private void FrmAllPipelineStatis_Load(object sender, EventArgs e)
{
+ drawChart();
+ }
+
+ public void drawChart()
+ {
try
{
// Set axis title
@@ -49,6 +64,11 @@
chartAllAreaPipeline.Series["井盖"]["DrawingStyle"] = "Cylinder";
//chartAllAreaPipeline.Series[0].IsValueShownAsLabel = true;
+ Dictionary workWellLengthAndType = new Dictionary();
+ foreach (KeyValuePair kv in map)
+ {
+ workWellLengthAndType.Add(kv.Key, kv.Value.Length);
+ }
chartAllAreaPipeline.Series["井盖"].Points.DataBindXY(workWellLengthAndType.Keys, workWellLengthAndType.Values);
for (int m = 0; m < workWellLengthAndType.Values.Count; m++)
{
@@ -71,11 +91,11 @@
if (indexHit >= 0)
{
- GSOFeatures fs = list[indexHit];
+ //GSOFeatures fs = list[indexHit];
string sql = "";
string pipetype = chartAllAreaPipeline.Series["井盖"].Points[indexHit].AxisLabel;
-
+ GSOFeatures fs = map[pipetype];
string layername = "";
if (pipetype.EndsWith("窖井") || pipetype.EndsWith("表井") ||
(pipetype.EndsWith("窨井")) || pipetype.EndsWith("孔") ||
@@ -93,6 +113,23 @@
{
return;
}
+ //从图层获取datatable数据,不涉及数据库操作,速度会快一些
+ //string [] fieldNames = GSOFeatureUtils.getFields(layername, globeControl1);
+ //DataTable dt = GSOFeatureUtils.convertGSOFeatures2DataTable(fs,fieldNames);
+ //if (dt.Rows.Count > 0)
+ //{
+ // dataGridViewX1.DataSource = dt;
+ // panel.Visible = true;
+ // toolStripNumbers.Text = " 井盖类型:" + pipetype + "||共有:" + Convert.ToString(dt.Rows.Count) + "条记录";
+ //}
+ //else
+ //{
+ // panel.Visible = false;
+ // dataGridViewX1.DataSource = null;
+ // dataGridViewX1.Refresh();
+ // toolStripNumbers.Text = "类型:";
+ //}
+ //数据库获取数据
if (fs.Length > 0)
{
sql = "select " + getpipeLineFields.getFields(layername, globeControl1) + " from " + layer.Name;
@@ -120,8 +157,8 @@
{
dataGridViewX1.DataSource = dt;
panel.Visible = true;
- //toolStripNumbers.Text = " 井盖类型:" + MainFrm.m_CurrentQueryLayer + "||共有:" + Convert.ToString(dt.Rows.Count) + "条记录";
- toolStripNumbers.Text = " 井盖类型:" + pipetype + "||共有:" + Convert.ToString(dt.Rows.Count) + "条记录";
+ string strLable = toolStripNumbers.Text = " 井盖类型:" + pipetype + "||共有:" + Convert.ToString(dt.Rows.Count) + "条记录";
+ //m_InitDataGridViewX1(dt, strLable, "", true);
}
else
{
@@ -131,7 +168,6 @@
toolStripNumbers.Text = "类型:";
}
- //}
}
@@ -174,7 +210,7 @@
}
}
}
-
+ //m_InitDataGridViewX1(null,"","" , false);
globeControl1.Globe.MemoryLayer.RemoveAllFeature();
}
@@ -183,5 +219,63 @@
PATM_Forms.F_PATMTitle frm = new PATM_Forms.F_PATMTitle("S", chartAllAreaPipeline);
frm.Show();
}
+
+ //获取指定layer类型的附属物名称列表
+ public string[] getLayerAccNames(string layerType)
+ {
+ GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(layerType + "管线附属物");
+ if (layer == null) return null;
+
+ string sql = "select 附属物名称 from " + layerType + "管线附属物 group by 附属物名称";
+ DataSet dataset = OledbHelper.getDataSet(sql, layerType + "管线附属物");
+ if (dataset == null) return null;
+
+ int count = dataset.Tables[0].Rows.Count;
+
+
+ string[] result = new string[count];
+ for (int i = 0; i < count; i++)
+ {
+ result[i] = dataset.Tables[0].Rows[i][0].ToString();
+ }
+ return result;
+ }
+
+ ///
+ /// 获取区域内各图层的井、孔、蓖的map
+ ///
+ /// 区域
+ /// 要查找的附属物名称数组、如井、孔、蓖
+ /// 返回值为:<图层+附属物名称,附属物列表>
+
+ public Dictionary getAccsMap(GSOGeoPolygon3D polygon)
+ {
+ //List list = new List();
+ Dictionary map = new Dictionary();
+ ArrayList listpt = Utility.LayerNamesList;
+ if (listpt == null || listpt.Count == 0) return null;
+ FeatureStatisticsService service = new FeatureStatisticsService();
+ for (int i = 0; i < listpt.Count; i++)
+ {
+ GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(listpt[i] + "管线附属物");
+ string[] accNames = getLayerAccNames(listpt[i] as string);
+ if (accNames == null || accNames.Length == 0) continue;//排除不合法的值
+ for (int j = 0; j < accNames.Length; j++)
+ {
+ if (accNames[j].Contains("井") || accNames[j].Contains("孔") || accNames[j].Contains("篦"))
+ {
+
+ GSOFeatures features = service.Intersect_PointLayerByType(polygon, layer, accNames[j]);
+ if (features == null) continue;
+ map.Add(listpt[i] + accNames[j], features);
+ }
+
+ }
+
+ }
+ return map;
+
+ }
+
}
}
diff --git a/MainFrm.cs b/MainFrm.cs
index ac2614d..b584749 100644
--- a/MainFrm.cs
+++ b/MainFrm.cs
@@ -2951,35 +2951,35 @@
break;
case "workwellquery":
- workWellLen.Clear();
- List listWell = new List();
- //找到所有井
- if (Utility.LayerNamesList != null)
- {
- ArrayList listpt = Utility.LayerNamesList;
+ //workWellLen.Clear();
+ //List listWell = new List();
+ ////找到所有井
+ //if (Utility.LayerNamesList != null)
+ //{
+ // ArrayList listpt = Utility.LayerNamesList;
- for (int i = 0; i < listpt.Count; i++)
- {
- string pipelineType = (string)Utility.LayerNamesList[i];
+ // for (int i = 0; i < listpt.Count; i++)
+ // {
+ // string pipelineType = (string)Utility.LayerNamesList[i];
- string sql = "select 附属物名称 from " + pipelineType + "管线附属物 group by 附属物名称";
- DataSet dataset = OledbHelper.getDataSet(sql, pipelineType + "管线附属物");
- if (dataset != null)
- {
- for (int j = 0; j < dataset.Tables[0].Rows.Count; j++)
- {
- string accname = dataset.Tables[0].Rows[j][0].ToString();
- if ((accname.IndexOf("井") > 0) || (accname.IndexOf("孔") > 0) || (accname.IndexOf("篦") > 0))
- {
- GSOFeatures fs = Intersect_PointLayerByType(polygon, pipelineType, dataset.Tables[0].Rows[j][0].ToString());
- listWell.Add(fs);
- }
- }
- }
- }
- }
+ // string sql = "select 附属物名称 from " + pipelineType + "管线附属物 group by 附属物名称";
+ // DataSet dataset = OledbHelper.getDataSet(sql, pipelineType + "管线附属物");
+ // if (dataset != null)
+ // {
+ // for (int j = 0; j < dataset.Tables[0].Rows.Count; j++)
+ // {
+ // string accname = dataset.Tables[0].Rows[j][0].ToString();
+ // if ((accname.IndexOf("井") > 0) || (accname.IndexOf("孔") > 0) || (accname.IndexOf("篦") > 0))
+ // {
+ // GSOFeatures fs = Intersect_PointLayerByType(polygon, pipelineType, dataset.Tables[0].Rows[j][0].ToString());
+ // listWell.Add(fs);
+ // }
+ // }
+ // }
+ // }
+ //}
- FrmAllWorkWellStatis frmWell = new FrmAllWorkWellStatis(workWellLen, listWell, dataGridViewX1, toolStripNumbers, globeControl1, panelOfTable);
+ FrmAllWorkWellStatis frmWell = new FrmAllWorkWellStatis(polygon, dataGridViewX1, toolStripNumbers, globeControl1, panelOfTable);
frmWell.Show(this);
globeControl1.Globe.Action = EnumAction3D.ActionNull;
@@ -9740,37 +9740,37 @@
private void buttonItemTJ3_ALL_Click(object sender, EventArgs e)
{
//日志记录
- LogManager.saveLog(Utility.userName, "井盖数量统计");
+ //LogManager.saveLog(Utility.userName, "井盖数量统计");
- workWellLen.Clear();
- List list = new List();
+ //workWellLen.Clear();
+ //List list = new List();
- if (Utility.LayerNamesList != null)
- {
- ArrayList listpt = Utility.LayerNamesList;
+ //if (Utility.LayerNamesList != null)
+ //{
+ // ArrayList listpt = Utility.LayerNamesList;
- for (int i = 0; i < listpt.Count; i++)
- {
- string pipelineType = (string)Utility.LayerNamesList[i];
+ // for (int i = 0; i < listpt.Count; i++)
+ // {
+ // string pipelineType = (string)Utility.LayerNamesList[i];
- string sql = "select 附属物名称 from " + pipelineType + "管线附属物 group by 附属物名称";
- DataSet dataset = OledbHelper.getDataSet(sql, pipelineType + "管线附属物");
- if (dataset != null)
- {
- for (int j = 0; j < dataset.Tables[0].Rows.Count; j++)
- {
- string accname = dataset.Tables[0].Rows[j][0].ToString();
- if ((accname.IndexOf("井") > 0) || (accname.IndexOf("孔") > 0) || (accname.IndexOf("篦") > 0))
- {
- GSOFeatures fs = Intersect_PointLayerByType(null, pipelineType, dataset.Tables[0].Rows[j][0].ToString());
- list.Add(fs);
- }
- }
- }
- }
- }
+ // string sql = "select 附属物名称 from " + pipelineType + "管线附属物 group by 附属物名称";
+ // DataSet dataset = OledbHelper.getDataSet(sql, pipelineType + "管线附属物");
+ // if (dataset != null)
+ // {
+ // for (int j = 0; j < dataset.Tables[0].Rows.Count; j++)
+ // {
+ // string accname = dataset.Tables[0].Rows[j][0].ToString();
+ // if ((accname.IndexOf("井") > 0) || (accname.IndexOf("孔") > 0) || (accname.IndexOf("篦") > 0))
+ // {
+ // GSOFeatures fs = Intersect_PointLayerByType(null, pipelineType, dataset.Tables[0].Rows[j][0].ToString());
+ // list.Add(fs);
+ // }
+ // }
+ // }
+ // }
+ //}
- FrmAllWorkWellStatis frm = new FrmAllWorkWellStatis(workWellLen, list, dataGridViewX1, toolStripNumbers, globeControl1, panelOfTable);
+ FrmAllWorkWellStatis frm = new FrmAllWorkWellStatis(null, dataGridViewX1, toolStripNumbers, globeControl1, panelOfTable);
frm.Show(this);
}
///
diff --git a/obj/x64/Debug/Cyberpipe.FrmLogin.resources b/obj/x64/Debug/Cyberpipe.FrmLogin.resources
index 1f91e9b..ddd5756 100644
--- a/obj/x64/Debug/Cyberpipe.FrmLogin.resources
+++ b/obj/x64/Debug/Cyberpipe.FrmLogin.resources
Binary files differ
diff --git a/obj/x64/Debug/Cyberpipe.HFS_Forms.Frm_HFSinout.resources b/obj/x64/Debug/Cyberpipe.HFS_Forms.Frm_HFSinout.resources
index 5f1e50e..f1256ed 100644
--- a/obj/x64/Debug/Cyberpipe.HFS_Forms.Frm_HFSinout.resources
+++ b/obj/x64/Debug/Cyberpipe.HFS_Forms.Frm_HFSinout.resources
Binary files differ
diff --git a/obj/x64/Debug/Cyberpipe.MainFrm.resources b/obj/x64/Debug/Cyberpipe.MainFrm.resources
index 2c6b8c1..1d7970c 100644
--- a/obj/x64/Debug/Cyberpipe.MainFrm.resources
+++ b/obj/x64/Debug/Cyberpipe.MainFrm.resources
Binary files differ
diff --git a/obj/x64/Debug/Cyberpipe.PATM_Forms.F_PATMInout.resources b/obj/x64/Debug/Cyberpipe.PATM_Forms.F_PATMInout.resources
index 8403735..cd44f5d 100644
--- a/obj/x64/Debug/Cyberpipe.PATM_Forms.F_PATMInout.resources
+++ b/obj/x64/Debug/Cyberpipe.PATM_Forms.F_PATMInout.resources
Binary files differ
diff --git a/Cyberpipe.suo b/Cyberpipe.suo
index 9a3c1e6..b66c3fa 100644
--- a/Cyberpipe.suo
+++ b/Cyberpipe.suo
Binary files differ
diff --git a/FeatureStatisticsService.cs b/FeatureStatisticsService.cs
index 8686f85..7b5caad 100644
--- a/FeatureStatisticsService.cs
+++ b/FeatureStatisticsService.cs
@@ -6,6 +6,8 @@
using GeoScene.Globe;
using GeoScene.Engine;
+using System.Windows.Forms;
+
namespace Cyberpipe
{
class FeatureStatisticsService
@@ -18,7 +20,7 @@
///
///
- private GSOFeatures Intersect_PointLayerByType(GSOGeoPolygon3D polygon, GSOLayer layer, string type)
+ public GSOFeatures Intersect_PointLayerByType(GSOGeoPolygon3D polygon, GSOLayer layer, string type)
{
if (layer == null) return null;
@@ -43,8 +45,8 @@
return newfeats;
}
-
-
+
+
///
///
/// 根据附属物列表,统计该类附属物个数
@@ -55,7 +57,7 @@
{
if (feats == null || feats.Length == 0) return null;
Dictionary result = new Dictionary();
- result.Add(feats[0].GetFieldAsString("附属物名称"),feats.Length);
+ result.Add(feats[0].GetFieldAsString("附属物名称"), feats.Length);
return result;
}
///
@@ -73,14 +75,15 @@
FeaturesClassfyResult result = new FeaturesClassfyResult();
double totalLength = 0.0;
int ncount = 0;
- GSOFeatures features = getPipesByValueSection( polygon, layer, min, max, fieldName);
- for (int i = 0; i < features.Length;i++ ) {
+ GSOFeatures features = getPipesByValueSection(polygon, layer, min, max, fieldName);
+ for (int i = 0; i < features.Length; i++)
+ {
GSOGeoPolyline3D line = features[i].Geometry as GSOGeoPolyline3D;
double length = line.GetSpaceLength(true, 6378137);
totalLength += length;
ncount += 1;
}
- string filedValue = (min == null) ? "不限":min+"-";
+ string filedValue = (min == null) ? "不限" : min + "-";
filedValue += (max == null) ? "不限" : max + "";
result.layerName = layer.Caption;
result.groupFieldValue = filedValue;//上下限的拼接
@@ -99,20 +102,21 @@
/// 上限
/// 统计类型:"起始埋深"或"管径_毫米"
///
- 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();
GSOFeatureLayer flayer = layer as GSOFeatureLayer;
//TODOLIST:优化为只获取管线,目前不清楚调用方式
- GSOFeatures feats = ( polygon == null )? flayer.GetAllFeatures() : flayer.FindFeaturesInPolygon(polygon, false);
+ GSOFeatures feats = (polygon == null) ? flayer.GetAllFeatures() : flayer.FindFeaturesInPolygon(polygon, false);
- double minValue = min ?? Double.MinValue ;
+ double minValue = min ?? Double.MinValue;
double maxValue = max ?? Double.MaxValue;
-
+
//筛选出符合条件的
- for (int i = 0; i < feats.Length;i++ )
+ for (int i = 0; i < feats.Length; i++)
{
double radius = feats[i].GetFieldAsDouble(fieldName);
if (radius >= min && radius <= max)
@@ -121,17 +125,17 @@
}
}
-
+
return result;
-
+
}
//图层名称、管径、条数、总长度
public List groupPipeByDiameter(GSOGeoPolygon3D polygon, GSOLayer layer)
{
if (layer == null) return null;
- List result = new List() ;
-
+ List result = new List();
+
GSOFeatureLayer flayer = layer as GSOFeatureLayer;
//TODOLIST:优化为只获取管线,目前不清楚调用方式
@@ -173,7 +177,7 @@
}
}
return result;
-
+
}
//图层名称、附属物个数
///
@@ -208,7 +212,7 @@
//过滤
for (int n = 0; n < feats.Length; n++)
{
- if (feats[n].GetFieldAsString("附属物名称").Contains(accessStrs[j])) newfeats.Add(feats[n]);
+ if (feats[n].GetFieldAsString("附属物名称").Contains(accessStrs[j])) newfeats.Add(feats[n]);
}
ncount = newfeats.Length;
}
@@ -218,10 +222,10 @@
featuresClass.layerName = accessStrs[j];
featuresClass.ncount = ncount;
- result.Add(featuresClass);
+ result.Add(featuresClass);
}
return result;
-
+
}
///
@@ -231,11 +235,11 @@
///
/// 材质
///
- public FeaturesClassfyResult groupPipeByMaterial(GSOGeoPolygon3D polygon, GSOLayer layer,string material)
- {
- if (layer == null) return null;
- FeaturesClassfyResult result = new FeaturesClassfyResult() ;
-
+ public FeaturesClassfyResult groupPipeByMaterial(GSOGeoPolygon3D polygon, GSOLayer layer, string material)
+ {
+ if (layer == null) return null;
+ FeaturesClassfyResult result = new FeaturesClassfyResult();
+
GSOFeatureLayer flayer = layer as GSOFeatureLayer;
//TODOLIST:优化为只获取管线,目前不清楚调用方式
@@ -244,7 +248,7 @@
string fixedMaterial = material == "无" ? "" : material;
double totalLength = 0.00;
int ncount = 0;
- for (int i = 0; i < feats.Length;i++ )
+ for (int i = 0; i < feats.Length; i++)
{
if (feats[i].GetFieldAsString("材质").Equals(fixedMaterial))
{
@@ -255,7 +259,7 @@
totalLength += length;
ncount += 1;
}
- }
+ }
}
result.layerName = layer.Caption;
@@ -264,13 +268,9 @@
result.sum = totalLength;
return result;
}
-
-
-
-
}
}
diff --git a/FrmAllWorkWellStatis.cs b/FrmAllWorkWellStatis.cs
index 4f0593d..fe2b7f8 100644
--- a/FrmAllWorkWellStatis.cs
+++ b/FrmAllWorkWellStatis.cs
@@ -9,30 +9,45 @@
using GeoScene.Data;
using GeoScene.Globe;
using DevComponents.DotNetBar;
+using System.Collections;
namespace Cyberpipe
{
public partial class FrmAllWorkWellStatis : DevComponents.DotNetBar.Office2007Form
{
- Dictionary workWellLengthAndType = new Dictionary();
- List list = new List();
+
+ private MainFrm.DataGridViewDelegate m_InitDataGridViewX1;
+ private Dictionary map = null;
DataGridView dataGridViewX1;
ToolStripStatusLabel toolStripNumbers;
GSOGlobeControl globeControl1;
PanelEx panel;
- public FrmAllWorkWellStatis(Dictionary wellLen, List _list, DataGridView dataGridViewX11, ToolStripStatusLabel toolStripNumbers1, GSOGlobeControl ctl, PanelEx p)
+ //TODOLIST:用晓伟的代理进行操作,功能拆分细化
+ public FrmAllWorkWellStatis(GSOGeoPolygon3D polygon, DataGridView dataGridViewX11, ToolStripStatusLabel toolStripNumbers1, GSOGlobeControl ctl, PanelEx p)
{
InitializeComponent();
panel = p;
- workWellLengthAndType = wellLen;
- list = _list;
dataGridViewX1 = dataGridViewX11;
toolStripNumbers = toolStripNumbers1;
-
globeControl1 = ctl;
+ map = getAccsMap(polygon);
+
+ }
+ public FrmAllWorkWellStatis(GSOGeoPolygon3D polygon, MainFrm.DataGridViewDelegate InitDataGridViewX1, GSOGlobeControl ctl)
+ {
+ InitializeComponent();
+ globeControl1 = ctl;
+ m_InitDataGridViewX1 = InitDataGridViewX1;
+ map = getAccsMap(polygon);
+
}
private void FrmAllPipelineStatis_Load(object sender, EventArgs e)
{
+ drawChart();
+ }
+
+ public void drawChart()
+ {
try
{
// Set axis title
@@ -49,6 +64,11 @@
chartAllAreaPipeline.Series["井盖"]["DrawingStyle"] = "Cylinder";
//chartAllAreaPipeline.Series[0].IsValueShownAsLabel = true;
+ Dictionary workWellLengthAndType = new Dictionary();
+ foreach (KeyValuePair kv in map)
+ {
+ workWellLengthAndType.Add(kv.Key, kv.Value.Length);
+ }
chartAllAreaPipeline.Series["井盖"].Points.DataBindXY(workWellLengthAndType.Keys, workWellLengthAndType.Values);
for (int m = 0; m < workWellLengthAndType.Values.Count; m++)
{
@@ -71,11 +91,11 @@
if (indexHit >= 0)
{
- GSOFeatures fs = list[indexHit];
+ //GSOFeatures fs = list[indexHit];
string sql = "";
string pipetype = chartAllAreaPipeline.Series["井盖"].Points[indexHit].AxisLabel;
-
+ GSOFeatures fs = map[pipetype];
string layername = "";
if (pipetype.EndsWith("窖井") || pipetype.EndsWith("表井") ||
(pipetype.EndsWith("窨井")) || pipetype.EndsWith("孔") ||
@@ -93,6 +113,23 @@
{
return;
}
+ //从图层获取datatable数据,不涉及数据库操作,速度会快一些
+ //string [] fieldNames = GSOFeatureUtils.getFields(layername, globeControl1);
+ //DataTable dt = GSOFeatureUtils.convertGSOFeatures2DataTable(fs,fieldNames);
+ //if (dt.Rows.Count > 0)
+ //{
+ // dataGridViewX1.DataSource = dt;
+ // panel.Visible = true;
+ // toolStripNumbers.Text = " 井盖类型:" + pipetype + "||共有:" + Convert.ToString(dt.Rows.Count) + "条记录";
+ //}
+ //else
+ //{
+ // panel.Visible = false;
+ // dataGridViewX1.DataSource = null;
+ // dataGridViewX1.Refresh();
+ // toolStripNumbers.Text = "类型:";
+ //}
+ //数据库获取数据
if (fs.Length > 0)
{
sql = "select " + getpipeLineFields.getFields(layername, globeControl1) + " from " + layer.Name;
@@ -120,8 +157,8 @@
{
dataGridViewX1.DataSource = dt;
panel.Visible = true;
- //toolStripNumbers.Text = " 井盖类型:" + MainFrm.m_CurrentQueryLayer + "||共有:" + Convert.ToString(dt.Rows.Count) + "条记录";
- toolStripNumbers.Text = " 井盖类型:" + pipetype + "||共有:" + Convert.ToString(dt.Rows.Count) + "条记录";
+ string strLable = toolStripNumbers.Text = " 井盖类型:" + pipetype + "||共有:" + Convert.ToString(dt.Rows.Count) + "条记录";
+ //m_InitDataGridViewX1(dt, strLable, "", true);
}
else
{
@@ -131,7 +168,6 @@
toolStripNumbers.Text = "类型:";
}
- //}
}
@@ -174,7 +210,7 @@
}
}
}
-
+ //m_InitDataGridViewX1(null,"","" , false);
globeControl1.Globe.MemoryLayer.RemoveAllFeature();
}
@@ -183,5 +219,63 @@
PATM_Forms.F_PATMTitle frm = new PATM_Forms.F_PATMTitle("S", chartAllAreaPipeline);
frm.Show();
}
+
+ //获取指定layer类型的附属物名称列表
+ public string[] getLayerAccNames(string layerType)
+ {
+ GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(layerType + "管线附属物");
+ if (layer == null) return null;
+
+ string sql = "select 附属物名称 from " + layerType + "管线附属物 group by 附属物名称";
+ DataSet dataset = OledbHelper.getDataSet(sql, layerType + "管线附属物");
+ if (dataset == null) return null;
+
+ int count = dataset.Tables[0].Rows.Count;
+
+
+ string[] result = new string[count];
+ for (int i = 0; i < count; i++)
+ {
+ result[i] = dataset.Tables[0].Rows[i][0].ToString();
+ }
+ return result;
+ }
+
+ ///
+ /// 获取区域内各图层的井、孔、蓖的map
+ ///
+ /// 区域
+ /// 要查找的附属物名称数组、如井、孔、蓖
+ /// 返回值为:<图层+附属物名称,附属物列表>
+
+ public Dictionary getAccsMap(GSOGeoPolygon3D polygon)
+ {
+ //List list = new List();
+ Dictionary map = new Dictionary();
+ ArrayList listpt = Utility.LayerNamesList;
+ if (listpt == null || listpt.Count == 0) return null;
+ FeatureStatisticsService service = new FeatureStatisticsService();
+ for (int i = 0; i < listpt.Count; i++)
+ {
+ GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(listpt[i] + "管线附属物");
+ string[] accNames = getLayerAccNames(listpt[i] as string);
+ if (accNames == null || accNames.Length == 0) continue;//排除不合法的值
+ for (int j = 0; j < accNames.Length; j++)
+ {
+ if (accNames[j].Contains("井") || accNames[j].Contains("孔") || accNames[j].Contains("篦"))
+ {
+
+ GSOFeatures features = service.Intersect_PointLayerByType(polygon, layer, accNames[j]);
+ if (features == null) continue;
+ map.Add(listpt[i] + accNames[j], features);
+ }
+
+ }
+
+ }
+ return map;
+
+ }
+
}
}
diff --git a/MainFrm.cs b/MainFrm.cs
index ac2614d..b584749 100644
--- a/MainFrm.cs
+++ b/MainFrm.cs
@@ -2951,35 +2951,35 @@
break;
case "workwellquery":
- workWellLen.Clear();
- List listWell = new List();
- //找到所有井
- if (Utility.LayerNamesList != null)
- {
- ArrayList listpt = Utility.LayerNamesList;
+ //workWellLen.Clear();
+ //List listWell = new List();
+ ////找到所有井
+ //if (Utility.LayerNamesList != null)
+ //{
+ // ArrayList listpt = Utility.LayerNamesList;
- for (int i = 0; i < listpt.Count; i++)
- {
- string pipelineType = (string)Utility.LayerNamesList[i];
+ // for (int i = 0; i < listpt.Count; i++)
+ // {
+ // string pipelineType = (string)Utility.LayerNamesList[i];
- string sql = "select 附属物名称 from " + pipelineType + "管线附属物 group by 附属物名称";
- DataSet dataset = OledbHelper.getDataSet(sql, pipelineType + "管线附属物");
- if (dataset != null)
- {
- for (int j = 0; j < dataset.Tables[0].Rows.Count; j++)
- {
- string accname = dataset.Tables[0].Rows[j][0].ToString();
- if ((accname.IndexOf("井") > 0) || (accname.IndexOf("孔") > 0) || (accname.IndexOf("篦") > 0))
- {
- GSOFeatures fs = Intersect_PointLayerByType(polygon, pipelineType, dataset.Tables[0].Rows[j][0].ToString());
- listWell.Add(fs);
- }
- }
- }
- }
- }
+ // string sql = "select 附属物名称 from " + pipelineType + "管线附属物 group by 附属物名称";
+ // DataSet dataset = OledbHelper.getDataSet(sql, pipelineType + "管线附属物");
+ // if (dataset != null)
+ // {
+ // for (int j = 0; j < dataset.Tables[0].Rows.Count; j++)
+ // {
+ // string accname = dataset.Tables[0].Rows[j][0].ToString();
+ // if ((accname.IndexOf("井") > 0) || (accname.IndexOf("孔") > 0) || (accname.IndexOf("篦") > 0))
+ // {
+ // GSOFeatures fs = Intersect_PointLayerByType(polygon, pipelineType, dataset.Tables[0].Rows[j][0].ToString());
+ // listWell.Add(fs);
+ // }
+ // }
+ // }
+ // }
+ //}
- FrmAllWorkWellStatis frmWell = new FrmAllWorkWellStatis(workWellLen, listWell, dataGridViewX1, toolStripNumbers, globeControl1, panelOfTable);
+ FrmAllWorkWellStatis frmWell = new FrmAllWorkWellStatis(polygon, dataGridViewX1, toolStripNumbers, globeControl1, panelOfTable);
frmWell.Show(this);
globeControl1.Globe.Action = EnumAction3D.ActionNull;
@@ -9740,37 +9740,37 @@
private void buttonItemTJ3_ALL_Click(object sender, EventArgs e)
{
//日志记录
- LogManager.saveLog(Utility.userName, "井盖数量统计");
+ //LogManager.saveLog(Utility.userName, "井盖数量统计");
- workWellLen.Clear();
- List list = new List();
+ //workWellLen.Clear();
+ //List list = new List();
- if (Utility.LayerNamesList != null)
- {
- ArrayList listpt = Utility.LayerNamesList;
+ //if (Utility.LayerNamesList != null)
+ //{
+ // ArrayList listpt = Utility.LayerNamesList;
- for (int i = 0; i < listpt.Count; i++)
- {
- string pipelineType = (string)Utility.LayerNamesList[i];
+ // for (int i = 0; i < listpt.Count; i++)
+ // {
+ // string pipelineType = (string)Utility.LayerNamesList[i];
- string sql = "select 附属物名称 from " + pipelineType + "管线附属物 group by 附属物名称";
- DataSet dataset = OledbHelper.getDataSet(sql, pipelineType + "管线附属物");
- if (dataset != null)
- {
- for (int j = 0; j < dataset.Tables[0].Rows.Count; j++)
- {
- string accname = dataset.Tables[0].Rows[j][0].ToString();
- if ((accname.IndexOf("井") > 0) || (accname.IndexOf("孔") > 0) || (accname.IndexOf("篦") > 0))
- {
- GSOFeatures fs = Intersect_PointLayerByType(null, pipelineType, dataset.Tables[0].Rows[j][0].ToString());
- list.Add(fs);
- }
- }
- }
- }
- }
+ // string sql = "select 附属物名称 from " + pipelineType + "管线附属物 group by 附属物名称";
+ // DataSet dataset = OledbHelper.getDataSet(sql, pipelineType + "管线附属物");
+ // if (dataset != null)
+ // {
+ // for (int j = 0; j < dataset.Tables[0].Rows.Count; j++)
+ // {
+ // string accname = dataset.Tables[0].Rows[j][0].ToString();
+ // if ((accname.IndexOf("井") > 0) || (accname.IndexOf("孔") > 0) || (accname.IndexOf("篦") > 0))
+ // {
+ // GSOFeatures fs = Intersect_PointLayerByType(null, pipelineType, dataset.Tables[0].Rows[j][0].ToString());
+ // list.Add(fs);
+ // }
+ // }
+ // }
+ // }
+ //}
- FrmAllWorkWellStatis frm = new FrmAllWorkWellStatis(workWellLen, list, dataGridViewX1, toolStripNumbers, globeControl1, panelOfTable);
+ FrmAllWorkWellStatis frm = new FrmAllWorkWellStatis(null, dataGridViewX1, toolStripNumbers, globeControl1, panelOfTable);
frm.Show(this);
}
///
diff --git a/obj/x64/Debug/Cyberpipe.FrmLogin.resources b/obj/x64/Debug/Cyberpipe.FrmLogin.resources
index 1f91e9b..ddd5756 100644
--- a/obj/x64/Debug/Cyberpipe.FrmLogin.resources
+++ b/obj/x64/Debug/Cyberpipe.FrmLogin.resources
Binary files differ
diff --git a/obj/x64/Debug/Cyberpipe.HFS_Forms.Frm_HFSinout.resources b/obj/x64/Debug/Cyberpipe.HFS_Forms.Frm_HFSinout.resources
index 5f1e50e..f1256ed 100644
--- a/obj/x64/Debug/Cyberpipe.HFS_Forms.Frm_HFSinout.resources
+++ b/obj/x64/Debug/Cyberpipe.HFS_Forms.Frm_HFSinout.resources
Binary files differ
diff --git a/obj/x64/Debug/Cyberpipe.MainFrm.resources b/obj/x64/Debug/Cyberpipe.MainFrm.resources
index 2c6b8c1..1d7970c 100644
--- a/obj/x64/Debug/Cyberpipe.MainFrm.resources
+++ b/obj/x64/Debug/Cyberpipe.MainFrm.resources
Binary files differ
diff --git a/obj/x64/Debug/Cyberpipe.PATM_Forms.F_PATMInout.resources b/obj/x64/Debug/Cyberpipe.PATM_Forms.F_PATMInout.resources
index 8403735..cd44f5d 100644
--- a/obj/x64/Debug/Cyberpipe.PATM_Forms.F_PATMInout.resources
+++ b/obj/x64/Debug/Cyberpipe.PATM_Forms.F_PATMInout.resources
Binary files differ
diff --git a/obj/x64/Debug/Cyberpipe.Properties.Resources.resources b/obj/x64/Debug/Cyberpipe.Properties.Resources.resources
index 30635f2..adf5da5 100644
--- a/obj/x64/Debug/Cyberpipe.Properties.Resources.resources
+++ b/obj/x64/Debug/Cyberpipe.Properties.Resources.resources
Binary files differ
diff --git a/Cyberpipe.suo b/Cyberpipe.suo
index 9a3c1e6..b66c3fa 100644
--- a/Cyberpipe.suo
+++ b/Cyberpipe.suo
Binary files differ
diff --git a/FeatureStatisticsService.cs b/FeatureStatisticsService.cs
index 8686f85..7b5caad 100644
--- a/FeatureStatisticsService.cs
+++ b/FeatureStatisticsService.cs
@@ -6,6 +6,8 @@
using GeoScene.Globe;
using GeoScene.Engine;
+using System.Windows.Forms;
+
namespace Cyberpipe
{
class FeatureStatisticsService
@@ -18,7 +20,7 @@
///
///
- private GSOFeatures Intersect_PointLayerByType(GSOGeoPolygon3D polygon, GSOLayer layer, string type)
+ public GSOFeatures Intersect_PointLayerByType(GSOGeoPolygon3D polygon, GSOLayer layer, string type)
{
if (layer == null) return null;
@@ -43,8 +45,8 @@
return newfeats;
}
-
-
+
+
///
///
/// 根据附属物列表,统计该类附属物个数
@@ -55,7 +57,7 @@
{
if (feats == null || feats.Length == 0) return null;
Dictionary result = new Dictionary();
- result.Add(feats[0].GetFieldAsString("附属物名称"),feats.Length);
+ result.Add(feats[0].GetFieldAsString("附属物名称"), feats.Length);
return result;
}
///
@@ -73,14 +75,15 @@
FeaturesClassfyResult result = new FeaturesClassfyResult();
double totalLength = 0.0;
int ncount = 0;
- GSOFeatures features = getPipesByValueSection( polygon, layer, min, max, fieldName);
- for (int i = 0; i < features.Length;i++ ) {
+ GSOFeatures features = getPipesByValueSection(polygon, layer, min, max, fieldName);
+ for (int i = 0; i < features.Length; i++)
+ {
GSOGeoPolyline3D line = features[i].Geometry as GSOGeoPolyline3D;
double length = line.GetSpaceLength(true, 6378137);
totalLength += length;
ncount += 1;
}
- string filedValue = (min == null) ? "不限":min+"-";
+ string filedValue = (min == null) ? "不限" : min + "-";
filedValue += (max == null) ? "不限" : max + "";
result.layerName = layer.Caption;
result.groupFieldValue = filedValue;//上下限的拼接
@@ -99,20 +102,21 @@
/// 上限
/// 统计类型:"起始埋深"或"管径_毫米"
///
- 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();
GSOFeatureLayer flayer = layer as GSOFeatureLayer;
//TODOLIST:优化为只获取管线,目前不清楚调用方式
- GSOFeatures feats = ( polygon == null )? flayer.GetAllFeatures() : flayer.FindFeaturesInPolygon(polygon, false);
+ GSOFeatures feats = (polygon == null) ? flayer.GetAllFeatures() : flayer.FindFeaturesInPolygon(polygon, false);
- double minValue = min ?? Double.MinValue ;
+ double minValue = min ?? Double.MinValue;
double maxValue = max ?? Double.MaxValue;
-
+
//筛选出符合条件的
- for (int i = 0; i < feats.Length;i++ )
+ for (int i = 0; i < feats.Length; i++)
{
double radius = feats[i].GetFieldAsDouble(fieldName);
if (radius >= min && radius <= max)
@@ -121,17 +125,17 @@
}
}
-
+
return result;
-
+
}
//图层名称、管径、条数、总长度
public List groupPipeByDiameter(GSOGeoPolygon3D polygon, GSOLayer layer)
{
if (layer == null) return null;
- List result = new List() ;
-
+ List