Ejemplo n.º 1
0
        public override void DrawInternal(
            DrawContext.Surface context,
            ISurfaceGraphicsFactory 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);

            graphicsFactory.SetColor(plotColor);
            Interface41 transformer = context.GetTransformer();

            if (this.double_1 != 0.0)
            {
                graphicsFactory.CreateSegment(transformer.Transform(this.point3D_0), transformer.Transform(this.point3D_0 + this.double_1 * this.vector3D_0));
            }
            else
            {
                graphicsFactory.CreatePoint(transformer.Transform(this.point3D_0));
            }
        }
Ejemplo n.º 2
0
        public override void DrawInternal(
            DrawContext.Surface context,
            ISurfaceGraphicsFactory graphicsFactory)
        {
            graphicsFactory.SetColor(context.GetPlotColor((DxfEntity)this));
            IList <WW.Math.Geometry.Polyline3D> polylines;
            IList <FlatShape4D> shapes;

            this.GetPolylines((DrawContext)context, context.GetTransformer().LineTypeScaler, out polylines, out shapes);
            Interface41 transformer = (Interface41)context.GetTransformer().Clone();

            transformer.SetPreTransform(this.Transform);
            IList <Polyline4D> polyline4DList = DxfUtil.smethod_51(polylines, transformer);

            if (polyline4DList.Count > 0)
            {
                foreach (Polyline4D polyline4D in (IEnumerable <Polyline4D>)polyline4DList)
                {
                    graphicsFactory.CreatePolyline((IList <Vector4D>)polyline4D, polyline4D.Closed);
                }
            }
            if (shapes == null)
            {
                return;
            }
            Class940.smethod_24((IPathDrawer) new Class473((DxfEntity)this, context, graphicsFactory), (IEnumerable <FlatShape4D>)shapes, this.Color.ToColor(), context.GetLineWeight((DxfEntity)this), 0.0);
        }
Ejemplo n.º 3
0
        public override void DrawInternal(
            DrawContext.Surface context,
            ISurfaceGraphicsFactory graphicsFactory)
        {
            ushort mApproximationPointCount;
            ushort nApproximationPointCount;

            this.method_13(out mApproximationPointCount, out nApproximationPointCount);
            WW.Math.Point3D[,] point3DArray = this.method_19((int)mApproximationPointCount - 1, (int)nApproximationPointCount - 1);
            int length1 = point3DArray.GetLength(0);
            int length2 = point3DArray.GetLength(1);

            Vector4D[,] polygonMesh = new Vector4D[length1, length2];
            Interface41 transformer = context.GetTransformer();

            for (int index1 = 0; index1 < length1; ++index1)
            {
                for (int index2 = 0; index2 < length2; ++index2)
                {
                    polygonMesh[index1, index2] = transformer.Transform(point3DArray[index1, index2]);
                }
            }
            graphicsFactory.SetColor(context.GetPlotColor((DxfEntity)this));
            graphicsFactory.CreatePolygonMesh(polygonMesh, this.ClosedInMDirection, this.ClosedInNDirection);
        }
Ejemplo n.º 4
0
        public static void smethod_19(
            DxfEntity entity,
            DrawContext.Surface context,
            ISurfaceGraphicsFactory graphicsFactory,
            List <WW.Math.Point3D> boundary,
            List <bool> edgeVisibleList)
        {
            Interface41 transformer = context.GetTransformer();
            Polyline4D  boundary1   = DxfUtil.smethod_46(new WW.Math.Geometry.Polyline3D((IList <WW.Math.Point3D>)boundary), transformer);

            Class940.smethod_20(entity, context, graphicsFactory, boundary1, edgeVisibleList);
        }
Ejemplo n.º 5
0
        public static void smethod_15(
            DxfEntity entity,
            DrawContext.Surface context,
            ISurfaceGraphicsFactory graphicsFactory,
            IList <WW.Math.Geometry.Polyline3D> polylines)
        {
            Interface41 transformer = context.GetTransformer();

            foreach (WW.Math.Geometry.Polyline3D polyline in (IEnumerable <WW.Math.Geometry.Polyline3D>)polylines)
            {
                Polyline4D polyline4D = DxfUtil.smethod_46(polyline, transformer);
                graphicsFactory.CreatePolyline((IList <Vector4D>)polyline4D, polyline.Closed);
            }
        }
Ejemplo n.º 6
0
        private static void smethod_9(
            DxfEntity entity,
            ISurfaceGraphicsFactory graphicsFactory,
            WW.Cad.Drawing.Polyline2D2N polyline2D,
            Interface41 transformer,
            Polyline4D polyline4DBottom,
            Polyline4D polyline4DTop)
        {
            int count            = polyline2D.Count;
            int startVertexIndex = polyline2D.Closed ? count - 1 : 0;

            for (int endVertexIndex = polyline2D.Closed ? 0 : 1; endVertexIndex < count; ++endVertexIndex)
            {
                Point2D2N point2D2N1 = polyline2D[startVertexIndex];
                Point2D2N point2D2N2 = point2D2N1;
                int       num1       = endVertexIndex;
                while (endVertexIndex < count)
                {
                    Point2D2N point2D2N3 = polyline2D[endVertexIndex];
                    if (!(point2D2N1.EndNormal != point2D2N3.StartNormal))
                    {
                        ++endVertexIndex;
                        point2D2N1 = point2D2N3;
                    }
                    else
                    {
                        break;
                    }
                }
                if (endVertexIndex == count)
                {
                    endVertexIndex = count - 1;
                }
                Vector3D[] vector3DArray = new Vector3D[endVertexIndex - num1 + 2];
                vector3DArray[0] = transformer.Transform((Vector3D)point2D2N2.StartNormal);
                vector3DArray[1] = transformer.Transform((Vector3D)point2D2N2.EndNormal);
                int num2   = num1;
                int index1 = 2;
                while (num2 < endVertexIndex)
                {
                    int index2 = num2 >= count ? 0 : num2;
                    vector3DArray[index1] = transformer.Transform((Vector3D)polyline2D[index2].EndNormal);
                    ++num2;
                    ++index1;
                }
                graphicsFactory.CreateQuadStrip((IList <Vector4D>)polyline4DBottom, (IList <Vector4D>)polyline4DTop, (IList <Vector3D>)vector3DArray, startVertexIndex, endVertexIndex);
                startVertexIndex = endVertexIndex;
            }
        }
Ejemplo n.º 7
0
        public override void DrawInternal(
            DrawContext.Surface context,
            ISurfaceGraphicsFactory graphicsFactory)
        {
            DxfImageDef imageDef = this.ImageDef;

            if (imageDef == null || !imageDef.Bitmap.IsValid)
            {
                return;
            }
            List <WW.Math.Point2D> clipBoundary = (List <WW.Math.Point2D>) this.GetClipBoundary((DrawContext)context);

            if (clipBoundary == null || clipBoundary.Count <= 0)
            {
                return;
            }
            List <Triangulator2D.Triangle> triangleList = new List <Triangulator2D.Triangle>();
            List <WW.Math.Point2D>         point2DList  = new List <WW.Math.Point2D>();

            Triangulator2D.Triangulate((IList <IList <WW.Math.Point2D> >) new List <WW.Math.Point2D>[1]
            {
                clipBoundary
            }, (IList <Triangulator2D.Triangle>)triangleList, (IList <WW.Math.Point2D>)point2DList);
            Interface41 nterface41   = (Interface41)context.GetTransformer().Clone();
            Matrix4D    preTransform = this.method_15();

            nterface41.SetPreTransform(preTransform);
            WW.Math.Point2D[] point2DArray        = new WW.Math.Point2D[point2DList.Count];
            Vector4D[]        vector4DArray       = new Vector4D[point2DList.Count];
            Size2D            referencedImageSize = this.ReferencedImageSize;
            double            num1     = 1.0 / referencedImageSize.X;
            double            num2     = 1.0 / referencedImageSize.Y;
            Vector2D          vector2D = new Vector2D(0.5, 0.5);

            for (int index = point2DList.Count - 1; index >= 0; --index)
            {
                WW.Math.Point2D point2D = point2DList[index] + vector2D;
                point2DArray[index]  = new WW.Math.Point2D(num1 * point2D.X, 1.0 - num2 * point2D.Y);
                vector4DArray[index] = nterface41.Transform(new WW.Math.Point3D(point2D.X, point2D.Y, 0.0));
            }
            byte[] rgbaBytes = imageDef.Bitmap.GetRgbaBytes();
            graphicsFactory.CreateTexturedTriangles(rgbaBytes, imageDef.Bitmap.Width, imageDef.Bitmap.Height, preTransform.Transform(WW.Math.Vector3D.ZAxis), (IList <Triangulator2D.Triangle>)triangleList, (IList <WW.Math.Point2D>)point2DArray, (IList <Vector4D>)vector4DArray);
        }
Ejemplo n.º 8
0
        public static void smethod_17(
            DxfEntity entity,
            DrawContext.Surface context,
            ISurfaceGraphicsFactory graphicsFactory,
            WW.Math.Geometry.Polyline3D polyline,
            bool isSurface)
        {
            Interface41 transformer = context.GetTransformer();
            Polyline4D  boundary    = DxfUtil.smethod_46(polyline, transformer);

            if (isSurface)
            {
                Class940.smethod_20(entity, context, graphicsFactory, boundary, (List <bool>)null);
            }
            else
            {
                graphicsFactory.CreatePolyline((IList <Vector4D>)boundary, polyline.Closed);
            }
        }
Ejemplo n.º 9
0
        public override void DrawInternal(
            DrawContext.Surface context,
            ISurfaceGraphicsFactory graphicsFactory)
        {
            Vector4D[,] polygonMesh = new Vector4D[(int)this.ushort_0, (int)this.ushort_1];
            Interface41 transformer = context.GetTransformer();
            int         index1      = 0;

            for (int index2 = 0; index2 < (int)this.ushort_0; ++index2)
            {
                int index3 = 0;
                while (index3 < (int)this.ushort_1)
                {
                    polygonMesh[index2, index3] = transformer.Transform(this.dxfHandledObjectCollection_1[index1].Position);
                    ++index3;
                    ++index1;
                }
            }
            graphicsFactory.SetColor(context.GetPlotColor((DxfEntity)this));
            graphicsFactory.CreatePolygonMesh(polygonMesh, this.ClosedInMDirection, this.ClosedInNDirection);
        }
Ejemplo n.º 10
0
 public void imethod_22(Interface41 interface41_1)
 {
     this.interface41_0 = interface41_1;
 }
Ejemplo n.º 11
0
        internal static void smethod_11(
            DxfEntity entity,
            DrawContext.Surface context,
            ISurfaceGraphicsFactory graphicsFactory,
            WW.Cad.Drawing.Polyline2D2N polylineA,
            WW.Cad.Drawing.Polyline2D2N polylineB,
            Matrix4D transform,
            Vector3D normal,
            bool isSurface)
        {
            Interface41 transformer = (Interface41)context.GetTransformer().Clone();

            transformer.SetPreTransform(transform);
            if (polylineA.Count == 1)
            {
                Point2D2N point2D2N1 = polylineA[0];
                Point2D2N point2D2N2 = polylineB[0];
                if (point2D2N1.Position == point2D2N2.Position)
                {
                    graphicsFactory.CreatePoint(transformer.Transform(point2D2N1.Position));
                }
                else
                {
                    graphicsFactory.CreateSegment(transformer.Transform(point2D2N1.Position), transformer.Transform(point2D2N2.Position));
                }
            }
            else if (polylineA.Count == 2)
            {
                Point2D2N  point2D2N1    = polylineA[0];
                Point2D2N  point2D2N2    = polylineA[1];
                Point2D2N  point2D2N3    = polylineB[0];
                Point2D2N  point2D2N4    = polylineB[1];
                Vector4D[] vector4DArray = new Vector4D[4] {
                    transformer.Transform(point2D2N1.Position), transformer.Transform(point2D2N2.Position), transformer.Transform(point2D2N4.Position), transformer.Transform(point2D2N3.Position)
                };
                if (isSurface)
                {
                    graphicsFactory.CreateQuad((IList <Vector4D>)vector4DArray, (IList <bool>)null);
                }
                else
                {
                    graphicsFactory.CreatePolyline((IList <Vector4D>)vector4DArray, true);
                }
            }
            else
            {
                int        count       = polylineA.Count;
                bool       closed      = polylineA.Closed;
                Polyline4D polyline4D1 = DxfUtil.smethod_47(polylineA, transformer);
                Polyline4D polyline4D2 = DxfUtil.smethod_47(polylineB, transformer);
                if (isSurface)
                {
                    graphicsFactory.CreateQuadStrip((IList <Vector4D>)polyline4D1, (IList <Vector4D>)polyline4D2, normal, closed);
                }
                else
                {
                    int index1 = 0;
                    int num    = 1;
                    if (closed)
                    {
                        index1 = count - 1;
                        num    = 0;
                    }
                    Vector4D start = polyline4D1[index1];
                    Vector4D end   = polyline4D2[index1];
                    for (int index2 = num; index2 < count; ++index2)
                    {
                        Vector4D vector4D1 = polyline4D1[index2];
                        Vector4D vector4D2 = polyline4D2[index2];
                        graphicsFactory.CreateSegment(start, end);
                        start = vector4D1;
                        end   = vector4D2;
                    }
                    graphicsFactory.CreatePolyline((IList <Vector4D>)polyline4D1, closed);
                    graphicsFactory.CreatePolyline((IList <Vector4D>)polyline4D2, closed);
                }
            }
        }
Ejemplo n.º 12
0
        internal static void smethod_8(
            DxfEntity entity,
            DrawContext.Surface context,
            ISurfaceGraphicsFactory graphicsFactory,
            WW.Cad.Drawing.Polyline2D2N polylineA,
            WW.Cad.Drawing.Polyline2D2N polylineB,
            bool isSurface,
            Matrix4D transform,
            Vector3D normal,
            double extrusion)
        {
            Interface41 transformer = (Interface41)context.GetTransformer().Clone();

            transformer.SetPreTransform(transform);
            Vector3D vector3D  = transformer.Transform(new Vector3D(0.0, 0.0, extrusion));
            Vector4D vector4D1 = (Vector4D)vector3D;

            if (polylineA.Count == 1)
            {
                Point2D2N point2D2N1 = polylineA[0];
                Point2D2N point2D2N2 = polylineB[0];
                if (point2D2N1.Position == point2D2N2.Position)
                {
                    Vector4D start = transformer.Transform((WW.Math.Point3D)point2D2N1.Position);
                    graphicsFactory.CreateSegment(start, start + vector4D1);
                }
                else
                {
                    Vector4D   vector4D2     = transformer.Transform(point2D2N1.Position);
                    Vector4D   vector4D3     = transformer.Transform(point2D2N2.Position);
                    Vector4D[] vector4DArray = new Vector4D[4] {
                        vector4D2, vector4D3, vector4D3 + vector4D1, vector4D2 + vector4D1
                    };
                    if (isSurface)
                    {
                        graphicsFactory.CreateQuad((IList <Vector4D>)vector4DArray, (IList <bool>)null);
                    }
                    else
                    {
                        graphicsFactory.CreatePolyline((IList <Vector4D>)vector4DArray, true);
                    }
                }
            }
            else if (polylineA.Count == 2)
            {
                Point2D2N  point2D2N1     = polylineA[0];
                Point2D2N  point2D2N2     = polylineA[1];
                Point2D2N  point2D2N3     = polylineB[0];
                Point2D2N  point2D2N4     = polylineB[1];
                Vector4D   vector4D2      = transformer.Transform(new WW.Math.Point3D(point2D2N1.Position, 0.0));
                Vector4D   vector4D3      = transformer.Transform(new WW.Math.Point3D(point2D2N2.Position, 0.0));
                Vector4D   vector4D4      = transformer.Transform(new WW.Math.Point3D(point2D2N3.Position, 0.0));
                Vector4D   vector4D5      = transformer.Transform(new WW.Math.Point3D(point2D2N4.Position, 0.0));
                Vector4D   vector4D6      = vector4D2 + vector4D1;
                Vector4D   vector4D7      = vector4D3 + vector4D1;
                Vector4D   vector4D8      = vector4D4 + vector4D1;
                Vector4D   vector4D9      = vector4D5 + vector4D1;
                Vector4D[] vector4DArray1 = new Vector4D[4] {
                    vector4D2, vector4D3, vector4D5, vector4D4
                };
                Vector4D[] vector4DArray2 = new Vector4D[4] {
                    vector4D6, vector4D7, vector4D9, vector4D8
                };
                if (isSurface)
                {
                    graphicsFactory.CreateQuad((IList <Vector4D>)vector4DArray1, (IList <bool>)null);
                    graphicsFactory.CreateQuad((IList <Vector4D>)vector4DArray2, (IList <bool>)null);
                    graphicsFactory.CreateQuad((IList <Vector4D>) new Vector4D[4]
                    {
                        vector4D2,
                        vector4D4,
                        vector4D8,
                        vector4D6
                    }, (IList <bool>)null);
                    graphicsFactory.CreateQuad((IList <Vector4D>) new Vector4D[4]
                    {
                        vector4D3,
                        vector4D5,
                        vector4D9,
                        vector4D7
                    }, (IList <bool>)null);
                    graphicsFactory.CreateQuadStrip((IList <Vector4D>) new Vector4D[2]
                    {
                        vector4D2,
                        vector4D3
                    }, (IList <Vector4D>) new Vector4D[2]
                    {
                        vector4D6,
                        vector4D7
                    }, (IList <Vector3D>) new Vector3D[2]
                    {
                        transformer.Transform(new Vector3D(point2D2N1.StartNormal, 0.0)),
                        transformer.Transform(new Vector3D(point2D2N1.EndNormal, 0.0))
                    }, 0, 1);
                    graphicsFactory.CreateQuadStrip((IList <Vector4D>) new Vector4D[2]
                    {
                        vector4D8,
                        vector4D9
                    }, (IList <Vector4D>) new Vector4D[2]
                    {
                        vector4D4,
                        vector4D5
                    }, (IList <Vector3D>) new Vector3D[2]
                    {
                        transformer.Transform(new Vector3D(point2D2N3.StartNormal, 0.0)),
                        transformer.Transform(new Vector3D(point2D2N3.EndNormal, 0.0))
                    }, 0, 1);
                }
                else
                {
                    graphicsFactory.CreatePolyline((IList <Vector4D>)vector4DArray1, true);
                    graphicsFactory.CreatePolyline((IList <Vector4D>)vector4DArray2, true);
                    for (int index = 0; index < 4; ++index)
                    {
                        graphicsFactory.CreateSegment(vector4DArray1[index], vector4DArray2[index]);
                    }
                }
            }
            else
            {
                int        count             = polylineA.Count;
                int        index1            = count - 1;
                bool       closed            = polylineA.Closed;
                Polyline4D polyline4DBottom1 = DxfUtil.smethod_47(polylineA, transformer);
                Polyline4D polyline4DTop1    = DxfUtil.smethod_47(polylineB, transformer);
                Polyline4D polyline4DTop2    = new Polyline4D(count, closed);
                Polyline4D polyline4DBottom2 = new Polyline4D(count, closed);
                for (int index2 = 0; index2 < count; ++index2)
                {
                    polyline4DTop2.Add(polyline4DBottom1[index2] + vector3D);
                    polyline4DBottom2.Add(polyline4DTop1[index2] + vector3D);
                }
                if (isSurface)
                {
                    graphicsFactory.CreateQuadStrip((IList <Vector4D>)polyline4DBottom1, (IList <Vector4D>)polyline4DTop1, normal, closed);
                    graphicsFactory.CreateQuadStrip((IList <Vector4D>)polyline4DTop2, (IList <Vector4D>)polyline4DBottom2, normal, closed);
                    if (!closed)
                    {
                        graphicsFactory.CreateQuad((IList <Vector4D>) new Vector4D[4]
                        {
                            polyline4DBottom1[0],
                            polyline4DTop2[0],
                            polyline4DBottom2[0],
                            polyline4DTop1[0]
                        }, (IList <bool>)null);
                        graphicsFactory.CreateQuad((IList <Vector4D>) new Vector4D[4]
                        {
                            polyline4DBottom1[index1],
                            polyline4DTop2[index1],
                            polyline4DBottom2[index1],
                            polyline4DTop1[index1]
                        }, (IList <bool>)null);
                    }
                    Class940.smethod_9(entity, graphicsFactory, polylineA, transformer, polyline4DBottom1, polyline4DTop2);
                    Class940.smethod_9(entity, graphicsFactory, polylineB, transformer, polyline4DBottom2, polyline4DTop1);
                    if (closed)
                    {
                        return;
                    }
                    Vector4D vector4D2 = polyline4DBottom1[0];
                    Vector4D vector4D3 = polyline4DTop1[0];
                    Vector4D vector4D4 = polyline4DTop2[0];
                    Vector4D vector4D5 = polyline4DBottom2[0];
                    graphicsFactory.CreateQuad((IList <Vector4D>) new Vector4D[4]
                    {
                        vector4D2,
                        vector4D3,
                        vector4D5,
                        vector4D4
                    }, (IList <bool>)null);
                    int      index2    = count - 1;
                    Vector4D vector4D6 = polyline4DBottom1[index2];
                    Vector4D vector4D7 = polyline4DTop1[index2];
                    Vector4D vector4D8 = polyline4DTop2[index2];
                    Vector4D vector4D9 = polyline4DBottom2[index2];
                    graphicsFactory.CreateQuad((IList <Vector4D>) new Vector4D[4]
                    {
                        vector4D6,
                        vector4D7,
                        vector4D9,
                        vector4D8
                    }, (IList <bool>)null);
                }
                else
                {
                    int index2 = 0;
                    int num    = 1;
                    if (closed)
                    {
                        index2 = count - 1;
                        num    = 0;
                    }
                    Vector4D start     = polyline4DBottom1[index2];
                    Vector4D vector4D2 = polyline4DTop1[index2];
                    Vector4D vector4D3 = polyline4DTop2[index2];
                    Vector4D end       = polyline4DBottom2[index2];
                    for (int index3 = num; index3 < count; ++index3)
                    {
                        Vector4D vector4D4 = polyline4DBottom1[index3];
                        Vector4D vector4D5 = polyline4DTop1[index3];
                        Vector4D vector4D6 = polyline4DTop2[index3];
                        Vector4D vector4D7 = polyline4DBottom2[index3];
                        graphicsFactory.CreateSegment(start, vector4D2);
                        graphicsFactory.CreateSegment(vector4D3, end);
                        graphicsFactory.CreateSegment(start, vector4D3);
                        graphicsFactory.CreateSegment(vector4D2, end);
                        start     = vector4D4;
                        vector4D2 = vector4D5;
                        vector4D3 = vector4D6;
                        end       = vector4D7;
                    }
                    graphicsFactory.CreatePolyline((IList <Vector4D>)polyline4DBottom1, closed);
                    graphicsFactory.CreatePolyline((IList <Vector4D>)polyline4DTop1, closed);
                    graphicsFactory.CreatePolyline((IList <Vector4D>)polyline4DTop2, closed);
                    graphicsFactory.CreatePolyline((IList <Vector4D>)polyline4DBottom2, closed);
                }
            }
        }
Ejemplo n.º 13
0
        internal static void smethod_6(
            DxfEntity entity,
            DrawContext.Surface context,
            ISurfaceGraphicsFactory graphicsFactory,
            WW.Cad.Drawing.Polyline2D2N polyline,
            bool isSurface,
            Matrix4D transform,
            Vector3D normal,
            double extrusion)
        {
            Interface41 transformer = (Interface41)context.GetTransformer().Clone();

            transformer.SetPreTransform(transform);
            Vector3D vector3D  = transformer.Transform(new Vector3D(0.0, 0.0, extrusion));
            Vector4D vector4D1 = (Vector4D)vector3D;

            if (polyline.Count == 1)
            {
                Point2D2N point2D2N = polyline[0];
                Vector4D  start     = transformer.Transform(point2D2N.Position);
                graphicsFactory.CreateSegment(start, start + vector4D1);
            }
            else if (polyline.Count == 2)
            {
                Point2D2N point2D2N1 = polyline[0];
                Point2D2N point2D2N2 = polyline[1];
                Vector4D  vector4D2  = transformer.Transform(point2D2N1.Position);
                Vector4D  vector4D3  = transformer.Transform(point2D2N2.Position);
                Vector4D  vector4D4  = vector4D2 + vector4D1;
                Vector4D  vector4D5  = vector4D3 + vector4D1;
                if (isSurface)
                {
                    graphicsFactory.CreateQuadStrip((IList <Vector4D>) new Vector4D[2]
                    {
                        vector4D2,
                        vector4D3
                    }, (IList <Vector4D>) new Vector4D[2]
                    {
                        vector4D4,
                        vector4D5
                    }, (IList <Vector3D>) new Vector3D[2]
                    {
                        transformer.Transform(new Vector3D(point2D2N1.StartNormal, 0.0)),
                        transformer.Transform(new Vector3D(point2D2N1.EndNormal, 0.0))
                    }, 0, 1);
                }
                else
                {
                    graphicsFactory.CreatePolyline((IList <Vector4D>) new Vector4D[4]
                    {
                        vector4D2,
                        vector4D3,
                        vector4D5,
                        vector4D4
                    }, true);
                }
            }
            else
            {
                int        count            = polyline.Count;
                bool       closed           = polyline.Closed;
                Polyline4D polyline4DBottom = DxfUtil.smethod_47(polyline, transformer);
                Polyline4D polyline4DTop    = new Polyline4D(count, closed);
                for (int index = 0; index < count; ++index)
                {
                    polyline4DTop.Add(polyline4DBottom[index] + vector3D);
                }
                if (isSurface)
                {
                    Class940.smethod_9(entity, graphicsFactory, polyline, transformer, polyline4DBottom, polyline4DTop);
                }
                else
                {
                    for (int index = 0; index < count; ++index)
                    {
                        Vector4D start = polyline4DBottom[index];
                        Vector4D end   = polyline4DTop[index];
                        graphicsFactory.CreateSegment(start, end);
                    }
                    graphicsFactory.CreatePolyline((IList <Vector4D>)polyline4DBottom, closed);
                    graphicsFactory.CreatePolyline((IList <Vector4D>)polyline4DTop, closed);
                }
            }
        }
Ejemplo n.º 14
0
        internal static void Extrude(
            DxfEntity entity,
            DrawContext.Surface context,
            ISurfaceGraphicsFactory graphicsFactory,
            WW.Math.Geometry.Polyline3D polyline,
            bool isSurface,
            Vector3D extrusion)
        {
            Interface41 transformer = context.GetTransformer();

            if (polyline.Count == 1)
            {
                WW.Math.Point3D start     = polyline[0];
                Segment4D       segment4D = DxfUtil.smethod_50(new Segment3D(start, start + extrusion), transformer);
                graphicsFactory.CreateSegment(segment4D.Start, segment4D.End);
            }
            else if (polyline.Count == 2)
            {
                WW.Math.Point3D point3D1 = polyline[0];
                WW.Math.Point3D point3D2 = polyline[1];
                Polyline4D      boundary = DxfUtil.smethod_46(new WW.Math.Geometry.Polyline3D(true, new WW.Math.Point3D[4] {
                    point3D1, point3D2, point3D2 + extrusion, point3D1 + extrusion
                }), transformer);
                Class940.smethod_20(entity, context, graphicsFactory, boundary, (List <bool>)null);
            }
            else if (isSurface)
            {
                Polyline4D boundary1 = DxfUtil.smethod_46(polyline, transformer);
                Class940.smethod_20(entity, context, graphicsFactory, boundary1, (List <bool>)null);
                WW.Math.Point3D             point3D1  = polyline[polyline.Count - 1];
                WW.Math.Point3D             point3D2  = point3D1 + extrusion;
                WW.Math.Geometry.Polyline3D polyline1 = new WW.Math.Geometry.Polyline3D(polyline.Count, polyline.Closed);
                for (int index = 0; index < polyline.Count; ++index)
                {
                    WW.Math.Point3D point3D3 = polyline[index];
                    WW.Math.Point3D point3D4 = point3D3 + extrusion;
                    polyline1.Add(point3D4);
                    Polyline4D boundary2 = DxfUtil.smethod_46(new WW.Math.Geometry.Polyline3D(true, new WW.Math.Point3D[4] {
                        point3D3, point3D1, point3D2, point3D4
                    }), transformer);
                    Class940.smethod_20(entity, context, graphicsFactory, boundary2, (List <bool>)null);
                    point3D1 = point3D3;
                    point3D2 = point3D4;
                }
                Polyline4D boundary3 = DxfUtil.smethod_46(polyline1, transformer);
                Class940.smethod_20(entity, context, graphicsFactory, boundary3, (List <bool>)null);
            }
            else
            {
                WW.Math.Point3D             point3D1   = polyline[polyline.Count - 1];
                WW.Math.Point3D             point3D2   = point3D1 + extrusion;
                WW.Math.Geometry.Polyline3D polyline3D = new WW.Math.Geometry.Polyline3D(polyline.Count, polyline.Closed);
                for (int index = 0; index < polyline.Count; ++index)
                {
                    WW.Math.Point3D point3D3 = polyline[index];
                    WW.Math.Point3D point3D4 = point3D3 + extrusion;
                    polyline3D.Add(point3D4);
                    Polyline4D boundary = DxfUtil.smethod_46(new WW.Math.Geometry.Polyline3D(true, new WW.Math.Point3D[4] {
                        point3D3, point3D1, point3D2, point3D4
                    }), transformer);
                    Class940.smethod_20(entity, context, graphicsFactory, boundary, (List <bool>)null);
                    point3D1 = point3D3;
                    point3D2 = point3D4;
                }
            }
        }
Ejemplo n.º 15
0
        private void method_0(
            IShape2D path,
            Color color,
            Matrix4D transform,
            bool filled,
            double extrusion,
            bool isChar)
        {
            if (!path.HasSegments)
            {
                return;
            }
            ISurfaceGraphicsFactory graphicsFactory0 = this.isurfaceGraphicsFactory_0;
            IList <Polyline2D>      flattened        = (IList <Polyline2D>)ShapeTool.GetFlattened(path, this.surface_0.Config.ShapeFlattenEpsilon);

            this.isurfaceGraphicsFactory_0.SetColor(this.surface_0.GetPlotColor(this.dxfEntity_0, color));
            Interface41 transformer = (Interface41)this.surface_0.GetTransformer().Clone();

            transformer.SetPreTransform(transform);
            if (!filled)
            {
                IList <Polyline4D> polyline4DList1 = DxfUtil.smethod_48(flattened, transformer);
                foreach (Polyline4D polyline4D in (IEnumerable <Polyline4D>)polyline4DList1)
                {
                    graphicsFactory0.CreatePolyline((IList <Vector4D>)polyline4D, polyline4D.Closed);
                }
                if (extrusion == 0.0)
                {
                    return;
                }
                transformer.SetPreTransform(Transformation4D.Translation(0.0, 0.0, extrusion));
                IList <Polyline4D> polyline4DList2 = DxfUtil.smethod_48(flattened, transformer);
                foreach (Polyline4D polyline4D in (IEnumerable <Polyline4D>)polyline4DList2)
                {
                    graphicsFactory0.CreatePolyline((IList <Vector4D>)polyline4D, polyline4D.Closed);
                }
                Polyline4D polyline4D1 = new Polyline4D(2);
                polyline4D1.Add(Vector4D.Zero);
                polyline4D1.Add(Vector4D.Zero);
                for (int index1 = polyline4DList1.Count - 1; index1 >= 0; --index1)
                {
                    Polyline4D polyline4D2 = polyline4DList1[index1];
                    Polyline4D polyline4D3 = polyline4DList2[index1];
                    for (int index2 = polyline4D2.Count - 1; index2 >= 0; --index2)
                    {
                        polyline4D1[0] = polyline4D2[index2];
                        polyline4D1[1] = polyline4D3[index2];
                        graphicsFactory0.CreatePolyline((IList <Vector4D>)polyline4D1, false);
                    }
                }
            }
            else
            {
                List <Triangulator2D.Triangle> triangleList;
                List <WW.Math.Point2D>         point2DList;
                if (isChar)
                {
                    Class454 class454 = this.surface_0.CharTriangulationCache.method_0(path, this.surface_0.Config);
                    triangleList = class454.Triangles;
                    point2DList  = class454.Points;
                }
                else
                {
                    triangleList = new List <Triangulator2D.Triangle>();
                    point2DList  = new List <WW.Math.Point2D>();
                    IList <IList <WW.Math.Point2D> > polygons = (IList <IList <WW.Math.Point2D> >) new List <IList <WW.Math.Point2D> >();
                    foreach (Polyline2D polyline2D in (IEnumerable <Polyline2D>)flattened)
                    {
                        polygons.Add((IList <WW.Math.Point2D>)polyline2D);
                    }
                    Triangulator2D.Triangulate(polygons, (IList <Triangulator2D.Triangle>)triangleList, (IList <WW.Math.Point2D>)point2DList);
                }
                Polyline2D polyline    = new Polyline2D((IEnumerable <WW.Math.Point2D>)point2DList);
                Polyline4D polyline4D1 = DxfUtil.smethod_49(polyline, transformer);
                if (extrusion == 0.0)
                {
                    for (int index = 0; index < triangleList.Count; ++index)
                    {
                        Triangulator2D.Triangle triangle = triangleList[index];
                        this.isurfaceGraphicsFactory_0.CreateTriangle(polyline4D1[triangle.I0], polyline4D1[triangle.I1], polyline4D1[triangle.I2], (IList <bool>)null);
                    }
                }
                else
                {
                    if (extrusion == 0.0)
                    {
                        return;
                    }
                    IList <Polyline4D> polyline4DList1 = DxfUtil.smethod_48(flattened, transformer);
                    transformer.SetPreTransform(Transformation4D.Translation(0.0, 0.0, extrusion));
                    Polyline4D         polyline4D2     = DxfUtil.smethod_49(polyline, transformer);
                    IList <Polyline4D> polyline4DList2 = DxfUtil.smethod_48(flattened, transformer);
                    if (extrusion > 0.0)
                    {
                        for (int index = 0; index < triangleList.Count; ++index)
                        {
                            Triangulator2D.Triangle triangle = triangleList[index];
                            this.isurfaceGraphicsFactory_0.CreateTriangle(polyline4D1[triangle.I0], polyline4D1[triangle.I2], polyline4D1[triangle.I1], (IList <bool>)null);
                        }
                        for (int index = 0; index < triangleList.Count; ++index)
                        {
                            Triangulator2D.Triangle triangle = triangleList[index];
                            this.isurfaceGraphicsFactory_0.CreateTriangle(polyline4D2[triangle.I0], polyline4D2[triangle.I1], polyline4D2[triangle.I2], (IList <bool>)null);
                        }
                    }
                    else
                    {
                        for (int index = 0; index < triangleList.Count; ++index)
                        {
                            Triangulator2D.Triangle triangle = triangleList[index];
                            this.isurfaceGraphicsFactory_0.CreateTriangle(polyline4D1[triangle.I0], polyline4D1[triangle.I1], polyline4D1[triangle.I2], (IList <bool>)null);
                        }
                        for (int index = 0; index < triangleList.Count; ++index)
                        {
                            Triangulator2D.Triangle triangle = triangleList[index];
                            this.isurfaceGraphicsFactory_0.CreateTriangle(polyline4D2[triangle.I0], polyline4D2[triangle.I2], polyline4D2[triangle.I1], (IList <bool>)null);
                        }
                    }
                    for (int index1 = polyline4DList1.Count - 1; index1 >= 0; --index1)
                    {
                        Polyline4D       polyline4D3 = polyline4DList1[index1];
                        Polyline4D       polyline4D4 = polyline4DList2[index1];
                        Polyline2D       polyline2D  = flattened[index1];
                        IList <Vector3D> normals     = (IList <Vector3D>) new List <Vector3D>(polyline4D3.Count + 1);
                        for (int index2 = 0; index2 < polyline4D3.Count; ++index2)
                        {
                            int      index3   = (index2 + 1) % polyline4D3.Count;
                            Vector2D vector2D = polyline2D[index3] - polyline2D[index2];
                            normals.Add(transformer.Transform(new Vector3D(vector2D.Y, -vector2D.X, 0.0)));
                        }
                        normals.Add(normals[0]);
                        this.isurfaceGraphicsFactory_0.CreateQuadStrip((IList <Vector4D>)polyline4D3, (IList <Vector4D>)polyline4D4, normals, 0, 0);
                    }
                }
            }
        }