コード例 #1
0
        protected override void GetPointWidthAndHeight(Series series, int pointIndex, float location, out float height, out float startWidth, out float endWidth)
        {
            PointF     empty             = PointF.Empty;
            RectangleF absoluteRectangle = base.graph.GetAbsoluteRectangle(base.plotAreaPosition);
            float      num = absoluteRectangle.Height - base.funnelSegmentGap * (float)(base.pointNumber - (this.ShouldDrawFirstPoint() ? 1 : 2));

            if (num < 0.0)
            {
                num = 0f;
            }
            height = (float)((double)num * (this.GetYValue(series.Points[pointIndex], pointIndex) / base.yValueTotal));
            height = base.CheckMinHeight(height);
            PointF linesIntersection = ChartGraphics3D.GetLinesIntersection(absoluteRectangle.X, location - height, absoluteRectangle.Right, location - height, absoluteRectangle.X, absoluteRectangle.Bottom, (float)(absoluteRectangle.X + absoluteRectangle.Width / 2.0), absoluteRectangle.Y);

            if (linesIntersection.X > absoluteRectangle.X + absoluteRectangle.Width / 2.0)
            {
                linesIntersection.X = (float)(absoluteRectangle.X + absoluteRectangle.Width / 2.0);
            }
            PointF linesIntersection2 = ChartGraphics3D.GetLinesIntersection(absoluteRectangle.X, location, absoluteRectangle.Right, location, absoluteRectangle.X, absoluteRectangle.Bottom, (float)(absoluteRectangle.X + absoluteRectangle.Width / 2.0), absoluteRectangle.Y);

            if (linesIntersection2.X > absoluteRectangle.X + absoluteRectangle.Width / 2.0)
            {
                linesIntersection2.X = (float)(absoluteRectangle.X + absoluteRectangle.Width / 2.0);
            }
            startWidth = (float)(Math.Abs((float)(absoluteRectangle.X + absoluteRectangle.Width / 2.0 - linesIntersection.X)) * 2.0);
            endWidth   = (float)(Math.Abs((float)(absoluteRectangle.X + absoluteRectangle.Width / 2.0 - linesIntersection2.X)) * 2.0);
            empty      = new PointF((float)(absoluteRectangle.X + absoluteRectangle.Width / 2.0), (float)(location - height / 2.0));
            series.Points[pointIndex].positionRel = base.graph.GetRelativePoint(empty);
        }
コード例 #2
0
        protected override GraphicsPath Draw3DSurface(DataPoint3D firstPoint, DataPoint3D secondPoint, bool reversed, ChartArea area, ChartGraphics graph, Matrix3D matrix, LightStyle lightStyle, DataPoint3D prevDataPointEx, float positionZ, float depth, ArrayList points, int pointIndex, int pointLoopIndex, float tension, DrawingOperationTypes operationType, LineSegmentType surfaceSegmentType, float topDarkening, float bottomDarkening, PointF thirdPointPosition, PointF fourthPointPosition, bool clippedSegment, bool clipOnTop, bool clipOnBottom)
        {
            GraphicsPath graphicsPath = ((operationType & DrawingOperationTypes.CalcElementPath) == DrawingOperationTypes.CalcElementPath) ? new GraphicsPath() : null;
            DataPoint3D  dataPoint3D  = secondPoint;

            if (prevDataPointEx.dataPoint.Empty)
            {
                dataPoint3D = prevDataPointEx;
            }
            else if (firstPoint.index > secondPoint.index)
            {
                dataPoint3D = firstPoint;
            }
            Color          color       = useBorderColor ? dataPoint3D.dataPoint.BorderColor : dataPoint3D.dataPoint.Color;
            ChartDashStyle borderStyle = dataPoint3D.dataPoint.BorderStyle;

            if (dataPoint3D.dataPoint.Empty && dataPoint3D.dataPoint.Color == Color.Empty)
            {
                color = Color.Gray;
            }
            if (dataPoint3D.dataPoint.Empty && dataPoint3D.dataPoint.BorderStyle == ChartDashStyle.NotSet)
            {
                borderStyle = ChartDashStyle.Solid;
            }
            float num = (float)vAxis.GetPosition(vAxis.Crossing);

            GetBottomPointsPosition(common, area, num, ref firstPoint, ref secondPoint, out PointF thirdPoint, out PointF fourthPoint);
            if (!float.IsNaN(thirdPointPosition.Y))
            {
                thirdPoint.Y = thirdPointPosition.Y;
            }
            if (!float.IsNaN(fourthPointPosition.Y))
            {
                fourthPoint.Y = fourthPointPosition.Y;
            }
            if ((firstPoint.yPosition > (double)thirdPoint.Y && secondPoint.yPosition < (double)fourthPoint.Y) || (firstPoint.yPosition < (double)thirdPoint.Y && secondPoint.yPosition > (double)fourthPoint.Y))
            {
                if (tension != 0f)
                {
                    throw new InvalidOperationException(SR.Exception3DSplineY1ValueIsLessThenY2);
                }
                PointF      linesIntersection = ChartGraphics3D.GetLinesIntersection((float)firstPoint.xPosition, (float)firstPoint.yPosition, (float)secondPoint.xPosition, (float)secondPoint.yPosition, thirdPoint.X, thirdPoint.Y, fourthPoint.X, fourthPoint.Y);
                DataPoint3D dataPoint3D2      = new DataPoint3D();
                dataPoint3D2.xPosition = linesIntersection.X;
                dataPoint3D2.yPosition = linesIntersection.Y;
                bool flag = true;
                if (double.IsNaN(linesIntersection.X) || double.IsNaN(linesIntersection.Y))
                {
                    flag = false;
                }
                else
                {
                    if ((decimal)linesIntersection.X == (decimal)firstPoint.xPosition && (decimal)linesIntersection.Y == (decimal)firstPoint.yPosition)
                    {
                        flag = false;
                    }
                    if ((decimal)linesIntersection.X == (decimal)secondPoint.xPosition && (decimal)linesIntersection.Y == (decimal)secondPoint.yPosition)
                    {
                        flag = false;
                    }
                }
                if (flag)
                {
                    reversed = false;
                    if (pointIndex + 1 < points.Count && ((DataPoint3D)points[pointIndex + 1]).index == firstPoint.index)
                    {
                        reversed = true;
                    }
                    for (int i = 0; i <= 1; i++)
                    {
                        GraphicsPath graphicsPath2 = null;
                        if ((i == 0 && !reversed) || (i == 1 && reversed))
                        {
                            fourthPointY2Value     = (float)dataPoint3D2.yPosition;
                            dataPoint3D2.dataPoint = secondPoint.dataPoint;
                            dataPoint3D2.index     = secondPoint.index;
                            graphicsPath2          = Draw3DSurface(firstPoint, dataPoint3D2, reversed, area, graph, matrix, lightStyle, prevDataPointEx, positionZ, depth, points, pointIndex, pointLoopIndex, tension, operationType, surfaceSegmentType, topDarkening, bottomDarkening, new PointF(float.NaN, float.NaN), new PointF(float.NaN, float.NaN), clippedSegment, clipOnTop: true, clipOnBottom: true);
                        }
                        if ((i == 1 && !reversed) || (i == 0 && reversed))
                        {
                            thirdPointY2Value      = (float)dataPoint3D2.yPosition;
                            dataPoint3D2.dataPoint = firstPoint.dataPoint;
                            dataPoint3D2.index     = firstPoint.index;
                            graphicsPath2          = Draw3DSurface(dataPoint3D2, secondPoint, reversed, area, graph, matrix, lightStyle, prevDataPointEx, positionZ, depth, points, pointIndex, pointLoopIndex, tension, operationType, surfaceSegmentType, topDarkening, bottomDarkening, new PointF(float.NaN, float.NaN), new PointF(float.NaN, float.NaN), clippedSegment, clipOnTop: true, clipOnBottom: true);
                        }
                        if (graphicsPath != null && graphicsPath2 != null && graphicsPath2.PointCount > 0)
                        {
                            graphicsPath.AddPath(graphicsPath2, connect: true);
                        }
                        thirdPointY2Value  = float.NaN;
                        fourthPointY2Value = float.NaN;
                    }
                    return(graphicsPath);
                }
            }
            float num2 = (float)Math.Min(firstPoint.xPosition, secondPoint.xPosition);
            float val  = (float)Math.Min(firstPoint.yPosition, secondPoint.yPosition);

            val = Math.Min(val, num);
            float num3 = (float)Math.Max(firstPoint.xPosition, secondPoint.xPosition);
            float val2 = (float)Math.Max(firstPoint.yPosition, secondPoint.yPosition);

            val2 = Math.Max(val2, num);
            RectangleF   position        = new RectangleF(num2, val, num3 - num2, val2 - val);
            SurfaceNames visibleSurfaces = graph.GetVisibleSurfaces(position, positionZ, depth, matrix);
            bool         upSideDown      = false;

            if (firstPoint.yPosition >= (double)thirdPoint.Y && secondPoint.yPosition >= (double)fourthPoint.Y)
            {
                upSideDown = true;
                bool num4  = (visibleSurfaces & SurfaceNames.Top) == SurfaceNames.Top;
                bool flag2 = (visibleSurfaces & SurfaceNames.Bottom) == SurfaceNames.Bottom;
                visibleSurfaces ^= SurfaceNames.Bottom;
                visibleSurfaces ^= SurfaceNames.Top;
                if (num4)
                {
                    visibleSurfaces |= SurfaceNames.Bottom;
                }
                if (flag2)
                {
                    visibleSurfaces |= SurfaceNames.Top;
                }
            }
            GetTopSurfaceVisibility(area, firstPoint, secondPoint, upSideDown, positionZ, depth, matrix, ref visibleSurfaces);
            bool flag3 = true;

            if (tension != 0f)
            {
                if ((visibleSurfaces & SurfaceNames.Bottom) == SurfaceNames.Bottom)
                {
                    flag3 = false;
                }
                if ((visibleSurfaces & SurfaceNames.Bottom) == 0 && (visibleSurfaces & SurfaceNames.Top) == 0)
                {
                    flag3 = false;
                }
                visibleSurfaces |= SurfaceNames.Bottom;
                visibleSurfaces |= SurfaceNames.Top;
            }
            firstPoint.xPosition  = Math.Round(firstPoint.xPosition, 5);
            firstPoint.yPosition  = Math.Round(firstPoint.yPosition, 5);
            secondPoint.xPosition = Math.Round(secondPoint.xPosition, 5);
            secondPoint.yPosition = Math.Round(secondPoint.yPosition, 5);
            if (ClipTopPoints(graphicsPath, ref firstPoint, ref secondPoint, reversed, area, graph, matrix, lightStyle, prevDataPointEx, positionZ, depth, points, pointIndex, pointLoopIndex, tension, operationType, surfaceSegmentType, topDarkening, bottomDarkening))
            {
                return(graphicsPath);
            }
            if (ClipBottomPoints(graphicsPath, ref firstPoint, ref secondPoint, ref thirdPoint, ref fourthPoint, reversed, area, graph, matrix, lightStyle, prevDataPointEx, positionZ, depth, points, pointIndex, pointLoopIndex, tension, operationType, surfaceSegmentType, topDarkening, bottomDarkening))
            {
                return(graphicsPath);
            }
            for (int j = 1; j <= 2; j++)
            {
                SurfaceNames[] array = null;
                array = ((!flag3) ? new SurfaceNames[6]
                {
                    SurfaceNames.Back,
                    SurfaceNames.Top,
                    SurfaceNames.Bottom,
                    SurfaceNames.Left,
                    SurfaceNames.Right,
                    SurfaceNames.Front
                } : new SurfaceNames[6]
                {
                    SurfaceNames.Back,
                    SurfaceNames.Bottom,
                    SurfaceNames.Top,
                    SurfaceNames.Left,
                    SurfaceNames.Right,
                    SurfaceNames.Front
                });
                LineSegmentType lineSegmentType = LineSegmentType.Middle;
                SurfaceNames[]  array2          = array;
                foreach (SurfaceNames surfaceNames in array2)
                {
                    if (ChartGraphics3D.ShouldDrawLineChartSurface(area, area.reverseSeriesOrder, surfaceNames, visibleSurfaces, color, points, firstPoint, secondPoint, multiSeries, reversed, ref lineSegmentType) != j)
                    {
                        continue;
                    }
                    Color backColor = color;
                    Color color2    = dataPoint3D.dataPoint.BorderColor;
                    if (j == 1)
                    {
                        if (backColor.A == byte.MaxValue)
                        {
                            continue;
                        }
                        backColor = Color.Transparent;
                        if (color2 == Color.Empty)
                        {
                            color2 = ChartGraphics.GetGradientColor(color, Color.Black, 0.2);
                        }
                    }
                    GraphicsPath graphicsPath3 = null;
                    switch (surfaceNames)
                    {
                    case SurfaceNames.Top:
                        graphicsPath3 = graph.Draw3DSurface(area, matrix, lightStyle, surfaceNames, positionZ, depth, backColor, color2, dataPoint3D.dataPoint.BorderWidth, borderStyle, firstPoint, secondPoint, points, pointIndex, tension, operationType, LineSegmentType.Middle, showPointLines ? true : false, forceThickBorder: false, area.reverseSeriesOrder, multiSeries, 0, clipInsideArea: true);
                        break;

                    case SurfaceNames.Bottom:
                    {
                        DataPoint3D dataPoint3D13 = new DataPoint3D();
                        dataPoint3D13.dataPoint = firstPoint.dataPoint;
                        dataPoint3D13.index     = firstPoint.index;
                        dataPoint3D13.xPosition = firstPoint.xPosition;
                        dataPoint3D13.yPosition = thirdPoint.Y;
                        DataPoint3D dataPoint3D14 = new DataPoint3D();
                        dataPoint3D14.dataPoint = secondPoint.dataPoint;
                        dataPoint3D14.index     = secondPoint.index;
                        dataPoint3D14.xPosition = secondPoint.xPosition;
                        dataPoint3D14.yPosition = fourthPoint.Y;
                        graphicsPath3           = graph.Draw3DSurface(area, matrix, lightStyle, surfaceNames, positionZ, depth, backColor, color2, dataPoint3D.dataPoint.BorderWidth, borderStyle, dataPoint3D13, dataPoint3D14, points, pointIndex, tension, operationType, LineSegmentType.Middle, showPointLines ? true : false, forceThickBorder: false, area.reverseSeriesOrder, multiSeries, 1, clipInsideArea: true);
                        break;
                    }

                    case SurfaceNames.Left:
                        if (surfaceSegmentType == LineSegmentType.Single || (!area.reverseSeriesOrder && surfaceSegmentType == LineSegmentType.First) || (area.reverseSeriesOrder && surfaceSegmentType == LineSegmentType.Last))
                        {
                            DataPoint3D dataPoint3D10 = (firstPoint.xPosition <= secondPoint.xPosition) ? firstPoint : secondPoint;
                            DataPoint3D dataPoint3D11 = new DataPoint3D();
                            dataPoint3D11.xPosition = dataPoint3D10.xPosition;
                            dataPoint3D11.yPosition = ((firstPoint.xPosition <= secondPoint.xPosition) ? thirdPoint.Y : fourthPoint.Y);
                            DataPoint3D dataPoint3D12 = new DataPoint3D();
                            dataPoint3D12.xPosition = dataPoint3D10.xPosition;
                            dataPoint3D12.yPosition = dataPoint3D10.yPosition;
                            graphicsPath3           = graph.Draw3DSurface(area, matrix, lightStyle, surfaceNames, positionZ, depth, backColor, color2, dataPoint3D.dataPoint.BorderWidth, borderStyle, dataPoint3D11, dataPoint3D12, points, pointIndex, 0f, operationType, LineSegmentType.Single, forceThinBorder: false, forceThickBorder: true, area.reverseSeriesOrder, multiSeries, 0, clipInsideArea: true);
                        }
                        break;

                    case SurfaceNames.Right:
                        if (surfaceSegmentType == LineSegmentType.Single || (!area.reverseSeriesOrder && surfaceSegmentType == LineSegmentType.Last) || (area.reverseSeriesOrder && surfaceSegmentType == LineSegmentType.First))
                        {
                            DataPoint3D dataPoint3D7 = (secondPoint.xPosition >= firstPoint.xPosition) ? secondPoint : firstPoint;
                            DataPoint3D dataPoint3D8 = new DataPoint3D();
                            dataPoint3D8.xPosition = dataPoint3D7.xPosition;
                            dataPoint3D8.yPosition = ((secondPoint.xPosition >= firstPoint.xPosition) ? fourthPoint.Y : thirdPoint.Y);
                            DataPoint3D dataPoint3D9 = new DataPoint3D();
                            dataPoint3D9.xPosition = dataPoint3D7.xPosition;
                            dataPoint3D9.yPosition = dataPoint3D7.yPosition;
                            graphicsPath3          = graph.Draw3DSurface(area, matrix, lightStyle, surfaceNames, positionZ, depth, backColor, color2, dataPoint3D.dataPoint.BorderWidth, borderStyle, dataPoint3D8, dataPoint3D9, points, pointIndex, 0f, operationType, LineSegmentType.Single, forceThinBorder: false, forceThickBorder: true, area.reverseSeriesOrder, multiSeries, 0, clipInsideArea: true);
                        }
                        break;

                    case SurfaceNames.Back:
                    {
                        DataPoint3D dataPoint3D5 = new DataPoint3D();
                        dataPoint3D5.dataPoint = firstPoint.dataPoint;
                        dataPoint3D5.index     = firstPoint.index;
                        dataPoint3D5.xPosition = firstPoint.xPosition;
                        dataPoint3D5.yPosition = thirdPoint.Y;
                        DataPoint3D dataPoint3D6 = new DataPoint3D();
                        dataPoint3D6.dataPoint = secondPoint.dataPoint;
                        dataPoint3D6.index     = secondPoint.index;
                        dataPoint3D6.xPosition = secondPoint.xPosition;
                        dataPoint3D6.yPosition = fourthPoint.Y;
                        graphicsPath3          = Draw3DSplinePolygon(graph, area, positionZ, backColor, color2, dataPoint3D.dataPoint.BorderWidth, borderStyle, firstPoint, secondPoint, dataPoint3D6, dataPoint3D5, points, pointIndex, tension, operationType, lineSegmentType, showPointLines ? true : false);
                        break;
                    }

                    case SurfaceNames.Front:
                    {
                        DataPoint3D dataPoint3D3 = new DataPoint3D();
                        dataPoint3D3.dataPoint = firstPoint.dataPoint;
                        dataPoint3D3.index     = firstPoint.index;
                        dataPoint3D3.xPosition = firstPoint.xPosition;
                        dataPoint3D3.yPosition = thirdPoint.Y;
                        DataPoint3D dataPoint3D4 = new DataPoint3D();
                        dataPoint3D4.dataPoint = secondPoint.dataPoint;
                        dataPoint3D4.index     = secondPoint.index;
                        dataPoint3D4.xPosition = secondPoint.xPosition;
                        dataPoint3D4.yPosition = fourthPoint.Y;
                        if (area.reverseSeriesOrder)
                        {
                            switch (lineSegmentType)
                            {
                            case LineSegmentType.First:
                                lineSegmentType = LineSegmentType.Last;
                                break;

                            case LineSegmentType.Last:
                                lineSegmentType = LineSegmentType.First;
                                break;
                            }
                        }
                        if (surfaceSegmentType != 0)
                        {
                            if (surfaceSegmentType == LineSegmentType.Middle || (surfaceSegmentType == LineSegmentType.First && lineSegmentType != LineSegmentType.First) || (surfaceSegmentType == LineSegmentType.Last && lineSegmentType != LineSegmentType.Last))
                            {
                                lineSegmentType = LineSegmentType.Middle;
                            }
                            if (reversed)
                            {
                                switch (lineSegmentType)
                                {
                                case LineSegmentType.First:
                                    lineSegmentType = LineSegmentType.Last;
                                    break;

                                case LineSegmentType.Last:
                                    lineSegmentType = LineSegmentType.First;
                                    break;
                                }
                            }
                        }
                        graphicsPath3 = Draw3DSplinePolygon(graph, area, positionZ + depth, backColor, color2, dataPoint3D.dataPoint.BorderWidth, borderStyle, firstPoint, secondPoint, dataPoint3D4, dataPoint3D3, points, pointIndex, tension, operationType, lineSegmentType, showPointLines ? true : false);
                        break;
                    }
                    }
                    if (j == 2 && graphicsPath != null && graphicsPath3 != null && graphicsPath3.PointCount > 0)
                    {
                        graphicsPath.CloseFigure();
                        graphicsPath.AddPath(graphicsPath3, connect: true);
                    }
                }
            }
            return(graphicsPath);
        }