WktParser { public Geometry parse(String wkt) { if (wkt != null) { tempWkt = wkt; if (skip(org.geomajas.geometry.Geometry.MULTI_POLYGON.toUpperCase())) { return parseMultiPolygon(); } else if (skip(org.geomajas.geometry.Geometry.POLYGON.toUpperCase())) { return parsePolygon(); } else if (skip(org.geomajas.geometry.Geometry.MULTI_LINE_STRING.toUpperCase())) { return parseMultiLineString(); } else if (skip(org.geomajas.geometry.Geometry.MULTI_POINT.toUpperCase())) { return parseMultiPoint(); } else if (skip(org.geomajas.geometry.Geometry.LINE_STRING.toUpperCase())) { return parseLineString(); } else if (skip(org.geomajas.geometry.Geometry.POINT.toUpperCase())) { return parsePoint(); } } return null; } WktParser(int srid); Geometry parse(String wkt);  }
@Test public void testPoint() { Geometry geometry = parser.parse(POINT); Assert.assertNotNull(geometry); Assert.assertTrue(geometry instanceof Point); }
@Test public void testLineString() { Geometry geometry = parser.parse(LINESTRING); Assert.assertNotNull(geometry); Assert.assertTrue(geometry instanceof LineString); }
@Test public void testPolygon() { Geometry geometry = parser.parse(POLYGON); Assert.assertNotNull(geometry); Assert.assertTrue(geometry instanceof Polygon); }
@Test public void testMultiPoint() { Geometry geometry = parser.parse(MULTIPOINT); Assert.assertNotNull(geometry); Assert.assertTrue(geometry instanceof MultiPoint); }
@Test public void testMultiLineString() { Geometry geometry = parser.parse(MULTILINESTRING); Assert.assertNotNull(geometry); Assert.assertTrue(geometry instanceof MultiLineString); }
@Test public void testMultiPolygon() { Geometry geometry = parser.parse(MULTIPOLYGON); Assert.assertNotNull(geometry); Assert.assertTrue(geometry instanceof MultiPolygon); }
@Test public void testMultiPolygon2() { Geometry geometry = parser.parse(MULTIPOLYGON1); Assert.assertNotNull(geometry); Assert.assertTrue(geometry instanceof MultiPolygon); MultiPolygon mp = (MultiPolygon) geometry; Assert.assertEquals(2, mp.getNumGeometries()); geometry = parser.parse(MULTIPOLYGON2); Assert.assertNotNull(geometry); Assert.assertTrue(geometry instanceof MultiPolygon); mp = (MultiPolygon) geometry; Assert.assertEquals(1, mp.getNumGeometries()); Polygon polygon = (Polygon) mp.getGeometryN(0); Assert.assertEquals(1, polygon.getNumInteriorRing()); }
@Test public void testMultiLineString2() { Geometry geometry = parser.parse(MULTILINESTRING1); Assert.assertNotNull(geometry); Assert.assertTrue(geometry instanceof MultiLineString); MultiLineString mp = (MultiLineString) geometry; Assert.assertEquals(1, mp.getNumGeometries()); }