// // Copyright (c) PlaceholderCompany. All rights reserved. // using System; using System.Collections.Generic; using System.ComponentModel; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Xml.Serialization; using GeoSigmaDrawLib; using SigmaDrawerStyle; #if NET8_0 #else using System.Drawing.Design; #endif namespace SigmaDrawerElement { /// /// 线图元类. /// [TypeConverter(typeof(PropertySorter))] public class DrawerPline: ElementBase { /// /// Initializes a new instance of the class. /// public DrawerPline() { ElementType = DrawElementType.ELEMENT_CURVE; } /// /// Gets or sets the name. /// [XmlAttribute("Name")] [Category("基础属性"), DisplayName("名称"), PropertyOrder(0)] public override string Name { get; set; } /// /// Gets or sets the width. /// [Browsable(false)] [XmlAttribute("Width")] [Category("基础属性"), DisplayName("宽度"), PropertyOrder(1)] public double Width { get; set; } = 0; /// /// Gets or sets the display type. /// [Browsable(false)] [XmlAttribute("Type")] [Category("基础属性"), DisplayName("显示方式"), PropertyOrder(2)] public string DisplayType { get; set; } private string coordinate; /// /// Gets or sets the coordinate. /// [XmlElement("Coordinate")] [Category("基础属性"), DisplayName("坐标"), PropertyOrder(3)] #if NET8_0 #else [Editor("UCDraw.Editor.CoordinateEditor, UCDraw", typeof(UITypeEditor))] #endif public string Coordinate { get { if (coordinate == null) { return null; } StringBuilder strbData = new StringBuilder(); TextReader tr = new StringReader(coordinate); string strLine = string.Empty; while ((strLine = tr.ReadLine()) != null) { string strData = strLine.Trim(' ', '\t'); if (string.IsNullOrWhiteSpace(strData)) { continue; } strbData.AppendLine(strData); } coordinate = strbData.ToString(); return coordinate; } set { coordinate = value; } } /// /// Converts to dfdstring. /// /// /// 数据内容 /// public override string ToDfdString() { string strCoor = this.Coordinate; if (string.IsNullOrEmpty(strCoor)) { return string.Empty; } StringBuilder strb = new StringBuilder(); if (string.IsNullOrEmpty(this.Name)) { strb.AppendLine("Pline"); } else { strb.AppendLine($"Pline.{this.Name}"); } strb.AppendLine(strCoor); strb.AppendLine(); return strb.ToString(); } } }