void WriteMultiSegment(MultiSegmentGeometry line) { IPointGeometry[] pts = line.Data; List <PolylineVertex> acVertexList = new List <PolylineVertex>(pts.Length); foreach (IPointGeometry p in pts) { acVertexList.Add(new PolylineVertex((float)p.X, (float)p.Y)); } Polyline acLine = new Polyline(acVertexList); acLine.Layer = m_Layer; m_Dxf.AddEntity(acLine); }
IRing GetRing(Ring r) { CurveSegmentCollection csc = new CurveSegmentCollection(); foreach (IDivider d in r.Edge) { LineGeometry line = d.LineGeometry; ICurveSegmentAbstract cseg = null; if (line is SectionGeometry) { SectionGeometry section = (line as SectionGeometry); line = section.Make(); } if (line is MultiSegmentGeometry) { MultiSegmentGeometry mseg = (line as MultiSegmentGeometry); DirectPositionCollection dpc = GetDirectPositions(mseg.Data); cseg = m_Factory.CreateLineStringSegment(dpc); } else if (line is SegmentGeometry) { SegmentGeometry segment = (line as SegmentGeometry); DirectPositionCollection dpc = GetDirectPositions(new IPosition[] { segment.Start, segment.End }); cseg = m_Factory.CreateLineStringSegment(dpc); } else if (line is ArcGeometry) { ArcGeometry arc = (line as ArcGeometry); IPosition mp = arc.GetMidPosition(); IDirectPosition bc = m_Factory.CreatePositionXY(arc.BC.X, arc.BC.Y); IDirectPosition mid = m_Factory.CreatePositionXY(mp.X, mp.Y); IDirectPosition ec = m_Factory.CreatePositionXY(arc.EC.X, arc.EC.Y); cseg = m_Factory.CreateCircularArcSegment(bc, mid, ec); } else { throw new NotSupportedException("Unknown line type: " + line.GetType().Name); } csc.Add(cseg); } return(m_Factory.CreateRing(csc)); }
/// <summary> /// Loads a list of positions with data for this line. /// </summary> /// <param name="positions">The list to append to</param> /// <param name="reverse">Should the data be appended in reverse order?</param> /// <param name="wantFirst">Should the first position be appended? (last if <paramref name="reverse"/> is true)</param> /// <param name="arcTol">Tolerance for approximating circular arcs (the maximum chord-to-circumference distance).</param> internal override void AppendPositions(List <IPosition> positions, bool reverse, bool wantFirst, ILength arcTol) { IPointGeometry[] approx = CircularArcGeometry.GetApproximation(this, arcTol); MultiSegmentGeometry.AppendPositions(approx, positions, reverse, wantFirst); }
void WriteMultiSegment(MultiSegmentGeometry line) { IPointGeometry[] pts = line.Data; List<PolylineVertex> acVertexList = new List<PolylineVertex>(pts.Length); foreach (IPointGeometry p in pts) acVertexList.Add(new PolylineVertex((float)p.X, (float)p.Y)); Polyline acLine = new Polyline(acVertexList); acLine.Layer = m_Layer; m_Dxf.AddEntity(acLine); }