Object representing 3D pie.
Inheritance: Object, IDisposable
コード例 #1
0
ファイル: PieSlice.cs プロジェクト: paopaofeng/dp2
        /// <summary>
        ///   Splits a pie slice into two on the split angle.
        /// </summary>
        /// <param name="splitAngle">
        ///   Angle at which splitting is performed.
        /// </param>
        /// <returns>
        ///   An array of two pie  slices.
        /// </returns>
        internal PieSlice[] Split(float splitAngle) {
            // if split angle equals one of bounding angles, then nothing to split
            if (StartAngle == splitAngle || this.EndAngle == splitAngle)
                return new PieSlice[] { (PieSlice)Clone() };

            float transformedSplitAngle = TransformAngle(splitAngle);

            float actualStartAngle = GetActualAngle(StartAngle);
            float newSweepAngle = (splitAngle - actualStartAngle + 360) % 360;
            PieSlice pieSlice1 = new PieSlice(BoundingRectangle, SliceHeight, actualStartAngle, newSweepAngle, m_surfaceColor, m_shadowStyle, m_edgeColorType);
            pieSlice1.InitializeSides(true, false);

            newSweepAngle = GetActualAngle(EndAngle) - splitAngle;
            PieSlice pieSlice2 = new PieSlice(BoundingRectangle, SliceHeight, splitAngle, newSweepAngle, m_surfaceColor, m_shadowStyle, m_edgeColorType);
            pieSlice2.InitializeSides(false, true);
            return new PieSlice[] { pieSlice1, pieSlice2 };
        }
コード例 #2
0
ファイル: PieChart.cs プロジェクト: paopaofeng/dp2
 /// <summary>
 ///   Return the index of the foremost pie slice i.e. the one crossing
 ///   90 degrees boundary.
 /// </summary>
 /// <param name="pieSlices">
 ///   Array of <c>PieSlice</c> objects to examine.
 /// </param>
 /// <returns>
 ///   Index of the foremost pie slice.
 /// </returns>
 private int GetForemostPieSlice(PieSlice[] pieSlices) {
     Debug.Assert(pieSlices != null && pieSlices.Length > 0);
     for (int i = 0; i < pieSlices.Length; ++i) {
         PieSlice pieSlice = pieSlices[i];
         if (((pieSlice.StartAngle <= 90) && ((pieSlice.StartAngle + pieSlice.SweepAngle) >= 90)) ||
             ((pieSlice.StartAngle + pieSlice.SweepAngle > 360) && ((pieSlice.StartAngle) <= 450) && (pieSlice.StartAngle + pieSlice.SweepAngle) >= 450)) {
             return i;
         }
     }
     Debug.Assert(false, "Foremost pie slice not found");
     return -1;
 }
コード例 #3
0
ファイル: PieSlice.cs プロジェクト: Longkong/Pojjaman
        /// <summary>
        ///   Splits a pie slice into two on the split angle.
        /// </summary>
        /// <param name="splitAngle">
        ///   Angle at which splitting is performed.
        /// </param>
        /// <returns>
        ///   An array of two pie  slices.
        /// </returns>
        internal PieSlice[] Split(float splitAngle)
        {
            float transformedSplitAngle = TransformAngle(splitAngle);

            float actualStartAngle = GetActualAngle(StartAngle);
            float newSweepAngle = (splitAngle - actualStartAngle + 360) % 360;
            PieSlice pieSlice1 = new PieSlice(BoundingRectangle, SliceHeight, actualStartAngle, newSweepAngle, m_surfaceColor, m_shadowStyle, m_edgeColorType);
            pieSlice1.InitializeSides(true, false);

            newSweepAngle = GetActualAngle(EndAngle) - splitAngle;
            PieSlice pieSlice2 = new PieSlice(BoundingRectangle, SliceHeight, splitAngle, newSweepAngle, m_surfaceColor, m_shadowStyle, m_edgeColorType);
            pieSlice2.InitializeSides(false, true);
            return new PieSlice[] { pieSlice1, pieSlice2 };
        }