You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123 lines
3.5 KiB
C#

// <copyright file="DrawerPline.cs" company="PlaceholderCompany">
// Copyright (c) PlaceholderCompany. All rights reserved.
// </copyright>
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 WEB_SERVICE
#else
using System.Drawing.Design;
#endif
namespace SigmaDrawerElement
{
/// <summary>
/// 线图元类.
/// </summary>
[TypeConverter(typeof(PropertySorter))]
public class DrawerPline: ElementBase
{
/// <summary>
/// Initializes a new instance of the <see cref="DrawerPline"/> class.
/// </summary>
public DrawerPline()
{
ElementType = DrawElementType.ELEMENT_CURVE;
}
/// <summary>
/// Gets or sets the name.
/// </summary>
[XmlAttribute("Name")]
[Category("基础属性"), DisplayName("名称"), PropertyOrder(0)]
public override string Name { get; set; }
/// <summary>
/// Gets or sets the width.
/// </summary>
[Browsable(false)]
[XmlAttribute("Width")]
[Category("基础属性"), DisplayName("宽度"), PropertyOrder(1)]
public double Width { get; set; } = 0;
/// <summary>
/// Gets or sets the display type.
/// </summary>
[Browsable(false)]
[XmlAttribute("Type")]
[Category("基础属性"), DisplayName("显示方式"), PropertyOrder(2)]
public string DisplayType { get; set; }
private string coordinate;
/// <summary>
/// Gets or sets the coordinate.
/// </summary>
[XmlElement("Coordinate")]
[Category("基础属性"), DisplayName("坐标"), PropertyOrder(3)]
#if WEB_SERVICE
#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;
}
}
/// <summary>
/// Converts to dfdstring.
/// </summary>
/// <returns>
/// 数据内容
/// </returns>
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();
}
}
}