public void WellKnownTextConverterGeometryTest() { foreach (IGeometry geometry in _geometries) { String wkt = WellKnownTextConverter.ToWellKnownText(geometry); IGeometry converted = WellKnownTextConverter.ToGeometry(wkt, _factory); Assert.AreEqual(0, new GeometryComparer().Compare(geometry, converted)); } }
public void WellKnownTextConverterToGeometryTest() { for (Int32 index = 0; index < this.geometries.Length; index++) { IGeometry geometry = WellKnownTextConverter.ToGeometry(this.geometriesText[index], this.factory); Assert.AreEqual(0, this.geometryComparer.Compare(geometry, this.geometries[index])); } IPoint point = WellKnownTextConverter.ToGeometry("POINT(1 1)", this.factory) as IPoint; Assert.AreEqual(new Coordinate(1, 1), point.Coordinate); point = WellKnownTextConverter.ToGeometry("POINT (1 1)", this.factory) as IPoint; Assert.AreEqual(new Coordinate(1, 1), point.Coordinate); point = WellKnownTextConverter.ToGeometry("POINT (1 1 1)", this.factory) as IPoint; Assert.AreEqual(new Coordinate(1, 1), point.Coordinate); point = WellKnownTextConverter.ToGeometry("POINT Z (1 1 1)", this.factory) as IPoint; Assert.AreEqual(new Coordinate(1, 1, 1), point.Coordinate); point = WellKnownTextConverter.ToGeometry("POINT M (1 1 1)", this.factory) as IPoint; Assert.AreEqual(new Coordinate(1, 1), point.Coordinate); point = WellKnownTextConverter.ToGeometry("POINT ZM (1 1 1 1)", this.factory) as IPoint; Assert.AreEqual(new Coordinate(1, 1, 1), point.Coordinate); point = WellKnownTextConverter.ToGeometry("POINT ZM(1 1 1 1)", this.factory) as IPoint; Assert.AreEqual(new Coordinate(1, 1, 1), point.Coordinate); point = WellKnownTextConverter.ToGeometry("POINT EMPTY", this.factory) as IPoint; Assert.AreEqual(Coordinate.Empty, point.Coordinate); point = WellKnownTextConverter.ToGeometry("POINT (0 0)", this.factory) as IPoint; Assert.AreEqual(Coordinate.Empty, point.Coordinate); point = WellKnownTextConverter.ToGeometry("POINT Z (0 0 0)", this.factory) as IPoint; Assert.AreEqual(Coordinate.Empty, point.Coordinate); Assert.Throws <ArgumentNullException>(() => WellKnownTextConverter.ToGeometry(null, this.factory)); Assert.Throws <ArgumentException>(() => WellKnownTextConverter.ToGeometry(String.Empty, this.factory)); Assert.Throws <ArgumentException>(() => WellKnownTextConverter.ToGeometry("UNDEFINED (0 0 0)", this.factory)); }