diff --git a/README.md b/README.md index 00f6855..bc0762d 100644 --- a/README.md +++ b/README.md @@ -73,6 +73,8 @@ wkx-sharp - https://github.com/cschwarz/wkx-sharp for handling geometries ## History +2023-08-30: release 1.2.1: add support for Geometry type as input (in addition of WKB) + 2023-08-30: release 1.2: add support for MultiPolygon 2020-09-01: release 1.1: to NET 6 diff --git a/src/triangulator/Triangulator.cs b/src/triangulator/Triangulator.cs index 45ba5cc..ddefb1f 100644 --- a/src/triangulator/Triangulator.cs +++ b/src/triangulator/Triangulator.cs @@ -8,24 +8,26 @@ namespace Triangulate { public static class Triangulator { - public static byte[] Triangulate(byte[] wkb) + public static Geometry Triangulate(Geometry geom) { - var geom = Geometry.Deserialize(wkb); - if (geom is PolyhedralSurface polyhedral) { - var triangulatedPolygon = Triangulate(polyhedral); - return triangulatedPolygon.AsBinary(); + return Triangulate(polyhedral); } else if (geom is MultiPolygon multiPolygon) { - var triangulatedPolygon = Triangulate(multiPolygon); - return triangulatedPolygon.AsBinary(); + return Triangulate(multiPolygon); } else { throw new NotSupportedException($"Geometry type {geom.GeometryType} is not supported"); } + } + public static byte[] Triangulate(byte[] wkb) + { + var geom = Geometry.Deserialize(wkb); + var result = Triangulate(geom); + return result.AsBinary(); } private static MultiPolygon Triangulate(MultiPolygon multipolygon) diff --git a/src/triangulator/triangulator.csproj b/src/triangulator/triangulator.csproj index 9c6b85f..4344270 100644 --- a/src/triangulator/triangulator.csproj +++ b/src/triangulator/triangulator.csproj @@ -13,11 +13,11 @@ wkb triangulate earcut MIT Bert Temme - 1.2 + 1.2.1 Add support for MultiPolygon Triangulate - 1.2 - 1.2 + 1.2.1 + 1.2.1