[geos-commits] r3179 - in trunk: include/geos/geom/util src/algorithm src/geom src/geom/util src/geomgraph src/io src/operation src/operation/valid

svn_geos at osgeo.org svn_geos at osgeo.org
Thu Feb 3 14:59:23 EST 2011


Author: strk
Date: 2011-02-03 11:59:23 -0800 (Thu, 03 Feb 2011)
New Revision: 3179

Modified:
   trunk/include/geos/geom/util/GeometryEditor.h
   trunk/include/geos/geom/util/GeometryTransformer.h
   trunk/src/algorithm/CentroidPoint.cpp
   trunk/src/geom/GeometryCollection.cpp
   trunk/src/geom/MultiPolygon.cpp
   trunk/src/geom/Point.cpp
   trunk/src/geom/util/GeometryEditor.cpp
   trunk/src/geom/util/GeometryTransformer.cpp
   trunk/src/geomgraph/GeometryGraph.cpp
   trunk/src/io/WKBWriter.cpp
   trunk/src/io/WKTWriter.cpp
   trunk/src/operation/IsSimpleOp.cpp
   trunk/src/operation/valid/IsValidOp.cpp
   trunk/src/operation/valid/RepeatedPointTester.cpp
Log:
reduce static casts

Modified: trunk/include/geos/geom/util/GeometryEditor.h
===================================================================
--- trunk/include/geos/geom/util/GeometryEditor.h	2011-02-03 19:58:58 UTC (rev 3178)
+++ trunk/include/geos/geom/util/GeometryEditor.h	2011-02-03 19:59:23 UTC (rev 3179)
@@ -4,14 +4,19 @@
  * GEOS - Geometry Engine Open Source
  * http://geos.refractions.net
  *
+ * Copyright (C) 2011 Sandro Santilli <strk at keybit.net>
+ * Copyright (C) 2006 Refractions Research Inc.
  * Copyright (C) 2001-2002 Vivid Solutions Inc.
- * Copyright (C) 2006 Refractions Research Inc.
  *
  * This is free software; you can redistribute and/or modify it under
  * the terms of the GNU Lesser General Public Licence as published
  * by the Free Software Foundation. 
  * See the COPYING file for more information.
  *
+ **********************************************************************
+ *
+ * Last port: geom/util/GeometryEditor.java r320 (JTS-1.12)
+ *
  **********************************************************************/
 
 #ifndef GEOS_GEOM_UTIL_GEOMETRYEDITOR_H

Modified: trunk/include/geos/geom/util/GeometryTransformer.h
===================================================================
--- trunk/include/geos/geom/util/GeometryTransformer.h	2011-02-03 19:58:58 UTC (rev 3178)
+++ trunk/include/geos/geom/util/GeometryTransformer.h	2011-02-03 19:59:23 UTC (rev 3179)
@@ -4,6 +4,7 @@
  * GEOS - Geometry Engine Open Source
  * http://geos.refractions.net
  *
+ * Copyright (C) 2011 Sandro Santilli <strk at keybit.net>
  * Copyright (C) 2006 Refractions Research Inc.
  *
  * This is free software; you can redistribute and/or modify it under
@@ -13,7 +14,7 @@
  *
  **********************************************************************
  *
- * Last port: geom/util/GeometryTransformer.java rev. 1.6 (JTS-1.7.1+)
+ * Last port: geom/util/GeometryTransformer.java r320 (JTS-1.12)
  *
  **********************************************************************/
 

Modified: trunk/src/algorithm/CentroidPoint.cpp
===================================================================
--- trunk/src/algorithm/CentroidPoint.cpp	2011-02-03 19:58:58 UTC (rev 3178)
+++ trunk/src/algorithm/CentroidPoint.cpp	2011-02-03 19:59:23 UTC (rev 3179)
@@ -31,16 +31,17 @@
 void
 CentroidPoint::add(const Geometry *geom)
 {
-	if (typeid(*geom)==typeid(Point)) {
-		add(geom->getCoordinate());
-	} else if ((typeid(*geom)==typeid(GeometryCollection)) ||
-				(typeid(*geom)==typeid(MultiPoint))) {
-		GeometryCollection *gc=(GeometryCollection*) geom;
-		for(std::size_t i=0, n=gc->getNumGeometries(); i<n; ++i)
-		{
-			add(gc->getGeometryN(i));
-		}
-	}
+  if ( const Point *p = dynamic_cast<const Point*>(geom) )
+  {
+		add(p->getCoordinate());
+  }
+  else if ( const GeometryCollection *gc =
+            dynamic_cast<const GeometryCollection*>(geom) )
+  {
+    for(std::size_t i=0, n=gc->getNumGeometries(); i<n; ++i) {
+      add(gc->getGeometryN(i));
+    }
+  }
 }
 
 void

Modified: trunk/src/geom/GeometryCollection.cpp
===================================================================
--- trunk/src/geom/GeometryCollection.cpp	2011-02-03 19:58:58 UTC (rev 3178)
+++ trunk/src/geom/GeometryCollection.cpp	2011-02-03 19:59:23 UTC (rev 3179)
@@ -253,9 +253,10 @@
 }
 
 int
-GeometryCollection::compareToSameClass(const Geometry *gc) const
+GeometryCollection::compareToSameClass(const Geometry *g) const
 {
-	return compare(*geometries, *(((GeometryCollection*)gc)->geometries));
+  const GeometryCollection* gc = dynamic_cast<const GeometryCollection*>(g);
+	return compare(*geometries, *(gc->geometries));
 }
 
 const Coordinate*

Modified: trunk/src/geom/MultiPolygon.cpp
===================================================================
--- trunk/src/geom/MultiPolygon.cpp	2011-02-03 19:58:58 UTC (rev 3178)
+++ trunk/src/geom/MultiPolygon.cpp	2011-02-03 19:59:23 UTC (rev 3179)
@@ -72,14 +72,13 @@
 		Polygon *pg=dynamic_cast<Polygon *>((*geometries)[i]);
 		assert(pg);
 		Geometry *g=pg->getBoundary();
-		LineString *ls=dynamic_cast<LineString *>(g);
-		if ( ls )
+		if ( LineString *ls=dynamic_cast<LineString *>(g) )
 		{
 			allRings->push_back(ls);
 		}
 		else
 		{
-			GeometryCollection* rings=(GeometryCollection*)g;
+			GeometryCollection* rings=dynamic_cast<GeometryCollection*>(g);
 			for (size_t j=0, jn=rings->getNumGeometries();
 					j<jn; ++j)
 			{

Modified: trunk/src/geom/Point.cpp
===================================================================
--- trunk/src/geom/Point.cpp	2011-02-03 19:58:58 UTC (rev 3178)
+++ trunk/src/geom/Point.cpp	2011-02-03 19:59:23 UTC (rev 3179)
@@ -237,9 +237,10 @@
 }
 
 int
-Point::compareToSameClass(const Geometry *point) const
+Point::compareToSameClass(const Geometry *g) const
 {
-	return getCoordinate()->compareTo(*(((Point*)point)->getCoordinate()));
+	const Point* p = dynamic_cast<const Point*>(g);
+	return getCoordinate()->compareTo(*(p->getCoordinate()));
 }
 
 Point::~Point()

Modified: trunk/src/geom/util/GeometryEditor.cpp
===================================================================
--- trunk/src/geom/util/GeometryEditor.cpp	2011-02-03 19:58:58 UTC (rev 3178)
+++ trunk/src/geom/util/GeometryEditor.cpp	2011-02-03 19:59:23 UTC (rev 3179)
@@ -4,6 +4,8 @@
  * GEOS - Geometry Engine Open Source
  * http://geos.refractions.net
  *
+ * Copyright (C) 2011 Sandro Santilli <strk at keybit.net>
+ * Copyright (C) 2006 Refractions Research Inc.
  * Copyright (C) 2001-2002 Vivid Solutions Inc.
  *
  * This is free software; you can redistribute and/or modify it under
@@ -11,6 +13,10 @@
  * by the Free Software Foundation. 
  * See the COPYING file for more information.
  *
+ **********************************************************************
+ *
+ * Last port: geom/util/GeometryEditor.java r320 (JTS-1.12)
+ *
  **********************************************************************/
 
 #include <geos/geom/util/GeometryEditor.h>
@@ -71,24 +77,27 @@
 	// if client did not supply a GeometryFactory, use the one from the input Geometry
 	if (factory == NULL)
 		factory=geometry->getFactory();
-	if ((typeid(*geometry)==typeid(GeometryCollection)) ||
-				(typeid(*geometry)==typeid(MultiPoint)) ||
-				(typeid(*geometry)==typeid(MultiPolygon)) ||
-				(typeid(*geometry)==typeid(MultiLineString))) {
-		return editGeometryCollection((const GeometryCollection*) geometry, operation);
-	}
 
-	if (typeid(*geometry)==typeid(Polygon)) {
-		return editPolygon((Polygon*) geometry, operation);
-	}
+  if ( const GeometryCollection *gc =
+            dynamic_cast<const GeometryCollection*>(geometry) )
+  {
+		return editGeometryCollection(gc, operation);
+  }
 
-	if (typeid(*geometry)==typeid(Point)) {
+  if ( const Polygon *p = dynamic_cast<const Polygon*>(geometry) )
+  {
+		return editPolygon(p, operation);
+  }
+
+  if ( dynamic_cast<const Point*>(geometry) )
+  {
 		return operation->edit(geometry, factory);
-	}
+  }
 
-	if (typeid(*geometry)==typeid(LineString) || typeid(*geometry)==typeid(LinearRing)) {
+  if ( dynamic_cast<const LineString*>(geometry) )
+  {
 		return operation->edit(geometry, factory);
-	}
+  }
 
     // Unsupported Geometry classes should be caught in the GeometryEditorOperation.
     assert(!"SHOULD NEVER GET HERE");
@@ -137,7 +146,7 @@
 GeometryCollection*
 GeometryEditor::editGeometryCollection(const GeometryCollection *collection, GeometryEditorOperation *operation)
 {
-	GeometryCollection *newCollection = (GeometryCollection*) operation->edit(collection,factory);
+	GeometryCollection *newCollection = dynamic_cast<GeometryCollection*>( operation->edit(collection,factory) );
 	vector<Geometry*> *geometries = new vector<Geometry*>();
 	for (unsigned int i=0, n=newCollection->getNumGeometries(); i<n; i++)
 	{

Modified: trunk/src/geom/util/GeometryTransformer.cpp
===================================================================
--- trunk/src/geom/util/GeometryTransformer.cpp	2011-02-03 19:58:58 UTC (rev 3178)
+++ trunk/src/geom/util/GeometryTransformer.cpp	2011-02-03 19:59:23 UTC (rev 3179)
@@ -4,6 +4,7 @@
  * GEOS - Geometry Engine Open Source
  * http://geos.refractions.net
  *
+ * Copyright (C) 2011 Sandro Santilli <strk at keybit.net>
  * Copyright (C) 2006 Refractions Research Inc.
  *
  * This is free software; you can redistribute and/or modify it under
@@ -13,7 +14,7 @@
  *
  **********************************************************************
  *
- * Last port: geom/util/GeometryTransformer.java rev. 1.6 (JTS-1.7.1+)
+ * Last port: geom/util/GeometryTransformer.java r320 (JTS-1.12)
  *
  **********************************************************************/
 
@@ -155,9 +156,8 @@
 
 	for (unsigned int i=0, n=geom->getNumGeometries(); i<n; i++)
 	{
-		assert(dynamic_cast<const Point*>(geom->getGeometryN(i)));
-		const Point* p = static_cast<const Point*>(
-				geom->getGeometryN(i));
+		const Point* p = dynamic_cast<const Point*>(geom->getGeometryN(i));
+		assert(p);
 
 		Geometry::AutoPtr transformGeom = transformPoint(p, geom);
 		if ( transformGeom.get() == NULL ) continue;

Modified: trunk/src/geomgraph/GeometryGraph.cpp
===================================================================
--- trunk/src/geomgraph/GeometryGraph.cpp	2011-02-03 19:58:58 UTC (rev 3178)
+++ trunk/src/geomgraph/GeometryGraph.cpp	2011-02-03 19:59:23 UTC (rev 3179)
@@ -179,28 +179,22 @@
 		useBoundaryDeterminationRule = false;
 
 
-	if ( dynamic_cast<const Polygon*>(g) )
-		addPolygon((Polygon*) g);
+	if ( const Polygon* x = dynamic_cast<const Polygon*>(g) )
+		addPolygon(x);
 
 	// LineString also handles LinearRings
-	else if ( dynamic_cast<const LineString*>(g) )
-		addLineString((LineString*) g);
+	else if ( const LineString* x = dynamic_cast<const LineString*>(g) )
+		addLineString(x);
 
-	else if ( dynamic_cast<const Point*>(g) )
-		addPoint((Point*) g);
+	else if ( const Point* x = dynamic_cast<const Point*>(g) )
+		addPoint(x);
 
-	else if ( dynamic_cast<const MultiPoint*>(g) )
-		addCollection((MultiPoint*) g);
+	else if ( const GeometryCollection* x =
+            dynamic_cast<const GeometryCollection*>(g) )
+  {
+		addCollection(x);
+  }
 
-	else if ( dynamic_cast<const MultiLineString*>(g) )
-		addCollection((MultiLineString*) g);
-
-	else if ( dynamic_cast<const MultiPolygon*>(g) )
-		addCollection((MultiPolygon*) g);
-
-	else if ( dynamic_cast<const GeometryCollection*>(g) )
-		addCollection((GeometryCollection*) g);
-
 	else {
 		string out=typeid(*g).name();
 		throw util::UnsupportedOperationException("GeometryGraph::add(Geometry *): unknown geometry type: "+out);

Modified: trunk/src/io/WKBWriter.cpp
===================================================================
--- trunk/src/io/WKBWriter.cpp	2011-02-03 19:58:58 UTC (rev 3178)
+++ trunk/src/io/WKBWriter.cpp	2011-02-03 19:59:23 UTC (rev 3179)
@@ -89,33 +89,43 @@
 
 	outStream = &os;
 
-	switch (g.getGeometryTypeId()) {
-		case GEOS_POINT:
-			return writePoint((Point &)g);
-		case GEOS_LINESTRING:
-		case GEOS_LINEARRING:
-			return writeLineString((LineString &)g);
-		case GEOS_POLYGON:
-			return writePolygon((Polygon &)g);
-		case GEOS_MULTIPOINT:
-			return writeGeometryCollection(
-				(GeometryCollection &)g,
-				WKBConstants::wkbMultiPoint);
-		case GEOS_MULTILINESTRING:
-			return writeGeometryCollection(
-				(GeometryCollection &)g,
-				WKBConstants::wkbMultiLineString);
-		case GEOS_MULTIPOLYGON:
-			return writeGeometryCollection(
-				(GeometryCollection &)g,
-				WKBConstants::wkbMultiPolygon);
-		case GEOS_GEOMETRYCOLLECTION:
-			return writeGeometryCollection(
-				(GeometryCollection &)g,
-				WKBConstants::wkbGeometryCollection);
-		default:
-			assert(0); // Unknown Geometry type
-	}
+  if ( const Point* x = dynamic_cast<const Point*>(&g) )
+  {
+    return writePoint(*x);
+  }
+
+  if ( const LineString* x = dynamic_cast<const LineString*>(&g) )
+  {
+    return writeLineString(*x);
+  }
+
+  if ( const Polygon* x = dynamic_cast<const Polygon*>(&g) )
+  {
+    return writePolygon(*x);
+  }
+
+  if ( const MultiPoint* x = dynamic_cast<const MultiPoint*>(&g) )
+  {
+    return writeGeometryCollection(*x, WKBConstants::wkbMultiPoint);
+  }
+
+  if ( const MultiLineString* x = dynamic_cast<const MultiLineString*>(&g) )
+  { 
+    return writeGeometryCollection(*x, WKBConstants::wkbMultiLineString);
+  }
+
+  if ( const MultiPolygon* x = dynamic_cast<const MultiPolygon*>(&g) )
+  {
+    return writeGeometryCollection(*x, WKBConstants::wkbMultiPolygon);
+  }
+
+  if ( const GeometryCollection* x = 
+       dynamic_cast<const GeometryCollection*>(&g) )
+  {
+    return writeGeometryCollection(*x, WKBConstants::wkbGeometryCollection);
+  }
+
+  assert(0); // Unknown Geometry type
 }
 
 void

Modified: trunk/src/io/WKTWriter.cpp
===================================================================
--- trunk/src/io/WKTWriter.cpp	2011-02-03 19:58:58 UTC (rev 3178)
+++ trunk/src/io/WKTWriter.cpp	2011-02-03 19:59:23 UTC (rev 3179)
@@ -206,31 +206,53 @@
 WKTWriter::appendGeometryTaggedText(const Geometry *geometry, int level,
 		Writer *writer)
 {
-    outputDimension = min(defaultOutputDimension,geometry->getCoordinateDimension());
+  outputDimension = min( defaultOutputDimension,
+                         geometry->getCoordinateDimension() );
 
-	indent(level, writer);
-	if (typeid(*geometry)==typeid(Point)) {
-		Point* point=(Point*)geometry;
-		appendPointTaggedText(point->getCoordinate(),level,writer);
-	} else if (typeid(*geometry)==typeid(LinearRing)) {
-		appendLinearRingTaggedText((LinearRing*) geometry, level, writer);
-	} else if (typeid(*geometry)==typeid(LineString)) {
-		appendLineStringTaggedText((LineString*)geometry, level, writer);
-	} else if (typeid(*geometry)==typeid(LinearRing)) {
-		appendLinearRingTaggedText((LinearRing*)geometry, level, writer);
-	} else if (typeid(*geometry)==typeid(Polygon)) {
-		appendPolygonTaggedText((Polygon*)geometry, level, writer);
-	} else if (typeid(*geometry)==typeid(MultiPoint)) {
-		appendMultiPointTaggedText((MultiPoint*)geometry, level, writer);
-	} else if (typeid(*geometry)==typeid(MultiLineString)) {
-		appendMultiLineStringTaggedText((MultiLineString*)geometry, level, writer);
-	} else if (typeid(*geometry)==typeid(MultiPolygon)) {
-		appendMultiPolygonTaggedText((MultiPolygon*)geometry, level, writer);
-	} else if (typeid(*geometry)==typeid(GeometryCollection)) {
-		appendGeometryCollectionTaggedText((GeometryCollection*)geometry, level, writer);
-	} else {
-		assert(0); // Unsupported Geometry implementation
-	}
+  indent(level, writer);
+  if ( const Point* point = dynamic_cast<const Point*>(geometry) )
+  {
+    appendPointTaggedText(point->getCoordinate(),level,writer);
+  }
+  else if ( const LinearRing* lr =
+    dynamic_cast<const LinearRing*>(geometry) )
+  {
+    appendLinearRingTaggedText(lr, level, writer);
+  }
+  else if ( const LineString* ls =
+    dynamic_cast<const LineString*>(geometry) )
+  {
+    appendLineStringTaggedText(ls, level, writer);
+  }
+  else if ( const Polygon* x =
+    dynamic_cast<const Polygon*>(geometry) )
+  {
+    appendPolygonTaggedText(x, level, writer);
+  }
+  else if ( const MultiPoint* x =
+    dynamic_cast<const MultiPoint*>(geometry) )
+  {
+    appendMultiPointTaggedText(x, level, writer);
+  }
+  else if ( const MultiLineString* x =
+    dynamic_cast<const MultiLineString*>(geometry) )
+  {
+    appendMultiLineStringTaggedText(x, level, writer);
+  }
+  else if ( const MultiPolygon* x =
+    dynamic_cast<const MultiPolygon*>(geometry) )
+  {
+    appendMultiPolygonTaggedText(x, level, writer);
+  }
+  else if ( const GeometryCollection* x =
+    dynamic_cast<const GeometryCollection*>(geometry) )
+  {
+    appendGeometryCollectionTaggedText(x, level, writer);
+  }
+  else
+  {
+    assert(0); // Unsupported Geometry implementation
+  }
 }
 
 /*protected*/
@@ -465,7 +487,7 @@
 				writer->write(", ");
 			}
 			appendCoordinate(
-				((Point* )multiPoint->getGeometryN(i))->getCoordinate(),
+				dynamic_cast<const Point*>(multiPoint->getGeometryN(i))->getCoordinate(),
 				writer);
 		}
 		writer->write(")");

Modified: trunk/src/operation/IsSimpleOp.cpp
===================================================================
--- trunk/src/operation/IsSimpleOp.cpp	2011-02-03 19:58:58 UTC (rev 3178)
+++ trunk/src/operation/IsSimpleOp.cpp	2011-02-03 19:59:23 UTC (rev 3179)
@@ -153,8 +153,8 @@
 
 	for (std::size_t i=0, n=mp.getNumGeometries(); i<n; ++i)
 	{
-		assert(dynamic_cast<const Point*>(mp.getGeometryN(i)));
-		const Point *pt=static_cast<const Point*>(mp.getGeometryN(i));
+		const Point *pt = dynamic_cast<const Point*>(mp.getGeometryN(i));
+		assert(pt);
 		const Coordinate *p=pt->getCoordinate();
 		if (points.find(p) != points.end())
 		{

Modified: trunk/src/operation/valid/IsValidOp.cpp
===================================================================
--- trunk/src/operation/valid/IsValidOp.cpp	2011-02-03 19:58:58 UTC (rev 3178)
+++ trunk/src/operation/valid/IsValidOp.cpp	2011-02-03 19:59:23 UTC (rev 3179)
@@ -129,15 +129,22 @@
 	// empty geometries are always valid!
 	if (g->isEmpty()) return;
 
-	const GeometryCollection *gc;
-
-	if (typeid(*g)==typeid(Point)) checkValid((Point *)g);
-	else if (typeid(*g)==typeid(LinearRing)) checkValid((LinearRing*)g);
-	else if (typeid(*g)==typeid(LineString)) checkValid((LineString*)g);
-	else if (typeid(*g)==typeid(Polygon)) checkValid((Polygon*)g);
-	else if (typeid(*g)==typeid(MultiPolygon)) checkValid((MultiPolygon*)g);
-	else if (0 != (gc=dynamic_cast<const GeometryCollection *>(g)))
-		checkValid(gc);
+	if ( const Point* x = dynamic_cast<const Point*>(g) )
+    checkValid(x);
+  // LineString also handles LinearRings, so we check LinearRing first
+	else if ( const LinearRing* x = dynamic_cast<const LinearRing*>(g) )
+    checkValid(x);
+	else if ( const LineString* x = dynamic_cast<const LineString*>(g) )
+    checkValid(x);
+	else if ( const Polygon* x = dynamic_cast<const Polygon*>(g) )
+    checkValid(x);
+	else if ( const MultiPolygon* x = dynamic_cast<const MultiPolygon*>(g) )
+    checkValid(x);
+	else if ( const GeometryCollection* x =
+        dynamic_cast<const GeometryCollection*>(g) )
+  {
+		checkValid(x);
+  }
 	else throw util::UnsupportedOperationException();
 }
 

Modified: trunk/src/operation/valid/RepeatedPointTester.cpp
===================================================================
--- trunk/src/operation/valid/RepeatedPointTester.cpp	2011-02-03 19:58:58 UTC (rev 3178)
+++ trunk/src/operation/valid/RepeatedPointTester.cpp	2011-02-03 19:59:23 UTC (rev 3179)
@@ -48,16 +48,37 @@
 RepeatedPointTester::hasRepeatedPoint(const Geometry *g)
 {
 	if (g->isEmpty()) return false;
-	if (typeid(*g)==typeid(Point)) return false;
-	else if (typeid(*g)==typeid(MultiPoint)) return false;
+
+	if ( dynamic_cast<const Point*>(g) ) return false;
+	if ( dynamic_cast<const MultiPoint*>(g) ) return false;
+
 	// LineString also handles LinearRings
-	else if (typeid(*g)==typeid(LineString)) return hasRepeatedPoint(((LineString*)g)->getCoordinatesRO());
-	else if (typeid(*g)==typeid(LinearRing)) return hasRepeatedPoint(((LineString*)g)->getCoordinatesRO());
-	else if (typeid(*g)==typeid(Polygon)) return hasRepeatedPoint((Polygon*)g);
-	else if (typeid(*g)==typeid(MultiPolygon)) return hasRepeatedPoint((MultiPolygon*)g);
-	else if (typeid(*g)==typeid(MultiLineString)) return hasRepeatedPoint((MultiLineString*)g);
-	else if (typeid(*g)==typeid(GeometryCollection)) return hasRepeatedPoint((GeometryCollection*)g);
-	else  throw util::UnsupportedOperationException(typeid(*g).name());
+	if ( const LineString* x = dynamic_cast<const LineString*>(g) ) 
+  {
+    return hasRepeatedPoint(x->getCoordinatesRO());
+  }
+
+	if ( const Polygon* x = dynamic_cast<const Polygon*>(g) ) 
+  {
+    return hasRepeatedPoint(x);
+  }
+
+	if ( const MultiPolygon* x = dynamic_cast<const MultiPolygon*>(g) ) 
+  {
+    return hasRepeatedPoint(x);
+  }
+
+	if ( const MultiLineString* x = dynamic_cast<const MultiLineString*>(g) ) 
+  {
+    return hasRepeatedPoint(x);
+  }
+
+	if ( const GeometryCollection* x = dynamic_cast<const GeometryCollection*>(g) ) 
+  {
+    return hasRepeatedPoint(x);
+  }
+
+	throw util::UnsupportedOperationException(typeid(*g).name());
 }
 
 bool



More information about the geos-commits mailing list