Exemple #1
0
        public static NTSGeometry ToNTS(this IGeometry geometry)
        {
            var polygons = geometry.Polygons.ToArray();

            if (polygons.Length > 1)
            {
                return(new MultiPolygon(polygons.Select(ToNTS).ToArray()));
            }

            var singlePolygon = geometry.Polygons.First();
            var envelope      = singlePolygon.Shell.ToArray();

            if (envelope.Length == 1)
            {
                return(new NetTopologySuite.Geometries.Point(envelope[0].X, envelope[0].Y));
            }

            return(new NTSPolygon(FromPoints(envelope), singlePolygon.Holes.Select(FromPoints).ToArray()));
        }
Exemple #2
0
 /// <inheritdoc />
 public bool Equals(IGeometry other) => other is IPolygon polygon && Equals(polygon);
Exemple #3
0
 /// <inheritdoc />
 public bool Covers(IGeometry input) => _ntsPolygon.Value.Covers(input.ToNTS());