Esempio n. 1
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);
                }
            }
        }
Esempio n. 2
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);
                }
            }
        }