using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using DevComponents.DotNetBar.Charts.Style; namespace DevComponents.DotNetBar.Charts { /// /// Represents a PieLabel (label associated with a pie data slice in the chart). /// public class PieLabel : IDisposable { #region Private data private PieSeriesPoint _PieSeriesPoint; private float _Angle; private Rectangle _Bounds; private Rectangle _ConnectorBounds; private Point _PtBoxEdge; private Point _PtBoxBend; private Point _PtSliceEdge; private double _Radius; private double _OuterRadius; private string _Label; private Size _LabelSize; private SliceOuterLabelVisualStyle _SliceLabelVisualStyle; private States _States; #endregion public PieLabel(PieSeriesPoint sp, string label) { _PieSeriesPoint = sp; _Label = label; InitDefaultStates(); } #region InitDefaultStates private void InitDefaultStates() { } #endregion #region Public properties #region Angle /// /// Gets the angle used to display the point label /// associated with the data point. /// public float Angle { get { return (_Angle); } internal set { _Angle = value; } } #endregion #region Bounds /// /// Gets the label text bounds. /// public Rectangle Bounds { get { return (_Bounds); } internal set { _Bounds = value; } } #endregion #region IsLeftlabel /// /// Gets whether the label is a left positioned /// label (with respect to the chart slice). /// public bool IsLeftlabel { get { return (!TestState(States.RightLabel)); } internal set { SetState(States.RightLabel, !value); } } #endregion #region IsRightlabel /// /// Gets whether the label is a right positioned /// label (with respect to the chart slice). /// public bool IsRightlabel { get { return (TestState(States.RightLabel)); } internal set { SetState(States.RightLabel, value); } } #endregion #region Label /// /// Gets or sets the label text /// public string Label { get { return (_Label); } internal set { _Label = value; } } #endregion #region LabelSize /// /// Gets the label size. /// public Size LabelSize { get { return (_LabelSize); } internal set { _LabelSize = value; } } #endregion #region PieSeriesPoint /// /// Gets the associated PieSeriesPoint. /// public PieSeriesPoint PieSeriesPoint { get { return (_PieSeriesPoint); } internal set { _PieSeriesPoint = value; } } #endregion #region PtBoxBend /// /// Gets the middle connector point located /// at the 'bend' of the connector. /// public Point PtBoxBend { get { return (_PtBoxBend); } internal set { _PtBoxBend = value; } } #endregion #region PtBoxEdge /// /// Gets the connector point located and the /// 'edge' of the label text bounding box. /// public Point PtBoxEdge { get { return (_PtBoxEdge); } internal set { _PtBoxEdge = value; } } #endregion #region PtSliceEdge /// /// Gets the initial connector point, located at /// the edge of the pie slice. /// public Point PtSliceEdge { get { return (_PtSliceEdge); } internal set { _PtSliceEdge = value; } } #endregion #region SliceLabelVisualStyle /// /// Gets the current slice label VisualStyle for the label. /// public SliceOuterLabelVisualStyle LabelStyle { get { return (_SliceLabelVisualStyle); } internal set { _SliceLabelVisualStyle = value; } } #endregion #endregion #region Internal properties #region ConnectorBounds internal Rectangle ConnectorBounds { get { return (_ConnectorBounds); } set { _ConnectorBounds = value; } } #endregion #region OuterRadius internal double OuterRadius { get { return (_OuterRadius); } set { _OuterRadius = value; } } #endregion #region Radius internal double Radius { get { return (_Radius); } set { _Radius = value; } } #endregion #endregion #region States [Flags] private enum States : uint { RightLabel = (1U << 0), } #region TestState private bool TestState(States state) { return ((_States & state) == state); } #endregion #region SetState private void SetState(States state, bool value) { if (value == true) _States |= state; else _States &= ~state; } #endregion #endregion #region IDisposable public void Dispose() { } #endregion } }