コード例 #1
0
        internal static void smethod_12(
            DrawContext context,
            IVertex2DCollection vertices,
            bool closed,
            Matrix4D transform,
            double thickness,
            double defaultStartWidth,
            double defaultEndWidth,
            WW.Cad.Drawing.Surface.Geometry geometry)
        {
            bool flag;

            if (flag = defaultStartWidth == 0.0 && defaultEndWidth == 0.0)
            {
                int num = closed ? vertices.Count : vertices.Count - 1;
                for (int index = 0; index < num; ++index)
                {
                    IVertex2D ivertex2D = vertices.GetIVertex2D(index);
                    if (ivertex2D.StartWidth != 0.0 || ivertex2D.EndWidth != 0.0)
                    {
                        flag = false;
                        break;
                    }
                }
            }
            if (flag)
            {
                if (thickness == 0.0)
                {
                    geometry.Add((IPrimitive) new WW.Cad.Drawing.Surface.Polyline2DE(Class639.Class640.smethod_0(vertices, context.Config, closed), transform));
                }
                else
                {
                    geometry.Add((IPrimitive) new WW.Cad.Drawing.Surface.Polyline2D2N(Class639.Class641.smethod_0(vertices, context.Config, closed), transform));
                }
            }
            else if (thickness == 0.0)
            {
                WW.Cad.Drawing.Polyline2D2WN wrappee = new Class639(defaultStartWidth, defaultEndWidth).method_0(vertices, context.Config, closed);
                if (wrappee == null || wrappee.Count <= 0)
                {
                    return;
                }
                geometry.Add((IPrimitive) new WW.Cad.Drawing.Surface.Polyline2D2WN(wrappee, context.Model.Header.FillMode, transform));
            }
            else
            {
                WW.Cad.Drawing.Polyline2D2WN wrappee = new Class639(defaultStartWidth, defaultEndWidth).method_0(vertices, context.Config, closed);
                if (wrappee == null || wrappee.Count <= 0)
                {
                    return;
                }
                geometry.Add((IPrimitive) new WW.Cad.Drawing.Surface.Polyline2D2WN(wrappee, context.Model.Header.FillMode, transform));
            }
        }
コード例 #2
0
ファイル: DxfPolyline2DSpline.cs プロジェクト: 15831944/WW
 private void method_14(
     DrawContext context,
     WW.Cad.Drawing.Surface.Geometry geometry,
     DxfPolyline2DSpline.Interface43 polylineProvider,
     bool allWidthsAreZero)
 {
     if (allWidthsAreZero)
     {
         if (this.Thickness == 0.0)
         {
             WW.Cad.Drawing.Polyline2DE wrappee = polylineProvider.imethod_0();
             geometry.Add((IPrimitive) new WW.Cad.Drawing.Surface.Polyline2DE(wrappee, this.Transform));
         }
         else
         {
             WW.Cad.Drawing.Polyline2D2N wrappee1 = polylineProvider.imethod_1();
             if (wrappee1.Count > 0)
             {
                 geometry.Add((IPrimitive) new WW.Cad.Drawing.Surface.Polyline2D2N(wrappee1, this.Transform));
             }
             else
             {
                 WW.Cad.Drawing.Polyline2DE wrappee2 = polylineProvider.imethod_0();
                 geometry.Add((IPrimitive) new WW.Cad.Drawing.Surface.Polyline2DE(wrappee2, this.Transform));
             }
         }
     }
     else if (this.Thickness == 0.0)
     {
         WW.Cad.Drawing.Polyline2D2WN wrappee1 = polylineProvider.imethod_2();
         if (wrappee1.Count > 0)
         {
             geometry.Add((IPrimitive) new WW.Cad.Drawing.Surface.Polyline2D2WN(wrappee1, context.Model.Header.FillMode, this.Transform));
         }
         else
         {
             WW.Cad.Drawing.Polyline2DE wrappee2 = polylineProvider.imethod_0();
             geometry.Add((IPrimitive) new WW.Cad.Drawing.Surface.Polyline2DE(wrappee2, this.Transform));
         }
     }
     else
     {
         WW.Cad.Drawing.Polyline2D2WN wrappee1 = polylineProvider.imethod_2();
         if (wrappee1.Count > 0)
         {
             geometry.Add((IPrimitive) new WW.Cad.Drawing.Surface.Polyline2D2WN(wrappee1, context.Model.Header.FillMode, this.Transform));
         }
         else
         {
             WW.Cad.Drawing.Polyline2DE wrappee2 = polylineProvider.imethod_0();
             geometry.Add((IPrimitive) new WW.Cad.Drawing.Surface.Polyline2DE(wrappee2, this.Transform));
         }
     }
 }
コード例 #3
0
 internal static void Extrude(
     WW.Cad.Drawing.Surface.Geometry geometry,
     IList <WW.Math.Geometry.Polyline3D> polylines,
     bool areSurfaces,
     Vector3D extrusion)
 {
     foreach (WW.Math.Geometry.Polyline3D polyline in (IEnumerable <WW.Math.Geometry.Polyline3D>)polylines)
     {
         Class940.Extrude(geometry, polyline, areSurfaces, extrusion);
     }
 }
コード例 #4
0
 public static void smethod_22(WW.Cad.Drawing.Surface.Geometry geometry, IList <WW.Math.Point3D> boundary)
 {
     if (boundary.Count == 0)
     {
         return;
     }
     if (boundary.Count == 1)
     {
         geometry.Add((IPrimitive) new WW.Cad.Drawing.Surface.Point(boundary[0]));
     }
     else if (boundary.Count == 2)
     {
         geometry.Add((IPrimitive) new WW.Cad.Drawing.Surface.Segment(boundary[0], boundary[1]));
     }
     else if (boundary.Count == 3)
     {
         geometry.Add((IPrimitive) new WW.Cad.Drawing.Surface.Triangle(boundary[0], boundary[1], boundary[2]));
     }
     else if (boundary.Count == 4)
     {
         geometry.Add((IPrimitive) new Quad(boundary[0], boundary[1], boundary[2], boundary[3]));
     }
     else
     {
         int       count     = boundary.Count;
         Polygon3D polygon3D = new Polygon3D(count);
         for (int index = 0; index < count; ++index)
         {
             polygon3D.Add(boundary[index]);
         }
         Plane3D?plane = polygon3D.GetPlane();
         if (!plane.HasValue)
         {
             return;
         }
         Matrix4D  matrix4D     = Transformation4D.Translation(plane.Value.Distance * plane.Value.Normal) * Transformation4D.GetArbitraryCoordSystem(plane.Value.Normal);
         Matrix4D  inverse      = matrix4D.GetInverse();
         Polygon2D projection2D = polygon3D.GetProjection2D(inverse);
         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 Polygon2D[1]
         {
             projection2D
         }, (IList <Triangulator2D.Triangle>)triangleList, (IList <WW.Math.Point2D>)point2DList);
         foreach (Triangulator2D.Triangle triangle in triangleList)
         {
             geometry.Add((IPrimitive) new WW.Cad.Drawing.Surface.Triangle(matrix4D.TransformTo3D(point2DList[triangle.I0]), matrix4D.TransformTo3D(point2DList[triangle.I1]), matrix4D.TransformTo3D(point2DList[triangle.I2])));
         }
     }
 }
コード例 #5
0
 internal static void Extrude(
     WW.Cad.Drawing.Surface.Geometry geometry,
     WW.Math.Geometry.Polyline3D polyline,
     bool isSurface,
     Vector3D extrusion)
 {
     if (polyline.Count == 1)
     {
         WW.Math.Point3D start = polyline[0];
         geometry.Add((IPrimitive) new WW.Cad.Drawing.Surface.Segment(start, start + extrusion));
     }
     else if (polyline.Count == 2)
     {
         WW.Math.Point3D v0 = polyline[0];
         WW.Math.Point3D v1 = polyline[1];
         geometry.Add((IPrimitive) new Quad(v0, v1, v1 + extrusion, v0 + extrusion));
     }
     else if (isSurface)
     {
         Class940.smethod_22(geometry, (IList <WW.Math.Point3D>)polyline);
         WW.Math.Point3D             v1         = polyline[polyline.Count - 1];
         WW.Math.Point3D             v2         = v1 + 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 v0 = polyline[index];
             WW.Math.Point3D v3 = v0 + extrusion;
             polyline3D.Add(v3);
             geometry.Add((IPrimitive) new Quad(v0, v1, v2, v3));
             v1 = v0;
             v2 = v3;
         }
         Class940.smethod_22(geometry, (IList <WW.Math.Point3D>)polyline3D);
     }
     else
     {
         WW.Math.Point3D             v1         = polyline[polyline.Count - 1];
         WW.Math.Point3D             v2         = v1 + 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 v0 = polyline[index];
             WW.Math.Point3D v3 = v0 + extrusion;
             polyline3D.Add(v3);
             geometry.Add((IPrimitive) new Quad(v0, v1, v2, v3));
             v1 = v0;
             v2 = v3;
         }
     }
 }
コード例 #6
0
 public static void smethod_21(
     DxfEntity entity,
     DrawContext.Surface context,
     WW.Cad.Drawing.Surface.Geometry geometry,
     WW.Math.Geometry.Polyline3D polyline,
     bool isSurface)
 {
     if (isSurface)
     {
         Class940.smethod_22(geometry, (IList <WW.Math.Point3D>)polyline);
     }
     else
     {
         geometry.Add(WW.Cad.Drawing.Surface.Polyline3D.CreatePrimitive(polyline));
     }
 }
コード例 #7
0
        internal static void smethod_13(
            DxfEntity entity,
            DrawContext.Surface context,
            WW.Cad.Drawing.Surface.Geometry geometry,
            IList <Polyline2D> polylinesA,
            IList <Polyline2D> polylinesB,
            Matrix4D transform,
            Vector3D normal,
            bool areSurfaces)
        {
            int count = polylinesA.Count;

            for (int index = 0; index < count; ++index)
            {
                Polyline2D polylineA = polylinesA[index];
                Polyline2D polylineB = polylinesB[index];
                Class940.smethod_14(entity, context, geometry, polylineA, polylineB, transform, normal, areSurfaces);
            }
        }
コード例 #8
0
 internal static void smethod_14(
     DxfEntity entity,
     DrawContext.Surface context,
     WW.Cad.Drawing.Surface.Geometry geometry,
     Polyline2D polylineA,
     Polyline2D polylineB,
     Matrix4D transform,
     Vector3D normal,
     bool isSurface)
 {
     if (polylineA.Count == 1)
     {
         WW.Math.Point2D point1 = polylineA[0];
         WW.Math.Point2D point2 = polylineB[0];
         if (point1 == point2)
         {
             geometry.Add((IPrimitive) new WW.Cad.Drawing.Surface.Point(transform.TransformTo3D(point1)));
         }
         else
         {
             geometry.Add((IPrimitive) new WW.Cad.Drawing.Surface.Segment(transform.TransformTo3D(point1), transform.TransformTo3D(point2)));
         }
     }
     else if (polylineA.Count == 2)
     {
         WW.Math.Point2D point1 = polylineA[0];
         WW.Math.Point2D point2 = polylineA[1];
         WW.Math.Point2D point3 = polylineB[0];
         WW.Math.Point2D point4 = polylineB[1];
         if (isSurface)
         {
             geometry.Add((IPrimitive) new Quad(transform.TransformTo3D(point1), transform.TransformTo3D(point2), transform.TransformTo3D(point4), transform.TransformTo3D(point3)));
         }
         else
         {
             geometry.Add(WW.Cad.Drawing.Surface.Polyline3D.CreatePrimitive((IList <WW.Math.Point3D>) new WW.Math.Point3D[4]
             {
                 transform.TransformTo3D(point1),
                 transform.TransformTo3D(point2),
                 transform.TransformTo3D(point4),
                 transform.TransformTo3D(point3)
             }, true));
         }
     }
     else
     {
         int  count  = polylineA.Count;
         bool closed = polylineA.Closed;
         WW.Math.Geometry.Polyline3D polyline3D1 = DxfUtil.smethod_42(polylineA, transform);
         WW.Math.Geometry.Polyline3D polyline3D2 = DxfUtil.smethod_42(polylineB, transform);
         if (isSurface)
         {
             geometry.Add((IPrimitive) new QuadStrip1((IList <WW.Math.Point3D>)polyline3D1, (IList <WW.Math.Point3D>)polyline3D2, normal, closed));
         }
         else
         {
             int index1 = 0;
             int num    = 1;
             if (closed)
             {
                 index1 = count - 1;
                 num    = 0;
             }
             WW.Math.Point3D start = polyline3D1[index1];
             WW.Math.Point3D end   = polyline3D2[index1];
             for (int index2 = num; index2 < count; ++index2)
             {
                 WW.Math.Point3D point3D1 = polyline3D1[index2];
                 WW.Math.Point3D point3D2 = polyline3D2[index2];
                 geometry.Add((IPrimitive) new WW.Cad.Drawing.Surface.Segment(start, end));
                 start = point3D1;
                 end   = point3D2;
             }
             geometry.Add(WW.Cad.Drawing.Surface.Polyline3D.CreatePrimitive((IList <WW.Math.Point3D>)polyline3D1, closed));
             geometry.Add(WW.Cad.Drawing.Surface.Polyline3D.CreatePrimitive((IList <WW.Math.Point3D>)polyline3D2, closed));
         }
     }
 }