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

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

            if (color == Color.Transparent)
            {
                areaSceneWallWidth = SizeF.Empty;
                return;
            }
            if (color == Color.Empty)
            {
                color = Color.LightGray;
            }
            if (IsBottomSceneWallVisible())
            {
                position.Height += areaSceneWallWidth.Height;
            }
            position.Width += areaSceneWallWidth.Width;
            if (Area3DStyle.YAngle > 0)
            {
                position.X -= areaSceneWallWidth.Width;
            }
            RectangleF position2 = new RectangleF(position.Location, position.Size);
            float      width     = areaSceneWallWidth.Width;
            float      positionZ = 0f - width;

            if (IsMainSceneWallOnFront())
            {
                positionZ = areaSceneDepth;
            }
            graph.Fill3DRectangle(position2, positionZ, width, 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 = areaSceneWallWidth.Width;
            if (!IsSideSceneWallOnLeft())
            {
                position2.X = position.Right - areaSceneWallWidth.Width;
            }
            graph.Fill3DRectangle(position2, 0f, areaSceneDepth, 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 (IsBottomSceneWallVisible())
            {
                position2        = new RectangleF(position.Location, position.Size);
                position2.Height = areaSceneWallWidth.Height;
                position2.Y      = position.Bottom - areaSceneWallWidth.Height;
                position2.Width -= areaSceneWallWidth.Width;
                if (IsSideSceneWallOnLeft())
                {
                    position2.X += areaSceneWallWidth.Width;
                }
                positionZ = 0f;
                graph.Fill3DRectangle(position2, 0f, areaSceneDepth, 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
        internal void Estimate3DInterval(ChartGraphics graph)
        {
            _ = (ChartArea)this;
            areaSceneWallWidth = graph.GetRelativeSize(new SizeF(Area3DStyle.WallWidth, Area3DStyle.WallWidth));
            ChartArea chartArea = (ChartArea)this;

            areaSceneDepth = GetEstimatedSceneDepth();
            RectangleF innerPlotRectangle = chartArea.Position.ToRectangleF();

            if (base.PlotAreaPosition.Width == 0f && base.PlotAreaPosition.Height == 0f && !chartArea.InnerPlotPosition.Auto && !chartArea.Position.Auto && !chartArea.InnerPlotPosition.Auto)
            {
                innerPlotRectangle.X     += chartArea.Position.Width / 100f * chartArea.InnerPlotPosition.X;
                innerPlotRectangle.Y     += chartArea.Position.Height / 100f * chartArea.InnerPlotPosition.Y;
                innerPlotRectangle.Width  = chartArea.Position.Width / 100f * chartArea.InnerPlotPosition.Width;
                innerPlotRectangle.Height = chartArea.Position.Height / 100f * chartArea.InnerPlotPosition.Height;
            }
            int      realYAngle = GetRealYAngle();
            Matrix3D matrix3D   = new Matrix3D();

            matrix3D.Initialize(innerPlotRectangle, areaSceneDepth, Area3DStyle.XAngle, realYAngle, Area3DStyle.Perspective, Area3DStyle.RightAngleAxes);
            Point3D[] array = new Point3D[8];
            bool      axisOnEdge;

            if (chartArea.switchValueAxes)
            {
                float marksZPosition = axisX.GetMarksZPosition(out axisOnEdge);
                array[0]       = new Point3D(innerPlotRectangle.X, innerPlotRectangle.Y, marksZPosition);
                array[1]       = new Point3D(innerPlotRectangle.X, innerPlotRectangle.Bottom, marksZPosition);
                marksZPosition = axisY.GetMarksZPosition(out axisOnEdge);
                array[2]       = new Point3D(innerPlotRectangle.X, innerPlotRectangle.Bottom, marksZPosition);
                array[3]       = new Point3D(innerPlotRectangle.Right, innerPlotRectangle.Bottom, marksZPosition);
                marksZPosition = axisX2.GetMarksZPosition(out axisOnEdge);
                array[4]       = new Point3D(innerPlotRectangle.X, innerPlotRectangle.Y, marksZPosition);
                array[5]       = new Point3D(innerPlotRectangle.X, innerPlotRectangle.Bottom, marksZPosition);
                marksZPosition = axisY2.GetMarksZPosition(out axisOnEdge);
                array[6]       = new Point3D(innerPlotRectangle.X, innerPlotRectangle.Y, marksZPosition);
                array[7]       = new Point3D(innerPlotRectangle.Right, innerPlotRectangle.Y, marksZPosition);
            }
            else
            {
                float marksZPosition = axisX.GetMarksZPosition(out axisOnEdge);
                array[0]       = new Point3D(innerPlotRectangle.X, innerPlotRectangle.Bottom, marksZPosition);
                array[1]       = new Point3D(innerPlotRectangle.Right, innerPlotRectangle.Bottom, marksZPosition);
                marksZPosition = axisY.GetMarksZPosition(out axisOnEdge);
                array[2]       = new Point3D(innerPlotRectangle.X, innerPlotRectangle.Y, marksZPosition);
                array[3]       = new Point3D(innerPlotRectangle.X, innerPlotRectangle.Bottom, marksZPosition);
                marksZPosition = axisX2.GetMarksZPosition(out axisOnEdge);
                array[4]       = new Point3D(innerPlotRectangle.X, innerPlotRectangle.Y, marksZPosition);
                array[5]       = new Point3D(innerPlotRectangle.Right, innerPlotRectangle.Y, marksZPosition);
                marksZPosition = axisY2.GetMarksZPosition(out axisOnEdge);
                array[6]       = new Point3D(innerPlotRectangle.X, innerPlotRectangle.Y, marksZPosition);
                array[7]       = new Point3D(innerPlotRectangle.X, innerPlotRectangle.Bottom, marksZPosition);
            }
            Axis[] axes = chartArea.Axes;
            foreach (Axis obj in axes)
            {
                obj.crossing = obj.tempCrossing;
            }
            matrix3D.TransformPoints(array);
            int num = 0;

            axes = chartArea.Axes;
            foreach (Axis axis in axes)
            {
                double num2 = Math.Sqrt((array[num].X - array[num + 1].X) * (array[num].X - array[num + 1].X) + (array[num].Y - array[num + 1].Y) * (array[num].Y - array[num + 1].Y));
                float  num3 = 1f;
                if (!chartArea.switchValueAxes)
                {
                    num3 = 0.5f;
                }
                if (axis.Type == AxisName.X || axis.Type == AxisName.X2)
                {
                    if (chartArea.switchValueAxes)
                    {
                        axis.interval3DCorrection = num2 / (double)innerPlotRectangle.Height;
                    }
                    else
                    {
                        axis.interval3DCorrection = num2 / (double)innerPlotRectangle.Width;
                    }
                }
                else if (chartArea.switchValueAxes)
                {
                    axis.interval3DCorrection = num2 / (double)innerPlotRectangle.Width;
                }
                else
                {
                    axis.interval3DCorrection = num2 / (double)innerPlotRectangle.Height * (double)num3;
                }
                if (axis.interval3DCorrection < 0.15)
                {
                    axis.interval3DCorrection = 0.15;
                }
                if (axis.interval3DCorrection > 0.8)
                {
                    axis.interval3DCorrection = 1.0;
                }
                num += 2;
            }
        }