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.
134 lines
4.0 KiB
C#
134 lines
4.0 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 GeoSigmaDrawLib;
|
|
using SigmaDrawerElement.Descriptor;
|
|
using SigmaDrawerStyle;
|
|
|
|
namespace SigmaDrawerElement
|
|
{
|
|
[TypeConverter(typeof(PropertySorter))]
|
|
public class DrawerEllipse : ElementBase
|
|
{
|
|
public DrawerEllipse()
|
|
{
|
|
ElementType = DrawElementType.ELEMENT_ELLIPSE;
|
|
}
|
|
[Browsable(false)]
|
|
[XmlAttribute("Color")]
|
|
public int ColorRef;
|
|
|
|
[XmlIgnore]
|
|
[Category("Ô²"), DisplayName("ÑÕÉ«"), PropertyOrder(4)]
|
|
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("Ô²"), DisplayName("Ô²ÐÄ×ø±ê"), PropertyOrder(0)]
|
|
[TypeConverter(typeof(PropertyPointConvert))]
|
|
public PropertyPoint CenterPoint
|
|
{
|
|
get => Coordinate.CenterPoint;
|
|
set => Coordinate.CenterPoint = value;
|
|
}
|
|
|
|
[XmlIgnore]
|
|
[Category("Ô²"), DisplayName("°ë¾¶"), PropertyOrder(1)]
|
|
[TypeConverter(typeof(PropertyRadiusConvert))]
|
|
public PropertyRadius RadiusSize
|
|
{
|
|
get => Coordinate.RadiusSize;
|
|
set => Coordinate.RadiusSize = value;
|
|
}
|
|
#region Other
|
|
[Browsable(false)]
|
|
[XmlElement("Other")]
|
|
[TypeConverter(typeof(GeoSigma.SigmaDrawerStyle.Converter.BaseExpandableConverter))]
|
|
public EllipsOther Other { get; set; } = new EllipsOther();
|
|
|
|
[XmlIgnore]
|
|
[Category("Ô²"), DisplayName("ÇúÏß¿í¶È"), PropertyOrder(2)]
|
|
public double Width
|
|
{
|
|
get => Other.Width;
|
|
set => Other.Width = value;
|
|
}
|
|
|
|
[XmlIgnore]
|
|
[Category("Ô²"), DisplayName("¿í¶È¶¨Î»"), PropertyOrder(3)]
|
|
[TypeConverter(typeof(SigmaDrawerElement.Converter.EllipseStyleConverter))]
|
|
public int WidthStyle
|
|
{
|
|
get
|
|
{
|
|
return Other.Style & (int)EllipseStyle.ELLIPSE_WIDTH_ALL;
|
|
}
|
|
set
|
|
{
|
|
Other.Style &= ~(int)EllipseStyle.ELLIPSE_WIDTH_ALL;
|
|
Other.Style |= value;
|
|
}
|
|
}
|
|
#endregion
|
|
}
|
|
public class EllipsOther
|
|
{
|
|
[XmlAttribute]
|
|
public double Width { get; set; } = 1;
|
|
|
|
[XmlAttribute]
|
|
public int Style { get; set; } = (int)EllipseStyle.ELLIPSE_WIDTH_CENTER;
|
|
}
|
|
|
|
public class CircleCoordinate
|
|
{
|
|
[XmlText]
|
|
[Browsable(false)]
|
|
public string Text
|
|
{
|
|
get
|
|
{
|
|
return $"{CenterPoint.X},{CenterPoint.Y} {CenterPoint.X + RadiusSize.X},{CenterPoint.Y + RadiusSize.Y}";
|
|
}
|
|
set
|
|
{
|
|
var arr = value.Split(new string[] { ",", " ", "\t" }, StringSplitOptions.RemoveEmptyEntries);
|
|
|
|
if (arr.Length == 4)
|
|
{
|
|
CenterPoint = new PropertyPoint(Convert.ToDouble(arr[0]), Convert.ToDouble(arr[1]));
|
|
var xMax = Convert.ToDouble(arr[2]);
|
|
var yMax = Convert.ToDouble(arr[3]);
|
|
|
|
RadiusSize = new PropertyRadius(xMax - CenterPoint.X, yMax - CenterPoint.Y);
|
|
}
|
|
}
|
|
}
|
|
|
|
[XmlIgnore]
|
|
public PropertyPoint CenterPoint { get; set; } = new PropertyPoint();
|
|
[XmlIgnore]
|
|
public PropertyRadius RadiusSize { get; set; } = new PropertyRadius();
|
|
}
|
|
}
|