コード例 #1
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));
        }
コード例 #2
0
        public Matrix4D GetTransform(Size2D targetSize)
        {
            Matrix4D toWcsTransform = DxfUtil.GetToWCSTransform(this.vector3D_0);

            toWcsTransform.Transpose();
            Matrix4D matrix4D = Transformation4D.RotateZ(this.double_6) * toWcsTransform;

            return(Transformation4D.Translation(this.point2D_2.X, this.point2D_2.Y, 0.0) * (!this.PerspectiveMode ? Matrix4D.Identity : 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_2, 0.0, 0.0, -1.0 / this.double_2, 0.0) * Transformation4D.Translation(0.0, 0.0, -Class484.smethod_0(new Size2D(targetSize.X * this.double_1, targetSize.Y), this.double_2, this.double_0))) * matrix4D * Transformation4D.Translation(-this.point3D_0.X, -this.point3D_0.Y, -this.point3D_0.Z));
        }
コード例 #3
0
ファイル: DxfView.cs プロジェクト: 15831944/WW
        public Matrix4D GetTransform()
        {
            Matrix4D toWcsTransform = DxfUtil.GetToWCSTransform(this.vector3D_0);

            toWcsTransform.Transpose();
            Matrix4D matrix4D = Transformation4D.RotateZ(this.double_3) * toWcsTransform;

            return((!this.PerspectiveMode ? Matrix4D.Identity : 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_0, 0.0, 0.0, -1.0 / this.double_0, 0.0) * Transformation4D.Translation(0.0, 0.0, -this.vector3D_0.GetLength())) * Transformation4D.Translation(-this.point2D_0.X, -this.point2D_0.Y, 0.0) * matrix4D * Transformation4D.Translation(-(Vector3D)this.point3D_0));
        }
コード例 #4
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);
                        }
                    }
                }
            }
        }
コード例 #5
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));
        }
コード例 #6
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));
        }
コード例 #7
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);
        }
コード例 #8
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));
        }
コード例 #9
0
        public override void TransformMe(
            TransformConfig config,
            Matrix4D matrix,
            CommandGroup undoGroup)
        {
            // ISSUE: object of a compiler-generated type is created
            // ISSUE: variable of a compiler-generated type
            DxfInsertBase.Class476 class476 = new DxfInsertBase.Class476();
            // ISSUE: reference to a compiler-generated field
            class476.dxfInsertBase_0 = this;
            // ISSUE: reference to a compiler-generated field
            class476.vector3D_0 = this.vector3D_0;
            // ISSUE: reference to a compiler-generated field
            class476.point3D_0 = this.insertionPoint;
            // ISSUE: reference to a compiler-generated field
            class476.double_0 = this.rotation;
            // ISSUE: reference to a compiler-generated field
            class476.vector3D_1 = this.scaleFactor;
            this.vector3D_0     = matrix.Transform(this.ZAxis).GetUnit();
            Matrix4D inverse = DxfUtil.GetToWCSTransform(this.ZAxis).GetInverse();
            // ISSUE: reference to a compiler-generated field
            Matrix4D toWcsTransform = DxfUtil.GetToWCSTransform(class476.vector3D_0);

            // ISSUE: reference to a compiler-generated field
            this.insertionPoint = inverse.Transform(matrix.Transform(toWcsTransform.Transform(class476.point3D_0)));
            // ISSUE: reference to a compiler-generated field
            Vector3D vector3D = inverse.Transform(matrix.Transform(toWcsTransform.Transform(Transformation4D.RotateZ(class476.double_0).Transform(Vector3D.XAxis))));

            this.rotation = System.Math.Atan2(vector3D.Y, vector3D.X);
            if (this.Rotation < 0.0)
            {
                this.Rotation += 2.0 * System.Math.PI;
            }
            // ISSUE: reference to a compiler-generated field
            // ISSUE: reference to a compiler-generated field
            this.scaleFactor = Transformation4D.RotateZ(-this.Rotation).Transform(inverse.Transform(matrix.Transform(toWcsTransform.Transform(Transformation4D.RotateZ(class476.double_0).Transform(class476.vector3D_1)))));
            CommandGroup undoGroup1 = (CommandGroup)null;

            if (undoGroup != null)
            {
                // ISSUE: object of a compiler-generated type is created
                // ISSUE: variable of a compiler-generated type
                DxfInsertBase.Class477 class477 = new DxfInsertBase.Class477();
                // ISSUE: reference to a compiler-generated field
                class477.class476_0 = class476;
                undoGroup1          = new CommandGroup((object)this);
                undoGroup.UndoStack.Push((ICommand)undoGroup1);
                // ISSUE: reference to a compiler-generated field
                class477.vector3D_0 = this.vector3D_0;
                // ISSUE: reference to a compiler-generated field
                class477.point3D_0 = this.insertionPoint;
                // ISSUE: reference to a compiler-generated field
                class477.double_0 = this.rotation;
                // ISSUE: reference to a compiler-generated field
                class477.vector3D_1 = this.scaleFactor;
                // ISSUE: reference to a compiler-generated method
                // ISSUE: reference to a compiler-generated method
                undoGroup1.UndoStack.Push((ICommand) new Command((object)this, new System.Action(class477.method_0), new System.Action(class476.method_0)));
            }
            foreach (DxfEntity dxfEntity in (DxfHandledObjectCollection <DxfAttribute>) this.activeDxfHandledObjectCollection_0)
            {
                dxfEntity.TransformMe(config, matrix, undoGroup1);
            }
        }
コード例 #10
0
        internal Bounds3D method_1(DxfTable table)
        {
            DxfBlock valueObject = this.ValueObject as DxfBlock;

            if (valueObject == null)
            {
                return((Bounds3D)null);
            }
            DxfInsert dxfInsert = new DxfInsert(valueObject);

            foreach (DxfTableAttribute dxfTableAttribute in (List <DxfTableAttribute>) this.dxfTableAttributeCollection_0)
            {
                if (dxfTableAttribute.AttributeDefinition != null)
                {
                    DxfAttribute dxfAttribute1 = new DxfAttribute(dxfTableAttribute.AttributeDefinition);
                    dxfAttribute1.Text = dxfTableAttribute.Value;
                    DxfAttribute dxfAttribute2 = dxfAttribute1;
                    dxfAttribute2.AlignmentPoint1 = dxfAttribute2.AlignmentPoint1 - valueObject.BasePoint;
                    if (dxfAttribute1.AlignmentPoint2.HasValue)
                    {
                        DxfAttribute     dxfAttribute3   = dxfAttribute1;
                        WW.Math.Point3D? alignmentPoint2 = dxfAttribute3.AlignmentPoint2;
                        WW.Math.Vector3D basePoint       = valueObject.BasePoint;
                        dxfAttribute3.AlignmentPoint2 = alignmentPoint2.HasValue ? new WW.Math.Point3D?(alignmentPoint2.GetValueOrDefault() - basePoint) : new WW.Math.Point3D?();
                    }
                }
            }
            BoundsCalculator boundsCalculator = new BoundsCalculator();

            boundsCalculator.GetBounds(table.Content.Model, (DxfEntity)dxfInsert);
            Bounds3D bounds    = boundsCalculator.Bounds;
            Matrix4D transform = Transformation4D.Translation(valueObject.BasePoint) * Transformation4D.RotateZ(this.dxfContentFormat_0.Rotation) * Transformation4D.Translation(-valueObject.BasePoint);

            bounds.Transform(transform);
            return(bounds);
        }
コード例 #11
0
        internal void method_0(
            DxfTableContent tableContent,
            double width,
            double height,
            double rotation,
            double horizontalMargin,
            double verticalMargin)
        {
            DxfBlock valueObject = this.ValueObject as DxfBlock;

            if (valueObject == null)
            {
                this.dxfContentFormat_0.method_6(1.0);
            }
            else
            {
                DxfInsert dxfInsert = new DxfInsert(valueObject);
                foreach (DxfTableAttribute dxfTableAttribute in (List <DxfTableAttribute>) this.dxfTableAttributeCollection_0)
                {
                    if (dxfTableAttribute.AttributeDefinition != null)
                    {
                        DxfAttribute dxfAttribute1 = new DxfAttribute(dxfTableAttribute.AttributeDefinition);
                        dxfAttribute1.Text = dxfTableAttribute.Value;
                        DxfAttribute dxfAttribute2 = dxfAttribute1;
                        dxfAttribute2.AlignmentPoint1 = dxfAttribute2.AlignmentPoint1 - valueObject.BasePoint;
                        if (dxfAttribute1.AlignmentPoint2.HasValue)
                        {
                            DxfAttribute     dxfAttribute3   = dxfAttribute1;
                            WW.Math.Point3D? alignmentPoint2 = dxfAttribute3.AlignmentPoint2;
                            WW.Math.Vector3D basePoint       = valueObject.BasePoint;
                            dxfAttribute3.AlignmentPoint2 = alignmentPoint2.HasValue ? new WW.Math.Point3D?(alignmentPoint2.GetValueOrDefault() - basePoint) : new WW.Math.Point3D?();
                        }
                    }
                }
                BoundsCalculator boundsCalculator = new BoundsCalculator();
                boundsCalculator.GetBounds(tableContent.Model, (DxfEntity)dxfInsert);
                Bounds3D bounds    = boundsCalculator.Bounds;
                Matrix4D transform = Transformation4D.Translation(valueObject.BasePoint) * Transformation4D.RotateZ(rotation) * Transformation4D.Translation(-valueObject.BasePoint);
                bounds.Transform(transform);
                Vector2D vector2D = new Vector2D((width - 2.0 * horizontalMargin) / bounds.Delta.X, (height - 2.0 * verticalMargin) / bounds.Delta.Y);
                this.dxfContentFormat_0.BlockScale = System.Math.Min(vector2D.X, vector2D.Y);
            }
        }