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)); }
private static ILineStringSegment FlattenLineStringSegment(ILineStringSegment lineStrSegment, FgfGeometryFactory factory) { double[] positions = new double[lineStrSegment.Count * 2]; int j = 0; for (int i = 0; i < lineStrSegment.Count; i++) { IDirectPosition pos = lineStrSegment[i]; positions[j] = pos.X; positions[j + 1] = pos.Y; j += 2; } return(factory.CreateLineStringSegment(FDO_DIM_XY, positions.Length, positions)); }
private static ILineStringSegment FlattenLineStringSegment(ILineStringSegment lineStrSegment, FgfGeometryFactory factory) { double[] positions = new double[lineStrSegment.Count * 2]; int j = 0; for (int i = 0; i < lineStrSegment.Count; i++) { IDirectPosition pos = lineStrSegment[i]; positions[j] = pos.X; positions[j+1] = pos.Y; j += 2; } return factory.CreateLineStringSegment(FDO_DIM_XY, positions.Length, positions); }