Exemple #1
0
        /// <summary>
        /// Returns doughnut curved shapes
        /// </summary>
        /// <param name="doughnutParams">Doughnut parameters</param>
        /// <param name="centroid">Centroid</param>
        /// <param name="topFaceCenter">Top face center</param>
        /// <param name="bottomFaceCenter">Bottom face center</param>
        /// <returns>List of shape</returns>
        private static List<Shape> GetDoughnutCurvedFace(SectorChartShapeParams doughnutParams, Point3D centroid, Point3D topFaceCenter, Point3D bottomFaceCenter)
        {
            List<Shape> curvedFaces = new List<Shape>();

            if (doughnutParams.StartAngle >= Math.PI && doughnutParams.StartAngle <= Math.PI * 2 && doughnutParams.StopAngle >= Math.PI && doughnutParams.StopAngle <= Math.PI * 2 && doughnutParams.IsLargerArc)
            {
                // Outer curved path
                Path curvedSegment = GetCurvedSegment(doughnutParams, doughnutParams.OuterRadius, 0, Math.PI, topFaceCenter, bottomFaceCenter, centroid, true, RenderAs.Doughnut);
                curvedFaces.Add(curvedSegment);

                // Inner curved paths
                curvedSegment = GetCurvedSegment(doughnutParams, doughnutParams.InnerRadius, doughnutParams.StartAngle, 0, topFaceCenter, bottomFaceCenter, centroid, false, RenderAs.Doughnut);
                curvedFaces.Add(curvedSegment);

                curvedSegment = GetCurvedSegment(doughnutParams, doughnutParams.InnerRadius, Math.PI, doughnutParams.StopAngle, topFaceCenter, bottomFaceCenter, centroid, false, RenderAs.Doughnut);
                curvedFaces.Add(curvedSegment);
            }
            else if (doughnutParams.StartAngle >= 0 && doughnutParams.StartAngle <= Math.PI && doughnutParams.StopAngle >= 0 && doughnutParams.StopAngle <= Math.PI && doughnutParams.IsLargerArc)
            {
                // Outer curved paths
                Path curvedSegment = GetCurvedSegment(doughnutParams, doughnutParams.OuterRadius, doughnutParams.StartAngle, Math.PI, topFaceCenter, bottomFaceCenter, centroid, true, RenderAs.Doughnut);
                curvedFaces.Add(curvedSegment);
                curvedSegment = GetCurvedSegment(doughnutParams, doughnutParams.OuterRadius, Math.PI * 2, doughnutParams.StopAngle, topFaceCenter, bottomFaceCenter, centroid, true, RenderAs.Doughnut);
                curvedFaces.Add(curvedSegment);

                // Inner curved path
                curvedSegment = GetCurvedSegment(doughnutParams, doughnutParams.InnerRadius, Math.PI, Math.PI * 2, topFaceCenter, bottomFaceCenter, centroid, false, RenderAs.Doughnut);
                curvedFaces.Add(curvedSegment);
            }
            else if (doughnutParams.StartAngle >= 0 && doughnutParams.StartAngle <= Math.PI && doughnutParams.StopAngle >= Math.PI && doughnutParams.StopAngle <= Math.PI * 2)
            {
                // Outer curved path
                Path curvedSegment = GetCurvedSegment(doughnutParams, doughnutParams.OuterRadius, doughnutParams.StartAngle, Math.PI, topFaceCenter, bottomFaceCenter, centroid, true, RenderAs.Doughnut);
                curvedFaces.Add(curvedSegment);

                // Inner curved path
                curvedSegment = GetCurvedSegment(doughnutParams, doughnutParams.InnerRadius, Math.PI, doughnutParams.StopAngle, topFaceCenter, bottomFaceCenter, centroid, false, RenderAs.Doughnut);
                curvedFaces.Add(curvedSegment);
            }
            else if (doughnutParams.StartAngle >= Math.PI && doughnutParams.StartAngle <= Math.PI * 2 && doughnutParams.StopAngle >= 0 && doughnutParams.StopAngle <= Math.PI)
            {
                // Outer curved path
                Path curvedSegment = GetCurvedSegment(doughnutParams, doughnutParams.OuterRadius, 0, doughnutParams.StopAngle, topFaceCenter, bottomFaceCenter, centroid, true, RenderAs.Doughnut);
                curvedFaces.Add(curvedSegment);

                // Inner curved path
                curvedSegment = GetCurvedSegment(doughnutParams, doughnutParams.InnerRadius, doughnutParams.StartAngle, 0, topFaceCenter, bottomFaceCenter, centroid, false, RenderAs.Doughnut);
                curvedFaces.Add(curvedSegment);
            }
            else
            {
                if (doughnutParams.StartAngle >= 0 && doughnutParams.StopAngle <= Math.PI)
                {
                    Path curvedSegment = GetCurvedSegment(doughnutParams, doughnutParams.OuterRadius, doughnutParams.StartAngle, doughnutParams.StopAngle, topFaceCenter, bottomFaceCenter, centroid, true, RenderAs.Doughnut);
                    curvedFaces.Add(curvedSegment);
                }
                else
                {
                    Path curvedSegment = curvedSegment = GetCurvedSegment(doughnutParams, doughnutParams.InnerRadius, doughnutParams.StartAngle, doughnutParams.StopAngle, topFaceCenter, bottomFaceCenter, centroid, false, RenderAs.Doughnut);
                    curvedFaces.Add(curvedSegment);
                }
            }

            return curvedFaces;
        }
Exemple #2
0
        /// <summary>
        /// Returns a centroid
        /// </summary>
        /// <param name="points">Array of Point3D</param>
        /// <returns>Point3D</returns>
        private static Point3D GetCentroid(params Point3D[] points)
        {
            Double sumX = 0;
            Double sumY = 0;
            Double sumZ = 0;

            foreach (Point3D point in points)
            {
                sumX += point.X;
                sumY += point.Y;
                sumZ += point.Z;
            }

            Point3D centroid = new Point3D();
            centroid.X = sumX / points.Length;
            centroid.Y = sumY / points.Length;
            centroid.Z = sumZ / points.Length;

            return centroid;
        }
Exemple #3
0
        /// <summary>
        /// Returns a pie side path
        /// </summary>
        /// <param name="pieParams">Pie parameters</param>
        /// <param name="centroid">Centroid</param>
        /// <param name="centerTop">Center top</param>
        /// <param name="centerBottom">Center bottom</param>
        /// <param name="outerTop">Outer top</param>
        /// <param name="outerBottom">Outer bottom</param>
        /// <returns>Path</returns>
        private static Path GetPieSide(SectorChartShapeParams pieParams, Point3D centroid, Point3D centerTop, Point3D centerBottom, Point3D outerTop, Point3D outerBottom)
        {   
            Path pieFace = new Path() { Tag = new ElementData() { Element = pieParams.TagReference } };

            //pieFace.Fill = pieParams.Lighting ? Graphics.GetLightingEnabledBrush(pieParams.Background, "Linear", new Double[] { 0.845, 0.79 }) : pieParams.Background;

            pieFace.Fill = Get3DFaceColor(RenderAs.Pie, pieParams.Lighting, pieParams.Background, PieFaceTypes.Left, Double.NaN, Double.NaN, Double.NaN);
            
            List<PathGeometryParams> pathGeometryList = new List<PathGeometryParams>();

            pathGeometryList.Add(new LineSegmentParams(new Point(centerTop.X, centerTop.Y)));
            pathGeometryList.Add(new LineSegmentParams(new Point(outerTop.X, outerTop.Y)));
            pathGeometryList.Add(new LineSegmentParams(new Point(outerBottom.X, outerBottom.Y)));
            pathGeometryList.Add(new LineSegmentParams(new Point(centerBottom.X, centerBottom.Y)));

            pieFace.Data = GetPathGeometryFromList(FillRule.Nonzero, new Point(centerBottom.X, centerBottom.Y), pathGeometryList, true);
            PathFigure figure = (pieFace.Data as PathGeometry).Figures[0];
            PathSegmentCollection segments = figure.Segments;

            return pieFace;
        }
Exemple #4
0
        /// <summary>
        /// Returns a doughnut face
        /// </summary>
        /// <param name="doughnutParams">Doughnut parameters</param>
        /// <param name="centroid">Centroid</param>
        /// <param name="arcInnerStart">Arc inner dateTime point</param>
        /// <param name="arcInnerStop">Arc inner stop point</param>
        /// <param name="arcOuterStart">Arc outer dateTime point</param>
        /// <param name="arcOuterStop">Arc outer stop point</param>
        /// <param name="isTopFace">Whether a top face</param>
        /// <returns>Path</returns>
        private static Path GetDoughnutFace(SectorChartShapeParams doughnutParams, Point3D centroid, Point3D arcInnerStart, Point3D arcInnerStop, Point3D arcOuterStart, Point3D arcOuterStop, Boolean isTopFace)
        {
            Path pieFace = new Path() { Tag = new ElementData() { Element = doughnutParams.TagReference } };

            //pieFace.Fill = doughnutParams.Lighting ? Graphics.GetLightingEnabledBrush(doughnutParams.Background, -75, "Linear", new Double[] { 0.99, 0.854 }) : doughnutParams.Background;
            pieFace.Fill = Get3DFaceColor(RenderAs.Doughnut, doughnutParams.Lighting, doughnutParams.Background, PieFaceTypes.Top, Double.NaN, Double.NaN, Double.NaN);
           
           
            List<PathGeometryParams> pathGeometryList = new List<PathGeometryParams>();

            pathGeometryList.Add(new LineSegmentParams(new Point(arcOuterStop.X, arcOuterStop.Y)));
            pathGeometryList.Add(new ArcSegmentParams(new Size(doughnutParams.OuterRadius, doughnutParams.OuterRadius * doughnutParams.YAxisScaling), 0, doughnutParams.IsLargerArc, SweepDirection.Counterclockwise, new Point(arcOuterStart.X, arcOuterStart.Y)));
            pathGeometryList.Add(new LineSegmentParams(new Point(arcInnerStart.X, arcInnerStart.Y)));
            pathGeometryList.Add(new ArcSegmentParams(new Size(doughnutParams.InnerRadius, doughnutParams.InnerRadius * doughnutParams.YAxisScaling), 0, doughnutParams.IsLargerArc, SweepDirection.Clockwise, new Point(arcInnerStop.X, arcInnerStop.Y)));

            pieFace.Data = GetPathGeometryFromList(FillRule.Nonzero, new Point(arcInnerStop.X, arcInnerStop.Y), pathGeometryList, true);
            Point3D midPoint = GetFaceZIndex(arcInnerStart, arcInnerStop, arcOuterStart, arcOuterStop);
            if (isTopFace)
                pieFace.SetValue(Canvas.ZIndexProperty, (Int32)(doughnutParams.Height * 200));
            else
                pieFace.SetValue(Canvas.ZIndexProperty, (Int32)(-doughnutParams.Height * 200));
            return pieFace;
        }
Exemple #5
0
        /// <summary>
        /// Returns a pie face
        /// </summary>
        /// <param name="pieParams">Pie parameters</param>
        /// <param name="centroid">Centroid</param>
        /// <param name="center">Center</param>
        /// <param name="arcStart">Arc dateTime point</param>
        /// <param name="arcStop">Arc stop point</param>
        /// <returns>Path</returns>
        private static Path GetPieFace(SectorChartShapeParams pieParams, Point3D centroid, Point3D center, Point3D arcStart, Point3D arcStop)
        {
            Path pieFace = new Path() { Tag = new ElementData() { Element = pieParams.TagReference } };

            //pieFace.Fill = pieParams.Lighting ? Graphics.GetLightingEnabledBrush(pieParams.Background, "Linear", new Double[] { 0.99, 0.854 }) : pieParams.Background;

            pieFace.Fill = Get3DFaceColor(RenderAs.Pie, pieParams.Lighting, pieParams.Background, PieFaceTypes.Top, Double.NaN, Double.NaN, Double.NaN);

            List<PathGeometryParams> pathGeometryList = new List<PathGeometryParams>();

            pathGeometryList.Add(new LineSegmentParams(new Point(arcStop.X, arcStop.Y)));
            pathGeometryList.Add(new ArcSegmentParams(new Size(pieParams.OuterRadius, pieParams.OuterRadius * pieParams.YAxisScaling), 0, pieParams.IsLargerArc, SweepDirection.Counterclockwise, new Point(arcStart.X, arcStart.Y)));
            pathGeometryList.Add(new LineSegmentParams(new Point(center.X, center.Y)));

            pieFace.Data = GetPathGeometryFromList(FillRule.Nonzero, new Point(center.X, center.Y), pathGeometryList, true);

            PathFigure figure = (pieFace.Data as PathGeometry).Figures[0];
            PathSegmentCollection segments = figure.Segments;

            return pieFace;
        }
Exemple #6
0
        /// <summary>
        /// Returns curved path segment
        /// </summary>
        /// <param name="pieParams">Pie parameters</param>
        /// <param name="radius">Radius</param>
        /// <param name="startAngle">StartAngle</param>
        /// <param name="stopAngle">StopAngle</param>
        /// <param name="topFaceCenter">Top face center</param>
        /// <param name="bottomFaceCenter">Bottom face center</param>
        /// <param name="centroid">Centroid</param>
        /// <param name="isOuterSide">Whether outer side curve</param>
        /// <returns>Path</returns>
        private static Path GetCurvedSegment(SectorChartShapeParams pieParams, Double radius, Double startAngle, Double stopAngle, Point3D topFaceCenter, Point3D bottomFaceCenter, Point3D centroid, Boolean isOuterSide, RenderAs renderAs)
        {
            Point3D topArcStart = new Point3D();
            topArcStart.X = topFaceCenter.X + radius * Math.Cos(startAngle);
            topArcStart.Y = topFaceCenter.Y + radius * Math.Sin(startAngle) * pieParams.YAxisScaling;
            topArcStart.Z = (topFaceCenter.Z + radius) * Math.Sin(startAngle) * Math.Cos(pieParams.TiltAngle) + pieParams.Depth * Math.Cos(Math.PI / 2 - pieParams.TiltAngle);

            Point3D topArcStop = new Point3D();
            topArcStop.X = topFaceCenter.X + radius * Math.Cos(stopAngle);
            topArcStop.Y = topFaceCenter.Y + radius * Math.Sin(stopAngle) * pieParams.YAxisScaling;
            topArcStop.Z = (topFaceCenter.Z + radius) * Math.Sin(stopAngle) * Math.Cos(pieParams.TiltAngle) + pieParams.Depth * Math.Cos(Math.PI / 2 - pieParams.TiltAngle);

            Point3D bottomArcStart = new Point3D();
            bottomArcStart.X = bottomFaceCenter.X + radius * Math.Cos(startAngle);
            bottomArcStart.Y = bottomFaceCenter.Y + radius * Math.Sin(startAngle) * pieParams.YAxisScaling;
            bottomArcStart.Z = (bottomFaceCenter.Z + radius) * Math.Sin(startAngle) * Math.Cos(pieParams.TiltAngle) - pieParams.Depth * Math.Cos(Math.PI / 2 - pieParams.TiltAngle);

            Point3D bottomArcStop = new Point3D();
            bottomArcStop.X = bottomFaceCenter.X + radius * Math.Cos(stopAngle);
            bottomArcStop.Y = bottomFaceCenter.Y + radius * Math.Sin(stopAngle) * pieParams.YAxisScaling;
            bottomArcStop.Z = (bottomFaceCenter.Z + radius) * Math.Sin(stopAngle) * Math.Cos(pieParams.TiltAngle) - pieParams.Depth * Math.Cos(Math.PI / 2 - pieParams.TiltAngle);

            Path pieFace = new Path() { Tag = new ElementData() { Element = pieParams.TagReference } };

            // pieFace.Fill = pieParams.Lighting ? Graphics.GetLightingEnabledBrush(pieParams.Background, "Linear", new Double[] { 0.745, 0.99,  }) : pieParams.Background;

            pieFace.Fill = Get3DFaceColor(RenderAs.Doughnut, pieParams.Lighting, pieParams.Background, PieFaceTypes.CurvedSurface, startAngle,stopAngle, pieParams.TiltAngle);
            
            //if (renderAs == RenderAs.Pie)
            //{
            //    pieFace.Fill = pieParams.Lighting ? Graphics.GetLightingEnabledBrush(pieParams.Background, startAngle * 180 / Math.PI, "Linear", new Double[] { 0.99, 0.845 }) : pieParams.Background;
            //}
            //else
            //{
            //    if (stopAngle > Math.PI)
            //        pieFace.Fill = pieParams.Lighting ? Graphics.GetLightingEnabledBrush(pieParams.Background, pieParams.TiltAngle * 180 / Math.PI, "Linear", new Double[] { 0.99, 0.845 }) : pieParams.Background;
            //    else
            //        pieFace.Fill = pieParams.Lighting ? Graphics.GetLightingEnabledBrush(pieParams.Background, startAngle * 180 / Math.PI, "Linear", new Double[] { 0.99, 0.845 }) : pieParams.Background;
            //}

            List<PathGeometryParams> pathGeometryList = new List<PathGeometryParams>();

            Boolean isLargeArc = (Math.Abs(stopAngle - startAngle) > Math.PI) ? true : false;
            if (stopAngle < startAngle)
                isLargeArc = (Math.Abs((stopAngle + Math.PI * 2) - startAngle) > Math.PI) ? true : false;

            pathGeometryList.Add(new LineSegmentParams(new Point(topArcStop.X, topArcStop.Y)));
            pathGeometryList.Add(new ArcSegmentParams(new Size(radius, radius * pieParams.YAxisScaling), 0, isLargeArc, SweepDirection.Counterclockwise, new Point(topArcStart.X, topArcStart.Y)));
            pathGeometryList.Add(new LineSegmentParams(new Point(bottomArcStart.X, bottomArcStart.Y)));
            pathGeometryList.Add(new ArcSegmentParams(new Size(radius, radius * pieParams.YAxisScaling), 0, isLargeArc, SweepDirection.Clockwise, new Point(bottomArcStop.X, bottomArcStop.Y)));

            pieFace.Data = GetPathGeometryFromList(FillRule.Nonzero, new Point(bottomArcStop.X, bottomArcStop.Y), pathGeometryList, true);
            PathFigure figure = (pieFace.Data as PathGeometry).Figures[0];
            PathSegmentCollection segments = figure.Segments;

            return pieFace;
        }
Exemple #7
0
        /// <summary>
        /// Returns pie outer curved shapes
        /// </summary>
        /// <param name="pieParams">Pie parameters</param>
        /// <param name="centroid">Centroid</param>
        /// <param name="topFaceCenter">Top face center</param>
        /// <param name="bottomFaceCenter">Bottom face center</param>
        /// <returns>List of Shape</returns>
        private static List<Shape> GetPieOuterCurvedFace(SectorChartShapeParams pieParams, Point3D centroid, Point3D topFaceCenter, Point3D bottomFaceCenter)
        {
            List<Shape> curvedFaces = new List<Shape>();

            if (pieParams.StartAngle >= Math.PI && pieParams.StartAngle <= Math.PI * 2 && pieParams.StopAngle >= Math.PI && pieParams.StopAngle <= Math.PI * 2 && pieParams.IsLargerArc)
            {
                Path curvedSegment = GetCurvedSegment(pieParams, pieParams.OuterRadius, 0, Math.PI, topFaceCenter, bottomFaceCenter, centroid, true, RenderAs.Pie);
                curvedFaces.Add(curvedSegment);
            }
            else if (pieParams.StartAngle >= 0 && pieParams.StartAngle <= Math.PI && pieParams.StopAngle >= 0 && pieParams.StopAngle <= Math.PI && pieParams.IsLargerArc)
            {
                Path curvedSegment = GetCurvedSegment(pieParams, pieParams.OuterRadius, pieParams.StartAngle, Math.PI, topFaceCenter, bottomFaceCenter, centroid, true, RenderAs.Pie);
                curvedFaces.Add(curvedSegment);
                curvedSegment = GetCurvedSegment(pieParams, pieParams.OuterRadius, Math.PI * 2, pieParams.StopAngle, topFaceCenter, bottomFaceCenter, centroid, true, RenderAs.Pie);
                curvedFaces.Add(curvedSegment);
            }
            else if (pieParams.StartAngle >= 0 && pieParams.StartAngle <= Math.PI && pieParams.StopAngle >= Math.PI && pieParams.StopAngle <= Math.PI * 2)
            {
                Path curvedSegment = GetCurvedSegment(pieParams, pieParams.OuterRadius, pieParams.StartAngle, Math.PI, topFaceCenter, bottomFaceCenter, centroid, true, RenderAs.Pie);
                curvedFaces.Add(curvedSegment);
            }
            else if (pieParams.StartAngle >= Math.PI && pieParams.StartAngle <= Math.PI * 2 && pieParams.StopAngle >= 0 && pieParams.StopAngle <= Math.PI)
            {
                Path curvedSegment = GetCurvedSegment(pieParams, pieParams.OuterRadius, 0, pieParams.StopAngle, topFaceCenter, bottomFaceCenter, centroid, true, RenderAs.Pie);
                curvedFaces.Add(curvedSegment);
            }
            else
            {
                Path curvedSegment = GetCurvedSegment(pieParams, pieParams.OuterRadius, pieParams.StartAngle, pieParams.StopAngle, topFaceCenter, bottomFaceCenter, centroid, true, RenderAs.Pie);
                curvedFaces.Add(curvedSegment);
            }

            return curvedFaces;
        }
Exemple #8
0
        /// <summary>
        /// Returns 3D Doughnut shapes
        /// </summary>
        /// <param name="faces">Doughnut faces</param>
        /// <param name="doughnutParams">Doughnut parameters</param>
        /// <param name="unExplodedPoints">UnExploded dataPoints</param>
        /// <param name="explodedPoints">Exploded dataPoints</param>
        /// <param name="labelLinePath">Label line path</param>
        /// <param name="enabledDataPoints">List of enabled dataPoints</param>
        /// <returns>List of Shape</returns>
        private static List<Shape> GetDoughnut3D(DataSeries currentDataSeries, ref Faces faces, SectorChartShapeParams doughnutParams, ref PieDoughnut3DPoints unExplodedPoints, ref PieDoughnut3DPoints explodedPoints, ref Path labelLinePath, List<DataPoint> enabledDataPoints)
        {
            List<Shape> pieFaces = new List<Shape>();
            Shape topFace = null, bottomFace = null, rightFace = null, leftFace = null;

            // calculate 3d offsets
            Double yOffset = -doughnutParams.Depth / 2 * doughnutParams.ZAxisScaling;
            Point center = new Point();
            center.X += doughnutParams.Width / 2;
            center.Y += doughnutParams.Height / 2;

            // calculate all points
            Point3D topFaceCenter = new Point3D();
            topFaceCenter.X = center.X;
            topFaceCenter.Y = center.Y + yOffset;
            topFaceCenter.Z = doughnutParams.OffsetY * Math.Sin(doughnutParams.StartAngle) * Math.Cos(doughnutParams.TiltAngle) + doughnutParams.Depth * Math.Cos(Math.PI / 2 - doughnutParams.TiltAngle);

            Point3D topOuterArcStart = new Point3D();
            topOuterArcStart.X = topFaceCenter.X + doughnutParams.OuterRadius * Math.Cos(doughnutParams.StartAngle);
            topOuterArcStart.Y = topFaceCenter.Y + doughnutParams.OuterRadius * Math.Sin(doughnutParams.StartAngle) * doughnutParams.YAxisScaling;
            topOuterArcStart.Z = (topFaceCenter.Y + doughnutParams.OuterRadius) * Math.Sin(doughnutParams.StartAngle) * Math.Cos(doughnutParams.TiltAngle) + doughnutParams.Depth * Math.Cos(Math.PI / 2 - doughnutParams.TiltAngle);

            Point3D topOuterArcStop = new Point3D();
            topOuterArcStop.X = topFaceCenter.X + doughnutParams.OuterRadius * Math.Cos(doughnutParams.StopAngle);
            topOuterArcStop.Y = topFaceCenter.Y + doughnutParams.OuterRadius * Math.Sin(doughnutParams.StopAngle) * doughnutParams.YAxisScaling;
            topOuterArcStop.Z = (topFaceCenter.Y + doughnutParams.OuterRadius) * Math.Sin(doughnutParams.StopAngle) * Math.Cos(doughnutParams.TiltAngle) + doughnutParams.Depth * Math.Cos(Math.PI / 2 - doughnutParams.TiltAngle);

            Point3D topInnerArcStart = new Point3D();
            topInnerArcStart.X = topFaceCenter.X + doughnutParams.InnerRadius * Math.Cos(doughnutParams.StartAngle);
            topInnerArcStart.Y = topFaceCenter.Y + doughnutParams.InnerRadius * Math.Sin(doughnutParams.StartAngle) * doughnutParams.YAxisScaling;
            topInnerArcStart.Z = (topFaceCenter.Y + doughnutParams.InnerRadius) * Math.Sin(doughnutParams.StartAngle) * Math.Cos(doughnutParams.TiltAngle) + doughnutParams.Depth * Math.Cos(Math.PI / 2 - doughnutParams.TiltAngle);

            Point3D topInnerArcStop = new Point3D();
            topInnerArcStop.X = topFaceCenter.X + doughnutParams.InnerRadius * Math.Cos(doughnutParams.StopAngle);
            topInnerArcStop.Y = topFaceCenter.Y + doughnutParams.InnerRadius * Math.Sin(doughnutParams.StopAngle) * doughnutParams.YAxisScaling;
            topInnerArcStop.Z = (topFaceCenter.Y + doughnutParams.InnerRadius) * Math.Sin(doughnutParams.StopAngle) * Math.Cos(doughnutParams.TiltAngle) + doughnutParams.Depth * Math.Cos(Math.PI / 2 - doughnutParams.TiltAngle);

            Point3D bottomFaceCenter = new Point3D();
            bottomFaceCenter.X = center.X;
            bottomFaceCenter.Y = center.Y - yOffset;
            bottomFaceCenter.Z = doughnutParams.OffsetY * Math.Sin(doughnutParams.StartAngle) * Math.Cos(doughnutParams.TiltAngle) - doughnutParams.Depth * Math.Cos(Math.PI / 2 - doughnutParams.TiltAngle);

            Point3D bottomOuterArcStart = new Point3D();
            bottomOuterArcStart.X = bottomFaceCenter.X + doughnutParams.OuterRadius * Math.Cos(doughnutParams.StartAngle);
            bottomOuterArcStart.Y = bottomFaceCenter.Y + doughnutParams.OuterRadius * Math.Sin(doughnutParams.StartAngle) * doughnutParams.YAxisScaling;
            bottomOuterArcStart.Z = (bottomFaceCenter.Y + doughnutParams.OuterRadius) * Math.Sin(doughnutParams.StartAngle) * Math.Cos(doughnutParams.TiltAngle) - doughnutParams.Depth * Math.Cos(Math.PI / 2 - doughnutParams.TiltAngle);

            Point3D bottomOuterArcStop = new Point3D();
            bottomOuterArcStop.X = bottomFaceCenter.X + doughnutParams.OuterRadius * Math.Cos(doughnutParams.StopAngle);
            bottomOuterArcStop.Y = bottomFaceCenter.Y + doughnutParams.OuterRadius * Math.Sin(doughnutParams.StopAngle) * doughnutParams.YAxisScaling;
            bottomOuterArcStop.Z = (bottomFaceCenter.Y + doughnutParams.OuterRadius) * Math.Sin(doughnutParams.StopAngle) * Math.Cos(doughnutParams.TiltAngle) - doughnutParams.Depth * Math.Cos(Math.PI / 2 - doughnutParams.TiltAngle);

            Point3D bottomInnerArcStart = new Point3D();
            bottomInnerArcStart.X = bottomFaceCenter.X + doughnutParams.InnerRadius * Math.Cos(doughnutParams.StartAngle);
            bottomInnerArcStart.Y = bottomFaceCenter.Y + doughnutParams.InnerRadius * Math.Sin(doughnutParams.StartAngle) * doughnutParams.YAxisScaling;
            bottomInnerArcStart.Z = (bottomFaceCenter.Y + doughnutParams.InnerRadius) * Math.Sin(doughnutParams.StartAngle) * Math.Cos(doughnutParams.TiltAngle) - doughnutParams.Depth * Math.Cos(Math.PI / 2 - doughnutParams.TiltAngle);

            Point3D bottomInnerArcStop = new Point3D();
            bottomInnerArcStop.X = bottomFaceCenter.X + doughnutParams.InnerRadius * Math.Cos(doughnutParams.StopAngle);
            bottomInnerArcStop.Y = bottomFaceCenter.Y + doughnutParams.InnerRadius * Math.Sin(doughnutParams.StopAngle) * doughnutParams.YAxisScaling;
            bottomInnerArcStop.Z = (bottomFaceCenter.Y + doughnutParams.InnerRadius) * Math.Sin(doughnutParams.StopAngle) * Math.Cos(doughnutParams.TiltAngle) - doughnutParams.Depth * Math.Cos(Math.PI / 2 - doughnutParams.TiltAngle);

            Point3D centroid = GetCentroid(topInnerArcStart, topInnerArcStop, topOuterArcStart, topOuterArcStop, bottomInnerArcStart, bottomInnerArcStop, bottomOuterArcStart, bottomOuterArcStop);

            UpdatePositionLabelInsidePie(doughnutParams, yOffset);

            if (doughnutParams.StartAngle == doughnutParams.StopAngle && doughnutParams.IsLargerArc || enabledDataPoints.Count == 1)
            {
                // draw singleton pie here
                topFace = new Ellipse() { Tag = new ElementData() { Element = doughnutParams.TagReference } };
                // topFace.Fill = doughnutParams.Lighting ? Graphics.GetLightingEnabledBrush(doughnutParams.Background, "Radial", new Double[] { 0.99, 0.745 }) : doughnutParams.Background;
                topFace.Fill = doughnutParams.Lighting ? Graphics.GetLightingEnabledBrush(doughnutParams.Background, "Linear", new Double[] { 0.99, 0.854 }) : doughnutParams.Background;
                
                topFace.Width = 2 * doughnutParams.OuterRadius;
                topFace.Height = 2 * doughnutParams.OuterRadius * doughnutParams.YAxisScaling;
                topFace.SetValue(Canvas.LeftProperty, (Double)(doughnutParams.Center.X - topFace.Width / 2));
                topFace.SetValue(Canvas.TopProperty, (Double)(doughnutParams.Center.Y - topFace.Height / 2 + yOffset));

                GeometryGroup gg = new GeometryGroup();
                gg.Children.Add(new EllipseGeometry() { Center = new Point(topFace.Width / 2, topFace.Height / 2), RadiusX = topFace.Width, RadiusY = topFace.Height });
                gg.Children.Add(new EllipseGeometry() { Center = new Point(topFace.Width / 2, topFace.Height / 2), RadiusX = doughnutParams.InnerRadius, RadiusY = topFace.Height - 2 * (doughnutParams.OuterRadius - doughnutParams.InnerRadius) });

                topFace.Clip = gg;
                pieFaces.Add(topFace);
                faces.Parts.Add(topFace);

                bottomFace = new Ellipse() { Tag = new ElementData() { Element = doughnutParams.TagReference } };
                bottomFace.Fill = doughnutParams.Lighting ? Graphics.GetLightingEnabledBrush(doughnutParams.Background, "Radial", new Double[] { 0.99, 0.745 }) : doughnutParams.Background;
                // topFace.Stroke = pieParams.Lighting ? Graphics.GetLightingEnabledBrush(pieParams.Background, "Radial", new Double[] { 0.99, 0.745 }) : pieParams.Background;
                bottomFace.Width = 2 * doughnutParams.OuterRadius;
                bottomFace.Height = 2 * doughnutParams.OuterRadius * doughnutParams.YAxisScaling;
                bottomFace.SetValue(Canvas.LeftProperty, (Double)(doughnutParams.Center.X - topFace.Width / 2));
                bottomFace.SetValue(Canvas.TopProperty, (Double)(doughnutParams.Center.Y - topFace.Height / 2));

                gg = new GeometryGroup();
                gg.Children.Add(new EllipseGeometry() { Center = new Point(topFace.Width / 2, topFace.Height / 2), RadiusX = topFace.Width, RadiusY = topFace.Height });
                gg.Children.Add(new EllipseGeometry() { Center = new Point(topFace.Width / 2, topFace.Height / 2), RadiusX = doughnutParams.InnerRadius, RadiusY = topFace.Height - 2 * (doughnutParams.OuterRadius - doughnutParams.InnerRadius) });

                bottomFace.Clip = gg;
                pieFaces.Add(bottomFace);
                faces.Parts.Add(bottomFace);
            }
            else
            {
                topFace = GetDoughnutFace(doughnutParams, centroid, topInnerArcStart, topInnerArcStop, topOuterArcStart, topOuterArcStop, true);
                pieFaces.Add(topFace);
                faces.Parts.Add(topFace);

                bottomFace = GetDoughnutFace(doughnutParams, centroid, bottomInnerArcStart, bottomInnerArcStop, bottomOuterArcStart, bottomOuterArcStop, false);
                pieFaces.Add(bottomFace);
                faces.Parts.Add(bottomFace);

                rightFace = GetPieSide(doughnutParams, centroid, topInnerArcStart, bottomInnerArcStart, topOuterArcStart, bottomOuterArcStart);
                pieFaces.Add(rightFace);
                faces.Parts.Add(rightFace);

                leftFace = GetPieSide(doughnutParams, centroid, topInnerArcStop, bottomInnerArcStop, topOuterArcStop, bottomOuterArcStop);
                pieFaces.Add(leftFace);
                faces.Parts.Add(leftFace);
            }

            List<Shape> curvedSurface = GetDoughnutCurvedFace(doughnutParams, centroid, topFaceCenter, bottomFaceCenter);
            pieFaces.InsertRange(pieFaces.Count, curvedSurface);

            foreach (FrameworkElement fe in curvedSurface)
                faces.Parts.Add(fe);

            labelLinePath = CreateLabelLine(currentDataSeries, doughnutParams, center, ref unExplodedPoints, ref explodedPoints);

            if ((doughnutParams.TagReference as DataPoint).InternalYValue == 0)
                return new List<Shape>();

            //Top face ZIndex
            topFace.SetValue(Canvas.ZIndexProperty, (Int32)(50000));
            //BottomFace ZIndex
            bottomFace.SetValue(Canvas.ZIndexProperty, (Int32)(-50000));

            if (!(doughnutParams.StartAngle == doughnutParams.StopAngle && doughnutParams.IsLargerArc))
            {
                // ZIndex of curved face
                if (doughnutParams.StartAngle >= Math.PI && doughnutParams.StartAngle <= Math.PI * 2 && doughnutParams.StopAngle >= Math.PI && doughnutParams.StopAngle <= Math.PI * 2 && doughnutParams.IsLargerArc)
                {
                    _elementPositionData.Add(new ElementPositionData(rightFace, doughnutParams.StartAngle, doughnutParams.StartAngle));
                    _elementPositionData.Add(new ElementPositionData(curvedSurface[0], 0, Math.PI));
                    _elementPositionData.Add(new ElementPositionData(curvedSurface[1], doughnutParams.StartAngle, 0));
                    _elementPositionData.Add(new ElementPositionData(curvedSurface[2], Math.PI, doughnutParams.StopAngle));
                    _elementPositionData.Add(new ElementPositionData(leftFace, doughnutParams.StopAngle, doughnutParams.StopAngle));
                    if (labelLinePath != null)
                        _elementPositionData.Add(new ElementPositionData(labelLinePath, 0, Math.PI));
                }
                else if (doughnutParams.StartAngle >= 0 && doughnutParams.StartAngle <= Math.PI && doughnutParams.StopAngle >= 0 && doughnutParams.StopAngle <= Math.PI && doughnutParams.IsLargerArc)
                {
                    _elementPositionData.Add(new ElementPositionData(rightFace, doughnutParams.StartAngle, doughnutParams.StartAngle));
                    _elementPositionData.Add(new ElementPositionData(curvedSurface[0], doughnutParams.StartAngle, Math.PI));
                    _elementPositionData.Add(new ElementPositionData(curvedSurface[1], Math.PI * 2, doughnutParams.StopAngle));
                    _elementPositionData.Add(new ElementPositionData(curvedSurface[2], Math.PI, Math.PI * 2));
                    _elementPositionData.Add(new ElementPositionData(leftFace, doughnutParams.StopAngle, doughnutParams.StopAngle));
                    if (labelLinePath != null)
                        labelLinePath.SetValue(Canvas.ZIndexProperty, -50000);
                }
                else if (doughnutParams.StartAngle >= 0 && doughnutParams.StartAngle <= Math.PI && doughnutParams.StopAngle >= Math.PI && doughnutParams.StopAngle <= Math.PI * 2)
                {
                    _elementPositionData.Add(new ElementPositionData(rightFace, doughnutParams.StartAngle, doughnutParams.StartAngle));
                    if (labelLinePath != null)
                        _elementPositionData.Add(new ElementPositionData(labelLinePath, doughnutParams.StartAngle, Math.PI));
                    _elementPositionData.Add(new ElementPositionData(curvedSurface[0], doughnutParams.StartAngle, Math.PI));
                    _elementPositionData.Add(new ElementPositionData(curvedSurface[1], Math.PI, doughnutParams.StopAngle));
                    _elementPositionData.Add(new ElementPositionData(leftFace, doughnutParams.StopAngle, doughnutParams.StopAngle));
                }
                else if (doughnutParams.StartAngle >= Math.PI && doughnutParams.StartAngle <= Math.PI * 2 && doughnutParams.StopAngle >= 0 && doughnutParams.StopAngle <= Math.PI)
                {
                    _elementPositionData.Add(new ElementPositionData(rightFace, doughnutParams.StartAngle, doughnutParams.StartAngle));
                    _elementPositionData.Add(new ElementPositionData(curvedSurface[0], 0, doughnutParams.StopAngle));
                    _elementPositionData.Add(new ElementPositionData(curvedSurface[1], doughnutParams.StartAngle, 0));
                    _elementPositionData.Add(new ElementPositionData(leftFace, doughnutParams.StopAngle, doughnutParams.StopAngle));
                    if (labelLinePath != null)
                        _elementPositionData.Add(new ElementPositionData(labelLinePath, doughnutParams.StopAngle, doughnutParams.StopAngle));
                }
                else
                {
                    _elementPositionData.Add(new ElementPositionData(rightFace, doughnutParams.StartAngle, doughnutParams.StartAngle));
                    if (doughnutParams.StartAngle >= 0 && doughnutParams.StartAngle < Math.PI / 2 && doughnutParams.StopAngle >= 0 && doughnutParams.StopAngle < Math.PI / 2)
                    {
                        if (labelLinePath != null)
                            _elementPositionData.Add(new ElementPositionData(labelLinePath, doughnutParams.StopAngle, doughnutParams.StopAngle));
                        _elementPositionData.Add(new ElementPositionData(curvedSurface[0], doughnutParams.StartAngle, doughnutParams.StopAngle));
                    }
                    else if (doughnutParams.StartAngle >= 0 && doughnutParams.StartAngle < Math.PI / 2 && doughnutParams.StopAngle >= Math.PI / 2 && doughnutParams.StopAngle < Math.PI)
                    {
                        if (labelLinePath != null)
                            labelLinePath.SetValue(Canvas.ZIndexProperty, 40000);
                        _elementPositionData.Add(new ElementPositionData(curvedSurface[0], doughnutParams.StartAngle, doughnutParams.StopAngle));
                    }
                    else if (doughnutParams.StartAngle >= Math.PI / 2 && doughnutParams.StartAngle < Math.PI && doughnutParams.StopAngle >= Math.PI / 2 && doughnutParams.StopAngle < Math.PI)
                    {
                        if (labelLinePath != null)
                            _elementPositionData.Add(new ElementPositionData(labelLinePath, doughnutParams.StartAngle, doughnutParams.StartAngle));
                        _elementPositionData.Add(new ElementPositionData(curvedSurface[0], doughnutParams.StartAngle, doughnutParams.StopAngle));
                    }
                    else if (doughnutParams.StartAngle >= Math.PI && doughnutParams.StartAngle < Math.PI * 1.5 && doughnutParams.StopAngle >= Math.PI && doughnutParams.StopAngle < Math.PI * 1.5)
                    {
                        _elementPositionData.Add(new ElementPositionData(curvedSurface[0], doughnutParams.StartAngle, doughnutParams.StopAngle));
                        if (labelLinePath != null)
                            _elementPositionData.Add(new ElementPositionData(labelLinePath, doughnutParams.StartAngle, doughnutParams.StartAngle));
                    }
                    else if (doughnutParams.StartAngle >= Math.PI * 1.5 && doughnutParams.StartAngle < Math.PI * 2 && doughnutParams.StopAngle >= Math.PI * 1.5 && doughnutParams.StopAngle < Math.PI * 2)
                    {
                        _elementPositionData.Add(new ElementPositionData(curvedSurface[0], doughnutParams.StartAngle, doughnutParams.StopAngle));
                        if (labelLinePath != null)
                            _elementPositionData.Add(new ElementPositionData(labelLinePath, doughnutParams.StartAngle, doughnutParams.StopAngle));
                    }
                    else
                    {
                        if (labelLinePath != null)
                            _elementPositionData.Add(new ElementPositionData(labelLinePath, doughnutParams.StartAngle, doughnutParams.StartAngle));
                        _elementPositionData.Add(new ElementPositionData(curvedSurface[0], doughnutParams.StartAngle, doughnutParams.StopAngle));
                    }
                    _elementPositionData.Add(new ElementPositionData(leftFace, doughnutParams.StopAngle, doughnutParams.StopAngle));
                }
            }

            return pieFaces;
        }
Exemple #9
0
        /// <summary>
        /// Returns 3D Pie shapes
        /// </summary>
        /// <param name="faces">Pie faces</param>
        /// <param name="pieParams">Pie parameters</param>
        /// <param name="zindex">Zindex</param>
        /// <param name="unExplodedPoints">UnExploded dataPoints</param>
        /// <param name="explodedPoints">Exploded dataPoints</param>
        /// <param name="labelLinePath">Label line path</param>
        /// <param name="enabledDataPoints">List of enabled dataPoints</param>
        /// <returns>List of Shape</returns>
        private static List<Shape> GetPie3D(DataSeries currentDataSeries, ref Faces faces, SectorChartShapeParams pieParams, ref Int32 zindex, ref PieDoughnut3DPoints unExplodedPoints, ref PieDoughnut3DPoints explodedPoints, ref Path labelLinePath, List<DataPoint> enabledDataPoints)
        {
            List<Shape> pieFaces = new List<Shape>();

            Shape topFace = null, bottomFace = null, rightFace = null, leftFace = null;
            Point center = new Point();
            center.X = pieParams.Width / 2;
            center.Y = pieParams.Height / 2;

            // calculate 3d offsets
            Double yOffset = -pieParams.Depth / 2 * pieParams.ZAxisScaling;

            // calculate all points
            Point3D topFaceCenter = new Point3D();
            topFaceCenter.X = center.X;
            topFaceCenter.Y = center.Y + yOffset;
            topFaceCenter.Z = pieParams.OffsetY * Math.Sin(pieParams.StartAngle) * Math.Cos(pieParams.TiltAngle) + pieParams.Depth * Math.Cos(Math.PI / 2 - pieParams.TiltAngle);

            Point3D topArcStart = new Point3D();
            topArcStart.X = topFaceCenter.X + pieParams.OuterRadius * Math.Cos(pieParams.StartAngle);
            topArcStart.Y = topFaceCenter.Y + pieParams.OuterRadius * Math.Sin(pieParams.StartAngle) * pieParams.YAxisScaling;
            topArcStart.Z = (topFaceCenter.Y + pieParams.OuterRadius) * Math.Sin(pieParams.StartAngle) * Math.Cos(pieParams.TiltAngle) + pieParams.Depth * Math.Cos(Math.PI / 2 - pieParams.TiltAngle);

            Point3D topArcStop = new Point3D();
            topArcStop.X = topFaceCenter.X + pieParams.OuterRadius * Math.Cos(pieParams.StopAngle);
            topArcStop.Y = topFaceCenter.Y + pieParams.OuterRadius * Math.Sin(pieParams.StopAngle) * pieParams.YAxisScaling;
            topArcStop.Z = (topFaceCenter.Y + pieParams.OuterRadius) * Math.Sin(pieParams.StopAngle) * Math.Cos(pieParams.TiltAngle) + pieParams.Depth * Math.Cos(Math.PI / 2 - pieParams.TiltAngle);

            Point3D bottomFaceCenter = new Point3D();
            bottomFaceCenter.X = center.X;
            bottomFaceCenter.Y = center.Y - yOffset;
            bottomFaceCenter.Z = pieParams.OffsetY * Math.Sin(pieParams.StartAngle) * Math.Cos(pieParams.TiltAngle) - pieParams.Depth * Math.Cos(Math.PI / 2 - pieParams.TiltAngle);

            Point3D bottomArcStart = new Point3D();
            bottomArcStart.X = bottomFaceCenter.X + pieParams.OuterRadius * Math.Cos(pieParams.StartAngle);
            bottomArcStart.Y = bottomFaceCenter.Y + pieParams.OuterRadius * Math.Sin(pieParams.StartAngle) * pieParams.YAxisScaling;
            bottomArcStart.Z = (bottomFaceCenter.Y + pieParams.OuterRadius) * Math.Sin(pieParams.StartAngle) * Math.Cos(pieParams.TiltAngle) - pieParams.Depth * Math.Cos(Math.PI / 2 - pieParams.TiltAngle);

            Point3D bottomArcStop = new Point3D();
            bottomArcStop.X = bottomFaceCenter.X + pieParams.OuterRadius * Math.Cos(pieParams.StopAngle);
            bottomArcStop.Y = bottomFaceCenter.Y + pieParams.OuterRadius * Math.Sin(pieParams.StopAngle) * pieParams.YAxisScaling;
            bottomArcStop.Z = (bottomFaceCenter.Y + pieParams.OuterRadius) * Math.Sin(pieParams.StopAngle) * Math.Cos(pieParams.TiltAngle) - pieParams.Depth * Math.Cos(Math.PI / 2 - pieParams.TiltAngle);

            Point3D centroid = GetCentroid(topFaceCenter, topArcStart, topArcStop, bottomFaceCenter, bottomArcStart, bottomArcStop);

            UpdatePositionLabelInsidePie(pieParams, yOffset);

            if (pieParams.StartAngle == pieParams.StopAngle && pieParams.IsLargerArc || enabledDataPoints.Count == 1)
            {
                // draw singleton pie here
                topFace = new Ellipse() { Tag = new ElementData() { Element = pieParams.TagReference } };
                // topFace.Fill = pieParams.Lighting ? Graphics.GetLightingEnabledBrush(pieParams.Background, "Radial", new Double[] { 0.99, 0.745 }) : pieParams.Background;
                topFace.Fill = pieParams.Lighting ? Graphics.GetLightingEnabledBrush(pieParams.Background, "Linear", new Double[] { 0.99, 0.854 }) : pieParams.Background;

                topFace.Width = 2 * pieParams.OuterRadius;
                topFace.Height = 2 * pieParams.OuterRadius * pieParams.YAxisScaling;
                topFace.SetValue(Canvas.LeftProperty, (Double)(pieParams.Center.X - topFace.Width / 2));
                topFace.SetValue(Canvas.TopProperty, (Double)(pieParams.Center.Y - topFace.Height / 2 + yOffset));
                pieFaces.Add(topFace);
                faces.Parts.Add(topFace);

                bottomFace = new Ellipse() { Tag = new ElementData() { Element = pieParams.TagReference } };
                bottomFace.Fill = pieParams.Lighting ? Graphics.GetLightingEnabledBrush(pieParams.Background, "Radial", new Double[] { 0.99, 0.745 }) : pieParams.Background;

                bottomFace.Width = 2 * pieParams.OuterRadius;
                bottomFace.Height = 2 * pieParams.OuterRadius * pieParams.YAxisScaling;
                bottomFace.SetValue(Canvas.LeftProperty, (Double)(pieParams.Center.X - topFace.Width / 2));
                bottomFace.SetValue(Canvas.TopProperty, (Double)(pieParams.Center.Y - topFace.Height / 2 + yOffset));
                pieFaces.Add(bottomFace);
                faces.Parts.Add(bottomFace);
            }
            else
            {
                topFace = GetPieFace(pieParams, centroid, topFaceCenter, topArcStart, topArcStop);
                pieFaces.Add(topFace);
                faces.Parts.Add(topFace);

                bottomFace = GetPieFace(pieParams, centroid, bottomFaceCenter, bottomArcStart, bottomArcStop);
                pieFaces.Add(bottomFace);
                faces.Parts.Add(bottomFace);

                rightFace = GetPieSide(pieParams, centroid, topFaceCenter, bottomFaceCenter, topArcStart, bottomArcStart);
                pieFaces.Add(rightFace);
                faces.Parts.Add(rightFace);

                leftFace = GetPieSide(pieParams, centroid, topFaceCenter, bottomFaceCenter, topArcStop, bottomArcStop);
                pieFaces.Add(leftFace);
                faces.Parts.Add(leftFace);
            }

            labelLinePath = CreateLabelLine(currentDataSeries, pieParams, center, ref unExplodedPoints, ref explodedPoints);

            if ((pieParams.TagReference as DataPoint).InternalYValue == 0)
                return new List<Shape>();

            List<Shape> curvedSurface = GetPieOuterCurvedFace(pieParams, centroid, topFaceCenter, bottomFaceCenter);
            pieFaces.InsertRange(pieFaces.Count, curvedSurface.ToList());

            foreach (FrameworkElement fe in curvedSurface)
                faces.Parts.Add(fe);

            //Top face ZIndex
            topFace.SetValue(Canvas.ZIndexProperty, (Int32)(50000));

            //BottomFace ZIndex
            bottomFace.SetValue(Canvas.ZIndexProperty, (Int32)(-50000));

            if (pieParams.StartAngle == pieParams.StopAngle && pieParams.IsLargerArc)
            {

            }
            else
            {
                // ZIndex of curved face
                if (pieParams.StartAngle >= Math.PI && pieParams.StartAngle <= Math.PI * 2 && pieParams.StopAngle >= Math.PI && pieParams.StopAngle <= Math.PI * 2 && pieParams.IsLargerArc)
                {
                    _elementPositionData.Add(new ElementPositionData(rightFace, pieParams.StartAngle, pieParams.StartAngle));
                    _elementPositionData.Add(new ElementPositionData(curvedSurface[0], 0, Math.PI));
                    _elementPositionData.Add(new ElementPositionData(leftFace, pieParams.StopAngle, pieParams.StopAngle));
                    if (labelLinePath != null)
                        _elementPositionData.Add(new ElementPositionData(labelLinePath, 0, Math.PI));
                }
                else if (pieParams.StartAngle >= 0 && pieParams.StartAngle <= Math.PI && pieParams.StopAngle >= 0 && pieParams.StopAngle <= Math.PI && pieParams.IsLargerArc)
                {
                    _elementPositionData.Add(new ElementPositionData(rightFace, pieParams.StartAngle, pieParams.StartAngle));
                    _elementPositionData.Add(new ElementPositionData(curvedSurface[0], pieParams.StartAngle, Math.PI));
                    _elementPositionData.Add(new ElementPositionData(curvedSurface[1], 0, pieParams.StopAngle));
                    _elementPositionData.Add(new ElementPositionData(leftFace, pieParams.StopAngle, pieParams.StopAngle));
                    if (labelLinePath != null)
                        labelLinePath.SetValue(Canvas.ZIndexProperty, -50000);
                }
                else if (pieParams.StartAngle >= 0 && pieParams.StartAngle <= Math.PI && pieParams.StopAngle >= Math.PI && pieParams.StopAngle <= Math.PI * 2)
                {
                    _elementPositionData.Add(new ElementPositionData(rightFace, pieParams.StartAngle, pieParams.StartAngle));
                    
                    //  if (labelLinePath != null)
                    //      _elementPositionData.Add(new ElementPositionData(labelLinePath, pieParams.StartAngle, Math.PI));

                    //------------
                    if (labelLinePath != null)
                    {
                        if (pieParams.StartAngle >= Math.PI / 2 && pieParams.StopAngle <= Math.PI)
                            labelLinePath.SetValue(Canvas.ZIndexProperty, 50000);
                        else
                            _elementPositionData.Add(new ElementPositionData(labelLinePath, pieParams.StartAngle, Math.PI));
                    }
                    //------------

                    _elementPositionData.Add(new ElementPositionData(leftFace, pieParams.StopAngle, pieParams.StopAngle));
                    _elementPositionData.Add(new ElementPositionData(curvedSurface[0], pieParams.StartAngle, Math.PI));
                }
                else if (pieParams.StartAngle >= Math.PI && pieParams.StartAngle <= Math.PI * 2 && pieParams.StopAngle >= 0 && pieParams.StopAngle <= Math.PI)
                {
                    _elementPositionData.Add(new ElementPositionData(rightFace, pieParams.StartAngle, pieParams.StartAngle));
                    _elementPositionData.Add(new ElementPositionData(curvedSurface[0], 0, pieParams.StopAngle));
                    _elementPositionData.Add(new ElementPositionData(leftFace, pieParams.StopAngle, pieParams.StopAngle));
                    if (labelLinePath != null)
                        _elementPositionData.Add(new ElementPositionData(labelLinePath, pieParams.StopAngle, pieParams.StopAngle));
                }
                else
                {
                    _elementPositionData.Add(new ElementPositionData(rightFace, pieParams.StartAngle, pieParams.StartAngle));
                    if (pieParams.StartAngle >= 0 && pieParams.StartAngle < Math.PI / 2 && pieParams.StopAngle >= 0 && pieParams.StopAngle < Math.PI / 2)
                    {
                        if (labelLinePath != null)
                            _elementPositionData.Add(new ElementPositionData(labelLinePath, pieParams.StopAngle, pieParams.StopAngle));
                        _elementPositionData.Add(new ElementPositionData(curvedSurface[0], pieParams.StartAngle, pieParams.StopAngle));
                    }
                    else if (pieParams.StartAngle >= 0 && pieParams.StartAngle < Math.PI / 2 && pieParams.StopAngle >= Math.PI / 2 && pieParams.StopAngle < Math.PI)
                    {
                        if (labelLinePath != null)
                            labelLinePath.SetValue(Canvas.ZIndexProperty, 40000);
                        curvedSurface[0].SetValue(Canvas.ZIndexProperty, 35000);
                    }
                    else if (pieParams.StartAngle >= Math.PI / 2 && pieParams.StartAngle < Math.PI && pieParams.StopAngle >= Math.PI / 2 && pieParams.StopAngle < Math.PI)
                    {
                        if (labelLinePath != null)
                            _elementPositionData.Add(new ElementPositionData(labelLinePath, pieParams.StartAngle, pieParams.StartAngle));
                        _elementPositionData.Add(new ElementPositionData(curvedSurface[0], pieParams.StartAngle, pieParams.StopAngle));
                    }
                    else if (pieParams.StartAngle >= Math.PI && pieParams.StartAngle < Math.PI * 1.5 && pieParams.StopAngle >= Math.PI && pieParams.StopAngle < Math.PI * 1.5)
                    {
                        _elementPositionData.Add(new ElementPositionData(curvedSurface[0], pieParams.StartAngle, pieParams.StopAngle));
                        if (labelLinePath != null)
                            _elementPositionData.Add(new ElementPositionData(labelLinePath, pieParams.StartAngle, pieParams.StartAngle));
                    }
                    else if (pieParams.StartAngle >= Math.PI * 1.5 && pieParams.StartAngle < Math.PI * 2 && pieParams.StopAngle >= Math.PI * 1.5 && pieParams.StopAngle < Math.PI * 2)
                    {
                        _elementPositionData.Add(new ElementPositionData(curvedSurface[0], pieParams.StartAngle, pieParams.StopAngle));
                        if (labelLinePath != null)
                            _elementPositionData.Add(new ElementPositionData(labelLinePath, pieParams.StartAngle, pieParams.StopAngle));
                    }
                    else
                    {
                        if (labelLinePath != null)
                            _elementPositionData.Add(new ElementPositionData(labelLinePath, pieParams.StartAngle, pieParams.StartAngle));
                        _elementPositionData.Add(new ElementPositionData(curvedSurface[0], pieParams.StartAngle, pieParams.StopAngle));
                    }

                    _elementPositionData.Add(new ElementPositionData(leftFace, pieParams.StopAngle, pieParams.StopAngle));
                }
            }

            return pieFaces;

        }