Exemple #1
0
        private WW.Cad.Drawing.Polyline2DE method_25(
            DxfVertex2DCollection points,
            bool isInterpolated)
        {
            bool closed = this.Closed;
            int  count  = points.Count;

            WW.Cad.Drawing.Polyline2DE polyline2De = new WW.Cad.Drawing.Polyline2DE(count, closed);
            if (count > 0)
            {
                DxfVertex2D dxfVertex2D = points[0];
                polyline2De.Add(new Point2DE(dxfVertex2D.Position)
                {
                    IsInterpolatedPoint = isInterpolated
                });
                for (int index = 1; index < count; ++index)
                {
                    DxfVertex2D point = points[index];
                    if (!(dxfVertex2D.Position == point.Position))
                    {
                        polyline2De.Add(new Point2DE(point.Position)
                        {
                            IsInterpolatedPoint = isInterpolated
                        });
                        dxfVertex2D = point;
                    }
                }
                if (closed && count > 1 && polyline2De[0].Position == polyline2De[polyline2De.Count - 1].Position)
                {
                    polyline2De.RemoveAt(polyline2De.Count - 1);
                }
            }
            return(polyline2De);
        }
Exemple #2
0
        public override IList <Polygon2D> GetClipBoundary(GraphicsConfig graphicsConfig)
        {
            WW.Cad.Drawing.Polyline2DE polyline2De = (WW.Cad.Drawing.Polyline2DE)null;
            switch (this.splineType_0)
            {
            case SplineType.None:
                if (!graphicsConfig.ShowSplineApproximationPoints)
                {
                    polyline2De = this.method_19();
                    break;
                }
                break;

            case SplineType.QuadraticBSpline:
                polyline2De = this.method_28(2, (int)graphicsConfig.NoOfSplineLineSegments);
                break;

            case SplineType.CubicBSpline:
                polyline2De = this.method_28(3, (int)graphicsConfig.NoOfSplineLineSegments);
                break;
            }
            if (polyline2De == null)
            {
                return((IList <Polygon2D>) new Polygon2D[0]);
            }
            Polygon2D polygon2D = new Polygon2D(polyline2De.Count);

            foreach (Point2DE point2De in (List <Point2DE>)polyline2De)
            {
                polygon2D.Add(point2De.Position);
            }
            return((IList <Polygon2D>) new Polygon2D[1] {
                polygon2D
            });
        }
Exemple #3
0
 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));
         }
     }
 }
Exemple #4
0
        public override IList <Polygon2D> GetClipBoundary(GraphicsConfig graphicsConfig)
        {
            WW.Cad.Drawing.Polyline2DE polyline2De = Class639.Class640.smethod_0((IVertex2DCollection)this.dxfVertex2DCollection_0, graphicsConfig, this.Closed);
            Polygon2D polygon2D = new Polygon2D(polyline2De.Count);

            foreach (Point2DE point2De in (List <Point2DE>)polyline2De)
            {
                polygon2D.Add(point2De.Position);
            }
            return((IList <Polygon2D>) new Polygon2D[1] {
                polygon2D
            });
        }
Exemple #5
0
        private WW.Cad.Drawing.Polyline2DE method_28(int power, int noOfSplineLineParts)
        {
            WW.Cad.Drawing.Polyline2DE polyline2De = new WW.Cad.Drawing.Polyline2DE();
            int count = this.dxfVertex2DCollection_0.Count;

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

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

            while (num3 < num1)
            {
                int knotSpanIndex = bsplineD.GetKnotSpanIndex(u);
                bsplineD.EvaluateBasisFunctions(knotSpanIndex, u, result);
                WW.Math.Point2D zero = WW.Math.Point2D.Zero;
                for (int index = 0; index <= power; ++index)
                {
                    DxfVertex2D dxfVertex2D = this.dxfVertex2DCollection_0[(knotSpanIndex - power + index) % count];
                    zero += result[index] * new Vector2D(dxfVertex2D.Position);
                }
                Point2DE point2De = new Point2DE(zero)
                {
                    IsInterpolatedPoint = true
                };
                polyline2De.Add(point2De);
                ++num3;
                u += num2;
            }
            return(polyline2De);
        }
Exemple #6
0
 public double GetLength()
 {
     return(Polyline2DE.GetLength((IList <Point2DE>) this, this.Closed));
 }