コード例 #1
0
ファイル: ShxShape.cs プロジェクト: 15831944/WW
            internal void method_8(double radius, double startAngle, double sweepAngle)
            {
                radius *= this.double_0;
                Vector2D vector2D1 = -radius * new Vector2D(System.Math.Cos(startAngle), System.Math.Sin(startAngle));

                WW.Math.Point2D point2D1  = this.point2D_0 + vector2D1;
                double          num1      = startAngle + sweepAngle;
                Vector2D        vector2D2 = vector2D1 + radius * new Vector2D(System.Math.Cos(num1), System.Math.Sin(num1));

                if (this.bool_1)
                {
                    this.method_11();
                    int num2 = (int)System.Math.Ceiling(2.0 * System.Math.Abs(sweepAngle) / System.Math.PI);
                    if (num2 >= 5)
                    {
                        num2       = 4;
                        sweepAngle = sweepAngle < 0.0 ? -2.0 * System.Math.PI : 2.0 * System.Math.PI;
                    }
                    sweepAngle /= (double)num2;
                    double          num3      = startAngle;
                    Vector2D        vector2D3 = radius * new Vector2D(System.Math.Cos(num3), System.Math.Sin(num3));
                    WW.Math.Point2D p         = point2D1 + vector2D3;
                    if (this.generalShape2D_0.CurrentPoint != p)
                    {
                        this.generalShape2D_0.LineTo(p);
                    }
                    double num4 = 1.0 + System.Math.Cos(sweepAngle);
                    double num5 = System.Math.Sin(sweepAngle);
                    double num6 = 4.0 / 3.0 * (System.Math.Sqrt(2.0 * num4) - num4) / num5;
                    for (int index = 0; index < num2; ++index)
                    {
                        num3 += sweepAngle;
                        Vector2D        vector2D4 = radius * new Vector2D(System.Math.Cos(num3), System.Math.Sin(num3));
                        WW.Math.Point2D point2D2  = point2D1 + vector2D4;
                        WW.Math.Point2D point2D3  = new WW.Math.Point2D(point2D1.X + vector2D3.X - num6 * vector2D3.Y, point2D1.Y + vector2D3.Y + num6 * vector2D3.X);
                        WW.Math.Point2D point2D4  = new WW.Math.Point2D(point2D1.X + vector2D4.X + num6 * vector2D4.Y, point2D1.Y + vector2D4.Y - num6 * vector2D4.X);
                        this.generalShape2D_0.CubicTo(point2D3.X, point2D3.Y, point2D4.X, point2D4.Y, point2D2.X, point2D2.Y);
                        vector2D3 = vector2D4;
                    }
                }
                this.point2D_0 += vector2D2;
            }
コード例 #2
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;
                }
            }
コード例 #3
0
            internal List <Polyline2D> method_0(
                Polyline2D[] boundaries,
                WW.Math.Point2D seed,
                bool fillInterior)
            {
                if (this.list_0 == null)
                {
                    Vector2D vector2D = new Vector2D(System.Math.Cos(this.double_0), System.Math.Sin(this.double_0));
                    double   distance = System.Math.Abs(this.vector2D_0.X * vector2D.Y - this.vector2D_0.Y * vector2D.X);
                    return(Class811.smethod_0(boundaries, seed + (Vector2D)this.point2D_0, this.double_0, distance, fillInterior));
                }
                double[] dashPattern = new double[this.list_0.Count];
                int      num1        = 0;

                foreach (double num2 in this.list_0)
                {
                    dashPattern[num1++] = num2;
                }
                return(Class811.smethod_3(boundaries, seed + (Vector2D)this.point2D_0, this.vector2D_0, new Vector2D(System.Math.Cos(this.double_0), System.Math.Sin(this.double_0)), dashPattern, fillInterior));
            }
コード例 #4
0
ファイル: DxfView.cs プロジェクト: 15831944/WW
        public override void CopyFrom(DxfHandledObject from, CloneContext cloneContext)
        {
            base.CopyFrom(from, cloneContext);
            DxfView dxfView = (DxfView)from;

            this.string_0           = dxfView.string_0;
            this.viewFlags_0        = dxfView.viewFlags_0;
            this.point2D_0          = dxfView.point2D_0;
            this.size2D_0           = dxfView.size2D_0;
            this.vector3D_0         = dxfView.vector3D_0;
            this.point3D_0          = dxfView.point3D_0;
            this.double_0           = dxfView.double_0;
            this.double_1           = dxfView.double_1;
            this.double_2           = dxfView.double_2;
            this.double_3           = dxfView.double_3;
            this.ViewMode           = dxfView.viewMode_0;
            this.renderMode_0       = dxfView.renderMode_0;
            this.bool_0             = dxfView.bool_0;
            this.Ucs                = Class906.smethod_2(cloneContext, dxfView.Ucs);
            this.orthographicType_0 = dxfView.orthographicType_0;
        }
コード例 #5
0
ファイル: DxfLineCreator.cs プロジェクト: 15831944/WW
        public override bool ProcessMouseButtonUp(CanonicalMouseEventArgs e, InteractionContext context)
        {
            bool isActive = this.IsActive;

            if (this.IsActive)
            {
                WW.Math.Point2D position1 = e.Position;
                WW.Math.Point3D position2 = context.InverseProjectionTransform.TransformTo3D(position1);
                if (this.node_0 == null)
                {
                    this.dxfLine_0.Start = position2;
                    this.node_0          = new WW.Cad.Drawing.Node(position2);
                    this.OnChanged((EventArgs)null);
                }
                else
                {
                    this.dxfLine_0.End = position2;
                    this.Deactivate();
                }
            }
            return(isActive);
        }
コード例 #6
0
ファイル: DxfPolyline2DSpline.cs プロジェクト: 15831944/WW
        private WW.Cad.Drawing.Polyline2DE method_28(int power, int noOfSplineLineParts)
        {
            WW.Cad.Drawing.Polyline2DE polyline2De = new WW.Cad.Drawing.Polyline2DE();
            int count = this.dxfVertex2DCollection_0.Count;

            if (count <= power)
            {
                return(this.method_19());
            }
            BSplineD bsplineD = new BSplineD(power, count, this.Closed);

            double[] result = new double[power + 1];
            double   maxU   = bsplineD.MaxU;
            int      num1   = noOfSplineLineParts + 1;
            double   num2   = maxU / (double)(num1 - 1);
            int      num3   = 0;
            double   u      = 0.0;

            while (num3 < num1)
            {
                int knotSpanIndex = bsplineD.GetKnotSpanIndex(u);
                bsplineD.EvaluateBasisFunctions(knotSpanIndex, u, result);
                WW.Math.Point2D zero = WW.Math.Point2D.Zero;
                for (int index = 0; index <= power; ++index)
                {
                    DxfVertex2D dxfVertex2D = this.dxfVertex2DCollection_0[(knotSpanIndex - power + index) % count];
                    zero += result[index] * new Vector2D(dxfVertex2D.Position);
                }
                Point2DE point2De = new Point2DE(zero)
                {
                    IsInterpolatedPoint = true
                };
                polyline2De.Add(point2De);
                ++num3;
                u += num2;
            }
            return(polyline2De);
        }
コード例 #7
0
        public static Bitmap CreatePlotLayoutBitmap(
            Size maxSize,
            DxfModel model,
            DxfLayout layout,
            DxfViewportCollection viewports,
            GraphicsConfig config,
            SmoothingMode smoothingMode)
        {
            DxfLayout.PlotInfo plotInfo = layout.GetPlotInfo((double)maxSize.Width, (double)maxSize.Height, new Rectangle2D(0.0, 0.0, (double)(maxSize.Width - 1), (double)(maxSize.Height - 1)), false, true);
            Size     size;
            Matrix4D to2DTransform;

            if (plotInfo != null)
            {
                Rectangle2D printableArea = plotInfo.PrintableArea;
                size = new Size((int)System.Math.Ceiling(printableArea.Width), (int)System.Math.Ceiling(printableArea.Height));
                WW.Math.Point2D center = printableArea.Center;
                to2DTransform = Transformation4D.Translation((WW.Math.Vector3D)(new WW.Math.Point2D(0.5 * (double)(size.Width - 1), 0.5 * (double)(size.Height - 1)) - center)) * plotInfo.ToPaperTransform;
            }
            else
            {
                BoundsCalculator boundsCalculator = new BoundsCalculator();
                boundsCalculator.GetBounds(model, layout);
                Bounds3D bounds = boundsCalculator.Bounds;
                if (!bounds.Initialized)
                {
                    return((Bitmap)null);
                }
                WW.Math.Point3D  min      = bounds.Min;
                WW.Math.Point3D  max      = bounds.Max;
                WW.Math.Vector3D vector3D = max - min;
                WW.Math.Point3D  point3D  = new WW.Math.Point3D(min.X, min.Y, 0.0);
                double           scaling;
                to2DTransform = DxfUtil.GetScaleTransform(point3D, new WW.Math.Point3D(max.X, min.Y, 0.0), point3D, WW.Math.Point3D.Zero, new WW.Math.Point3D((double)(maxSize.Width - 1), (double)(maxSize.Height - 1), 0.0), WW.Math.Point3D.Zero, out scaling);
                size          = new Size((int)System.Math.Ceiling(vector3D.X * scaling), (int)System.Math.Ceiling(vector3D.Y * scaling));
            }
            return(ImageExporter.CreateBitmap(model, layout, (ICollection <DxfViewport>)viewports, config, smoothingMode, (System.Drawing.Color)config.BackColor, to2DTransform, size.Width, size.Height));
        }
コード例 #8
0
                public override void Draw(
                    PaintEventArgs e,
                    GraphicsHelper graphicsHelper,
                    InteractionContext context)
                {
                    base.Draw(e, graphicsHelper, context);
                    IControlPointCollection controlPoints = this.Interactor.ControlPoints;
                    Matrix4D matrix4D = context.ProjectionTransform * this.Interactor.Entity.Transform;

                    for (int index = 0; index < controlPoints.Count; ++index)
                    {
                        WW.Math.Point2D position = matrix4D.TransformTo2D(controlPoints.Get(index));
                        switch (controlPoints.GetDisplayType(index))
                        {
                        case PointDisplayType.Default:
                            int x = (int)System.Math.Round(position.X);
                            int y = (int)System.Math.Round(position.Y);
                            Class735.smethod_3(e.Graphics, graphicsHelper.DefaultPen.Color, x, y);
                            break;

                        case PointDisplayType.EditHandle:
                            GdiDrawUtil.DrawEditHandle(e.Graphics, graphicsHelper.DefaultPen, position, context.EditHandleSize);
                            break;

                        case PointDisplayType.CrossHair:
                            int num1 = (int)System.Math.Round(position.X);
                            int num2 = (int)System.Math.Round(position.Y);
                            int x1   = (int)System.Math.Round((double)num1 - 0.5 * context.CrossHairSize);
                            int y1   = (int)System.Math.Round((double)num2 - 0.5 * context.CrossHairSize);
                            int x2   = (int)System.Math.Round((double)num1 + 0.5 * context.CrossHairSize);
                            int y2   = (int)System.Math.Round((double)num2 + 0.5 * context.CrossHairSize);
                            e.Graphics.DrawLine(graphicsHelper.DefaultPen, x1, num2, x2, num2);
                            e.Graphics.DrawLine(graphicsHelper.DefaultPen, num1, y1, num1, y2);
                            break;
                        }
                    }
                }
コード例 #9
0
ファイル: GDIGraphics3D.cs プロジェクト: 15831944/WW
        internal void Draw(
            Graphics graphics,
            Rasterizer2D fastRasterizer,
            Rectangle drawingBounds,
            System.Drawing.Color backColor)
        {
            GDIGraphics3D.smethod_0();
            GraphicsConfig config = (GraphicsConfig)this.graphicsConfig_0.Clone();

            config.BackColor = (ArgbColor)backColor;
            BlinnClipper4D drawingBoundsClipper = new BlinnClipper4D((double)drawingBounds.Left, (double)drawingBounds.Right, (double)drawingBounds.Top, (double)drawingBounds.Bottom, 0.0, 0.0, false, true);

            using (Class386 context = new Class386(this.graphicsConfig_0, graphics, fastRasterizer, this.nullable_0, drawingBoundsClipper, this.matrix4D_0, this.method_5(), this.method_6(), this.float_0, this.float_1, Class1002.Create(config, this.float_1), Class1002.Create(config, this.float_0)))
            {
                foreach (Interface12 nterface12 in this.linkedList_0)
                {
                    nterface12.Draw(context);
                }
                foreach (Interface12 nterface12 in this.linkedList_1)
                {
                    nterface12.Draw(context);
                }
            }
            if (this.nodeCollection_0 == null || this.nodeCollection_0.Count <= 0)
            {
                return;
            }
            foreach (WW.Cad.Drawing.Node node in (List <WW.Cad.Drawing.Node>) this.nodeCollection_0)
            {
                using (Pen pen = new Pen((System.Drawing.Color) this.graphicsConfig_0.NodeColor, node.HighLighted ? 2f : 1f))
                {
                    WW.Math.Point2D position = this.matrix4D_0.TransformTo2D(node.Position);
                    GdiDrawUtil.DrawEditHandle(graphics, pen, position, this.graphicsConfig_0.NodeSize);
                }
            }
        }
コード例 #10
0
            public static WW.Math.Point3D SnapHorizontalOrVertical(
                DxfEntity.Interactor interactor,
                WW.Math.Point3D p,
                InteractionContext context,
                int controlPointIndex)
            {
                bool flag = InputUtil.IsShiftPressed();
                CadInteractionContext interactionContext = context as CadInteractionContext;

                if (interactionContext != null)
                {
                    flag ^= interactionContext.DefaultNonDiagonalLines;
                }
                if (interactor.IsActive && flag)
                {
                    DxfLine         entity   = (DxfLine)interactor.Entity;
                    WW.Math.Point2D point2D1 = context.ProjectionTransform.TransformTo2D(controlPointIndex == 0 ? entity.point3D_1 : entity.point3D_0);
                    WW.Math.Point3D point3D  = p;
                    WW.Math.Point2D point2D2 = context.ProjectionTransform.TransformTo2D((WW.Math.Point2D)point3D);
                    Vector2D        vector2D = point2D2 - point2D1;
                    p = System.Math.Abs(vector2D.X) >= System.Math.Abs(vector2D.Y) ? context.InverseProjectionTransform.TransformTo3D(new WW.Math.Point2D(point2D2.X, point2D1.Y)) : context.InverseProjectionTransform.TransformTo3D(new WW.Math.Point2D(point2D1.X, point2D2.Y));
                }
                return(p);
            }
コード例 #11
0
ファイル: DxfPolyline2DSpline.cs プロジェクト: 15831944/WW
        private WW.Cad.Drawing.Polyline2D2WN method_31(int power, int noOfSplineLineParts)
        {
            WW.Cad.Drawing.Polyline2D2WN polyline2D2Wn = new WW.Cad.Drawing.Polyline2D2WN();
            int count = this.dxfVertex2DCollection_0.Count;

            if (count <= power)
            {
                return(this.method_23());
            }
            BSplineD bsplineD = new BSplineD(power, count, this.Closed);

            double[] result = new double[power + 1];
            double   maxU   = bsplineD.MaxU;
            int      num1   = noOfSplineLineParts + 1;
            double   num2   = maxU / (double)(num1 - 1);
            double   num3   = 0.0;
            double   num4   = 0.0;
            int      num5   = -1;

            double[,] derivatives = new double[2, power + 1];
            Point2D2WN point2D2Wn1 = (Point2D2WN)null;
            int        num6        = 0;
            double     u           = 0.0;

            while (num6 < num1)
            {
                double d    = (double)(count - 1) * u / maxU;
                int    num7 = (int)System.Math.Floor(d);
                if (num5 != num7)
                {
                    DxfVertex2D dxfVertex2D = this.dxfVertex2DCollection_0[num7 % count];
                    num3 = dxfVertex2D.StartWidth == 0.0 ? this.DefaultStartWidth : dxfVertex2D.StartWidth;
                    num4 = (dxfVertex2D.EndWidth == 0.0 ? this.DefaultEndWidth : dxfVertex2D.EndWidth) - num3;
                }
                double num8 = d - (double)num7;
                num5 = num7;
                int knotSpanIndex = bsplineD.GetKnotSpanIndex(u);
                bsplineD.EvaluateBasisFunctions(knotSpanIndex, u, result);
                WW.Math.Point2D zero1 = WW.Math.Point2D.Zero;
                for (int index = 0; index <= power; ++index)
                {
                    DxfVertex2D dxfVertex2D = this.dxfVertex2DCollection_0[(knotSpanIndex - power + index) % count];
                    zero1 += result[index] * new Vector2D(dxfVertex2D.Position);
                }
                bsplineD.GetDerivativesBasisFunctions(knotSpanIndex, u, 1, derivatives);
                Vector2D zero2 = Vector2D.Zero;
                for (int index = 0; index <= power; ++index)
                {
                    zero2 += (Vector2D)this.dxfVertex2DCollection_0[(knotSpanIndex - power + index) % count].Position * derivatives[1, index];
                }
                Vector2D   unit        = new Vector2D(-zero2.Y, zero2.X).GetUnit();
                Point2D2WN point2D2Wn2 = new Point2D2WN(zero1, num3 + num8 * num4, num3 + (num8 + num2) * num4)
                {
                    IsInterpolatedPoint = true
                };
                point2D2Wn2.StartNormal = unit;
                if (point2D2Wn1 != null)
                {
                    point2D2Wn1.EndNormal = unit;
                }
                polyline2D2Wn.Add(point2D2Wn2);
                point2D2Wn1 = point2D2Wn2;
                ++num6;
                u += num2;
            }
            if (this.Closed)
            {
                polyline2D2Wn[num1 - 1].EndNormal = polyline2D2Wn[0].StartNormal;
            }
            return(polyline2D2Wn);
        }
コード例 #12
0
ファイル: DxfInsert.cs プロジェクト: 15831944/WW
        private DxfInsert.Enum44 method_16(
            Matrix4D insertionTransform,
            DxfInsert.Interface46 drawHandler)
        {
            if (drawHandler.InsertCellDrawContext.Config.UseSpatialFilters)
            {
                DxfSpatialFilter spatialFilter = this.SpatialFilter;
                if (spatialFilter != null && spatialFilter.ClipBoundaryDisplayEnabled)
                {
                    Polygon2D clipPolygon = spatialFilter.GetClipBoundaryPolygon();
                    if (clipPolygon.Count < 3)
                    {
                        return(DxfInsert.Enum44.const_1);
                    }
                    if (clipPolygon.GetArea() < 0.0)
                    {
                        clipPolygon = clipPolygon.GetReverse();
                    }
                    Matrix4D         boundaryTransform     = spatialFilter.ClipBoundaryTransform;
                    Matrix4D         transform             = insertionTransform * this.Block.BaseTransformation * spatialFilter.InverseInsertionTransform;
                    Matrix4D         inverse1              = boundaryTransform.GetInverse();
                    Matrix4D         clipBoundaryTransform = transform * inverse1;
                    DxfInsert.Enum44 enum44;
                    if (clipPolygon.IsConvex())
                    {
                        List <BlinnClipper4D.ClipPlane> clipPlaneList = new List <BlinnClipper4D.ClipPlane>();
                        WW.Math.Point2D  point2D             = clipPolygon[clipPolygon.Count - 1];
                        WW.Math.Vector3D boundaryPlaneNormal = spatialFilter.ClipBoundaryPlaneNormal;
                        Matrix4D         inverse2            = transform.GetInverse();
                        inverse2.Transpose();
                        foreach (WW.Math.Point2D point in (List <WW.Math.Point2D>)clipPolygon)
                        {
                            Vector2D v = point - point2D;
                            BlinnClipper4D.ClipPlane clipPlane = new BlinnClipper4D.ClipPlane(WW.Math.Vector3D.CrossProduct(inverse1.TransformTo3D(v), boundaryPlaneNormal), inverse1.TransformTo3D(point));
                            clipPlane.TransformBy(transform, inverse2);
                            clipPlaneList.Add(clipPlane);
                            point2D = point;
                        }
                        BoundsCalculator boundsCalculator = new BoundsCalculator();
                        boundsCalculator.GetBounds(drawHandler.InsertCellDrawContext.Model, (IEnumerable <DxfEntity>) this.Block.Entities, insertionTransform * this.Block.BaseTransformation);
                        switch (new BlinnClipper4D((ICollection <BlinnClipper4D.ClipPlane>)clipPlaneList).TryIsInside(boundsCalculator.Bounds))
                        {
                        case InsideTestResult.Inside:
                            enum44 = DxfInsert.Enum44.const_2;
                            break;

                        case InsideTestResult.Outside:
                            enum44 = DxfInsert.Enum44.const_0;
                            break;

                        default:
                            enum44 = DxfInsert.Enum44.const_3;
                            break;
                        }
                        if (enum44 == DxfInsert.Enum44.const_3)
                        {
                            Class808 class808 = new Class808((ICollection <BlinnClipper4D.ClipPlane>)clipPlaneList);
                            class808.imethod_0(insertionTransform.GetInverse());
                            GraphicsConfig config = drawHandler.InsertCellDrawContext.Config;
                            ModelSpaceClippingTransformer clippingTransformer = new ModelSpaceClippingTransformer(Matrix4D.Identity, (Interface32)class808, config.ShapeFlattenEpsilon, config.ShapeFlattenEpsilonForBoundsCalculation);
                            drawHandler.InsertCellDrawContext.vmethod_0((IClippingTransformer)clippingTransformer);
                        }
                    }
                    else
                    {
                        Class455         class455         = new Class455(clipBoundaryTransform, clipPolygon, false);
                        BoundsCalculator boundsCalculator = new BoundsCalculator();
                        boundsCalculator.GetBounds(drawHandler.InsertCellDrawContext.Model, (IEnumerable <DxfEntity>) this.Block.Entities, insertionTransform * this.Block.BaseTransformation);
                        switch (class455.TryIsInside(boundsCalculator.Bounds))
                        {
                        case InsideTestResult.Inside:
                            enum44 = DxfInsert.Enum44.const_2;
                            break;

                        case InsideTestResult.Outside:
                            enum44 = DxfInsert.Enum44.const_0;
                            break;

                        default:
                            enum44 = DxfInsert.Enum44.const_3;
                            break;
                        }
                        if (enum44 == DxfInsert.Enum44.const_3)
                        {
                            Matrix4D inverse2 = insertionTransform.GetInverse();
                            class455.imethod_0(inverse2);
                            GraphicsConfig config = drawHandler.InsertCellDrawContext.Config;
                            ModelSpaceClippingTransformer clippingTransformer = new ModelSpaceClippingTransformer(Matrix4D.Identity, (Interface32)class455, config.ShapeFlattenEpsilon, config.ShapeFlattenEpsilonForBoundsCalculation);
                            drawHandler.InsertCellDrawContext.vmethod_0((IClippingTransformer)clippingTransformer);
                        }
                    }
                    if ((!spatialFilter.ClipBoundaryDisplayEnabled || drawHandler.InsertCellDrawContext.Model.Header.ExternalReferenceClippingBoundaryType == WW.Cad.Model.SimpleLineType.Off ? 0 : (this.IsEntityVisibleInContext(drawHandler.InsertCellDrawContext, true) ? 1 : 0)) != 0)
                    {
                        WW.Math.Geometry.Polyline3D polygon = new WW.Math.Geometry.Polyline3D(clipPolygon.Count);
                        foreach (WW.Math.Point2D point in (List <WW.Math.Point2D>)clipPolygon)
                        {
                            polygon.Add(clipBoundaryTransform.TransformTo3D(point));
                        }
                        polygon.Closed = true;
                        drawHandler.Draw(polygon);
                    }
                    return(enum44);
                }
            }
            return(DxfInsert.Enum44.const_1);
        }
コード例 #13
0
 public DxfLine(EntityColor color, WW.Math.Point2D start, WW.Math.Point2D end)
 {
     this.Color     = color;
     this.point3D_0 = (WW.Math.Point3D)start;
     this.point3D_1 = (WW.Math.Point3D)end;
 }
コード例 #14
0
 public DxfTableCellContent(DxfValueFormat format, WW.Math.Point2D value)
     : this(format)
 {
     this.dxfValue_0.SetValue(value);
 }
コード例 #15
0
 public DxfLine(WW.Math.Point2D start, WW.Math.Point2D end)
 {
     this.point3D_0 = (WW.Math.Point3D)start;
     this.point3D_1 = (WW.Math.Point3D)end;
 }
コード例 #16
0
ファイル: PsExporter.cs プロジェクト: 15831944/WW
 private void method_10(WW.Math.Point2D p1, WW.Math.Point2D p2, WW.Math.Point2D p3)
 {
     this.textWriter_0.WriteLine("{0} {1} {2} {3} {4} {5} curveto", (object)p1.X.ToString("0.##", (IFormatProvider)CultureInfo.InvariantCulture), (object)p1.Y.ToString("0.##", (IFormatProvider)CultureInfo.InvariantCulture), (object)p2.X.ToString("0.##", (IFormatProvider)CultureInfo.InvariantCulture), (object)p2.Y.ToString("0.##", (IFormatProvider)CultureInfo.InvariantCulture), (object)p3.X.ToString("0.##", (IFormatProvider)CultureInfo.InvariantCulture), (object)p3.Y.ToString("0.##", (IFormatProvider)CultureInfo.InvariantCulture));
 }
コード例 #17
0
 public WW.Math.Point2D imethod_37(WW.Math.Point2D defaultPoint)
 {
     return(this.interface30_0.imethod_37(defaultPoint));
 }
コード例 #18
0
ファイル: DxfCircle.cs プロジェクト: 15831944/WW
 public DxfCircle(WW.Math.Point2D center, double radius)
 {
     this.point3D_0 = (WW.Math.Point3D)center;
     this.double_1  = radius;
 }
コード例 #19
0
ファイル: DxfLayout.cs プロジェクト: 15831944/WW
        public void CreateInitialModelViewport()
        {
            BoundsCalculator boundsCalculator = new BoundsCalculator();

            boundsCalculator.GetBounds(this.Model);
            Bounds3D bounds = boundsCalculator.Bounds;

            if (!bounds.Initialized)
            {
                return;
            }
            DxfViewport dxfViewport = new DxfViewport();

            this.dxfViewportCollection_0.Add(dxfViewport);
            Vector2D vector2D = this.Model.Header.PaperSpaceLimitsMax - this.Model.Header.PaperSpaceLimitsMin;

            if (this.PlotRotation != PlotRotation.None && this.PlotRotation != PlotRotation.Half)
            {
                vector2D.X -= this.UnprintableMarginTop;
                vector2D.X -= this.UnprintableMarginBottom;
                vector2D.Y -= this.UnprintableMarginRight;
                vector2D.Y -= this.UnprintableMarginLeft;
            }
            else
            {
                vector2D.X -= this.UnprintableMarginRight;
                vector2D.X -= this.UnprintableMarginLeft;
                vector2D.Y -= this.UnprintableMarginTop;
                vector2D.Y -= this.UnprintableMarginBottom;
            }
            dxfViewport.Size = new Size2D(vector2D.X, vector2D.Y);
            WW.Math.Point2D point = this.Model.Header.PaperSpaceLimitsMin + vector2D / 2.0;
            switch (this.PlotRotation)
            {
            case PlotRotation.None:
                point.X += this.UnprintableMarginLeft;
                point.Y += this.UnprintableMarginBottom;
                break;

            case PlotRotation.QuarterCounterClockwise:
                point.X += this.UnprintableMarginTop;
                point.Y += this.UnprintableMarginRight;
                break;

            case PlotRotation.Half:
                point.X += this.UnprintableMarginRight;
                point.Y += this.UnprintableMarginTop;
                break;

            case PlotRotation.QuarterClockwise:
                point.X += this.UnprintableMarginBottom;
                point.Y += this.UnprintableMarginRight;
                break;
            }
            dxfViewport.Center = new WW.Math.Point3D(point, 0.0);
            WW.Math.Point3D  center   = bounds.Center;
            WW.Math.Vector3D vector3D = bounds.Delta * 1.02;
            dxfViewport.Direction  = WW.Math.Vector3D.ZAxis;
            dxfViewport.ViewCenter = (WW.Math.Point2D)bounds.Center;
            double num = vector3D.Y;
            double x   = vector3D.X;

            if (num > 1E-10)
            {
                if (vector2D.X / vector2D.Y < x / num)
                {
                    num *= x / (vector2D.X / vector2D.Y * num);
                }
            }
            else
            {
                num = vector2D.Y / vector2D.X * x;
            }
            dxfViewport.ViewHeight = num;
        }
コード例 #20
0
ファイル: XamlExporter.cs プロジェクト: 15831944/WW
            private bool method_5(IShape4D shape)
            {
                if (shape.IsEmpty)
                {
                    return(false);
                }
                StringBuilder stringBuilder = this.stack_0.Peek().StringBuilder;

                WW.Math.Point2D[]  points      = new WW.Math.Point2D[3];
                SegmentType        segmentType = SegmentType.MoveTo;
                ISegment2DIterator iterator    = shape.CreateIterator(this.xamlExporter_0.matrix4D_0);

                while (iterator.MoveNext())
                {
                    switch (iterator.Current(points, 0))
                    {
                    case SegmentType.MoveTo:
                        stringBuilder.Append('M');
                        stringBuilder.Append(points[0].X.ToString(this.xamlExporter_0.string_2, (IFormatProvider)CultureInfo.InvariantCulture));
                        stringBuilder.Append(',');
                        stringBuilder.Append(points[0].Y.ToString(this.xamlExporter_0.string_2, (IFormatProvider)CultureInfo.InvariantCulture));
                        segmentType = SegmentType.MoveTo;
                        break;

                    case SegmentType.LineTo:
                        if (segmentType != SegmentType.LineTo)
                        {
                            stringBuilder.Append('L');
                        }
                        stringBuilder.Append(points[0].X.ToString(this.xamlExporter_0.string_2, (IFormatProvider)CultureInfo.InvariantCulture));
                        stringBuilder.Append(',');
                        stringBuilder.Append(points[0].Y.ToString(this.xamlExporter_0.string_2, (IFormatProvider)CultureInfo.InvariantCulture));
                        segmentType = SegmentType.LineTo;
                        break;

                    case SegmentType.QuadTo:
                        if (segmentType != SegmentType.QuadTo)
                        {
                            stringBuilder.Append('Q');
                        }
                        stringBuilder.Append(points[0].X.ToString(this.xamlExporter_0.string_2, (IFormatProvider)CultureInfo.InvariantCulture));
                        stringBuilder.Append(',');
                        stringBuilder.Append(points[0].Y.ToString(this.xamlExporter_0.string_2, (IFormatProvider)CultureInfo.InvariantCulture));
                        stringBuilder.Append(' ');
                        stringBuilder.Append(points[1].X.ToString(this.xamlExporter_0.string_2, (IFormatProvider)CultureInfo.InvariantCulture));
                        stringBuilder.Append(',');
                        stringBuilder.Append(points[1].Y.ToString(this.xamlExporter_0.string_2, (IFormatProvider)CultureInfo.InvariantCulture));
                        segmentType = SegmentType.QuadTo;
                        break;

                    case SegmentType.CubicTo:
                        if (segmentType != SegmentType.CubicTo)
                        {
                            stringBuilder.Append('C');
                        }
                        stringBuilder.Append(points[0].X.ToString(this.xamlExporter_0.string_2, (IFormatProvider)CultureInfo.InvariantCulture));
                        stringBuilder.Append(',');
                        stringBuilder.Append(points[0].Y.ToString(this.xamlExporter_0.string_2, (IFormatProvider)CultureInfo.InvariantCulture));
                        stringBuilder.Append(' ');
                        stringBuilder.Append(points[1].X.ToString(this.xamlExporter_0.string_2, (IFormatProvider)CultureInfo.InvariantCulture));
                        stringBuilder.Append(',');
                        stringBuilder.Append(points[1].Y.ToString(this.xamlExporter_0.string_2, (IFormatProvider)CultureInfo.InvariantCulture));
                        stringBuilder.Append(' ');
                        stringBuilder.Append(points[2].X.ToString(this.xamlExporter_0.string_2, (IFormatProvider)CultureInfo.InvariantCulture));
                        stringBuilder.Append(',');
                        stringBuilder.Append(points[2].Y.ToString(this.xamlExporter_0.string_2, (IFormatProvider)CultureInfo.InvariantCulture));
                        segmentType = SegmentType.CubicTo;
                        break;

                    case SegmentType.Close:
                        stringBuilder.Append('Z');
                        segmentType = SegmentType.Close;
                        break;
                    }
                    stringBuilder.Append(' ');
                }
                return(true);
            }
コード例 #21
0
 public DxfPoint(WW.Math.Point2D position)
 {
     this.point3D_0 = (WW.Math.Point3D)position;
 }
コード例 #22
0
 internal static void smethod_14(
     DxfEntity entity,
     DrawContext.Surface context,
     WW.Cad.Drawing.Surface.Geometry geometry,
     Polyline2D polylineA,
     Polyline2D polylineB,
     Matrix4D transform,
     Vector3D normal,
     bool isSurface)
 {
     if (polylineA.Count == 1)
     {
         WW.Math.Point2D point1 = polylineA[0];
         WW.Math.Point2D point2 = polylineB[0];
         if (point1 == point2)
         {
             geometry.Add((IPrimitive) new WW.Cad.Drawing.Surface.Point(transform.TransformTo3D(point1)));
         }
         else
         {
             geometry.Add((IPrimitive) new WW.Cad.Drawing.Surface.Segment(transform.TransformTo3D(point1), transform.TransformTo3D(point2)));
         }
     }
     else if (polylineA.Count == 2)
     {
         WW.Math.Point2D point1 = polylineA[0];
         WW.Math.Point2D point2 = polylineA[1];
         WW.Math.Point2D point3 = polylineB[0];
         WW.Math.Point2D point4 = polylineB[1];
         if (isSurface)
         {
             geometry.Add((IPrimitive) new Quad(transform.TransformTo3D(point1), transform.TransformTo3D(point2), transform.TransformTo3D(point4), transform.TransformTo3D(point3)));
         }
         else
         {
             geometry.Add(WW.Cad.Drawing.Surface.Polyline3D.CreatePrimitive((IList <WW.Math.Point3D>) new WW.Math.Point3D[4]
             {
                 transform.TransformTo3D(point1),
                 transform.TransformTo3D(point2),
                 transform.TransformTo3D(point4),
                 transform.TransformTo3D(point3)
             }, true));
         }
     }
     else
     {
         int  count  = polylineA.Count;
         bool closed = polylineA.Closed;
         WW.Math.Geometry.Polyline3D polyline3D1 = DxfUtil.smethod_42(polylineA, transform);
         WW.Math.Geometry.Polyline3D polyline3D2 = DxfUtil.smethod_42(polylineB, transform);
         if (isSurface)
         {
             geometry.Add((IPrimitive) new QuadStrip1((IList <WW.Math.Point3D>)polyline3D1, (IList <WW.Math.Point3D>)polyline3D2, normal, closed));
         }
         else
         {
             int index1 = 0;
             int num    = 1;
             if (closed)
             {
                 index1 = count - 1;
                 num    = 0;
             }
             WW.Math.Point3D start = polyline3D1[index1];
             WW.Math.Point3D end   = polyline3D2[index1];
             for (int index2 = num; index2 < count; ++index2)
             {
                 WW.Math.Point3D point3D1 = polyline3D1[index2];
                 WW.Math.Point3D point3D2 = polyline3D2[index2];
                 geometry.Add((IPrimitive) new WW.Cad.Drawing.Surface.Segment(start, end));
                 start = point3D1;
                 end   = point3D2;
             }
             geometry.Add(WW.Cad.Drawing.Surface.Polyline3D.CreatePrimitive((IList <WW.Math.Point3D>)polyline3D1, closed));
             geometry.Add(WW.Cad.Drawing.Surface.Polyline3D.CreatePrimitive((IList <WW.Math.Point3D>)polyline3D2, closed));
         }
     }
 }
コード例 #23
0
ファイル: Class444.cs プロジェクト: 15831944/WW
 public WW.Math.Point2D imethod_37(WW.Math.Point2D defaultPoint)
 {
     return(new WW.Math.Point2D(this.imethod_29(defaultPoint.X), this.imethod_29(defaultPoint.Y)));
 }
コード例 #24
0
ファイル: ShxShape.cs プロジェクト: 15831944/WW
 internal void method_4()
 {
     this.point2D_0 = this.stack_0.Pop();
     this.bool_3    = false;
 }
コード例 #25
0
 public DxfPoint(EntityColor color, WW.Math.Point2D position)
 {
     this.point3D_0 = (WW.Math.Point3D)position;
     this.Color     = color;
 }
コード例 #26
0
ファイル: Class908.cs プロジェクト: 15831944/WW
 public void method_2(WW.Math.Point2D start, WW.Math.Point2D end)
 {
     this.method_4((IShape2D) new Line2D(start, end - start));
 }
コード例 #27
0
            public void CreateShape(DxfEntity entity, IShape4D shape)
            {
                if (shape.IsEmpty)
                {
                    return;
                }
                WW.Math.Point2D[]  points    = new WW.Math.Point2D[3];
                List <bool>        boolList  = new List <bool>();
                ISegment2DIterator iterator1 = shape.CreateIterator(this.matrix4D_0);

                while (iterator1.MoveNext())
                {
                    switch (iterator1.CurrentType)
                    {
                    case SegmentType.MoveTo:
                        boolList.Add(false);
                        continue;

                    case SegmentType.Close:
                        boolList[boolList.Count - 1] = true;
                        continue;

                    default:
                        continue;
                    }
                }
                int num = 0;
                List <System.Windows.Point> pointList = new List <System.Windows.Point>();
                ISegment2DIterator          iterator2 = shape.CreateIterator(this.matrix4D_0);

                while (iterator2.MoveNext())
                {
                    switch (iterator2.Current(points, 0))
                    {
                    case SegmentType.MoveTo:
                        this.class453_0.method_1((System.Windows.Point)points[0], this.class453_0.Fill, boolList[num++]);
                        continue;

                    case SegmentType.LineTo:
                        this.class453_0.method_4((System.Windows.Point)points[0]);
                        continue;

                    case SegmentType.QuadTo:
                        pointList.Clear();
                        pointList.Add((System.Windows.Point)points[0]);
                        pointList.Add((System.Windows.Point)points[1]);
                        this.class453_0.method_6((IList <System.Windows.Point>)pointList);
                        continue;

                    case SegmentType.CubicTo:
                        pointList.Clear();
                        pointList.Add((System.Windows.Point)points[0]);
                        pointList.Add((System.Windows.Point)points[1]);
                        pointList.Add((System.Windows.Point)points[2]);
                        this.class453_0.method_8((IList <System.Windows.Point>)pointList);
                        continue;

                    default:
                        continue;
                    }
                }
            }
コード例 #28
0
ファイル: PsExporter.cs プロジェクト: 15831944/WW
 private void method_3(Vector4D point, ArgbColor color)
 {
     WW.Math.Point2D point2D = (WW.Math.Point2D)point;
     this.textWriter_0.WriteLine("{0} {1} {2} {3} rectfill", (object)(point2D.X - (double)this.float_3).ToString("0.##", (IFormatProvider)CultureInfo.InvariantCulture), (object)(point2D.Y - (double)this.float_3).ToString("0.##", (IFormatProvider)CultureInfo.InvariantCulture), (object)this.float_2.ToString("0.##", (IFormatProvider)CultureInfo.InvariantCulture), (object)this.float_2.ToString("0.##", (IFormatProvider)CultureInfo.InvariantCulture));
     this.method_11(color, true);
 }
コード例 #29
0
ファイル: DxfCircle.cs プロジェクト: 15831944/WW
 public DxfCircle(EntityColor color, WW.Math.Point2D center, double radius)
 {
     this.Color     = color;
     this.point3D_0 = (WW.Math.Point3D)center;
     this.double_1  = radius;
 }
コード例 #30
0
ファイル: PsExporter.cs プロジェクト: 15831944/WW
 private void method_9(WW.Math.Point2D p)
 {
     this.textWriter_0.WriteLine("{0} {1} lineto", (object)p.X.ToString("0.##", (IFormatProvider)CultureInfo.InvariantCulture), (object)p.Y.ToString("0.##", (IFormatProvider)CultureInfo.InvariantCulture));
 }