Exemple #1
0
        /// <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 (Math.Abs(StartAngle - splitAngle) < float.Epsilon || Math.Abs(EndAngle - splitAngle) < float.Epsilon)
                return new[] { (PieSlice)Clone() };

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

                newSweepAngle = GetActualAngle(EndAngle) - splitAngle;
                using (PieSlice pieSlice2 = new PieSlice(BoundingRectangle, SliceHeight, splitAngle, newSweepAngle,
                    m_surfaceColor, m_shadowStyle, m_edgeColorType))
                {
                    pieSlice2.InitializeSides(false);
                    return new[] { (PieSlice)pieSlice1.Clone(), (PieSlice)pieSlice2.Clone() };
                }
            }
        }
Exemple #2
0
        /// <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 };
        }