public void Test2() { IGeometry geom = _wktReader.Read("POLYGON ((0 0, 0 10, 4 10, 4 8, 6 8, 6 10, 10 10, 10 0, 0 0))"); ConformingDelaunayTriangulationBuilder dtb = new ConformingDelaunayTriangulationBuilder(); dtb.SetSites(geom); IMultiLineString resultEdges = dtb.GetEdges(geom.Factory); Console.WriteLine(resultEdges.AsText()); IGeometryCollection resultTriangles = dtb.GetTriangles(geom.Factory); Console.WriteLine(resultTriangles.AsText()); }
public void ParseGeometryCollection() { string geomCollection = "GEOMETRYCOLLECTION(POINT(10 10),POINT(30 30),LINESTRING(15 15,20 20))"; IGeometryCollection geom = GeometryFromWKT.Parse(geomCollection) as IGeometryCollection; Assert.IsNotNull(geom); Assert.AreEqual(3, geom.NumGeometries); Assert.IsTrue(geom[0] is IPoint); Assert.IsTrue(geom[1] is IPoint); Assert.IsTrue(geom[2] is ILineString); Assert.AreEqual(geomCollection, geom.AsText()); geom = GeometryFromWKT.Parse("GEOMETRYCOLLECTION EMPTY") as IGeometryCollection; Assert.IsNotNull(geom); Assert.AreEqual(0, geom.NumGeometries); geomCollection = "GEOMETRYCOLLECTION(POINT(10 10),LINESTRING EMPTY,POINT(20 49))"; geom = GeometryFromWKT.Parse(geomCollection) as IGeometryCollection; Assert.IsNotNull(geom); Assert.IsTrue(geom[1].IsEmpty); Assert.AreEqual(3, geom.NumGeometries); Assert.AreEqual(geomCollection, geom.AsText()); Assert.AreEqual("GEOMETRYCOLLECTION EMPTY", GeometryFactory.CreateGeometryCollection().AsText()); }