예제 #1
0
 private static ICircularArcSegment FlattenCircularArcSegment(ICircularArcSegment circularArc, FgfGeometryFactory factory)
 {
     return(factory.CreateCircularArcSegment(
                FlattenPosition(circularArc.StartPosition, factory),
                FlattenPosition(circularArc.MidPoint, factory),
                FlattenPosition(circularArc.EndPosition, factory)));
 }
예제 #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 ICircularArcSegment FlattenCircularArcSegment(ICircularArcSegment circularArc, FgfGeometryFactory factory)
 {
     return factory.CreateCircularArcSegment(
         FlattenPosition(circularArc.StartPosition, factory),
         FlattenPosition(circularArc.MidPoint, factory),
         FlattenPosition(circularArc.EndPosition, factory));
 }