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)); }
public void CopyFrom(DxfMLine.Segment.Element from, CloneContext cloneContext) { this.list_0.AddRange((IEnumerable <double>)from.list_0); this.list_1.AddRange((IEnumerable <double>)from.list_1); }
public DxfMLine.Segment.Element Clone(CloneContext cloneContext) { DxfMLine.Segment.Element element = new DxfMLine.Segment.Element(); element.CopyFrom(this, cloneContext); return(element); }
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); }
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); }