[geos-commits] r2868 - in trunk: include/geos src/algorithm src/algorithm/locate src/noding/snapround src/operation/buffer src/operation/overlay/snap src/operation/overlay/validate

svn_geos at osgeo.org svn_geos at osgeo.org
Sun Jan 17 19:59:23 EST 2010


Author: mloskot
Date: 2010-01-17 19:59:21 -0500 (Sun, 17 Jan 2010)
New Revision: 2868

Modified:
   trunk/include/geos/platform.h.cmake
   trunk/src/algorithm/CGAlgorithms.cpp
   trunk/src/algorithm/locate/IndexedPointInAreaLocator.cpp
   trunk/src/noding/snapround/HotPixel.cpp
   trunk/src/operation/buffer/BufferOp.cpp
   trunk/src/operation/overlay/snap/GeometrySnapper.cpp
   trunk/src/operation/overlay/validate/OverlayResultValidator.cpp
Log:
* Successfully tested CMake configuration with Visual Studio 2010 (#317).
* Disable argument dependant lookup (Koenig) for min/max functions to make sure GEOS compiles in the presence of the min/max macros.
* Some platform headers define min() and max() macros which cause some common C++ constructs to fail to compile.

Modified: trunk/include/geos/platform.h.cmake
===================================================================
--- trunk/include/geos/platform.h.cmake	2010-01-17 23:54:32 UTC (rev 2867)
+++ trunk/include/geos/platform.h.cmake	2010-01-18 00:59:21 UTC (rev 2868)
@@ -151,13 +151,12 @@
 # error "Could not find finite or isfinite function or macro!"
 #endif
 
+#include <limits>
+#define DoubleNegInfinity (-(std::numeric_limits<double>::infinity)())
+#define DoubleMax (std::numeric_limits<double>::max)()
+// Defines NaN for Intel platforms
+#define DoubleNotANumber std::numeric_limits<double>::quiet_NaN()
+// Don't forget to define infinities
+#define DoubleInfinity (std::numeric_limits<double>::infinity)()
 
-#include <limits>
-#define DoubleNegInfinity -std::numeric_limits<double>::infinity()
-#define DoubleMax std::numeric_limits<double>::max()
-// Defines NaN for Intel platforms
-#define DoubleNotANumber std::numeric_limits<double>::quiet_NaN()
-// Don't forget to define infinities
-#define DoubleInfinity std::numeric_limits<double>::infinity()
-
 #endif // GEOS_PLATFORM_H_INCLUDED

Modified: trunk/src/algorithm/CGAlgorithms.cpp
===================================================================
--- trunk/src/algorithm/CGAlgorithms.cpp	2010-01-17 23:54:32 UTC (rev 2867)
+++ trunk/src/algorithm/CGAlgorithms.cpp	2010-01-18 00:59:21 UTC (rev 2868)
@@ -284,17 +284,17 @@
 	double s_top=(A.y-C.y)*(B.x-A.x)-(A.x-C.x)*(B.y-A.y);
 	double s_bot=(B.x-A.x)*(D.y-C.y)-(B.y-A.y)*(D.x-C.x);
 	if ((r_bot==0)||(s_bot==0)) {
-		return std::min(distancePointLine(A,C,D),
-						std::min(distancePointLine(B,C,D),
-						std::min(distancePointLine(C,A,B), distancePointLine(D,A,B))));
+		return (std::min)(distancePointLine(A,C,D),
+						(std::min)(distancePointLine(B,C,D),
+						(std::min)(distancePointLine(C,A,B), distancePointLine(D,A,B))));
 	}
 	double s=s_top/s_bot;
 	double r=r_top/r_bot;
 	if ((r<0)||( r>1)||(s<0)||(s>1)) {
 		//no intersection
-		return std::min(distancePointLine(A,C,D),
-						std::min(distancePointLine(B,C,D),
-						std::min(distancePointLine(C,A,B), distancePointLine(D,A,B))));
+		return (std::min)(distancePointLine(A,C,D),
+						(std::min)(distancePointLine(B,C,D),
+						(std::min)(distancePointLine(C,A,B), distancePointLine(D,A,B))));
 	}
 	return 0.0; //intersection exists
 }

Modified: trunk/src/algorithm/locate/IndexedPointInAreaLocator.cpp
===================================================================
--- trunk/src/algorithm/locate/IndexedPointInAreaLocator.cpp	2010-01-17 23:54:32 UTC (rev 2867)
+++ trunk/src/algorithm/locate/IndexedPointInAreaLocator.cpp	2010-01-18 00:59:21 UTC (rev 2868)
@@ -75,8 +75,8 @@
 	for ( size_t i = 1, ni = pts->size(); i < ni; i++ ) 
 	{
 		geom::LineSegment * seg = new geom::LineSegment( (*pts)[ i - 1 ], (*pts)[ i ]);
-		double min = std::min( seg->p0.y, seg->p1.y);
-		double max = std::max( seg->p0.y, seg->p1.y);
+		double const min = (std::min)( seg->p0.y, seg->p1.y);
+		double const max = (std::max)( seg->p0.y, seg->p1.y);
 		
 		// NOTE: seg ownership still ours
 		allocatedSegments.push_back(seg);

Modified: trunk/src/noding/snapround/HotPixel.cpp
===================================================================
--- trunk/src/noding/snapround/HotPixel.cpp	2010-01-17 23:54:32 UTC (rev 2867)
+++ trunk/src/noding/snapround/HotPixel.cpp	2010-01-18 00:59:21 UTC (rev 2868)
@@ -101,10 +101,10 @@
 		const Coordinate& p1) const
 {
 
-	double segMinx = std::min(p0.x, p1.x);
-	double segMaxx = std::max(p0.x, p1.x);
-	double segMiny = std::min(p0.y, p1.y);
-	double segMaxy = std::max(p0.y, p1.y);
+	double const segMinx = (std::min)(p0.x, p1.x);
+	double const segMaxx = (std::max)(p0.x, p1.x);
+	double const segMiny = (std::min)(p0.y, p1.y);
+	double const segMaxy = (std::max)(p0.y, p1.y);
 
 	bool isOutsidePixelEnv =  maxx < segMinx
                          || minx > segMaxx

Modified: trunk/src/operation/buffer/BufferOp.cpp
===================================================================
--- trunk/src/operation/buffer/BufferOp.cpp	2010-01-17 23:54:32 UTC (rev 2867)
+++ trunk/src/operation/buffer/BufferOp.cpp	2010-01-18 00:59:21 UTC (rev 2868)
@@ -67,7 +67,7 @@
 	int maxPrecisionDigits)
 {
 	const Envelope *env=g->getEnvelopeInternal();
-	double envSize=std::max(env->getHeight(), env->getWidth());
+	double envSize=(std::max)(env->getHeight(), env->getWidth());
 	double expandByDistance=distance > 0.0 ? distance : 0.0;
 	double bufEnvSize=envSize + 2 * expandByDistance;
 	// the smallest power of 10 greater than the buffer envelope

Modified: trunk/src/operation/overlay/snap/GeometrySnapper.cpp
===================================================================
--- trunk/src/operation/overlay/snap/GeometrySnapper.cpp	2010-01-17 23:54:32 UTC (rev 2867)
+++ trunk/src/operation/overlay/snap/GeometrySnapper.cpp	2010-01-18 00:59:21 UTC (rev 2868)
@@ -120,7 +120,7 @@
 GeometrySnapper::computeSizeBasedSnapTolerance(const geom::Geometry& g)
 {
 	const Envelope* env = g.getEnvelopeInternal();
-	double minDimension = std::min(env->getHeight(), env->getWidth());
+	double minDimension = (std::min)(env->getHeight(), env->getWidth());
 	double snapTol = minDimension * snapPrecisionFactor;
 	return snapTol;
 }
@@ -156,7 +156,7 @@
 GeometrySnapper::computeOverlaySnapTolerance(const geom::Geometry& g1,
 		const geom::Geometry& g2)
 {
-        return std::min(computeOverlaySnapTolerance(g1), computeOverlaySnapTolerance(g2));
+        return (std::min)(computeOverlaySnapTolerance(g1), computeOverlaySnapTolerance(g2));
 }
 
 /* public static */

Modified: trunk/src/operation/overlay/validate/OverlayResultValidator.cpp
===================================================================
--- trunk/src/operation/overlay/validate/OverlayResultValidator.cpp	2010-01-17 23:54:32 UTC (rev 2867)
+++ trunk/src/operation/overlay/validate/OverlayResultValidator.cpp	2010-01-18 00:59:21 UTC (rev 2868)
@@ -235,12 +235,12 @@
 /*private static*/
 double
 OverlayResultValidator::computeBoundaryDistanceTolerance(
-		const geom::Geometry& g0, const geom::Geometry& g1)
+    const geom::Geometry& g0, const geom::Geometry& g1)
 {
-	using geos::operation::overlay::snap::GeometrySnapper;
+    using geos::operation::overlay::snap::GeometrySnapper;
 
-	return std::min(GeometrySnapper::computeSizeBasedSnapTolerance(g0),
-                        GeometrySnapper::computeSizeBasedSnapTolerance(g1));
+    return (std::min)(GeometrySnapper::computeSizeBasedSnapTolerance(g0),
+                      GeometrySnapper::computeSizeBasedSnapTolerance(g1));
 }
 
 } // namespace geos.operation.overlay.validate



More information about the geos-commits mailing list