| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292 |
- using System;
- using System.Collections.Generic;
- using WeifenLuo.WinFormsUI.Docking;
- using WWPipeLine.MapBasic.Conditions;
- using WWPipeLine.MapBasic;
- using SuperMap.Data;
- using SuperMap.Mapping;
- using System.Data;
- using System.Windows.Forms;
- using Sunny.UI;
- using System.Drawing;
- using System.Text;
- namespace WWPipeLine.MapTools.Conditions.AnalystToolBar
- {
- public class PengZhuang : ConditionPanel
- {
- private UIRadioButton uiRBpz;
- private UIRadioButton uiRBsp;
- private UIRadioButton uiRBcz;
- private UIPanel uiPanelgx;
- private UIRadioButtonGroup uiubg;
- private Label lbGxxinxi;
- Selection[] _selection;
- private UIPanel uiPanel1;
- private UITextBox uitbBanjing;
- private UILabel uiLabel1;
- private UILabel uiLabel2;
- Recordset _rdSelect = null;
- public PengZhuang() : base()
- {
- this.ConditionPanelName = "碰撞分析";
- this.IsShowResultWindow = false;
- InitializeComponent();
- this.SetSize(300, 300);
- }
- protected override void OnLoad(EventArgs e)
- {
- MapControl.Action = SuperMap.UI.Action.Select;
- ComsStatic.SetLayersIsSelectableFalse(ComsStatic.gsGuanXian.Name, true);
- MapControl.GeometrySelected += MapControl_GeometrySelected;
- }
- private void MapControl_GeometrySelected(object sender, SuperMap.UI.GeometrySelectedEventArgs e)
- {
- _selection = MapControl.Map.FindSelection(true);
- _rdSelect = _selection[0].ToRecordset();
- if (_rdSelect.Dataset.Name != ComsStatic.gsGuanXian.Name || _selection[0].Count != 1)
- {
- Sunny.UI.UIMessageTip.ShowError("仅可以选择管线图层,仅可以选择一条管线"); return;
- }
- DataTable dtSelectJSLK = ComsStatic.GetJSLKbyJSJDPT(ComsStatic.RecordsetToDataTable(_rdSelect, false));
- if (dtSelectJSLK.Rows.Count == 1)
- {
- StringBuilder jslk = new StringBuilder("选择管线的信息:\r\n");
- foreach (DataColumn dc in dtSelectJSLK.Columns)
- { //smid qsdh zddh
- if ((" qddmgc qdgdms qdgc zddmgc zdgdms zdgc").Contains(dc.ColumnName.ToLower()))
- jslk.Append(dc.Caption + ":" + dtSelectJSLK.Rows[0][dc.ColumnName] + "米\r\n");
- }
- lbGxxinxi.Text = jslk.ToString();
- }
- }
- private double[] getJingJu()
- {
- Recordset _rd = ComsStatic.dvConfig.Query(" pzlx='净距配置' ", CursorType.Static);
- if (_rd is null || _rd.RecordCount != 1) return new double[] { 0, 0 };
- _rd.MoveFirst();
- return new double[] { _rd.GetDouble("gxspjj"), _rd.GetDouble("gxczjj") };
- }
- public override object Do(DockPanel dockPanel = null)
- {
- if (_selection == null || _rdSelect.RecordCount != 1)
- {
- Sunny.UI.UIMessageTip.ShowError("请先选择一条需要分析的管线"); return false;
- }
- double[] jingju = getJingJu();
- if (jingju.Length != 2)
- {
- Sunny.UI.UIMessageTip.ShowError("未进行净距配置"); return false;
- }
- double banjing = ComsStatic.StringToDouble(uitbBanjing.Text);
- if (banjing == 0.0)
- {
- Sunny.UI.UIMessageTip.ShowError("请输入正确的分析半径"); return false;
- }
- _rdSelect.MoveFirst();
- Geometry geometry = _rdSelect.GetGeometry();
- int selectSMID = geometry.ID;
- //查询 当前选择的管线 半径内的管线 不包括废弃管线
- Recordset rd = ComsStatic.gsGuanXian.Query(geometry, banjing, " enabled=1 ", CursorType.Static);
- rd.MoveFirst();
- while (!rd.IsEOF)
- {
- geometry = rd.GetGeometry();
- geometry.Style = ComsStatic.geoStyle_Red_1mm_OpaqueRate;
- MapControl.Map.TrackingLayer.Add(geometry, "StartDraw");
- rd.MoveNext();
- }
- MapControl.Map.RefreshTrackingLayer();
- string fenxileixing = "碰撞";
- if (uiRBpz.Checked) fenxileixing = "碰撞";
- if (uiRBsp.Checked) fenxileixing = "水平";
- if (uiRBcz.Checked) fenxileixing = "垂直";
- DataTable dtFinal = ComsStatic.GetJSLKbyJSJDPT(ComsStatic.RecordsetToDataTable(rd));
- PengZhuangAnalystResult form = new PengZhuangAnalystResult(dtFinal, banjing, fenxileixing, selectSMID, jingju);
- //pengZhuangAnalystResult.ShowDialog();
- this.Invoke((MethodInvoker)delegate () { form.ShowDialog(); });
- return true;
- }
- public override void AfterClose()
- {
- ComsStatic.RecordsetDispose(_rdSelect);
- MapControl.GeometrySelected -= MapControl_GeometrySelected;
- base.AfterClose();
- }
- private void InitializeComponent()
- {
- this.uiubg = new Sunny.UI.UIRadioButtonGroup();
- this.uiPanel1 = new Sunny.UI.UIPanel();
- this.uiLabel2 = new Sunny.UI.UILabel();
- this.uitbBanjing = new Sunny.UI.UITextBox();
- this.uiLabel1 = new Sunny.UI.UILabel();
- this.uiRBcz = new Sunny.UI.UIRadioButton();
- this.uiRBsp = new Sunny.UI.UIRadioButton();
- this.uiRBpz = new Sunny.UI.UIRadioButton();
- this.uiPanelgx = new Sunny.UI.UIPanel();
- this.lbGxxinxi = new System.Windows.Forms.Label();
- this.uiubg.SuspendLayout();
- this.uiPanel1.SuspendLayout();
- this.uiPanelgx.SuspendLayout();
- this.SuspendLayout();
- //
- // uiubg
- //
- this.uiubg.ColumnCount = 3;
- this.uiubg.Controls.Add(this.uiPanel1);
- this.uiubg.Controls.Add(this.uiRBcz);
- this.uiubg.Controls.Add(this.uiRBsp);
- this.uiubg.Controls.Add(this.uiRBpz);
- this.uiubg.Dock = System.Windows.Forms.DockStyle.Left;
- this.uiubg.Font = new System.Drawing.Font("微软雅黑", 12F);
- this.uiubg.Location = new System.Drawing.Point(0, 0);
- this.uiubg.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
- this.uiubg.MinimumSize = new System.Drawing.Size(1, 1);
- this.uiubg.Name = "uiubg";
- this.uiubg.Padding = new System.Windows.Forms.Padding(0, 32, 0, 0);
- this.uiubg.Size = new System.Drawing.Size(133, 215);
- this.uiubg.TabIndex = 0;
- this.uiubg.Text = "分析类型";
- this.uiubg.TextAlignment = System.Drawing.ContentAlignment.MiddleCenter;
- //
- // uiPanel1
- //
- this.uiPanel1.Controls.Add(this.uiLabel2);
- this.uiPanel1.Controls.Add(this.uitbBanjing);
- this.uiPanel1.Controls.Add(this.uiLabel1);
- this.uiPanel1.Dock = System.Windows.Forms.DockStyle.Bottom;
- this.uiPanel1.Font = new System.Drawing.Font("微软雅黑", 12F);
- this.uiPanel1.Location = new System.Drawing.Point(0, 143);
- this.uiPanel1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
- this.uiPanel1.MinimumSize = new System.Drawing.Size(1, 1);
- this.uiPanel1.Name = "uiPanel1";
- this.uiPanel1.Size = new System.Drawing.Size(133, 72);
- this.uiPanel1.TabIndex = 3;
- this.uiPanel1.Text = null;
- this.uiPanel1.TextAlignment = System.Drawing.ContentAlignment.MiddleCenter;
- //
- // uiLabel2
- //
- this.uiLabel2.Font = new System.Drawing.Font("微软雅黑", 12F);
- this.uiLabel2.Location = new System.Drawing.Point(74, 37);
- this.uiLabel2.Name = "uiLabel2";
- this.uiLabel2.Size = new System.Drawing.Size(38, 23);
- this.uiLabel2.TabIndex = 2;
- this.uiLabel2.Text = "米";
- this.uiLabel2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
- //
- // uitbBanjing
- //
- this.uitbBanjing.Cursor = System.Windows.Forms.Cursors.IBeam;
- this.uitbBanjing.DoubleValue = 2D;
- this.uitbBanjing.FillColor = System.Drawing.Color.White;
- this.uitbBanjing.Font = new System.Drawing.Font("微软雅黑", 12F);
- this.uitbBanjing.IntValue = 2;
- this.uitbBanjing.Location = new System.Drawing.Point(8, 34);
- this.uitbBanjing.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
- this.uitbBanjing.Maximum = 2147483647D;
- this.uitbBanjing.MaxLength = 6;
- this.uitbBanjing.Minimum = -2147483648D;
- this.uitbBanjing.MinimumSize = new System.Drawing.Size(1, 1);
- this.uitbBanjing.Name = "uitbBanjing";
- this.uitbBanjing.Size = new System.Drawing.Size(59, 29);
- this.uitbBanjing.TabIndex = 1;
- this.uitbBanjing.Text = "2";
- this.uitbBanjing.TextAlignment = System.Drawing.ContentAlignment.MiddleLeft;
- this.uitbBanjing.KeyPress += new System.Windows.Forms.KeyPressEventHandler(ComsStatic.uiTextBox_num_KeyPress);
- //
- // uiLabel1
- //
- this.uiLabel1.Font = new System.Drawing.Font("微软雅黑", 12F);
- this.uiLabel1.Location = new System.Drawing.Point(8, 7);
- this.uiLabel1.Name = "uiLabel1";
- this.uiLabel1.Size = new System.Drawing.Size(104, 23);
- this.uiLabel1.TabIndex = 0;
- this.uiLabel1.Text = "分析半径:";
- this.uiLabel1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
- //
- // uiRBcz
- //
- this.uiRBcz.Cursor = System.Windows.Forms.Cursors.Hand;
- this.uiRBcz.Font = new System.Drawing.Font("微软雅黑", 12F);
- this.uiRBcz.Location = new System.Drawing.Point(2, 106);
- this.uiRBcz.MinimumSize = new System.Drawing.Size(1, 1);
- this.uiRBcz.Name = "uiRBcz";
- this.uiRBcz.Padding = new System.Windows.Forms.Padding(22, 0, 0, 0);
- this.uiRBcz.Size = new System.Drawing.Size(127, 29);
- this.uiRBcz.TabIndex = 2;
- this.uiRBcz.Text = "垂直净距分析";
- //
- // uiRBsp
- //
- this.uiRBsp.Cursor = System.Windows.Forms.Cursors.Hand;
- this.uiRBsp.Font = new System.Drawing.Font("微软雅黑", 12F);
- this.uiRBsp.Location = new System.Drawing.Point(2, 70);
- this.uiRBsp.MinimumSize = new System.Drawing.Size(1, 1);
- this.uiRBsp.Name = "uiRBsp";
- this.uiRBsp.Padding = new System.Windows.Forms.Padding(22, 0, 0, 0);
- this.uiRBsp.Size = new System.Drawing.Size(127, 29);
- this.uiRBsp.TabIndex = 1;
- this.uiRBsp.Text = "水平净距分析";
- //
- // uiRBpz
- //
- this.uiRBpz.Checked = true;
- this.uiRBpz.Cursor = System.Windows.Forms.Cursors.Hand;
- this.uiRBpz.Font = new System.Drawing.Font("微软雅黑", 12F);
- this.uiRBpz.Location = new System.Drawing.Point(2, 35);
- this.uiRBpz.MinimumSize = new System.Drawing.Size(1, 1);
- this.uiRBpz.Name = "uiRBpz";
- this.uiRBpz.Padding = new System.Windows.Forms.Padding(22, 0, 0, 0);
- this.uiRBpz.Size = new System.Drawing.Size(127, 29);
- this.uiRBpz.TabIndex = 0;
- this.uiRBpz.Text = "碰撞分析";
- //
- // uiPanelgx
- //
- this.uiPanelgx.Controls.Add(this.lbGxxinxi);
- this.uiPanelgx.Dock = System.Windows.Forms.DockStyle.Fill;
- this.uiPanelgx.Font = new System.Drawing.Font("微软雅黑", 12F);
- this.uiPanelgx.Location = new System.Drawing.Point(133, 0);
- this.uiPanelgx.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
- this.uiPanelgx.MinimumSize = new System.Drawing.Size(1, 1);
- this.uiPanelgx.Name = "uiPanelgx";
- this.uiPanelgx.Size = new System.Drawing.Size(167, 215);
- this.uiPanelgx.TabIndex = 1;
- this.uiPanelgx.Text = null;
- this.uiPanelgx.TextAlignment = System.Drawing.ContentAlignment.TopLeft;
- //
- // lbGxxinxi
- //
- this.lbGxxinxi.AutoSize = true;
- this.lbGxxinxi.Location = new System.Drawing.Point(3, 5);
- this.lbGxxinxi.Name = "lbGxxinxi";
- this.lbGxxinxi.Size = new System.Drawing.Size(138, 21);
- this.lbGxxinxi.TabIndex = 0;
- this.lbGxxinxi.Text = "选择管线的信息:";
- //
- // PengZhuang
- //
- this.Controls.Add(this.uiPanelgx);
- this.Controls.Add(this.uiubg);
- this.Name = "PengZhuang";
- this.Size = new System.Drawing.Size(300, 215);
- this.uiubg.ResumeLayout(false);
- this.uiPanel1.ResumeLayout(false);
- this.uiPanelgx.ResumeLayout(false);
- this.uiPanelgx.PerformLayout();
- this.ResumeLayout(false);
- }
- }
- }
|