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.

128 lines
3.4 KiB
C#

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Serialization;
using GeoSigma.SigmaDrawerStyle;
using GeoSigma.SigmaDrawerStyle.Converter;
using GeoSigmaDrawLib;
using SigmaDrawerElement.Descriptor;
namespace SigmaDrawerElement
{
// [DrawerArcInfo]
public class DrawerArc : ElementBase // : DrawerWithCenter
{
public DrawerArc()
{
ElementType = DrawElementType.ELEMENT_ARC;
}
[Browsable(false)]
[XmlAttribute("Color")]
public int ColorRef;
[XmlIgnore]
[Category("\t弧、弦、饼"), DisplayName("颜色")]
public Color LineColor
{
get
{
return ColorTranslator.FromWin32(ColorRef);
}
set
{
ColorRef = ColorTranslator.ToWin32(value);
}
}
[XmlElement("Coordinate")]
[Browsable(false)]
[TypeConverter(typeof(GeoSigma.SigmaDrawerStyle.Converter.BaseExpandableConverter))]
public CircleCoordinate Coordinate { get; set; } = new CircleCoordinate();
[XmlIgnore]
[Category("\t弧、弦、饼"), DisplayName("\t\t\t\t圆心坐标")]
[TypeConverter(typeof(PropertyPointConvert))]
public PropertyPoint CenterPoint
{
get => Coordinate.CenterPoint;
set => Coordinate.CenterPoint = value;
}
[XmlIgnore]
[Category("\t弧、弦、饼"), DisplayName("\t\t\t半径")]
[TypeConverter(typeof(PropertyRadiusConvert))]
public PropertyRadius RadiusSize
{
get => Coordinate.RadiusSize;
set => Coordinate.RadiusSize = value;
}
#region Other
[Browsable(false)]
[XmlElement("Other")]
public ArcOther Other { get; set; } = new ArcOther();
[XmlIgnore]
[Category("\t弧、弦、饼"), DisplayName("\t\t\t开始角度")]
[TypeConverter(typeof(DoubleTrimConverter))]
public double BA
{
get => Other.BA;
set => Other.BA = value;
}
[XmlIgnore]
[Category("\t弧、弦、饼"), DisplayName("\t\t结束角度")]
[TypeConverter(typeof(DoubleTrimConverter))]
public double EA
{
get => Other.EA;
set => Other.EA = value;
}
[XmlIgnore]
[TypeConverter(typeof(DoubleTrimConverter))]
[Category("\t弧、弦、饼"), DisplayName("曲线宽度")]
public double Width
{
get => Other.Width;
set => Other.Width = value;
}
[XmlIgnore]
[Category("\t弧、弦、饼"), DisplayName("\t类型")]
[TypeConverter(typeof(SigmaDrawerElement.Converter.ArcStyleConverter))]
public int Style
{
get
{
return Other.Style & (int)ArcStyle.DrawTypeAll;
}
set
{
Other.Style &= ~(int)ArcStyle.DrawTypeAll;
Other.Style |= value;
}
}
#endregion
}
public class ArcOther
{
[XmlAttribute]
public double BA { get; set; }
[XmlAttribute]
public double EA { get; set; }
[XmlAttribute]
public int Style { get; set; }
[XmlAttribute]
public double Width { get; set; } = 1;
}
}