Files
SourceCode/PROMS/Volian.Svg.Library/SvgUse.cs
T

76 lines
2.4 KiB
C#

using System.Xml.Serialization;
using System.ComponentModel;
using System.Drawing;
namespace Volian.Svg.Library
{
public partial class SvgUse : SvgPartInheritance
{
#region ctor
public SvgUse() { ;}
public SvgUse(PointF location, SizeF size, string id)
{
X.Value = location.X;
Y.Value = location.Y;
Width.Value = size.Width;
Height.Value = size.Height;
_ID = id;
}
#endregion
#region Location
[XmlIgnore]
public SvgMeasurement X { get; set; } = new SvgMeasurement();
[XmlAttribute("x")]
[Browsable(false)]
[EditorBrowsable(EditorBrowsableState.Never)]
public string X_XmlSurrogate
{
get { return SvgXmlConverter<SvgMeasurement>.GetString(X); }
set { X = SvgXmlConverter<SvgMeasurement>.GetObject(value); }
}
[XmlIgnore]
public SvgMeasurement Y { get; set; } = new SvgMeasurement();
[XmlAttribute("y")]
[Browsable(false)]
[EditorBrowsable(EditorBrowsableState.Never)]
public string Y_XmlSurrogate
{
get { return SvgXmlConverter<SvgMeasurement>.GetString(Y); }
set { Y = SvgXmlConverter<SvgMeasurement>.GetObject(value); }
}
#endregion
#region Size
[XmlIgnore]
public SvgMeasurement Width { get; set; } = new SvgMeasurement();
[XmlAttribute("width")]
[Browsable(false)]
[EditorBrowsable(EditorBrowsableState.Never)]
public string Width_WidthmlSurrogate
{
get { return SvgXmlConverter<SvgMeasurement>.GetString(Width); }
set { Width = SvgXmlConverter<SvgMeasurement>.GetObject(value); }
}
[XmlIgnore]
public SvgMeasurement Height { get; set; } = new SvgMeasurement();
[XmlAttribute("height")]
[Browsable(false)]
[EditorBrowsable(EditorBrowsableState.Never)]
public string Height_XmlSurrogate
{
get { return SvgXmlConverter<SvgMeasurement>.GetString(Height); }
set { Height = SvgXmlConverter<SvgMeasurement>.GetObject(value); }
}
#endregion
#region ID to be used
[XmlAttribute(AttributeName = "href", Namespace = "http://www.w3.org/1999/xlink")]
public string UseID { get; set; } = null;
#endregion
#region Setup Inheritance
override internal void SetupInheritance(SvgInheritedSettings myParentsSettings) => _MyInheritedSettings.MyParentsSettings = myParentsSettings;
#endregion
public override string ToString() => string.Format("({0}, {1}) Template '{2}'", this.X, this.Y, this.UseID);
}
}