コード例 #1
0
ファイル: DxfOle.cs プロジェクト: 15831944/WW
        private void method_15(
            DrawContext.Wireframe context,
            Bitmap bitmap,
            out DxfRasterImage rasterImage,
            out Vector4D transformedOrigin,
            out Vector4D transformedXAxis,
            out Vector4D transformedYAxis)
        {
            GdiBitmap gdiBitmap = new GdiBitmap(bitmap);

            rasterImage = (DxfRasterImage) new DxfImage();
            DxfImageDef imageDef = new DxfImageDef(context.Model);

            imageDef.SetBitmap((IBitmap)gdiBitmap);
            rasterImage.SetImageDef(imageDef, true);
            IClippingTransformer clippingTransformer = (IClippingTransformer)context.GetTransformer().Clone();
            Matrix4D             preTransform1       = Transformation4D.Translation((WW.Math.Vector3D) this.point3D_3);

            clippingTransformer.SetPreTransform(preTransform1);
            Matrix4D preTransform2 = Transformation4D.Scaling((this.point3D_2 - this.point3D_3).GetLength() / (double)bitmap.Width, (this.point3D_0 - this.point3D_3).GetLength() / (double)bitmap.Height, 1.0);

            clippingTransformer.SetPreTransform(preTransform2);
            Matrix4D matrix = clippingTransformer.Matrix;

            WW.Math.Point3D zero = WW.Math.Point3D.Zero;
            transformedOrigin = matrix.TransformTo4D(zero);
            transformedXAxis  = matrix.TransformTo4D(zero + WW.Math.Vector3D.XAxis);
            transformedYAxis  = matrix.TransformTo4D(zero + WW.Math.Vector3D.YAxis);
        }
コード例 #2
0
ファイル: ShowDwgFile.cs プロジェクト: sunjini/ShowDwgFile
        public Matrix4D CalculateTo2DTransform1()
        {
            Matrix4D to2DTransform = Matrix4D.Identity;

            if (model != null && bounds != null)
            {
                double halfHeight = ImageControl.ClientSize.Height / 2;
                double halfWidth  = ImageControl.ClientSize.Width / 2;
                double margin     = 5d; // 5 pixels margin on each size.
                to2DTransform =
                    Transformation4D.Translation(translation) *
                    Transformation4D.Translation(halfWidth, halfHeight, 0) *
                    Transformation4D.Scaling(scaleFactor) *
                    DxfUtil.GetScaleTransform(
                        bounds.Corner1,
                        bounds.Corner2,
                        bounds.Center,
                        new Point3D(margin, ImageControl.ClientSize.Height - margin, 0d),
                        new Point3D(ImageControl.ClientSize.Width - margin, margin, 0d),
                        Point3D.Zero
                        );
            }
            gdiGraphics3D.To2DTransform = to2DTransform * modelTransform;
            from2DTransform             = gdiGraphics3D.To2DTransform.GetInverse();
            return(to2DTransform);
        }
コード例 #3
0
        internal Matrix4D method_14()
        {
            Matrix4D toWcsTransform = DxfUtil.GetToWCSTransform(this.vector3D_0);

            toWcsTransform.Transpose();
            Matrix4D matrix4D1 = Transformation4D.RotateZ(this.double_6) * toWcsTransform;
            Matrix4D matrix4D2;
            Matrix4D matrix4D3;
            Matrix4D matrix4D4;

            if (this.PerspectiveMode)
            {
                double num1 = Class484.smethod_0(this.size2D_0, this.double_1, this.double_4);
                matrix4D2 = this.method_24();
                matrix4D3 = new Matrix4D(1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, -1.0 / this.double_1, 0.0, 0.0, -1.0 / this.double_1, 0.0) * Transformation4D.Translation(0.0, 0.0, -num1);
                double num2 = System.Math.Sqrt(this.size2D_0.X * this.size2D_0.X + this.size2D_0.Y * this.size2D_0.Y) / 42.0;
                matrix4D4 = Transformation4D.Scaling(num2, num2, 1.0);
            }
            else
            {
                matrix4D2 = this.method_25();
                matrix4D3 = Matrix4D.Identity;
                double num = this.size2D_0.Y / this.double_4;
                matrix4D4 = Transformation4D.Scaling(num, num, 1.0);
            }
            Matrix4D matrix4D5 = Transformation4D.Translation(-this.point2D_0.X, -this.point2D_0.Y, 0.0);

            return(matrix4D2 * matrix4D4 * matrix4D5 * matrix4D3 * matrix4D1 * Transformation4D.Translation(-(WW.Math.Vector3D) this.point3D_1));
        }
コード例 #4
0
        private Matrix4D method_24()
        {
            double num1 = Class484.smethod_0(this.size2D_0, this.double_1, this.double_4);
            double num2 = this.double_3 - num1;
            double num3 = this.double_2 - num1;
            double num4 = this.bool_6 ? 1.0 / num2 : 0.0;

            return(Transformation4D.Scaling(1.0 / this.size2D_0.X, 1.0 / this.size2D_0.Y, !this.bool_5 ? -1.0 : 1.0 / (1.0 / num3 - num4)) * Transformation4D.Translation(this.size2D_0.X * 0.5, this.size2D_0.Y * 0.5, -num4));
        }
コード例 #5
0
ファイル: DxfInsert.cs プロジェクト: 15831944/WW
        private void DrawInternal(DxfInsert.Interface46 drawHandler, bool drawBlock)
        {
            Matrix4D toWcsTransform = DxfUtil.GetToWCSTransform(this.ZAxis);
            Matrix4D matrix4D1      = Transformation4D.Translation((WW.Math.Vector3D) this.InsertionPoint);
            Matrix4D matrix4D2      = Transformation4D.RotateZ(this.Rotation);
            Matrix4D matrix4D3      = Transformation4D.Scaling(this.ScaleFactor);
            ushort   num1           = this.RowCount;

            if (num1 < (ushort)1)
            {
                num1 = (ushort)1;
            }
            ushort num2 = this.ColumnCount;

            if (num2 < (ushort)1)
            {
                num2 = (ushort)1;
            }
            for (int row = 0; row < (int)num1; ++row)
            {
                for (int column = 0; column < (int)num2; ++column)
                {
                    if (drawBlock)
                    {
                        Matrix4D matrix4D4 = toWcsTransform * matrix4D1 * matrix4D2 * Transformation4D.Translation((double)column * this.ColumnSpacing, (double)row * this.RowSpacing, 0.0) * matrix4D3;
                        drawHandler.imethod_0(row, column, matrix4D4);
                        if (this.Block != null)
                        {
                            switch (this.method_16(matrix4D4, drawHandler))
                            {
                            case DxfInsert.Enum44.const_1:
                            case DxfInsert.Enum44.const_2:
                                drawHandler.Draw(this.Block, true);
                                break;

                            case DxfInsert.Enum44.const_3:
                                drawHandler.Draw(this.Block, true);
                                drawHandler.InsertCellDrawContext.vmethod_1();
                                break;
                            }
                        }
                    }
                    if (this.Attributes.Count > 0)
                    {
                        WW.Math.Vector3D vector = new WW.Math.Vector3D((double)column * this.ColumnSpacing, (double)row * this.RowSpacing, 0.0);
                        vector = (toWcsTransform * matrix4D2).Transform(vector);
                        Matrix4D instanceTransform = Transformation4D.Translation(vector.X, vector.Y, vector.Z);
                        drawHandler.imethod_1(row, column, instanceTransform);
                        foreach (DxfAttribute attribute in (IEnumerable <DxfAttribute>) this.Attributes)
                        {
                            drawHandler.Draw(attribute);
                        }
                    }
                }
            }
        }
コード例 #6
0
ファイル: ViewUtil.cs プロジェクト: 15831944/WW
        public static Matrix4D GetBasicModelToViewportTransform(IViewDescription view)
        {
            Matrix4D matrix4D1 = view.IsTargetPaper ? Transformation4D.Translation(-view.ViewCenter.X, -view.ViewCenter.Y, 0.0) : Transformation4D.Translation(-view.ViewCenter.X, -view.ViewCenter.Y, -view.ViewDirection.GetLength()) * Transformation4D.RotateZ(view.ViewTwistAngle) * DxfUtil.GetToWCSTransform(view.ViewDirection).GetTranspose() * Transformation4D.Translation(-(Vector3D)view.ViewTarget);

            if ((view.ViewModeFlags & ViewportStatusFlags.PerspectiveMode) != ViewportStatusFlags.None)
            {
                double   num1      = 1.0 / System.Math.Tan(0.5 * (2.0 * System.Math.Atan(18.0 / view.FocalLength)));
                double   num2      = 0.5 * view.ViewWidth;
                Matrix4D matrix4D2 = new Matrix4D(num2, 0.0, 0.0, 0.0, 0.0, num2, 0.0, 0.0, 0.0, 0.0, -1.0, 0.0, 0.0, 0.0, -1.0, 0.0);
                matrix4D1 = Transformation4D.Scaling(num1, num1, 1.0) * matrix4D2 * matrix4D1;
            }
            return(matrix4D1);
        }
コード例 #7
0
ファイル: ViewUtil.cs プロジェクト: 15831944/WW
        public static Matrix4D GetTransform(
            IViewDescription view,
            Rectangle2D targetRectangle,
            bool invertY)
        {
            Matrix4D viewportTransform = ViewUtil.GetBasicModelToViewportTransform(view);
            double   num = System.Math.Min(targetRectangle.Width * view.ViewportWidth / view.ViewWidth, targetRectangle.Height * view.ViewportHeight / view.ViewHeight);
            double   x   = targetRectangle.Center.X + (view.ViewportCenter.X - 0.5) * targetRectangle.Width;
            double   y1  = targetRectangle.Center.Y;
            double   y2  = !invertY ? y1 + (view.ViewportCenter.Y - 0.5) * targetRectangle.Height : y1 - (view.ViewportCenter.Y - 0.5) * targetRectangle.Height;

            return(Transformation4D.Translation(x, y2, 0.0) * Transformation4D.Scaling(num, invertY ? -num : num, num) * viewportTransform);
        }
コード例 #8
0
        public static Matrix4D GetScaleAndTranslateTransform(
            Point2D fromP1,
            Point2D fromP2,
            Point2D toP1,
            Point2D toP2)
        {
            double  x         = (toP2.X - toP1.X) / (fromP2.X - fromP1.X);
            double  y         = (toP2.Y - toP1.Y) / (fromP2.Y - fromP1.Y);
            Point2D midPoint1 = Point2D.GetMidPoint(toP1, toP2);
            Point2D midPoint2 = Point2D.GetMidPoint(fromP1, fromP2);

            return(Transformation4D.Translation(midPoint1.X, midPoint1.Y, 0.0) * Transformation4D.Scaling(x, y, 1.0) * Transformation4D.Translation(-midPoint2.X, -midPoint2.Y, 0.0));
        }
コード例 #9
0
ファイル: DxfLayout.cs プロジェクト: 15831944/WW
        private DxfLayout.PlotInfo GetPlotInfo(
            bool invertY,
            DxfLayout.BasicLayoutRenderInfo layoutRenderInfo)
        {
            Size2D plotPaperSize = this.PlotPaperSize;

            if (plotPaperSize.X == 0.0 || plotPaperSize.Y == 0.0)
            {
                return((DxfLayout.PlotInfo)null);
            }
            double y = invertY ? this.UnprintableMarginBottom : plotPaperSize.Y - this.UnprintableMarginTop;

            WW.Math.Point3D toPoint1         = new WW.Math.Point3D(this.UnprintableMarginLeft, invertY ? plotPaperSize.Y - this.UnprintableMarginTop : this.UnprintableMarginBottom, 0.0);
            WW.Math.Point3D toPoint2         = new WW.Math.Point3D(plotPaperSize.X - this.UnprintableMarginRight, y, 0.0);
            WW.Math.Point3D toReferencePoint = new WW.Math.Point3D(0.5 * (toPoint1.X + toPoint2.X), 0.5 * (toPoint1.Y + toPoint2.Y), 0.0);
            Matrix4D        matrix4D1        = Matrix4D.Identity;

            switch (this.PlotRotation)
            {
            case PlotRotation.QuarterCounterClockwise:
                matrix4D1 = Transformation4D.RotateZ(System.Math.PI / 2.0);
                break;

            case PlotRotation.Half:
                matrix4D1 = Transformation4D.RotateZ(System.Math.PI);
                break;

            case PlotRotation.QuarterClockwise:
                matrix4D1 = Transformation4D.RotateZ(-1.0 * System.Math.PI / 2.0);
                break;
            }
            if (invertY)
            {
                matrix4D1 *= Transformation4D.Scaling(1.0, -1.0, 1.0);
            }
            WW.Math.Point3D point3D1           = new WW.Math.Point3D(layoutRenderInfo.LayoutViewport.Min, 0.0);
            WW.Math.Point3D point3D2           = new WW.Math.Point3D(layoutRenderInfo.LayoutViewport.Max, 0.0);
            WW.Math.Point3D fromReferencePoint = new WW.Math.Point3D(layoutRenderInfo.LayoutViewport.Center, 0.0);
            Matrix4D        matrix4D2          = Transformation4D.Translation((WW.Math.Vector3D)fromReferencePoint) * matrix4D1 * Transformation4D.Translation(-(WW.Math.Vector3D)fromReferencePoint);

            WW.Math.Point3D point3D3 = matrix4D2 * point3D1;
            point3D2 = matrix4D2 * point3D2;
            double   scaling;
            Matrix4D toPaperTransform = DxfUtil.GetScaleTransform(new WW.Math.Point3D(System.Math.Min(point3D3.X, point3D2.X), System.Math.Min(point3D3.Y, point3D2.Y), 0.0), new WW.Math.Point3D(System.Math.Max(point3D3.X, point3D2.X), System.Math.Max(point3D3.Y, point3D2.Y), 0.0), fromReferencePoint, toPoint1, toPoint2, toReferencePoint, out scaling) * matrix4D2;

            return(new DxfLayout.PlotInfo(this, plotPaperSize, new Rectangle2D(toPoint1.X, System.Math.Min(toPoint1.Y, toPoint2.Y), toPoint2.X, System.Math.Max(toPoint1.Y, toPoint2.Y)), toPaperTransform, scaling));
        }
コード例 #10
0
        public static Matrix4D GetScaleTransform(
            Point3D fromPoint1,
            Point3D fromPoint2,
            Point3D fromReferencePoint,
            Point3D toPoint1,
            Point3D toPoint2,
            Point3D toReferencePoint,
            out double scaling)
        {
            Vector3D vector3D1 = toPoint2 - toPoint1;
            Vector3D vector3D2 = fromPoint2 - fromPoint1;
            double   num1      = vector3D1.X / vector3D2.X;
            double   num2      = vector3D1.Y / vector3D2.Y;

            scaling = System.Math.Abs(num1) <= System.Math.Abs(num2) ? num1 : num2;
            scaling = System.Math.Abs(scaling);
            Matrix4D matrix4D = Transformation4D.Translation(0.0, 0.0, toPoint1.Z) * Transformation4D.Scaling(scaling * (double)System.Math.Sign(num1), scaling * (double)System.Math.Sign(num2), scaling) * Transformation4D.Translation(0.0, 0.0, -fromPoint1.Z);
            Point3D  point3D  = matrix4D.Transform(fromReferencePoint);

            return(Transformation4D.Translation(toReferencePoint - point3D) * matrix4D);
        }
コード例 #11
0
        /// <summary>
        /// Zoom in/out.
        /// </summary>
        private void Canvas_MouseWheel(object sender, MouseWheelEventArgs e)
        {
            int sign = Math.Sign(e.Delta);

            double newScaling = scaling;

            // wheel movement is forward
            if (sign > 0)
            {
                newScaling *= 1.1d;
            }
            // wheel movement is backward
            else if (sign < 0)
            {
                newScaling /= 1.1d;
            }
            System.Windows.Point p = e.GetPosition(dockPanel);

            // This is the post-zoom position.
            Point3D postZoomPosition =
                new Point3D(p.X / canvas.ActualWidth * 2d - 1d, -p.Y / canvas.ActualHeight * 2d + 1, 0d);

            // This is the pre-zoom position.
            Matrix4D zoomTranslation =
                Transformation4D.Translation((Vector3D)translation) *
                Transformation4D.Scaling(scaling);
            Point3D preZoomPosition = zoomTranslation.GetInverse().Transform(postZoomPosition);

            Matrix4D newZoomTranslation =
                Transformation4D.Translation((Vector3D)translation) *
                Transformation4D.Scaling(newScaling);
            Point3D uncorrectedPostZoomPosition = newZoomTranslation.Transform(preZoomPosition);

            translation += postZoomPosition - uncorrectedPostZoomPosition;
            scaling      = newScaling;

            UpdateRenderTransform();
        }
コード例 #12
0
 private Matrix4D method_25()
 {
     return(Transformation4D.Scaling(1.0 / this.size2D_0.X, 1.0 / this.size2D_0.Y, !this.bool_5 ? 1.0 : 1.0 / (this.double_2 - this.double_3)) * Transformation4D.Translation(this.size2D_0.X * 0.5, this.size2D_0.Y * 0.5, -this.double_3));
 }
コード例 #13
0
ファイル: Class666.cs プロジェクト: 15831944/WW
        internal static IList <Class908> smethod_6(
            DxfText text,
            Color color,
            short lineWeight,
            Matrix4D insertionTransformation,
            Bounds2D collectBounds,
            out Vector2D alignmentTranslation,
            out Vector2D alignmentScaling)
        {
            Class425 class425 = Class594.smethod_10(text.DisplayString, text.Height, text.ObliqueAngle, text.WidthFactor, text.Style, color);
            Vector2D zero     = Vector2D.Zero;

            class425.imethod_0(ref zero, text.Height, Enum24.flag_3);
            alignmentTranslation = Vector2D.Zero;
            Bounds2D bounds = class425.GetBounds(Enum24.flag_0, (Class985)null);

            if (zero != Vector2D.Zero)
            {
                bounds.Update(0.0, 0.0);
                bounds.Update(zero.X, zero.Y);
            }
            double x = 1.0;
            double y = 1.0;

            if (bounds.Initialized && text.AlignmentPoint2.HasValue)
            {
                if (text.VerticalAlignment != TextVerticalAlignment.Baseline)
                {
                    switch (text.VerticalAlignment)
                    {
                    case TextVerticalAlignment.Bottom:
                        alignmentTranslation.Y = class425.Blocks.Count > 0 ? class425.Blocks.First.Value.Settings.Font.Metrics.Descent : -bounds.Min.Y;
                        break;

                    case TextVerticalAlignment.Middle:
                        alignmentTranslation.Y = -0.5 * text.Height;
                        break;

                    case TextVerticalAlignment.Top:
                        alignmentTranslation.Y = -text.Height;
                        break;
                    }
                }
                switch (text.HorizontalAlignment)
                {
                case TextHorizontalAlignment.Left:
                    alignmentTranslation.X = -bounds.Corner1.X;
                    break;

                case TextHorizontalAlignment.Center:
                    alignmentTranslation.X = -bounds.Center.X;
                    break;

                case TextHorizontalAlignment.Right:
                    alignmentTranslation.X = -bounds.Corner2.X;
                    break;

                case TextHorizontalAlignment.Aligned:
                    x      = (text.AlignmentPoint2.Value - text.AlignmentPoint1).GetLength() / bounds.Delta.X;
                    y      = x;
                    bounds = new Bounds2D(new WW.Math.Point2D(bounds.Corner1.X, y * bounds.Corner1.Y), new WW.Math.Point2D(bounds.Corner1.X + x * bounds.Delta.X, y * bounds.Corner2.Y));
                    alignmentTranslation.X = -bounds.Corner2.X;
                    break;

                case TextHorizontalAlignment.Middle:
                    alignmentTranslation.Y = -bounds.Center.Y;
                    alignmentTranslation.X = -bounds.Center.X;
                    break;

                case TextHorizontalAlignment.Fit:
                    x      = (text.AlignmentPoint2.Value - text.AlignmentPoint1).GetLength() / bounds.Delta.X;
                    bounds = new Bounds2D(bounds.Corner1, new WW.Math.Point2D(bounds.Corner1.X + x * bounds.Delta.X, bounds.Corner2.Y));
                    alignmentTranslation.X = -bounds.Corner2.X;
                    break;
                }
            }
            IList <Class908> class908List = (IList <Class908>) new List <Class908>();

            class425.imethod_3((ICollection <Class908>)class908List, insertionTransformation * Transformation4D.Translation(alignmentTranslation.X, alignmentTranslation.Y, 0.0) * Transformation4D.Scaling(x, y, 1.0), lineWeight);
            if (collectBounds != null)
            {
                bounds.Move(alignmentTranslation.X, alignmentTranslation.Y);
                collectBounds.Update(bounds);
            }
            alignmentScaling = new Vector2D(x, y);
            return(class908List);
        }
コード例 #14
0
ファイル: DxfLayout.cs プロジェクト: 15831944/WW
            public BasicLayoutRenderInfo(IViewDescription viewDescription)
            {
                double val1 = viewDescription.ViewportWidth / viewDescription.ViewWidth;
                double val2 = viewDescription.ViewportHeight / viewDescription.ViewHeight;

                if (DxfUtil.IsSaneNotZero(val1) && DxfUtil.IsSaneNotZero(val2))
                {
                    this.ModelToLayoutScaling = System.Math.Min(val1, val2);
                    Vector2D        vector2D       = val1 > val2 ? new Vector2D(0.5 * val2 / val1 * viewDescription.ViewportWidth, 0.5 * viewDescription.ViewportHeight) : new Vector2D(0.5 * viewDescription.ViewportWidth, 0.5 * val1 / val2 * viewDescription.ViewportHeight);
                    WW.Math.Point2D viewportCenter = (WW.Math.Point2D)viewDescription.ViewportCenter;
                    this.LayoutViewport         = new Bounds2D(viewportCenter - vector2D, viewportCenter + vector2D);
                    this.ModelToLayoutTransform = Transformation4D.Translation((WW.Math.Vector3D)viewDescription.ViewportCenter) * Transformation4D.Scaling(this.ModelToLayoutScaling) * ViewUtil.GetBasicModelToViewportTransform(viewDescription) * Transformation4D.Translation(-(WW.Math.Vector3D)viewDescription.ViewportCenter);
                }
                else
                {
                    this.LayoutViewport         = new Bounds2D();
                    this.ModelToLayoutTransform = Matrix4D.Identity;
                    this.ModelToLayoutScaling   = 0.0;
                }
            }
コード例 #15
0
        public static Matrix4D Scaling(double s, Point3D origin)
        {
            Vector3D v = (Vector3D)origin;

            return(Transformation4D.Translation(v) * Transformation4D.Scaling(s) * Transformation4D.Translation(-v));
        }
コード例 #16
0
        public static Matrix4D Scaling(Vector3D v, Point3D origin)
        {
            Vector3D v1 = (Vector3D)origin;

            return(Transformation4D.Translation(v1) * Transformation4D.Scaling(v) * Transformation4D.Translation(-v1));
        }
コード例 #17
0
        internal static Matrix4D smethod_6(
            ILeader leader,
            IList <WW.Math.Point3D> vertices,
            Vector3D zaxis)
        {
            WW.Math.Point3D vertex1        = vertices[0];
            WW.Math.Point3D vertex2        = vertices[1];
            Matrix4D        toWcsTransform = DxfUtil.GetToWCSTransform(zaxis);
            Vector3D        v1             = new Vector3D(toWcsTransform.M00, toWcsTransform.M10, toWcsTransform.M20);
            Vector3D        v2             = new Vector3D(toWcsTransform.M01, toWcsTransform.M11, toWcsTransform.M21);
            Vector3D        u     = vertex1 - vertex2;
            double          angle = System.Math.Atan2(Vector3D.DotProduct(u, v2), Vector3D.DotProduct(u, v1));
            double          effectiveArrowSize = leader.GetEffectiveArrowSize();

            return(Transformation4D.Translation((Vector3D)vertex1) * toWcsTransform * Transformation4D.RotateZ(angle) * Transformation4D.Scaling(effectiveArrowSize, effectiveArrowSize, effectiveArrowSize));
        }
コード例 #18
0
ファイル: DxfLayout.cs プロジェクト: 15831944/WW
        public DxfLayout.PlotInfo GetPlotInfo(
            double paperWidth,
            double paperHeight,
            Rectangle2D printArea,
            bool autoRotate,
            bool invertY)
        {
            DxfLayout.BasicLayoutRenderInfo layoutRenderInfo = this.method_8();
            if (!layoutRenderInfo.LayoutViewport.Initialized)
            {
                return((DxfLayout.PlotInfo)null);
            }
            Bounds2D layoutViewport = layoutRenderInfo.LayoutViewport;
            Matrix4D matrix4D1      = Matrix4D.Identity;
            double   num1           = layoutViewport.Delta.X;
            double   num2           = layoutViewport.Delta.Y;

            if (autoRotate && (printArea.Width > printArea.Height && num1 < num2 || printArea.Width < printArea.Height && num1 > num2))
            {
                PlotRotation plotRotation1 = PlotRotation.None;
                PlotRotation plotRotation2;
                PlotRotation plotRotation3;
                switch (this.PlotRotation)
                {
                case PlotRotation.None:
                    plotRotation2 = PlotRotation.QuarterCounterClockwise;
                    plotRotation3 = PlotRotation.QuarterCounterClockwise;
                    goto label_10;

                case PlotRotation.QuarterCounterClockwise:
                    plotRotation2 = PlotRotation.QuarterClockwise;
                    plotRotation3 = PlotRotation.QuarterClockwise;
                    break;

                case PlotRotation.Half:
                    plotRotation2 = PlotRotation.QuarterClockwise;
                    plotRotation3 = PlotRotation.QuarterClockwise;
                    break;

                case PlotRotation.QuarterClockwise:
                    plotRotation2 = PlotRotation.QuarterCounterClockwise;
                    plotRotation3 = PlotRotation.QuarterCounterClockwise;
                    goto label_10;

                default:
                    switch (plotRotation1)
                    {
                    case PlotRotation.QuarterCounterClockwise:
                        goto label_10;

                    case PlotRotation.QuarterClockwise:
                        break;

                    default:
                        goto label_11;
                    }
                }
                matrix4D1 = Transformation4D.RotateZ(invertY ? System.Math.PI / 2.0 : -1.0 * System.Math.PI / 2.0);
                goto label_11;
label_10:
                matrix4D1 = Transformation4D.RotateZ(invertY ? -1.0 * System.Math.PI / 2.0 : System.Math.PI / 2.0);
label_11:
                num1 = layoutViewport.Delta.Y;
                num2 = layoutViewport.Delta.X;
            }
            double s = System.Math.Min(printArea.Width / num1, printArea.Height / num2);

            if (!DxfUtil.IsSaneNotZero(s))
            {
                return((DxfLayout.PlotInfo)null);
            }
            Matrix4D matrix4D2 = Transformation4D.Translation(printArea.Center.X, printArea.Center.Y, 0.0) * Transformation4D.Scaling(s) * matrix4D1 * Transformation4D.Translation(-layoutViewport.Center.X, -layoutViewport.Center.Y, 0.0);

            WW.Math.Point3D point3D1 = matrix4D2.Transform(new WW.Math.Point3D(layoutViewport.Corner1, 0.0));
            WW.Math.Point3D point3D2 = matrix4D2.Transform(new WW.Math.Point3D(layoutViewport.Corner2, 0.0));
            return(new DxfLayout.PlotInfo(this, new Size2D(paperWidth, paperHeight), new Rectangle2D(System.Math.Min(point3D1.X, point3D2.X), System.Math.Min(point3D1.Y, point3D2.Y), System.Math.Max(point3D1.X, point3D2.X), System.Math.Max(point3D1.Y, point3D2.Y)), matrix4D2 * layoutRenderInfo.ModelToLayoutTransform, s * layoutRenderInfo.ModelToLayoutScaling));
        }
コード例 #19
0
        public void Draw(Class385 context)
        {
            Font     systemFont = this.class908_0.Font.SystemFont;
            Graphics graphics   = context.Graphics;
            Matrix4D transform1 = context.Transform;

            if (systemFont != null)
            {
                double      fontHeight = this.class908_0.Font.Metrics.FontHeight;
                ns4.Class26 metrics    = (ns4.Class26) this.class908_0.Font.Metrics;
                double      num        = metrics.CanonicalScaling * fontHeight;
                Matrix4D    matrix4D   = transform1 * this.class908_0.Transformation * Transformation4D.Scaling(num, -num, num);
                Matrix      transform2 = graphics.Transform;
                using (Matrix matrix = new Matrix((float)matrix4D.M00, (float)matrix4D.M10, (float)matrix4D.M01, (float)matrix4D.M11, (float)matrix4D.M03, (float)matrix4D.M13))
                {
                    graphics.Transform         = matrix;
                    context.solidBrush_0.Color = this.color_0;
                    graphics.DrawString(this.class908_0.Text.Text, systemFont, (Brush)context.solidBrush_0, metrics.BaseLineOffset.X, metrics.BaseLineOffset.Y, StringFormat.GenericTypographic);
                }
                graphics.Transform = transform2;
                if (this.class908_0.Linings.Length <= 0)
                {
                    return;
                }
                context.pen_0.Color = this.color_0;
                context.method_3(this.short_0);
                this.class908_0.method_1((IPathDrawer) new Class1036.Class1037(graphics, context.pen_0), transform1, 0.0);
            }
            else
            {
                context.pen_0.Color = this.color_0;
                context.method_3(this.short_0);
                IPathDrawer drawer = (IPathDrawer) new Class1036.Class1037(graphics, context.pen_0);
                this.class908_0.method_0(drawer, transform1, 0.0);
                if (this.class908_0.Linings.Length <= 0)
                {
                    return;
                }
                this.class908_0.method_1(drawer, transform1, 0.0);
            }
        }