Esempio n. 1
0
        private static IEnumerable <PolygonShape> ToPolygons(this AreaBaseShape area)
        {
            Collection <PolygonShape> results = null;

            PolygonShape      polygon           = area as PolygonShape;
            MultipolygonShape multipolygonShape = area as MultipolygonShape;

            if (polygon != null)
            {
                results = new Collection <PolygonShape> {
                    polygon
                };
            }
            else if (multipolygonShape != null)
            {
                results = multipolygonShape.Polygons;
            }
            else
            {
                var polygonShape = area.GetType().GetMethod("ToPolygon").Invoke(null, null) as PolygonShape;
                results = new Collection <PolygonShape> {
                    polygonShape
                };
            }

            return(results);
        }
Esempio n. 2
0
        private static AreaBaseShape ToPolygonOrMultiPolygon(this AreaBaseShape area)
        {
            AreaBaseShape result = null;

            PolygonShape      polygon           = area as PolygonShape;
            MultipolygonShape multipolygonShape = area as MultipolygonShape;

            if (polygon != null)
            {
                result = polygon;
            }
            else if (multipolygonShape != null)
            {
                result = multipolygonShape;
            }
            else
            {
                result = area.GetType().GetMethod("ToPolygon").Invoke(null, null) as PolygonShape;
            }

            return(result);
        }