[geos-commits] r3640 - in trunk: capi include/geos/algorithm src/algorithm src/geomgraph src/operation

svn_geos at osgeo.org svn_geos at osgeo.org
Wed May 23 20:23:42 EDT 2012


Author: mloskot
Date: 2012-05-23 17:23:42 -0700 (Wed, 23 May 2012)
New Revision: 3640

Modified:
   trunk/capi/geos_ts_c.cpp
   trunk/include/geos/algorithm/BoundaryNodeRule.h
   trunk/src/algorithm/BoundaryNodeRule.cpp
   trunk/src/geomgraph/GeometryGraph.cpp
   trunk/src/operation/GeometryGraphOperation.cpp
Log:
Replaced static members/references to global boundary rule objects with static methods providing access to those objects. The previous implementation was troublesome for exports from Windows DLL. From POV, it is just syntactical change. Semantically nothing has changed.

Modified: trunk/capi/geos_ts_c.cpp
===================================================================
--- trunk/capi/geos_ts_c.cpp	2012-05-24 00:21:11 UTC (rev 3639)
+++ trunk/capi/geos_ts_c.cpp	2012-05-24 00:23:42 UTC (rev 3640)
@@ -751,19 +751,19 @@
         switch (bnr) {
           case GEOSRELATE_BNR_MOD2: /* same as OGC */
             im = RelateOp::relate(g1, g2,
-              BoundaryNodeRule::MOD2_BOUNDARY_RULE);
+                BoundaryNodeRule::getBoundaryRuleMod2());
             break;
           case GEOSRELATE_BNR_ENDPOINT:
             im = RelateOp::relate(g1, g2,
-              BoundaryNodeRule::ENDPOINT_BOUNDARY_RULE);
+                BoundaryNodeRule::getBoundaryEndPoint());
             break;
           case GEOSRELATE_BNR_MULTIVALENT_ENDPOINT:
             im = RelateOp::relate(g1, g2,
-              BoundaryNodeRule::MULTIVALENT_ENDPOINT_BOUNDARY_RULE);
+                BoundaryNodeRule::getBoundaryMultivalentEndPoint());
             break;
           case GEOSRELATE_BNR_MONOVALENT_ENDPOINT:
             im = RelateOp::relate(g1, g2,
-              BoundaryNodeRule::MONOVALENT_ENDPOINT_BOUNDARY_RULE);
+                BoundaryNodeRule::getBoundaryMonovalentEndPoint());
             break;
           default:
             handle->ERROR_MESSAGE("Invalid boundary node rule %d", bnr);

Modified: trunk/include/geos/algorithm/BoundaryNodeRule.h
===================================================================
--- trunk/include/geos/algorithm/BoundaryNodeRule.h	2012-05-24 00:21:11 UTC (rev 3639)
+++ trunk/include/geos/algorithm/BoundaryNodeRule.h	2012-05-24 00:23:42 UTC (rev 3640)
@@ -72,28 +72,32 @@
 	 *
 	 * @see Mod2BoundaryNodeRule
 	 */
-	static const BoundaryNodeRule& MOD2_BOUNDARY_RULE;
+	//static const BoundaryNodeRule& MOD2_BOUNDARY_RULE;
+    static const BoundaryNodeRule& getBoundaryRuleMod2();
 
 	/** \brief
 	 * The Endpoint Boundary Node Rule.
 	 *
 	 * @see EndPointBoundaryNodeRule
 	 */
-	static const BoundaryNodeRule& ENDPOINT_BOUNDARY_RULE;
+	//static const BoundaryNodeRule& ENDPOINT_BOUNDARY_RULE;
+    static const BoundaryNodeRule& getBoundaryEndPoint();
 
 	/** \brief
 	 * The MultiValent Endpoint Boundary Node Rule.
 	 *
 	 * @see MultiValentEndPointBoundaryNodeRule
 	 */
-	static const BoundaryNodeRule& MULTIVALENT_ENDPOINT_BOUNDARY_RULE;
+	//static const BoundaryNodeRule& MULTIVALENT_ENDPOINT_BOUNDARY_RULE;
+    static const BoundaryNodeRule& getBoundaryMultivalentEndPoint();
 
 	/** \brief
 	 * The Monovalent Endpoint Boundary Node Rule.
 	 *
 	 * @see MonoValentEndPointBoundaryNodeRule
 	 */
-	static const BoundaryNodeRule& MONOVALENT_ENDPOINT_BOUNDARY_RULE;
+	//static const BoundaryNodeRule& MONOVALENT_ENDPOINT_BOUNDARY_RULE;
+    static const BoundaryNodeRule& getBoundaryMonovalentEndPoint();
 
 	/** \brief
 	 * The Boundary Node Rule specified by the OGC Simple Features
@@ -101,8 +105,8 @@
 	 *
 	 * @see Mod2BoundaryNodeRule
 	 */
-	static const BoundaryNodeRule& OGC_SFS_BOUNDARY_RULE;
-
+	//static const BoundaryNodeRule& OGC_SFS_BOUNDARY_RULE;
+    static const BoundaryNodeRule& getBoundaryOGCSFS();
 };
 
 } // namespace geos::algorithm

Modified: trunk/src/algorithm/BoundaryNodeRule.cpp
===================================================================
--- trunk/src/algorithm/BoundaryNodeRule.cpp	2012-05-24 00:21:11 UTC (rev 3639)
+++ trunk/src/algorithm/BoundaryNodeRule.cpp	2012-05-24 00:23:42 UTC (rev 3640)
@@ -122,21 +122,43 @@
 	}
 };
 
+Mod2BoundaryNodeRule mod2Rule;
+EndPointBoundaryNodeRule endPointRule;
+MultiValentEndPointBoundaryNodeRule multiValentRule;
+MonoValentEndPointBoundaryNodeRule monoValentRule;
 
 } // anonymous namespace
 
-static Mod2BoundaryNodeRule mod2Rule;
-static EndPointBoundaryNodeRule endPointRule;
-static MultiValentEndPointBoundaryNodeRule multiValentRule;
-static MonoValentEndPointBoundaryNodeRule monoValentRule;
+//const BoundaryNodeRule& BoundaryNodeRule::MOD2_BOUNDARY_RULE = mod2Rule;
+const BoundaryNodeRule& BoundaryNodeRule::getBoundaryRuleMod2()
+{
+    return mod2Rule;
+}
 
-const BoundaryNodeRule& BoundaryNodeRule::MOD2_BOUNDARY_RULE = mod2Rule;
-const BoundaryNodeRule& BoundaryNodeRule::ENDPOINT_BOUNDARY_RULE = endPointRule;
-const BoundaryNodeRule& BoundaryNodeRule::MULTIVALENT_ENDPOINT_BOUNDARY_RULE = multiValentRule;
-const BoundaryNodeRule& BoundaryNodeRule::MONOVALENT_ENDPOINT_BOUNDARY_RULE = monoValentRule;
-const BoundaryNodeRule& BoundaryNodeRule::OGC_SFS_BOUNDARY_RULE = BoundaryNodeRule::MOD2_BOUNDARY_RULE;
+//const BoundaryNodeRule& BoundaryNodeRule::ENDPOINT_BOUNDARY_RULE = endPointRule;
+const BoundaryNodeRule& BoundaryNodeRule::getBoundaryEndPoint()
+{
+    return endPointRule;
+}
 
+//const BoundaryNodeRule& BoundaryNodeRule::MULTIVALENT_ENDPOINT_BOUNDARY_RULE = multiValentRule;
+const BoundaryNodeRule& BoundaryNodeRule::getBoundaryMultivalentEndPoint()
+{
+    return multiValentRule;
+}
 
+//const BoundaryNodeRule& BoundaryNodeRule::MONOVALENT_ENDPOINT_BOUNDARY_RULE = monoValentRule;
+const BoundaryNodeRule& BoundaryNodeRule::getBoundaryMonovalentEndPoint()
+{
+    return monoValentRule;
+}
+
+//const BoundaryNodeRule& BoundaryNodeRule::OGC_SFS_BOUNDARY_RULE = BoundaryNodeRule::MOD2_BOUNDARY_RULE;
+const BoundaryNodeRule& BoundaryNodeRule::getBoundaryOGCSFS()
+{
+    return getBoundaryRuleMod2();
+}
+
 } // namespace geos.algorithm
 } // namespace geos
 

Modified: trunk/src/geomgraph/GeometryGraph.cpp
===================================================================
--- trunk/src/geomgraph/GeometryGraph.cpp	2012-05-24 00:21:11 UTC (rev 3639)
+++ trunk/src/geomgraph/GeometryGraph.cpp	2012-05-24 00:23:42 UTC (rev 3640)
@@ -495,7 +495,7 @@
 	PlanarGraph(),
 	parentGeom(newParentGeom),
 	useBoundaryDeterminationRule(true),
-	boundaryNodeRule(algorithm::BoundaryNodeRule::OGC_SFS_BOUNDARY_RULE),
+    boundaryNodeRule(algorithm::BoundaryNodeRule::getBoundaryOGCSFS()),
 	argIndex(newArgIndex),
 	hasTooFewPointsVar(false)
 {
@@ -521,7 +521,7 @@
 	PlanarGraph(),
 	parentGeom(NULL),
 	useBoundaryDeterminationRule(true),
-	boundaryNodeRule(algorithm::BoundaryNodeRule::OGC_SFS_BOUNDARY_RULE),
+    boundaryNodeRule(algorithm::BoundaryNodeRule::getBoundaryOGCSFS()),
 	argIndex(-1),
 	hasTooFewPointsVar(false)
 {

Modified: trunk/src/operation/GeometryGraphOperation.cpp
===================================================================
--- trunk/src/operation/GeometryGraphOperation.cpp	2012-05-24 00:21:11 UTC (rev 3639)
+++ trunk/src/operation/GeometryGraphOperation.cpp	2012-05-24 00:23:42 UTC (rev 3640)
@@ -53,9 +53,9 @@
 		setComputationPrecision(pm1);
 
 	arg[0]=new GeometryGraph(0, g0,
-		algorithm::BoundaryNodeRule::OGC_SFS_BOUNDARY_RULE);
+        algorithm::BoundaryNodeRule::getBoundaryOGCSFS());
 	arg[1]=new GeometryGraph(1, g1,
-		algorithm::BoundaryNodeRule::OGC_SFS_BOUNDARY_RULE);
+		algorithm::BoundaryNodeRule::getBoundaryOGCSFS());
 }
 
 GeometryGraphOperation::GeometryGraphOperation(const Geometry *g0,



More information about the geos-commits mailing list