|
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using System.ComponentModel;
|
|
|
|
|
|
using System.Drawing;
|
|
|
|
|
|
#if NET8_0
|
|
|
|
|
|
#else
|
|
|
|
|
|
using System.Drawing.Design;
|
|
|
|
|
|
#endif
|
|
|
|
|
|
using System.Linq;
|
|
|
|
|
|
using System.Text;
|
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
using System.Xml.Serialization;
|
|
|
|
|
|
using GeoSigmaDrawLib;
|
|
|
|
|
|
using SigmaDrawerStyle;
|
|
|
|
|
|
|
|
|
|
|
|
namespace GeoSigma.SigmaDrawerStyle
|
|
|
|
|
|
{
|
|
|
|
|
|
[TypeConverter(typeof(PropertySorter))]
|
|
|
|
|
|
[XmlRoot("CurveName")]
|
|
|
|
|
|
public class CurveName : CurveView
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Initializes a new instance of the <see cref="CurveName"/> class.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public CurveName()
|
|
|
|
|
|
{
|
|
|
|
|
|
TypeName = "名字";
|
|
|
|
|
|
}
|
|
|
|
|
|
string _ViewType;
|
|
|
|
|
|
[Browsable(false)]
|
|
|
|
|
|
//[Category("基础属性"), DisplayName("\t\t\t\t\t\t\t类型")]
|
|
|
|
|
|
[XmlAttribute("Type")]
|
|
|
|
|
|
public string ViewType
|
|
|
|
|
|
{
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
|
|
|
|
|
return _ViewType;
|
|
|
|
|
|
}
|
|
|
|
|
|
set
|
|
|
|
|
|
{
|
|
|
|
|
|
_ViewType = value;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[XmlIgnore]
|
|
|
|
|
|
[Category("基础属性"), DisplayName("类型"), PropertyOrder(1)]
|
|
|
|
|
|
[TypeConverter(typeof(Converter.CurveNameStyleTypeConverter))]
|
|
|
|
|
|
public CurveNameStyleType NameViewType
|
|
|
|
|
|
{
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
|
|
|
|
|
if (Enum.TryParse<CurveNameStyleType>(_ViewType, out var result))
|
|
|
|
|
|
{
|
|
|
|
|
|
return result;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return CurveNameStyleType.NameHead;
|
|
|
|
|
|
}
|
|
|
|
|
|
set
|
|
|
|
|
|
{
|
|
|
|
|
|
_ViewType = value.ToString();
|
|
|
|
|
|
if (value == CurveNameStyleType.NameHead)
|
|
|
|
|
|
{
|
|
|
|
|
|
TypeName = CurveStyleType.CurveNameHead.ToString();
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
TypeName = CurveStyleType.CurveNameTail.ToString();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[XmlIgnore]
|
|
|
|
|
|
[Category("基础属性"), DisplayName("高度"), PropertyOrder(2)]
|
|
|
|
|
|
[TypeConverter(typeof(PropertyDoubleConverter))]
|
|
|
|
|
|
public double FontHeight
|
|
|
|
|
|
{
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
|
|
|
|
|
return Base.Height;
|
|
|
|
|
|
}
|
|
|
|
|
|
set
|
|
|
|
|
|
{
|
|
|
|
|
|
Base.Height = value;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
[XmlIgnore]
|
|
|
|
|
|
[Category("基础属性"), DisplayName("角度"), PropertyOrder(3)]
|
|
|
|
|
|
[TypeConverter(typeof(PropertyDoubleConverter))]
|
|
|
|
|
|
public double Angle
|
|
|
|
|
|
{
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
|
|
|
|
|
return Base.Angle;
|
|
|
|
|
|
}
|
|
|
|
|
|
set
|
|
|
|
|
|
{
|
|
|
|
|
|
Base.Angle = value;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
[XmlIgnore]
|
|
|
|
|
|
[Category("基础属性"), DisplayName("偏移"), PropertyOrder(4)]
|
|
|
|
|
|
[TypeConverter(typeof(PropertyDoubleConverter))]
|
|
|
|
|
|
public double Offset
|
|
|
|
|
|
{
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
|
|
|
|
|
return Base.Offset;
|
|
|
|
|
|
}
|
|
|
|
|
|
set
|
|
|
|
|
|
{
|
|
|
|
|
|
Base.Offset = value;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[XmlIgnore]
|
|
|
|
|
|
[Category("基础属性"), DisplayName("颜色"), PropertyOrder(5)]
|
|
|
|
|
|
#if NET8_0
|
|
|
|
|
|
#else
|
|
|
|
|
|
[Editor(typeof(PropertyEditorColor), typeof(UITypeEditor))]
|
|
|
|
|
|
#endif
|
|
|
|
|
|
[TypeConverter(typeof(PropertyColorIndicatorConvert))]
|
|
|
|
|
|
public Color TextColor
|
|
|
|
|
|
{
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
|
|
|
|
|
return ColorTranslator.FromWin32(Base.ColorRef);
|
|
|
|
|
|
}
|
|
|
|
|
|
set
|
|
|
|
|
|
{
|
|
|
|
|
|
Base.ColorRef = ColorTranslator.ToWin32(value);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
private Font _TextFont;
|
|
|
|
|
|
[XmlIgnore]
|
|
|
|
|
|
[Category("基础属性"), DisplayName("字体"), PropertyOrder(6)]
|
|
|
|
|
|
[TypeConverterAttribute(typeof(FontPropertyConvert))]
|
|
|
|
|
|
public Font TextFont
|
|
|
|
|
|
{
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
|
|
|
|
|
_TextFont = Font.FromLogFont(FontStyle);
|
|
|
|
|
|
return _TextFont;
|
|
|
|
|
|
}
|
|
|
|
|
|
set
|
|
|
|
|
|
{
|
|
|
|
|
|
_TextFont = value;
|
|
|
|
|
|
FontStyle = LogFontConverter.convert(_TextFont);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[XmlIgnore]
|
|
|
|
|
|
[Category("基础属性"), DisplayName("沿着曲线"), Description("沿着曲线"), PropertyOrder(7)]
|
|
|
|
|
|
[TypeConverter(typeof(Converter.YesNoConverter))]
|
|
|
|
|
|
public bool IsAlongCurve
|
|
|
|
|
|
{
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
|
|
|
|
|
if ((Base.Style & Constants.PLINE_NAME_ALONG_CURVE) != 0)
|
|
|
|
|
|
return true;
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
set
|
|
|
|
|
|
{
|
|
|
|
|
|
if (value == true)
|
|
|
|
|
|
{
|
|
|
|
|
|
Base.Style |= Constants.PLINE_NAME_ALONG_CURVE;
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
Base.Style &= ~Constants.PLINE_NAME_ALONG_CURVE;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Gets or sets 名字前缀.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
[XmlIgnore]
|
|
|
|
|
|
[Category("基础属性"), DisplayName("名字前缀"), Description("名字前缀"), PropertyOrder(8)]
|
|
|
|
|
|
public string HeadString
|
|
|
|
|
|
{
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
|
|
|
|
|
return Base.HeadString;
|
|
|
|
|
|
}
|
|
|
|
|
|
set
|
|
|
|
|
|
{
|
|
|
|
|
|
Base.HeadString = value;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 基础属性
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
[Browsable(false)]
|
|
|
|
|
|
[XmlElement("Base")]
|
|
|
|
|
|
public NameBase Base { get; set; } = new NameBase();
|
|
|
|
|
|
|
|
|
|
|
|
[Browsable(false)]
|
|
|
|
|
|
[XmlElement("Font")]
|
|
|
|
|
|
public LogFont FontStyle { get; set; } = LogFont.Default;
|
|
|
|
|
|
}
|
|
|
|
|
|
public class NameBase
|
|
|
|
|
|
{
|
|
|
|
|
|
[XmlAttribute]
|
|
|
|
|
|
public double Height { get; set; }
|
|
|
|
|
|
[XmlAttribute]
|
|
|
|
|
|
public double Angle { get; set; }
|
|
|
|
|
|
[XmlAttribute]
|
|
|
|
|
|
public double Offset { get; set; }
|
|
|
|
|
|
[XmlAttribute("Color")]
|
|
|
|
|
|
public int ColorRef { get; set; }
|
|
|
|
|
|
[XmlAttribute]
|
|
|
|
|
|
public int Style { get; set; }
|
|
|
|
|
|
[XmlAttribute]
|
|
|
|
|
|
public string HeadString { get; set; }
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|