Example #1
0
        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);
        }
Example #2
0
        private void GetPolylines4D(
            DrawContext context,
            IClippingTransformer transformer,
            out bool fill,
            out IList <Polyline4D> polylines4D)
        {
            DxfHeader      header = context.Model.Header;
            GraphicsConfig config = context.Config;
            IList <WW.Math.Geometry.Polyline3D> polylines = (IList <WW.Math.Geometry.Polyline3D>) new List <WW.Math.Geometry.Polyline3D>();

            fill = false;
            if (header.ShowSplineControlPoints || config.ShowSplineControlPoints)
            {
                this.method_14(polylines);
            }
            if (config.ShowSplineApproximationPoints)
            {
                this.method_15(polylines);
            }
            if (!header.ShowSplineControlPoints || config.ShowSplineInterpolatedPoints)
            {
                int splineLineSegments = (int)context.Config.NoOfSplineLineSegments;
                this.method_18(polylines, splineLineSegments, splineLineSegments);
            }
            IClippingTransformer transformer1 = (IClippingTransformer)transformer.Clone();

            transformer1.SetPreTransform(this.Transform);
            polylines4D = DxfUtil.smethod_36(polylines, false, transformer1);
        }
Example #3
0
        private IList <Polyline4D> method_14(
            DrawContext context,
            IClippingTransformer transformer)
        {
            bool closed = this.Closed;
            List <Polyline3D> polyline3DList = new List <Polyline3D>();

            if (this.Style.DisplayMiters)
            {
                int num1 = closed ? 0 : 1;
                int num2 = closed ? this.list_0.Count : this.list_0.Count - 1;
                for (int index = num1; index < num2; ++index)
                {
                    DxfMLine.Segment segment = this.list_0[index];
                    if (segment.Elements.Count >= 2)
                    {
                        DxfMLine.Segment.Element element1 = segment.Elements[0];
                        DxfMLine.Segment.Element element2 = segment.Elements[segment.Elements.Count - 1];
                        if (element1.Parameters.Count > 0 && element2.Parameters.Count > 0)
                        {
                            Polyline3D polyline3D = new Polyline3D(2, false);
                            polyline3D.Add(segment.Position + element1.Parameters[0] * segment.MiterDirection);
                            polyline3D.Add(segment.Position + element2.Parameters[0] * segment.MiterDirection);
                            polyline3DList.Add(polyline3D);
                        }
                    }
                }
            }
            return(DxfUtil.smethod_36((IList <Polyline3D>)polyline3DList, false, transformer));
        }
Example #4
0
 protected Wireframe(
     DxfModel model,
     DxfLayout layout,
     GraphicsConfig config,
     IClippingTransformer initialTransformer)
     : base(model, layout, config)
 {
     this.clippingTransformerChain_0 = new ClippingTransformerChain();
     this.clippingTransformerChain_0.Push(initialTransformer);
 }
Example #5
0
        private IList <Polyline4D> method_21(
            DrawContext context,
            IClippingTransformer transformer)
        {
            Polyline3D polyline = new Polyline3D(true, new WW.Math.Point3D[4] {
                new WW.Math.Point3D(this.point3D_0.X - this.size2D_0.X * 0.5, this.point3D_0.Y - this.size2D_0.Y * 0.5, 0.0), new WW.Math.Point3D(this.point3D_0.X + this.size2D_0.X * 0.5, this.point3D_0.Y - this.size2D_0.Y * 0.5, 0.0), new WW.Math.Point3D(this.point3D_0.X + this.size2D_0.X * 0.5, this.point3D_0.Y + this.size2D_0.Y * 0.5, 0.0), new WW.Math.Point3D(this.point3D_0.X - this.size2D_0.X * 0.5, this.point3D_0.Y + this.size2D_0.Y * 0.5, 0.0)
            });

            return(transformer.Transform(polyline, false));
        }
Example #6
0
        public void DrawPath(
            IShape2D path,
            Matrix4D transform,
            Color color,
            short lineWeight,
            bool filled,
            bool forText,
            double extrusion)
        {
            if (!path.HasSegments)
            {
                return;
            }
            IClippingTransformer transformer = (IClippingTransformer)this.wireframe_0.GetTransformer().Clone();

            transformer.SetPreTransform(transform);
            if (extrusion == 0.0)
            {
                IShape4D shape1 = (IShape4D) new FlatShape4D(path, filled);
                IShape4D shape2 = transformer.Transform(shape1);
                if (shape2.IsEmpty)
                {
                    return;
                }
                this.iwireframeGraphicsFactory2_0.BeginGeometry(this.dxfEntity_0, this.wireframe_0, this.wireframe_0.GetPlotColor(this.dxfEntity_0, color), false, filled, !filled, true);
                this.iwireframeGraphicsFactory2_0.CreateShape(this.dxfEntity_0, shape2);
                this.iwireframeGraphicsFactory2_0.EndGeometry();
            }
            else
            {
                IList <Polyline2D> flattened  = (IList <Polyline2D>)ShapeTool.GetFlattened(path, this.wireframe_0.Config.ShapeFlattenEpsilon);
                IList <Polyline4D> polylines1 = DxfUtil.smethod_39(flattened, filled, transformer);
                ArgbColor          plotColor  = this.wireframe_0.GetPlotColor(this.dxfEntity_0, color);
                Class940.smethod_3(this.dxfEntity_0, this.wireframe_0, this.iwireframeGraphicsFactory2_0, plotColor, forText, false, true, polylines1);
                transformer.SetPreTransform(Transformation4D.Translation(0.0, 0.0, extrusion));
                IList <Polyline4D> polylines2 = DxfUtil.smethod_39(flattened, filled, transformer);
                Class940.smethod_3(this.dxfEntity_0, this.wireframe_0, this.iwireframeGraphicsFactory2_0, plotColor, forText, false, true, polylines2);
                Polyline4D polyline4D1 = new Polyline4D(2);
                polyline4D1.Add(Vector4D.Zero);
                polyline4D1.Add(Vector4D.Zero);
                IList <Polyline4D> polylines3 = (IList <Polyline4D>) new List <Polyline4D>(1);
                polylines3.Add(polyline4D1);
                for (int index1 = polylines1.Count - 1; index1 >= 0; --index1)
                {
                    Polyline4D polyline4D2 = polylines1[index1];
                    Polyline4D polyline4D3 = polylines2[index1];
                    for (int index2 = polyline4D2.Count - 1; index2 >= 0; --index2)
                    {
                        polyline4D1[0] = polyline4D2[index2];
                        polyline4D1[1] = polyline4D3[index2];
                        Class940.smethod_2(this.dxfEntity_0, this.wireframe_0, this.iwireframeGraphicsFactory2_0, plotColor, forText, false, true, polylines3);
                    }
                }
            }
        }
Example #7
0
        private void GetPolylines4D(
            DrawContext context,
            IClippingTransformer transformer,
            out IList <Polyline4D> polylines4D,
            out IList <FlatShape4D> shapes)
        {
            IList <WW.Math.Geometry.Polyline3D> polylines;

            this.GetPolylines(context, transformer.LineTypeScaler, out polylines, out shapes);
            polylines4D = DxfUtil.smethod_36(polylines, false, transformer);
        }
Example #8
0
        private IList <Polyline4D> GetPolylines4D(IClippingTransformer transformer)
        {
            WW.Math.Geometry.Polyline3D        polyline3D     = this.method_13();
            List <WW.Math.Geometry.Polyline3D> polyline3DList = new List <WW.Math.Geometry.Polyline3D>(1);

            polyline3DList.Add(polyline3D);
            if (this.Thickness != 0.0)
            {
                DxfUtil.Extrude((IList <WW.Math.Geometry.Polyline3D>)polyline3DList, this.Thickness, this.ZAxis);
            }
            return(DxfUtil.smethod_36((IList <WW.Math.Geometry.Polyline3D>)polyline3DList, polyline3D.Closed, transformer));
        }
Example #9
0
        private void GetPolylines4D(
            IClippingTransformer transformer,
            out IList <Polyline4D> polylines4D,
            out bool fill)
        {
            IList <WW.Math.Geometry.Polyline3D> polylines = (IList <WW.Math.Geometry.Polyline3D>) new List <WW.Math.Geometry.Polyline3D>();

            fill = false;
            this.method_13(polylines);
            DxfUtil.Transform(polylines, this.Transform);
            polylines4D = DxfUtil.smethod_36(polylines, false, transformer);
        }
Example #10
0
        private void GetPolylines4D(
            DrawContext context,
            IClippingTransformer transformer,
            out IList <Polyline4D> polylines4D,
            out IList <IShape4D> shapes)
        {
            IList <Polyline3D>  polylines;
            IList <FlatShape4D> flatShapes;

            this.GetPolylines(context, transformer.LineTypeScaler, out polylines, out flatShapes);
            polylines4D = DxfUtil.smethod_36(polylines, false, transformer);
            shapes      = DxfUtil.smethod_37((ICollection <FlatShape4D>)flatShapes, transformer);
        }
Example #11
0
 private void method_13(
     DrawContext context,
     IClippingTransformer transformer,
     out IList <WW.Math.Geometry.Polyline3D> polylines,
     out IList <FlatShape4D> flatShapes)
 {
     this.GetPolylines(context, transformer.LineTypeScaler, out polylines, out flatShapes);
     if (this.double_1 == 0.0)
     {
         return;
     }
     DxfUtil.Extrude(polylines, this.double_1, this.vector3D_0);
 }
Example #12
0
        private void GetPolylines4D(
            DrawContext context,
            IClippingTransformer transformer,
            out IList <Polyline4D> polylines4D,
            out bool fill)
        {
            DxfHeader      header = context.Model.Header;
            GraphicsConfig config = context.Config;
            IList <WW.Math.Geometry.Polyline3D> polylines = (IList <WW.Math.Geometry.Polyline3D>) new List <WW.Math.Geometry.Polyline3D>();

            fill = false;
            this.method_13(polylines);
            DxfUtil.Transform(polylines, this.Transform);
            polylines4D = DxfUtil.smethod_36(polylines, false, transformer);
        }
Example #13
0
        public override void DrawInternal(
            DrawContext.Wireframe context,
            IWireframeGraphicsFactory graphicsFactory)
        {
            IClippingTransformer transformer = context.GetTransformer();
            Vector3D             vector3D    = 10000000.0 * this.vector3D_0;

            WW.Math.Point3D start = this.point3D_0 - vector3D;
            WW.Math.Point3D end   = this.point3D_0 + vector3D;
            foreach (Segment4D segment in (IEnumerable <Segment4D>)transformer.Transform(new Segment3D(start, end)))
            {
                Vector4D?startPoint = transformer.Transform(this.point3D_0);
                graphicsFactory.CreateXLine((DxfEntity)this, context, context.GetPlotColor((DxfEntity)this), startPoint, segment);
            }
        }
Example #14
0
        public void DrawPath(
            IShape2D path,
            Matrix4D transform,
            Color color,
            short lineWeight,
            bool filled,
            bool forText,
            double extrusion)
        {
            if (!path.HasSegments)
            {
                return;
            }
            IClippingTransformer transformer = (IClippingTransformer)this.wireframe_0.GetTransformer().Clone();

            transformer.SetPreTransform(transform);
            IWireframeGraphicsFactory graphicsFactory0 = this.iwireframeGraphicsFactory_0;

            if (extrusion == 0.0)
            {
                IShape4D shape1 = (IShape4D) new FlatShape4D((IShape2D)(path as GeneralShape2D ?? new GeneralShape2D(path, true)), filled);
                IShape4D shape2 = transformer.Transform(shape1);
                if (shape2.IsEmpty)
                {
                    return;
                }
                graphicsFactory0.CreateShape(this.dxfEntity_0, this.wireframe_0, this.wireframe_0.GetPlotColor(this.dxfEntity_0, color), forText, shape2);
            }
            else
            {
                IList <Polyline2D> flattened  = (IList <Polyline2D>)ShapeTool.GetFlattened(path, this.wireframe_0.Config.ShapeFlattenEpsilon);
                IList <Polyline4D> polylines1 = DxfUtil.smethod_39(flattened, filled, transformer);
                ArgbColor          plotColor  = this.wireframe_0.GetPlotColor(this.dxfEntity_0, color);
                graphicsFactory0.CreatePathAsOne(this.dxfEntity_0, this.wireframe_0, plotColor, forText, polylines1, false, true);
                transformer.SetPreTransform(Transformation4D.Translation(0.0, 0.0, extrusion));
                IList <Polyline4D> polylines2 = DxfUtil.smethod_39(flattened, filled, transformer);
                graphicsFactory0.CreatePathAsOne(this.dxfEntity_0, this.wireframe_0, plotColor, forText, polylines2, false, true);
                for (int index1 = polylines1.Count - 1; index1 >= 0; --index1)
                {
                    Polyline4D polyline4D1 = polylines1[index1];
                    Polyline4D polyline4D2 = polylines2[index1];
                    for (int index2 = polyline4D1.Count - 1; index2 >= 0; --index2)
                    {
                        graphicsFactory0.CreateLine(this.dxfEntity_0, this.wireframe_0, plotColor, forText, polyline4D1[index2], polyline4D2[index2]);
                    }
                }
            }
        }
Example #15
0
        private void GetPolylines4D(
            DrawContext context,
            IClippingTransformer transformer,
            out IList <Polyline4D> polylines4D,
            out IList <IShape4D> shapes)
        {
            IList <WW.Math.Geometry.Polyline3D> polylines;
            IList <FlatShape4D> shapes1;

            this.GetPolylines(context, transformer.LineTypeScaler, out polylines, out shapes1);
            IClippingTransformer transformer1 = (IClippingTransformer)transformer.Clone();

            transformer1.SetPreTransform(this.Transform);
            polylines4D = DxfUtil.smethod_36(polylines, false, transformer1);
            shapes      = DxfUtil.smethod_37((ICollection <FlatShape4D>)shapes1, transformer1);
        }
Example #16
0
        public override void DrawInternal(
            DrawContext.Wireframe context,
            IWireframeGraphicsFactory2 graphicsFactory)
        {
            PointDisplayMode pointDisplayMode = context.Model.Header.PointDisplayMode;
            bool             flag             = this.Layer != null && this.Layer == context.DefPointsLayer;

            if (pointDisplayMode == PointDisplayMode.None && !flag)
            {
                return;
            }
            ArgbColor            plotColor   = context.GetPlotColor((DxfEntity)this);
            IClippingTransformer transformer = context.GetTransformer();

            if (this.double_1 != 0.0)
            {
                foreach (Segment4D segment4D in (IEnumerable <Segment4D>)transformer.Transform(new Segment3D(this.point3D_0, this.point3D_0 + this.double_1 * this.vector3D_0)))
                {
                    graphicsFactory.BeginGeometry((DxfEntity)this, context, plotColor, false, false, true, true);
                    graphicsFactory.CreateLine((DxfEntity)this, segment4D.Start, segment4D.End);
                    graphicsFactory.EndGeometry();
                }
            }
            else if (pointDisplayMode != PointDisplayMode.Point && context.Model.Header.PointDisplaySize > 0.0 && !flag)
            {
                IShape4D shape = transformer.Transform((IShape4D) new FlatShape4D(context.PointShape2D, Transformation4D.Translation(this.point3D_0.X, this.point3D_0.Y, this.point3D_0.Z), false));
                if (shape.IsEmpty)
                {
                    return;
                }
                graphicsFactory.BeginGeometry((DxfEntity)this, context, plotColor, false, true, false, true);
                graphicsFactory.CreateShape((DxfEntity)this, shape);
                graphicsFactory.EndGeometry();
            }
            else
            {
                Vector4D?nullable = transformer.Transform(this.point3D_0);
                if (!nullable.HasValue)
                {
                    return;
                }
                graphicsFactory.BeginGeometry((DxfEntity)this, context, plotColor, false, true, false, true);
                graphicsFactory.CreateDot((DxfEntity)this, nullable.Value);
                graphicsFactory.EndGeometry();
            }
        }
Example #17
0
        private void GetPolylines4D(
            DrawContext context,
            IClippingTransformer transformer,
            out IList <Polyline4D> polylines4D,
            out IList <FlatShape4D> shapes,
            out bool fill)
        {
            IList <Polyline3D> polylines;

            this.GetPolylines(context, transformer.LineTypeScaler, out polylines, out shapes, out fill);
            fill = fill && this.ZAxis.X == 0.0 && this.ZAxis.Y == 0.0;
            if (this.Thickness != 0.0)
            {
                DxfUtil.Extrude(polylines, this.Thickness, this.ZAxis);
            }
            polylines4D = DxfUtil.smethod_36(polylines, fill, transformer);
        }
Example #18
0
        private void GetPolylines4D(
            DrawContext context,
            IClippingTransformer transformer,
            double startAngle,
            double endAngle,
            out IList <Polyline4D> polylines4D,
            out IList <FlatShape4D> shapes)
        {
            IList <WW.Math.Geometry.Polyline3D> polylines;

            this.GetPolylines(context, transformer.LineTypeScaler, startAngle, endAngle, out polylines, out shapes);
            if (this.Thickness != 0.0)
            {
                DxfUtil.Extrude(polylines, this.Thickness, this.ZAxis);
            }
            polylines4D = DxfUtil.smethod_36(polylines, false, transformer);
        }
Example #19
0
        public override void DrawInternal(
            DrawContext.Wireframe context,
            IWireframeGraphicsFactory graphicsFactory)
        {
            IList <Polyline3D>  polylines1;
            IList <FlatShape4D> shapes;

            this.method_14((DrawContext)context, context.GetTransformer().LineTypeScaler, out polylines1, out shapes);
            IList <Polyline4D> polylines2 = DxfUtil.smethod_36(polylines1, false, context.GetTransformer());

            if (polylines2.Count > 0)
            {
                graphicsFactory.CreatePath((DxfEntity)this, context, context.GetPlotColor((DxfEntity)this, this.dxfDimensionStyleOverrides_0.DimensionLineColor), false, polylines2, false, true);
            }
            if (shapes != null)
            {
                Class940.smethod_23((IPathDrawer) new ns0.Class0((DxfEntity)this, context, graphicsFactory), (IEnumerable <IShape4D>)shapes, this.dxfDimensionStyleOverrides_0.DimensionLineColor, context.GetLineWeight((DxfEntity)this));
            }
            if (!DxfLeader.smethod_7((ILeader)this, (IList <WW.Math.Point3D>) this.list_0))
            {
                return;
            }
            if (this.dxfDimensionStyleOverrides_0.LeaderArrowBlock == null)
            {
                Polyline3D polyline = this.method_15();
                if (polyline == null)
                {
                    return;
                }
                IClippingTransformer clippingTransformer = (IClippingTransformer)context.GetTransformer().Clone();
                clippingTransformer.SetPreTransform(this.method_16());
                List <Polyline4D> polyline4DList = new List <Polyline4D>((IEnumerable <Polyline4D>)clippingTransformer.Transform(polyline, polyline.Closed));
                if (polyline4DList.Count <= 0)
                {
                    return;
                }
                graphicsFactory.CreatePath((DxfEntity)this, context, context.GetPlotColor((DxfEntity)this, this.dxfDimensionStyleOverrides_0.DimensionLineColor), false, (IList <Polyline4D>)polyline4DList, true, true);
            }
            else
            {
                DxfInsert.Interface46 nterface46 = (DxfInsert.Interface46) new DxfInsert.Class1019((DxfEntity)this, context, graphicsFactory);
                nterface46.imethod_0(0, 0, this.method_16());
                nterface46.Draw(this.dxfDimensionStyleOverrides_0.LeaderArrowBlock, true);
            }
        }
Example #20
0
        private IList <Polyline4D> method_17(
            IClippingTransformer transformer,
            Bounds2D textBounds)
        {
            Matrix4D             transform    = this.Transform;
            IClippingTransformer transformer1 = (IClippingTransformer)transformer.Clone();

            transformer1.SetPreTransform(transform);
            double num = this.double_1 * (this.backgroundFillInfo_0.BorderOffsetFactor - 1.0);
            double x1  = textBounds.Corner1.X - num;
            double x2  = this.double_2 + num;
            double y1  = textBounds.Corner1.Y - num;
            double y2  = textBounds.Corner2.Y + num;

            return(DxfUtil.smethod_38(new WW.Math.Geometry.Polyline3D(true, new WW.Math.Point3D[4] {
                new WW.Math.Point3D(x1, y1, 0.0), new WW.Math.Point3D(x2, y1, 0.0), new WW.Math.Point3D(x2, y2, 0.0), new WW.Math.Point3D(x1, y2, 0.0)
            }), true, transformer1));
        }
Example #21
0
        public override void DrawInternal(
            DrawContext.Wireframe context,
            IWireframeGraphicsFactory2 graphicsFactory)
        {
            IClippingTransformer transformer = context.GetTransformer();
            IList <WW.Math.Geometry.Polyline3D> polylines1;
            IList <FlatShape4D> flatShapes;

            this.method_13((DrawContext)context, transformer, out polylines1, out flatShapes);
            IList <Polyline4D> polylines2 = DxfUtil.smethod_36(polylines1, false, transformer);

            if (polylines2.Count > 0)
            {
                Class940.smethod_3((DxfEntity)this, context, graphicsFactory, context.GetPlotColor((DxfEntity)this), false, false, true, polylines2);
            }
            if (flatShapes == null)
            {
                return;
            }
            Class940.smethod_23((IPathDrawer) new Class396((DxfEntity)this, context, graphicsFactory), (IEnumerable <IShape4D>)flatShapes, this.Color.ToColor(), context.GetLineWeight((DxfEntity)this));
        }
Example #22
0
        public override void DrawInternal(
            DrawContext.Wireframe context,
            IWireframeGraphicsFactory graphicsFactory)
        {
            if (this.list_0.Count <= 0)
            {
                return;
            }
            Polygon2D clipBoundary = this.GetClipBoundary((DrawContext)context);

            if (clipBoundary == null)
            {
                return;
            }
            Matrix4D             preTransform        = this.method_15();
            IClippingTransformer clippingTransformer = (IClippingTransformer)context.GetTransformer().Clone();

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

            WW.Math.Point3D point             = new WW.Math.Point3D(-0.5, -0.5, 0.0);
            Vector4D        transformedOrigin = matrix.TransformTo4D(point);
            Vector4D        transformedXAxis  = matrix.TransformTo4D(point + WW.Math.Vector3D.XAxis);
            Vector4D        transformedYAxis  = matrix.TransformTo4D(point + WW.Math.Vector3D.YAxis);

            WW.Math.Geometry.Polyline3D polyline = new WW.Math.Geometry.Polyline3D(true);
            foreach (WW.Math.Point2D point2D in (List <WW.Math.Point2D>)clipBoundary)
            {
                polyline.Add((WW.Math.Point3D)point2D);
            }
            IList <Polyline4D> polyline4DList = clippingTransformer.Transform(polyline, true);

            if (polyline4DList.Count <= 0)
            {
                return;
            }
            Polyline4D imageBoundary = polyline4DList[0];

            graphicsFactory.CreateImage(this, context, this.bool_2 ? imageBoundary : (Polyline4D)null, imageBoundary, transformedOrigin, transformedXAxis, transformedYAxis);
        }
Example #23
0
        internal IClippingTransformer method_17(
            DxfModel model,
            GraphicsConfig graphicsConfig,
            Matrix4D postTransform)
        {
            IClippingTransformer  clippingTransformer    = (IClippingTransformer)null;
            IClipBoundaryProvider clippingBoundaryEntity = this.ClippingBoundaryEntity as IClipBoundaryProvider;

            if (this.UseNonRectangularClipBoundary && clippingBoundaryEntity != null)
            {
                IList <Polygon2D> clipBoundary = clippingBoundaryEntity.GetClipBoundary(graphicsConfig);
                if (clipBoundary.Count == 1)
                {
                    Matrix4D transform = this.GetTransform();
                    clippingTransformer = (IClippingTransformer) new ModelSpaceClippingTransformer(postTransform * transform, new Matrix3D(transform.M00, transform.M01, transform.M02, transform.M10, transform.M11, transform.M12, transform.M20, transform.M21, transform.M22), (Interface32) new Class455(transform.GetInverse(), clipBoundary[0], false), graphicsConfig.ShapeFlattenEpsilon, graphicsConfig.ShapeFlattenEpsilonForBoundsCalculation);
                }
            }
            if (clippingTransformer == null)
            {
                clippingTransformer = (IClippingTransformer) new Class938(this, postTransform, graphicsConfig.ShapeFlattenEpsilon, graphicsConfig.ShapeFlattenEpsilonForBoundsCalculation, model.Header.PaperSpaceAnnotationScalingEnabled);
            }
            return(clippingTransformer);
        }
Example #24
0
        private IList <Polyline4D> method_16(
            DrawContext.Wireframe context,
            out Polyline3DT imageBoundaryPolyline,
            out IClippingTransformer transformer)
        {
            Polygon2D clipBoundary = this.GetClipBoundary((DrawContext)context);

            if (clipBoundary != null && clipBoundary.Count != 0)
            {
                Matrix4D preTransform = this.method_15();
                transformer = context.GetTransformer();
                transformer = (IClippingTransformer)transformer.Clone();
                transformer.SetPreTransform(preTransform);
                imageBoundaryPolyline = new Polyline3DT(true);
                foreach (WW.Math.Point2D point2D in (List <WW.Math.Point2D>)clipBoundary)
                {
                    imageBoundaryPolyline.Add(new Point3DT((WW.Math.Point3D)point2D, 0U));
                }
                return((IList <Polyline4D>) new List <Polyline4D>((IEnumerable <Polyline4D>)transformer.Transform(imageBoundaryPolyline.ToPolyline3D(), true)));
            }
            imageBoundaryPolyline = (Polyline3DT)null;
            transformer           = (IClippingTransformer)null;
            return((IList <Polyline4D>) new Polyline4D[0]);
        }
Example #25
0
        public override void DrawInternal(
            DrawContext.Wireframe context,
            IWireframeGraphicsFactory graphicsFactory)
        {
            IList <Polyline4D> polyline4DList = context.GetTransformer().Transform(this.method_14(), true);

            if (polyline4DList == null || polyline4DList.Count <= 0)
            {
                return;
            }
            IList <Polyline4D> polylines4D;
            IList <IShape4D>   shapes;

            this.GetPolylines4D((DrawContext)context, context.GetTransformer(), out polylines4D, out shapes);
            IClippingTransformer clippingTransformer = (IClippingTransformer)context.GetTransformer().Clone();
            Matrix4D             preTransform        = Transformation4D.Translation((WW.Math.Vector3D) this.point3D_3);

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

            WW.Math.Point3D zero = WW.Math.Point3D.Zero;
            Vector4D        transformedOrigin = matrix.TransformTo4D(zero);
            Vector4D        transformedXAxis  = matrix.TransformTo4D(zero + WW.Math.Vector3D.XAxis);
            Vector4D        transformedYAxis  = matrix.TransformTo4D(zero + WW.Math.Vector3D.YAxis);

            graphicsFactory.CreateScalableImage((DxfEntity)this, context, (IBitmapProvider)this, polyline4DList[0], new Size2D((this.point3D_2 - this.point3D_3).GetLength(), (this.point3D_0 - this.point3D_3).GetLength()), transformedOrigin, transformedXAxis, transformedYAxis);
            if (polylines4D.Count > 0)
            {
                graphicsFactory.CreatePath((DxfEntity)this, context, context.GetPlotColor((DxfEntity)this), false, polylines4D, false, true);
            }
            if (shapes == null)
            {
                return;
            }
            Class940.smethod_23((IPathDrawer) new ns0.Class0((DxfEntity)this, context, graphicsFactory), (IEnumerable <IShape4D>)shapes, this.Color.ToColor(), context.GetLineWeight((DxfEntity)this));
        }
Example #26
0
 public void Push(IClippingTransformer transformer)
 {
     this.linkedList_0.AddFirst(transformer);
     this.iclippingTransformer_0 = this.linkedList_0.Count == 1 ? this.linkedList_0.First.Value : (IClippingTransformer)null;
     this.method_0();
 }
Example #27
0
        private void GetPolylines4D(
            DrawContext context,
            int elementIndex,
            int minElementCount,
            DxfMLineStyle.Element styleElement,
            IClippingTransformer transformer,
            out IList <Polyline4D> polylines4D,
            out IList <IShape4D> shapes)
        {
            WW.Math.Point3D     point3D0       = this.point3D_0;
            bool                closed         = this.Closed;
            IList <Polyline3D>  polyline3DList = (IList <Polyline3D>) new List <Polyline3D>();
            IList <FlatShape4D> resultShapes   = (IList <FlatShape4D>) new List <FlatShape4D>();

            if (minElementCount == 0)
            {
                Polyline3D polyline3D = new Polyline3D(closed);
                foreach (DxfMLine.Segment segment in this.list_0)
                {
                    polyline3D.Add(segment.Position);
                }
                if (polyline3D.Count > 0)
                {
                    DxfUtil.smethod_2(context.Config, polyline3DList, resultShapes, (IList <Polyline3D>) new Polyline3D[1]
                    {
                        polyline3D
                    }, styleElement.LineType, this.vector3D_0, 1.0, transformer.LineTypeScaler);
                }
            }
            else
            {
                IList <Polyline3D> polylines  = (IList <Polyline3D>) new List <Polyline3D>();
                Polyline3D         polyline3D = new Polyline3D();
                bool flag = false;
                foreach (DxfMLine.Segment segment in this.list_0)
                {
                    WW.Math.Vector3D miterDirection = segment.MiterDirection;
                    WW.Math.Point3D  position       = segment.Position;
                    if (elementIndex < segment.Elements.Count)
                    {
                        DxfMLine.Segment.Element element  = segment.Elements[elementIndex];
                        WW.Math.Point3D          point3D1 = position;
                        if (element.Parameters.Count > 0)
                        {
                            WW.Math.Point3D point3D2 = point3D1 + miterDirection * element.Parameters[0];
                            if (element.Parameters.Count > 1)
                            {
                                for (int index = 1; index < element.Parameters.Count; index += 2)
                                {
                                    WW.Math.Point3D point3D3 = point3D2 + segment.Direction * element.Parameters[index];
                                    polyline3D.Add(point3D3);
                                    if (index + 1 < element.Parameters.Count)
                                    {
                                        WW.Math.Point3D point3D4 = point3D2 + segment.Direction * element.Parameters[index + 1];
                                        polyline3D.Add(point3D4);
                                        polylines.Add(polyline3D);
                                        polyline3D = new Polyline3D();
                                    }
                                }
                            }
                            else if (polyline3D.Count > 0)
                            {
                                polyline3D.Add(point3D2);
                                polylines.Add(polyline3D);
                                polyline3D = new Polyline3D();
                            }
                        }
                        else if (element.AreaFillParameters.Count > 0)
                        {
                            flag = true;
                        }
                    }
                }
                DxfMLine.Segment segment1 = this.list_0[this.list_0.Count - 1];
                if (closed && polyline3D.Count > 0)
                {
                    DxfMLine.Segment segment2 = this.list_0[0];
                    if (elementIndex < segment2.Elements.Count)
                    {
                        DxfMLine.Segment.Element element  = segment2.Elements[elementIndex];
                        WW.Math.Point3D          position = segment2.Position;
                        if (element.Parameters.Count > 0)
                        {
                            WW.Math.Vector3D miterDirection = segment2.MiterDirection;
                            WW.Math.Point3D  point3D        = position + miterDirection * element.Parameters[0];
                            polyline3D.Add(point3D);
                        }
                    }
                }
                if (polyline3D.Count > 0)
                {
                    polylines.Add(polyline3D);
                }
                if (flag)
                {
                    polyline3DList.Add(polyline3D);
                }
                else if (polylines.Count > 0)
                {
                    DxfUtil.smethod_2(context.Config, polyline3DList, resultShapes, polylines, styleElement.LineType, this.vector3D_0, 1.0, transformer.LineTypeScaler);
                }
            }
            polylines4D = DxfUtil.smethod_36(polyline3DList, false, transformer);
            shapes      = DxfUtil.smethod_37((ICollection <FlatShape4D>)resultShapes, transformer);
        }
Example #28
0
        private IList <Polyline4D> method_16(IClippingTransformer transformer)
        {
            WW.Math.Point3D point3D0 = this.point3D_0;
            bool            closed   = this.Closed;

            DxfMLine.Segment segment1 = this.list_0[0];
            int num1 = int.MaxValue;

            foreach (DxfMLine.Segment segment2 in this.list_0)
            {
                if (segment2.Elements.Count < num1)
                {
                    num1 = segment2.Elements.Count;
                }
            }
            IList <Polyline4D> polyline4DList;

            if (num1 >= 2)
            {
                Polyline3D[] polyline3DArray = new Polyline3D[2];
                for (int index = 0; index < polyline3DArray.Length; ++index)
                {
                    polyline3DArray[index] = new Polyline3D(closed);
                }
                foreach (DxfMLine.Segment segment2 in this.list_0)
                {
                    WW.Math.Vector3D miterDirection = segment2.MiterDirection;
                    WW.Math.Point3D  position       = segment2.Position;
                    if (segment2.Elements.Count == 0)
                    {
                        polyline3DArray[0].Add(position);
                    }
                    else
                    {
                        DxfMLine.Segment.Element element1 = (DxfMLine.Segment.Element)null;
                        DxfMLine.Segment.Element element2 = (DxfMLine.Segment.Element)null;
                        double num2 = double.MaxValue;
                        double num3 = double.MinValue;
                        for (int index = 0; index < num1; ++index)
                        {
                            DxfMLine.Segment.Element element3 = segment2.Elements[index];
                            if (element3.Parameters.Count != 0)
                            {
                                if (element1 == null)
                                {
                                    element1 = element3;
                                    num2     = element1.Parameters[0];
                                }
                                else if (element3.Parameters[0] < num2)
                                {
                                    element1 = element3;
                                    num2     = element1.Parameters[0];
                                }
                                if (element2 == null)
                                {
                                    element2 = element3;
                                    num3     = element2.Parameters[0];
                                }
                                else if (element3.Parameters[0] > num3)
                                {
                                    element2 = element3;
                                    num3     = element2.Parameters[0];
                                }
                            }
                        }
                        if (num2 == double.MaxValue)
                        {
                            num2 = 0.0;
                        }
                        if (num3 == double.MinValue)
                        {
                            num3 = 0.0;
                        }
                        if (element1 != null && element2 != null)
                        {
                            polyline3DArray[0].Add(position + miterDirection * num2);
                            polyline3DArray[1].Add(position + miterDirection * num3);
                        }
                    }
                }
                List <Polyline3D> polyline3DList;
                if (closed)
                {
                    polyline3DList = new List <Polyline3D>(2);
                    polyline3DList.AddRange((IEnumerable <Polyline3D>)polyline3DArray);
                }
                else
                {
                    polyline3DList = new List <Polyline3D>(1);
                    Polyline3D polyline3D = new Polyline3D(polyline3DArray[0].Count + polyline3DArray[1].Count, true);
                    polyline3D.AddRange((IEnumerable <WW.Math.Point3D>)polyline3DArray[0]);
                    polyline3D.AddRange((IEnumerable <WW.Math.Point3D>)polyline3DArray[1].GetReverse());
                    polyline3DList.Add(polyline3D);
                }
                IClippingTransformer transformer1 = (IClippingTransformer)transformer.Clone();
                transformer1.SetPreTransform(DxfUtil.GetToWCSTransform(this.vector3D_0));
                polyline4DList = DxfUtil.smethod_36((IList <Polyline3D>)polyline3DList, false, transformer1);
            }
            else
            {
                polyline4DList = (IList <Polyline4D>)null;
            }
            return(polyline4DList);
        }
Example #29
0
        public override void DrawInternal(
            DrawContext.Wireframe context,
            IWireframeGraphicsFactory2 graphicsFactory)
        {
            if (this.list_0.Count > 0)
            {
                Bounds2D             bounds2D            = this.method_14((DrawContext)context);
                Matrix4D             preTransform        = this.method_15();
                IClippingTransformer clippingTransformer = (IClippingTransformer)context.GetTransformer().Clone();
                clippingTransformer.SetPreTransform(preTransform);
                Vector4D?nullable1 = clippingTransformer.Transform(WW.Math.Point3D.Zero);
                Vector4D?nullable2 = clippingTransformer.Transform(WW.Math.Point3D.Zero + WW.Math.Vector3D.XAxis);
                Vector4D?nullable3 = clippingTransformer.Transform(WW.Math.Point3D.Zero + WW.Math.Vector3D.YAxis);
                if (this.ImageDef != null && nullable1.HasValue && (nullable2.HasValue && nullable3.HasValue))
                {
                    graphicsFactory.BeginGeometry((DxfEntity)this, context, ArgbColor.Empty, false, false, false, true);
                    graphicsFactory.CreateImage(this, bounds2D.Corner1, bounds2D.Corner2, nullable1.Value, nullable2.Value, nullable3.Value, context);
                    graphicsFactory.EndGeometry();
                }
            }
            if (this.ImageDef != null && !context.Config.DrawImageFrame)
            {
                return;
            }
            Polygon2D clipBoundary = this.GetClipBoundary((DrawContext)context);

            if (clipBoundary == null)
            {
                return;
            }
            Matrix4D             preTransform1        = this.method_15();
            IClippingTransformer clippingTransformer1 = (IClippingTransformer)context.GetTransformer().Clone();

            clippingTransformer1.SetPreTransform(preTransform1);
            WW.Math.Geometry.Polyline3D polyline1 = new WW.Math.Geometry.Polyline3D(true);
            foreach (WW.Math.Point2D point2D in (List <WW.Math.Point2D>)clipBoundary)
            {
                polyline1.Add((WW.Math.Point3D)point2D);
            }
            List <Polyline4D> polyline4DList = new List <Polyline4D>((IEnumerable <Polyline4D>)clippingTransformer1.Transform(polyline1, true));

            if (this.ImageDef == null)
            {
                graphicsFactory.BeginGeometry((DxfEntity)this, context, context.Config.BackColor, false, true, false, false);
                foreach (Polyline4D polyline2 in polyline4DList)
                {
                    graphicsFactory.CreatePolyline((DxfEntity)this, polyline2);
                }
                graphicsFactory.EndGeometry();
            }
            if (this.ImageDef != null && !context.Config.DrawImageFrame)
            {
                return;
            }
            graphicsFactory.BeginGeometry((DxfEntity)this, context, this.GetColor((DrawContext)context), false, false, true, true);
            foreach (Polyline4D polyline2 in polyline4DList)
            {
                graphicsFactory.CreatePolyline((DxfEntity)this, polyline2);
            }
            graphicsFactory.EndGeometry();
        }
Example #30
0
 public void Pop()
 {
     this.linkedList_0.RemoveFirst();
     this.iclippingTransformer_0 = this.linkedList_0.Count == 1 ? this.linkedList_0.First.Value : (IClippingTransformer)null;
     this.method_0();
 }