예제 #1
0
        private static IGeometryObject toGeometry(this PatternPairMatch wktPattern)
        {
            switch (wktPattern.Left.Groups[1].Value.ToLower())
            {
            case "point":
                return(wktPattern.toPoint());

            case "polygon":
                return(wktPattern.toPolygon());

            case "linestring":
                return(wktPattern.toLineString());

            case "multipolygon":
                return(wktPattern.toMultiPolygon());

            case "multipoint":
                return(wktPattern.toMultiPoint());

            case "multilinestring":
                return(wktPattern.toMultiLineString());

            case "geometrycollection":
                return(wktPattern.toGeometryCollection());

            default:
                throw new Exception($@"Unable to Parse Geometry Type '{wktPattern.Left.Groups[1].Value}'");
            }
        }
예제 #2
0
        private static MultiPoint toMultiPoint(this PatternPairMatch match)
        {
            IEnumerable <Point> points;

            if (match.Children.Count > 0)
            {
                points = match.Children.Select(pointMatch => new Point(WktPointToPosition(pointMatch.Content)));
            }
            else
            {
                points = WktPointsToPositions(match.Content).Select(position => new Point(position));
            }
            // only 1 level of points
            return(new MultiPoint(points));
        }
예제 #3
0
 private static GeometryCollection toGeometryCollection(this PatternPairMatch match)
 {
     return(new GeometryCollection(match.Children.Select(geometry => geometry.toGeometry())));
 }
예제 #4
0
 private static MultiPolygon toMultiPolygon(this PatternPairMatch match)
 {
     // 2 levels of points
     return(new MultiPolygon(match.Children.Select(polygonMatch => polygonMatch.toPolygon())));
 }
예제 #5
0
 private static Polygon toPolygon(this PatternPairMatch match)
 {
     // 2 levels of points
     return(new Polygon(match.Children.Select(lineStringMatch => lineStringMatch.toLineString())));
 }
예제 #6
0
 private static MultiLineString toMultiLineString(this PatternPairMatch match)
 {
     // only 1 level of points
     return(new MultiLineString(match.Children.Select(lineStringMatch => lineStringMatch.toLineString())));
 }
예제 #7
0
 private static LineString toLineString(this PatternPairMatch match)
 {
     // only 1 level of points
     return(new LineString(match.Content.WktPointsToPositions()));
 }
예제 #8
0
 private static Point toPoint(this PatternPairMatch match)
 {
     return(new Point(WktPointToPosition(match.Content)));
 }