[GRASS-SVN] r65715 - grass/trunk/vector/v.buffer

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Jul 20 11:24:47 PDT 2015


Author: martinl
Date: 2015-07-20 11:24:47 -0700 (Mon, 20 Jul 2015)
New Revision: 65715

Modified:
   grass/trunk/vector/v.buffer/geos.c
   grass/trunk/vector/v.buffer/local_proto.h
   grass/trunk/vector/v.buffer/main.c
Log:
fix v.buffer to be compiled with GEOS < 3.2 (see r65710)


Modified: grass/trunk/vector/v.buffer/geos.c
===================================================================
--- grass/trunk/vector/v.buffer/geos.c	2015-07-20 17:50:07 UTC (rev 65714)
+++ grass/trunk/vector/v.buffer/geos.c	2015-07-20 18:24:47 UTC (rev 65715)
@@ -158,6 +158,7 @@
      * A value of 8 gives less than 2% max error in the buffer distance.
      * For a max error of < 1%, use QS = 12.
      * For a max error of < 0.1%, use QS = 18. */
+#ifdef GEOS_3_3
     if (flat || no_caps) {
         GEOSBufferParams* geos_params = GEOSBufferParams_create();
         GEOSBufferParams_setEndCapStyle(geos_params,
@@ -166,9 +167,10 @@
         OGeom = GEOSBufferWithParams(IGeom, geos_params, da);
         GEOSBufferParams_destroy(geos_params);
     }
-    else {
+    else
+#else
         OGeom = GEOSBuffer(IGeom, da, 12);
-    }
+#endif
     
     if (!OGeom) {
 	G_fatal_error(_("Buffering failed"));

Modified: grass/trunk/vector/v.buffer/local_proto.h
===================================================================
--- grass/trunk/vector/v.buffer/local_proto.h	2015-07-20 17:50:07 UTC (rev 65714)
+++ grass/trunk/vector/v.buffer/local_proto.h	2015-07-20 18:24:47 UTC (rev 65715)
@@ -1,3 +1,6 @@
+#if (GEOS_VERSION_MAJOR >= 3 && GEOS_VERSION_MINOR >= 3)
+#define GEOS_3_3
+#endif
 
 struct buf_contours
 {

Modified: grass/trunk/vector/v.buffer/main.c
===================================================================
--- grass/trunk/vector/v.buffer/main.c	2015-07-20 17:50:07 UTC (rev 65714)
+++ grass/trunk/vector/v.buffer/main.c	2015-07-20 18:24:47 UTC (rev 65715)
@@ -474,7 +474,13 @@
 
 #ifdef HAVE_GEOS
     initGEOS(G_message, G_fatal_error);
+
+    /* check required version for -s/-c flag */
+#ifndef GEOS_3_3
+        G_warning(_("Flags -%c/%c ignored by this version, GEOS >= 3.3 is required"),
+                  's', 'c');
 #endif
+#endif
     if(!use_geos && (da < 0. || db < 0.)) {
 	G_warning(_("Negative distances for internal buffers are not supported "
 	            "and converted to positive values."));



More information about the grass-commit mailing list