public void GetBoundary_ReturnsEmptyMultiPointForClosedLineString() { LineString target = new LineString(_coordinatesXYZ); target.Coordinates.Add(target.Coordinates[0]); IMultiPoint boundary = target.GetBoundary() as IMultiPoint; Assert.NotNull(boundary); Assert.Empty(boundary.Geometries); }
public void GetBoundary_ReturnsMultipointWithStartAndEndPointsAndCorrectSRID() { int srid = 1111; LineString target = new LineString(srid, _coordinatesXYZM); IMultiPoint boundary = target.GetBoundary() as IMultiPoint; Assert.NotNull(boundary); Assert.Equal(srid, boundary.Srid); Assert.Equal(target.Start, boundary.Geometries.First().Position); Assert.Equal(target.End, boundary.Geometries.Last().Position); }
public void test_GetBoundary() { //try on a simple-open linestring LineString ls = SimpleOpen(); Geometry geom = ls.GetBoundary(); Assertion.AssertEquals("GetBoundary-1: ", false, geom.IsEmpty()); Assertion.AssertEquals("GetBoundary-2: ", 2, geom.GetNumPoints()); GeometryFactory gf = new GeometryFactory(_precMod, _sRID); MultiPoint mp = gf.CreateMultiPoint(geom.GetCoordinates()); for (int i = 0; i < mp.GetNumPoints(); i++) { switch (i) { case 0: Assertion.AssertEquals("GetBoundary-3: ", 1.0, mp.GetCoordinate(i).X); Assertion.AssertEquals("GetBoundary-4: ", 1.0, mp.GetCoordinate(i).Y); break; case 1: Assertion.AssertEquals("GetBoundary-5: ", 9.0, mp.GetCoordinate(i).X); Assertion.AssertEquals("GetBoundary-6: ", 22.0, mp.GetCoordinate(i).Y); break; default: Assertion.Fail("This should never be reached"); break; } } //try on a simple-closed linestring ls = SimpleClosed(); geom = ls.GetBoundary(); Assertion.AssertEquals("GetBoundary-7: ", true, geom.IsEmpty()); Assertion.AssertEquals("GetBoundary-8: ", 0, geom.GetNumPoints()); //try on a nonsimple-open linestring ls = NonSimpleOpen(); geom = ls.GetBoundary(); Assertion.AssertEquals("GetBoundary-9: ", false, geom.IsEmpty()); Assertion.AssertEquals("GetBoundary-10: ", 2, geom.GetNumPoints()); mp = gf.CreateMultiPoint(geom.GetCoordinates()); for (int i = 0; i < mp.GetNumPoints(); i++) { switch (i) { case 0: Assertion.AssertEquals("GetBoundary-11: ", 2.0, mp.GetCoordinate(i).X); Assertion.AssertEquals("GetBoundary-12: ", 2.0, mp.GetCoordinate(i).Y); break; case 1: Assertion.AssertEquals("GetBoundary-13: ", 3.0, mp.GetCoordinate(i).X); Assertion.AssertEquals("GetBoundary-14: ", 9.0, mp.GetCoordinate(i).Y); break; default: Assertion.Fail("This should never be reached"); break; } } //try on a simple-closed linestring ls = NonSimpleClosed(); geom = ls.GetBoundary(); Assertion.AssertEquals("GetBoundary-15: ", true, geom.IsEmpty()); Assertion.AssertEquals("GetBoundary-16: ", 0, geom.GetNumPoints()); }