227 lines
5.6 KiB
C#

using System.ComponentModel;
using System.Drawing;
namespace DevComponents.DotNetBar.Charts.Style
{
/// <summary>
/// Represents the visual style of a Legend element.
/// </summary>
[TypeConverter(typeof(VisualStylesConverter))]
public class SliceCenterLineVisualStyle : ChartLineVisualStyle
{
#region Private variables
private int _InnerExtent;
private int _OuterExtent;
#endregion
#region Public properties
#region InnerExtent
/// <summary>
/// Gets or sets the distance (in pixels) to which the center line
/// is extended prior to the slice inner radius.
/// </summary>
[Description("Indicates the distance (in pixels) to which the center line is extended prior to the slice inner radius.")]
[DefaultValue(0)]
public int InnerExtent
{
get { return (_InnerExtent); }
set
{
if (_InnerExtent != value)
{
_InnerExtent = value;
OnPropertyChangedEx("InnerExtent", VisualChangeType.Render);
}
}
}
#endregion
#region OuterExtent
/// <summary>
/// Gets or sets the distance (in pixels) to which the center line
/// is extended past to the slice Outer radius.
/// </summary>
[Description("Indicates the distance (in pixels) to which the center line is extended past the slice Outer radius.")]
[DefaultValue(0)]
public int OuterExtent
{
get { return (_OuterExtent); }
set
{
if (_OuterExtent != value)
{
_OuterExtent = value;
OnPropertyChangedEx("OuterExtent", VisualChangeType.Render);
}
}
}
#endregion
#region IsEmpty
/// <summary>
/// Gets whether the style is logically Empty.
/// </summary>
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[Description("Gets whether the style is logically Empty.")]
public override bool IsEmpty
{
get
{
return ((_InnerExtent == 0) &&
(_OuterExtent == 0) &&
(base.IsEmpty == true));
}
}
#endregion
#endregion
#region ApplyStyle
/// <summary>
/// Applies the style to the instance of this style.
/// </summary>
/// <param name="style">Style to apply.</param>
public void ApplyStyle(SliceCenterLineVisualStyle style)
{
if (style != null)
{
base.ApplyStyle(style);
if (style.InnerExtent != 0)
InnerExtent = style.InnerExtent;
if (style.OuterExtent != 0)
OuterExtent = style.OuterExtent;
}
}
#endregion
#region ApplyDefaults
public override void ApplyDefaults()
{
base.ApplyDefaults();
}
#endregion
#region Copy
/// <summary>
/// Returns the copy of the style.
/// </summary>
/// <returns>Copy of the style.</returns>
public new SliceCenterLineVisualStyle Copy()
{
SliceCenterLineVisualStyle style = new SliceCenterLineVisualStyle();
CopyTo(style);
return (style);
}
#endregion
#region CopyTo
/// <summary>
/// Returns the copy of the style.
/// </summary>
/// <returns>Copy of the style.</returns>
public void CopyTo(SliceCenterLineVisualStyle style)
{
base.CopyTo(style);
style.InnerExtent = _InnerExtent;
style.OuterExtent = _OuterExtent;
}
#endregion
#region GetSerialData
internal override SerialElementCollection GetSerialData(string serialName)
{
SerialElementCollection sec = new SerialElementCollection();
if (serialName != null)
{
if (serialName.Equals("") == true)
serialName = "SliceCenterLineVisualStyle";
sec.AddStartElement(serialName);
}
sec.AddValue("InnerExtent", InnerExtent, 0);
sec.AddValue("OuterExtent", OuterExtent, 0);
sec.AddElement(base.GetSerialData(null));
if (serialName != null)
sec.AddEndElement(serialName);
return (sec);
}
#endregion
#region PutSerialData
#region ProcessValue
internal override void ProcessValue(SerialElement se)
{
switch (se.Name)
{
case "InnerExtent":
InnerExtent = int.Parse(se.StringValue);
break;
case "OuterExtent":
OuterExtent = int.Parse(se.StringValue);
break;
default:
base.ProcessValue(se);
break;
}
}
#endregion
#region ProcessCollection
internal override void ProcessCollection(SerialElement se)
{
SerialElementCollection sec = se.Sec;
switch (se.Name)
{
default:
base.ProcessCollection(se);
break;
}
}
#endregion
#endregion
}
}