[geos-commits] r2544 - in trunk/source: geomgraph headers/geos/geomgraph

svn_geos at osgeo.org svn_geos at osgeo.org
Fri Jun 5 07:03:53 EDT 2009


Author: strk
Date: 2009-06-05 07:03:53 -0400 (Fri, 05 Jun 2009)
New Revision: 2544

Modified:
   trunk/source/geomgraph/Depth.cpp
   trunk/source/geomgraph/GeometryGraph.cpp
   trunk/source/geomgraph/GraphComponent.cpp
   trunk/source/geomgraph/NodeMap.cpp
   trunk/source/geomgraph/PlanarGraph.cpp
   trunk/source/headers/geos/geomgraph/Depth.h
   trunk/source/headers/geos/geomgraph/EdgeEnd.h
   trunk/source/headers/geos/geomgraph/EdgeEndStar.h
   trunk/source/headers/geos/geomgraph/EdgeList.h
   trunk/source/headers/geos/geomgraph/GeometryGraph.h
   trunk/source/headers/geos/geomgraph/GeometryGraph.inl
   trunk/source/headers/geos/geomgraph/GraphComponent.h
   trunk/source/headers/geos/geomgraph/Node.h
   trunk/source/headers/geos/geomgraph/NodeMap.h
   trunk/source/headers/geos/geomgraph/PlanarGraph.h
Log:
Port info in the geomgraph package (unfinished); fix compiler warning in GeometryGraph and make code more readable;


Modified: trunk/source/geomgraph/Depth.cpp
===================================================================
--- trunk/source/geomgraph/Depth.cpp	2009-06-05 10:23:23 UTC (rev 2543)
+++ trunk/source/geomgraph/Depth.cpp	2009-06-05 11:03:53 UTC (rev 2544)
@@ -12,6 +12,10 @@
  * by the Free Software Foundation. 
  * See the COPYING file for more information.
  *
+ **********************************************************************
+ *
+ * Last port: geomgraph/Depth.java rev. 1.4 (JTS-1.10)
+ *
  **********************************************************************/
 
 #include <sstream>
@@ -22,7 +26,7 @@
 #include <geos/geomgraph/Position.h>
 #include <geos/geom/Location.h>
 
-#define DEPTHNULL -1
+#define NULL_VALUE -1
 
 using namespace std;
 using namespace geos::geom;
@@ -35,7 +39,7 @@
 {
 	if (location == Location::EXTERIOR) return 0;
 	if (location == Location::INTERIOR) return 1;
-	return DEPTHNULL;
+	return NULL_VALUE;
 }
 
 Depth::Depth()
@@ -43,7 +47,7 @@
 	// initialize depth array to a sentinel value
 	for (int i=0; i<2; i++) {
 		for (int j=0; j<3;j++) {
-			depth[i][j]=DEPTHNULL;
+			depth[i][j]=NULL_VALUE;
 		}
 	}
 }
@@ -87,7 +91,7 @@
 {
 	for (int i=0; i<2; i++) {
 		for (int j=0; j<3; j++) {
-			if (depth[i][j] != DEPTHNULL)
+			if (depth[i][j] != NULL_VALUE)
 				return false;
 		}
 	}
@@ -97,13 +101,13 @@
 bool
 Depth::isNull(int geomIndex) const
 {
-	return depth[geomIndex][1] == DEPTHNULL;
+	return depth[geomIndex][1] == NULL_VALUE;
 }
 
 bool
 Depth::isNull(int geomIndex, int posIndex) const
 {
-	return depth[geomIndex][posIndex] == DEPTHNULL;
+	return depth[geomIndex][posIndex] == NULL_VALUE;
 }
 
 int

Modified: trunk/source/geomgraph/GeometryGraph.cpp
===================================================================
--- trunk/source/geomgraph/GeometryGraph.cpp	2009-06-05 10:23:23 UTC (rev 2543)
+++ trunk/source/geomgraph/GeometryGraph.cpp	2009-06-05 11:03:53 UTC (rev 2544)
@@ -12,6 +12,10 @@
  * by the Free Software Foundation. 
  * See the COPYING file for more information.
  *
+ **********************************************************************
+ *
+ * Last port: geomgraph/GeometryGraph.java rev. 1.5 (JTS-1.7)
+ *
  **********************************************************************/
 
 #include <geos/algorithm/CGAlgorithms.h>
@@ -167,30 +171,35 @@
 	//throw (UnsupportedOperationException *)
 {
 	if (g->isEmpty()) return;
+
 	// check if this Geometry should obey the Boundary Determination Rule
 	// all collections except MultiPolygons obey the rule
-    // FIXME - mloskot: Make this condition readable and use paranthesis
-	if ((typeid(*g)==typeid(GeometryCollection)) ||
-			   (typeid(*g)==typeid(MultiPoint)) ||
-			   (typeid(*g)==typeid(MultiLineString)) &&
-			   !(typeid(*g)==typeid(MultiPolygon)))
-			useBoundaryDeterminationRule=true;
-	if (typeid(*g)==typeid(Polygon))
+	if ( dynamic_cast<const MultiPolygon*>(g) )
+		useBoundaryDeterminationRule = false;
+
+
+	if ( dynamic_cast<const Polygon*>(g) )
 		addPolygon((Polygon*) g);
-	else if (typeid(*g)==typeid(LineString))
+
+	// LineString also handles LinearRings
+	else if ( dynamic_cast<const LineString*>(g) )
 		addLineString((LineString*) g);
-	else if (typeid(*g)==typeid(LinearRing))
-		addLineString((LineString*) g);
-	else if (typeid(*g)==typeid(Point))
+
+	else if ( dynamic_cast<const Point*>(g) )
 		addPoint((Point*) g);
-	else if (typeid(*g)==typeid(MultiPoint))
+
+	else if ( dynamic_cast<const MultiPoint*>(g) )
 		addCollection((MultiPoint*) g);
-	else if (typeid(*g)==typeid(MultiLineString))
+
+	else if ( dynamic_cast<const MultiLineString*>(g) )
 		addCollection((MultiLineString*) g);
-	else if (typeid(*g)==typeid(MultiPolygon))
+
+	else if ( dynamic_cast<const MultiPolygon*>(g) )
 		addCollection((MultiPolygon*) g);
-	else if (typeid(*g)==typeid(GeometryCollection))
+
+	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/source/geomgraph/GraphComponent.cpp
===================================================================
--- trunk/source/geomgraph/GraphComponent.cpp	2009-06-05 10:23:23 UTC (rev 2543)
+++ trunk/source/geomgraph/GraphComponent.cpp	2009-06-05 11:03:53 UTC (rev 2544)
@@ -12,6 +12,10 @@
  * by the Free Software Foundation. 
  * See the COPYING file for more information.
  *
+ **********************************************************************
+ *
+ * Last port: geomgraph/GraphComponent.java rev. 1.3 (JTS-1.10)
+ *
  **********************************************************************/
 
 #include <cassert>

Modified: trunk/source/geomgraph/NodeMap.cpp
===================================================================
--- trunk/source/geomgraph/NodeMap.cpp	2009-06-05 10:23:23 UTC (rev 2543)
+++ trunk/source/geomgraph/NodeMap.cpp	2009-06-05 11:03:53 UTC (rev 2544)
@@ -12,6 +12,10 @@
  * by the Free Software Foundation. 
  * See the COPYING file for more information.
  *
+ **********************************************************************
+ *
+ * Last port: geomgraph/NodeMap.java rev. 1.3 (JTS-1.10)
+ *
  **********************************************************************/
 
 #include <geos/geomgraph/NodeMap.h>

Modified: trunk/source/geomgraph/PlanarGraph.cpp
===================================================================
--- trunk/source/geomgraph/PlanarGraph.cpp	2009-06-05 10:23:23 UTC (rev 2543)
+++ trunk/source/geomgraph/PlanarGraph.cpp	2009-06-05 11:03:53 UTC (rev 2544)
@@ -14,7 +14,7 @@
  *
  **********************************************************************
  *
- * Last port: geomgraph/PlanarGraph.java rev. 1.4 (JTS-1.7)
+ * Last port: geomgraph/PlanarGraph.java rev. 1.6 (JTS-1.10)
  *
  **********************************************************************/
 

Modified: trunk/source/headers/geos/geomgraph/Depth.h
===================================================================
--- trunk/source/headers/geos/geomgraph/Depth.h	2009-06-05 10:23:23 UTC (rev 2543)
+++ trunk/source/headers/geos/geomgraph/Depth.h	2009-06-05 11:03:53 UTC (rev 2544)
@@ -12,6 +12,12 @@
  * by the Free Software Foundation. 
  * See the COPYING file for more information.
  *
+ **********************************************************************
+ *
+ * Last port: geomgraph/Depth.java rev. 1.4 (JTS-1.10)
+ *
+ * NON-EXPOSED GEOS HEADER
+ *
  **********************************************************************/
 
 
@@ -50,9 +56,8 @@
 	std::string toString() const;
 private:
 	enum {
-		DEPTHNULL=-1 //Replaces NULL
+		NULL_VALUE=-1 //Replaces NULL
 	};
-//	static const int DEPTHNULL=-1; //Replaces NULL
 	int depth[2][3];
 };
 

Modified: trunk/source/headers/geos/geomgraph/EdgeEnd.h
===================================================================
--- trunk/source/headers/geos/geomgraph/EdgeEnd.h	2009-06-05 10:23:23 UTC (rev 2543)
+++ trunk/source/headers/geos/geomgraph/EdgeEnd.h	2009-06-05 11:03:53 UTC (rev 2544)
@@ -16,6 +16,8 @@
  *
  * Last port: geomgraph/EdgeEnd.java rev. 1.5 (JTS-1.7)
  *
+ * EXPOSED GEOS HEADER
+ *
  **********************************************************************/
 
 

Modified: trunk/source/headers/geos/geomgraph/EdgeEndStar.h
===================================================================
--- trunk/source/headers/geos/geomgraph/EdgeEndStar.h	2009-06-05 10:23:23 UTC (rev 2543)
+++ trunk/source/headers/geos/geomgraph/EdgeEndStar.h	2009-06-05 11:03:53 UTC (rev 2544)
@@ -16,6 +16,8 @@
  *
  * Last port: geomgraph/EdgeEndStar.java rev. 1.4 (JTS-1.7)
  *
+ * EXPOSED GEOS HEADER
+ *
  **********************************************************************/
 
 

Modified: trunk/source/headers/geos/geomgraph/EdgeList.h
===================================================================
--- trunk/source/headers/geos/geomgraph/EdgeList.h	2009-06-05 10:23:23 UTC (rev 2543)
+++ trunk/source/headers/geos/geomgraph/EdgeList.h	2009-06-05 11:03:53 UTC (rev 2544)
@@ -14,8 +14,10 @@
  *
  **********************************************************************
  *
- * Last port: geomgraph/EdgeList.java rev. 1.4 (JTS-1.9)
+ * Last port: geomgraph/EdgeList.java rev. 1.4 (JTS-1.10)
  *
+ * EXPOSED GEOS HEADER
+ *
  **********************************************************************/
 
 

Modified: trunk/source/headers/geos/geomgraph/GeometryGraph.h
===================================================================
--- trunk/source/headers/geos/geomgraph/GeometryGraph.h	2009-06-05 10:23:23 UTC (rev 2543)
+++ trunk/source/headers/geos/geomgraph/GeometryGraph.h	2009-06-05 11:03:53 UTC (rev 2544)
@@ -12,6 +12,12 @@
  * by the Free Software Foundation. 
  * See the COPYING file for more information.
  *
+ **********************************************************************
+ *
+ * Last port: geomgraph/GeometryGraph.java rev. 1.5 (JTS-1.7)
+ *
+ * EXPOSED GEOS HEADER
+ *
  **********************************************************************/
 
 

Modified: trunk/source/headers/geos/geomgraph/GeometryGraph.inl
===================================================================
--- trunk/source/headers/geos/geomgraph/GeometryGraph.inl	2009-06-05 10:23:23 UTC (rev 2543)
+++ trunk/source/headers/geos/geomgraph/GeometryGraph.inl	2009-06-05 11:03:53 UTC (rev 2544)
@@ -11,6 +11,12 @@
  * by the Free Software Foundation. 
  * See the COPYING file for more information.
  *
+ **********************************************************************
+ *
+ * Last port: geomgraph/GeometryGraph.java rev. 1.5 (JTS-1.7)
+ *
+ * EXPOSED GEOS HEADER
+ *
  **********************************************************************/
 
 #ifndef GEOS_GEOMGRAPH_GEOMETRYGRAPH_INL
@@ -52,7 +58,7 @@
 	:
 	PlanarGraph(),
 	parentGeom(newParentGeom),
-	useBoundaryDeterminationRule(false),
+	useBoundaryDeterminationRule(true),
 	argIndex(newArgIndex),
 	hasTooFewPointsVar(false)
 {
@@ -64,7 +70,7 @@
 	:
 	PlanarGraph(),
 	parentGeom(NULL),
-	useBoundaryDeterminationRule(false),
+	useBoundaryDeterminationRule(true),
 	argIndex(-1),
 	hasTooFewPointsVar(false)
 {

Modified: trunk/source/headers/geos/geomgraph/GraphComponent.h
===================================================================
--- trunk/source/headers/geos/geomgraph/GraphComponent.h	2009-06-05 10:23:23 UTC (rev 2543)
+++ trunk/source/headers/geos/geomgraph/GraphComponent.h	2009-06-05 11:03:53 UTC (rev 2544)
@@ -12,6 +12,12 @@
  * by the Free Software Foundation. 
  * See the COPYING file for more information.
  *
+ **********************************************************************
+ *
+ * Last port: geomgraph/GraphComponent.java rev. 1.3 (JTS-1.10)
+ *
+ * EXPOSED GEOS HEADER
+ *
  **********************************************************************/
 
 

Modified: trunk/source/headers/geos/geomgraph/Node.h
===================================================================
--- trunk/source/headers/geos/geomgraph/Node.h	2009-06-05 10:23:23 UTC (rev 2543)
+++ trunk/source/headers/geos/geomgraph/Node.h	2009-06-05 11:03:53 UTC (rev 2544)
@@ -16,6 +16,8 @@
  *
  * Last port: geomgraph/Node.java rev. 1.6 (JTS-1.7)
  *
+ * EXPOSED GEOS HEADER
+ *
  **********************************************************************/
 
 

Modified: trunk/source/headers/geos/geomgraph/NodeMap.h
===================================================================
--- trunk/source/headers/geos/geomgraph/NodeMap.h	2009-06-05 10:23:23 UTC (rev 2543)
+++ trunk/source/headers/geos/geomgraph/NodeMap.h	2009-06-05 11:03:53 UTC (rev 2544)
@@ -12,6 +12,12 @@
  * by the Free Software Foundation. 
  * See the COPYING file for more information.
  *
+ **********************************************************************
+ *
+ * Last port: geomgraph/NodeMap.java rev. 1.3 (JTS-1.10)
+ *
+ * EXPOSED GEOS HEADER
+ *
  **********************************************************************/
 
 

Modified: trunk/source/headers/geos/geomgraph/PlanarGraph.h
===================================================================
--- trunk/source/headers/geos/geomgraph/PlanarGraph.h	2009-06-05 10:23:23 UTC (rev 2543)
+++ trunk/source/headers/geos/geomgraph/PlanarGraph.h	2009-06-05 11:03:53 UTC (rev 2544)
@@ -14,8 +14,10 @@
  *
  **********************************************************************
  *
- * Last port: geomgraph/PlanarGraph.java rev. 1.4 (JTS-1.7)
+ * Last port: geomgraph/PlanarGraph.java rev. 1.6 (JTS-1.10)
  *
+ * EXPOSED GEOS HEADER
+ *
  **********************************************************************/
 
 



More information about the geos-commits mailing list