Ejemplo n.º 1
0
        protected void DrawArea3DScene(ChartGraphics graph, RectangleF position)
        {
            ChartArea chartArea = (ChartArea)this;

            this.areaSceneWallWidth = graph.GetRelativeSize(new SizeF((float)this.Area3DStyle.WallWidth, (float)this.Area3DStyle.WallWidth));
            this.areaSceneDepth     = this.GetArea3DSceneDepth();
            this.matrix3D.Initialize(position, this.areaSceneDepth, (float)this.Area3DStyle.XAngle, (float)this.Area3DStyle.YAngle, (float)this.Area3DStyle.Perspective, this.Area3DStyle.RightAngleAxes);
            this.matrix3D.InitLight(this.Area3DStyle.Light);
            this.visibleSurfaces = graph.GetVisibleSurfaces(position, 0f, this.areaSceneDepth, this.matrix3D);
            Color color = chartArea.BackColor;

            if (color == Color.Transparent)
            {
                this.areaSceneWallWidth = SizeF.Empty;
            }
            else
            {
                if (color == Color.Empty)
                {
                    color = Color.LightGray;
                }
                if (this.IsBottomSceneWallVisible())
                {
                    position.Height += this.areaSceneWallWidth.Height;
                }
                position.Width += this.areaSceneWallWidth.Width;
                if (this.Area3DStyle.YAngle > 0)
                {
                    position.X -= this.areaSceneWallWidth.Width;
                }
                RectangleF position2 = new RectangleF(position.Location, position.Size);
                float      width     = this.areaSceneWallWidth.Width;
                float      positionZ = (float)(0.0 - width);
                if (this.IsMainSceneWallOnFront())
                {
                    positionZ = this.areaSceneDepth;
                }
                graph.Fill3DRectangle(position2, positionZ, width, this.matrix3D, chartArea.Area3DStyle.Light, color, chartArea.BackHatchStyle, chartArea.BackImage, chartArea.BackImageMode, chartArea.BackImageTransparentColor, chartArea.BackImageAlign, chartArea.BackGradientType, chartArea.BackGradientEndColor, chartArea.BorderColor, chartArea.BorderWidth, chartArea.BorderStyle, PenAlignment.Outset, DrawingOperationTypes.DrawElement);
                position2       = new RectangleF(position.Location, position.Size);
                position2.Width = this.areaSceneWallWidth.Width;
                if (!this.IsSideSceneWallOnLeft())
                {
                    position2.X = position.Right - this.areaSceneWallWidth.Width;
                }
                graph.Fill3DRectangle(position2, 0f, this.areaSceneDepth, this.matrix3D, chartArea.Area3DStyle.Light, color, chartArea.BackHatchStyle, chartArea.BackImage, chartArea.BackImageMode, chartArea.BackImageTransparentColor, chartArea.BackImageAlign, chartArea.BackGradientType, chartArea.BackGradientEndColor, chartArea.BorderColor, chartArea.BorderWidth, chartArea.BorderStyle, PenAlignment.Outset, DrawingOperationTypes.DrawElement);
                if (this.IsBottomSceneWallVisible())
                {
                    position2        = new RectangleF(position.Location, position.Size);
                    position2.Height = this.areaSceneWallWidth.Height;
                    position2.Y      = position.Bottom - this.areaSceneWallWidth.Height;
                    position2.Width -= this.areaSceneWallWidth.Width;
                    if (this.IsSideSceneWallOnLeft())
                    {
                        position2.X += this.areaSceneWallWidth.Width;
                    }
                    positionZ = 0f;
                    graph.Fill3DRectangle(position2, 0f, this.areaSceneDepth, this.matrix3D, chartArea.Area3DStyle.Light, color, chartArea.BackHatchStyle, chartArea.BackImage, chartArea.BackImageMode, chartArea.BackImageTransparentColor, chartArea.BackImageAlign, chartArea.BackGradientType, chartArea.BackGradientEndColor, chartArea.BorderColor, chartArea.BorderWidth, chartArea.BorderStyle, PenAlignment.Outset, DrawingOperationTypes.DrawElement);
                }
            }
        }
Ejemplo n.º 2
0
        public bool ShouldDrawOnSurface(SurfaceNames surfaceName, bool backLayer, bool onEdge)
        {
            bool flag = (this.visibleSurfaces & surfaceName) == surfaceName;

            if (onEdge)
            {
                return(backLayer);
            }
            return(backLayer == !flag);
        }
Ejemplo n.º 3
0
 protected override void GetTopSurfaceVisibility(ChartArea area, DataPoint3D firstPoint, DataPoint3D secondPoint, bool upSideDown, float positionZ, float depth, Matrix3D matrix, ref SurfaceNames visibleSurfaces)
 {
     base.GetTopSurfaceVisibility(area, firstPoint, secondPoint, upSideDown, positionZ, depth, matrix, ref visibleSurfaces);
     if ((visibleSurfaces & SurfaceNames.Top) == SurfaceNames.Top)
     {
         bool flag = false;
         foreach (Series item in area.Common.DataManager.Series)
         {
             if (string.Compare(item.ChartTypeName, secondPoint.dataPoint.series.ChartTypeName, true, CultureInfo.CurrentCulture) == 0)
             {
                 if (flag)
                 {
                     DataPointAttributes dataPointAttributes = item.Points[secondPoint.index - 1];
                     if (item.Points[secondPoint.index - 1].Empty)
                     {
                         dataPointAttributes = item.EmptyPointStyle;
                     }
                     if (dataPointAttributes.Color.A == 255)
                     {
                         visibleSurfaces ^= SurfaceNames.Top;
                     }
                     break;
                 }
                 if (string.Compare(item.Name, secondPoint.dataPoint.series.Name, StringComparison.Ordinal) == 0)
                 {
                     flag = true;
                 }
             }
         }
     }
     if ((visibleSurfaces & SurfaceNames.Bottom) != SurfaceNames.Bottom)
     {
         DataPointAttributes dataPointAttributes2 = null;
         foreach (Series item2 in area.Common.DataManager.Series)
         {
             if (string.Compare(item2.ChartTypeName, secondPoint.dataPoint.series.ChartTypeName, StringComparison.OrdinalIgnoreCase) == 0)
             {
                 if (dataPointAttributes2 != null && string.Compare(item2.Name, secondPoint.dataPoint.series.Name, StringComparison.Ordinal) == 0)
                 {
                     if (dataPointAttributes2.Color.A != 255)
                     {
                         visibleSurfaces |= SurfaceNames.Bottom;
                     }
                     break;
                 }
                 dataPointAttributes2 = item2.Points[secondPoint.index - 1];
                 if (item2.Points[secondPoint.index - 1].Empty)
                 {
                     dataPointAttributes2 = item2.EmptyPointStyle;
                 }
             }
         }
     }
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Return intensity of lightStyle for Polygons. There are tree types of lights: None,
        /// Simplistic and Realistic. None Style have same lightStyle intensity on
        /// all polygons. Normal vector doesn’t have influence on this type
        /// of lighting. Simplistic style have lightStyle source, which is
        /// rotated together with scene. Realistic lighting have fixed lightStyle
        /// source and intensity of lightStyle is change when scene is rotated.
        /// </summary>
        /// <param name="points">Points of the polygon</param>
        /// <param name="surfaceColor">Color used for polygons without lighting</param>
        /// <param name="visiblePolygon">This flag gets information if  polygon is visible or not.</param>
        /// <param name="rotation">Y angle ( from -90 to 90 ) Should be used width switchSeriesOrder to get from -180 to 180</param>
        /// <param name="surfaceName">Used for lighting of front - back and left - right sides</param>
        /// <param name="switchSeriesOrder">Used to calculate real y angle</param>
        /// <returns>Color corrected with intensity of lightStyle</returns>
        internal SKColor GetPolygonLight(Point3D[] points, SKColor surfaceColor, bool visiblePolygon, float rotation, SurfaceNames surfaceName, bool switchSeriesOrder)
        {
            // Corrected color
            SKColor color = surfaceColor;

            // Direction of lightStyle source
            Point3D lightSource;

            lightSource = new Point3D(0F, 0F, 1F);

            // There are tree different lightStyle styles: None, Simplistic and realistic.
            switch (_lightStyle)
            {
            // LightStyle style is None
            case LightStyle.None:
            {
                // Use same color
                break;
            }

            // LightStyle style is Simplistic
            case LightStyle.Simplistic:
            {
                // Find two vectors of polygon
                Point3D firstVector = new();
                firstVector.X = points[0].X - points[1].X;
                firstVector.Y = points[0].Y - points[1].Y;
                firstVector.Z = points[0].Z - points[1].Z;

                Point3D secondVector = new();
                secondVector.X = points[2].X - points[1].X;
                secondVector.Y = points[2].Y - points[1].Y;
                secondVector.Z = points[2].Z - points[1].Z;

                // Find Normal vector for Polygon
                Point3D normalVector = new();
                normalVector.X = firstVector.Y * secondVector.Z - firstVector.Z * secondVector.Y;
                normalVector.Y = firstVector.Z * secondVector.X - firstVector.X * secondVector.Z;
                normalVector.Z = firstVector.X * secondVector.Y - firstVector.Y * secondVector.X;

                // Polygon is left side ( like side of area chart )
                if (surfaceName == SurfaceNames.Left)
                {
                    color = ChartGraphics.GetGradientColor(surfaceColor, SKColors.Black, 0.15);
                }
                // Polygon is right side ( like side of area chart )
                else if (surfaceName == SurfaceNames.Right)
                {
                    color = ChartGraphics.GetGradientColor(surfaceColor, SKColors.Black, 0.15);
                }
                // Polygon is front side ( like side of area chart )
                else if (surfaceName == SurfaceNames.Front)
                {
                    color = surfaceColor;
                }
                // Polygon is back side ( like side of area chart )
                else if (surfaceName == SurfaceNames.Back)
                {
                    color = surfaceColor;
                }
                // Polygon has angle with bottom side ( Line chart or top of area chart )
                else
                {
                    float angleLeft;
                    float angleRight;

                    // Find angles between lightStyle and polygon for different y-axis angles.
                    if (switchSeriesOrder)
                    {
                        if (rotation > 0 && rotation <= 90)
                        {
                            angleLeft  = GetAngle(normalVector, _lightVectors[3]);
                            angleRight = GetAngle(normalVector, _lightVectors[4]);
                        }
                        else
                        {
                            angleLeft  = GetAngle(normalVector, _lightVectors[4]);
                            angleRight = GetAngle(normalVector, _lightVectors[3]);
                        }
                    }
                    else
                    {
                        if (rotation > 0 && rotation <= 90)
                        {
                            angleLeft  = GetAngle(normalVector, _lightVectors[4]);
                            angleRight = GetAngle(normalVector, _lightVectors[3]);
                        }
                        else
                        {
                            angleLeft  = GetAngle(normalVector, _lightVectors[3]);
                            angleRight = GetAngle(normalVector, _lightVectors[4]);
                        }
                    }

                    if (Math.Abs(angleLeft - angleRight) < 0.01)
                    {
                        color = ChartGraphics.GetGradientColor(surfaceColor, SKColors.Black, 0.25);
                    }
                    else if (angleLeft < angleRight)
                    {
                        color = ChartGraphics.GetGradientColor(surfaceColor, SKColors.Black, 0.25);
                    }
                    else
                    {
                        color = ChartGraphics.GetGradientColor(surfaceColor, SKColors.Black, 0.15);
                    }
                }

                break;
            }

            // LightStyle style is Realistic
            default:
            {
                // Find two vectors of polygon
                Point3D firstVector = new();
                firstVector.X = points[0].X - points[1].X;
                firstVector.Y = points[0].Y - points[1].Y;
                firstVector.Z = points[0].Z - points[1].Z;

                Point3D secondVector = new();
                secondVector.X = points[2].X - points[1].X;
                secondVector.Y = points[2].Y - points[1].Y;
                secondVector.Z = points[2].Z - points[1].Z;

                // Find Normal vector for Polygon
                Point3D normalVector = new();
                normalVector.X = firstVector.Y * secondVector.Z - firstVector.Z * secondVector.Y;
                normalVector.Y = firstVector.Z * secondVector.X - firstVector.X * secondVector.Z;
                normalVector.Z = firstVector.X * secondVector.Y - firstVector.Y * secondVector.X;

                // ******************************************************************
                // Color correction. Angle between Normal vector of polygon and
                // vector of lightStyle source is used.
                // ******************************************************************
                if (surfaceName == SurfaceNames.Front)
                {
                    lightSource.Z *= -1;
                    color          = GetBrightGradientColor(surfaceColor, GetAngle(lightSource, _lightVectors[2]) / Math.PI);
                }
                else if (surfaceName == SurfaceNames.Back)
                {
                    lightSource.Z *= -1;
                    color          = GetBrightGradientColor(surfaceColor, GetAngle(lightSource, _lightVectors[1]) / Math.PI);
                }
                else
                {
                    if (visiblePolygon)
                    {
                        lightSource.Z *= -1;
                    }

                    color = GetBrightGradientColor(surfaceColor, GetAngle(lightSource, normalVector) / Math.PI);
                }

                break;
            }
            }
            return(color);
        }
Ejemplo n.º 5
0
        internal Color GetPolygonLight(Point3D[] points, Color surfaceColor, bool visiblePolygon, float yAngle, SurfaceNames surfaceName, bool switchSeriesOrder)
        {
            Color   result  = surfaceColor;
            Point3D point3D = new Point3D(0f, 0f, 1f);

            switch (lightStyle)
            {
            case LightStyle.Simplistic:
            {
                Point3D point3D5 = new Point3D();
                point3D5.X = points[0].X - points[1].X;
                point3D5.Y = points[0].Y - points[1].Y;
                point3D5.Z = points[0].Z - points[1].Z;
                Point3D point3D6 = new Point3D();
                point3D6.X = points[2].X - points[1].X;
                point3D6.Y = points[2].Y - points[1].Y;
                point3D6.Z = points[2].Z - points[1].Z;
                Point3D point3D7 = new Point3D();
                point3D7.X = point3D5.Y * point3D6.Z - point3D5.Z * point3D6.Y;
                point3D7.Y = point3D5.Z * point3D6.X - point3D5.X * point3D6.Z;
                point3D7.Z = point3D5.X * point3D6.Y - point3D5.Y * point3D6.X;
                switch (surfaceName)
                {
                case SurfaceNames.Left:
                    result = ChartGraphics.GetGradientColor(surfaceColor, Color.Black, 0.15);
                    break;

                case SurfaceNames.Right:
                    result = ChartGraphics.GetGradientColor(surfaceColor, Color.Black, 0.15);
                    break;

                case SurfaceNames.Front:
                    result = surfaceColor;
                    break;

                case SurfaceNames.Back:
                    result = surfaceColor;
                    break;

                default:
                {
                    float angle;
                    float angle2;
                    if (switchSeriesOrder)
                    {
                        if (yAngle > 0f && yAngle <= 90f)
                        {
                            angle  = GetAngle(point3D7, lightVectors[3]);
                            angle2 = GetAngle(point3D7, lightVectors[4]);
                        }
                        else
                        {
                            angle  = GetAngle(point3D7, lightVectors[4]);
                            angle2 = GetAngle(point3D7, lightVectors[3]);
                        }
                    }
                    else if (yAngle > 0f && yAngle <= 90f)
                    {
                        angle  = GetAngle(point3D7, lightVectors[4]);
                        angle2 = GetAngle(point3D7, lightVectors[3]);
                    }
                    else
                    {
                        angle  = GetAngle(point3D7, lightVectors[3]);
                        angle2 = GetAngle(point3D7, lightVectors[4]);
                    }
                    result = ((!((double)Math.Abs(angle - angle2) < 0.01)) ? ((!(angle < angle2)) ? ChartGraphics.GetGradientColor(surfaceColor, Color.Black, 0.15) : ChartGraphics.GetGradientColor(surfaceColor, Color.Black, 0.25)) : ChartGraphics.GetGradientColor(surfaceColor, Color.Black, 0.25));
                    break;
                }
                }
                break;
            }

            default:
            {
                Point3D point3D2 = new Point3D();
                point3D2.X = points[0].X - points[1].X;
                point3D2.Y = points[0].Y - points[1].Y;
                point3D2.Z = points[0].Z - points[1].Z;
                Point3D point3D3 = new Point3D();
                point3D3.X = points[2].X - points[1].X;
                point3D3.Y = points[2].Y - points[1].Y;
                point3D3.Z = points[2].Z - points[1].Z;
                Point3D point3D4 = new Point3D();
                point3D4.X = point3D2.Y * point3D3.Z - point3D2.Z * point3D3.Y;
                point3D4.Y = point3D2.Z * point3D3.X - point3D2.X * point3D3.Z;
                point3D4.Z = point3D2.X * point3D3.Y - point3D2.Y * point3D3.X;
                switch (surfaceName)
                {
                case SurfaceNames.Front:
                    point3D.Z *= -1f;
                    result     = GetBrightGradientColor(surfaceColor, (double)GetAngle(point3D, lightVectors[2]) / Math.PI);
                    break;

                case SurfaceNames.Back:
                    point3D.Z *= -1f;
                    result     = GetBrightGradientColor(surfaceColor, (double)GetAngle(point3D, lightVectors[1]) / Math.PI);
                    break;

                default:
                    if (visiblePolygon)
                    {
                        point3D.Z *= -1f;
                    }
                    result = GetBrightGradientColor(surfaceColor, (double)GetAngle(point3D, point3D4) / Math.PI);
                    break;
                }
                break;
            }

            case LightStyle.None:
                break;
            }
            return(result);
        }
Ejemplo n.º 6
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;

            if (Math.Round(firstPoint.xPosition, 3) == Math.Round(secondPoint.xPosition, 3) && Math.Round(firstPoint.yPosition, 3) == Math.Round(secondPoint.yPosition, 3))
            {
                return(graphicsPath);
            }
            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)Math.Round(vAxis.GetPosition(vAxis.Crossing), 3);
            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 ((decimal)firstPoint.yPosition >= (decimal)num && (decimal)secondPoint.yPosition >= (decimal)num)
            {
                upSideDown = true;
                bool num4 = (visibleSurfaces & SurfaceNames.Top) == SurfaceNames.Top;
                bool flag = (visibleSurfaces & SurfaceNames.Bottom) == SurfaceNames.Bottom;
                visibleSurfaces ^= SurfaceNames.Bottom;
                visibleSurfaces ^= SurfaceNames.Top;
                if (num4)
                {
                    visibleSurfaces |= SurfaceNames.Bottom;
                }
                if (flag)
                {
                    visibleSurfaces |= SurfaceNames.Top;
                }
            }
            GetTopSurfaceVisibility(area, firstPoint, secondPoint, upSideDown, positionZ, depth, matrix, ref visibleSurfaces);
            GetBottomPointsPosition(common, area, num, ref firstPoint, ref secondPoint, thirdPointPosition, fourthPointPosition, 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 (float.IsNaN(thirdPoint.X) || float.IsNaN(thirdPoint.Y) || float.IsNaN(fourthPoint.X) || float.IsNaN(fourthPoint.Y))
            {
                return(graphicsPath);
            }
            if (clipOnTop && 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 (clipOnBottom && 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);
            }
            if ((Math.Round((decimal)firstPoint.yPosition, 3) > (decimal)num + 0.001m && Math.Round((decimal)secondPoint.yPosition, 3) < (decimal)num - 0.001m) || (Math.Round((decimal)firstPoint.yPosition, 3) < (decimal)num - 0.001m && Math.Round((decimal)secondPoint.yPosition, 3) > (decimal)num + 0.001m))
            {
                DataPoint3D axisIntersection = GetAxisIntersection(firstPoint, secondPoint, num);
                for (int i = 0; i <= 1; i++)
                {
                    GraphicsPath graphicsPath2 = null;
                    if ((i == 0 && !reversed) || (i == 1 && reversed))
                    {
                        axisIntersection.dataPoint = secondPoint.dataPoint;
                        axisIntersection.index     = secondPoint.index;
                        graphicsPath2 = Draw3DSurface(firstPoint, axisIntersection, 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, clipOnBottom);
                    }
                    if ((i == 1 && !reversed) || (i == 0 && reversed))
                    {
                        axisIntersection.dataPoint = firstPoint.dataPoint;
                        axisIntersection.index     = firstPoint.index;
                        graphicsPath2 = Draw3DSurface(axisIntersection, 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, clipOnBottom);
                    }
                    if (graphicsPath != null && graphicsPath2 != null && graphicsPath2.PointCount > 0)
                    {
                        graphicsPath.AddPath(graphicsPath2, connect: true);
                    }
                }
                return(graphicsPath);
            }
            if (Math.Round(firstPoint.xPosition, 3) == Math.Round(secondPoint.xPosition, 3) && Math.Round(firstPoint.yPosition, 3) == Math.Round(secondPoint.yPosition, 3))
            {
                return(graphicsPath);
            }
            for (int j = 1; j <= 2; j++)
            {
                SurfaceNames[] obj = new SurfaceNames[6]
                {
                    SurfaceNames.Back,
                    SurfaceNames.Bottom,
                    SurfaceNames.Top,
                    SurfaceNames.Left,
                    SurfaceNames.Right,
                    SurfaceNames.Front
                };
                LineSegmentType lineSegmentType = LineSegmentType.Middle;
                SurfaceNames[]  array           = obj;
                foreach (SurfaceNames surfaceNames in array)
                {
                    if (ChartGraphics3D.ShouldDrawLineChartSurface(area, area.reverseSeriesOrder, surfaceNames, visibleSurfaces, color, points, firstPoint, secondPoint, multiSeries, reversed, ref lineSegmentType) != j || (allPointsLoopsNumber == 2 && (operationType & DrawingOperationTypes.DrawElement) == DrawingOperationTypes.DrawElement && ((pointLoopIndex == 0 && (surfaceNames == SurfaceNames.Front || (j == 2 && (surfaceNames == SurfaceNames.Left || surfaceNames == SurfaceNames.Right)))) || (pointLoopIndex == 1 && (surfaceNames == SurfaceNames.Back || surfaceNames != SurfaceNames.Front) && (j == 1 || (surfaceNames != SurfaceNames.Left && surfaceNames != SurfaceNames.Right))))))
                    {
                        continue;
                    }
                    Color color2 = color;
                    Color color3 = dataPoint3D.dataPoint.BorderColor;
                    if (j == 1)
                    {
                        if (color2.A == byte.MaxValue)
                        {
                            continue;
                        }
                        color2 = Color.Transparent;
                        if (color3 == Color.Empty)
                        {
                            color3 = ChartGraphics.GetGradientColor(color, Color.Black, 0.2);
                        }
                    }
                    bool flag2 = showPointLines;
                    if (surfaceSegmentType == LineSegmentType.Middle)
                    {
                        flag2 = false;
                    }
                    if (clippedSegment && surfaceNames != SurfaceNames.Top && surfaceNames != SurfaceNames.Bottom)
                    {
                        continue;
                    }
                    GraphicsPath graphicsPath3 = null;
                    switch (surfaceNames)
                    {
                    case SurfaceNames.Top:
                    {
                        Color backColor   = (topDarkening == 0f) ? color2 : ChartGraphics.GetGradientColor(color2, Color.Black, topDarkening);
                        Color borderColor = (topDarkening == 0f) ? color3 : ChartGraphics.GetGradientColor(color3, Color.Black, topDarkening);
                        graphicsPath3 = graph.Draw3DSurface(area, matrix, lightStyle, surfaceNames, positionZ, depth, backColor, borderColor, dataPoint3D.dataPoint.BorderWidth, borderStyle, firstPoint, secondPoint, points, pointIndex, 0f, operationType, surfaceSegmentType, flag2, forceThickBorder: false, area.reverseSeriesOrder, multiSeries, 0, clipInsideArea: true);
                        break;
                    }

                    case SurfaceNames.Bottom:
                    {
                        DataPoint3D dataPoint3D12 = new DataPoint3D();
                        dataPoint3D12.index     = firstPoint.index;
                        dataPoint3D12.dataPoint = firstPoint.dataPoint;
                        dataPoint3D12.xPosition = firstPoint.xPosition;
                        dataPoint3D12.yPosition = thirdPoint.Y;
                        DataPoint3D dataPoint3D13 = new DataPoint3D();
                        dataPoint3D13.index     = secondPoint.index;
                        dataPoint3D13.dataPoint = secondPoint.dataPoint;
                        dataPoint3D13.xPosition = secondPoint.xPosition;
                        dataPoint3D13.yPosition = fourthPoint.Y;
                        Color backColor2   = (bottomDarkening == 0f) ? color2 : ChartGraphics.GetGradientColor(color2, Color.Black, topDarkening);
                        Color borderColor2 = (bottomDarkening == 0f) ? color3 : ChartGraphics.GetGradientColor(color3, Color.Black, topDarkening);
                        graphicsPath3 = graph.Draw3DSurface(area, matrix, lightStyle, surfaceNames, positionZ, depth, backColor2, borderColor2, dataPoint3D.dataPoint.BorderWidth, borderStyle, dataPoint3D12, dataPoint3D13, points, pointIndex, 0f, operationType, surfaceSegmentType, flag2, forceThickBorder: false, area.reverseSeriesOrder, multiSeries, 0, clipInsideArea: true);
                        break;
                    }

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

                    case SurfaceNames.Back:
                    {
                        DataPoint3D dataPoint3D7 = new DataPoint3D();
                        dataPoint3D7.index     = firstPoint.index;
                        dataPoint3D7.dataPoint = firstPoint.dataPoint;
                        dataPoint3D7.xPosition = firstPoint.xPosition;
                        dataPoint3D7.yPosition = thirdPoint.Y;
                        DataPoint3D dataPoint3D8 = new DataPoint3D();
                        dataPoint3D8.index     = secondPoint.index;
                        dataPoint3D8.dataPoint = secondPoint.dataPoint;
                        dataPoint3D8.xPosition = secondPoint.xPosition;
                        dataPoint3D8.yPosition = fourthPoint.Y;
                        SurfaceNames thinBorders2 = (SurfaceNames)0;
                        if (flag2)
                        {
                            switch (surfaceSegmentType)
                            {
                            case LineSegmentType.Single:
                                thinBorders2 = (SurfaceNames.Left | SurfaceNames.Right);
                                break;

                            case LineSegmentType.First:
                                thinBorders2 = SurfaceNames.Left;
                                break;

                            case LineSegmentType.Last:
                                thinBorders2 = SurfaceNames.Right;
                                break;
                            }
                        }
                        graphicsPath3 = graph.Draw3DPolygon(area, matrix, lightStyle, surfaceNames, positionZ, color2, color3, dataPoint3D.dataPoint.BorderWidth, borderStyle, firstPoint, secondPoint, dataPoint3D8, dataPoint3D7, points, pointIndex, 0f, operationType, lineSegmentType, thinBorders2);
                        break;
                    }

                    case SurfaceNames.Front:
                    {
                        DataPoint3D dataPoint3D2 = new DataPoint3D();
                        dataPoint3D2.index     = firstPoint.index;
                        dataPoint3D2.dataPoint = firstPoint.dataPoint;
                        dataPoint3D2.xPosition = firstPoint.xPosition;
                        dataPoint3D2.yPosition = thirdPoint.Y;
                        DataPoint3D dataPoint3D3 = new DataPoint3D();
                        dataPoint3D3.index     = secondPoint.index;
                        dataPoint3D3.dataPoint = secondPoint.dataPoint;
                        dataPoint3D3.xPosition = secondPoint.xPosition;
                        dataPoint3D3.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 && (surfaceSegmentType == LineSegmentType.Middle || (surfaceSegmentType == LineSegmentType.First && lineSegmentType != LineSegmentType.First) || (surfaceSegmentType == LineSegmentType.Last && lineSegmentType != LineSegmentType.Last)))
                        {
                            lineSegmentType = LineSegmentType.Middle;
                        }
                        SurfaceNames thinBorders = (SurfaceNames)0;
                        if (flag2)
                        {
                            switch (surfaceSegmentType)
                            {
                            case LineSegmentType.Single:
                                thinBorders = (SurfaceNames.Left | SurfaceNames.Right);
                                break;

                            case LineSegmentType.First:
                                thinBorders = SurfaceNames.Left;
                                break;

                            case LineSegmentType.Last:
                                thinBorders = SurfaceNames.Right;
                                break;
                            }
                        }
                        graphicsPath3 = graph.Draw3DPolygon(area, matrix, lightStyle, surfaceNames, positionZ + depth, color2, color3, dataPoint3D.dataPoint.BorderWidth, borderStyle, firstPoint, secondPoint, dataPoint3D3, dataPoint3D2, points, pointIndex, 0f, operationType, lineSegmentType, thinBorders);
                        break;
                    }
                    }
                    if (j == 2 && graphicsPath != null && graphicsPath3 != null && graphicsPath3.PointCount > 0)
                    {
                        graphicsPath.CloseFigure();
                        graphicsPath.SetMarkers();
                        graphicsPath.AddPath(graphicsPath3, connect: true);
                    }
                }
            }
            return(graphicsPath);
        }
Ejemplo n.º 7
0
 protected virtual void GetTopSurfaceVisibility(ChartArea area, DataPoint3D firstPoint, DataPoint3D secondPoint, bool upSideDown, float positionZ, float depth, Matrix3D matrix, ref SurfaceNames visibleSurfaces)
 {
     if ((visibleSurfaces & SurfaceNames.Top) == SurfaceNames.Top)
     {
         visibleSurfaces ^= SurfaceNames.Top;
     }
     Point3D[] array = new Point3D[3];
     if (!area.reverseSeriesOrder)
     {
         if ((!upSideDown && firstPoint.xPosition <= secondPoint.xPosition) || (upSideDown && firstPoint.xPosition >= secondPoint.xPosition))
         {
             array[0] = new Point3D((float)firstPoint.xPosition, (float)firstPoint.yPosition, positionZ + depth);
             array[1] = new Point3D((float)firstPoint.xPosition, (float)firstPoint.yPosition, positionZ);
             array[2] = new Point3D((float)secondPoint.xPosition, (float)secondPoint.yPosition, positionZ);
         }
         else
         {
             array[0] = new Point3D((float)secondPoint.xPosition, (float)secondPoint.yPosition, positionZ + depth);
             array[1] = new Point3D((float)secondPoint.xPosition, (float)secondPoint.yPosition, positionZ);
             array[2] = new Point3D((float)firstPoint.xPosition, (float)firstPoint.yPosition, positionZ);
         }
     }
     else if ((!upSideDown && secondPoint.xPosition <= firstPoint.xPosition) || (upSideDown && secondPoint.xPosition >= firstPoint.xPosition))
     {
         array[0] = new Point3D((float)secondPoint.xPosition, (float)secondPoint.yPosition, positionZ + depth);
         array[1] = new Point3D((float)secondPoint.xPosition, (float)secondPoint.yPosition, positionZ);
         array[2] = new Point3D((float)firstPoint.xPosition, (float)firstPoint.yPosition, positionZ);
     }
     else
     {
         array[0] = new Point3D((float)firstPoint.xPosition, (float)firstPoint.yPosition, positionZ + depth);
         array[1] = new Point3D((float)firstPoint.xPosition, (float)firstPoint.yPosition, positionZ);
         array[2] = new Point3D((float)secondPoint.xPosition, (float)secondPoint.yPosition, positionZ);
     }
     matrix.TransformPoints(array);
     if (ChartGraphics3D.IsSurfaceVisible(array[0], array[1], array[2]))
     {
         visibleSurfaces |= SurfaceNames.Top;
     }
 }
Ejemplo n.º 8
0
        public void Draw3DTickLine(ChartGraphics graph, PointF point1, PointF point2, bool horizontal, float scrollBarSize, bool backElements, bool selectionMode)
        {
            ChartArea chartArea      = base.axis.chartArea;
            bool      flag           = default(bool);
            float     marksZPosition = base.axis.GetMarksZPosition(out flag);
            bool      flag2          = flag;

            if ((!flag2 || base.axis.MajorTickMark.Style != TickMarkStyle.Cross) && base.axis.MajorTickMark.Style != TickMarkStyle.Inside && base.axis.MinorTickMark.Style != TickMarkStyle.Cross && base.axis.MinorTickMark.Style != TickMarkStyle.Inside)
            {
                goto IL_006d;
            }
            flag2 = false;
            goto IL_006d;
IL_006d:
            SurfaceNames surfaceName = (SurfaceNames)((marksZPosition != 0.0) ? 1 : 2);

            if (chartArea.ShouldDrawOnSurface(surfaceName, backElements, flag2))
            {
                if (base.axis.AxisPosition == AxisPosition.Bottom && (!base.axis.IsMarksNextToAxis() || flag) && chartArea.IsBottomSceneWallVisible())
                {
                    point2.Y += chartArea.areaSceneWallWidth.Height;
                }
                else if (base.axis.AxisPosition == AxisPosition.Left && (!base.axis.IsMarksNextToAxis() || flag) && chartArea.IsSideSceneWallOnLeft())
                {
                    point1.X -= chartArea.areaSceneWallWidth.Width;
                }
                else if (base.axis.AxisPosition == AxisPosition.Right && (!base.axis.IsMarksNextToAxis() || flag) && !chartArea.IsSideSceneWallOnLeft())
                {
                    point2.X += chartArea.areaSceneWallWidth.Width;
                }
                else if (base.axis.AxisPosition == AxisPosition.Top && (!base.axis.IsMarksNextToAxis() || flag))
                {
                    point1.Y -= chartArea.areaSceneWallWidth.Height;
                }
                Point3D point3D  = null;
                Point3D point3D2 = null;
                if (flag && chartArea.areaSceneWallWidth.Width != 0.0)
                {
                    if (base.axis.AxisPosition == AxisPosition.Top)
                    {
                        float y = base.axis.PlotAreaPosition.Y;
                        if (this.style == TickMarkStyle.Inside)
                        {
                            point1.Y = y;
                            point2.Y = y + this.size;
                            point3D  = new Point3D(point1.X, point1.Y, (float)(0.0 - chartArea.areaSceneWallWidth.Width));
                            point3D2 = new Point3D(point1.X, point1.Y, 0f);
                        }
                        else if (this.style == TickMarkStyle.Outside)
                        {
                            point1.Y = y;
                            point2.Y = y;
                            point3D  = new Point3D(point1.X, y, marksZPosition);
                            point3D2 = new Point3D(point1.X, point1.Y, (float)(0.0 - this.size - chartArea.areaSceneWallWidth.Width));
                        }
                        else if (this.style == TickMarkStyle.Cross)
                        {
                            point1.Y = y;
                            point2.Y = (float)(y + this.size / 2.0);
                            point3D  = new Point3D(point1.X, y, marksZPosition);
                            point3D2 = new Point3D(point1.X, point1.Y, (float)((0.0 - this.size) / 2.0 - chartArea.areaSceneWallWidth.Width));
                        }
                        if (chartArea.ShouldDrawOnSurface(SurfaceNames.Top, backElements, false))
                        {
                            point3D  = null;
                            point3D2 = null;
                        }
                    }
                    if (base.axis.AxisPosition == AxisPosition.Left && !chartArea.IsSideSceneWallOnLeft())
                    {
                        float x = base.axis.PlotAreaPosition.X;
                        if (this.style == TickMarkStyle.Inside)
                        {
                            point1.X = x;
                            point2.X = x + this.size;
                            point3D  = new Point3D(point1.X, point1.Y, (float)(0.0 - chartArea.areaSceneWallWidth.Width));
                            point3D2 = new Point3D(point1.X, point1.Y, 0f);
                        }
                        else if (this.style == TickMarkStyle.Outside)
                        {
                            point1.X = x;
                            point2.X = x;
                            point3D  = new Point3D(x, point1.Y, marksZPosition);
                            point3D2 = new Point3D(x, point1.Y, (float)(0.0 - this.size - chartArea.areaSceneWallWidth.Width));
                        }
                        else if (this.style == TickMarkStyle.Cross)
                        {
                            point1.X = x;
                            point2.X = (float)(x + this.size / 2.0);
                            point3D  = new Point3D(x, point1.Y, marksZPosition);
                            point3D2 = new Point3D(x, point1.Y, (float)((0.0 - this.size) / 2.0 - chartArea.areaSceneWallWidth.Width));
                        }
                        if (chartArea.ShouldDrawOnSurface(SurfaceNames.Left, backElements, false))
                        {
                            point3D  = null;
                            point3D2 = null;
                        }
                    }
                    else if (base.axis.AxisPosition == AxisPosition.Right && chartArea.IsSideSceneWallOnLeft())
                    {
                        float num = base.axis.PlotAreaPosition.Right();
                        if (this.style == TickMarkStyle.Inside)
                        {
                            point1.X = num - this.size;
                            point2.X = num;
                            point3D  = new Point3D(point2.X, point2.Y, (float)(0.0 - chartArea.areaSceneWallWidth.Width));
                            point3D2 = new Point3D(point2.X, point2.Y, 0f);
                        }
                        else if (this.style == TickMarkStyle.Outside)
                        {
                            point1.X = num;
                            point2.X = num;
                            point3D  = new Point3D(num, point1.Y, marksZPosition);
                            point3D2 = new Point3D(num, point1.Y, (float)(0.0 - this.size - chartArea.areaSceneWallWidth.Width));
                        }
                        else if (this.style == TickMarkStyle.Cross)
                        {
                            point1.X = (float)(num - this.size / 2.0);
                            point2.X = num;
                            point3D  = new Point3D(num, point1.Y, marksZPosition);
                            point3D2 = new Point3D(num, point1.Y, (float)((0.0 - this.size) / 2.0 - chartArea.areaSceneWallWidth.Width));
                        }
                        if (chartArea.ShouldDrawOnSurface(SurfaceNames.Right, backElements, false))
                        {
                            point3D  = null;
                            point3D2 = null;
                        }
                    }
                }
                graph.Draw3DLine(chartArea.matrix3D, base.borderColor, base.borderWidth, base.borderStyle, new Point3D(point1.X, point1.Y, marksZPosition), new Point3D(point2.X, point2.Y, marksZPosition), base.axis.Common, this, ChartElementType.TickMarks);
                if (point3D != null && point3D2 != null)
                {
                    graph.Draw3DLine(chartArea.matrix3D, base.borderColor, base.borderWidth, base.borderStyle, point3D, point3D2, base.axis.Common, this, ChartElementType.TickMarks);
                }
            }
        }
Ejemplo n.º 9
0
        internal GraphicsPath Draw3DSplinePolygon(ChartGraphics graph, ChartArea area, float positionZ, Color backColor, Color borderColor, int borderWidth, ChartDashStyle borderStyle, DataPoint3D firstPoint, DataPoint3D secondPoint, DataPoint3D thirdPoint, DataPoint3D fourthPoint, ArrayList points, int pointIndex, float tension, DrawingOperationTypes operationType, LineSegmentType lineSegmentType, bool forceThinBorder)
        {
            if (tension == 0f)
            {
                SurfaceNames thinBorders = (SurfaceNames)0;
                if (forceThinBorder)
                {
                    thinBorders = (SurfaceNames.Left | SurfaceNames.Right);
                }
                return(graph.Draw3DPolygon(area, area.matrix3D, area.Area3DStyle.Light, SurfaceNames.Front, positionZ, backColor, borderColor, borderWidth, borderStyle, firstPoint, secondPoint, thirdPoint, fourthPoint, points, pointIndex, tension, operationType, lineSegmentType, thinBorders));
            }
            bool         num                = (operationType & DrawingOperationTypes.DrawElement) == DrawingOperationTypes.DrawElement;
            GraphicsPath graphicsPath       = new GraphicsPath();
            GraphicsPath splineFlattenPath  = graph.GetSplineFlattenPath(area, area.matrix3D, positionZ, 0f, firstPoint, secondPoint, points, pointIndex, tension, flatten: false, translateCoordinates: true, 0);
            GraphicsPath splineFlattenPath2 = graph.GetSplineFlattenPath(area, area.matrix3D, positionZ, 0f, thirdPoint, fourthPoint, points, pointIndex, tension, flatten: false, translateCoordinates: true, 1);

            graphicsPath.AddPath(splineFlattenPath, connect: true);
            graphicsPath.AddPath(splineFlattenPath2, connect: true);
            graphicsPath.CloseAllFigures();
            Point3D[] array = new Point3D[3]
            {
                new Point3D((float)firstPoint.xPosition, (float)firstPoint.yPosition, positionZ),
                new Point3D((float)secondPoint.xPosition, (float)secondPoint.yPosition, positionZ),
                new Point3D((float)thirdPoint.xPosition, (float)thirdPoint.yPosition, positionZ)
            };
            area.matrix3D.TransformPoints(array);
            bool  visiblePolygon = ChartGraphics3D.IsSurfaceVisible(array[0], array[1], array[2]);
            Color polygonLight   = area.matrix3D.GetPolygonLight(array, backColor, visiblePolygon, area.Area3DStyle.YAngle, SurfaceNames.Front, area.reverseSeriesOrder);
            Color color          = borderColor;

            if (color == Color.Empty)
            {
                color = ChartGraphics.GetGradientColor(backColor, Color.Black, 0.2);
            }
            Pen pen = null;

            if (num)
            {
                SmoothingMode smoothingMode = graph.SmoothingMode;
                graph.SmoothingMode = SmoothingMode.Default;
                graph.FillPath(new SolidBrush(polygonLight), graphicsPath);
                graph.SmoothingMode = smoothingMode;
                if (forceThinBorder)
                {
                    graph.DrawPath(new Pen(color, 1f), graphicsPath);
                }
                else if (polygonLight.A == byte.MaxValue)
                {
                    graph.DrawPath(new Pen(polygonLight, 1f), graphicsPath);
                }
                pen          = new Pen(color, borderWidth);
                pen.StartCap = LineCap.Round;
                pen.EndCap   = LineCap.Round;
                graph.DrawPath(pen, splineFlattenPath);
                graph.DrawPath(pen, splineFlattenPath2);
                switch (lineSegmentType)
                {
                case LineSegmentType.First:
                    graph.DrawLine(pen, splineFlattenPath.PathPoints[0], splineFlattenPath2.GetLastPoint());
                    break;

                case LineSegmentType.Last:
                    graph.DrawLine(pen, splineFlattenPath.GetLastPoint(), splineFlattenPath2.PathPoints[0]);
                    break;
                }
            }
            if (graphicsPath != null && pen != null)
            {
                ChartGraphics.Widen(graphicsPath, pen);
            }
            return(graphicsPath);
        }
Ejemplo n.º 10
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);
        }
Ejemplo n.º 11
0
        internal void Draw3DTickLine(ChartGraphics graph, PointF point1, PointF point2, bool horizontal, float scrollBarSize, bool backElements, bool selectionMode)
        {
            ChartArea chartArea = axis.chartArea;
            bool      axisOnEdge;
            float     marksZPosition = axis.GetMarksZPosition(out axisOnEdge);
            bool      flag           = axisOnEdge;

            if ((flag && axis.MajorTickMark.Style == TickMarkStyle.Cross) || axis.MajorTickMark.Style == TickMarkStyle.Inside || axis.MinorTickMark.Style == TickMarkStyle.Cross || axis.MinorTickMark.Style == TickMarkStyle.Inside)
            {
                flag = false;
            }
            SurfaceNames surfaceName = (marksZPosition != 0f) ? SurfaceNames.Front : SurfaceNames.Back;

            if (!chartArea.ShouldDrawOnSurface(surfaceName, backElements, flag))
            {
                return;
            }
            if (axis.AxisPosition == AxisPosition.Bottom && (!axis.IsMarksNextToAxis() || axisOnEdge) && chartArea.IsBottomSceneWallVisible())
            {
                point2.Y += chartArea.areaSceneWallWidth.Height;
            }
            else if (axis.AxisPosition == AxisPosition.Left && (!axis.IsMarksNextToAxis() || axisOnEdge) && chartArea.IsSideSceneWallOnLeft())
            {
                point1.X -= chartArea.areaSceneWallWidth.Width;
            }
            else if (axis.AxisPosition == AxisPosition.Right && (!axis.IsMarksNextToAxis() || axisOnEdge) && !chartArea.IsSideSceneWallOnLeft())
            {
                point2.X += chartArea.areaSceneWallWidth.Width;
            }
            else if (axis.AxisPosition == AxisPosition.Top && (!axis.IsMarksNextToAxis() || axisOnEdge))
            {
                point1.Y -= chartArea.areaSceneWallWidth.Height;
            }
            Point3D point3D  = null;
            Point3D point3D2 = null;

            if (axisOnEdge && chartArea.areaSceneWallWidth.Width != 0f)
            {
                if (axis.AxisPosition == AxisPosition.Top)
                {
                    float y = axis.PlotAreaPosition.Y;
                    if (style == TickMarkStyle.Inside)
                    {
                        point1.Y = y;
                        point2.Y = y + size;
                        point3D  = new Point3D(point1.X, point1.Y, 0f - chartArea.areaSceneWallWidth.Width);
                        point3D2 = new Point3D(point1.X, point1.Y, 0f);
                    }
                    else if (style == TickMarkStyle.Outside)
                    {
                        point1.Y = y;
                        point2.Y = y;
                        point3D  = new Point3D(point1.X, y, marksZPosition);
                        point3D2 = new Point3D(point1.X, point1.Y, 0f - size - chartArea.areaSceneWallWidth.Width);
                    }
                    else if (style == TickMarkStyle.Cross)
                    {
                        point1.Y = y;
                        point2.Y = y + size / 2f;
                        point3D  = new Point3D(point1.X, y, marksZPosition);
                        point3D2 = new Point3D(point1.X, point1.Y, (0f - size) / 2f - chartArea.areaSceneWallWidth.Width);
                    }
                    if (chartArea.ShouldDrawOnSurface(SurfaceNames.Top, backElements, onEdge: false))
                    {
                        point3D  = null;
                        point3D2 = null;
                    }
                }
                if (axis.AxisPosition == AxisPosition.Left && !chartArea.IsSideSceneWallOnLeft())
                {
                    float x = axis.PlotAreaPosition.X;
                    if (style == TickMarkStyle.Inside)
                    {
                        point1.X = x;
                        point2.X = x + size;
                        point3D  = new Point3D(point1.X, point1.Y, 0f - chartArea.areaSceneWallWidth.Width);
                        point3D2 = new Point3D(point1.X, point1.Y, 0f);
                    }
                    else if (style == TickMarkStyle.Outside)
                    {
                        point1.X = x;
                        point2.X = x;
                        point3D  = new Point3D(x, point1.Y, marksZPosition);
                        point3D2 = new Point3D(x, point1.Y, 0f - size - chartArea.areaSceneWallWidth.Width);
                    }
                    else if (style == TickMarkStyle.Cross)
                    {
                        point1.X = x;
                        point2.X = x + size / 2f;
                        point3D  = new Point3D(x, point1.Y, marksZPosition);
                        point3D2 = new Point3D(x, point1.Y, (0f - size) / 2f - chartArea.areaSceneWallWidth.Width);
                    }
                    if (chartArea.ShouldDrawOnSurface(SurfaceNames.Left, backElements, onEdge: false))
                    {
                        point3D  = null;
                        point3D2 = null;
                    }
                }
                else if (axis.AxisPosition == AxisPosition.Right && chartArea.IsSideSceneWallOnLeft())
                {
                    float num = axis.PlotAreaPosition.Right();
                    if (style == TickMarkStyle.Inside)
                    {
                        point1.X = num - size;
                        point2.X = num;
                        point3D  = new Point3D(point2.X, point2.Y, 0f - chartArea.areaSceneWallWidth.Width);
                        point3D2 = new Point3D(point2.X, point2.Y, 0f);
                    }
                    else if (style == TickMarkStyle.Outside)
                    {
                        point1.X = num;
                        point2.X = num;
                        point3D  = new Point3D(num, point1.Y, marksZPosition);
                        point3D2 = new Point3D(num, point1.Y, 0f - size - chartArea.areaSceneWallWidth.Width);
                    }
                    else if (style == TickMarkStyle.Cross)
                    {
                        point1.X = num - size / 2f;
                        point2.X = num;
                        point3D  = new Point3D(num, point1.Y, marksZPosition);
                        point3D2 = new Point3D(num, point1.Y, (0f - size) / 2f - chartArea.areaSceneWallWidth.Width);
                    }
                    if (chartArea.ShouldDrawOnSurface(SurfaceNames.Right, backElements, onEdge: false))
                    {
                        point3D  = null;
                        point3D2 = null;
                    }
                }
            }
            graph.Draw3DLine(chartArea.matrix3D, borderColor, borderWidth, borderStyle, new Point3D(point1.X, point1.Y, marksZPosition), new Point3D(point2.X, point2.Y, marksZPosition), axis.Common, this, ChartElementType.TickMarks);
            if (point3D != null && point3D2 != null)
            {
                graph.Draw3DLine(chartArea.matrix3D, borderColor, borderWidth, borderStyle, point3D, point3D2, axis.Common, this, ChartElementType.TickMarks);
            }
        }
Ejemplo n.º 12
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;

            if (Math.Round(firstPoint.xPosition, 3) == Math.Round(secondPoint.xPosition, 3) && Math.Round(firstPoint.yPosition, 3) == Math.Round(secondPoint.yPosition, 3))
            {
                return(graphicsPath);
            }
            DataPoint3D dataPoint3D = secondPoint;

            if (prevDataPointEx.dataPoint.Empty)
            {
                dataPoint3D = prevDataPointEx;
            }
            else if (firstPoint.index > secondPoint.index)
            {
                dataPoint3D = firstPoint;
            }
            Color          color       = base.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)Math.Round(base.vAxis.GetPosition(base.vAxis.Crossing), 3);
            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 surfaceNames = graph.GetVisibleSurfaces(position, positionZ, depth, matrix);
            bool         upSideDown   = false;

            if ((decimal)firstPoint.yPosition >= (decimal)num && (decimal)secondPoint.yPosition >= (decimal)num)
            {
                upSideDown = true;
                bool flag  = (surfaceNames & SurfaceNames.Top) == SurfaceNames.Top;
                bool flag2 = (surfaceNames & SurfaceNames.Bottom) == SurfaceNames.Bottom;
                surfaceNames ^= SurfaceNames.Bottom;
                surfaceNames ^= SurfaceNames.Top;
                if (flag)
                {
                    surfaceNames |= SurfaceNames.Bottom;
                }
                if (flag2)
                {
                    surfaceNames |= SurfaceNames.Top;
                }
            }
            this.GetTopSurfaceVisibility(area, firstPoint, secondPoint, upSideDown, positionZ, depth, matrix, ref surfaceNames);
            PointF pointF  = default(PointF);
            PointF pointF2 = default(PointF);

            this.GetBottomPointsPosition(base.common, area, num, ref firstPoint, ref secondPoint, thirdPointPosition, fourthPointPosition, out pointF, out pointF2);
            if (!float.IsNaN(thirdPointPosition.Y))
            {
                pointF.Y = thirdPointPosition.Y;
            }
            if (!float.IsNaN(fourthPointPosition.Y))
            {
                pointF2.Y = fourthPointPosition.Y;
            }
            if (!float.IsNaN(pointF.X) && !float.IsNaN(pointF.Y) && !float.IsNaN(pointF2.X) && !float.IsNaN(pointF2.Y))
            {
                if (clipOnTop && base.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 (clipOnBottom && base.ClipBottomPoints(graphicsPath, ref firstPoint, ref secondPoint, ref pointF, ref pointF2, reversed, area, graph, matrix, lightStyle, prevDataPointEx, positionZ, depth, points, pointIndex, pointLoopIndex, tension, operationType, surfaceSegmentType, topDarkening, bottomDarkening))
                {
                    return(graphicsPath);
                }
                if (Math.Round((decimal)firstPoint.yPosition, 3) > (decimal)num + 0.001m && Math.Round((decimal)secondPoint.yPosition, 3) < (decimal)num - 0.001m)
                {
                    goto IL_03d1;
                }
                if (Math.Round((decimal)firstPoint.yPosition, 3) < (decimal)num - 0.001m && Math.Round((decimal)secondPoint.yPosition, 3) > (decimal)num + 0.001m)
                {
                    goto IL_03d1;
                }
                if (Math.Round(firstPoint.xPosition, 3) == Math.Round(secondPoint.xPosition, 3) && Math.Round(firstPoint.yPosition, 3) == Math.Round(secondPoint.yPosition, 3))
                {
                    return(graphicsPath);
                }
                for (int i = 1; i <= 2; i++)
                {
                    SurfaceNames[] array = new SurfaceNames[6]
                    {
                        SurfaceNames.Back,
                        SurfaceNames.Bottom,
                        SurfaceNames.Top,
                        SurfaceNames.Left,
                        SurfaceNames.Right,
                        SurfaceNames.Front
                    };
                    LineSegmentType lineSegmentType = LineSegmentType.Middle;
                    SurfaceNames[]  array2          = array;
                    foreach (SurfaceNames surfaceNames2 in array2)
                    {
                        if (ChartGraphics3D.ShouldDrawLineChartSurface(area, area.reverseSeriesOrder, surfaceNames2, surfaceNames, color, points, firstPoint, secondPoint, base.multiSeries, reversed, ref lineSegmentType) == i)
                        {
                            if (base.allPointsLoopsNumber == 2 && (operationType & DrawingOperationTypes.DrawElement) == DrawingOperationTypes.DrawElement)
                            {
                                if (pointLoopIndex == 0 && (surfaceNames2 == SurfaceNames.Front || (i == 2 && (surfaceNames2 == SurfaceNames.Left || surfaceNames2 == SurfaceNames.Right))))
                                {
                                    continue;
                                }
                                if (pointLoopIndex == 1)
                                {
                                    switch (surfaceNames2)
                                    {
                                    case SurfaceNames.Front:
                                        goto IL_05fc;
                                    }
                                    if (i != 1 && (surfaceNames2 == SurfaceNames.Left || surfaceNames2 == SurfaceNames.Right))
                                    {
                                        goto IL_05fc;
                                    }
                                    continue;
                                }
                            }
                            goto IL_05fc;
                        }
                        continue;
IL_05fc:
                        Color color2 = color;
                        Color color3 = dataPoint3D.dataPoint.BorderColor;
                        if (i == 1)
                        {
                            if (color2.A == 255)
                            {
                                continue;
                            }
                            color2 = Color.Transparent;
                            if (color3 == Color.Empty)
                            {
                                color3 = ChartGraphics.GetGradientColor(color, Color.Black, 0.2);
                            }
                        }
                        bool flag3 = base.showPointLines;
                        if (surfaceSegmentType == LineSegmentType.Middle)
                        {
                            flag3 = false;
                        }
                        if (!clippedSegment || surfaceNames2 == SurfaceNames.Top || surfaceNames2 == SurfaceNames.Bottom)
                        {
                            GraphicsPath graphicsPath2 = null;
                            switch (surfaceNames2)
                            {
                            case SurfaceNames.Top:
                            {
                                Color backColor   = (topDarkening == 0.0) ? color2 : ChartGraphics.GetGradientColor(color2, Color.Black, (double)topDarkening);
                                Color borderColor = (topDarkening == 0.0) ? color3 : ChartGraphics.GetGradientColor(color3, Color.Black, (double)topDarkening);
                                graphicsPath2 = graph.Draw3DSurface(area, matrix, lightStyle, surfaceNames2, positionZ, depth, backColor, borderColor, dataPoint3D.dataPoint.BorderWidth, borderStyle, firstPoint, secondPoint, points, pointIndex, 0f, operationType, surfaceSegmentType, flag3, false, area.reverseSeriesOrder, base.multiSeries, 0, true);
                                break;
                            }

                            case SurfaceNames.Bottom:
                            {
                                DataPoint3D dataPoint3D9 = new DataPoint3D();
                                dataPoint3D9.index     = firstPoint.index;
                                dataPoint3D9.dataPoint = firstPoint.dataPoint;
                                dataPoint3D9.xPosition = firstPoint.xPosition;
                                dataPoint3D9.yPosition = (double)pointF.Y;
                                DataPoint3D dataPoint3D10 = new DataPoint3D();
                                dataPoint3D10.index     = secondPoint.index;
                                dataPoint3D10.dataPoint = secondPoint.dataPoint;
                                dataPoint3D10.xPosition = secondPoint.xPosition;
                                dataPoint3D10.yPosition = (double)pointF2.Y;
                                Color backColor2   = (bottomDarkening == 0.0) ? color2 : ChartGraphics.GetGradientColor(color2, Color.Black, (double)topDarkening);
                                Color borderColor2 = (bottomDarkening == 0.0) ? color3 : ChartGraphics.GetGradientColor(color3, Color.Black, (double)topDarkening);
                                graphicsPath2 = graph.Draw3DSurface(area, matrix, lightStyle, surfaceNames2, positionZ, depth, backColor2, borderColor2, dataPoint3D.dataPoint.BorderWidth, borderStyle, dataPoint3D9, dataPoint3D10, points, pointIndex, 0f, operationType, surfaceSegmentType, flag3, false, area.reverseSeriesOrder, base.multiSeries, 0, true);
                                break;
                            }

                            case SurfaceNames.Left:
                            {
                                if (surfaceSegmentType != 0 && (area.reverseSeriesOrder || surfaceSegmentType != LineSegmentType.First))
                                {
                                    if (!area.reverseSeriesOrder)
                                    {
                                        break;
                                    }
                                    if (surfaceSegmentType != LineSegmentType.Last)
                                    {
                                        break;
                                    }
                                }
                                DataPoint3D dataPoint3D4 = (firstPoint.xPosition <= secondPoint.xPosition) ? firstPoint : secondPoint;
                                DataPoint3D dataPoint3D5 = new DataPoint3D();
                                dataPoint3D5.index     = dataPoint3D4.index;
                                dataPoint3D5.dataPoint = dataPoint3D4.dataPoint;
                                dataPoint3D5.xPosition = dataPoint3D4.xPosition;
                                dataPoint3D5.yPosition = (double)((firstPoint.xPosition <= secondPoint.xPosition) ? pointF.Y : pointF2.Y);
                                DataPoint3D dataPoint3D6 = new DataPoint3D();
                                dataPoint3D6.index     = dataPoint3D4.index;
                                dataPoint3D6.dataPoint = dataPoint3D4.dataPoint;
                                dataPoint3D6.xPosition = dataPoint3D4.xPosition;
                                dataPoint3D6.yPosition = dataPoint3D4.yPosition;
                                graphicsPath2          = graph.Draw3DSurface(area, matrix, lightStyle, surfaceNames2, positionZ, depth, color2, color3, dataPoint3D.dataPoint.BorderWidth, borderStyle, dataPoint3D5, dataPoint3D6, points, pointIndex, 0f, operationType, LineSegmentType.Single, true, true, area.reverseSeriesOrder, base.multiSeries, 0, true);
                                break;
                            }

                            case SurfaceNames.Right:
                            {
                                if (surfaceSegmentType != 0 && (area.reverseSeriesOrder || surfaceSegmentType != LineSegmentType.Last))
                                {
                                    if (!area.reverseSeriesOrder)
                                    {
                                        break;
                                    }
                                    if (surfaceSegmentType != LineSegmentType.First)
                                    {
                                        break;
                                    }
                                }
                                DataPoint3D dataPoint3D11 = (secondPoint.xPosition >= firstPoint.xPosition) ? secondPoint : firstPoint;
                                DataPoint3D dataPoint3D12 = new DataPoint3D();
                                dataPoint3D12.index     = dataPoint3D11.index;
                                dataPoint3D12.dataPoint = dataPoint3D11.dataPoint;
                                dataPoint3D12.xPosition = dataPoint3D11.xPosition;
                                dataPoint3D12.yPosition = (double)((secondPoint.xPosition >= firstPoint.xPosition) ? pointF2.Y : pointF.Y);
                                DataPoint3D dataPoint3D13 = new DataPoint3D();
                                dataPoint3D13.index     = dataPoint3D11.index;
                                dataPoint3D13.dataPoint = dataPoint3D11.dataPoint;
                                dataPoint3D13.xPosition = dataPoint3D11.xPosition;
                                dataPoint3D13.yPosition = dataPoint3D11.yPosition;
                                graphicsPath2           = graph.Draw3DSurface(area, matrix, lightStyle, surfaceNames2, positionZ, depth, color2, color3, dataPoint3D.dataPoint.BorderWidth, borderStyle, dataPoint3D12, dataPoint3D13, points, pointIndex, 0f, operationType, LineSegmentType.Single, true, true, area.reverseSeriesOrder, base.multiSeries, 0, true);
                                break;
                            }

                            case SurfaceNames.Back:
                            {
                                DataPoint3D dataPoint3D7 = new DataPoint3D();
                                dataPoint3D7.index     = firstPoint.index;
                                dataPoint3D7.dataPoint = firstPoint.dataPoint;
                                dataPoint3D7.xPosition = firstPoint.xPosition;
                                dataPoint3D7.yPosition = (double)pointF.Y;
                                DataPoint3D dataPoint3D8 = new DataPoint3D();
                                dataPoint3D8.index     = secondPoint.index;
                                dataPoint3D8.dataPoint = secondPoint.dataPoint;
                                dataPoint3D8.xPosition = secondPoint.xPosition;
                                dataPoint3D8.yPosition = (double)pointF2.Y;
                                SurfaceNames thinBorders2 = (SurfaceNames)0;
                                if (flag3)
                                {
                                    switch (surfaceSegmentType)
                                    {
                                    case LineSegmentType.Single:
                                        thinBorders2 = (SurfaceNames.Left | SurfaceNames.Right);
                                        break;

                                    case LineSegmentType.First:
                                        thinBorders2 = SurfaceNames.Left;
                                        break;

                                    case LineSegmentType.Last:
                                        thinBorders2 = SurfaceNames.Right;
                                        break;
                                    }
                                }
                                graphicsPath2 = graph.Draw3DPolygon(area, matrix, lightStyle, surfaceNames2, positionZ, color2, color3, dataPoint3D.dataPoint.BorderWidth, borderStyle, firstPoint, secondPoint, dataPoint3D8, dataPoint3D7, points, pointIndex, 0f, operationType, lineSegmentType, thinBorders2);
                                break;
                            }

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

                                    case LineSegmentType.Last:
                                        lineSegmentType = LineSegmentType.First;
                                        break;
                                    }
                                }
                                switch (surfaceSegmentType)
                                {
                                case LineSegmentType.First:
                                    if (lineSegmentType == LineSegmentType.First)
                                    {
                                        goto default;
                                    }
                                    goto case LineSegmentType.Middle;

                                default:
                                    if (surfaceSegmentType != LineSegmentType.Last)
                                    {
                                        break;
                                    }
                                    if (lineSegmentType == LineSegmentType.Last)
                                    {
                                        break;
                                    }
                                    goto case LineSegmentType.Middle;

                                case LineSegmentType.Middle:
                                    lineSegmentType = LineSegmentType.Middle;
                                    break;

                                case LineSegmentType.Single:
                                    break;
                                }
                                SurfaceNames thinBorders = (SurfaceNames)0;
                                if (flag3)
                                {
                                    switch (surfaceSegmentType)
                                    {
                                    case LineSegmentType.Single:
                                        thinBorders = (SurfaceNames.Left | SurfaceNames.Right);
                                        break;

                                    case LineSegmentType.First:
                                        thinBorders = SurfaceNames.Left;
                                        break;

                                    case LineSegmentType.Last:
                                        thinBorders = SurfaceNames.Right;
                                        break;
                                    }
                                }
                                graphicsPath2 = graph.Draw3DPolygon(area, matrix, lightStyle, surfaceNames2, positionZ + depth, color2, color3, dataPoint3D.dataPoint.BorderWidth, borderStyle, firstPoint, secondPoint, dataPoint3D3, dataPoint3D2, points, pointIndex, 0f, operationType, lineSegmentType, thinBorders);
                                break;
                            }
                            }
                            if (i == 2 && graphicsPath != null && graphicsPath2 != null && graphicsPath2.PointCount > 0)
                            {
                                graphicsPath.CloseFigure();
                                graphicsPath.SetMarkers();
                                graphicsPath.AddPath(graphicsPath2, true);
                            }
                        }
                    }
                }
                return(graphicsPath);
            }
            return(graphicsPath);

IL_03d1:
            DataPoint3D axisIntersection = this.GetAxisIntersection(firstPoint, secondPoint, num);

            for (int num4 = 0; num4 <= 1; num4++)
            {
                GraphicsPath graphicsPath3 = null;
                if (num4 == 0 && !reversed)
                {
                    goto IL_03f7;
                }
                if (num4 == 1 && reversed)
                {
                    goto IL_03f7;
                }
                goto IL_045f;
IL_03f7:
                axisIntersection.dataPoint = secondPoint.dataPoint;
                axisIntersection.index     = secondPoint.index;
                graphicsPath3 = this.Draw3DSurface(firstPoint, axisIntersection, 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, clipOnBottom);
                goto IL_045f;
IL_046e:
                axisIntersection.dataPoint = firstPoint.dataPoint;
                axisIntersection.index     = firstPoint.index;
                graphicsPath3 = this.Draw3DSurface(axisIntersection, 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, clipOnBottom);
                goto IL_04d6;
IL_045f:
                if (num4 == 1 && !reversed)
                {
                    goto IL_046e;
                }
                if (num4 == 0 && reversed)
                {
                    goto IL_046e;
                }
                goto IL_04d6;
IL_04d6:
                if (graphicsPath != null && graphicsPath3 != null && graphicsPath3.PointCount > 0)
                {
                    graphicsPath.AddPath(graphicsPath3, true);
                }
            }
            return(graphicsPath);
        }