12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- using SuperMap.Data;
- using System;
- using System.Collections.Generic;
- using System.Windows.Forms;
- using WWPipeLine.MapBasic.Conditions;
- using WWPipeLine.MapBasic;
- using System.Drawing;
- using SuperMap.UI;
- using WWPipeLine.MapBasic;
- using SuperMap.Mapping;
- namespace WWPipeLine.MapTools.Conditions.FuZhuGongJu
- {
- public class BZGuanDian : BasicToolBar
- {
- private Selection[] m_selection = null;
- private Recordset m_recordset = null;
- public BZGuanDian() : base()
- {
- this.ConditionPanelName = "管点标注";
- InitializeComponent();
- base.IsShowToolStripComboBox = true;
- toolStripComboBoxLayer.SelectedIndexChanged += ToolStripComboBoxLayer_SelectedIndexChanged;
- var bzBiaozhu = new ToolStripButton()
- {
- DisplayStyle = ToolStripItemDisplayStyle.ImageAndText,
- Text = "标注信息",
- Name = "bzBiaozhu",
- AutoToolTip = false
- };
- var img = Commons.Paths.ApplicationResourcesDir + "\\ToolBar\\标注信息.png";
- if (System.IO.File.Exists(img))
- bzBiaozhu.Image = System.Drawing.Image.FromFile(img);
- base.ToolStrip.Items.Add(bzBiaozhu); bzBiaozhu.Click += bzBiaozhu_Click;
- }
- private void ToolStripComboBoxLayer_SelectedIndexChanged(object sender, EventArgs e)
- {
- ComsStatic.SetLayersIsSelectableFalse(toolStripComboBoxLayer.ComboBox.SelectedValue.ToString(), true);
- }
- private void bzBiaozhu_Click(object sender, EventArgs e)
- {
- m_selection = MapControl.Map.FindSelection(true);
- if (m_selection is null || m_selection.Length != 1)
- {
- Sunny.UI.UIMessageTip.ShowError("没有选中任何管点元素"); return;
- }
- m_recordset = m_selection[0].ToRecordset();
- m_recordset.MoveFirst();
- GeoPoint g;
- TextPart m_TextPart = new TextPart();
- GeoText geoText;
- while (!m_recordset.IsEOF)
- {
- g = m_recordset.GetGeometry() as GeoPoint;
- m_TextPart.AnchorPoint = g.InnerPoint;
- m_TextPart.Text = m_recordset.GetFieldValue("fsw")?.ToString();
- geoText = new GeoText(m_TextPart, ComsStatic.textStyle_Brown_6mm_BottomLeft);
- MapControl.Map.TrackingLayer.Add(geoText, "geoText");
- m_recordset.MoveNext();
- }
- MapControl.Map.Refresh();
- }
- protected override void OnLoad(EventArgs e)
- {
- MapControl.Action = SuperMap.UI.Action.Select2;
- base.OnLoad(e);
- }
- public override void AfterClose()
- {
- ComsStatic.RecordsetDispose(m_recordset);
- base.AfterClose();
- }
- private void InitializeComponent()
- {
- this.SuspendLayout();
- //
- // ToolsConditions
- //
- this.Name = "坐标标注";
- this.ResumeLayout(false);
- }
- }
- }
|