diff --git a/Cyberpipe.csproj b/Cyberpipe.csproj
index 3a45ad8..d22f590 100644
--- a/Cyberpipe.csproj
+++ b/Cyberpipe.csproj
@@ -402,12 +402,6 @@
FrmBACKORACLE.cs
-
- Form
-
-
- FrmBSQDuoBianXingStatis.cs
-
Form
@@ -1271,9 +1265,6 @@
FrmBACKORACLE.cs
-
- FrmBSQDuoBianXingStatis.cs
-
FrmBSQStatis.cs
diff --git a/Cyberpipe.csproj b/Cyberpipe.csproj
index 3a45ad8..d22f590 100644
--- a/Cyberpipe.csproj
+++ b/Cyberpipe.csproj
@@ -402,12 +402,6 @@
FrmBACKORACLE.cs
-
- Form
-
-
- FrmBSQDuoBianXingStatis.cs
-
Form
@@ -1271,9 +1265,6 @@
FrmBACKORACLE.cs
-
- FrmBSQDuoBianXingStatis.cs
-
FrmBSQStatis.cs
diff --git a/FeatureStatisticsService.cs b/FeatureStatisticsService.cs
index e833e5f..c7de210 100644
--- a/FeatureStatisticsService.cs
+++ b/FeatureStatisticsService.cs
@@ -273,19 +273,15 @@
/// 获取特定区域图层的管线列表,并将其总长度统计出来
/// TODOLIST:将Intersects_Pipeline在MainFrm中去除
///
- ///
+ ///
+ /// 要统计的长度
///
public static GSOFeatures getLayerPipes(GSOGeoPolygon3D polygon, GSOLayer layer, out double length)
{
length = 0;
if (layer == null) return null;
- GSOFeatureLayer flayer = layer as GSOFeatureLayer;
- GSOFeatureDataset fdataset = flayer.Dataset as GSOFeatureDataset;
- GSOFeatures feats = null;
-
- feats = polygon == null?flayer.GetAllFeatures():flayer.FindFeaturesInPolygon(polygon, false);
-
+ GSOFeatures feats = getLayerFeatures(polygon, layer);
double totallength = 0.00;
for (int i = 0; i < feats.Length; i++)
{
@@ -301,5 +297,17 @@
return feats;
}
+ ///
+ /// 获取区域图层内的feature列表,MainFrm.PolygonIntersectAnalysis和此方法重复,需要整理删除
+ ///
+ ///
+ ///
+ ///
+ public static GSOFeatures getLayerFeatures(GSOGeoPolygon3D polygon, GSOLayer layer)
+ {
+ if (layer == null) return null;
+ GSOFeatureLayer flayer = layer as GSOFeatureLayer;
+ return polygon == null ? flayer.GetAllFeatures() : flayer.FindFeaturesInPolygon(polygon, false);
+ }
}
}
diff --git a/Cyberpipe.csproj b/Cyberpipe.csproj
index 3a45ad8..d22f590 100644
--- a/Cyberpipe.csproj
+++ b/Cyberpipe.csproj
@@ -402,12 +402,6 @@
FrmBACKORACLE.cs
-
- Form
-
-
- FrmBSQDuoBianXingStatis.cs
-
Form
@@ -1271,9 +1265,6 @@
FrmBACKORACLE.cs
-
- FrmBSQDuoBianXingStatis.cs
-
FrmBSQStatis.cs
diff --git a/FeatureStatisticsService.cs b/FeatureStatisticsService.cs
index e833e5f..c7de210 100644
--- a/FeatureStatisticsService.cs
+++ b/FeatureStatisticsService.cs
@@ -273,19 +273,15 @@
/// 获取特定区域图层的管线列表,并将其总长度统计出来
/// TODOLIST:将Intersects_Pipeline在MainFrm中去除
///
- ///
+ ///
+ /// 要统计的长度
///
public static GSOFeatures getLayerPipes(GSOGeoPolygon3D polygon, GSOLayer layer, out double length)
{
length = 0;
if (layer == null) return null;
- GSOFeatureLayer flayer = layer as GSOFeatureLayer;
- GSOFeatureDataset fdataset = flayer.Dataset as GSOFeatureDataset;
- GSOFeatures feats = null;
-
- feats = polygon == null?flayer.GetAllFeatures():flayer.FindFeaturesInPolygon(polygon, false);
-
+ GSOFeatures feats = getLayerFeatures(polygon, layer);
double totallength = 0.00;
for (int i = 0; i < feats.Length; i++)
{
@@ -301,5 +297,17 @@
return feats;
}
+ ///
+ /// 获取区域图层内的feature列表,MainFrm.PolygonIntersectAnalysis和此方法重复,需要整理删除
+ ///
+ ///
+ ///
+ ///
+ public static GSOFeatures getLayerFeatures(GSOGeoPolygon3D polygon, GSOLayer layer)
+ {
+ if (layer == null) return null;
+ GSOFeatureLayer flayer = layer as GSOFeatureLayer;
+ return polygon == null ? flayer.GetAllFeatures() : flayer.FindFeaturesInPolygon(polygon, false);
+ }
}
}
diff --git a/FrmAllWorkWellStatis.cs b/FrmAllWorkWellStatis.cs
index 7bf65dc..bd0f81b 100644
--- a/FrmAllWorkWellStatis.cs
+++ b/FrmAllWorkWellStatis.cs
@@ -19,17 +19,7 @@
private Dictionary map = null;
private GSOGlobeControl globeControl1;
private GSOGeoPolygon3D polygon;
- //TODOLIST:用晓伟的代理进行操作,功能拆分细化
- //public FrmAllWorkWellStatis(GSOGeoPolygon3D polygon, DataGridView dataGridViewX11, ToolStripStatusLabel toolStripNumbers1, GSOGlobeControl ctl, PanelEx p)
- //{
- // InitializeComponent();
- // panel = p;
- // dataGridViewX1 = dataGridViewX11;
- // toolStripNumbers = toolStripNumbers1;
- // globeControl1 = ctl;
- // map = getAccsMap(polygon);
- //}
public FrmAllWorkWellStatis(GSOGlobeControl ctl,GSOGeoPolygon3D polygon, MainFrm.DataGridViewDelegate InitDataGridViewX1)
{
InitializeComponent();
@@ -117,8 +107,9 @@
sql = "select " + getpipeLineFields.getFields(layername, globeControl1) + " from " + layer.Name;
sql += " where 1>2 ";
- for (int i = 0; i < fs.Length && fs[i].GetFieldDefn("编号") != null; i++)
+ for (int i = 0; i < fs.Length; i++)
{
+ if (fs[i].GetFieldDefn("编号") == null) continue;
sql += " or 编号 = '" + fs[i].GetValue("编号").ToString() + "'";
}
diff --git a/Cyberpipe.csproj b/Cyberpipe.csproj
index 3a45ad8..d22f590 100644
--- a/Cyberpipe.csproj
+++ b/Cyberpipe.csproj
@@ -402,12 +402,6 @@
FrmBACKORACLE.cs
-
- Form
-
-
- FrmBSQDuoBianXingStatis.cs
-
Form
@@ -1271,9 +1265,6 @@
FrmBACKORACLE.cs
-
- FrmBSQDuoBianXingStatis.cs
-
FrmBSQStatis.cs
diff --git a/FeatureStatisticsService.cs b/FeatureStatisticsService.cs
index e833e5f..c7de210 100644
--- a/FeatureStatisticsService.cs
+++ b/FeatureStatisticsService.cs
@@ -273,19 +273,15 @@
/// 获取特定区域图层的管线列表,并将其总长度统计出来
/// TODOLIST:将Intersects_Pipeline在MainFrm中去除
///
- ///
+ ///
+ /// 要统计的长度
///
public static GSOFeatures getLayerPipes(GSOGeoPolygon3D polygon, GSOLayer layer, out double length)
{
length = 0;
if (layer == null) return null;
- GSOFeatureLayer flayer = layer as GSOFeatureLayer;
- GSOFeatureDataset fdataset = flayer.Dataset as GSOFeatureDataset;
- GSOFeatures feats = null;
-
- feats = polygon == null?flayer.GetAllFeatures():flayer.FindFeaturesInPolygon(polygon, false);
-
+ GSOFeatures feats = getLayerFeatures(polygon, layer);
double totallength = 0.00;
for (int i = 0; i < feats.Length; i++)
{
@@ -301,5 +297,17 @@
return feats;
}
+ ///
+ /// 获取区域图层内的feature列表,MainFrm.PolygonIntersectAnalysis和此方法重复,需要整理删除
+ ///
+ ///
+ ///
+ ///
+ public static GSOFeatures getLayerFeatures(GSOGeoPolygon3D polygon, GSOLayer layer)
+ {
+ if (layer == null) return null;
+ GSOFeatureLayer flayer = layer as GSOFeatureLayer;
+ return polygon == null ? flayer.GetAllFeatures() : flayer.FindFeaturesInPolygon(polygon, false);
+ }
}
}
diff --git a/FrmAllWorkWellStatis.cs b/FrmAllWorkWellStatis.cs
index 7bf65dc..bd0f81b 100644
--- a/FrmAllWorkWellStatis.cs
+++ b/FrmAllWorkWellStatis.cs
@@ -19,17 +19,7 @@
private Dictionary map = null;
private GSOGlobeControl globeControl1;
private GSOGeoPolygon3D polygon;
- //TODOLIST:用晓伟的代理进行操作,功能拆分细化
- //public FrmAllWorkWellStatis(GSOGeoPolygon3D polygon, DataGridView dataGridViewX11, ToolStripStatusLabel toolStripNumbers1, GSOGlobeControl ctl, PanelEx p)
- //{
- // InitializeComponent();
- // panel = p;
- // dataGridViewX1 = dataGridViewX11;
- // toolStripNumbers = toolStripNumbers1;
- // globeControl1 = ctl;
- // map = getAccsMap(polygon);
- //}
public FrmAllWorkWellStatis(GSOGlobeControl ctl,GSOGeoPolygon3D polygon, MainFrm.DataGridViewDelegate InitDataGridViewX1)
{
InitializeComponent();
@@ -117,8 +107,9 @@
sql = "select " + getpipeLineFields.getFields(layername, globeControl1) + " from " + layer.Name;
sql += " where 1>2 ";
- for (int i = 0; i < fs.Length && fs[i].GetFieldDefn("编号") != null; i++)
+ for (int i = 0; i < fs.Length; i++)
{
+ if (fs[i].GetFieldDefn("编号") == null) continue;
sql += " or 编号 = '" + fs[i].GetValue("编号").ToString() + "'";
}
diff --git a/FrmBSQDuoBianXingStatis.Designer.cs b/FrmBSQDuoBianXingStatis.Designer.cs
deleted file mode 100644
index bda6842..0000000
--- a/FrmBSQDuoBianXingStatis.Designer.cs
+++ /dev/null
@@ -1,87 +0,0 @@
-namespace Cyberpipe
-{
- partial class FrmBSQDuoBianXingStatis
- {
- ///
- /// Required designer variable.
- ///
- private System.ComponentModel.IContainer components = null;
-
- ///
- /// Clean up any resources being used.
- ///
- /// true if managed resources should be disposed; otherwise, false.
- protected override void Dispose(bool disposing)
- {
- if (disposing && (components != null))
- {
- components.Dispose();
- }
- base.Dispose(disposing);
- }
-
- #region Windows Form Designer generated code
-
- ///
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- ///
- private void InitializeComponent()
- {
- System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea1 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
- this.groupBox1 = new System.Windows.Forms.GroupBox();
- this.chart1 = new System.Windows.Forms.DataVisualization.Charting.Chart();
- this.groupBox1.SuspendLayout();
- ((System.ComponentModel.ISupportInitialize)(this.chart1)).BeginInit();
- this.SuspendLayout();
- //
- // groupBox1
- //
- this.groupBox1.Controls.Add(this.chart1);
- this.groupBox1.Dock = System.Windows.Forms.DockStyle.Fill;
- this.groupBox1.Location = new System.Drawing.Point(0, 0);
- this.groupBox1.Name = "groupBox1";
- this.groupBox1.Size = new System.Drawing.Size(592, 384);
- this.groupBox1.TabIndex = 0;
- this.groupBox1.TabStop = false;
- this.groupBox1.Text = "统计结果信息";
- //
- // chart1
- //
- chartArea1.AxisX.MajorGrid.Enabled = false;
- chartArea1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(191)))), ((int)(((byte)(219)))), ((int)(((byte)(255)))));
- chartArea1.BackGradientStyle = System.Windows.Forms.DataVisualization.Charting.GradientStyle.TopBottom;
- chartArea1.Name = "ChartArea1";
- this.chart1.ChartAreas.Add(chartArea1);
- this.chart1.Dock = System.Windows.Forms.DockStyle.Fill;
- this.chart1.Location = new System.Drawing.Point(3, 17);
- this.chart1.Name = "chart1";
- this.chart1.Size = new System.Drawing.Size(586, 364);
- this.chart1.TabIndex = 0;
- this.chart1.Text = "chart1";
- //
- // FrmBSQDuoBianXingStatis
- //
- this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.ClientSize = new System.Drawing.Size(592, 384);
- this.Controls.Add(this.groupBox1);
- this.DoubleBuffered = true;
- this.Name = "FrmBSQDuoBianXingStatis";
- this.ShowIcon = false;
- this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
- this.Text = "多边形区域统计";
- this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FrmBSQDuoBianXingStatis_FormClosing);
- this.Load += new System.EventHandler(this.FrmBSQDuoBianXingStatis_Load);
- this.groupBox1.ResumeLayout(false);
- ((System.ComponentModel.ISupportInitialize)(this.chart1)).EndInit();
- this.ResumeLayout(false);
-
- }
-
- #endregion
-
- private System.Windows.Forms.GroupBox groupBox1;
- private System.Windows.Forms.DataVisualization.Charting.Chart chart1;
- }
-}
\ No newline at end of file
diff --git a/Cyberpipe.csproj b/Cyberpipe.csproj
index 3a45ad8..d22f590 100644
--- a/Cyberpipe.csproj
+++ b/Cyberpipe.csproj
@@ -402,12 +402,6 @@
FrmBACKORACLE.cs
-
- Form
-
-
- FrmBSQDuoBianXingStatis.cs
-
Form
@@ -1271,9 +1265,6 @@
FrmBACKORACLE.cs
-
- FrmBSQDuoBianXingStatis.cs
-
FrmBSQStatis.cs
diff --git a/FeatureStatisticsService.cs b/FeatureStatisticsService.cs
index e833e5f..c7de210 100644
--- a/FeatureStatisticsService.cs
+++ b/FeatureStatisticsService.cs
@@ -273,19 +273,15 @@
/// 获取特定区域图层的管线列表,并将其总长度统计出来
/// TODOLIST:将Intersects_Pipeline在MainFrm中去除
///
- ///
+ ///
+ /// 要统计的长度
///
public static GSOFeatures getLayerPipes(GSOGeoPolygon3D polygon, GSOLayer layer, out double length)
{
length = 0;
if (layer == null) return null;
- GSOFeatureLayer flayer = layer as GSOFeatureLayer;
- GSOFeatureDataset fdataset = flayer.Dataset as GSOFeatureDataset;
- GSOFeatures feats = null;
-
- feats = polygon == null?flayer.GetAllFeatures():flayer.FindFeaturesInPolygon(polygon, false);
-
+ GSOFeatures feats = getLayerFeatures(polygon, layer);
double totallength = 0.00;
for (int i = 0; i < feats.Length; i++)
{
@@ -301,5 +297,17 @@
return feats;
}
+ ///
+ /// 获取区域图层内的feature列表,MainFrm.PolygonIntersectAnalysis和此方法重复,需要整理删除
+ ///
+ ///
+ ///
+ ///
+ public static GSOFeatures getLayerFeatures(GSOGeoPolygon3D polygon, GSOLayer layer)
+ {
+ if (layer == null) return null;
+ GSOFeatureLayer flayer = layer as GSOFeatureLayer;
+ return polygon == null ? flayer.GetAllFeatures() : flayer.FindFeaturesInPolygon(polygon, false);
+ }
}
}
diff --git a/FrmAllWorkWellStatis.cs b/FrmAllWorkWellStatis.cs
index 7bf65dc..bd0f81b 100644
--- a/FrmAllWorkWellStatis.cs
+++ b/FrmAllWorkWellStatis.cs
@@ -19,17 +19,7 @@
private Dictionary map = null;
private GSOGlobeControl globeControl1;
private GSOGeoPolygon3D polygon;
- //TODOLIST:用晓伟的代理进行操作,功能拆分细化
- //public FrmAllWorkWellStatis(GSOGeoPolygon3D polygon, DataGridView dataGridViewX11, ToolStripStatusLabel toolStripNumbers1, GSOGlobeControl ctl, PanelEx p)
- //{
- // InitializeComponent();
- // panel = p;
- // dataGridViewX1 = dataGridViewX11;
- // toolStripNumbers = toolStripNumbers1;
- // globeControl1 = ctl;
- // map = getAccsMap(polygon);
- //}
public FrmAllWorkWellStatis(GSOGlobeControl ctl,GSOGeoPolygon3D polygon, MainFrm.DataGridViewDelegate InitDataGridViewX1)
{
InitializeComponent();
@@ -117,8 +107,9 @@
sql = "select " + getpipeLineFields.getFields(layername, globeControl1) + " from " + layer.Name;
sql += " where 1>2 ";
- for (int i = 0; i < fs.Length && fs[i].GetFieldDefn("编号") != null; i++)
+ for (int i = 0; i < fs.Length; i++)
{
+ if (fs[i].GetFieldDefn("编号") == null) continue;
sql += " or 编号 = '" + fs[i].GetValue("编号").ToString() + "'";
}
diff --git a/FrmBSQDuoBianXingStatis.Designer.cs b/FrmBSQDuoBianXingStatis.Designer.cs
deleted file mode 100644
index bda6842..0000000
--- a/FrmBSQDuoBianXingStatis.Designer.cs
+++ /dev/null
@@ -1,87 +0,0 @@
-namespace Cyberpipe
-{
- partial class FrmBSQDuoBianXingStatis
- {
- ///
- /// Required designer variable.
- ///
- private System.ComponentModel.IContainer components = null;
-
- ///
- /// Clean up any resources being used.
- ///
- /// true if managed resources should be disposed; otherwise, false.
- protected override void Dispose(bool disposing)
- {
- if (disposing && (components != null))
- {
- components.Dispose();
- }
- base.Dispose(disposing);
- }
-
- #region Windows Form Designer generated code
-
- ///
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- ///
- private void InitializeComponent()
- {
- System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea1 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
- this.groupBox1 = new System.Windows.Forms.GroupBox();
- this.chart1 = new System.Windows.Forms.DataVisualization.Charting.Chart();
- this.groupBox1.SuspendLayout();
- ((System.ComponentModel.ISupportInitialize)(this.chart1)).BeginInit();
- this.SuspendLayout();
- //
- // groupBox1
- //
- this.groupBox1.Controls.Add(this.chart1);
- this.groupBox1.Dock = System.Windows.Forms.DockStyle.Fill;
- this.groupBox1.Location = new System.Drawing.Point(0, 0);
- this.groupBox1.Name = "groupBox1";
- this.groupBox1.Size = new System.Drawing.Size(592, 384);
- this.groupBox1.TabIndex = 0;
- this.groupBox1.TabStop = false;
- this.groupBox1.Text = "统计结果信息";
- //
- // chart1
- //
- chartArea1.AxisX.MajorGrid.Enabled = false;
- chartArea1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(191)))), ((int)(((byte)(219)))), ((int)(((byte)(255)))));
- chartArea1.BackGradientStyle = System.Windows.Forms.DataVisualization.Charting.GradientStyle.TopBottom;
- chartArea1.Name = "ChartArea1";
- this.chart1.ChartAreas.Add(chartArea1);
- this.chart1.Dock = System.Windows.Forms.DockStyle.Fill;
- this.chart1.Location = new System.Drawing.Point(3, 17);
- this.chart1.Name = "chart1";
- this.chart1.Size = new System.Drawing.Size(586, 364);
- this.chart1.TabIndex = 0;
- this.chart1.Text = "chart1";
- //
- // FrmBSQDuoBianXingStatis
- //
- this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.ClientSize = new System.Drawing.Size(592, 384);
- this.Controls.Add(this.groupBox1);
- this.DoubleBuffered = true;
- this.Name = "FrmBSQDuoBianXingStatis";
- this.ShowIcon = false;
- this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
- this.Text = "多边形区域统计";
- this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FrmBSQDuoBianXingStatis_FormClosing);
- this.Load += new System.EventHandler(this.FrmBSQDuoBianXingStatis_Load);
- this.groupBox1.ResumeLayout(false);
- ((System.ComponentModel.ISupportInitialize)(this.chart1)).EndInit();
- this.ResumeLayout(false);
-
- }
-
- #endregion
-
- private System.Windows.Forms.GroupBox groupBox1;
- private System.Windows.Forms.DataVisualization.Charting.Chart chart1;
- }
-}
\ No newline at end of file
diff --git a/FrmBSQDuoBianXingStatis.cs b/FrmBSQDuoBianXingStatis.cs
deleted file mode 100644
index 80b567e..0000000
--- a/FrmBSQDuoBianXingStatis.cs
+++ /dev/null
@@ -1,179 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Data;
-using System.Drawing;
-using System.Linq;
-using System.Text;
-using System.Windows.Forms;
-using DevComponents.DotNetBar;
-using System.Data.SqlClient;
-using System.Windows.Forms.DataVisualization.Charting;
-using GeoScene.Data;
-using GeoScene.Engine;
-using GeoScene.Globe;
-using System.Data.OracleClient;
-
-namespace Cyberpipe
-{
- public partial class FrmBSQDuoBianXingStatis : Office2007Form
- {
- Dictionary bsq = new Dictionary();
- Dictionary bsq1 = new Dictionary();
- static FrmBSQDuoBianXingStatis frm;
- GSOGlobeControl globeControl1;
- List list = new List();
- public static List pipeLists = new List();
-
- string[] codeStr = new string[50];
- string[] nameStr = new string[30];
- public static List typeLists;
-
- public FrmBSQDuoBianXingStatis(Dictionary workWellLen, GSOGlobeControl glb,List _list)
- {
- InitializeComponent();
- bsq = workWellLen;
- globeControl1 = glb;
- list = _list;
- }
-
- private void FrmBSQDuoBianXingStatis_Load(object sender, EventArgs e)
- {
- FrmBSQDuoBianXingStatisFenLei();
- try
- {
- chart1.Series.Add("标识器");
- chart1.ChartAreas["ChartArea1"].AxisX.Title = "标识器类型";
- chart1.ChartAreas["ChartArea1"].AxisY.Title = "标识器数量";
- chart1.ChartAreas["ChartArea1"].AxisX.Interval = 1;
- chart1.Series["标识器"].ChartType = SeriesChartType.Column;
- chart1.Series["标识器"]["DrawingStyle"] = "Cylinder";
-
- chart1.Series["标识器"].Points.DataBindXY(bsq1.Keys, bsq1.Values);
- if (bsq1.Values.Count == 0)
- {
- MessageBox.Show("该区域没有标识器信息", "提示");
- this.Close();
- return;
- }
- else
- {
- for (int m = 0; m < bsq1.Values.Count; m++)
- {
- if (chart1.Series["标识器"].Points[m].YValues[0].ToString() != "0")
- {
- chart1.Series["标识器"].Points[m].Label = chart1.Series[0].Points[m].YValues[0].ToString();
- }
- }
- }
- }
- catch (Exception ex)
- {
- //ErrorLog.PublishError(ex);
- }
- }
-
- private void FrmBSQDuoBianXingStatis_FormClosing(object sender, FormClosingEventArgs e)
- {
- frm = null;
- globeControl1.Globe.ClearAnalysis();
- globeControl1.Globe.MemoryLayer.RemoveAllFeature();
- }
-
-
- private void FrmBSQDuoBianXingStatisFenLei()
- {
- try
- {
- bool flag2 = false;
- for (int i = 0; i < Utility.listPipelineType.Count; i++)
- {
-
- for (int j = 0; j < pipeLists.Count; j++)
- {
- if (pipeLists[j] == Utility.listPipelineType[i].type)
- {
- flag2 = true;
- break;
- }
- }
- if (!flag2 && Utility.listPipelineType[i].type != "标识器")
- {
- pipeLists.Add(Utility.listPipelineType[i].type);
- }
- flag2 = false;
- }
-
- typeLists = new List();
- for (int num = 0; num < pipeLists.Count; num++)
- {
- typeList ls = new typeList(0, pipeLists[num]);
- typeLists.Add(ls);
- }
-
- GSOFeatures fs = list[0];
- string pipetype = "标识器";
- foreach (string key in bsq.Keys)
- {
- if (key.StartsWith(pipetype))
- {
- pipetype = key;
- break;
- }
- }
- if (fs.Length > 0)
- {
- for (int i = 0; i < fs.Length; i++)
- {
- string str = fs[i].GetValue("对象名称").ToString();
- codeStr = str.Split(',');
- for (int n = 0; n < codeStr.Length; n++)
- {
- for (int ii = 0; ii < Utility.listPipelineType.Count; ii++)
- {
- if (Utility.listPipelineType[ii].code == codeStr[n])
- {
- for (int m = 0; m < typeLists.Count; m++)
- {
- if (Utility.listPipelineType[ii].type == typeLists[m].type)
- {
- typeLists[m].num++;
- break;
- }
- }
- break;
- }
- }
- }
- }
- }
-
- for (int i = 0; i < typeLists.Count; i++)
- {
- if (typeLists[i].num > 0)
- bsq1.Add(typeLists[i].type, typeLists[i].num);
- }
-
- }
- catch (Exception ex)
- {
- //ErrorLog.PublishError(ex);
- //MessageBox.Show(ex.Message);
- }
-
- }
- public class typeList
- {
- public int num;
- public string type;
-
- public typeList(int _num, string _type)
- {
- num = _num;
- type = _type;
- }
- }
-
-
- }
-}
diff --git a/Cyberpipe.csproj b/Cyberpipe.csproj
index 3a45ad8..d22f590 100644
--- a/Cyberpipe.csproj
+++ b/Cyberpipe.csproj
@@ -402,12 +402,6 @@
FrmBACKORACLE.cs
-
- Form
-
-
- FrmBSQDuoBianXingStatis.cs
-
Form
@@ -1271,9 +1265,6 @@
FrmBACKORACLE.cs
-
- FrmBSQDuoBianXingStatis.cs
-
FrmBSQStatis.cs
diff --git a/FeatureStatisticsService.cs b/FeatureStatisticsService.cs
index e833e5f..c7de210 100644
--- a/FeatureStatisticsService.cs
+++ b/FeatureStatisticsService.cs
@@ -273,19 +273,15 @@
/// 获取特定区域图层的管线列表,并将其总长度统计出来
/// TODOLIST:将Intersects_Pipeline在MainFrm中去除
///
- ///
+ ///
+ /// 要统计的长度
///
public static GSOFeatures getLayerPipes(GSOGeoPolygon3D polygon, GSOLayer layer, out double length)
{
length = 0;
if (layer == null) return null;
- GSOFeatureLayer flayer = layer as GSOFeatureLayer;
- GSOFeatureDataset fdataset = flayer.Dataset as GSOFeatureDataset;
- GSOFeatures feats = null;
-
- feats = polygon == null?flayer.GetAllFeatures():flayer.FindFeaturesInPolygon(polygon, false);
-
+ GSOFeatures feats = getLayerFeatures(polygon, layer);
double totallength = 0.00;
for (int i = 0; i < feats.Length; i++)
{
@@ -301,5 +297,17 @@
return feats;
}
+ ///
+ /// 获取区域图层内的feature列表,MainFrm.PolygonIntersectAnalysis和此方法重复,需要整理删除
+ ///
+ ///
+ ///
+ ///
+ public static GSOFeatures getLayerFeatures(GSOGeoPolygon3D polygon, GSOLayer layer)
+ {
+ if (layer == null) return null;
+ GSOFeatureLayer flayer = layer as GSOFeatureLayer;
+ return polygon == null ? flayer.GetAllFeatures() : flayer.FindFeaturesInPolygon(polygon, false);
+ }
}
}
diff --git a/FrmAllWorkWellStatis.cs b/FrmAllWorkWellStatis.cs
index 7bf65dc..bd0f81b 100644
--- a/FrmAllWorkWellStatis.cs
+++ b/FrmAllWorkWellStatis.cs
@@ -19,17 +19,7 @@
private Dictionary map = null;
private GSOGlobeControl globeControl1;
private GSOGeoPolygon3D polygon;
- //TODOLIST:用晓伟的代理进行操作,功能拆分细化
- //public FrmAllWorkWellStatis(GSOGeoPolygon3D polygon, DataGridView dataGridViewX11, ToolStripStatusLabel toolStripNumbers1, GSOGlobeControl ctl, PanelEx p)
- //{
- // InitializeComponent();
- // panel = p;
- // dataGridViewX1 = dataGridViewX11;
- // toolStripNumbers = toolStripNumbers1;
- // globeControl1 = ctl;
- // map = getAccsMap(polygon);
- //}
public FrmAllWorkWellStatis(GSOGlobeControl ctl,GSOGeoPolygon3D polygon, MainFrm.DataGridViewDelegate InitDataGridViewX1)
{
InitializeComponent();
@@ -117,8 +107,9 @@
sql = "select " + getpipeLineFields.getFields(layername, globeControl1) + " from " + layer.Name;
sql += " where 1>2 ";
- for (int i = 0; i < fs.Length && fs[i].GetFieldDefn("编号") != null; i++)
+ for (int i = 0; i < fs.Length; i++)
{
+ if (fs[i].GetFieldDefn("编号") == null) continue;
sql += " or 编号 = '" + fs[i].GetValue("编号").ToString() + "'";
}
diff --git a/FrmBSQDuoBianXingStatis.Designer.cs b/FrmBSQDuoBianXingStatis.Designer.cs
deleted file mode 100644
index bda6842..0000000
--- a/FrmBSQDuoBianXingStatis.Designer.cs
+++ /dev/null
@@ -1,87 +0,0 @@
-namespace Cyberpipe
-{
- partial class FrmBSQDuoBianXingStatis
- {
- ///
- /// Required designer variable.
- ///
- private System.ComponentModel.IContainer components = null;
-
- ///
- /// Clean up any resources being used.
- ///
- /// true if managed resources should be disposed; otherwise, false.
- protected override void Dispose(bool disposing)
- {
- if (disposing && (components != null))
- {
- components.Dispose();
- }
- base.Dispose(disposing);
- }
-
- #region Windows Form Designer generated code
-
- ///
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- ///
- private void InitializeComponent()
- {
- System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea1 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
- this.groupBox1 = new System.Windows.Forms.GroupBox();
- this.chart1 = new System.Windows.Forms.DataVisualization.Charting.Chart();
- this.groupBox1.SuspendLayout();
- ((System.ComponentModel.ISupportInitialize)(this.chart1)).BeginInit();
- this.SuspendLayout();
- //
- // groupBox1
- //
- this.groupBox1.Controls.Add(this.chart1);
- this.groupBox1.Dock = System.Windows.Forms.DockStyle.Fill;
- this.groupBox1.Location = new System.Drawing.Point(0, 0);
- this.groupBox1.Name = "groupBox1";
- this.groupBox1.Size = new System.Drawing.Size(592, 384);
- this.groupBox1.TabIndex = 0;
- this.groupBox1.TabStop = false;
- this.groupBox1.Text = "统计结果信息";
- //
- // chart1
- //
- chartArea1.AxisX.MajorGrid.Enabled = false;
- chartArea1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(191)))), ((int)(((byte)(219)))), ((int)(((byte)(255)))));
- chartArea1.BackGradientStyle = System.Windows.Forms.DataVisualization.Charting.GradientStyle.TopBottom;
- chartArea1.Name = "ChartArea1";
- this.chart1.ChartAreas.Add(chartArea1);
- this.chart1.Dock = System.Windows.Forms.DockStyle.Fill;
- this.chart1.Location = new System.Drawing.Point(3, 17);
- this.chart1.Name = "chart1";
- this.chart1.Size = new System.Drawing.Size(586, 364);
- this.chart1.TabIndex = 0;
- this.chart1.Text = "chart1";
- //
- // FrmBSQDuoBianXingStatis
- //
- this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.ClientSize = new System.Drawing.Size(592, 384);
- this.Controls.Add(this.groupBox1);
- this.DoubleBuffered = true;
- this.Name = "FrmBSQDuoBianXingStatis";
- this.ShowIcon = false;
- this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
- this.Text = "多边形区域统计";
- this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FrmBSQDuoBianXingStatis_FormClosing);
- this.Load += new System.EventHandler(this.FrmBSQDuoBianXingStatis_Load);
- this.groupBox1.ResumeLayout(false);
- ((System.ComponentModel.ISupportInitialize)(this.chart1)).EndInit();
- this.ResumeLayout(false);
-
- }
-
- #endregion
-
- private System.Windows.Forms.GroupBox groupBox1;
- private System.Windows.Forms.DataVisualization.Charting.Chart chart1;
- }
-}
\ No newline at end of file
diff --git a/FrmBSQDuoBianXingStatis.cs b/FrmBSQDuoBianXingStatis.cs
deleted file mode 100644
index 80b567e..0000000
--- a/FrmBSQDuoBianXingStatis.cs
+++ /dev/null
@@ -1,179 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Data;
-using System.Drawing;
-using System.Linq;
-using System.Text;
-using System.Windows.Forms;
-using DevComponents.DotNetBar;
-using System.Data.SqlClient;
-using System.Windows.Forms.DataVisualization.Charting;
-using GeoScene.Data;
-using GeoScene.Engine;
-using GeoScene.Globe;
-using System.Data.OracleClient;
-
-namespace Cyberpipe
-{
- public partial class FrmBSQDuoBianXingStatis : Office2007Form
- {
- Dictionary bsq = new Dictionary();
- Dictionary bsq1 = new Dictionary();
- static FrmBSQDuoBianXingStatis frm;
- GSOGlobeControl globeControl1;
- List list = new List();
- public static List pipeLists = new List();
-
- string[] codeStr = new string[50];
- string[] nameStr = new string[30];
- public static List typeLists;
-
- public FrmBSQDuoBianXingStatis(Dictionary workWellLen, GSOGlobeControl glb,List _list)
- {
- InitializeComponent();
- bsq = workWellLen;
- globeControl1 = glb;
- list = _list;
- }
-
- private void FrmBSQDuoBianXingStatis_Load(object sender, EventArgs e)
- {
- FrmBSQDuoBianXingStatisFenLei();
- try
- {
- chart1.Series.Add("标识器");
- chart1.ChartAreas["ChartArea1"].AxisX.Title = "标识器类型";
- chart1.ChartAreas["ChartArea1"].AxisY.Title = "标识器数量";
- chart1.ChartAreas["ChartArea1"].AxisX.Interval = 1;
- chart1.Series["标识器"].ChartType = SeriesChartType.Column;
- chart1.Series["标识器"]["DrawingStyle"] = "Cylinder";
-
- chart1.Series["标识器"].Points.DataBindXY(bsq1.Keys, bsq1.Values);
- if (bsq1.Values.Count == 0)
- {
- MessageBox.Show("该区域没有标识器信息", "提示");
- this.Close();
- return;
- }
- else
- {
- for (int m = 0; m < bsq1.Values.Count; m++)
- {
- if (chart1.Series["标识器"].Points[m].YValues[0].ToString() != "0")
- {
- chart1.Series["标识器"].Points[m].Label = chart1.Series[0].Points[m].YValues[0].ToString();
- }
- }
- }
- }
- catch (Exception ex)
- {
- //ErrorLog.PublishError(ex);
- }
- }
-
- private void FrmBSQDuoBianXingStatis_FormClosing(object sender, FormClosingEventArgs e)
- {
- frm = null;
- globeControl1.Globe.ClearAnalysis();
- globeControl1.Globe.MemoryLayer.RemoveAllFeature();
- }
-
-
- private void FrmBSQDuoBianXingStatisFenLei()
- {
- try
- {
- bool flag2 = false;
- for (int i = 0; i < Utility.listPipelineType.Count; i++)
- {
-
- for (int j = 0; j < pipeLists.Count; j++)
- {
- if (pipeLists[j] == Utility.listPipelineType[i].type)
- {
- flag2 = true;
- break;
- }
- }
- if (!flag2 && Utility.listPipelineType[i].type != "标识器")
- {
- pipeLists.Add(Utility.listPipelineType[i].type);
- }
- flag2 = false;
- }
-
- typeLists = new List();
- for (int num = 0; num < pipeLists.Count; num++)
- {
- typeList ls = new typeList(0, pipeLists[num]);
- typeLists.Add(ls);
- }
-
- GSOFeatures fs = list[0];
- string pipetype = "标识器";
- foreach (string key in bsq.Keys)
- {
- if (key.StartsWith(pipetype))
- {
- pipetype = key;
- break;
- }
- }
- if (fs.Length > 0)
- {
- for (int i = 0; i < fs.Length; i++)
- {
- string str = fs[i].GetValue("对象名称").ToString();
- codeStr = str.Split(',');
- for (int n = 0; n < codeStr.Length; n++)
- {
- for (int ii = 0; ii < Utility.listPipelineType.Count; ii++)
- {
- if (Utility.listPipelineType[ii].code == codeStr[n])
- {
- for (int m = 0; m < typeLists.Count; m++)
- {
- if (Utility.listPipelineType[ii].type == typeLists[m].type)
- {
- typeLists[m].num++;
- break;
- }
- }
- break;
- }
- }
- }
- }
- }
-
- for (int i = 0; i < typeLists.Count; i++)
- {
- if (typeLists[i].num > 0)
- bsq1.Add(typeLists[i].type, typeLists[i].num);
- }
-
- }
- catch (Exception ex)
- {
- //ErrorLog.PublishError(ex);
- //MessageBox.Show(ex.Message);
- }
-
- }
- public class typeList
- {
- public int num;
- public string type;
-
- public typeList(int _num, string _type)
- {
- num = _num;
- type = _type;
- }
- }
-
-
- }
-}
diff --git a/FrmBSQDuoBianXingStatis.resx b/FrmBSQDuoBianXingStatis.resx
deleted file mode 100644
index 1af7de1..0000000
--- a/FrmBSQDuoBianXingStatis.resx
+++ /dev/null
@@ -1,120 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- text/microsoft-resx
-
-
- 2.0
-
-
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
\ No newline at end of file
diff --git a/Cyberpipe.csproj b/Cyberpipe.csproj
index 3a45ad8..d22f590 100644
--- a/Cyberpipe.csproj
+++ b/Cyberpipe.csproj
@@ -402,12 +402,6 @@
FrmBACKORACLE.cs
-
- Form
-
-
- FrmBSQDuoBianXingStatis.cs
-
Form
@@ -1271,9 +1265,6 @@
FrmBACKORACLE.cs
-
- FrmBSQDuoBianXingStatis.cs
-
FrmBSQStatis.cs
diff --git a/FeatureStatisticsService.cs b/FeatureStatisticsService.cs
index e833e5f..c7de210 100644
--- a/FeatureStatisticsService.cs
+++ b/FeatureStatisticsService.cs
@@ -273,19 +273,15 @@
/// 获取特定区域图层的管线列表,并将其总长度统计出来
/// TODOLIST:将Intersects_Pipeline在MainFrm中去除
///
- ///
+ ///
+ /// 要统计的长度
///
public static GSOFeatures getLayerPipes(GSOGeoPolygon3D polygon, GSOLayer layer, out double length)
{
length = 0;
if (layer == null) return null;
- GSOFeatureLayer flayer = layer as GSOFeatureLayer;
- GSOFeatureDataset fdataset = flayer.Dataset as GSOFeatureDataset;
- GSOFeatures feats = null;
-
- feats = polygon == null?flayer.GetAllFeatures():flayer.FindFeaturesInPolygon(polygon, false);
-
+ GSOFeatures feats = getLayerFeatures(polygon, layer);
double totallength = 0.00;
for (int i = 0; i < feats.Length; i++)
{
@@ -301,5 +297,17 @@
return feats;
}
+ ///
+ /// 获取区域图层内的feature列表,MainFrm.PolygonIntersectAnalysis和此方法重复,需要整理删除
+ ///
+ ///
+ ///
+ ///
+ public static GSOFeatures getLayerFeatures(GSOGeoPolygon3D polygon, GSOLayer layer)
+ {
+ if (layer == null) return null;
+ GSOFeatureLayer flayer = layer as GSOFeatureLayer;
+ return polygon == null ? flayer.GetAllFeatures() : flayer.FindFeaturesInPolygon(polygon, false);
+ }
}
}
diff --git a/FrmAllWorkWellStatis.cs b/FrmAllWorkWellStatis.cs
index 7bf65dc..bd0f81b 100644
--- a/FrmAllWorkWellStatis.cs
+++ b/FrmAllWorkWellStatis.cs
@@ -19,17 +19,7 @@
private Dictionary map = null;
private GSOGlobeControl globeControl1;
private GSOGeoPolygon3D polygon;
- //TODOLIST:用晓伟的代理进行操作,功能拆分细化
- //public FrmAllWorkWellStatis(GSOGeoPolygon3D polygon, DataGridView dataGridViewX11, ToolStripStatusLabel toolStripNumbers1, GSOGlobeControl ctl, PanelEx p)
- //{
- // InitializeComponent();
- // panel = p;
- // dataGridViewX1 = dataGridViewX11;
- // toolStripNumbers = toolStripNumbers1;
- // globeControl1 = ctl;
- // map = getAccsMap(polygon);
- //}
public FrmAllWorkWellStatis(GSOGlobeControl ctl,GSOGeoPolygon3D polygon, MainFrm.DataGridViewDelegate InitDataGridViewX1)
{
InitializeComponent();
@@ -117,8 +107,9 @@
sql = "select " + getpipeLineFields.getFields(layername, globeControl1) + " from " + layer.Name;
sql += " where 1>2 ";
- for (int i = 0; i < fs.Length && fs[i].GetFieldDefn("编号") != null; i++)
+ for (int i = 0; i < fs.Length; i++)
{
+ if (fs[i].GetFieldDefn("编号") == null) continue;
sql += " or 编号 = '" + fs[i].GetValue("编号").ToString() + "'";
}
diff --git a/FrmBSQDuoBianXingStatis.Designer.cs b/FrmBSQDuoBianXingStatis.Designer.cs
deleted file mode 100644
index bda6842..0000000
--- a/FrmBSQDuoBianXingStatis.Designer.cs
+++ /dev/null
@@ -1,87 +0,0 @@
-namespace Cyberpipe
-{
- partial class FrmBSQDuoBianXingStatis
- {
- ///
- /// Required designer variable.
- ///
- private System.ComponentModel.IContainer components = null;
-
- ///
- /// Clean up any resources being used.
- ///
- /// true if managed resources should be disposed; otherwise, false.
- protected override void Dispose(bool disposing)
- {
- if (disposing && (components != null))
- {
- components.Dispose();
- }
- base.Dispose(disposing);
- }
-
- #region Windows Form Designer generated code
-
- ///
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- ///
- private void InitializeComponent()
- {
- System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea1 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
- this.groupBox1 = new System.Windows.Forms.GroupBox();
- this.chart1 = new System.Windows.Forms.DataVisualization.Charting.Chart();
- this.groupBox1.SuspendLayout();
- ((System.ComponentModel.ISupportInitialize)(this.chart1)).BeginInit();
- this.SuspendLayout();
- //
- // groupBox1
- //
- this.groupBox1.Controls.Add(this.chart1);
- this.groupBox1.Dock = System.Windows.Forms.DockStyle.Fill;
- this.groupBox1.Location = new System.Drawing.Point(0, 0);
- this.groupBox1.Name = "groupBox1";
- this.groupBox1.Size = new System.Drawing.Size(592, 384);
- this.groupBox1.TabIndex = 0;
- this.groupBox1.TabStop = false;
- this.groupBox1.Text = "统计结果信息";
- //
- // chart1
- //
- chartArea1.AxisX.MajorGrid.Enabled = false;
- chartArea1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(191)))), ((int)(((byte)(219)))), ((int)(((byte)(255)))));
- chartArea1.BackGradientStyle = System.Windows.Forms.DataVisualization.Charting.GradientStyle.TopBottom;
- chartArea1.Name = "ChartArea1";
- this.chart1.ChartAreas.Add(chartArea1);
- this.chart1.Dock = System.Windows.Forms.DockStyle.Fill;
- this.chart1.Location = new System.Drawing.Point(3, 17);
- this.chart1.Name = "chart1";
- this.chart1.Size = new System.Drawing.Size(586, 364);
- this.chart1.TabIndex = 0;
- this.chart1.Text = "chart1";
- //
- // FrmBSQDuoBianXingStatis
- //
- this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.ClientSize = new System.Drawing.Size(592, 384);
- this.Controls.Add(this.groupBox1);
- this.DoubleBuffered = true;
- this.Name = "FrmBSQDuoBianXingStatis";
- this.ShowIcon = false;
- this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
- this.Text = "多边形区域统计";
- this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FrmBSQDuoBianXingStatis_FormClosing);
- this.Load += new System.EventHandler(this.FrmBSQDuoBianXingStatis_Load);
- this.groupBox1.ResumeLayout(false);
- ((System.ComponentModel.ISupportInitialize)(this.chart1)).EndInit();
- this.ResumeLayout(false);
-
- }
-
- #endregion
-
- private System.Windows.Forms.GroupBox groupBox1;
- private System.Windows.Forms.DataVisualization.Charting.Chart chart1;
- }
-}
\ No newline at end of file
diff --git a/FrmBSQDuoBianXingStatis.cs b/FrmBSQDuoBianXingStatis.cs
deleted file mode 100644
index 80b567e..0000000
--- a/FrmBSQDuoBianXingStatis.cs
+++ /dev/null
@@ -1,179 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Data;
-using System.Drawing;
-using System.Linq;
-using System.Text;
-using System.Windows.Forms;
-using DevComponents.DotNetBar;
-using System.Data.SqlClient;
-using System.Windows.Forms.DataVisualization.Charting;
-using GeoScene.Data;
-using GeoScene.Engine;
-using GeoScene.Globe;
-using System.Data.OracleClient;
-
-namespace Cyberpipe
-{
- public partial class FrmBSQDuoBianXingStatis : Office2007Form
- {
- Dictionary bsq = new Dictionary();
- Dictionary bsq1 = new Dictionary();
- static FrmBSQDuoBianXingStatis frm;
- GSOGlobeControl globeControl1;
- List list = new List();
- public static List pipeLists = new List();
-
- string[] codeStr = new string[50];
- string[] nameStr = new string[30];
- public static List typeLists;
-
- public FrmBSQDuoBianXingStatis(Dictionary workWellLen, GSOGlobeControl glb,List _list)
- {
- InitializeComponent();
- bsq = workWellLen;
- globeControl1 = glb;
- list = _list;
- }
-
- private void FrmBSQDuoBianXingStatis_Load(object sender, EventArgs e)
- {
- FrmBSQDuoBianXingStatisFenLei();
- try
- {
- chart1.Series.Add("标识器");
- chart1.ChartAreas["ChartArea1"].AxisX.Title = "标识器类型";
- chart1.ChartAreas["ChartArea1"].AxisY.Title = "标识器数量";
- chart1.ChartAreas["ChartArea1"].AxisX.Interval = 1;
- chart1.Series["标识器"].ChartType = SeriesChartType.Column;
- chart1.Series["标识器"]["DrawingStyle"] = "Cylinder";
-
- chart1.Series["标识器"].Points.DataBindXY(bsq1.Keys, bsq1.Values);
- if (bsq1.Values.Count == 0)
- {
- MessageBox.Show("该区域没有标识器信息", "提示");
- this.Close();
- return;
- }
- else
- {
- for (int m = 0; m < bsq1.Values.Count; m++)
- {
- if (chart1.Series["标识器"].Points[m].YValues[0].ToString() != "0")
- {
- chart1.Series["标识器"].Points[m].Label = chart1.Series[0].Points[m].YValues[0].ToString();
- }
- }
- }
- }
- catch (Exception ex)
- {
- //ErrorLog.PublishError(ex);
- }
- }
-
- private void FrmBSQDuoBianXingStatis_FormClosing(object sender, FormClosingEventArgs e)
- {
- frm = null;
- globeControl1.Globe.ClearAnalysis();
- globeControl1.Globe.MemoryLayer.RemoveAllFeature();
- }
-
-
- private void FrmBSQDuoBianXingStatisFenLei()
- {
- try
- {
- bool flag2 = false;
- for (int i = 0; i < Utility.listPipelineType.Count; i++)
- {
-
- for (int j = 0; j < pipeLists.Count; j++)
- {
- if (pipeLists[j] == Utility.listPipelineType[i].type)
- {
- flag2 = true;
- break;
- }
- }
- if (!flag2 && Utility.listPipelineType[i].type != "标识器")
- {
- pipeLists.Add(Utility.listPipelineType[i].type);
- }
- flag2 = false;
- }
-
- typeLists = new List();
- for (int num = 0; num < pipeLists.Count; num++)
- {
- typeList ls = new typeList(0, pipeLists[num]);
- typeLists.Add(ls);
- }
-
- GSOFeatures fs = list[0];
- string pipetype = "标识器";
- foreach (string key in bsq.Keys)
- {
- if (key.StartsWith(pipetype))
- {
- pipetype = key;
- break;
- }
- }
- if (fs.Length > 0)
- {
- for (int i = 0; i < fs.Length; i++)
- {
- string str = fs[i].GetValue("对象名称").ToString();
- codeStr = str.Split(',');
- for (int n = 0; n < codeStr.Length; n++)
- {
- for (int ii = 0; ii < Utility.listPipelineType.Count; ii++)
- {
- if (Utility.listPipelineType[ii].code == codeStr[n])
- {
- for (int m = 0; m < typeLists.Count; m++)
- {
- if (Utility.listPipelineType[ii].type == typeLists[m].type)
- {
- typeLists[m].num++;
- break;
- }
- }
- break;
- }
- }
- }
- }
- }
-
- for (int i = 0; i < typeLists.Count; i++)
- {
- if (typeLists[i].num > 0)
- bsq1.Add(typeLists[i].type, typeLists[i].num);
- }
-
- }
- catch (Exception ex)
- {
- //ErrorLog.PublishError(ex);
- //MessageBox.Show(ex.Message);
- }
-
- }
- public class typeList
- {
- public int num;
- public string type;
-
- public typeList(int _num, string _type)
- {
- num = _num;
- type = _type;
- }
- }
-
-
- }
-}
diff --git a/FrmBSQDuoBianXingStatis.resx b/FrmBSQDuoBianXingStatis.resx
deleted file mode 100644
index 1af7de1..0000000
--- a/FrmBSQDuoBianXingStatis.resx
+++ /dev/null
@@ -1,120 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- text/microsoft-resx
-
-
- 2.0
-
-
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
\ No newline at end of file
diff --git a/FrmBSQStatis.Designer.cs b/FrmBSQStatis.Designer.cs
index 2509c7d..ee9b1e7 100644
--- a/FrmBSQStatis.Designer.cs
+++ b/FrmBSQStatis.Designer.cs
@@ -57,6 +57,7 @@
this.ShowIcon = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "标识器全区域统计";
+ this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FrmBSQStatis_FormClosing);
this.Load += new System.EventHandler(this.FrmBSQStatis_Load);
((System.ComponentModel.ISupportInitialize)(this.chartStatis)).EndInit();
this.ResumeLayout(false);
diff --git a/Cyberpipe.csproj b/Cyberpipe.csproj
index 3a45ad8..d22f590 100644
--- a/Cyberpipe.csproj
+++ b/Cyberpipe.csproj
@@ -402,12 +402,6 @@
FrmBACKORACLE.cs
-
- Form
-
-
- FrmBSQDuoBianXingStatis.cs
-
Form
@@ -1271,9 +1265,6 @@
FrmBACKORACLE.cs
-
- FrmBSQDuoBianXingStatis.cs
-
FrmBSQStatis.cs
diff --git a/FeatureStatisticsService.cs b/FeatureStatisticsService.cs
index e833e5f..c7de210 100644
--- a/FeatureStatisticsService.cs
+++ b/FeatureStatisticsService.cs
@@ -273,19 +273,15 @@
/// 获取特定区域图层的管线列表,并将其总长度统计出来
/// TODOLIST:将Intersects_Pipeline在MainFrm中去除
///
- ///
+ ///
+ /// 要统计的长度
///
public static GSOFeatures getLayerPipes(GSOGeoPolygon3D polygon, GSOLayer layer, out double length)
{
length = 0;
if (layer == null) return null;
- GSOFeatureLayer flayer = layer as GSOFeatureLayer;
- GSOFeatureDataset fdataset = flayer.Dataset as GSOFeatureDataset;
- GSOFeatures feats = null;
-
- feats = polygon == null?flayer.GetAllFeatures():flayer.FindFeaturesInPolygon(polygon, false);
-
+ GSOFeatures feats = getLayerFeatures(polygon, layer);
double totallength = 0.00;
for (int i = 0; i < feats.Length; i++)
{
@@ -301,5 +297,17 @@
return feats;
}
+ ///
+ /// 获取区域图层内的feature列表,MainFrm.PolygonIntersectAnalysis和此方法重复,需要整理删除
+ ///
+ ///
+ ///
+ ///
+ public static GSOFeatures getLayerFeatures(GSOGeoPolygon3D polygon, GSOLayer layer)
+ {
+ if (layer == null) return null;
+ GSOFeatureLayer flayer = layer as GSOFeatureLayer;
+ return polygon == null ? flayer.GetAllFeatures() : flayer.FindFeaturesInPolygon(polygon, false);
+ }
}
}
diff --git a/FrmAllWorkWellStatis.cs b/FrmAllWorkWellStatis.cs
index 7bf65dc..bd0f81b 100644
--- a/FrmAllWorkWellStatis.cs
+++ b/FrmAllWorkWellStatis.cs
@@ -19,17 +19,7 @@
private Dictionary map = null;
private GSOGlobeControl globeControl1;
private GSOGeoPolygon3D polygon;
- //TODOLIST:用晓伟的代理进行操作,功能拆分细化
- //public FrmAllWorkWellStatis(GSOGeoPolygon3D polygon, DataGridView dataGridViewX11, ToolStripStatusLabel toolStripNumbers1, GSOGlobeControl ctl, PanelEx p)
- //{
- // InitializeComponent();
- // panel = p;
- // dataGridViewX1 = dataGridViewX11;
- // toolStripNumbers = toolStripNumbers1;
- // globeControl1 = ctl;
- // map = getAccsMap(polygon);
- //}
public FrmAllWorkWellStatis(GSOGlobeControl ctl,GSOGeoPolygon3D polygon, MainFrm.DataGridViewDelegate InitDataGridViewX1)
{
InitializeComponent();
@@ -117,8 +107,9 @@
sql = "select " + getpipeLineFields.getFields(layername, globeControl1) + " from " + layer.Name;
sql += " where 1>2 ";
- for (int i = 0; i < fs.Length && fs[i].GetFieldDefn("编号") != null; i++)
+ for (int i = 0; i < fs.Length; i++)
{
+ if (fs[i].GetFieldDefn("编号") == null) continue;
sql += " or 编号 = '" + fs[i].GetValue("编号").ToString() + "'";
}
diff --git a/FrmBSQDuoBianXingStatis.Designer.cs b/FrmBSQDuoBianXingStatis.Designer.cs
deleted file mode 100644
index bda6842..0000000
--- a/FrmBSQDuoBianXingStatis.Designer.cs
+++ /dev/null
@@ -1,87 +0,0 @@
-namespace Cyberpipe
-{
- partial class FrmBSQDuoBianXingStatis
- {
- ///
- /// Required designer variable.
- ///
- private System.ComponentModel.IContainer components = null;
-
- ///
- /// Clean up any resources being used.
- ///
- /// true if managed resources should be disposed; otherwise, false.
- protected override void Dispose(bool disposing)
- {
- if (disposing && (components != null))
- {
- components.Dispose();
- }
- base.Dispose(disposing);
- }
-
- #region Windows Form Designer generated code
-
- ///
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- ///
- private void InitializeComponent()
- {
- System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea1 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
- this.groupBox1 = new System.Windows.Forms.GroupBox();
- this.chart1 = new System.Windows.Forms.DataVisualization.Charting.Chart();
- this.groupBox1.SuspendLayout();
- ((System.ComponentModel.ISupportInitialize)(this.chart1)).BeginInit();
- this.SuspendLayout();
- //
- // groupBox1
- //
- this.groupBox1.Controls.Add(this.chart1);
- this.groupBox1.Dock = System.Windows.Forms.DockStyle.Fill;
- this.groupBox1.Location = new System.Drawing.Point(0, 0);
- this.groupBox1.Name = "groupBox1";
- this.groupBox1.Size = new System.Drawing.Size(592, 384);
- this.groupBox1.TabIndex = 0;
- this.groupBox1.TabStop = false;
- this.groupBox1.Text = "统计结果信息";
- //
- // chart1
- //
- chartArea1.AxisX.MajorGrid.Enabled = false;
- chartArea1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(191)))), ((int)(((byte)(219)))), ((int)(((byte)(255)))));
- chartArea1.BackGradientStyle = System.Windows.Forms.DataVisualization.Charting.GradientStyle.TopBottom;
- chartArea1.Name = "ChartArea1";
- this.chart1.ChartAreas.Add(chartArea1);
- this.chart1.Dock = System.Windows.Forms.DockStyle.Fill;
- this.chart1.Location = new System.Drawing.Point(3, 17);
- this.chart1.Name = "chart1";
- this.chart1.Size = new System.Drawing.Size(586, 364);
- this.chart1.TabIndex = 0;
- this.chart1.Text = "chart1";
- //
- // FrmBSQDuoBianXingStatis
- //
- this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.ClientSize = new System.Drawing.Size(592, 384);
- this.Controls.Add(this.groupBox1);
- this.DoubleBuffered = true;
- this.Name = "FrmBSQDuoBianXingStatis";
- this.ShowIcon = false;
- this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
- this.Text = "多边形区域统计";
- this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FrmBSQDuoBianXingStatis_FormClosing);
- this.Load += new System.EventHandler(this.FrmBSQDuoBianXingStatis_Load);
- this.groupBox1.ResumeLayout(false);
- ((System.ComponentModel.ISupportInitialize)(this.chart1)).EndInit();
- this.ResumeLayout(false);
-
- }
-
- #endregion
-
- private System.Windows.Forms.GroupBox groupBox1;
- private System.Windows.Forms.DataVisualization.Charting.Chart chart1;
- }
-}
\ No newline at end of file
diff --git a/FrmBSQDuoBianXingStatis.cs b/FrmBSQDuoBianXingStatis.cs
deleted file mode 100644
index 80b567e..0000000
--- a/FrmBSQDuoBianXingStatis.cs
+++ /dev/null
@@ -1,179 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Data;
-using System.Drawing;
-using System.Linq;
-using System.Text;
-using System.Windows.Forms;
-using DevComponents.DotNetBar;
-using System.Data.SqlClient;
-using System.Windows.Forms.DataVisualization.Charting;
-using GeoScene.Data;
-using GeoScene.Engine;
-using GeoScene.Globe;
-using System.Data.OracleClient;
-
-namespace Cyberpipe
-{
- public partial class FrmBSQDuoBianXingStatis : Office2007Form
- {
- Dictionary bsq = new Dictionary();
- Dictionary bsq1 = new Dictionary();
- static FrmBSQDuoBianXingStatis frm;
- GSOGlobeControl globeControl1;
- List list = new List();
- public static List pipeLists = new List();
-
- string[] codeStr = new string[50];
- string[] nameStr = new string[30];
- public static List typeLists;
-
- public FrmBSQDuoBianXingStatis(Dictionary workWellLen, GSOGlobeControl glb,List _list)
- {
- InitializeComponent();
- bsq = workWellLen;
- globeControl1 = glb;
- list = _list;
- }
-
- private void FrmBSQDuoBianXingStatis_Load(object sender, EventArgs e)
- {
- FrmBSQDuoBianXingStatisFenLei();
- try
- {
- chart1.Series.Add("标识器");
- chart1.ChartAreas["ChartArea1"].AxisX.Title = "标识器类型";
- chart1.ChartAreas["ChartArea1"].AxisY.Title = "标识器数量";
- chart1.ChartAreas["ChartArea1"].AxisX.Interval = 1;
- chart1.Series["标识器"].ChartType = SeriesChartType.Column;
- chart1.Series["标识器"]["DrawingStyle"] = "Cylinder";
-
- chart1.Series["标识器"].Points.DataBindXY(bsq1.Keys, bsq1.Values);
- if (bsq1.Values.Count == 0)
- {
- MessageBox.Show("该区域没有标识器信息", "提示");
- this.Close();
- return;
- }
- else
- {
- for (int m = 0; m < bsq1.Values.Count; m++)
- {
- if (chart1.Series["标识器"].Points[m].YValues[0].ToString() != "0")
- {
- chart1.Series["标识器"].Points[m].Label = chart1.Series[0].Points[m].YValues[0].ToString();
- }
- }
- }
- }
- catch (Exception ex)
- {
- //ErrorLog.PublishError(ex);
- }
- }
-
- private void FrmBSQDuoBianXingStatis_FormClosing(object sender, FormClosingEventArgs e)
- {
- frm = null;
- globeControl1.Globe.ClearAnalysis();
- globeControl1.Globe.MemoryLayer.RemoveAllFeature();
- }
-
-
- private void FrmBSQDuoBianXingStatisFenLei()
- {
- try
- {
- bool flag2 = false;
- for (int i = 0; i < Utility.listPipelineType.Count; i++)
- {
-
- for (int j = 0; j < pipeLists.Count; j++)
- {
- if (pipeLists[j] == Utility.listPipelineType[i].type)
- {
- flag2 = true;
- break;
- }
- }
- if (!flag2 && Utility.listPipelineType[i].type != "标识器")
- {
- pipeLists.Add(Utility.listPipelineType[i].type);
- }
- flag2 = false;
- }
-
- typeLists = new List();
- for (int num = 0; num < pipeLists.Count; num++)
- {
- typeList ls = new typeList(0, pipeLists[num]);
- typeLists.Add(ls);
- }
-
- GSOFeatures fs = list[0];
- string pipetype = "标识器";
- foreach (string key in bsq.Keys)
- {
- if (key.StartsWith(pipetype))
- {
- pipetype = key;
- break;
- }
- }
- if (fs.Length > 0)
- {
- for (int i = 0; i < fs.Length; i++)
- {
- string str = fs[i].GetValue("对象名称").ToString();
- codeStr = str.Split(',');
- for (int n = 0; n < codeStr.Length; n++)
- {
- for (int ii = 0; ii < Utility.listPipelineType.Count; ii++)
- {
- if (Utility.listPipelineType[ii].code == codeStr[n])
- {
- for (int m = 0; m < typeLists.Count; m++)
- {
- if (Utility.listPipelineType[ii].type == typeLists[m].type)
- {
- typeLists[m].num++;
- break;
- }
- }
- break;
- }
- }
- }
- }
- }
-
- for (int i = 0; i < typeLists.Count; i++)
- {
- if (typeLists[i].num > 0)
- bsq1.Add(typeLists[i].type, typeLists[i].num);
- }
-
- }
- catch (Exception ex)
- {
- //ErrorLog.PublishError(ex);
- //MessageBox.Show(ex.Message);
- }
-
- }
- public class typeList
- {
- public int num;
- public string type;
-
- public typeList(int _num, string _type)
- {
- num = _num;
- type = _type;
- }
- }
-
-
- }
-}
diff --git a/FrmBSQDuoBianXingStatis.resx b/FrmBSQDuoBianXingStatis.resx
deleted file mode 100644
index 1af7de1..0000000
--- a/FrmBSQDuoBianXingStatis.resx
+++ /dev/null
@@ -1,120 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- text/microsoft-resx
-
-
- 2.0
-
-
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
\ No newline at end of file
diff --git a/FrmBSQStatis.Designer.cs b/FrmBSQStatis.Designer.cs
index 2509c7d..ee9b1e7 100644
--- a/FrmBSQStatis.Designer.cs
+++ b/FrmBSQStatis.Designer.cs
@@ -57,6 +57,7 @@
this.ShowIcon = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "标识器全区域统计";
+ this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FrmBSQStatis_FormClosing);
this.Load += new System.EventHandler(this.FrmBSQStatis_Load);
((System.ComponentModel.ISupportInitialize)(this.chartStatis)).EndInit();
this.ResumeLayout(false);
diff --git a/FrmBSQStatis.cs b/FrmBSQStatis.cs
index 4b25eda..e7c4926 100644
--- a/FrmBSQStatis.cs
+++ b/FrmBSQStatis.cs
@@ -18,94 +18,18 @@
{
public partial class FrmBSQStatis : Office2007Form
{
- public Dictionary bsq = new Dictionary();
- //SqlConnection conn;
- public static List typeLists;
- OracleConnection conn;
- string connectString;
+ private Dictionary bsq = new Dictionary();
+ private GSOGlobeControl globeControl1;
+ private GSOGeoPolygon3D polygon;
- public FrmBSQStatis()
+ public FrmBSQStatis(GSOGlobeControl globeControl1,GSOGeoPolygon3D polygon)
{
+ this.globeControl1 = globeControl1;
+ this.polygon = polygon;
InitializeComponent();
- BSQNumStatis();
+ bsq = getBSQNameAndNumMap(polygon);
}
- string[] codeStr = new string[50];
- string[] nameStr = new string[30];
- public static List pipeLists = new List();
-
- private void BSQNumStatis()
- {
- bool flag2 = false;
- for (int i = 0; i < Utility.listPipelineType.Count; i++)
- {
- for (int j = 0; j < pipeLists.Count; j++)
- {
- if (pipeLists[j] == Utility.listPipelineType[i].type)
- {
- flag2 = true;
- break;
- }
- }
- if (!flag2 && Utility.listPipelineType[i].type != "标识器")
- {
- pipeLists.Add(Utility.listPipelineType[i].type);
- }
- flag2 = false;
- }
-
- typeLists = new List();
- for (int num = 0; num 0)
- bsq.Add(typeLists[i].type, typeLists[i].num);
- }
-
- }
- catch (Exception ex)
- {
-
- }
- }
private void FrmBSQStatis_Load(object sender, EventArgs e)
{
@@ -136,17 +60,88 @@
}
}
- public class typeList
+ private Dictionary getBSQNameAndNumMap(GSOGeoPolygon3D polygon)
{
- public int num;
- public string type;
- public typeList(int _num, string _type)
+ Dictionary result = new Dictionary();
+ Dictionary codeAndType = new Dictionary();
+ //得到type的种类
+ for (int i = 0; i < Utility.listPipelineType.Count; i++)
{
- num = _num;
- type = _type;
+ if (!result.ContainsKey(Utility.listPipelineType[i].type) && Utility.listPipelineType[i].type != "标识器")
+ {
+ result.Add(Utility.listPipelineType[i].type, 0);
+ codeAndType.Add(Utility.listPipelineType[i].code, Utility.listPipelineType[i].type);
+ }
+
}
+
+ return polygon == null ? getAllAreaMap(result, codeAndType) : getBSQMapByPolygon(polygon, result, codeAndType);
+
}
+ public Dictionary getAllAreaMap(Dictionary typeAndCount,Dictionary codeAndType)
+ {
+ try
+ {
+ OracleConnection conn = OledbHelper.sqlConnection();
+ conn.Open();
+ OracleCommand cmd;
+ cmd = new OracleCommand("select 对象类型 from 标识器", conn);
+ OracleDataReader dr = cmd.ExecuteReader();
+
+ while (dr.Read())
+ {
+ string str = Convert.ToString(dr["对象类型"]);
+ if (str == null) continue;
+ foreach (string key in codeAndType.Keys)
+ {
+ if (str.Contains(key))
+ {
+ typeAndCount[codeAndType[key]] += 1;
+ }
+ }
+ }
+ conn.Close();
+ }
+ catch (Exception ex)
+ {
+ LogHelper.WriteLog(typeof(FrmBSQStatis),ex.Message.ToString());
+ }
+ return typeAndCount;
+ }
+
+
+ public Dictionary getBSQMapByPolygon(GSOGeoPolygon3D polygon,Dictionary typeAndCount, Dictionary codeAndType)
+ {
+ GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption("标识器");
+ GSOFeatures bsqFs = FeatureStatisticsService.getLayerFeatures(polygon, layer);
+ if (bsqFs == null || bsqFs.Length <= 0) {
+ LogHelper.WriteLog(typeof(FrmBSQStatis),"标识器图层下的Feature为空");
+ return null;
+ }
+
+ for (int i = 0; i < bsqFs.Length; i++)
+ {
+ string str = bsqFs[i].GetValue("对象类型").ToString();
+
+ foreach (string key in codeAndType.Keys)
+ {
+ if (str.Contains(key))
+ {
+ typeAndCount[codeAndType[key]] += 1;
+ }
+ }
+ }
+
+ return typeAndCount;
+ }
+
+ private void FrmBSQStatis_FormClosing(object sender, FormClosingEventArgs e)
+ {
+ globeControl1.Globe.ClearAnalysis();
+ }
+
+
}
}
diff --git a/Cyberpipe.csproj b/Cyberpipe.csproj
index 3a45ad8..d22f590 100644
--- a/Cyberpipe.csproj
+++ b/Cyberpipe.csproj
@@ -402,12 +402,6 @@
FrmBACKORACLE.cs
-
- Form
-
-
- FrmBSQDuoBianXingStatis.cs
-
Form
@@ -1271,9 +1265,6 @@
FrmBACKORACLE.cs
-
- FrmBSQDuoBianXingStatis.cs
-
FrmBSQStatis.cs
diff --git a/FeatureStatisticsService.cs b/FeatureStatisticsService.cs
index e833e5f..c7de210 100644
--- a/FeatureStatisticsService.cs
+++ b/FeatureStatisticsService.cs
@@ -273,19 +273,15 @@
/// 获取特定区域图层的管线列表,并将其总长度统计出来
/// TODOLIST:将Intersects_Pipeline在MainFrm中去除
///
- ///
+ ///
+ /// 要统计的长度
///
public static GSOFeatures getLayerPipes(GSOGeoPolygon3D polygon, GSOLayer layer, out double length)
{
length = 0;
if (layer == null) return null;
- GSOFeatureLayer flayer = layer as GSOFeatureLayer;
- GSOFeatureDataset fdataset = flayer.Dataset as GSOFeatureDataset;
- GSOFeatures feats = null;
-
- feats = polygon == null?flayer.GetAllFeatures():flayer.FindFeaturesInPolygon(polygon, false);
-
+ GSOFeatures feats = getLayerFeatures(polygon, layer);
double totallength = 0.00;
for (int i = 0; i < feats.Length; i++)
{
@@ -301,5 +297,17 @@
return feats;
}
+ ///
+ /// 获取区域图层内的feature列表,MainFrm.PolygonIntersectAnalysis和此方法重复,需要整理删除
+ ///
+ ///
+ ///
+ ///
+ public static GSOFeatures getLayerFeatures(GSOGeoPolygon3D polygon, GSOLayer layer)
+ {
+ if (layer == null) return null;
+ GSOFeatureLayer flayer = layer as GSOFeatureLayer;
+ return polygon == null ? flayer.GetAllFeatures() : flayer.FindFeaturesInPolygon(polygon, false);
+ }
}
}
diff --git a/FrmAllWorkWellStatis.cs b/FrmAllWorkWellStatis.cs
index 7bf65dc..bd0f81b 100644
--- a/FrmAllWorkWellStatis.cs
+++ b/FrmAllWorkWellStatis.cs
@@ -19,17 +19,7 @@
private Dictionary map = null;
private GSOGlobeControl globeControl1;
private GSOGeoPolygon3D polygon;
- //TODOLIST:用晓伟的代理进行操作,功能拆分细化
- //public FrmAllWorkWellStatis(GSOGeoPolygon3D polygon, DataGridView dataGridViewX11, ToolStripStatusLabel toolStripNumbers1, GSOGlobeControl ctl, PanelEx p)
- //{
- // InitializeComponent();
- // panel = p;
- // dataGridViewX1 = dataGridViewX11;
- // toolStripNumbers = toolStripNumbers1;
- // globeControl1 = ctl;
- // map = getAccsMap(polygon);
- //}
public FrmAllWorkWellStatis(GSOGlobeControl ctl,GSOGeoPolygon3D polygon, MainFrm.DataGridViewDelegate InitDataGridViewX1)
{
InitializeComponent();
@@ -117,8 +107,9 @@
sql = "select " + getpipeLineFields.getFields(layername, globeControl1) + " from " + layer.Name;
sql += " where 1>2 ";
- for (int i = 0; i < fs.Length && fs[i].GetFieldDefn("编号") != null; i++)
+ for (int i = 0; i < fs.Length; i++)
{
+ if (fs[i].GetFieldDefn("编号") == null) continue;
sql += " or 编号 = '" + fs[i].GetValue("编号").ToString() + "'";
}
diff --git a/FrmBSQDuoBianXingStatis.Designer.cs b/FrmBSQDuoBianXingStatis.Designer.cs
deleted file mode 100644
index bda6842..0000000
--- a/FrmBSQDuoBianXingStatis.Designer.cs
+++ /dev/null
@@ -1,87 +0,0 @@
-namespace Cyberpipe
-{
- partial class FrmBSQDuoBianXingStatis
- {
- ///
- /// Required designer variable.
- ///
- private System.ComponentModel.IContainer components = null;
-
- ///
- /// Clean up any resources being used.
- ///
- /// true if managed resources should be disposed; otherwise, false.
- protected override void Dispose(bool disposing)
- {
- if (disposing && (components != null))
- {
- components.Dispose();
- }
- base.Dispose(disposing);
- }
-
- #region Windows Form Designer generated code
-
- ///
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- ///
- private void InitializeComponent()
- {
- System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea1 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
- this.groupBox1 = new System.Windows.Forms.GroupBox();
- this.chart1 = new System.Windows.Forms.DataVisualization.Charting.Chart();
- this.groupBox1.SuspendLayout();
- ((System.ComponentModel.ISupportInitialize)(this.chart1)).BeginInit();
- this.SuspendLayout();
- //
- // groupBox1
- //
- this.groupBox1.Controls.Add(this.chart1);
- this.groupBox1.Dock = System.Windows.Forms.DockStyle.Fill;
- this.groupBox1.Location = new System.Drawing.Point(0, 0);
- this.groupBox1.Name = "groupBox1";
- this.groupBox1.Size = new System.Drawing.Size(592, 384);
- this.groupBox1.TabIndex = 0;
- this.groupBox1.TabStop = false;
- this.groupBox1.Text = "统计结果信息";
- //
- // chart1
- //
- chartArea1.AxisX.MajorGrid.Enabled = false;
- chartArea1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(191)))), ((int)(((byte)(219)))), ((int)(((byte)(255)))));
- chartArea1.BackGradientStyle = System.Windows.Forms.DataVisualization.Charting.GradientStyle.TopBottom;
- chartArea1.Name = "ChartArea1";
- this.chart1.ChartAreas.Add(chartArea1);
- this.chart1.Dock = System.Windows.Forms.DockStyle.Fill;
- this.chart1.Location = new System.Drawing.Point(3, 17);
- this.chart1.Name = "chart1";
- this.chart1.Size = new System.Drawing.Size(586, 364);
- this.chart1.TabIndex = 0;
- this.chart1.Text = "chart1";
- //
- // FrmBSQDuoBianXingStatis
- //
- this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.ClientSize = new System.Drawing.Size(592, 384);
- this.Controls.Add(this.groupBox1);
- this.DoubleBuffered = true;
- this.Name = "FrmBSQDuoBianXingStatis";
- this.ShowIcon = false;
- this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
- this.Text = "多边形区域统计";
- this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FrmBSQDuoBianXingStatis_FormClosing);
- this.Load += new System.EventHandler(this.FrmBSQDuoBianXingStatis_Load);
- this.groupBox1.ResumeLayout(false);
- ((System.ComponentModel.ISupportInitialize)(this.chart1)).EndInit();
- this.ResumeLayout(false);
-
- }
-
- #endregion
-
- private System.Windows.Forms.GroupBox groupBox1;
- private System.Windows.Forms.DataVisualization.Charting.Chart chart1;
- }
-}
\ No newline at end of file
diff --git a/FrmBSQDuoBianXingStatis.cs b/FrmBSQDuoBianXingStatis.cs
deleted file mode 100644
index 80b567e..0000000
--- a/FrmBSQDuoBianXingStatis.cs
+++ /dev/null
@@ -1,179 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Data;
-using System.Drawing;
-using System.Linq;
-using System.Text;
-using System.Windows.Forms;
-using DevComponents.DotNetBar;
-using System.Data.SqlClient;
-using System.Windows.Forms.DataVisualization.Charting;
-using GeoScene.Data;
-using GeoScene.Engine;
-using GeoScene.Globe;
-using System.Data.OracleClient;
-
-namespace Cyberpipe
-{
- public partial class FrmBSQDuoBianXingStatis : Office2007Form
- {
- Dictionary bsq = new Dictionary();
- Dictionary bsq1 = new Dictionary();
- static FrmBSQDuoBianXingStatis frm;
- GSOGlobeControl globeControl1;
- List list = new List();
- public static List pipeLists = new List();
-
- string[] codeStr = new string[50];
- string[] nameStr = new string[30];
- public static List typeLists;
-
- public FrmBSQDuoBianXingStatis(Dictionary workWellLen, GSOGlobeControl glb,List _list)
- {
- InitializeComponent();
- bsq = workWellLen;
- globeControl1 = glb;
- list = _list;
- }
-
- private void FrmBSQDuoBianXingStatis_Load(object sender, EventArgs e)
- {
- FrmBSQDuoBianXingStatisFenLei();
- try
- {
- chart1.Series.Add("标识器");
- chart1.ChartAreas["ChartArea1"].AxisX.Title = "标识器类型";
- chart1.ChartAreas["ChartArea1"].AxisY.Title = "标识器数量";
- chart1.ChartAreas["ChartArea1"].AxisX.Interval = 1;
- chart1.Series["标识器"].ChartType = SeriesChartType.Column;
- chart1.Series["标识器"]["DrawingStyle"] = "Cylinder";
-
- chart1.Series["标识器"].Points.DataBindXY(bsq1.Keys, bsq1.Values);
- if (bsq1.Values.Count == 0)
- {
- MessageBox.Show("该区域没有标识器信息", "提示");
- this.Close();
- return;
- }
- else
- {
- for (int m = 0; m < bsq1.Values.Count; m++)
- {
- if (chart1.Series["标识器"].Points[m].YValues[0].ToString() != "0")
- {
- chart1.Series["标识器"].Points[m].Label = chart1.Series[0].Points[m].YValues[0].ToString();
- }
- }
- }
- }
- catch (Exception ex)
- {
- //ErrorLog.PublishError(ex);
- }
- }
-
- private void FrmBSQDuoBianXingStatis_FormClosing(object sender, FormClosingEventArgs e)
- {
- frm = null;
- globeControl1.Globe.ClearAnalysis();
- globeControl1.Globe.MemoryLayer.RemoveAllFeature();
- }
-
-
- private void FrmBSQDuoBianXingStatisFenLei()
- {
- try
- {
- bool flag2 = false;
- for (int i = 0; i < Utility.listPipelineType.Count; i++)
- {
-
- for (int j = 0; j < pipeLists.Count; j++)
- {
- if (pipeLists[j] == Utility.listPipelineType[i].type)
- {
- flag2 = true;
- break;
- }
- }
- if (!flag2 && Utility.listPipelineType[i].type != "标识器")
- {
- pipeLists.Add(Utility.listPipelineType[i].type);
- }
- flag2 = false;
- }
-
- typeLists = new List();
- for (int num = 0; num < pipeLists.Count; num++)
- {
- typeList ls = new typeList(0, pipeLists[num]);
- typeLists.Add(ls);
- }
-
- GSOFeatures fs = list[0];
- string pipetype = "标识器";
- foreach (string key in bsq.Keys)
- {
- if (key.StartsWith(pipetype))
- {
- pipetype = key;
- break;
- }
- }
- if (fs.Length > 0)
- {
- for (int i = 0; i < fs.Length; i++)
- {
- string str = fs[i].GetValue("对象名称").ToString();
- codeStr = str.Split(',');
- for (int n = 0; n < codeStr.Length; n++)
- {
- for (int ii = 0; ii < Utility.listPipelineType.Count; ii++)
- {
- if (Utility.listPipelineType[ii].code == codeStr[n])
- {
- for (int m = 0; m < typeLists.Count; m++)
- {
- if (Utility.listPipelineType[ii].type == typeLists[m].type)
- {
- typeLists[m].num++;
- break;
- }
- }
- break;
- }
- }
- }
- }
- }
-
- for (int i = 0; i < typeLists.Count; i++)
- {
- if (typeLists[i].num > 0)
- bsq1.Add(typeLists[i].type, typeLists[i].num);
- }
-
- }
- catch (Exception ex)
- {
- //ErrorLog.PublishError(ex);
- //MessageBox.Show(ex.Message);
- }
-
- }
- public class typeList
- {
- public int num;
- public string type;
-
- public typeList(int _num, string _type)
- {
- num = _num;
- type = _type;
- }
- }
-
-
- }
-}
diff --git a/FrmBSQDuoBianXingStatis.resx b/FrmBSQDuoBianXingStatis.resx
deleted file mode 100644
index 1af7de1..0000000
--- a/FrmBSQDuoBianXingStatis.resx
+++ /dev/null
@@ -1,120 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- text/microsoft-resx
-
-
- 2.0
-
-
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
\ No newline at end of file
diff --git a/FrmBSQStatis.Designer.cs b/FrmBSQStatis.Designer.cs
index 2509c7d..ee9b1e7 100644
--- a/FrmBSQStatis.Designer.cs
+++ b/FrmBSQStatis.Designer.cs
@@ -57,6 +57,7 @@
this.ShowIcon = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "标识器全区域统计";
+ this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FrmBSQStatis_FormClosing);
this.Load += new System.EventHandler(this.FrmBSQStatis_Load);
((System.ComponentModel.ISupportInitialize)(this.chartStatis)).EndInit();
this.ResumeLayout(false);
diff --git a/FrmBSQStatis.cs b/FrmBSQStatis.cs
index 4b25eda..e7c4926 100644
--- a/FrmBSQStatis.cs
+++ b/FrmBSQStatis.cs
@@ -18,94 +18,18 @@
{
public partial class FrmBSQStatis : Office2007Form
{
- public Dictionary bsq = new Dictionary();
- //SqlConnection conn;
- public static List typeLists;
- OracleConnection conn;
- string connectString;
+ private Dictionary bsq = new Dictionary();
+ private GSOGlobeControl globeControl1;
+ private GSOGeoPolygon3D polygon;
- public FrmBSQStatis()
+ public FrmBSQStatis(GSOGlobeControl globeControl1,GSOGeoPolygon3D polygon)
{
+ this.globeControl1 = globeControl1;
+ this.polygon = polygon;
InitializeComponent();
- BSQNumStatis();
+ bsq = getBSQNameAndNumMap(polygon);
}
- string[] codeStr = new string[50];
- string[] nameStr = new string[30];
- public static List pipeLists = new List();
-
- private void BSQNumStatis()
- {
- bool flag2 = false;
- for (int i = 0; i < Utility.listPipelineType.Count; i++)
- {
- for (int j = 0; j < pipeLists.Count; j++)
- {
- if (pipeLists[j] == Utility.listPipelineType[i].type)
- {
- flag2 = true;
- break;
- }
- }
- if (!flag2 && Utility.listPipelineType[i].type != "标识器")
- {
- pipeLists.Add(Utility.listPipelineType[i].type);
- }
- flag2 = false;
- }
-
- typeLists = new List();
- for (int num = 0; num 0)
- bsq.Add(typeLists[i].type, typeLists[i].num);
- }
-
- }
- catch (Exception ex)
- {
-
- }
- }
private void FrmBSQStatis_Load(object sender, EventArgs e)
{
@@ -136,17 +60,88 @@
}
}
- public class typeList
+ private Dictionary getBSQNameAndNumMap(GSOGeoPolygon3D polygon)
{
- public int num;
- public string type;
- public typeList(int _num, string _type)
+ Dictionary result = new Dictionary();
+ Dictionary codeAndType = new Dictionary();
+ //得到type的种类
+ for (int i = 0; i < Utility.listPipelineType.Count; i++)
{
- num = _num;
- type = _type;
+ if (!result.ContainsKey(Utility.listPipelineType[i].type) && Utility.listPipelineType[i].type != "标识器")
+ {
+ result.Add(Utility.listPipelineType[i].type, 0);
+ codeAndType.Add(Utility.listPipelineType[i].code, Utility.listPipelineType[i].type);
+ }
+
}
+
+ return polygon == null ? getAllAreaMap(result, codeAndType) : getBSQMapByPolygon(polygon, result, codeAndType);
+
}
+ public Dictionary getAllAreaMap(Dictionary typeAndCount,Dictionary codeAndType)
+ {
+ try
+ {
+ OracleConnection conn = OledbHelper.sqlConnection();
+ conn.Open();
+ OracleCommand cmd;
+ cmd = new OracleCommand("select 对象类型 from 标识器", conn);
+ OracleDataReader dr = cmd.ExecuteReader();
+
+ while (dr.Read())
+ {
+ string str = Convert.ToString(dr["对象类型"]);
+ if (str == null) continue;
+ foreach (string key in codeAndType.Keys)
+ {
+ if (str.Contains(key))
+ {
+ typeAndCount[codeAndType[key]] += 1;
+ }
+ }
+ }
+ conn.Close();
+ }
+ catch (Exception ex)
+ {
+ LogHelper.WriteLog(typeof(FrmBSQStatis),ex.Message.ToString());
+ }
+ return typeAndCount;
+ }
+
+
+ public Dictionary getBSQMapByPolygon(GSOGeoPolygon3D polygon,Dictionary typeAndCount, Dictionary codeAndType)
+ {
+ GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption("标识器");
+ GSOFeatures bsqFs = FeatureStatisticsService.getLayerFeatures(polygon, layer);
+ if (bsqFs == null || bsqFs.Length <= 0) {
+ LogHelper.WriteLog(typeof(FrmBSQStatis),"标识器图层下的Feature为空");
+ return null;
+ }
+
+ for (int i = 0; i < bsqFs.Length; i++)
+ {
+ string str = bsqFs[i].GetValue("对象类型").ToString();
+
+ foreach (string key in codeAndType.Keys)
+ {
+ if (str.Contains(key))
+ {
+ typeAndCount[codeAndType[key]] += 1;
+ }
+ }
+ }
+
+ return typeAndCount;
+ }
+
+ private void FrmBSQStatis_FormClosing(object sender, FormClosingEventArgs e)
+ {
+ globeControl1.Globe.ClearAnalysis();
+ }
+
+
}
}
diff --git a/FrmValveStatistics.cs b/FrmValveStatistics.cs
index 672f97a..17dad6c 100644
--- a/FrmValveStatistics.cs
+++ b/FrmValveStatistics.cs
@@ -120,6 +120,7 @@
sql += " where 1>2 ";
for (int i = 0; i < fs.Length; i++)
{
+ if (fs[i].GetValue("编号") == null) continue;
sql += " or 编号 = '" + fs[i].GetValue("编号").ToString() + "'";
}
diff --git a/Cyberpipe.csproj b/Cyberpipe.csproj
index 3a45ad8..d22f590 100644
--- a/Cyberpipe.csproj
+++ b/Cyberpipe.csproj
@@ -402,12 +402,6 @@
FrmBACKORACLE.cs
-
- Form
-
-
- FrmBSQDuoBianXingStatis.cs
-
Form
@@ -1271,9 +1265,6 @@
FrmBACKORACLE.cs
-
- FrmBSQDuoBianXingStatis.cs
-
FrmBSQStatis.cs
diff --git a/FeatureStatisticsService.cs b/FeatureStatisticsService.cs
index e833e5f..c7de210 100644
--- a/FeatureStatisticsService.cs
+++ b/FeatureStatisticsService.cs
@@ -273,19 +273,15 @@
/// 获取特定区域图层的管线列表,并将其总长度统计出来
/// TODOLIST:将Intersects_Pipeline在MainFrm中去除
///
- ///
+ ///
+ /// 要统计的长度
///
public static GSOFeatures getLayerPipes(GSOGeoPolygon3D polygon, GSOLayer layer, out double length)
{
length = 0;
if (layer == null) return null;
- GSOFeatureLayer flayer = layer as GSOFeatureLayer;
- GSOFeatureDataset fdataset = flayer.Dataset as GSOFeatureDataset;
- GSOFeatures feats = null;
-
- feats = polygon == null?flayer.GetAllFeatures():flayer.FindFeaturesInPolygon(polygon, false);
-
+ GSOFeatures feats = getLayerFeatures(polygon, layer);
double totallength = 0.00;
for (int i = 0; i < feats.Length; i++)
{
@@ -301,5 +297,17 @@
return feats;
}
+ ///
+ /// 获取区域图层内的feature列表,MainFrm.PolygonIntersectAnalysis和此方法重复,需要整理删除
+ ///
+ ///
+ ///
+ ///
+ public static GSOFeatures getLayerFeatures(GSOGeoPolygon3D polygon, GSOLayer layer)
+ {
+ if (layer == null) return null;
+ GSOFeatureLayer flayer = layer as GSOFeatureLayer;
+ return polygon == null ? flayer.GetAllFeatures() : flayer.FindFeaturesInPolygon(polygon, false);
+ }
}
}
diff --git a/FrmAllWorkWellStatis.cs b/FrmAllWorkWellStatis.cs
index 7bf65dc..bd0f81b 100644
--- a/FrmAllWorkWellStatis.cs
+++ b/FrmAllWorkWellStatis.cs
@@ -19,17 +19,7 @@
private Dictionary map = null;
private GSOGlobeControl globeControl1;
private GSOGeoPolygon3D polygon;
- //TODOLIST:用晓伟的代理进行操作,功能拆分细化
- //public FrmAllWorkWellStatis(GSOGeoPolygon3D polygon, DataGridView dataGridViewX11, ToolStripStatusLabel toolStripNumbers1, GSOGlobeControl ctl, PanelEx p)
- //{
- // InitializeComponent();
- // panel = p;
- // dataGridViewX1 = dataGridViewX11;
- // toolStripNumbers = toolStripNumbers1;
- // globeControl1 = ctl;
- // map = getAccsMap(polygon);
- //}
public FrmAllWorkWellStatis(GSOGlobeControl ctl,GSOGeoPolygon3D polygon, MainFrm.DataGridViewDelegate InitDataGridViewX1)
{
InitializeComponent();
@@ -117,8 +107,9 @@
sql = "select " + getpipeLineFields.getFields(layername, globeControl1) + " from " + layer.Name;
sql += " where 1>2 ";
- for (int i = 0; i < fs.Length && fs[i].GetFieldDefn("编号") != null; i++)
+ for (int i = 0; i < fs.Length; i++)
{
+ if (fs[i].GetFieldDefn("编号") == null) continue;
sql += " or 编号 = '" + fs[i].GetValue("编号").ToString() + "'";
}
diff --git a/FrmBSQDuoBianXingStatis.Designer.cs b/FrmBSQDuoBianXingStatis.Designer.cs
deleted file mode 100644
index bda6842..0000000
--- a/FrmBSQDuoBianXingStatis.Designer.cs
+++ /dev/null
@@ -1,87 +0,0 @@
-namespace Cyberpipe
-{
- partial class FrmBSQDuoBianXingStatis
- {
- ///
- /// Required designer variable.
- ///
- private System.ComponentModel.IContainer components = null;
-
- ///
- /// Clean up any resources being used.
- ///
- /// true if managed resources should be disposed; otherwise, false.
- protected override void Dispose(bool disposing)
- {
- if (disposing && (components != null))
- {
- components.Dispose();
- }
- base.Dispose(disposing);
- }
-
- #region Windows Form Designer generated code
-
- ///
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- ///
- private void InitializeComponent()
- {
- System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea1 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
- this.groupBox1 = new System.Windows.Forms.GroupBox();
- this.chart1 = new System.Windows.Forms.DataVisualization.Charting.Chart();
- this.groupBox1.SuspendLayout();
- ((System.ComponentModel.ISupportInitialize)(this.chart1)).BeginInit();
- this.SuspendLayout();
- //
- // groupBox1
- //
- this.groupBox1.Controls.Add(this.chart1);
- this.groupBox1.Dock = System.Windows.Forms.DockStyle.Fill;
- this.groupBox1.Location = new System.Drawing.Point(0, 0);
- this.groupBox1.Name = "groupBox1";
- this.groupBox1.Size = new System.Drawing.Size(592, 384);
- this.groupBox1.TabIndex = 0;
- this.groupBox1.TabStop = false;
- this.groupBox1.Text = "统计结果信息";
- //
- // chart1
- //
- chartArea1.AxisX.MajorGrid.Enabled = false;
- chartArea1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(191)))), ((int)(((byte)(219)))), ((int)(((byte)(255)))));
- chartArea1.BackGradientStyle = System.Windows.Forms.DataVisualization.Charting.GradientStyle.TopBottom;
- chartArea1.Name = "ChartArea1";
- this.chart1.ChartAreas.Add(chartArea1);
- this.chart1.Dock = System.Windows.Forms.DockStyle.Fill;
- this.chart1.Location = new System.Drawing.Point(3, 17);
- this.chart1.Name = "chart1";
- this.chart1.Size = new System.Drawing.Size(586, 364);
- this.chart1.TabIndex = 0;
- this.chart1.Text = "chart1";
- //
- // FrmBSQDuoBianXingStatis
- //
- this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.ClientSize = new System.Drawing.Size(592, 384);
- this.Controls.Add(this.groupBox1);
- this.DoubleBuffered = true;
- this.Name = "FrmBSQDuoBianXingStatis";
- this.ShowIcon = false;
- this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
- this.Text = "多边形区域统计";
- this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FrmBSQDuoBianXingStatis_FormClosing);
- this.Load += new System.EventHandler(this.FrmBSQDuoBianXingStatis_Load);
- this.groupBox1.ResumeLayout(false);
- ((System.ComponentModel.ISupportInitialize)(this.chart1)).EndInit();
- this.ResumeLayout(false);
-
- }
-
- #endregion
-
- private System.Windows.Forms.GroupBox groupBox1;
- private System.Windows.Forms.DataVisualization.Charting.Chart chart1;
- }
-}
\ No newline at end of file
diff --git a/FrmBSQDuoBianXingStatis.cs b/FrmBSQDuoBianXingStatis.cs
deleted file mode 100644
index 80b567e..0000000
--- a/FrmBSQDuoBianXingStatis.cs
+++ /dev/null
@@ -1,179 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Data;
-using System.Drawing;
-using System.Linq;
-using System.Text;
-using System.Windows.Forms;
-using DevComponents.DotNetBar;
-using System.Data.SqlClient;
-using System.Windows.Forms.DataVisualization.Charting;
-using GeoScene.Data;
-using GeoScene.Engine;
-using GeoScene.Globe;
-using System.Data.OracleClient;
-
-namespace Cyberpipe
-{
- public partial class FrmBSQDuoBianXingStatis : Office2007Form
- {
- Dictionary bsq = new Dictionary();
- Dictionary bsq1 = new Dictionary();
- static FrmBSQDuoBianXingStatis frm;
- GSOGlobeControl globeControl1;
- List list = new List();
- public static List pipeLists = new List();
-
- string[] codeStr = new string[50];
- string[] nameStr = new string[30];
- public static List typeLists;
-
- public FrmBSQDuoBianXingStatis(Dictionary workWellLen, GSOGlobeControl glb,List _list)
- {
- InitializeComponent();
- bsq = workWellLen;
- globeControl1 = glb;
- list = _list;
- }
-
- private void FrmBSQDuoBianXingStatis_Load(object sender, EventArgs e)
- {
- FrmBSQDuoBianXingStatisFenLei();
- try
- {
- chart1.Series.Add("标识器");
- chart1.ChartAreas["ChartArea1"].AxisX.Title = "标识器类型";
- chart1.ChartAreas["ChartArea1"].AxisY.Title = "标识器数量";
- chart1.ChartAreas["ChartArea1"].AxisX.Interval = 1;
- chart1.Series["标识器"].ChartType = SeriesChartType.Column;
- chart1.Series["标识器"]["DrawingStyle"] = "Cylinder";
-
- chart1.Series["标识器"].Points.DataBindXY(bsq1.Keys, bsq1.Values);
- if (bsq1.Values.Count == 0)
- {
- MessageBox.Show("该区域没有标识器信息", "提示");
- this.Close();
- return;
- }
- else
- {
- for (int m = 0; m < bsq1.Values.Count; m++)
- {
- if (chart1.Series["标识器"].Points[m].YValues[0].ToString() != "0")
- {
- chart1.Series["标识器"].Points[m].Label = chart1.Series[0].Points[m].YValues[0].ToString();
- }
- }
- }
- }
- catch (Exception ex)
- {
- //ErrorLog.PublishError(ex);
- }
- }
-
- private void FrmBSQDuoBianXingStatis_FormClosing(object sender, FormClosingEventArgs e)
- {
- frm = null;
- globeControl1.Globe.ClearAnalysis();
- globeControl1.Globe.MemoryLayer.RemoveAllFeature();
- }
-
-
- private void FrmBSQDuoBianXingStatisFenLei()
- {
- try
- {
- bool flag2 = false;
- for (int i = 0; i < Utility.listPipelineType.Count; i++)
- {
-
- for (int j = 0; j < pipeLists.Count; j++)
- {
- if (pipeLists[j] == Utility.listPipelineType[i].type)
- {
- flag2 = true;
- break;
- }
- }
- if (!flag2 && Utility.listPipelineType[i].type != "标识器")
- {
- pipeLists.Add(Utility.listPipelineType[i].type);
- }
- flag2 = false;
- }
-
- typeLists = new List();
- for (int num = 0; num < pipeLists.Count; num++)
- {
- typeList ls = new typeList(0, pipeLists[num]);
- typeLists.Add(ls);
- }
-
- GSOFeatures fs = list[0];
- string pipetype = "标识器";
- foreach (string key in bsq.Keys)
- {
- if (key.StartsWith(pipetype))
- {
- pipetype = key;
- break;
- }
- }
- if (fs.Length > 0)
- {
- for (int i = 0; i < fs.Length; i++)
- {
- string str = fs[i].GetValue("对象名称").ToString();
- codeStr = str.Split(',');
- for (int n = 0; n < codeStr.Length; n++)
- {
- for (int ii = 0; ii < Utility.listPipelineType.Count; ii++)
- {
- if (Utility.listPipelineType[ii].code == codeStr[n])
- {
- for (int m = 0; m < typeLists.Count; m++)
- {
- if (Utility.listPipelineType[ii].type == typeLists[m].type)
- {
- typeLists[m].num++;
- break;
- }
- }
- break;
- }
- }
- }
- }
- }
-
- for (int i = 0; i < typeLists.Count; i++)
- {
- if (typeLists[i].num > 0)
- bsq1.Add(typeLists[i].type, typeLists[i].num);
- }
-
- }
- catch (Exception ex)
- {
- //ErrorLog.PublishError(ex);
- //MessageBox.Show(ex.Message);
- }
-
- }
- public class typeList
- {
- public int num;
- public string type;
-
- public typeList(int _num, string _type)
- {
- num = _num;
- type = _type;
- }
- }
-
-
- }
-}
diff --git a/FrmBSQDuoBianXingStatis.resx b/FrmBSQDuoBianXingStatis.resx
deleted file mode 100644
index 1af7de1..0000000
--- a/FrmBSQDuoBianXingStatis.resx
+++ /dev/null
@@ -1,120 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- text/microsoft-resx
-
-
- 2.0
-
-
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
\ No newline at end of file
diff --git a/FrmBSQStatis.Designer.cs b/FrmBSQStatis.Designer.cs
index 2509c7d..ee9b1e7 100644
--- a/FrmBSQStatis.Designer.cs
+++ b/FrmBSQStatis.Designer.cs
@@ -57,6 +57,7 @@
this.ShowIcon = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "标识器全区域统计";
+ this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FrmBSQStatis_FormClosing);
this.Load += new System.EventHandler(this.FrmBSQStatis_Load);
((System.ComponentModel.ISupportInitialize)(this.chartStatis)).EndInit();
this.ResumeLayout(false);
diff --git a/FrmBSQStatis.cs b/FrmBSQStatis.cs
index 4b25eda..e7c4926 100644
--- a/FrmBSQStatis.cs
+++ b/FrmBSQStatis.cs
@@ -18,94 +18,18 @@
{
public partial class FrmBSQStatis : Office2007Form
{
- public Dictionary bsq = new Dictionary();
- //SqlConnection conn;
- public static List typeLists;
- OracleConnection conn;
- string connectString;
+ private Dictionary bsq = new Dictionary();
+ private GSOGlobeControl globeControl1;
+ private GSOGeoPolygon3D polygon;
- public FrmBSQStatis()
+ public FrmBSQStatis(GSOGlobeControl globeControl1,GSOGeoPolygon3D polygon)
{
+ this.globeControl1 = globeControl1;
+ this.polygon = polygon;
InitializeComponent();
- BSQNumStatis();
+ bsq = getBSQNameAndNumMap(polygon);
}
- string[] codeStr = new string[50];
- string[] nameStr = new string[30];
- public static List pipeLists = new List();
-
- private void BSQNumStatis()
- {
- bool flag2 = false;
- for (int i = 0; i < Utility.listPipelineType.Count; i++)
- {
- for (int j = 0; j < pipeLists.Count; j++)
- {
- if (pipeLists[j] == Utility.listPipelineType[i].type)
- {
- flag2 = true;
- break;
- }
- }
- if (!flag2 && Utility.listPipelineType[i].type != "标识器")
- {
- pipeLists.Add(Utility.listPipelineType[i].type);
- }
- flag2 = false;
- }
-
- typeLists = new List();
- for (int num = 0; num 0)
- bsq.Add(typeLists[i].type, typeLists[i].num);
- }
-
- }
- catch (Exception ex)
- {
-
- }
- }
private void FrmBSQStatis_Load(object sender, EventArgs e)
{
@@ -136,17 +60,88 @@
}
}
- public class typeList
+ private Dictionary getBSQNameAndNumMap(GSOGeoPolygon3D polygon)
{
- public int num;
- public string type;
- public typeList(int _num, string _type)
+ Dictionary result = new Dictionary();
+ Dictionary codeAndType = new Dictionary();
+ //得到type的种类
+ for (int i = 0; i < Utility.listPipelineType.Count; i++)
{
- num = _num;
- type = _type;
+ if (!result.ContainsKey(Utility.listPipelineType[i].type) && Utility.listPipelineType[i].type != "标识器")
+ {
+ result.Add(Utility.listPipelineType[i].type, 0);
+ codeAndType.Add(Utility.listPipelineType[i].code, Utility.listPipelineType[i].type);
+ }
+
}
+
+ return polygon == null ? getAllAreaMap(result, codeAndType) : getBSQMapByPolygon(polygon, result, codeAndType);
+
}
+ public Dictionary getAllAreaMap(Dictionary typeAndCount,Dictionary codeAndType)
+ {
+ try
+ {
+ OracleConnection conn = OledbHelper.sqlConnection();
+ conn.Open();
+ OracleCommand cmd;
+ cmd = new OracleCommand("select 对象类型 from 标识器", conn);
+ OracleDataReader dr = cmd.ExecuteReader();
+
+ while (dr.Read())
+ {
+ string str = Convert.ToString(dr["对象类型"]);
+ if (str == null) continue;
+ foreach (string key in codeAndType.Keys)
+ {
+ if (str.Contains(key))
+ {
+ typeAndCount[codeAndType[key]] += 1;
+ }
+ }
+ }
+ conn.Close();
+ }
+ catch (Exception ex)
+ {
+ LogHelper.WriteLog(typeof(FrmBSQStatis),ex.Message.ToString());
+ }
+ return typeAndCount;
+ }
+
+
+ public Dictionary getBSQMapByPolygon(GSOGeoPolygon3D polygon,Dictionary typeAndCount, Dictionary codeAndType)
+ {
+ GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption("标识器");
+ GSOFeatures bsqFs = FeatureStatisticsService.getLayerFeatures(polygon, layer);
+ if (bsqFs == null || bsqFs.Length <= 0) {
+ LogHelper.WriteLog(typeof(FrmBSQStatis),"标识器图层下的Feature为空");
+ return null;
+ }
+
+ for (int i = 0; i < bsqFs.Length; i++)
+ {
+ string str = bsqFs[i].GetValue("对象类型").ToString();
+
+ foreach (string key in codeAndType.Keys)
+ {
+ if (str.Contains(key))
+ {
+ typeAndCount[codeAndType[key]] += 1;
+ }
+ }
+ }
+
+ return typeAndCount;
+ }
+
+ private void FrmBSQStatis_FormClosing(object sender, FormClosingEventArgs e)
+ {
+ globeControl1.Globe.ClearAnalysis();
+ }
+
+
}
}
diff --git a/FrmValveStatistics.cs b/FrmValveStatistics.cs
index 672f97a..17dad6c 100644
--- a/FrmValveStatistics.cs
+++ b/FrmValveStatistics.cs
@@ -120,6 +120,7 @@
sql += " where 1>2 ";
for (int i = 0; i < fs.Length; i++)
{
+ if (fs[i].GetValue("编号") == null) continue;
sql += " or 编号 = '" + fs[i].GetValue("编号").ToString() + "'";
}
diff --git a/FrmpipeDeepstatis.cs b/FrmpipeDeepstatis.cs
index 879801a..c7edbc3 100644
--- a/FrmpipeDeepstatis.cs
+++ b/FrmpipeDeepstatis.cs
@@ -164,88 +164,6 @@
}
}
- //if (clbPipeLine.CheckedItems.Count > 0)
- //{
- // if (dataGridViewX2.Rows.Count > 0)
- // {
- // for (int i = 0; i < clbPipeLine.CheckedItems.Count; i++)
- // {
- // GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(clbPipeLine.CheckedItems[i].ToString());
- // GSOFeatureLayer flayer = layer as GSOFeatureLayer;
- // GSOFeatures feats = new GSOFeatures();
- // if (polygon == null)
- // feats = flayer.GetAllFeatures();
- // else
- // feats = flayer.FindFeaturesInPolygon(polygon, false);
- // for (int j = 0; j < dataGridViewX2.Rows.Count; j++)
- // {
- // double totalLength = 0.00;
- // int ncount = 0;
- // for (int m = 0; m < feats.Length; m++)
- // {
- // GSOFeature feat = feats[m];
- // float radius = feat.GetFieldAsFloat("起始埋深");
- // bool upCompare = true;
- // bool downCompare = true;
- // if (dataGridViewX2.Rows[j].Cells["下限"].Value != null || dataGridViewX2.Rows[j].Cells["上限"].Value != null)
- // {
- // if (dataGridViewX2.Rows[j].Cells["下限"].Value != null)
- // {
- // if (dataGridViewX2.Rows[j].Cells["下限"].Value.ToString() != "")
- // {
- // if (radius >= Convert.ToDouble(dataGridViewX2.Rows[j].Cells["下限"].Value))
- // {
- // downCompare = true;
- // }
- // else
- // downCompare = false;
- // }
- // }
- // if (dataGridViewX2.Rows[j].Cells["上限"].Value != null)
- // {
- // if (dataGridViewX2.Rows[j].Cells["上限"].Value.ToString() != "")
- // {
- // if (radius <= Convert.ToDouble(dataGridViewX2.Rows[j].Cells["上限"].Value))
- // {
- // upCompare = true;
- // }
- // else
- // upCompare = false;
- // }
- // }
- // if (upCompare && downCompare)
- // {
- // GSOGeoPolyline3D line = feat.Geometry as GSOGeoPolyline3D;
- // double length = line.GetSpaceLength(true, 6378137);
- // totalLength += length;
- // ncount += 1;
- // }
- // }
- // }
- // if (dataGridViewX2.Rows[j].Cells["下限"].Value != null || dataGridViewX2.Rows[j].Cells["上限"].Value != null)
- // {
- // DataGridViewRow row = new DataGridViewRow();
- // int index = dataGridViewX1.Rows.Add(row);
- // row = dataGridViewX1.Rows[index];
- // row.Cells["图层名称"].Value = layer.Caption;
- // row.Cells["埋深范围"].Value = dataGridViewX2.Rows[j].Cells["下限"].Value + "-" + dataGridViewX2.Rows[j].Cells["上限"].Value;
- // row.Cells["条数"].Value = ncount;
- // row.Cells["总长度"].Value =Math.Round(totalLength,2);
-
- // dic.Add(layer.Caption + "," + row.Cells["埋深范围"].Value.ToString()+","+row.Cells["总长度"].Value.ToString(), ncount);
- // }
- // }
- // }
- // }
- // else
- // {
- // MessageBox.Show("请添加分段!");
- // }
- //}
- //else
- //{
- // MessageBox.Show("请选择图层!");
- //}
showPipeWidget();
}
catch (Exception ex)
diff --git a/Cyberpipe.csproj b/Cyberpipe.csproj
index 3a45ad8..d22f590 100644
--- a/Cyberpipe.csproj
+++ b/Cyberpipe.csproj
@@ -402,12 +402,6 @@
FrmBACKORACLE.cs
-
- Form
-
-
- FrmBSQDuoBianXingStatis.cs
-
Form
@@ -1271,9 +1265,6 @@
FrmBACKORACLE.cs
-
- FrmBSQDuoBianXingStatis.cs
-
FrmBSQStatis.cs
diff --git a/FeatureStatisticsService.cs b/FeatureStatisticsService.cs
index e833e5f..c7de210 100644
--- a/FeatureStatisticsService.cs
+++ b/FeatureStatisticsService.cs
@@ -273,19 +273,15 @@
/// 获取特定区域图层的管线列表,并将其总长度统计出来
/// TODOLIST:将Intersects_Pipeline在MainFrm中去除
///
- ///
+ ///
+ /// 要统计的长度
///
public static GSOFeatures getLayerPipes(GSOGeoPolygon3D polygon, GSOLayer layer, out double length)
{
length = 0;
if (layer == null) return null;
- GSOFeatureLayer flayer = layer as GSOFeatureLayer;
- GSOFeatureDataset fdataset = flayer.Dataset as GSOFeatureDataset;
- GSOFeatures feats = null;
-
- feats = polygon == null?flayer.GetAllFeatures():flayer.FindFeaturesInPolygon(polygon, false);
-
+ GSOFeatures feats = getLayerFeatures(polygon, layer);
double totallength = 0.00;
for (int i = 0; i < feats.Length; i++)
{
@@ -301,5 +297,17 @@
return feats;
}
+ ///
+ /// 获取区域图层内的feature列表,MainFrm.PolygonIntersectAnalysis和此方法重复,需要整理删除
+ ///
+ ///
+ ///
+ ///
+ public static GSOFeatures getLayerFeatures(GSOGeoPolygon3D polygon, GSOLayer layer)
+ {
+ if (layer == null) return null;
+ GSOFeatureLayer flayer = layer as GSOFeatureLayer;
+ return polygon == null ? flayer.GetAllFeatures() : flayer.FindFeaturesInPolygon(polygon, false);
+ }
}
}
diff --git a/FrmAllWorkWellStatis.cs b/FrmAllWorkWellStatis.cs
index 7bf65dc..bd0f81b 100644
--- a/FrmAllWorkWellStatis.cs
+++ b/FrmAllWorkWellStatis.cs
@@ -19,17 +19,7 @@
private Dictionary map = null;
private GSOGlobeControl globeControl1;
private GSOGeoPolygon3D polygon;
- //TODOLIST:用晓伟的代理进行操作,功能拆分细化
- //public FrmAllWorkWellStatis(GSOGeoPolygon3D polygon, DataGridView dataGridViewX11, ToolStripStatusLabel toolStripNumbers1, GSOGlobeControl ctl, PanelEx p)
- //{
- // InitializeComponent();
- // panel = p;
- // dataGridViewX1 = dataGridViewX11;
- // toolStripNumbers = toolStripNumbers1;
- // globeControl1 = ctl;
- // map = getAccsMap(polygon);
- //}
public FrmAllWorkWellStatis(GSOGlobeControl ctl,GSOGeoPolygon3D polygon, MainFrm.DataGridViewDelegate InitDataGridViewX1)
{
InitializeComponent();
@@ -117,8 +107,9 @@
sql = "select " + getpipeLineFields.getFields(layername, globeControl1) + " from " + layer.Name;
sql += " where 1>2 ";
- for (int i = 0; i < fs.Length && fs[i].GetFieldDefn("编号") != null; i++)
+ for (int i = 0; i < fs.Length; i++)
{
+ if (fs[i].GetFieldDefn("编号") == null) continue;
sql += " or 编号 = '" + fs[i].GetValue("编号").ToString() + "'";
}
diff --git a/FrmBSQDuoBianXingStatis.Designer.cs b/FrmBSQDuoBianXingStatis.Designer.cs
deleted file mode 100644
index bda6842..0000000
--- a/FrmBSQDuoBianXingStatis.Designer.cs
+++ /dev/null
@@ -1,87 +0,0 @@
-namespace Cyberpipe
-{
- partial class FrmBSQDuoBianXingStatis
- {
- ///
- /// Required designer variable.
- ///
- private System.ComponentModel.IContainer components = null;
-
- ///
- /// Clean up any resources being used.
- ///
- /// true if managed resources should be disposed; otherwise, false.
- protected override void Dispose(bool disposing)
- {
- if (disposing && (components != null))
- {
- components.Dispose();
- }
- base.Dispose(disposing);
- }
-
- #region Windows Form Designer generated code
-
- ///
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- ///
- private void InitializeComponent()
- {
- System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea1 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
- this.groupBox1 = new System.Windows.Forms.GroupBox();
- this.chart1 = new System.Windows.Forms.DataVisualization.Charting.Chart();
- this.groupBox1.SuspendLayout();
- ((System.ComponentModel.ISupportInitialize)(this.chart1)).BeginInit();
- this.SuspendLayout();
- //
- // groupBox1
- //
- this.groupBox1.Controls.Add(this.chart1);
- this.groupBox1.Dock = System.Windows.Forms.DockStyle.Fill;
- this.groupBox1.Location = new System.Drawing.Point(0, 0);
- this.groupBox1.Name = "groupBox1";
- this.groupBox1.Size = new System.Drawing.Size(592, 384);
- this.groupBox1.TabIndex = 0;
- this.groupBox1.TabStop = false;
- this.groupBox1.Text = "统计结果信息";
- //
- // chart1
- //
- chartArea1.AxisX.MajorGrid.Enabled = false;
- chartArea1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(191)))), ((int)(((byte)(219)))), ((int)(((byte)(255)))));
- chartArea1.BackGradientStyle = System.Windows.Forms.DataVisualization.Charting.GradientStyle.TopBottom;
- chartArea1.Name = "ChartArea1";
- this.chart1.ChartAreas.Add(chartArea1);
- this.chart1.Dock = System.Windows.Forms.DockStyle.Fill;
- this.chart1.Location = new System.Drawing.Point(3, 17);
- this.chart1.Name = "chart1";
- this.chart1.Size = new System.Drawing.Size(586, 364);
- this.chart1.TabIndex = 0;
- this.chart1.Text = "chart1";
- //
- // FrmBSQDuoBianXingStatis
- //
- this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.ClientSize = new System.Drawing.Size(592, 384);
- this.Controls.Add(this.groupBox1);
- this.DoubleBuffered = true;
- this.Name = "FrmBSQDuoBianXingStatis";
- this.ShowIcon = false;
- this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
- this.Text = "多边形区域统计";
- this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FrmBSQDuoBianXingStatis_FormClosing);
- this.Load += new System.EventHandler(this.FrmBSQDuoBianXingStatis_Load);
- this.groupBox1.ResumeLayout(false);
- ((System.ComponentModel.ISupportInitialize)(this.chart1)).EndInit();
- this.ResumeLayout(false);
-
- }
-
- #endregion
-
- private System.Windows.Forms.GroupBox groupBox1;
- private System.Windows.Forms.DataVisualization.Charting.Chart chart1;
- }
-}
\ No newline at end of file
diff --git a/FrmBSQDuoBianXingStatis.cs b/FrmBSQDuoBianXingStatis.cs
deleted file mode 100644
index 80b567e..0000000
--- a/FrmBSQDuoBianXingStatis.cs
+++ /dev/null
@@ -1,179 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Data;
-using System.Drawing;
-using System.Linq;
-using System.Text;
-using System.Windows.Forms;
-using DevComponents.DotNetBar;
-using System.Data.SqlClient;
-using System.Windows.Forms.DataVisualization.Charting;
-using GeoScene.Data;
-using GeoScene.Engine;
-using GeoScene.Globe;
-using System.Data.OracleClient;
-
-namespace Cyberpipe
-{
- public partial class FrmBSQDuoBianXingStatis : Office2007Form
- {
- Dictionary bsq = new Dictionary();
- Dictionary bsq1 = new Dictionary();
- static FrmBSQDuoBianXingStatis frm;
- GSOGlobeControl globeControl1;
- List list = new List();
- public static List pipeLists = new List();
-
- string[] codeStr = new string[50];
- string[] nameStr = new string[30];
- public static List typeLists;
-
- public FrmBSQDuoBianXingStatis(Dictionary workWellLen, GSOGlobeControl glb,List _list)
- {
- InitializeComponent();
- bsq = workWellLen;
- globeControl1 = glb;
- list = _list;
- }
-
- private void FrmBSQDuoBianXingStatis_Load(object sender, EventArgs e)
- {
- FrmBSQDuoBianXingStatisFenLei();
- try
- {
- chart1.Series.Add("标识器");
- chart1.ChartAreas["ChartArea1"].AxisX.Title = "标识器类型";
- chart1.ChartAreas["ChartArea1"].AxisY.Title = "标识器数量";
- chart1.ChartAreas["ChartArea1"].AxisX.Interval = 1;
- chart1.Series["标识器"].ChartType = SeriesChartType.Column;
- chart1.Series["标识器"]["DrawingStyle"] = "Cylinder";
-
- chart1.Series["标识器"].Points.DataBindXY(bsq1.Keys, bsq1.Values);
- if (bsq1.Values.Count == 0)
- {
- MessageBox.Show("该区域没有标识器信息", "提示");
- this.Close();
- return;
- }
- else
- {
- for (int m = 0; m < bsq1.Values.Count; m++)
- {
- if (chart1.Series["标识器"].Points[m].YValues[0].ToString() != "0")
- {
- chart1.Series["标识器"].Points[m].Label = chart1.Series[0].Points[m].YValues[0].ToString();
- }
- }
- }
- }
- catch (Exception ex)
- {
- //ErrorLog.PublishError(ex);
- }
- }
-
- private void FrmBSQDuoBianXingStatis_FormClosing(object sender, FormClosingEventArgs e)
- {
- frm = null;
- globeControl1.Globe.ClearAnalysis();
- globeControl1.Globe.MemoryLayer.RemoveAllFeature();
- }
-
-
- private void FrmBSQDuoBianXingStatisFenLei()
- {
- try
- {
- bool flag2 = false;
- for (int i = 0; i < Utility.listPipelineType.Count; i++)
- {
-
- for (int j = 0; j < pipeLists.Count; j++)
- {
- if (pipeLists[j] == Utility.listPipelineType[i].type)
- {
- flag2 = true;
- break;
- }
- }
- if (!flag2 && Utility.listPipelineType[i].type != "标识器")
- {
- pipeLists.Add(Utility.listPipelineType[i].type);
- }
- flag2 = false;
- }
-
- typeLists = new List();
- for (int num = 0; num < pipeLists.Count; num++)
- {
- typeList ls = new typeList(0, pipeLists[num]);
- typeLists.Add(ls);
- }
-
- GSOFeatures fs = list[0];
- string pipetype = "标识器";
- foreach (string key in bsq.Keys)
- {
- if (key.StartsWith(pipetype))
- {
- pipetype = key;
- break;
- }
- }
- if (fs.Length > 0)
- {
- for (int i = 0; i < fs.Length; i++)
- {
- string str = fs[i].GetValue("对象名称").ToString();
- codeStr = str.Split(',');
- for (int n = 0; n < codeStr.Length; n++)
- {
- for (int ii = 0; ii < Utility.listPipelineType.Count; ii++)
- {
- if (Utility.listPipelineType[ii].code == codeStr[n])
- {
- for (int m = 0; m < typeLists.Count; m++)
- {
- if (Utility.listPipelineType[ii].type == typeLists[m].type)
- {
- typeLists[m].num++;
- break;
- }
- }
- break;
- }
- }
- }
- }
- }
-
- for (int i = 0; i < typeLists.Count; i++)
- {
- if (typeLists[i].num > 0)
- bsq1.Add(typeLists[i].type, typeLists[i].num);
- }
-
- }
- catch (Exception ex)
- {
- //ErrorLog.PublishError(ex);
- //MessageBox.Show(ex.Message);
- }
-
- }
- public class typeList
- {
- public int num;
- public string type;
-
- public typeList(int _num, string _type)
- {
- num = _num;
- type = _type;
- }
- }
-
-
- }
-}
diff --git a/FrmBSQDuoBianXingStatis.resx b/FrmBSQDuoBianXingStatis.resx
deleted file mode 100644
index 1af7de1..0000000
--- a/FrmBSQDuoBianXingStatis.resx
+++ /dev/null
@@ -1,120 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- text/microsoft-resx
-
-
- 2.0
-
-
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
\ No newline at end of file
diff --git a/FrmBSQStatis.Designer.cs b/FrmBSQStatis.Designer.cs
index 2509c7d..ee9b1e7 100644
--- a/FrmBSQStatis.Designer.cs
+++ b/FrmBSQStatis.Designer.cs
@@ -57,6 +57,7 @@
this.ShowIcon = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "标识器全区域统计";
+ this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FrmBSQStatis_FormClosing);
this.Load += new System.EventHandler(this.FrmBSQStatis_Load);
((System.ComponentModel.ISupportInitialize)(this.chartStatis)).EndInit();
this.ResumeLayout(false);
diff --git a/FrmBSQStatis.cs b/FrmBSQStatis.cs
index 4b25eda..e7c4926 100644
--- a/FrmBSQStatis.cs
+++ b/FrmBSQStatis.cs
@@ -18,94 +18,18 @@
{
public partial class FrmBSQStatis : Office2007Form
{
- public Dictionary bsq = new Dictionary();
- //SqlConnection conn;
- public static List typeLists;
- OracleConnection conn;
- string connectString;
+ private Dictionary bsq = new Dictionary();
+ private GSOGlobeControl globeControl1;
+ private GSOGeoPolygon3D polygon;
- public FrmBSQStatis()
+ public FrmBSQStatis(GSOGlobeControl globeControl1,GSOGeoPolygon3D polygon)
{
+ this.globeControl1 = globeControl1;
+ this.polygon = polygon;
InitializeComponent();
- BSQNumStatis();
+ bsq = getBSQNameAndNumMap(polygon);
}
- string[] codeStr = new string[50];
- string[] nameStr = new string[30];
- public static List pipeLists = new List();
-
- private void BSQNumStatis()
- {
- bool flag2 = false;
- for (int i = 0; i < Utility.listPipelineType.Count; i++)
- {
- for (int j = 0; j < pipeLists.Count; j++)
- {
- if (pipeLists[j] == Utility.listPipelineType[i].type)
- {
- flag2 = true;
- break;
- }
- }
- if (!flag2 && Utility.listPipelineType[i].type != "标识器")
- {
- pipeLists.Add(Utility.listPipelineType[i].type);
- }
- flag2 = false;
- }
-
- typeLists = new List();
- for (int num = 0; num 0)
- bsq.Add(typeLists[i].type, typeLists[i].num);
- }
-
- }
- catch (Exception ex)
- {
-
- }
- }
private void FrmBSQStatis_Load(object sender, EventArgs e)
{
@@ -136,17 +60,88 @@
}
}
- public class typeList
+ private Dictionary getBSQNameAndNumMap(GSOGeoPolygon3D polygon)
{
- public int num;
- public string type;
- public typeList(int _num, string _type)
+ Dictionary result = new Dictionary();
+ Dictionary codeAndType = new Dictionary();
+ //得到type的种类
+ for (int i = 0; i < Utility.listPipelineType.Count; i++)
{
- num = _num;
- type = _type;
+ if (!result.ContainsKey(Utility.listPipelineType[i].type) && Utility.listPipelineType[i].type != "标识器")
+ {
+ result.Add(Utility.listPipelineType[i].type, 0);
+ codeAndType.Add(Utility.listPipelineType[i].code, Utility.listPipelineType[i].type);
+ }
+
}
+
+ return polygon == null ? getAllAreaMap(result, codeAndType) : getBSQMapByPolygon(polygon, result, codeAndType);
+
}
+ public Dictionary getAllAreaMap(Dictionary typeAndCount,Dictionary codeAndType)
+ {
+ try
+ {
+ OracleConnection conn = OledbHelper.sqlConnection();
+ conn.Open();
+ OracleCommand cmd;
+ cmd = new OracleCommand("select 对象类型 from 标识器", conn);
+ OracleDataReader dr = cmd.ExecuteReader();
+
+ while (dr.Read())
+ {
+ string str = Convert.ToString(dr["对象类型"]);
+ if (str == null) continue;
+ foreach (string key in codeAndType.Keys)
+ {
+ if (str.Contains(key))
+ {
+ typeAndCount[codeAndType[key]] += 1;
+ }
+ }
+ }
+ conn.Close();
+ }
+ catch (Exception ex)
+ {
+ LogHelper.WriteLog(typeof(FrmBSQStatis),ex.Message.ToString());
+ }
+ return typeAndCount;
+ }
+
+
+ public Dictionary getBSQMapByPolygon(GSOGeoPolygon3D polygon,Dictionary typeAndCount, Dictionary codeAndType)
+ {
+ GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption("标识器");
+ GSOFeatures bsqFs = FeatureStatisticsService.getLayerFeatures(polygon, layer);
+ if (bsqFs == null || bsqFs.Length <= 0) {
+ LogHelper.WriteLog(typeof(FrmBSQStatis),"标识器图层下的Feature为空");
+ return null;
+ }
+
+ for (int i = 0; i < bsqFs.Length; i++)
+ {
+ string str = bsqFs[i].GetValue("对象类型").ToString();
+
+ foreach (string key in codeAndType.Keys)
+ {
+ if (str.Contains(key))
+ {
+ typeAndCount[codeAndType[key]] += 1;
+ }
+ }
+ }
+
+ return typeAndCount;
+ }
+
+ private void FrmBSQStatis_FormClosing(object sender, FormClosingEventArgs e)
+ {
+ globeControl1.Globe.ClearAnalysis();
+ }
+
+
}
}
diff --git a/FrmValveStatistics.cs b/FrmValveStatistics.cs
index 672f97a..17dad6c 100644
--- a/FrmValveStatistics.cs
+++ b/FrmValveStatistics.cs
@@ -120,6 +120,7 @@
sql += " where 1>2 ";
for (int i = 0; i < fs.Length; i++)
{
+ if (fs[i].GetValue("编号") == null) continue;
sql += " or 编号 = '" + fs[i].GetValue("编号").ToString() + "'";
}
diff --git a/FrmpipeDeepstatis.cs b/FrmpipeDeepstatis.cs
index 879801a..c7edbc3 100644
--- a/FrmpipeDeepstatis.cs
+++ b/FrmpipeDeepstatis.cs
@@ -164,88 +164,6 @@
}
}
- //if (clbPipeLine.CheckedItems.Count > 0)
- //{
- // if (dataGridViewX2.Rows.Count > 0)
- // {
- // for (int i = 0; i < clbPipeLine.CheckedItems.Count; i++)
- // {
- // GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(clbPipeLine.CheckedItems[i].ToString());
- // GSOFeatureLayer flayer = layer as GSOFeatureLayer;
- // GSOFeatures feats = new GSOFeatures();
- // if (polygon == null)
- // feats = flayer.GetAllFeatures();
- // else
- // feats = flayer.FindFeaturesInPolygon(polygon, false);
- // for (int j = 0; j < dataGridViewX2.Rows.Count; j++)
- // {
- // double totalLength = 0.00;
- // int ncount = 0;
- // for (int m = 0; m < feats.Length; m++)
- // {
- // GSOFeature feat = feats[m];
- // float radius = feat.GetFieldAsFloat("起始埋深");
- // bool upCompare = true;
- // bool downCompare = true;
- // if (dataGridViewX2.Rows[j].Cells["下限"].Value != null || dataGridViewX2.Rows[j].Cells["上限"].Value != null)
- // {
- // if (dataGridViewX2.Rows[j].Cells["下限"].Value != null)
- // {
- // if (dataGridViewX2.Rows[j].Cells["下限"].Value.ToString() != "")
- // {
- // if (radius >= Convert.ToDouble(dataGridViewX2.Rows[j].Cells["下限"].Value))
- // {
- // downCompare = true;
- // }
- // else
- // downCompare = false;
- // }
- // }
- // if (dataGridViewX2.Rows[j].Cells["上限"].Value != null)
- // {
- // if (dataGridViewX2.Rows[j].Cells["上限"].Value.ToString() != "")
- // {
- // if (radius <= Convert.ToDouble(dataGridViewX2.Rows[j].Cells["上限"].Value))
- // {
- // upCompare = true;
- // }
- // else
- // upCompare = false;
- // }
- // }
- // if (upCompare && downCompare)
- // {
- // GSOGeoPolyline3D line = feat.Geometry as GSOGeoPolyline3D;
- // double length = line.GetSpaceLength(true, 6378137);
- // totalLength += length;
- // ncount += 1;
- // }
- // }
- // }
- // if (dataGridViewX2.Rows[j].Cells["下限"].Value != null || dataGridViewX2.Rows[j].Cells["上限"].Value != null)
- // {
- // DataGridViewRow row = new DataGridViewRow();
- // int index = dataGridViewX1.Rows.Add(row);
- // row = dataGridViewX1.Rows[index];
- // row.Cells["图层名称"].Value = layer.Caption;
- // row.Cells["埋深范围"].Value = dataGridViewX2.Rows[j].Cells["下限"].Value + "-" + dataGridViewX2.Rows[j].Cells["上限"].Value;
- // row.Cells["条数"].Value = ncount;
- // row.Cells["总长度"].Value =Math.Round(totalLength,2);
-
- // dic.Add(layer.Caption + "," + row.Cells["埋深范围"].Value.ToString()+","+row.Cells["总长度"].Value.ToString(), ncount);
- // }
- // }
- // }
- // }
- // else
- // {
- // MessageBox.Show("请添加分段!");
- // }
- //}
- //else
- //{
- // MessageBox.Show("请选择图层!");
- //}
showPipeWidget();
}
catch (Exception ex)
diff --git a/FrmpipeMaterialGather.cs b/FrmpipeMaterialGather.cs
index b7ab1d2..3e9f45d 100644
--- a/FrmpipeMaterialGather.cs
+++ b/FrmpipeMaterialGather.cs
@@ -180,79 +180,6 @@
}
- //if (clbPipeLine.CheckedItems.Count > 0)
- //{
- // for (int i = 0; i < clbPipeLine.CheckedItems.Count; i++)
- // {
- // GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(clbPipeLine.CheckedItems[i].ToString());
- // GSOFeatureLayer flayer = layer as GSOFeatureLayer;
- // GSOFeatures feats = new GSOFeatures();
- // if (polygon == null)
- // feats = flayer.GetAllFeatures();
- // else
- // feats = flayer.FindFeaturesInPolygon(polygon, false);
- // List lstDiameter = new List();
-
- // for (int j = 0; j < clbmaterials.CheckedItems.Count; j++)
- // {
- // if (!lstDiameter.Contains(clbmaterials.CheckedItems[j].ToString()))
- // {
- // lstDiameter.Add(clbmaterials.CheckedItems[j].ToString());
- // }
- // }
- // //lstDiameter.Sort();
- // if (lstDiameter.Count > 0)
- // {
- // for (int m = 0; m < lstDiameter.Count; m++)
- // {
- // double totalLength = 0.00;
- // int ncount = 0;
- // for (int j = 0; j < feats.Length; j++)
- // {
- // if (lstDiameter[m] != "无")
- // {
- // if (feats[j].GetFieldAsString("材质") == lstDiameter[m])
- // {
- // GSOGeoPolyline3D line = feats[j].Geometry as GSOGeoPolyline3D;
- // if (line != null)
- // {
- // double length = line.GetSpaceLength(true, 6378137);
- // totalLength += length;
- // ncount += 1;
- // }
- // }
- // }
- // else
- // {
- // if (feats[j].GetFieldAsString("材质") == "")
- // {
- // GSOGeoPolyline3D line = feats[j].Geometry as GSOGeoPolyline3D;
- // if (line != null)
- // {
- // double length = line.GetSpaceLength(true, 6378137);
- // totalLength += length;
- // ncount += 1;
- // }
- // }
- // }
- // }
- // DataGridViewRow row = new DataGridViewRow();
- // int index = dataGridViewX1.Rows.Add(row);
- // row = dataGridViewX1.Rows[index];
- // row.Cells["图层名称"].Value = layer.Caption;
- // row.Cells["材质"].Value = lstDiameter[m];
- // row.Cells["条数"].Value = ncount;
- // row.Cells["总长度"].Value = Math.Round(totalLength);
-
- // dic.Add(layer.Caption + "," + row.Cells["材质"].Value.ToString(), ncount);
- // }
- // }
- // }
- //}
- //else
- //{
- // MessageBox.Show("请选择图层!");
- //}
showPipeWidget();
}
catch (Exception ex)
diff --git a/Cyberpipe.csproj b/Cyberpipe.csproj
index 3a45ad8..d22f590 100644
--- a/Cyberpipe.csproj
+++ b/Cyberpipe.csproj
@@ -402,12 +402,6 @@
FrmBACKORACLE.cs
-
- Form
-
-
- FrmBSQDuoBianXingStatis.cs
-
Form
@@ -1271,9 +1265,6 @@
FrmBACKORACLE.cs
-
- FrmBSQDuoBianXingStatis.cs
-
FrmBSQStatis.cs
diff --git a/FeatureStatisticsService.cs b/FeatureStatisticsService.cs
index e833e5f..c7de210 100644
--- a/FeatureStatisticsService.cs
+++ b/FeatureStatisticsService.cs
@@ -273,19 +273,15 @@
/// 获取特定区域图层的管线列表,并将其总长度统计出来
/// TODOLIST:将Intersects_Pipeline在MainFrm中去除
///
- ///
+ ///
+ /// 要统计的长度
///
public static GSOFeatures getLayerPipes(GSOGeoPolygon3D polygon, GSOLayer layer, out double length)
{
length = 0;
if (layer == null) return null;
- GSOFeatureLayer flayer = layer as GSOFeatureLayer;
- GSOFeatureDataset fdataset = flayer.Dataset as GSOFeatureDataset;
- GSOFeatures feats = null;
-
- feats = polygon == null?flayer.GetAllFeatures():flayer.FindFeaturesInPolygon(polygon, false);
-
+ GSOFeatures feats = getLayerFeatures(polygon, layer);
double totallength = 0.00;
for (int i = 0; i < feats.Length; i++)
{
@@ -301,5 +297,17 @@
return feats;
}
+ ///
+ /// 获取区域图层内的feature列表,MainFrm.PolygonIntersectAnalysis和此方法重复,需要整理删除
+ ///
+ ///
+ ///
+ ///
+ public static GSOFeatures getLayerFeatures(GSOGeoPolygon3D polygon, GSOLayer layer)
+ {
+ if (layer == null) return null;
+ GSOFeatureLayer flayer = layer as GSOFeatureLayer;
+ return polygon == null ? flayer.GetAllFeatures() : flayer.FindFeaturesInPolygon(polygon, false);
+ }
}
}
diff --git a/FrmAllWorkWellStatis.cs b/FrmAllWorkWellStatis.cs
index 7bf65dc..bd0f81b 100644
--- a/FrmAllWorkWellStatis.cs
+++ b/FrmAllWorkWellStatis.cs
@@ -19,17 +19,7 @@
private Dictionary map = null;
private GSOGlobeControl globeControl1;
private GSOGeoPolygon3D polygon;
- //TODOLIST:用晓伟的代理进行操作,功能拆分细化
- //public FrmAllWorkWellStatis(GSOGeoPolygon3D polygon, DataGridView dataGridViewX11, ToolStripStatusLabel toolStripNumbers1, GSOGlobeControl ctl, PanelEx p)
- //{
- // InitializeComponent();
- // panel = p;
- // dataGridViewX1 = dataGridViewX11;
- // toolStripNumbers = toolStripNumbers1;
- // globeControl1 = ctl;
- // map = getAccsMap(polygon);
- //}
public FrmAllWorkWellStatis(GSOGlobeControl ctl,GSOGeoPolygon3D polygon, MainFrm.DataGridViewDelegate InitDataGridViewX1)
{
InitializeComponent();
@@ -117,8 +107,9 @@
sql = "select " + getpipeLineFields.getFields(layername, globeControl1) + " from " + layer.Name;
sql += " where 1>2 ";
- for (int i = 0; i < fs.Length && fs[i].GetFieldDefn("编号") != null; i++)
+ for (int i = 0; i < fs.Length; i++)
{
+ if (fs[i].GetFieldDefn("编号") == null) continue;
sql += " or 编号 = '" + fs[i].GetValue("编号").ToString() + "'";
}
diff --git a/FrmBSQDuoBianXingStatis.Designer.cs b/FrmBSQDuoBianXingStatis.Designer.cs
deleted file mode 100644
index bda6842..0000000
--- a/FrmBSQDuoBianXingStatis.Designer.cs
+++ /dev/null
@@ -1,87 +0,0 @@
-namespace Cyberpipe
-{
- partial class FrmBSQDuoBianXingStatis
- {
- ///
- /// Required designer variable.
- ///
- private System.ComponentModel.IContainer components = null;
-
- ///
- /// Clean up any resources being used.
- ///
- /// true if managed resources should be disposed; otherwise, false.
- protected override void Dispose(bool disposing)
- {
- if (disposing && (components != null))
- {
- components.Dispose();
- }
- base.Dispose(disposing);
- }
-
- #region Windows Form Designer generated code
-
- ///
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- ///
- private void InitializeComponent()
- {
- System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea1 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
- this.groupBox1 = new System.Windows.Forms.GroupBox();
- this.chart1 = new System.Windows.Forms.DataVisualization.Charting.Chart();
- this.groupBox1.SuspendLayout();
- ((System.ComponentModel.ISupportInitialize)(this.chart1)).BeginInit();
- this.SuspendLayout();
- //
- // groupBox1
- //
- this.groupBox1.Controls.Add(this.chart1);
- this.groupBox1.Dock = System.Windows.Forms.DockStyle.Fill;
- this.groupBox1.Location = new System.Drawing.Point(0, 0);
- this.groupBox1.Name = "groupBox1";
- this.groupBox1.Size = new System.Drawing.Size(592, 384);
- this.groupBox1.TabIndex = 0;
- this.groupBox1.TabStop = false;
- this.groupBox1.Text = "统计结果信息";
- //
- // chart1
- //
- chartArea1.AxisX.MajorGrid.Enabled = false;
- chartArea1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(191)))), ((int)(((byte)(219)))), ((int)(((byte)(255)))));
- chartArea1.BackGradientStyle = System.Windows.Forms.DataVisualization.Charting.GradientStyle.TopBottom;
- chartArea1.Name = "ChartArea1";
- this.chart1.ChartAreas.Add(chartArea1);
- this.chart1.Dock = System.Windows.Forms.DockStyle.Fill;
- this.chart1.Location = new System.Drawing.Point(3, 17);
- this.chart1.Name = "chart1";
- this.chart1.Size = new System.Drawing.Size(586, 364);
- this.chart1.TabIndex = 0;
- this.chart1.Text = "chart1";
- //
- // FrmBSQDuoBianXingStatis
- //
- this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.ClientSize = new System.Drawing.Size(592, 384);
- this.Controls.Add(this.groupBox1);
- this.DoubleBuffered = true;
- this.Name = "FrmBSQDuoBianXingStatis";
- this.ShowIcon = false;
- this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
- this.Text = "多边形区域统计";
- this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FrmBSQDuoBianXingStatis_FormClosing);
- this.Load += new System.EventHandler(this.FrmBSQDuoBianXingStatis_Load);
- this.groupBox1.ResumeLayout(false);
- ((System.ComponentModel.ISupportInitialize)(this.chart1)).EndInit();
- this.ResumeLayout(false);
-
- }
-
- #endregion
-
- private System.Windows.Forms.GroupBox groupBox1;
- private System.Windows.Forms.DataVisualization.Charting.Chart chart1;
- }
-}
\ No newline at end of file
diff --git a/FrmBSQDuoBianXingStatis.cs b/FrmBSQDuoBianXingStatis.cs
deleted file mode 100644
index 80b567e..0000000
--- a/FrmBSQDuoBianXingStatis.cs
+++ /dev/null
@@ -1,179 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Data;
-using System.Drawing;
-using System.Linq;
-using System.Text;
-using System.Windows.Forms;
-using DevComponents.DotNetBar;
-using System.Data.SqlClient;
-using System.Windows.Forms.DataVisualization.Charting;
-using GeoScene.Data;
-using GeoScene.Engine;
-using GeoScene.Globe;
-using System.Data.OracleClient;
-
-namespace Cyberpipe
-{
- public partial class FrmBSQDuoBianXingStatis : Office2007Form
- {
- Dictionary bsq = new Dictionary();
- Dictionary bsq1 = new Dictionary();
- static FrmBSQDuoBianXingStatis frm;
- GSOGlobeControl globeControl1;
- List list = new List();
- public static List pipeLists = new List();
-
- string[] codeStr = new string[50];
- string[] nameStr = new string[30];
- public static List typeLists;
-
- public FrmBSQDuoBianXingStatis(Dictionary workWellLen, GSOGlobeControl glb,List _list)
- {
- InitializeComponent();
- bsq = workWellLen;
- globeControl1 = glb;
- list = _list;
- }
-
- private void FrmBSQDuoBianXingStatis_Load(object sender, EventArgs e)
- {
- FrmBSQDuoBianXingStatisFenLei();
- try
- {
- chart1.Series.Add("标识器");
- chart1.ChartAreas["ChartArea1"].AxisX.Title = "标识器类型";
- chart1.ChartAreas["ChartArea1"].AxisY.Title = "标识器数量";
- chart1.ChartAreas["ChartArea1"].AxisX.Interval = 1;
- chart1.Series["标识器"].ChartType = SeriesChartType.Column;
- chart1.Series["标识器"]["DrawingStyle"] = "Cylinder";
-
- chart1.Series["标识器"].Points.DataBindXY(bsq1.Keys, bsq1.Values);
- if (bsq1.Values.Count == 0)
- {
- MessageBox.Show("该区域没有标识器信息", "提示");
- this.Close();
- return;
- }
- else
- {
- for (int m = 0; m < bsq1.Values.Count; m++)
- {
- if (chart1.Series["标识器"].Points[m].YValues[0].ToString() != "0")
- {
- chart1.Series["标识器"].Points[m].Label = chart1.Series[0].Points[m].YValues[0].ToString();
- }
- }
- }
- }
- catch (Exception ex)
- {
- //ErrorLog.PublishError(ex);
- }
- }
-
- private void FrmBSQDuoBianXingStatis_FormClosing(object sender, FormClosingEventArgs e)
- {
- frm = null;
- globeControl1.Globe.ClearAnalysis();
- globeControl1.Globe.MemoryLayer.RemoveAllFeature();
- }
-
-
- private void FrmBSQDuoBianXingStatisFenLei()
- {
- try
- {
- bool flag2 = false;
- for (int i = 0; i < Utility.listPipelineType.Count; i++)
- {
-
- for (int j = 0; j < pipeLists.Count; j++)
- {
- if (pipeLists[j] == Utility.listPipelineType[i].type)
- {
- flag2 = true;
- break;
- }
- }
- if (!flag2 && Utility.listPipelineType[i].type != "标识器")
- {
- pipeLists.Add(Utility.listPipelineType[i].type);
- }
- flag2 = false;
- }
-
- typeLists = new List();
- for (int num = 0; num < pipeLists.Count; num++)
- {
- typeList ls = new typeList(0, pipeLists[num]);
- typeLists.Add(ls);
- }
-
- GSOFeatures fs = list[0];
- string pipetype = "标识器";
- foreach (string key in bsq.Keys)
- {
- if (key.StartsWith(pipetype))
- {
- pipetype = key;
- break;
- }
- }
- if (fs.Length > 0)
- {
- for (int i = 0; i < fs.Length; i++)
- {
- string str = fs[i].GetValue("对象名称").ToString();
- codeStr = str.Split(',');
- for (int n = 0; n < codeStr.Length; n++)
- {
- for (int ii = 0; ii < Utility.listPipelineType.Count; ii++)
- {
- if (Utility.listPipelineType[ii].code == codeStr[n])
- {
- for (int m = 0; m < typeLists.Count; m++)
- {
- if (Utility.listPipelineType[ii].type == typeLists[m].type)
- {
- typeLists[m].num++;
- break;
- }
- }
- break;
- }
- }
- }
- }
- }
-
- for (int i = 0; i < typeLists.Count; i++)
- {
- if (typeLists[i].num > 0)
- bsq1.Add(typeLists[i].type, typeLists[i].num);
- }
-
- }
- catch (Exception ex)
- {
- //ErrorLog.PublishError(ex);
- //MessageBox.Show(ex.Message);
- }
-
- }
- public class typeList
- {
- public int num;
- public string type;
-
- public typeList(int _num, string _type)
- {
- num = _num;
- type = _type;
- }
- }
-
-
- }
-}
diff --git a/FrmBSQDuoBianXingStatis.resx b/FrmBSQDuoBianXingStatis.resx
deleted file mode 100644
index 1af7de1..0000000
--- a/FrmBSQDuoBianXingStatis.resx
+++ /dev/null
@@ -1,120 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- text/microsoft-resx
-
-
- 2.0
-
-
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
\ No newline at end of file
diff --git a/FrmBSQStatis.Designer.cs b/FrmBSQStatis.Designer.cs
index 2509c7d..ee9b1e7 100644
--- a/FrmBSQStatis.Designer.cs
+++ b/FrmBSQStatis.Designer.cs
@@ -57,6 +57,7 @@
this.ShowIcon = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "标识器全区域统计";
+ this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FrmBSQStatis_FormClosing);
this.Load += new System.EventHandler(this.FrmBSQStatis_Load);
((System.ComponentModel.ISupportInitialize)(this.chartStatis)).EndInit();
this.ResumeLayout(false);
diff --git a/FrmBSQStatis.cs b/FrmBSQStatis.cs
index 4b25eda..e7c4926 100644
--- a/FrmBSQStatis.cs
+++ b/FrmBSQStatis.cs
@@ -18,94 +18,18 @@
{
public partial class FrmBSQStatis : Office2007Form
{
- public Dictionary bsq = new Dictionary();
- //SqlConnection conn;
- public static List typeLists;
- OracleConnection conn;
- string connectString;
+ private Dictionary bsq = new Dictionary();
+ private GSOGlobeControl globeControl1;
+ private GSOGeoPolygon3D polygon;
- public FrmBSQStatis()
+ public FrmBSQStatis(GSOGlobeControl globeControl1,GSOGeoPolygon3D polygon)
{
+ this.globeControl1 = globeControl1;
+ this.polygon = polygon;
InitializeComponent();
- BSQNumStatis();
+ bsq = getBSQNameAndNumMap(polygon);
}
- string[] codeStr = new string[50];
- string[] nameStr = new string[30];
- public static List pipeLists = new List();
-
- private void BSQNumStatis()
- {
- bool flag2 = false;
- for (int i = 0; i < Utility.listPipelineType.Count; i++)
- {
- for (int j = 0; j < pipeLists.Count; j++)
- {
- if (pipeLists[j] == Utility.listPipelineType[i].type)
- {
- flag2 = true;
- break;
- }
- }
- if (!flag2 && Utility.listPipelineType[i].type != "标识器")
- {
- pipeLists.Add(Utility.listPipelineType[i].type);
- }
- flag2 = false;
- }
-
- typeLists = new List();
- for (int num = 0; num 0)
- bsq.Add(typeLists[i].type, typeLists[i].num);
- }
-
- }
- catch (Exception ex)
- {
-
- }
- }
private void FrmBSQStatis_Load(object sender, EventArgs e)
{
@@ -136,17 +60,88 @@
}
}
- public class typeList
+ private Dictionary getBSQNameAndNumMap(GSOGeoPolygon3D polygon)
{
- public int num;
- public string type;
- public typeList(int _num, string _type)
+ Dictionary result = new Dictionary();
+ Dictionary codeAndType = new Dictionary();
+ //得到type的种类
+ for (int i = 0; i < Utility.listPipelineType.Count; i++)
{
- num = _num;
- type = _type;
+ if (!result.ContainsKey(Utility.listPipelineType[i].type) && Utility.listPipelineType[i].type != "标识器")
+ {
+ result.Add(Utility.listPipelineType[i].type, 0);
+ codeAndType.Add(Utility.listPipelineType[i].code, Utility.listPipelineType[i].type);
+ }
+
}
+
+ return polygon == null ? getAllAreaMap(result, codeAndType) : getBSQMapByPolygon(polygon, result, codeAndType);
+
}
+ public Dictionary getAllAreaMap(Dictionary typeAndCount,Dictionary codeAndType)
+ {
+ try
+ {
+ OracleConnection conn = OledbHelper.sqlConnection();
+ conn.Open();
+ OracleCommand cmd;
+ cmd = new OracleCommand("select 对象类型 from 标识器", conn);
+ OracleDataReader dr = cmd.ExecuteReader();
+
+ while (dr.Read())
+ {
+ string str = Convert.ToString(dr["对象类型"]);
+ if (str == null) continue;
+ foreach (string key in codeAndType.Keys)
+ {
+ if (str.Contains(key))
+ {
+ typeAndCount[codeAndType[key]] += 1;
+ }
+ }
+ }
+ conn.Close();
+ }
+ catch (Exception ex)
+ {
+ LogHelper.WriteLog(typeof(FrmBSQStatis),ex.Message.ToString());
+ }
+ return typeAndCount;
+ }
+
+
+ public Dictionary getBSQMapByPolygon(GSOGeoPolygon3D polygon,Dictionary typeAndCount, Dictionary codeAndType)
+ {
+ GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption("标识器");
+ GSOFeatures bsqFs = FeatureStatisticsService.getLayerFeatures(polygon, layer);
+ if (bsqFs == null || bsqFs.Length <= 0) {
+ LogHelper.WriteLog(typeof(FrmBSQStatis),"标识器图层下的Feature为空");
+ return null;
+ }
+
+ for (int i = 0; i < bsqFs.Length; i++)
+ {
+ string str = bsqFs[i].GetValue("对象类型").ToString();
+
+ foreach (string key in codeAndType.Keys)
+ {
+ if (str.Contains(key))
+ {
+ typeAndCount[codeAndType[key]] += 1;
+ }
+ }
+ }
+
+ return typeAndCount;
+ }
+
+ private void FrmBSQStatis_FormClosing(object sender, FormClosingEventArgs e)
+ {
+ globeControl1.Globe.ClearAnalysis();
+ }
+
+
}
}
diff --git a/FrmValveStatistics.cs b/FrmValveStatistics.cs
index 672f97a..17dad6c 100644
--- a/FrmValveStatistics.cs
+++ b/FrmValveStatistics.cs
@@ -120,6 +120,7 @@
sql += " where 1>2 ";
for (int i = 0; i < fs.Length; i++)
{
+ if (fs[i].GetValue("编号") == null) continue;
sql += " or 编号 = '" + fs[i].GetValue("编号").ToString() + "'";
}
diff --git a/FrmpipeDeepstatis.cs b/FrmpipeDeepstatis.cs
index 879801a..c7edbc3 100644
--- a/FrmpipeDeepstatis.cs
+++ b/FrmpipeDeepstatis.cs
@@ -164,88 +164,6 @@
}
}
- //if (clbPipeLine.CheckedItems.Count > 0)
- //{
- // if (dataGridViewX2.Rows.Count > 0)
- // {
- // for (int i = 0; i < clbPipeLine.CheckedItems.Count; i++)
- // {
- // GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(clbPipeLine.CheckedItems[i].ToString());
- // GSOFeatureLayer flayer = layer as GSOFeatureLayer;
- // GSOFeatures feats = new GSOFeatures();
- // if (polygon == null)
- // feats = flayer.GetAllFeatures();
- // else
- // feats = flayer.FindFeaturesInPolygon(polygon, false);
- // for (int j = 0; j < dataGridViewX2.Rows.Count; j++)
- // {
- // double totalLength = 0.00;
- // int ncount = 0;
- // for (int m = 0; m < feats.Length; m++)
- // {
- // GSOFeature feat = feats[m];
- // float radius = feat.GetFieldAsFloat("起始埋深");
- // bool upCompare = true;
- // bool downCompare = true;
- // if (dataGridViewX2.Rows[j].Cells["下限"].Value != null || dataGridViewX2.Rows[j].Cells["上限"].Value != null)
- // {
- // if (dataGridViewX2.Rows[j].Cells["下限"].Value != null)
- // {
- // if (dataGridViewX2.Rows[j].Cells["下限"].Value.ToString() != "")
- // {
- // if (radius >= Convert.ToDouble(dataGridViewX2.Rows[j].Cells["下限"].Value))
- // {
- // downCompare = true;
- // }
- // else
- // downCompare = false;
- // }
- // }
- // if (dataGridViewX2.Rows[j].Cells["上限"].Value != null)
- // {
- // if (dataGridViewX2.Rows[j].Cells["上限"].Value.ToString() != "")
- // {
- // if (radius <= Convert.ToDouble(dataGridViewX2.Rows[j].Cells["上限"].Value))
- // {
- // upCompare = true;
- // }
- // else
- // upCompare = false;
- // }
- // }
- // if (upCompare && downCompare)
- // {
- // GSOGeoPolyline3D line = feat.Geometry as GSOGeoPolyline3D;
- // double length = line.GetSpaceLength(true, 6378137);
- // totalLength += length;
- // ncount += 1;
- // }
- // }
- // }
- // if (dataGridViewX2.Rows[j].Cells["下限"].Value != null || dataGridViewX2.Rows[j].Cells["上限"].Value != null)
- // {
- // DataGridViewRow row = new DataGridViewRow();
- // int index = dataGridViewX1.Rows.Add(row);
- // row = dataGridViewX1.Rows[index];
- // row.Cells["图层名称"].Value = layer.Caption;
- // row.Cells["埋深范围"].Value = dataGridViewX2.Rows[j].Cells["下限"].Value + "-" + dataGridViewX2.Rows[j].Cells["上限"].Value;
- // row.Cells["条数"].Value = ncount;
- // row.Cells["总长度"].Value =Math.Round(totalLength,2);
-
- // dic.Add(layer.Caption + "," + row.Cells["埋深范围"].Value.ToString()+","+row.Cells["总长度"].Value.ToString(), ncount);
- // }
- // }
- // }
- // }
- // else
- // {
- // MessageBox.Show("请添加分段!");
- // }
- //}
- //else
- //{
- // MessageBox.Show("请选择图层!");
- //}
showPipeWidget();
}
catch (Exception ex)
diff --git a/FrmpipeMaterialGather.cs b/FrmpipeMaterialGather.cs
index b7ab1d2..3e9f45d 100644
--- a/FrmpipeMaterialGather.cs
+++ b/FrmpipeMaterialGather.cs
@@ -180,79 +180,6 @@
}
- //if (clbPipeLine.CheckedItems.Count > 0)
- //{
- // for (int i = 0; i < clbPipeLine.CheckedItems.Count; i++)
- // {
- // GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(clbPipeLine.CheckedItems[i].ToString());
- // GSOFeatureLayer flayer = layer as GSOFeatureLayer;
- // GSOFeatures feats = new GSOFeatures();
- // if (polygon == null)
- // feats = flayer.GetAllFeatures();
- // else
- // feats = flayer.FindFeaturesInPolygon(polygon, false);
- // List lstDiameter = new List();
-
- // for (int j = 0; j < clbmaterials.CheckedItems.Count; j++)
- // {
- // if (!lstDiameter.Contains(clbmaterials.CheckedItems[j].ToString()))
- // {
- // lstDiameter.Add(clbmaterials.CheckedItems[j].ToString());
- // }
- // }
- // //lstDiameter.Sort();
- // if (lstDiameter.Count > 0)
- // {
- // for (int m = 0; m < lstDiameter.Count; m++)
- // {
- // double totalLength = 0.00;
- // int ncount = 0;
- // for (int j = 0; j < feats.Length; j++)
- // {
- // if (lstDiameter[m] != "无")
- // {
- // if (feats[j].GetFieldAsString("材质") == lstDiameter[m])
- // {
- // GSOGeoPolyline3D line = feats[j].Geometry as GSOGeoPolyline3D;
- // if (line != null)
- // {
- // double length = line.GetSpaceLength(true, 6378137);
- // totalLength += length;
- // ncount += 1;
- // }
- // }
- // }
- // else
- // {
- // if (feats[j].GetFieldAsString("材质") == "")
- // {
- // GSOGeoPolyline3D line = feats[j].Geometry as GSOGeoPolyline3D;
- // if (line != null)
- // {
- // double length = line.GetSpaceLength(true, 6378137);
- // totalLength += length;
- // ncount += 1;
- // }
- // }
- // }
- // }
- // DataGridViewRow row = new DataGridViewRow();
- // int index = dataGridViewX1.Rows.Add(row);
- // row = dataGridViewX1.Rows[index];
- // row.Cells["图层名称"].Value = layer.Caption;
- // row.Cells["材质"].Value = lstDiameter[m];
- // row.Cells["条数"].Value = ncount;
- // row.Cells["总长度"].Value = Math.Round(totalLength);
-
- // dic.Add(layer.Caption + "," + row.Cells["材质"].Value.ToString(), ncount);
- // }
- // }
- // }
- //}
- //else
- //{
- // MessageBox.Show("请选择图层!");
- //}
showPipeWidget();
}
catch (Exception ex)
diff --git a/Frmpipediameterstatis.cs b/Frmpipediameterstatis.cs
index 9953ac0..aa482d8 100644
--- a/Frmpipediameterstatis.cs
+++ b/Frmpipediameterstatis.cs
@@ -27,12 +27,9 @@
frm = new Frmpipediameterstatis(_globeControl1, pipeLayers, visibleId);
frm.Show(_globeControl1.Parent);
}
- else
+ else if (frm.WindowState == FormWindowState.Minimized)
{
- if (frm.WindowState == FormWindowState.Minimized)
- {
- frm.WindowState = FormWindowState.Normal;
- }
+ frm.WindowState = FormWindowState.Normal;
}
}
@@ -208,7 +205,8 @@
}
catch (Exception ex)
{
- MessageBox.Show(ex.Message);
+ LogHelper.WriteLog(typeof(Frmpipediameterstatis), ex.Message);
+ //MessageBox.Show(ex.Message);
LogError.PublishError(ex);
}
}
@@ -290,76 +288,77 @@
///
private void btnExport_Click(object sender, EventArgs e)
{
- if (dataGridViewX1.Rows.Count > 0)
+ if (dataGridViewX1.Rows.Count <= 0)
{
- SaveFileDialog dlg = new SaveFileDialog();
- dlg.Filter = "Excel files (*.xls)|*.xls";
- dlg.FilterIndex = 0;
- dlg.RestoreDirectory = true;
- //dlg.CreatePrompt = true;
- dlg.Title = "保存为Excel文件";
- dlg.FileName = DateTime.Now.ToString("yyyyMMdd") + ".xls";
- if (dlg.ShowDialog() == DialogResult.OK)
+ MessageBox.Show("统计结果为空,请重新统计之后再导出Excel!", "提示");
+ return;
+ }
+
+ SaveFileDialog dlg = new SaveFileDialog();
+ dlg.Filter = "Excel files (*.xls)|*.xls";
+ dlg.FilterIndex = 0;
+ dlg.RestoreDirectory = true;
+ //dlg.CreatePrompt = true;
+ dlg.Title = "保存为Excel文件";
+ dlg.FileName = DateTime.Now.ToString("yyyyMMdd") + ".xls";
+ if (dlg.ShowDialog() == DialogResult.OK)
+ {
+ Stream myStream;
+ myStream = dlg.OpenFile();
+ StreamWriter sw = new StreamWriter(myStream, System.Text.Encoding.GetEncoding(-0));
+ string columnTitle = "";
+ try
{
- Stream myStream;
- myStream = dlg.OpenFile();
- StreamWriter sw = new StreamWriter(myStream, System.Text.Encoding.GetEncoding(-0));
- string columnTitle = "";
- try
+ sw.WriteLine("日期:" + DateTime.Now.ToString("yyyy-MM-dd"));
+
+ //写入列标题
+ for (int i = 0; i < dataGridViewX1.ColumnCount; i++)
{
- sw.WriteLine("日期:" + DateTime.Now.ToString("yyyy-MM-dd"));
-
- //写入列标题
- for (int i = 0; i < dataGridViewX1.ColumnCount; i++)
+ if (i > 0)
{
- if (i > 0)
- {
- columnTitle += "\t";
- }
- columnTitle += dataGridViewX1.Columns[i].HeaderText;
+ columnTitle += "\t";
}
- sw.WriteLine(columnTitle);
-
- //写入列内容
- for (int j = 0; j < dataGridViewX1.Rows.Count; j++)
- {
- string columnValue = "";
- for (int k = 0; k < dataGridViewX1.Columns.Count; k++)
- {
- if (k > 0)
- {
- columnValue += "\t";
- }
- if (dataGridViewX1.Rows[j].Cells[k].Value == null)
- columnValue += "";
- else
- columnValue += dataGridViewX1.Rows[j].Cells[k].Value.ToString().Trim();
- }
-
- sw.WriteLine(columnValue);
- }
- sw.Close();
- myStream.Close();
- if (MessageBox.Show("导出Excel文件成功!是否打开?", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
- {
- System.Diagnostics.Process.Start(dlg.FileName);
- }
+ columnTitle += dataGridViewX1.Columns[i].HeaderText;
}
- catch (Exception ex)
+ sw.WriteLine(columnTitle);
+
+ //写入列内容
+ for (int j = 0; j < dataGridViewX1.Rows.Count; j++)
{
- MessageBox.Show(ex.ToString());
+ string columnValue = "";
+ for (int k = 0; k < dataGridViewX1.Columns.Count; k++)
+ {
+ if (k > 0)
+ {
+ columnValue += "\t";
+ }
+ if (dataGridViewX1.Rows[j].Cells[k].Value == null)
+ columnValue += "";
+ else
+ columnValue += dataGridViewX1.Rows[j].Cells[k].Value.ToString().Trim();
+ }
+
+ sw.WriteLine(columnValue);
}
- finally
+ sw.Close();
+ myStream.Close();
+ if (MessageBox.Show("导出Excel文件成功!是否打开?", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
{
- sw.Close();
- myStream.Close();
+ System.Diagnostics.Process.Start(dlg.FileName);
}
}
+ catch (Exception ex)
+ {
+ MessageBox.Show(ex.ToString());
+ }
+ finally
+ {
+ sw.Close();
+ myStream.Close();
+ }
}
- else
- {
- MessageBox.Show("统计结果为空,请重新统计之后再导出Excel!","提示");
- }
+
+
}
///
/// 绘制区域分段统计
diff --git a/Cyberpipe.csproj b/Cyberpipe.csproj
index 3a45ad8..d22f590 100644
--- a/Cyberpipe.csproj
+++ b/Cyberpipe.csproj
@@ -402,12 +402,6 @@
FrmBACKORACLE.cs
-
- Form
-
-
- FrmBSQDuoBianXingStatis.cs
-
Form
@@ -1271,9 +1265,6 @@
FrmBACKORACLE.cs
-
- FrmBSQDuoBianXingStatis.cs
-
FrmBSQStatis.cs
diff --git a/FeatureStatisticsService.cs b/FeatureStatisticsService.cs
index e833e5f..c7de210 100644
--- a/FeatureStatisticsService.cs
+++ b/FeatureStatisticsService.cs
@@ -273,19 +273,15 @@
/// 获取特定区域图层的管线列表,并将其总长度统计出来
/// TODOLIST:将Intersects_Pipeline在MainFrm中去除
///
- ///
+ ///
+ /// 要统计的长度
///
public static GSOFeatures getLayerPipes(GSOGeoPolygon3D polygon, GSOLayer layer, out double length)
{
length = 0;
if (layer == null) return null;
- GSOFeatureLayer flayer = layer as GSOFeatureLayer;
- GSOFeatureDataset fdataset = flayer.Dataset as GSOFeatureDataset;
- GSOFeatures feats = null;
-
- feats = polygon == null?flayer.GetAllFeatures():flayer.FindFeaturesInPolygon(polygon, false);
-
+ GSOFeatures feats = getLayerFeatures(polygon, layer);
double totallength = 0.00;
for (int i = 0; i < feats.Length; i++)
{
@@ -301,5 +297,17 @@
return feats;
}
+ ///
+ /// 获取区域图层内的feature列表,MainFrm.PolygonIntersectAnalysis和此方法重复,需要整理删除
+ ///
+ ///
+ ///
+ ///
+ public static GSOFeatures getLayerFeatures(GSOGeoPolygon3D polygon, GSOLayer layer)
+ {
+ if (layer == null) return null;
+ GSOFeatureLayer flayer = layer as GSOFeatureLayer;
+ return polygon == null ? flayer.GetAllFeatures() : flayer.FindFeaturesInPolygon(polygon, false);
+ }
}
}
diff --git a/FrmAllWorkWellStatis.cs b/FrmAllWorkWellStatis.cs
index 7bf65dc..bd0f81b 100644
--- a/FrmAllWorkWellStatis.cs
+++ b/FrmAllWorkWellStatis.cs
@@ -19,17 +19,7 @@
private Dictionary map = null;
private GSOGlobeControl globeControl1;
private GSOGeoPolygon3D polygon;
- //TODOLIST:用晓伟的代理进行操作,功能拆分细化
- //public FrmAllWorkWellStatis(GSOGeoPolygon3D polygon, DataGridView dataGridViewX11, ToolStripStatusLabel toolStripNumbers1, GSOGlobeControl ctl, PanelEx p)
- //{
- // InitializeComponent();
- // panel = p;
- // dataGridViewX1 = dataGridViewX11;
- // toolStripNumbers = toolStripNumbers1;
- // globeControl1 = ctl;
- // map = getAccsMap(polygon);
- //}
public FrmAllWorkWellStatis(GSOGlobeControl ctl,GSOGeoPolygon3D polygon, MainFrm.DataGridViewDelegate InitDataGridViewX1)
{
InitializeComponent();
@@ -117,8 +107,9 @@
sql = "select " + getpipeLineFields.getFields(layername, globeControl1) + " from " + layer.Name;
sql += " where 1>2 ";
- for (int i = 0; i < fs.Length && fs[i].GetFieldDefn("编号") != null; i++)
+ for (int i = 0; i < fs.Length; i++)
{
+ if (fs[i].GetFieldDefn("编号") == null) continue;
sql += " or 编号 = '" + fs[i].GetValue("编号").ToString() + "'";
}
diff --git a/FrmBSQDuoBianXingStatis.Designer.cs b/FrmBSQDuoBianXingStatis.Designer.cs
deleted file mode 100644
index bda6842..0000000
--- a/FrmBSQDuoBianXingStatis.Designer.cs
+++ /dev/null
@@ -1,87 +0,0 @@
-namespace Cyberpipe
-{
- partial class FrmBSQDuoBianXingStatis
- {
- ///
- /// Required designer variable.
- ///
- private System.ComponentModel.IContainer components = null;
-
- ///
- /// Clean up any resources being used.
- ///
- /// true if managed resources should be disposed; otherwise, false.
- protected override void Dispose(bool disposing)
- {
- if (disposing && (components != null))
- {
- components.Dispose();
- }
- base.Dispose(disposing);
- }
-
- #region Windows Form Designer generated code
-
- ///
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- ///
- private void InitializeComponent()
- {
- System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea1 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
- this.groupBox1 = new System.Windows.Forms.GroupBox();
- this.chart1 = new System.Windows.Forms.DataVisualization.Charting.Chart();
- this.groupBox1.SuspendLayout();
- ((System.ComponentModel.ISupportInitialize)(this.chart1)).BeginInit();
- this.SuspendLayout();
- //
- // groupBox1
- //
- this.groupBox1.Controls.Add(this.chart1);
- this.groupBox1.Dock = System.Windows.Forms.DockStyle.Fill;
- this.groupBox1.Location = new System.Drawing.Point(0, 0);
- this.groupBox1.Name = "groupBox1";
- this.groupBox1.Size = new System.Drawing.Size(592, 384);
- this.groupBox1.TabIndex = 0;
- this.groupBox1.TabStop = false;
- this.groupBox1.Text = "统计结果信息";
- //
- // chart1
- //
- chartArea1.AxisX.MajorGrid.Enabled = false;
- chartArea1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(191)))), ((int)(((byte)(219)))), ((int)(((byte)(255)))));
- chartArea1.BackGradientStyle = System.Windows.Forms.DataVisualization.Charting.GradientStyle.TopBottom;
- chartArea1.Name = "ChartArea1";
- this.chart1.ChartAreas.Add(chartArea1);
- this.chart1.Dock = System.Windows.Forms.DockStyle.Fill;
- this.chart1.Location = new System.Drawing.Point(3, 17);
- this.chart1.Name = "chart1";
- this.chart1.Size = new System.Drawing.Size(586, 364);
- this.chart1.TabIndex = 0;
- this.chart1.Text = "chart1";
- //
- // FrmBSQDuoBianXingStatis
- //
- this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.ClientSize = new System.Drawing.Size(592, 384);
- this.Controls.Add(this.groupBox1);
- this.DoubleBuffered = true;
- this.Name = "FrmBSQDuoBianXingStatis";
- this.ShowIcon = false;
- this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
- this.Text = "多边形区域统计";
- this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FrmBSQDuoBianXingStatis_FormClosing);
- this.Load += new System.EventHandler(this.FrmBSQDuoBianXingStatis_Load);
- this.groupBox1.ResumeLayout(false);
- ((System.ComponentModel.ISupportInitialize)(this.chart1)).EndInit();
- this.ResumeLayout(false);
-
- }
-
- #endregion
-
- private System.Windows.Forms.GroupBox groupBox1;
- private System.Windows.Forms.DataVisualization.Charting.Chart chart1;
- }
-}
\ No newline at end of file
diff --git a/FrmBSQDuoBianXingStatis.cs b/FrmBSQDuoBianXingStatis.cs
deleted file mode 100644
index 80b567e..0000000
--- a/FrmBSQDuoBianXingStatis.cs
+++ /dev/null
@@ -1,179 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Data;
-using System.Drawing;
-using System.Linq;
-using System.Text;
-using System.Windows.Forms;
-using DevComponents.DotNetBar;
-using System.Data.SqlClient;
-using System.Windows.Forms.DataVisualization.Charting;
-using GeoScene.Data;
-using GeoScene.Engine;
-using GeoScene.Globe;
-using System.Data.OracleClient;
-
-namespace Cyberpipe
-{
- public partial class FrmBSQDuoBianXingStatis : Office2007Form
- {
- Dictionary bsq = new Dictionary();
- Dictionary bsq1 = new Dictionary();
- static FrmBSQDuoBianXingStatis frm;
- GSOGlobeControl globeControl1;
- List list = new List();
- public static List pipeLists = new List();
-
- string[] codeStr = new string[50];
- string[] nameStr = new string[30];
- public static List typeLists;
-
- public FrmBSQDuoBianXingStatis(Dictionary workWellLen, GSOGlobeControl glb,List _list)
- {
- InitializeComponent();
- bsq = workWellLen;
- globeControl1 = glb;
- list = _list;
- }
-
- private void FrmBSQDuoBianXingStatis_Load(object sender, EventArgs e)
- {
- FrmBSQDuoBianXingStatisFenLei();
- try
- {
- chart1.Series.Add("标识器");
- chart1.ChartAreas["ChartArea1"].AxisX.Title = "标识器类型";
- chart1.ChartAreas["ChartArea1"].AxisY.Title = "标识器数量";
- chart1.ChartAreas["ChartArea1"].AxisX.Interval = 1;
- chart1.Series["标识器"].ChartType = SeriesChartType.Column;
- chart1.Series["标识器"]["DrawingStyle"] = "Cylinder";
-
- chart1.Series["标识器"].Points.DataBindXY(bsq1.Keys, bsq1.Values);
- if (bsq1.Values.Count == 0)
- {
- MessageBox.Show("该区域没有标识器信息", "提示");
- this.Close();
- return;
- }
- else
- {
- for (int m = 0; m < bsq1.Values.Count; m++)
- {
- if (chart1.Series["标识器"].Points[m].YValues[0].ToString() != "0")
- {
- chart1.Series["标识器"].Points[m].Label = chart1.Series[0].Points[m].YValues[0].ToString();
- }
- }
- }
- }
- catch (Exception ex)
- {
- //ErrorLog.PublishError(ex);
- }
- }
-
- private void FrmBSQDuoBianXingStatis_FormClosing(object sender, FormClosingEventArgs e)
- {
- frm = null;
- globeControl1.Globe.ClearAnalysis();
- globeControl1.Globe.MemoryLayer.RemoveAllFeature();
- }
-
-
- private void FrmBSQDuoBianXingStatisFenLei()
- {
- try
- {
- bool flag2 = false;
- for (int i = 0; i < Utility.listPipelineType.Count; i++)
- {
-
- for (int j = 0; j < pipeLists.Count; j++)
- {
- if (pipeLists[j] == Utility.listPipelineType[i].type)
- {
- flag2 = true;
- break;
- }
- }
- if (!flag2 && Utility.listPipelineType[i].type != "标识器")
- {
- pipeLists.Add(Utility.listPipelineType[i].type);
- }
- flag2 = false;
- }
-
- typeLists = new List();
- for (int num = 0; num < pipeLists.Count; num++)
- {
- typeList ls = new typeList(0, pipeLists[num]);
- typeLists.Add(ls);
- }
-
- GSOFeatures fs = list[0];
- string pipetype = "标识器";
- foreach (string key in bsq.Keys)
- {
- if (key.StartsWith(pipetype))
- {
- pipetype = key;
- break;
- }
- }
- if (fs.Length > 0)
- {
- for (int i = 0; i < fs.Length; i++)
- {
- string str = fs[i].GetValue("对象名称").ToString();
- codeStr = str.Split(',');
- for (int n = 0; n < codeStr.Length; n++)
- {
- for (int ii = 0; ii < Utility.listPipelineType.Count; ii++)
- {
- if (Utility.listPipelineType[ii].code == codeStr[n])
- {
- for (int m = 0; m < typeLists.Count; m++)
- {
- if (Utility.listPipelineType[ii].type == typeLists[m].type)
- {
- typeLists[m].num++;
- break;
- }
- }
- break;
- }
- }
- }
- }
- }
-
- for (int i = 0; i < typeLists.Count; i++)
- {
- if (typeLists[i].num > 0)
- bsq1.Add(typeLists[i].type, typeLists[i].num);
- }
-
- }
- catch (Exception ex)
- {
- //ErrorLog.PublishError(ex);
- //MessageBox.Show(ex.Message);
- }
-
- }
- public class typeList
- {
- public int num;
- public string type;
-
- public typeList(int _num, string _type)
- {
- num = _num;
- type = _type;
- }
- }
-
-
- }
-}
diff --git a/FrmBSQDuoBianXingStatis.resx b/FrmBSQDuoBianXingStatis.resx
deleted file mode 100644
index 1af7de1..0000000
--- a/FrmBSQDuoBianXingStatis.resx
+++ /dev/null
@@ -1,120 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- text/microsoft-resx
-
-
- 2.0
-
-
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
\ No newline at end of file
diff --git a/FrmBSQStatis.Designer.cs b/FrmBSQStatis.Designer.cs
index 2509c7d..ee9b1e7 100644
--- a/FrmBSQStatis.Designer.cs
+++ b/FrmBSQStatis.Designer.cs
@@ -57,6 +57,7 @@
this.ShowIcon = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "标识器全区域统计";
+ this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FrmBSQStatis_FormClosing);
this.Load += new System.EventHandler(this.FrmBSQStatis_Load);
((System.ComponentModel.ISupportInitialize)(this.chartStatis)).EndInit();
this.ResumeLayout(false);
diff --git a/FrmBSQStatis.cs b/FrmBSQStatis.cs
index 4b25eda..e7c4926 100644
--- a/FrmBSQStatis.cs
+++ b/FrmBSQStatis.cs
@@ -18,94 +18,18 @@
{
public partial class FrmBSQStatis : Office2007Form
{
- public Dictionary bsq = new Dictionary();
- //SqlConnection conn;
- public static List typeLists;
- OracleConnection conn;
- string connectString;
+ private Dictionary bsq = new Dictionary();
+ private GSOGlobeControl globeControl1;
+ private GSOGeoPolygon3D polygon;
- public FrmBSQStatis()
+ public FrmBSQStatis(GSOGlobeControl globeControl1,GSOGeoPolygon3D polygon)
{
+ this.globeControl1 = globeControl1;
+ this.polygon = polygon;
InitializeComponent();
- BSQNumStatis();
+ bsq = getBSQNameAndNumMap(polygon);
}
- string[] codeStr = new string[50];
- string[] nameStr = new string[30];
- public static List pipeLists = new List();
-
- private void BSQNumStatis()
- {
- bool flag2 = false;
- for (int i = 0; i < Utility.listPipelineType.Count; i++)
- {
- for (int j = 0; j < pipeLists.Count; j++)
- {
- if (pipeLists[j] == Utility.listPipelineType[i].type)
- {
- flag2 = true;
- break;
- }
- }
- if (!flag2 && Utility.listPipelineType[i].type != "标识器")
- {
- pipeLists.Add(Utility.listPipelineType[i].type);
- }
- flag2 = false;
- }
-
- typeLists = new List();
- for (int num = 0; num 0)
- bsq.Add(typeLists[i].type, typeLists[i].num);
- }
-
- }
- catch (Exception ex)
- {
-
- }
- }
private void FrmBSQStatis_Load(object sender, EventArgs e)
{
@@ -136,17 +60,88 @@
}
}
- public class typeList
+ private Dictionary getBSQNameAndNumMap(GSOGeoPolygon3D polygon)
{
- public int num;
- public string type;
- public typeList(int _num, string _type)
+ Dictionary result = new Dictionary();
+ Dictionary codeAndType = new Dictionary();
+ //得到type的种类
+ for (int i = 0; i < Utility.listPipelineType.Count; i++)
{
- num = _num;
- type = _type;
+ if (!result.ContainsKey(Utility.listPipelineType[i].type) && Utility.listPipelineType[i].type != "标识器")
+ {
+ result.Add(Utility.listPipelineType[i].type, 0);
+ codeAndType.Add(Utility.listPipelineType[i].code, Utility.listPipelineType[i].type);
+ }
+
}
+
+ return polygon == null ? getAllAreaMap(result, codeAndType) : getBSQMapByPolygon(polygon, result, codeAndType);
+
}
+ public Dictionary getAllAreaMap(Dictionary typeAndCount,Dictionary codeAndType)
+ {
+ try
+ {
+ OracleConnection conn = OledbHelper.sqlConnection();
+ conn.Open();
+ OracleCommand cmd;
+ cmd = new OracleCommand("select 对象类型 from 标识器", conn);
+ OracleDataReader dr = cmd.ExecuteReader();
+
+ while (dr.Read())
+ {
+ string str = Convert.ToString(dr["对象类型"]);
+ if (str == null) continue;
+ foreach (string key in codeAndType.Keys)
+ {
+ if (str.Contains(key))
+ {
+ typeAndCount[codeAndType[key]] += 1;
+ }
+ }
+ }
+ conn.Close();
+ }
+ catch (Exception ex)
+ {
+ LogHelper.WriteLog(typeof(FrmBSQStatis),ex.Message.ToString());
+ }
+ return typeAndCount;
+ }
+
+
+ public Dictionary getBSQMapByPolygon(GSOGeoPolygon3D polygon,Dictionary typeAndCount, Dictionary codeAndType)
+ {
+ GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption("标识器");
+ GSOFeatures bsqFs = FeatureStatisticsService.getLayerFeatures(polygon, layer);
+ if (bsqFs == null || bsqFs.Length <= 0) {
+ LogHelper.WriteLog(typeof(FrmBSQStatis),"标识器图层下的Feature为空");
+ return null;
+ }
+
+ for (int i = 0; i < bsqFs.Length; i++)
+ {
+ string str = bsqFs[i].GetValue("对象类型").ToString();
+
+ foreach (string key in codeAndType.Keys)
+ {
+ if (str.Contains(key))
+ {
+ typeAndCount[codeAndType[key]] += 1;
+ }
+ }
+ }
+
+ return typeAndCount;
+ }
+
+ private void FrmBSQStatis_FormClosing(object sender, FormClosingEventArgs e)
+ {
+ globeControl1.Globe.ClearAnalysis();
+ }
+
+
}
}
diff --git a/FrmValveStatistics.cs b/FrmValveStatistics.cs
index 672f97a..17dad6c 100644
--- a/FrmValveStatistics.cs
+++ b/FrmValveStatistics.cs
@@ -120,6 +120,7 @@
sql += " where 1>2 ";
for (int i = 0; i < fs.Length; i++)
{
+ if (fs[i].GetValue("编号") == null) continue;
sql += " or 编号 = '" + fs[i].GetValue("编号").ToString() + "'";
}
diff --git a/FrmpipeDeepstatis.cs b/FrmpipeDeepstatis.cs
index 879801a..c7edbc3 100644
--- a/FrmpipeDeepstatis.cs
+++ b/FrmpipeDeepstatis.cs
@@ -164,88 +164,6 @@
}
}
- //if (clbPipeLine.CheckedItems.Count > 0)
- //{
- // if (dataGridViewX2.Rows.Count > 0)
- // {
- // for (int i = 0; i < clbPipeLine.CheckedItems.Count; i++)
- // {
- // GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(clbPipeLine.CheckedItems[i].ToString());
- // GSOFeatureLayer flayer = layer as GSOFeatureLayer;
- // GSOFeatures feats = new GSOFeatures();
- // if (polygon == null)
- // feats = flayer.GetAllFeatures();
- // else
- // feats = flayer.FindFeaturesInPolygon(polygon, false);
- // for (int j = 0; j < dataGridViewX2.Rows.Count; j++)
- // {
- // double totalLength = 0.00;
- // int ncount = 0;
- // for (int m = 0; m < feats.Length; m++)
- // {
- // GSOFeature feat = feats[m];
- // float radius = feat.GetFieldAsFloat("起始埋深");
- // bool upCompare = true;
- // bool downCompare = true;
- // if (dataGridViewX2.Rows[j].Cells["下限"].Value != null || dataGridViewX2.Rows[j].Cells["上限"].Value != null)
- // {
- // if (dataGridViewX2.Rows[j].Cells["下限"].Value != null)
- // {
- // if (dataGridViewX2.Rows[j].Cells["下限"].Value.ToString() != "")
- // {
- // if (radius >= Convert.ToDouble(dataGridViewX2.Rows[j].Cells["下限"].Value))
- // {
- // downCompare = true;
- // }
- // else
- // downCompare = false;
- // }
- // }
- // if (dataGridViewX2.Rows[j].Cells["上限"].Value != null)
- // {
- // if (dataGridViewX2.Rows[j].Cells["上限"].Value.ToString() != "")
- // {
- // if (radius <= Convert.ToDouble(dataGridViewX2.Rows[j].Cells["上限"].Value))
- // {
- // upCompare = true;
- // }
- // else
- // upCompare = false;
- // }
- // }
- // if (upCompare && downCompare)
- // {
- // GSOGeoPolyline3D line = feat.Geometry as GSOGeoPolyline3D;
- // double length = line.GetSpaceLength(true, 6378137);
- // totalLength += length;
- // ncount += 1;
- // }
- // }
- // }
- // if (dataGridViewX2.Rows[j].Cells["下限"].Value != null || dataGridViewX2.Rows[j].Cells["上限"].Value != null)
- // {
- // DataGridViewRow row = new DataGridViewRow();
- // int index = dataGridViewX1.Rows.Add(row);
- // row = dataGridViewX1.Rows[index];
- // row.Cells["图层名称"].Value = layer.Caption;
- // row.Cells["埋深范围"].Value = dataGridViewX2.Rows[j].Cells["下限"].Value + "-" + dataGridViewX2.Rows[j].Cells["上限"].Value;
- // row.Cells["条数"].Value = ncount;
- // row.Cells["总长度"].Value =Math.Round(totalLength,2);
-
- // dic.Add(layer.Caption + "," + row.Cells["埋深范围"].Value.ToString()+","+row.Cells["总长度"].Value.ToString(), ncount);
- // }
- // }
- // }
- // }
- // else
- // {
- // MessageBox.Show("请添加分段!");
- // }
- //}
- //else
- //{
- // MessageBox.Show("请选择图层!");
- //}
showPipeWidget();
}
catch (Exception ex)
diff --git a/FrmpipeMaterialGather.cs b/FrmpipeMaterialGather.cs
index b7ab1d2..3e9f45d 100644
--- a/FrmpipeMaterialGather.cs
+++ b/FrmpipeMaterialGather.cs
@@ -180,79 +180,6 @@
}
- //if (clbPipeLine.CheckedItems.Count > 0)
- //{
- // for (int i = 0; i < clbPipeLine.CheckedItems.Count; i++)
- // {
- // GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(clbPipeLine.CheckedItems[i].ToString());
- // GSOFeatureLayer flayer = layer as GSOFeatureLayer;
- // GSOFeatures feats = new GSOFeatures();
- // if (polygon == null)
- // feats = flayer.GetAllFeatures();
- // else
- // feats = flayer.FindFeaturesInPolygon(polygon, false);
- // List lstDiameter = new List();
-
- // for (int j = 0; j < clbmaterials.CheckedItems.Count; j++)
- // {
- // if (!lstDiameter.Contains(clbmaterials.CheckedItems[j].ToString()))
- // {
- // lstDiameter.Add(clbmaterials.CheckedItems[j].ToString());
- // }
- // }
- // //lstDiameter.Sort();
- // if (lstDiameter.Count > 0)
- // {
- // for (int m = 0; m < lstDiameter.Count; m++)
- // {
- // double totalLength = 0.00;
- // int ncount = 0;
- // for (int j = 0; j < feats.Length; j++)
- // {
- // if (lstDiameter[m] != "无")
- // {
- // if (feats[j].GetFieldAsString("材质") == lstDiameter[m])
- // {
- // GSOGeoPolyline3D line = feats[j].Geometry as GSOGeoPolyline3D;
- // if (line != null)
- // {
- // double length = line.GetSpaceLength(true, 6378137);
- // totalLength += length;
- // ncount += 1;
- // }
- // }
- // }
- // else
- // {
- // if (feats[j].GetFieldAsString("材质") == "")
- // {
- // GSOGeoPolyline3D line = feats[j].Geometry as GSOGeoPolyline3D;
- // if (line != null)
- // {
- // double length = line.GetSpaceLength(true, 6378137);
- // totalLength += length;
- // ncount += 1;
- // }
- // }
- // }
- // }
- // DataGridViewRow row = new DataGridViewRow();
- // int index = dataGridViewX1.Rows.Add(row);
- // row = dataGridViewX1.Rows[index];
- // row.Cells["图层名称"].Value = layer.Caption;
- // row.Cells["材质"].Value = lstDiameter[m];
- // row.Cells["条数"].Value = ncount;
- // row.Cells["总长度"].Value = Math.Round(totalLength);
-
- // dic.Add(layer.Caption + "," + row.Cells["材质"].Value.ToString(), ncount);
- // }
- // }
- // }
- //}
- //else
- //{
- // MessageBox.Show("请选择图层!");
- //}
showPipeWidget();
}
catch (Exception ex)
diff --git a/Frmpipediameterstatis.cs b/Frmpipediameterstatis.cs
index 9953ac0..aa482d8 100644
--- a/Frmpipediameterstatis.cs
+++ b/Frmpipediameterstatis.cs
@@ -27,12 +27,9 @@
frm = new Frmpipediameterstatis(_globeControl1, pipeLayers, visibleId);
frm.Show(_globeControl1.Parent);
}
- else
+ else if (frm.WindowState == FormWindowState.Minimized)
{
- if (frm.WindowState == FormWindowState.Minimized)
- {
- frm.WindowState = FormWindowState.Normal;
- }
+ frm.WindowState = FormWindowState.Normal;
}
}
@@ -208,7 +205,8 @@
}
catch (Exception ex)
{
- MessageBox.Show(ex.Message);
+ LogHelper.WriteLog(typeof(Frmpipediameterstatis), ex.Message);
+ //MessageBox.Show(ex.Message);
LogError.PublishError(ex);
}
}
@@ -290,76 +288,77 @@
///
private void btnExport_Click(object sender, EventArgs e)
{
- if (dataGridViewX1.Rows.Count > 0)
+ if (dataGridViewX1.Rows.Count <= 0)
{
- SaveFileDialog dlg = new SaveFileDialog();
- dlg.Filter = "Excel files (*.xls)|*.xls";
- dlg.FilterIndex = 0;
- dlg.RestoreDirectory = true;
- //dlg.CreatePrompt = true;
- dlg.Title = "保存为Excel文件";
- dlg.FileName = DateTime.Now.ToString("yyyyMMdd") + ".xls";
- if (dlg.ShowDialog() == DialogResult.OK)
+ MessageBox.Show("统计结果为空,请重新统计之后再导出Excel!", "提示");
+ return;
+ }
+
+ SaveFileDialog dlg = new SaveFileDialog();
+ dlg.Filter = "Excel files (*.xls)|*.xls";
+ dlg.FilterIndex = 0;
+ dlg.RestoreDirectory = true;
+ //dlg.CreatePrompt = true;
+ dlg.Title = "保存为Excel文件";
+ dlg.FileName = DateTime.Now.ToString("yyyyMMdd") + ".xls";
+ if (dlg.ShowDialog() == DialogResult.OK)
+ {
+ Stream myStream;
+ myStream = dlg.OpenFile();
+ StreamWriter sw = new StreamWriter(myStream, System.Text.Encoding.GetEncoding(-0));
+ string columnTitle = "";
+ try
{
- Stream myStream;
- myStream = dlg.OpenFile();
- StreamWriter sw = new StreamWriter(myStream, System.Text.Encoding.GetEncoding(-0));
- string columnTitle = "";
- try
+ sw.WriteLine("日期:" + DateTime.Now.ToString("yyyy-MM-dd"));
+
+ //写入列标题
+ for (int i = 0; i < dataGridViewX1.ColumnCount; i++)
{
- sw.WriteLine("日期:" + DateTime.Now.ToString("yyyy-MM-dd"));
-
- //写入列标题
- for (int i = 0; i < dataGridViewX1.ColumnCount; i++)
+ if (i > 0)
{
- if (i > 0)
- {
- columnTitle += "\t";
- }
- columnTitle += dataGridViewX1.Columns[i].HeaderText;
+ columnTitle += "\t";
}
- sw.WriteLine(columnTitle);
-
- //写入列内容
- for (int j = 0; j < dataGridViewX1.Rows.Count; j++)
- {
- string columnValue = "";
- for (int k = 0; k < dataGridViewX1.Columns.Count; k++)
- {
- if (k > 0)
- {
- columnValue += "\t";
- }
- if (dataGridViewX1.Rows[j].Cells[k].Value == null)
- columnValue += "";
- else
- columnValue += dataGridViewX1.Rows[j].Cells[k].Value.ToString().Trim();
- }
-
- sw.WriteLine(columnValue);
- }
- sw.Close();
- myStream.Close();
- if (MessageBox.Show("导出Excel文件成功!是否打开?", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
- {
- System.Diagnostics.Process.Start(dlg.FileName);
- }
+ columnTitle += dataGridViewX1.Columns[i].HeaderText;
}
- catch (Exception ex)
+ sw.WriteLine(columnTitle);
+
+ //写入列内容
+ for (int j = 0; j < dataGridViewX1.Rows.Count; j++)
{
- MessageBox.Show(ex.ToString());
+ string columnValue = "";
+ for (int k = 0; k < dataGridViewX1.Columns.Count; k++)
+ {
+ if (k > 0)
+ {
+ columnValue += "\t";
+ }
+ if (dataGridViewX1.Rows[j].Cells[k].Value == null)
+ columnValue += "";
+ else
+ columnValue += dataGridViewX1.Rows[j].Cells[k].Value.ToString().Trim();
+ }
+
+ sw.WriteLine(columnValue);
}
- finally
+ sw.Close();
+ myStream.Close();
+ if (MessageBox.Show("导出Excel文件成功!是否打开?", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
{
- sw.Close();
- myStream.Close();
+ System.Diagnostics.Process.Start(dlg.FileName);
}
}
+ catch (Exception ex)
+ {
+ MessageBox.Show(ex.ToString());
+ }
+ finally
+ {
+ sw.Close();
+ myStream.Close();
+ }
}
- else
- {
- MessageBox.Show("统计结果为空,请重新统计之后再导出Excel!","提示");
- }
+
+
}
///
/// 绘制区域分段统计
diff --git a/MainFrm.cs b/MainFrm.cs
index 0b7e393..9bfb70e 100644
--- a/MainFrm.cs
+++ b/MainFrm.cs
@@ -2667,12 +2667,195 @@
FrmBaseLineProfillAnalysis dlg = new FrmBaseLineProfillAnalysis(globeControl1.Globe, e.Polyline);
dlg.Show(this);
globeControl1.Globe.ClearLastTrackPolyline();
+ /*
+ FrmRoadHDM f = new FrmRoadHDM();
+ f.Show()
+ * **/
}
else
{
}
trackPolylineEndMode = EnumTrackPolylineEndMode.Default_Analysis;
+ /*
+ ArrayList arraylistPoint = new ArrayList();
+ ArrayList arraylistLine = new ArrayList();
+
+ // globeControl1.Globe.ClearLastTrackPolyline();
+
+ if (e.Polyline != null)
+ {
+ //横断面分析
+ if (buttonItemFX2_1.Checked || buttonItemFX2_3.Checked)
+ {
+ if (m_PipelineLayerNames != null)
+ {
+ GSOGeoPolygon3D polygon = e.Polyline.CreateBuffer(0.1, true, 5, true, false);
+ for (int i = 0; i < m_PipelineLayerNames.Count; i++)
+ {
+ if (m_PipelineLayerNames[i] != null)
+ {
+ GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(m_PipelineLayerNames[i]);
+ if (layer == null)
+ {
+ continue;
+ }
+ if (layer.Visible == false)
+ {
+ continue;
+ }
+ GSOFeatureLayer featurelayer = layer as GSOFeatureLayer;
+ if (featurelayer != null)
+ {
+ GSOFeatures feats = featurelayer.FindFeaturesInPolygon(polygon, false); //featurelayer.GetAllFeatures();
+ if (feats != null)
+ {
+ for (int j = 0; j < feats.Length; j++)
+ {
+ GSOFeature feateline = feats[j];
+ GSOGeoPolyline3D geoline = feateline.Geometry as GSOGeoPolyline3D;
+
+ if (geoline != null)
+ {
+ if (geoline.Style != null)
+ {
+ if (geoline.Style.GetType() == typeof(GSOPipeLineStyle3D))
+ {
+ GSOPoint3d pntIntersect1 = new GSOPoint3d();
+ GSOPoint3d pntIntersect2 = new GSOPoint3d();
+
+ double honLen;
+ double verLen;
+ double dDist = globeControl1.Globe.Analysis3D.ComputeTwoGeoPolylineDistance(e.Polyline, geoline, out pntIntersect1, out pntIntersect2, out honLen, out verLen, false, false, 0);
+
+ globeControl1.Globe.Action = EnumAction3D.ActionNull;
+ if (dDist > -1)
+ {
+ arraylistPoint.Add(pntIntersect2);
+ arraylistLine.Add(feateline);
+ }
+ }
+ }
+ }
+ }
+ }
+ else
+ {
+ MessageBox.Show("请重新绘制断面");
+ return;
+ }
+
+ }
+ }
+ }
+ }
+ if (buttonItemFX2_1.Checked)
+ {
+ FrmHDMAnalysis3 frm = FrmHDMAnalysis3.GetForm(arraylistPoint, arraylistLine, e.Polyline, globeControl1);
+ if (!frm.isShowFirst)
+ {
+ frm.Show(this);
+ }
+ frm.LoadChartEvent();
+ }
+ else
+ {
+ FrmRoadHDM frm = FrmRoadHDM.GetForm(arraylistPoint, arraylistLine, e.Polyline, globeControl1);
+ if (!frm.isShowFirst)
+ {
+ frm.Show(this);
+ }
+ frm.LoadChartEvent();
+ }
+ globeControl1.Globe.ClearLastTrackPolyline();
+ }
+ else if (buttonItemFX2_4.Checked)
+ {
+ FrmBaseLineProfillAnalysis dlg = new FrmBaseLineProfillAnalysis(globeControl1.Globe, e.Polyline);
+ dlg.Show(this);
+ globeControl1.Globe.ClearLastTrackPolyline();
+ }
+ else if (buttonItemFX4_3.Checked)
+ {
+ GSOGeoPolygon3D resPolygon = e.Polyline.CreateBuffer(m_dDigPitWidthAlongLine, false, 0, false, false);
+
+ GSOGeoPit geoPit = new GSOGeoPit();
+ geoPit.PitPolygon = resPolygon;
+ if (m_bDigPitByDepth)
+ {
+ geoPit.PitDepth = m_dDigPitValue;
+ geoPit.PitDepthUsing = true;
+ }
+ else
+ {
+ geoPit.PitBottomAlt = m_dDigPitValue;
+ geoPit.PitDepthUsing = false;
+ }
+
+ globeControl1.Globe.AddPit("", geoPit);
+ GSOLayer layerGround = globeControl1.Globe.Layers.GetLayerByCaption(roadLayerName);// ("180fd");
+ if (layerGround != null)
+ {
+ layerGround.Visible = false;
+ }
+ // 清除当前TrackPolygonAnalysis的痕迹
+ globeControl1.Globe.ClearLastTrackPolyline();
+ }
+ else if (distanceMarker)
+ {
+ setMarkerLayerUnVisible("距离标注");
+ GSOLayer l = globeControl1.Globe.Layers.GetLayerByCaption("距离标注");
+ if (l != null)
+ {
+ l.Visible = true;
+ if (getLabelName(l) != -1)
+ {
+ GSOGeoPolyline3D line = e.Polyline;
+ if (line.PartCount > 0)
+ {
+ double length = line.GetSpaceLength(true, 6378137);//线的长度
+ if (length == 0)
+ {
+ return;
+ }
+ else
+ {
+
+ GSOGeoPoint3D pt = new GSOGeoPoint3D();
+ GSOGeoPolyline3D lineLine = line.GetSegment(0, length / 2);
+ GSOPoint3d point3d = lineLine[lineLine.PartCount - 1][lineLine[lineLine.PartCount - 1].Count - 1];
+ pt.X = point3d.X;
+ pt.Y = point3d.Y;
+ pt.Z = point3d.Z;
+
+ string Twodecimalplaces = string.Format("{0:F}", length);
+ string radiusLabelName = "" + Twodecimalplaces + "米";
+ //string radiusLabelName = "" + length + "米";//标注名称
+
+ GSOPoint2d point2d = new GSOPoint2d(0, 30);//标注位置
+
+ int labelText = getLabelName(l);
+
+ GSOFeature newFeatureLine = new GSOFeature();
+ newFeatureLine.Geometry = line;
+ newFeatureLine.Name = (labelText + 1).ToString() + "-line";
+ l.AddFeature(newFeatureLine);
+ globeControl1.Globe.ClearLastTrackPolyline();
+
+ GSOFeature newFeature = new GSOFeature();
+ newFeature = createLabel(l, newFeature, pt, radiusLabelName, (labelText + 1).ToString(), point2d);
+ l.AddFeature(newFeature);
+
+ globeControl1.Refresh();
+ }
+ }
+ }
+ }
+ }
+ }
+ globeControl1.Globe.Action = EnumAction3D.ActionNull;
+ ActionToolMenuChecked();
+ * **/
}
#endregion
@@ -2713,16 +2896,20 @@
case "valvequery":
FrmValveStatistics frm = new FrmValveStatistics(globeControl1,polygon, new DataGridViewDelegate(InitDataGridViewX1));
frm.Show(this);
+ //panelEx6.Visible = true;
+ toolStripFeatureLength.Text = "";
globeControl1.Globe.Action = EnumAction3D.ActionNull;
break;
case "PipelineDistanceStatistics":
+
FrmAllPipelineStatis frm1 = new FrmAllPipelineStatis(globeControl1, polygon, new DataGridViewDelegate(InitDataGridViewX1), m_PipelineLayerNames);
frm1.Show(this);
globeControl1.Globe.Action = EnumAction3D.ActionNull;
break;
case "PipelineSpatialQuery":
+
FrmAllPipelineStatis.ShowForm(globeControl1,polygon,new DataGridViewDelegate(InitDataGridViewX1),m_PipelineLayerNames);
globeControl1.Globe.ClearAnalysis();
globeControl1.Globe.Action = EnumAction3D.ActionNull;
@@ -2771,18 +2958,19 @@
break;
case "BSQDuoBianXiangStatis":
- GSOFeature f2 = new GSOFeature();
- f2.Geometry = e.Polygon;
- f2.Geometry.AltitudeMode = EnumAltitudeMode.Absolute;
- globeControl1.Globe.MemoryLayer.AddFeature(f2);
- f2.Geometry.MoveZ(3);
- workWellLen.Clear();
- List listBSQ = new List();
+ //GSOFeature f2 = new GSOFeature();
+ //f2.Geometry = e.Polygon;
+ //f2.Geometry.AltitudeMode = EnumAltitudeMode.Absolute;
+ //globeControl1.Globe.MemoryLayer.AddFeature(f2);
+ //f2.Geometry.MoveZ(3);
+ //workWellLen.Clear();
+ //List listBSQ = new List();
- GSOFeatures bsqFeatures = PolygonIntersectAnalysis(e.Polygon, "标识器");
- listBSQ.Add(bsqFeatures);
+ //GSOFeatures bsqFeatures = PolygonIntersectAnalysis(e.Polygon, "标识器");
+ //listBSQ.Add(bsqFeatures);
- FrmBSQDuoBianXingStatis bsqFrm = new FrmBSQDuoBianXingStatis(workWellLen, globeControl1, listBSQ);
+ //FrmBSQDuoBianXingStatis bsqFrm = new FrmBSQDuoBianXingStatis(workWellLen, globeControl1, listBSQ);
+ FrmBSQStatis bsqFrm = new FrmBSQStatis(globeControl1,e.Polygon);
bsqFrm.Show(this);
globeControl1.Globe.Action = EnumAction3D.ActionNull;
break;
@@ -4351,6 +4539,26 @@
}
///
+ /// 在窗体的底部状态栏上显示 综合管线条件查询结果
+ ///
+ ///
+ ///
+ private void ToolStripText(string currentLayer, int dataCount)
+ {
+ if (dataCount != 0)
+ {
+ double featurelength = PipeLength(currentLayer, 0);// 统计管线的里程数
+
+ toolStripNumbers.Text =currentLayer + " | 共有:" + Convert.ToString(dataCount - 1) + "条记录";
+ toolStripFeatureLength.Text = " 管线里程:" + featurelength.ToString("0.00") + " 米";
+ }
+ else
+ {
+ toolStripNumbers.Text =currentLayer + "| 共有:" + 0 + " 条记录 | ";
+ }
+ }
+
+ ///
/// 统计管线的里程数
///
///
@@ -6824,6 +7032,54 @@
}
///
+ /// 创建label要素 功能
+ ///
+ /// 添加label要素的feature
+ /// feature的位置
+ /// label要素名字
+ /// feature名字
+ /// label要素距离点的位置
+ ///
+ private GSOFeature createLabel(GSOLayer layer, GSOFeature feature, GSOGeoPoint3D point, string labelName, string featureName, GSOPoint2d point2d)
+ {
+ for (int i = layer.GetAllFeatures().Length - 1; i >= 0; i--)
+ {
+ GSOFeature gfeat = layer.GetAt(i);
+ if (gfeat != null && gfeat.Geometry != null && gfeat.Geometry.Type == EnumGeometryType.GeoPoint3D)
+ {
+ GSOGeoPoint3D pointItem = gfeat.Geometry as GSOGeoPoint3D;
+ if (pointItem.X == point.X && pointItem.Y == point.Y && pointItem.Z == point.Z)
+ {
+ layer.RemoveAt(i);
+ break;
+ }
+ }
+ }
+ point.AltitudeMode = EnumAltitudeMode.RelativeToGround;
+ feature.Geometry = point;
+ feature.Name = featureName;
+ GSOLabel newLabel = new GSOLabel();
+ newLabel.Text = labelName;
+ newLabel.Style = new GSOLabelStyle();
+ newLabel.Style.Opaque = 0.8;
+ newLabel.Style.OutlineColor = Color.Gray;
+ newLabel.Style.TractionLineEndPos = point2d;
+ newLabel.Style.OutlineWidth = 1;
+ newLabel.Style.TracktionLineWidth = 1;
+ newLabel.Style.TractionLineColor = Color.Green;
+
+ Color color1 = Color.FromArgb(60, 187, 206, 230);
+ Color color2 = Color.FromArgb(150, 187, 200, 250);
+ newLabel.Style.BackBeginColor = color1;
+ newLabel.Style.BackEndColor = color2;
+
+ feature.Label = newLabel;
+ return feature;
+ }
+
+
+
+ ///
/// 获取指定两点组成的线的长度 功能
///
///
@@ -9266,8 +9522,19 @@
//日志记录
LogManager.saveLog(Utility.userName, "管线长度统计");
+ //pipeLineDis.Clear();
+ //List list = new List();
+ //for (int i = 0; i < m_PipelineLayerNames.Count; i++)
+ //{
+ // GSOFeatures fs = Intersects_Pipeline(null, m_PipelineLayerNames[i]);
+ // if (fs!=null)
+ // list.Add(fs);
+ //}
+
+ //FrmAllPipelineStatis frm = new FrmAllPipelineStatis(0, pipeLineDis, list, globeControl1, new DataGridViewDelegate(InitDataGridViewX1));
FrmAllPipelineStatis frm = new FrmAllPipelineStatis(globeControl1,null, new DataGridViewDelegate(InitDataGridViewX1), m_PipelineLayerNames);
frm.Show(this);
+
}
///
/// 管线长度绘制区域统计
@@ -9293,6 +9560,25 @@
//日志记录
LogManager.saveLog(Utility.userName, "阀门数量统计");
+ //workWellLen.Clear();
+ //List list = new List