[geos-commits] r3985 - in trunk: . capi php php/test swig/python tests/unit/capi

svn_geos at osgeo.org svn_geos at osgeo.org
Wed May 21 09:08:38 PDT 2014


Author: strk
Date: 2014-05-21 09:08:38 -0700 (Wed, 21 May 2014)
New Revision: 3985

Modified:
   trunk/.gitignore
   trunk/capi/geos_c.cpp
   trunk/capi/geos_c.h.in
   trunk/capi/geos_ts_c.cpp
   trunk/php/geos.c
   trunk/php/test/test.php
   trunk/swig/python/geos.py
   trunk/swig/python/geos_wrap.cxx
   trunk/tests/unit/capi/GEOSVoronoiDiagramTest.cpp
Log:
Change GEOSVoronoiDiagram signature to accept optional clip extent

With this change I'll consider voronoi API final

Modified: trunk/.gitignore
===================================================================
--- trunk/.gitignore	2014-05-21 14:21:10 UTC (rev 3984)
+++ trunk/.gitignore	2014-05-21 16:08:38 UTC (rev 3985)
@@ -13,6 +13,7 @@
 macros/ltsugar.m4
 macros/ltversion.m4
 macros/lt~obsolete.m4
+test-driver
 tests/thread/badthreadtest
 tests/thread/threadtest
 tests/unit/geos_unit

Modified: trunk/capi/geos_c.cpp
===================================================================
--- trunk/capi/geos_c.cpp	2014-05-21 14:21:10 UTC (rev 3984)
+++ trunk/capi/geos_c.cpp	2014-05-21 16:08:38 UTC (rev 3985)
@@ -1271,9 +1271,9 @@
 }
 
 Geometry*
-GEOSVoronoiDiagram(const Geometry *g, double tolerance, int onlyEdges)
+GEOSVoronoiDiagram(const Geometry *g, const Geometry *env, double tolerance, int onlyEdges)
 {
-  return GEOSVoronoiDiagram_r(handle, g, tolerance, onlyEdges);
+  return GEOSVoronoiDiagram_r(handle, g, env, tolerance, onlyEdges);
 }
 
 } /* extern "C" */

Modified: trunk/capi/geos_c.h.in
===================================================================
--- trunk/capi/geos_c.h.in	2014-05-21 14:21:10 UTC (rev 3984)
+++ trunk/capi/geos_c.h.in	2014-05-21 16:08:38 UTC (rev 3985)
@@ -748,18 +748,25 @@
  * Returns the Voronoi polygons of a set of Vertices given as input
  * 
  * @param g the input geometry whose vertex will be used as sites.
- * @param tolerance optional snapping tolerance to use for improved robustness
+ * @param tolerance snapping tolerance to use for improved robustness
+ * @param onlyEdges whether to return only edges of the voronoi cells
+ * @param env clipping envelope for the returned diagram, automatically
+ *            determined if NULL.
+ *            The diagram will be clipped to the larger
+ *            of this envelope or an envelope surrounding the sites.
  * 
  * @return a newly allocated geometry, or NULL on exception.
  */
 extern GEOSGeometry GEOS_DLL * GEOSVoronoiDiagram(
-				const GEOSGeometry *g,  
+				const GEOSGeometry *g,
+				const GEOSGeometry *env,
 				double tolerance,
 				int onlyEdges);
 
 extern GEOSGeometry GEOS_DLL * GEOSVoronoiDiagram_r(
 				GEOSContextHandle_t extHandle, 
-				const GEOSGeometry *g1, 
+				const GEOSGeometry *g, 
+				const GEOSGeometry *env,
 				double tolerance,
 				int onlyEdges);
 

Modified: trunk/capi/geos_ts_c.cpp
===================================================================
--- trunk/capi/geos_ts_c.cpp	2014-05-21 14:21:10 UTC (rev 3984)
+++ trunk/capi/geos_ts_c.cpp	2014-05-21 16:08:38 UTC (rev 3985)
@@ -6219,7 +6219,7 @@
     return NULL;
 }
 Geometry* 
-GEOSVoronoiDiagram_r(GEOSContextHandle_t extHandle, const Geometry *g1,double tolerance ,int onlyEdges)
+GEOSVoronoiDiagram_r(GEOSContextHandle_t extHandle, const Geometry *g1, const Geometry *env, double tolerance ,int onlyEdges)
 {
 	if ( 0 == extHandle ) return NULL;
 
@@ -6234,6 +6234,7 @@
 		VoronoiDiagramBuilder builder;
 		builder.setSites(*g1);
 		builder.setTolerance(tolerance);
+    if(env) builder.setClipEnvelope(env->getEnvelopeInternal());
 		if(onlyEdges) return builder.getDiagramEdges(*g1->getFactory()).release();
 		else return builder.getDiagram(*g1->getFactory()).release();
 	}    

Modified: trunk/php/geos.c
===================================================================
--- trunk/php/geos.c	2014-05-21 14:21:10 UTC (rev 3984)
+++ trunk/php/geos.c	2014-05-21 16:08:38 UTC (rev 3985)
@@ -156,7 +156,6 @@
 Gen_create_obj (zend_class_entry *type TSRMLS_DC,
     zend_objects_free_object_storage_t st, zend_object_handlers* handlers)
 {
-    zval *tmp;
     zend_object_value retval;
 
     Proxy *obj = (Proxy *)emalloc(sizeof(Proxy));
@@ -2620,9 +2619,8 @@
 }
 
 /**
- * GEOSGeometry::voronoiDiagram([<tolerance>], [<onlyEdges>])
+ * GEOSGeometry::voronoiDiagram([<tolerance>], [<onlyEdges>], [<extent>])
  *
- * styleArray keys supported:
  *  'tolerance'
  *       Type: double
  *       snapping tolerance to use for improved robustness
@@ -2630,22 +2628,28 @@
  *       Type: boolean
  *       if true will return a MULTILINESTRING, otherwise (the default)
  *       it will return a GEOMETRYCOLLECTION containing POLYGONs.
+ *  'extent'
+ *       Type: geometry
+ *       Clip returned diagram by the extent of the given geometry
  */
 PHP_METHOD(Geometry, voronoiDiagram)
 {
     GEOSGeometry *this;
     GEOSGeometry *ret;
+    zval *zobj = 0;
+    GEOSGeometry *env = 0;
     double tolerance = 0.0;
     zend_bool edgeonly = 0;
 
     this = (GEOSGeometry*)getRelay(getThis(), Geometry_ce_ptr);
 
-    if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|db",
-            &tolerance, &edgeonly) == FAILURE) {
+    if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|dbo",
+            &tolerance, &edgeonly, &zobj) == FAILURE) {
         RETURN_NULL();
     }
 
-    ret = GEOSVoronoiDiagram(this, tolerance, edgeonly ? 1 : 0);
+    if ( zobj ) env = getRelay(zobj, Geometry_ce_ptr);
+    ret = GEOSVoronoiDiagram(this, env, tolerance, edgeonly ? 1 : 0);
     if ( ! ret ) RETURN_NULL(); /* should get an exception first */
 
     /* return_value is a zval */

Modified: trunk/php/test/test.php
===================================================================
--- trunk/php/test/test.php	2014-05-21 14:21:10 UTC (rev 3984)
+++ trunk/php/test/test.php	2014-05-21 16:08:38 UTC (rev 3985)
@@ -2045,7 +2045,7 @@
 
         $g = $reader->read('MULTIPOINT(0 0, 100 0, 100 100, 0 100)');
 
-        $b = $g->voronoiDiagram(0);
+        $b = $g->voronoiDiagram();
         $this->assertEquals(
 'GEOMETRYCOLLECTION (POLYGON ((50 200, 200 200, 200 50, 50 50, 50 200)), POLYGON ((-100 50, -100 200, 50 200, 50 50, -100 50)), POLYGON ((50 -100, -100 -100, -100 50, 50 50, 50 -100)), POLYGON ((200 50, 200 -100, 50 -100, 50 50, 200 50)))'
             , $writer->write($b));
@@ -2055,6 +2055,11 @@
 'MULTILINESTRING ((50 50, 50 200), (200 50, 50 50), (50 50, -100 50), (50 50, 50 -100))'
             , $writer->write($b));
 
+        $b = $g->voronoiDiagram(0, 1, $g->buffer(1000));
+        $this->assertEquals(
+'MULTILINESTRING ((50 50, 50 1100), (1100 50, 50 50), (50 50, -1000 50), (50 50, 50 -1000))'
+            , $writer->write($b));
+
     }
 
     public function testGeometry_snapTo()

Modified: trunk/swig/python/geos.py
===================================================================
--- trunk/swig/python/geos.py	2014-05-21 14:21:10 UTC (rev 3984)
+++ trunk/swig/python/geos.py	2014-05-21 16:08:38 UTC (rev 3985)
@@ -1,5 +1,5 @@
 # This file was automatically generated by SWIG (http://www.swig.org).
-# Version 2.0.4
+# Version 2.0.10
 #
 # Do not make changes to this file unless you know what you are doing--modify
 # the SWIG interface file instead.
@@ -84,8 +84,8 @@
     __swig_destroy__ = _geos.delete_SwigPyIterator
     __del__ = lambda self : None;
     def value(self): return _geos.SwigPyIterator_value(self)
-    def incr(self, n = 1): return _geos.SwigPyIterator_incr(self, n)
-    def decr(self, n = 1): return _geos.SwigPyIterator_decr(self, n)
+    def incr(self, n=1): return _geos.SwigPyIterator_incr(self, n)
+    def decr(self, n=1): return _geos.SwigPyIterator_decr(self, n)
     def distance(self, *args): return _geos.SwigPyIterator_distance(self, *args)
     def equal(self, *args): return _geos.SwigPyIterator_equal(self, *args)
     def copy(self): return _geos.SwigPyIterator_copy(self)

Modified: trunk/swig/python/geos_wrap.cxx
===================================================================
--- trunk/swig/python/geos_wrap.cxx	2014-05-21 14:21:10 UTC (rev 3984)
+++ trunk/swig/python/geos_wrap.cxx	2014-05-21 16:08:38 UTC (rev 3985)
@@ -1,6 +1,6 @@
 /* ----------------------------------------------------------------------------
  * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 2.0.4
+ * Version 2.0.10
  * 
  * This file is not intended to be easily readable and contains a number of 
  * coding conventions designed to improve portability and efficiency. Do not make
@@ -318,7 +318,7 @@
   return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0; 
 }
 #else /* no cast-rank mode */
-#  define SWIG_AddCast
+#  define SWIG_AddCast(r) (r)
 #  define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0)
 #endif
 
@@ -382,18 +382,18 @@
 
 /*
   Check type equivalence in a name list like <name1>|<name2>|...
-  Return 0 if not equal, 1 if equal
+  Return 0 if equal, -1 if nb < tb, 1 if nb > tb
 */
 SWIGRUNTIME int
-SWIG_TypeEquiv(const char *nb, const char *tb) {
-  int equiv = 0;
+SWIG_TypeCmp(const char *nb, const char *tb) {
+  int equiv = 1;
   const char* te = tb + strlen(tb);
   const char* ne = nb;
-  while (!equiv && *ne) {
+  while (equiv != 0 && *ne) {
     for (nb = ne; *ne; ++ne) {
       if (*ne == '|') break;
     }
-    equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
+    equiv = SWIG_TypeNameComp(nb, ne, tb, te);
     if (*ne) ++ne;
   }
   return equiv;
@@ -401,24 +401,13 @@
 
 /*
   Check type equivalence in a name list like <name1>|<name2>|...
-  Return 0 if equal, -1 if nb < tb, 1 if nb > tb
+  Return 0 if not equal, 1 if equal
 */
 SWIGRUNTIME int
-SWIG_TypeCompare(const char *nb, const char *tb) {
-  int equiv = 0;
-  const char* te = tb + strlen(tb);
-  const char* ne = nb;
-  while (!equiv && *ne) {
-    for (nb = ne; *ne; ++ne) {
-      if (*ne == '|') break;
-    }
-    equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
-    if (*ne) ++ne;
-  }
-  return equiv;
+SWIG_TypeEquiv(const char *nb, const char *tb) {
+  return SWIG_TypeCmp(nb, tb) == 0 ? 1 : 0;
 }
 
-
 /*
   Check the typename
 */
@@ -756,6 +745,7 @@
 #define PyInt_Check(x) PyLong_Check(x)
 #define PyInt_AsLong(x) PyLong_AsLong(x)
 #define PyInt_FromLong(x) PyLong_FromLong(x)
+#define PyInt_FromSize_t(x) PyLong_FromSize_t(x)
 #define PyString_Check(name) PyBytes_Check(name)
 #define PyString_FromString(x) PyUnicode_FromString(x)
 #define PyString_Format(fmt, args)  PyUnicode_Format(fmt, args)
@@ -925,6 +915,10 @@
 }
 #endif
 
+#if PY_VERSION_HEX < 0x02050000
+#define PyInt_FromSize_t(x) PyInt_FromLong((long)x)
+#endif
+
 #if PY_VERSION_HEX < 0x02040000
 #define Py_VISIT(op)				\
   do { 						\
@@ -1196,7 +1190,7 @@
 
 /* Runtime API */
 
-#define SWIG_GetModule(clientdata)                      SWIG_Python_GetModule()
+#define SWIG_GetModule(clientdata)                      SWIG_Python_GetModule(clientdata)
 #define SWIG_SetModule(clientdata, pointer)             SWIG_Python_SetModule(pointer)
 #define SWIG_NewClientData(obj)                         SwigPyClientData_New(obj)
 
@@ -1222,7 +1216,7 @@
 SWIGINTERN void 
 SWIG_Python_SetErrorMsg(PyObject *errtype, const char *msg) {
   SWIG_PYTHON_THREAD_BEGIN_BLOCK;
-  PyErr_SetString(errtype, (char *) msg);
+  PyErr_SetString(errtype, msg);
   SWIG_PYTHON_THREAD_END_BLOCK;
 }
 
@@ -1241,7 +1235,11 @@
 
 SWIGINTERN void
 SWIG_Python_SetConstant(PyObject *d, PyObject *public_interface, const char *name, PyObject *obj) {   
+#if PY_VERSION_HEX < 0x02030000
   PyDict_SetItemString(d, (char *)name, obj);
+#else
+  PyDict_SetItemString(d, name, obj);
+#endif
   Py_DECREF(obj);
   if (public_interface)
     SwigPyBuiltin_AddPublicSymbol(public_interface, name);
@@ -1251,7 +1249,11 @@
 
 SWIGINTERN void
 SWIG_Python_SetConstant(PyObject *d, const char *name, PyObject *obj) {   
+#if PY_VERSION_HEX < 0x02030000
   PyDict_SetItemString(d, (char *)name, obj);
+#else
+  PyDict_SetItemString(d, name, obj);
+#endif
   Py_DECREF(obj);                            
 }
 
@@ -1572,7 +1574,7 @@
 #endif
 {
   const char *name = SWIG_TypePrettyName(v->ty);
-  PyObject *repr = SWIG_Python_str_FromFormat("<Swig Object of type '%s' at %p>", name, (void *)v);
+  PyObject *repr = SWIG_Python_str_FromFormat("<Swig Object of type '%s' at %p>", (name ? name : "unknown"), (void *)v);
   if (v->next) {
 # ifdef METH_NOARGS
     PyObject *nrep = SwigPyObject_repr((SwigPyObject *)v->next);
@@ -1776,8 +1778,10 @@
   PyObject *val = 0;
 #if (PY_VERSION_HEX < 0x02020000)
   if (!PyArg_ParseTuple(args,(char *)"|O:own",&val))
+#elif (PY_VERSION_HEX < 0x02050000)
+  if (!PyArg_UnpackTuple(args, (char *)"own", 0, 1, &val)) 
 #else
-  if (!PyArg_UnpackTuple(args, (char *)"own", 0, 1, &val)) 
+  if (!PyArg_UnpackTuple(args, "own", 0, 1, &val)) 
 #endif
     {
       return NULL;
@@ -1809,7 +1813,7 @@
 static PyMethodDef
 swigobject_methods[] = {
   {(char *)"disown",  (PyCFunction)SwigPyObject_disown,  METH_NOARGS,  (char *)"releases ownership of the pointer"},
-  {(char *)"acquire", (PyCFunction)SwigPyObject_acquire, METH_NOARGS,  (char *)"aquires ownership of the pointer"},
+  {(char *)"acquire", (PyCFunction)SwigPyObject_acquire, METH_NOARGS,  (char *)"acquires ownership of the pointer"},
   {(char *)"own",     (PyCFunction)SwigPyObject_own,     METH_VARARGS, (char *)"returns/sets ownership of the pointer"},
   {(char *)"append",  (PyCFunction)SwigPyObject_append,  METH_O,       (char *)"appends another 'this' object"},
   {(char *)"next",    (PyCFunction)SwigPyObject_next,    METH_NOARGS,  (char *)"returns the next 'this' object"},
@@ -2472,23 +2476,29 @@
   } else {
 #if PY_VERSION_HEX >= 0x03000000
     inst = PyBaseObject_Type.tp_new((PyTypeObject*) data->newargs, Py_None, Py_None);
-    PyObject_SetAttr(inst, SWIG_This(), swig_this);
-    Py_TYPE(inst)->tp_flags &= ~Py_TPFLAGS_VALID_VERSION_TAG;
+    if (inst) {
+      PyObject_SetAttr(inst, SWIG_This(), swig_this);
+      Py_TYPE(inst)->tp_flags &= ~Py_TPFLAGS_VALID_VERSION_TAG;
+    }
 #else
     PyObject *dict = PyDict_New();
-    PyDict_SetItem(dict, SWIG_This(), swig_this);
-    inst = PyInstance_NewRaw(data->newargs, dict);
-    Py_DECREF(dict);
+    if (dict) {
+      PyDict_SetItem(dict, SWIG_This(), swig_this);
+      inst = PyInstance_NewRaw(data->newargs, dict);
+      Py_DECREF(dict);
+    }
 #endif
   }
   return inst;
 #else
 #if (PY_VERSION_HEX >= 0x02010000)
-  PyObject *inst;
+  PyObject *inst = 0;
   PyObject *dict = PyDict_New();
-  PyDict_SetItem(dict, SWIG_This(), swig_this);
-  inst = PyInstance_NewRaw(data->newargs, dict);
-  Py_DECREF(dict);
+  if (dict) {
+    PyDict_SetItem(dict, SWIG_This(), swig_this);
+    inst = PyInstance_NewRaw(data->newargs, dict);
+    Py_DECREF(dict);
+  }
   return (PyObject *) inst;
 #else
   PyInstanceObject *inst = PyObject_NEW(PyInstanceObject, &PyInstance_Type);
@@ -2539,7 +2549,7 @@
 SWIGINTERN PyObject *
 SWIG_Python_InitShadowInstance(PyObject *args) {
   PyObject *obj[2];
-  if (!SWIG_Python_UnpackTuple(args,(char*)"swiginit", 2, 2, obj)) {
+  if (!SWIG_Python_UnpackTuple(args, "swiginit", 2, 2, obj)) {
     return NULL;
   } else {
     SwigPyObject *sthis = SWIG_Python_GetSwigThis(obj[0]);
@@ -2595,12 +2605,10 @@
   assert(!(flags & SWIG_BUILTIN_TP_INIT));
 
   robj = SwigPyObject_New(ptr, type, own);
-  if (clientdata && !(flags & SWIG_POINTER_NOSHADOW)) {
+  if (robj && clientdata && !(flags & SWIG_POINTER_NOSHADOW)) {
     PyObject *inst = SWIG_Python_NewShadowInstance(clientdata, robj);
-    if (inst) {
-      Py_DECREF(robj);
-      robj = inst;
-    }
+    Py_DECREF(robj);
+    robj = inst;
   }
   return robj;
 }
@@ -2621,7 +2629,7 @@
 #endif
 
 SWIGRUNTIME swig_module_info *
-SWIG_Python_GetModule(void) {
+SWIG_Python_GetModule(void *SWIGUNUSEDPARM(clientdata)) {
   static void *type_pointer = (void *)0;
   /* first check if module already created */
   if (!type_pointer) {
@@ -2747,7 +2755,7 @@
     descriptor = (swig_type_info *) PyCObject_AsVoidPtr(obj);
 #endif
   } else {
-    swig_module_info *swig_module = SWIG_Python_GetModule();
+    swig_module_info *swig_module = SWIG_GetModule(0);
     descriptor = SWIG_TypeQueryModule(swig_module, swig_module, type);
     if (descriptor) {
 #ifdef SWIGPY_USE_CAPSULE
@@ -2815,7 +2823,7 @@
 {
   SwigPyObject *v = (SwigPyObject *)self;
   swig_type_info *ty = v ? v->ty : 0;
-  return ty ? ty->str : (char*)"";
+  return ty ? ty->str : "";
 }
 
 SWIGRUNTIME void
@@ -2872,6 +2880,7 @@
   return result;
 }
 
+#ifdef SWIGPYTHON_BUILTIN
 SWIGRUNTIME int
 SWIG_Python_NonDynamicSetAttr(PyObject *obj, PyObject *name, PyObject *value) {
   PyTypeObject *tp = obj->ob_type;
@@ -2880,15 +2889,15 @@
   descrsetfunc f;
   int res;
 
-#ifdef Py_USING_UNICODE
+# ifdef Py_USING_UNICODE
   if (PyString_Check(name)) {
     name = PyUnicode_Decode(PyString_AsString(name), PyString_Size(name), NULL, NULL);
     if (!name)
       return -1;
   } else if (!PyUnicode_Check(name))
-#else
+# else
   if (!PyString_Check(name))
-#endif
+# endif
   {
     PyErr_Format(PyExc_TypeError, "attribute name must be string, not '%.200s'", name->ob_type->tp_name);
     return -1;
@@ -2923,6 +2932,7 @@
   Py_DECREF(name);
   return res;
 }
+#endif
 
 
 #ifdef __cplusplus
@@ -2998,7 +3008,7 @@
 #endif
 #define SWIG_name    "_geos"
 
-#define SWIGVERSION 0x020004 
+#define SWIGVERSION 0x020010 
 #define SWIG_VERSION SWIGVERSION
 
 
@@ -3097,7 +3107,10 @@
 #include <stdexcept>
 #include <stddef.h>
 
-  
+
+  #include <stddef.h>
+
+
 namespace swig {
   struct stop_iteration {
   };
@@ -3308,6 +3321,7 @@
 SWIGINTERN int
 SWIG_AsVal_unsigned_SS_long (PyObject *obj, unsigned long *val) 
 {
+#if PY_VERSION_HEX < 0x03000000
   if (PyInt_Check(obj)) {
     long v = PyInt_AsLong(obj);
     if (v >= 0) {
@@ -3316,13 +3330,27 @@
     } else {
       return SWIG_OverflowError;
     }
-  } else if (PyLong_Check(obj)) {
+  } else
+#endif
+  if (PyLong_Check(obj)) {
     unsigned long v = PyLong_AsUnsignedLong(obj);
     if (!PyErr_Occurred()) {
       if (val) *val = v;
       return SWIG_OK;
     } else {
       PyErr_Clear();
+#if PY_VERSION_HEX >= 0x03000000
+      {
+        long v = PyLong_AsLong(obj);
+        if (!PyErr_Occurred()) {
+          if (v < 0) {
+            return SWIG_OverflowError;
+          }
+        } else {
+          PyErr_Clear();
+        }
+      }
+#endif
     }
   }
 #ifdef SWIG_PYTHON_CAST_MODE
@@ -3359,7 +3387,7 @@
 }
 
 
-  #define SWIG_From_long   PyInt_FromLong 
+  #define SWIG_From_long   PyLong_FromLong 
 
 
 SWIGINTERNINLINE PyObject *
@@ -3439,10 +3467,10 @@
 #include <stdarg.h>
 
 
-SWIGINTERNINLINE PyObject *
-SWIG_From_int  (int value)
-{    
-  return SWIG_From_long  (value);
+SWIGINTERNINLINE PyObject*
+  SWIG_From_int  (int value)
+{
+  return PyInt_FromLong((long) value);
 }
 
 
@@ -3592,20 +3620,12 @@
         return result;
     }
 
-SWIGINTERNINLINE PyObject* 
-SWIG_From_unsigned_SS_long  (unsigned long value)
+SWIGINTERNINLINE PyObject*
+  SWIG_From_unsigned_SS_int  (unsigned int value)
 {
-  return (value > LONG_MAX) ?
-    PyLong_FromUnsignedLong(value) : PyInt_FromLong(static_cast< long >(value)); 
+  return PyInt_FromSize_t((size_t) value);
 }
 
-
-SWIGINTERNINLINE PyObject *
-SWIG_From_unsigned_SS_int  (unsigned int value)
-{    
-  return SWIG_From_unsigned_SS_long  (value);
-}
-
 SWIGINTERN unsigned int GeosCoordinateSequence_getDimensions(GeosCoordinateSequence *self){
         unsigned int result;
         GEOSCoordSeq coords = (GEOSCoordSeq) self;
@@ -3704,6 +3724,14 @@
         return GEOSGeom_getDimensions(geom);
     }
 
+SWIGINTERNINLINE PyObject* 
+SWIG_From_unsigned_SS_long  (unsigned long value)
+{
+  return (value > LONG_MAX) ?
+    PyLong_FromUnsignedLong(value) : PyLong_FromLong(static_cast< long >(value)); 
+}
+
+
 SWIGINTERNINLINE PyObject *
 SWIG_From_size_t  (size_t value)
 {    
@@ -10438,8 +10466,6 @@
   swig_module_info *module_head, *iter;
   int found, init;
   
-  clientdata = clientdata;
-  
   /* check to see if the circular list has been setup, if not, set it up */
   if (swig_module.next==0) {
     /* Initialize the swig_module */
@@ -11012,6 +11038,7 @@
   m = Py_InitModule((char *) SWIG_name, SwigMethods);
 #endif
   md = d = PyModule_GetDict(m);
+  (void)md;
   
   SWIG_InitializeModule(0);
   
@@ -11054,15 +11081,15 @@
   SWIG_InstallConstants(d,swig_const_table);
   
   SWIG_Python_SetConstant(d, "GEOS_VERSION_MAJOR",SWIG_From_int(static_cast< int >(3)));
-  SWIG_Python_SetConstant(d, "GEOS_VERSION_MINOR",SWIG_From_int(static_cast< int >(4)));
-  SWIG_Python_SetConstant(d, "GEOS_VERSION",SWIG_FromCharPtr("3.4.0dev"));
-  SWIG_Python_SetConstant(d, "GEOS_JTS_PORT",SWIG_FromCharPtr("1.12.0"));
+  SWIG_Python_SetConstant(d, "GEOS_VERSION_MINOR",SWIG_From_int(static_cast< int >(5)));
+  SWIG_Python_SetConstant(d, "GEOS_VERSION",SWIG_FromCharPtr("3.5.0dev"));
+  SWIG_Python_SetConstant(d, "GEOS_JTS_PORT",SWIG_FromCharPtr("1.13.0"));
   SWIG_Python_SetConstant(d, "GEOS_CAPI_VERSION_MAJOR",SWIG_From_int(static_cast< int >(1)));
-  SWIG_Python_SetConstant(d, "GEOS_CAPI_VERSION_MINOR",SWIG_From_int(static_cast< int >(8)));
+  SWIG_Python_SetConstant(d, "GEOS_CAPI_VERSION_MINOR",SWIG_From_int(static_cast< int >(9)));
   SWIG_Python_SetConstant(d, "GEOS_CAPI_VERSION_PATCH",SWIG_From_int(static_cast< int >(0)));
   SWIG_Python_SetConstant(d, "GEOS_CAPI_FIRST_INTERFACE",SWIG_From_int(static_cast< int >(1)));
-  SWIG_Python_SetConstant(d, "GEOS_CAPI_LAST_INTERFACE",SWIG_From_int(static_cast< int >((1+8))));
-  SWIG_Python_SetConstant(d, "GEOS_CAPI_VERSION",SWIG_FromCharPtr("3.4.0dev-CAPI-1.8.0"));
+  SWIG_Python_SetConstant(d, "GEOS_CAPI_LAST_INTERFACE",SWIG_From_int(static_cast< int >((1+9))));
+  SWIG_Python_SetConstant(d, "GEOS_CAPI_VERSION",SWIG_FromCharPtr("3.5.0dev-CAPI-1.9.0"));
   SWIG_Python_SetConstant(d, "GEOS_POINT",SWIG_From_int(static_cast< int >(GEOS_POINT)));
   SWIG_Python_SetConstant(d, "GEOS_LINESTRING",SWIG_From_int(static_cast< int >(GEOS_LINESTRING)));
   SWIG_Python_SetConstant(d, "GEOS_LINEARRING",SWIG_From_int(static_cast< int >(GEOS_LINEARRING)));

Modified: trunk/tests/unit/capi/GEOSVoronoiDiagramTest.cpp
===================================================================
--- trunk/tests/unit/capi/GEOSVoronoiDiagramTest.cpp	2014-05-21 14:21:10 UTC (rev 3984)
+++ trunk/tests/unit/capi/GEOSVoronoiDiagramTest.cpp	2014-05-21 16:08:38 UTC (rev 3985)
@@ -90,12 +90,12 @@
     {
 	    geom1_ = GEOSGeomFromWKT("POINT(10 20)");
 
-	    geom2_ = GEOSVoronoiDiagram(geom1_,0, 0);
+	    geom2_ = GEOSVoronoiDiagram(geom1_, 0, 0, 0);
 	    ensure_equals ( GEOSisEmpty(geom2_), 1 );
 	    ensure_equals ( GEOSGeomTypeId(geom2_), GEOS_GEOMETRYCOLLECTION );
 
 	    GEOSGeom_destroy(geom2_);
-	    geom2_ = GEOSVoronoiDiagram(geom1_, 0, 1); 
+	    geom2_ = GEOSVoronoiDiagram(geom1_, 0, 0, 1); 
 	    char* wkt_c = GEOSWKTWriter_write(w_, geom2_);
 	    std::string out(wkt_c);
 	    free(wkt_c);
@@ -109,11 +109,11 @@
     {
 	    geom1_ = GEOSGeomFromWKT("MULTIPOINT ((280 300), (420 330), (380 230), (320 160))");
 
-	    geom2_ = GEOSVoronoiDiagram(geom1_,0,0);
+	    geom2_ = GEOSVoronoiDiagram(geom1_, 0, 0, 0);
 	    ensure_equals_wkt(geom2_ ,"GEOMETRYCOLLECTION (POLYGON ((110 175.71428571428572, 110 500, 310.35714285714283 500, 353.515625 298.59375, 306.875 231.96428571428572, 110 175.71428571428572)), POLYGON ((590 204, 590 -10, 589.1666666666666 -10, 306.875 231.96428571428572, 353.515625 298.59375, 590 204)), POLYGON ((110 -10, 110 175.71428571428572, 306.875 231.96428571428572, 589.1666666666666 -10, 110 -10)), POLYGON ((310.35714285714283 500, 590 500, 590 204, 353.515625 298.59375, 310.35714285714283 500)))" );
 
 	    GEOSGeom_destroy(geom2_);
-	    geom2_ = GEOSVoronoiDiagram(geom1_, 0, 1); 
+	    geom2_ = GEOSVoronoiDiagram(geom1_, 0, 0, 1); 
 	    char* wkt_c = GEOSWKTWriter_write(w_, geom2_);
 	    std::string out(wkt_c);
 	    free(wkt_c);
@@ -126,11 +126,11 @@
     {
 	    geom1_ = GEOSGeomFromWKT("MULTIPOINT ((170 270), (270 270), (230 310), (180 330), (250 340), (315 318), (330 260), (240 170), (220 220), (270 220))");
 
-	    geom2_ = GEOSVoronoiDiagram(geom1_,0,0);
+	    geom2_ = GEOSVoronoiDiagram(geom1_, 0, 0, 0);
 	    ensure_equals_wkt(geom2_,"GEOMETRYCOLLECTION (POLYGON ((0 329.1666666666667, 0 510, 190 510, 213.94736842105263 342.36842105263156, 195.625 296.5625, 0 329.1666666666667)), POLYGON ((0 76.50000000000001, 0 329.1666666666667, 195.625 296.5625, 216 266, 88.33333333333333 138.33333333333334, 0 76.50000000000001)), POLYGON ((216 266, 195.625 296.5625, 213.94736842105263 342.36842105263156, 267 307, 225 265, 216 266)), POLYGON ((245 245, 225 265, 267 307, 275.9160583941606 309.54744525547443, 303.1666666666667 284, 296.6666666666667 245, 245 245)), POLYGON ((225 265, 245 245, 245 201, 88.33333333333333 138.33333333333334, 216 266, 225 265)), POLYGON ((0 0, 0 76.50000000000001, 88.33333333333333 138.33333333333334, 245 201, 380 120, 500 0, 0 0)), POLYGON ((190 510, 343.76153846153846 510, 275.9160583941606 309.54744525547443, 267 307, 213.94736842105263 342.36842105263156, 190 510)), POLYGON ((245 201, 245 245, 296.6666666666667 245, 380 120, 245 201)), POLYGON ((343.76153846
 153846 510, 500 510, 500 334.9051724137931, 303.1666666666667 284, 275.9160583941606 309.54744525547443, 343.76153846153846 510)), POLYGON ((500 334.9051724137931, 500 0, 380 120, 296.6666666666667 245, 303.1666666666667 284, 500 334.9051724137931)))");
 
 	    GEOSGeom_destroy(geom2_);
-	    geom2_ = GEOSVoronoiDiagram(geom1_, 0, 1);
+	    geom2_ = GEOSVoronoiDiagram(geom1_, 0, 0, 1);
 	    char* wkt_c = GEOSWKTWriter_write(w_, geom2_); 
 	    std::string out(wkt_c);
 	    free(wkt_c);
@@ -145,11 +145,11 @@
     {
 	    geom1_ = GEOSGeomFromWKT("MULTIPOINT ((150 210), (210 270), (150 220), (220 210), (215 269))");
 
-	    geom2_ = GEOSVoronoiDiagram(geom1_,10,0);
+	    geom2_ = GEOSVoronoiDiagram(geom1_, 0, 10, 0);
 	    ensure_equals_wkt(geom2_,"GEOMETRYCOLLECTION (POLYGON ((290 252.5, 290 140, 185 140, 185 215, 187.9268292682927 235.4878048780488, 290 252.5)), POLYGON ((80 215, 80 340, 100.83333333333336 340, 187.9268292682927 235.4878048780488, 185 215, 80 215)), POLYGON ((80 140, 80 215, 185 215, 185 140, 80 140)), POLYGON ((100.83333333333336 340, 290 340, 290 252.5, 187.9268292682927 235.4878048780488, 100.83333333333336 340)))");
 
 	    GEOSGeom_destroy(geom2_);
-	    geom2_ = GEOSVoronoiDiagram(geom1_, 10, 1);
+	    geom2_ = GEOSVoronoiDiagram(geom1_, 0, 10, 1);
 	    char* wkt_c = GEOSWKTWriter_write(w_, geom2_); 
 	    std::string out(wkt_c);
 	    free(wkt_c);
@@ -163,11 +163,11 @@
     {
 	    geom1_ = GEOSGeomFromWKT("MULTIPOINT ((40 420), (50 420), (210 290), (300 360), (350 150), (170 70), (134 135) ,(305 359), (351 145), (175 71))");
 
-	    geom2_ = GEOSVoronoiDiagram(geom1_,10,0);
+	    geom2_ = GEOSVoronoiDiagram(geom1_, 0, 10, 0);
 	    ensure_equals_wkt(geom2_, "GEOMETRYCOLLECTION (POLYGON ((-310 146.559649122807, -310 770, 45 770, 45 263.64736842105265, -310 146.559649122807)), POLYGON ((-310 -153.37692307692305, -310 146.559649122807, 45 263.64736842105265, 59.16911764705881 267.8235294117647, 239.43506493506493 179.43506493506493, 241.34156378600824 151.98148148148147, -310 -153.37692307692305)), POLYGON ((45 770, 266.20000000000005 770, 181.94323144104806 418.9301310043668, 59.16911764705881 267.8235294117647, 45 263.64736842105265, 45 770)), POLYGON ((59.16911764705881 267.8235294117647, 181.94323144104806 418.9301310043668, 311.875 251.875, 239.43506493506493 179.43506493506493, 59.16911764705881 267.8235294117647)), POLYGON ((-310 -280, -310 -153.37692307692305, 241.34156378600824 151.98148148148147, 433.3333333333333 -280, -310 -280)), POLYGON ((266.20000000000005 770, 701 770, 701 344.5238095238096, 311.875 251.875, 181.94323144104806 418.9301310043668, 266.20000000000005 770)), POLYGON ((701
  344.5238095238096, 701 -280, 433.3333333333333 -280, 241.34156378600824 151.98148148148147, 239.43506493506493 179.43506493506493, 311.875 251.875, 701 344.5238095238096)))");
 
 	    GEOSGeom_destroy(geom2_);
-	    geom2_ = GEOSVoronoiDiagram(geom1_, 10, 1);
+	    geom2_ = GEOSVoronoiDiagram(geom1_, 0, 10, 1);
 	    char* wkt_c = GEOSWKTWriter_write(w_, geom2_);
 	    std::string out(wkt_c);
 	    free(wkt_c);
@@ -180,7 +180,7 @@
     void object::test<6>()
     {
 	    geom1_ = GEOSGeomFromWKT("MULTIPOINT ((123 245), (165 313), (240 310), (260 260), (180 210), (240 210))");
-	    geom2_ = GEOSVoronoiDiagram(geom1_,0,1);
+	    geom2_ = GEOSVoronoiDiagram(geom1_, 0, 0, 1);
 
 	    char* wkt_c = GEOSWKTWriter_write(w_, geom2_);
 	    std::string out(wkt_c);



More information about the geos-commits mailing list