コード例 #1
0
        private IEnumerable <Path2D> convertToPaths(IEnumerable <IPolygon> polygons)
        {
            Path2D gp = new Path2D();

            foreach (IPolygon polygon in polygons)
            {
                if (polygon.IsEmpty)
                {
                    continue;
                }

                // Add the exterior polygon
                gp.NewFigure(convertCoordinates(polygon.ExteriorRing.Coordinates), true);

                // Add the interior polygons (holes)
                foreach (ILinearRing ring in polygon.InteriorRings)
                {
                    gp.NewFigure(convertCoordinates(ring.Coordinates), true);
                }
            }

            yield return(gp);
        }
コード例 #2
0
        // TODO: these next two methods would benefit from handling TCoordinates
        private IEnumerable <Path2D> convertToPaths(IEnumerable <ILineString> lines)
        {
            Path2D gp = new Path2D();

            foreach (ILineString line in lines)
            {
                if (line.IsEmpty || line.PointCount <= 1)
                {
                    continue;
                }

                gp.NewFigure(convertCoordinates(line.Coordinates), false);
            }

            yield return(gp);
        }