Пример #1
0
        private static IRing FlattenRing(IRing ring, FgfGeometryFactory factory)
        {
            CurveSegmentCollection curves = new CurveSegmentCollection();

            foreach (ICurveSegmentAbstract curve in ring.CurveSegments)
            {
                curves.Add(FlattenCurveSegment(curve, factory));
            }
            return(factory.CreateRing(curves));
        }
Пример #2
0
        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));
        }
Пример #3
0
 private static IRing FlattenRing(IRing ring, FgfGeometryFactory factory)
 {
     CurveSegmentCollection curves = new CurveSegmentCollection();
     foreach (ICurveSegmentAbstract curve in ring.CurveSegments)
     {
         curves.Add(FlattenCurveSegment(curve, factory));
     }
     return factory.CreateRing(curves);
 }