using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; #if WEB_SERVICE #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 { /// /// Initializes a new instance of the class. /// 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(_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 WEB_SERVICE #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; } } } /// /// Gets or sets 名字前缀. /// [XmlIgnore] [Category("基础属性"), DisplayName("名字前缀"), Description("名字前缀"), PropertyOrder(8)] public string HeadString { get { return Base.HeadString; } set { Base.HeadString = value; } } [XmlIgnore] [Category("基础属性"), DisplayName("小数位数"), Description("小数位数"), PropertyOrder(9)] public int DecimalName { get { return Base.DecimalName; } set { Base.DecimalName = value; } } /////////////////////////////////////////////////////////////////////// /// /// 基础属性 /// [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; } [XmlAttribute] public int DecimalName { get; set; } = -1; } }