From: <js...@us...> - 2007-11-13 20:52:32
|
Revision: 4251 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4251&view=rev Author: jswhit Date: 2007-11-13 12:52:18 -0800 (Tue, 13 Nov 2007) Log Message: ----------- Add new custom pyrex wrapper of libgeos - Shapely no longer needed. Modified Paths: -------------- trunk/toolkits/basemap-testing/README trunk/toolkits/basemap-testing/setup.py Added Paths: ----------- trunk/toolkits/basemap-testing/src/geos.c trunk/toolkits/basemap-testing/src/geos.pyx Modified: trunk/toolkits/basemap-testing/README =================================================================== --- trunk/toolkits/basemap-testing/README 2007-11-13 20:37:11 UTC (rev 4250) +++ trunk/toolkits/basemap-testing/README 2007-11-13 20:52:18 UTC (rev 4251) @@ -13,10 +13,6 @@ libgoes_c version 2.2.3, available from http://geos.refractions.net/. -ctypes (which comes with python >= 2.5, -but can be installed separately for python 2.4 from -http:/python.org/pypi/ctypes). - **Copyright** source code from proj.4 (http://proj.maptools.org) is included in the @@ -25,10 +21,6 @@ pyshapelib by Bernhard Herzog is included in the 'pyshapelib' directory under the terms given in LICENSE_pyshapelib. -The Shapely module (http://trac.gispython.org/projects/PCL/wiki/Shapely) by -Sean Gillies is included in the 'lib/shapely' directory under the terms -given in LICENSE_shapely. - the coastline, lake, river and political boundary data are extracted from datasets provided with the Generic Mapping Tools (http://gmt.soest.hawaii.edu) @@ -39,7 +31,7 @@ is included. Everything else (including src/_proj.pyx, src/_geod.pyx, src/_pyproj.pxi, -src/_proj.c and src/_geod.c): +src/_proj.c and src/_geod.c, src/_geos.c, src/_geos.pyx): copyright (c) 2007 by Jeffrey Whitaker. Modified: trunk/toolkits/basemap-testing/setup.py =================================================================== --- trunk/toolkits/basemap-testing/setup.py 2007-11-13 20:37:11 UTC (rev 4250) +++ trunk/toolkits/basemap-testing/setup.py 2007-11-13 20:52:18 UTC (rev 4251) @@ -1,10 +1,18 @@ import sys, glob, os major, minor1, minor2, s, tmp = sys.version_info -if major==2 and minor1<4: - raise SystemExit(""" -python 2.4 or higher required""") +if major==2 and minor1<=3: + # setuptools monkeypatches distutils.core.Distribution to support + # package_data + try: import setuptools + except ImportError: + raise SystemExit("""\ +matplotlib requires setuptools for installation. Please download +http://peak.telecommunity.com/dist/ez_setup.py and run it (as su if +you are doing a system wide install) to install the proper version of +setuptools for your system""") from distutils.core import Extension from distutils.util import convert_path +import numpy def dbf_macros(): """Return the macros to define when compiling the dbflib wrapper. @@ -23,14 +31,22 @@ else: return [("HAVE_UPDATE_HEADER", "0")] +GEOS_dir = os.environ.get('GEOS_DIR') +if GEOS_dir is None: + raise KeyError, 'please specify the location of geos library and headers with GEOS_DIR environment variable' +geos_include_dirs=[os.path.join(GEOS_dir,'include'),numpy.get_include()] +geos_library_dirs=[os.path.join(GEOS_dir,'lib')] + deps = glob.glob('src/*.c') deps.remove(os.path.join('src','_proj.c')) deps.remove(os.path.join('src','_geod.c')) +deps.remove(os.path.join('src','geos.c')) packages = ['matplotlib.toolkits.basemap'] package_dirs = {'':'lib'} extensions = [Extension("matplotlib.toolkits.basemap._proj",deps+['src/_proj.c'],include_dirs = ['src'],)] extensions.append(Extension("matplotlib.toolkits.basemap._geod",deps+['src/_geod.c'],include_dirs = ['src'],)) +extensions.append(Extension("matplotlib.toolkits.basemap.geos",deps+['src/geos.c'],library_dirs=geos_library_dirs,include_dirs=geos_include_dirs,runtime_library_dirs=geos_library_dirs,libraries=['geos_c'])) # install shapelib and dbflib. packages = packages + ['shapelib','dbflib'] @@ -61,32 +77,6 @@ additional_params = {} from distutils.core import setup -# check for ctypes -try: from ctypes.util import find_library -except ImportError: havectypes = False -else: havectypes = True -if not havectypes: - raise SystemExit(""" -basemap requires ctypes, which comes with python 2.5. If you are -running python 2.4, please install ctypes from -http://pypi.python.org/pypi/ctypes""") - -# check for libgeos_c -sys.path.append('lib/shapely') -from find_geoslib import find_geoslib -lgeos = find_geoslib() -sys.path.remove('lib/shapely') - -# check for shapely -try: import shapely -except ImportError: haveshapely = False -else: haveshapely = True -if not haveshapely: - packages.append('shapely') - packages.append('shapely.geometry') - package_dirs['shapely'] = os.path.join('lib','shapely') - - # Specify all the required mpl data pyproj_datafiles = ['data/epsg', 'data/esri', 'data/esri.extra', 'data/GL27', 'data/nad.lst', 'data/nad27', 'data/nad83', 'data/ntv2_out.dist', 'data/other.extra', 'data/pj_out27.dist', 'data/pj_out83.dist', 'data/proj_def.dat', 'data/README', 'data/td_out.dist', 'data/test27', 'data/test83', 'data/testntv2', 'data/testvarious', 'data/world'] boundaryfiles = [] Added: trunk/toolkits/basemap-testing/src/geos.c =================================================================== --- trunk/toolkits/basemap-testing/src/geos.c (rev 0) +++ trunk/toolkits/basemap-testing/src/geos.c 2007-11-13 20:52:18 UTC (rev 4251) @@ -0,0 +1,3104 @@ +/* Generated by Cython 0.9.6.7 on Tue Nov 13 13:39:59 2007 */ + +#define PY_SSIZE_T_CLEAN +#include "Python.h" +#include "structmember.h" +#ifndef PY_LONG_LONG + #define PY_LONG_LONG LONG_LONG +#endif +#if PY_VERSION_HEX < 0x02050000 + typedef int Py_ssize_t; + #define PY_SSIZE_T_MAX INT_MAX + #define PY_SSIZE_T_MIN INT_MIN + #define PyInt_FromSsize_t(z) PyInt_FromLong(z) + #define PyInt_AsSsize_t(o) PyInt_AsLong(o) + #define PyNumber_Index(o) PyNumber_Int(o) + #define PyIndex_Check(o) PyNumber_Check(o) +#endif +#ifdef __cplusplus +#define __PYX_EXTERN_C extern "C" +#else +#define __PYX_EXTERN_C extern +#endif +__PYX_EXTERN_C double pow(double, double); +#include "numpy/arrayobject.h" +#include "geos_c.h" + + +#ifdef __GNUC__ +#define INLINE __inline__ +#elif _WIN32 +#define INLINE __inline +#else +#define INLINE +#endif + +typedef struct {const char *s; const void **p;} __Pyx_CApiTabEntry; /*proto*/ +typedef struct {PyObject **p; char *s;} __Pyx_InternTabEntry; /*proto*/ +typedef struct {PyObject **p; char *s; long n; int is_unicode;} __Pyx_StringTabEntry; /*proto*/ + +#define __pyx_PyIndex_AsSsize_t(b) PyInt_AsSsize_t(PyNumber_Index(b)) + +#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False)) +static INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { + if (x == Py_True) return 1; + else if (x == Py_False) return 0; + else return PyObject_IsTrue(x); +} + + +#ifdef __GNUC__ +/* Test for GCC > 2.95 */ +#if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)) +#define likely(x) __builtin_expect(!!(x), 1) +#define unlikely(x) __builtin_expect(!!(x), 0) +#else /* __GNUC__ > 2 ... */ +#define likely(x) (x) +#define unlikely(x) (x) +#endif /* __GNUC__ > 2 ... */ +#else /* __GNUC__ */ +#define likely(x) (x) +#define unlikely(x) (x) +#endif /* __GNUC__ */ + +static PyObject *__pyx_m; +static PyObject *__pyx_b; +static int __pyx_lineno; +static char *__pyx_filename; +static char **__pyx_f; + +static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, char *name); /*proto*/ + +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list); /*proto*/ + +static PyObject *__Pyx_GetExcValue(void); /*proto*/ + +static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/ + +static void __Pyx_WriteUnraisable(char *name); /*proto*/ + +static int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/ + +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ + +static int __Pyx_InternStrings(__Pyx_InternTabEntry *t); /*proto*/ + +static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ + +static PyTypeObject *__Pyx_ImportType(char *module_name, char *class_name, long size); /*proto*/ + +static void __Pyx_AddTraceback(char *funcname); /*proto*/ + +/* Declarations from geos */ + + +struct __pyx_obj_4geos_BaseGeometry { + PyObject_HEAD + GEOSGeom (*_geom); + unsigned int _npts; +}; + + +struct __pyx_obj_4geos_Polygon { + struct __pyx_obj_4geos_BaseGeometry __pyx_base; +}; + + +struct __pyx_obj_4geos_LineString { + struct __pyx_obj_4geos_BaseGeometry __pyx_base; +}; + + +struct __pyx_obj_4geos_Point { + struct __pyx_obj_4geos_BaseGeometry __pyx_base; + PyObject *x; + PyObject *y; +}; + +static PyTypeObject *__pyx_ptype_4geos_ndarray = 0; +static PyTypeObject *__pyx_ptype_4geos_BaseGeometry = 0; +static PyTypeObject *__pyx_ptype_4geos_Polygon = 0; +static PyTypeObject *__pyx_ptype_4geos_LineString = 0; +static PyTypeObject *__pyx_ptype_4geos_Point = 0; +static PyArrayObject *__pyx_k4; +static PyArrayObject *__pyx_k5; +static PyObject *__pyx_k6; +static void (__pyx_f_4geos_notice_h(char (*),char (*))); /*proto*/ +static void (__pyx_f_4geos_error_h(char (*),char (*))); /*proto*/ +static PyObject *(__pyx_f_4geos__add_geom(struct __pyx_obj_4geos_BaseGeometry *,GEOSGeom (*))); /*proto*/ +static PyObject *(__pyx_f_4geos__get_coords(GEOSGeom (*))); /*proto*/ + + +/* Implementation of geos */ + +static char (__pyx_k3[]) = "0.1"; + +static PyObject *__pyx_n_sys; +static PyObject *__pyx_n_numpy; +static PyObject *__pyx_n___version__; +static PyObject *__pyx_n_is_valid; +static PyObject *__pyx_n_geom_type; +static PyObject *__pyx_n_within; +static PyObject *__pyx_n_intersects; +static PyObject *__pyx_n_intersection; +static PyObject *__pyx_n_get_coords; +static PyObject *__pyx_n___init__; +static PyObject *__pyx_n_area; + +static PyObject *__pyx_k3p; + +static PyObject *__pyx_n_stdout; +static PyObject *__pyx_n_write; + +static PyObject *__pyx_k7p; + +static char (__pyx_k7[]) = "GEOS_NOTICE: %s\n"; + +static void __pyx_f_4geos_notice_h(char (*__pyx_v_fmt),char (*__pyx_v_msg)) { + PyObject *__pyx_v_format; + PyObject *__pyx_v_message; + PyObject *__pyx_v_warn_msg; + PyObject *__pyx_1 = 0; + PyObject *__pyx_2 = 0; + PyObject *__pyx_3 = 0; + __pyx_v_format = Py_None; Py_INCREF(Py_None); + __pyx_v_message = Py_None; Py_INCREF(Py_None); + __pyx_v_warn_msg = Py_None; Py_INCREF(Py_None); + + /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/geos.pyx":99 + * + * cdef void notice_h(char *fmt, char*msg): + * format = PyString_FromString(fmt) # <<<<<<<<<<<<<< + * message = PyString_FromString(msg) + * try: + */ + __pyx_1 = PyString_FromString(__pyx_v_fmt); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; goto __pyx_L1;} + Py_DECREF(__pyx_v_format); + __pyx_v_format = __pyx_1; + __pyx_1 = 0; + + /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/geos.pyx":100 + * cdef void notice_h(char *fmt, char*msg): + * format = PyString_FromString(fmt) + * message = PyString_FromString(msg) # <<<<<<<<<<<<<< + * try: + * warn_msg = format % message + */ + __pyx_1 = PyString_FromString(__pyx_v_msg); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; goto __pyx_L1;} + Py_DECREF(__pyx_v_message); + __pyx_v_message = __pyx_1; + __pyx_1 = 0; + + /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/geos.pyx":101 + * format = PyString_FromString(fmt) + * message = PyString_FromString(msg) + * try: # <<<<<<<<<<<<<< + * warn_msg = format % message + * except: + */ + /*try:*/ { + + /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/geos.pyx":102 + * message = PyString_FromString(msg) + * try: + * warn_msg = format % message # <<<<<<<<<<<<<< + * except: + * warn_msg = format + */ + __pyx_1 = PyNumber_Remainder(__pyx_v_format, __pyx_v_message); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; goto __pyx_L2;} + Py_DECREF(__pyx_v_warn_msg); + __pyx_v_warn_msg = __pyx_1; + __pyx_1 = 0; + } + goto __pyx_L3; + __pyx_L2:; + Py_XDECREF(__pyx_1); __pyx_1 = 0; + + /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/geos.pyx":103 + * try: + * warn_msg = format % message + * except: # <<<<<<<<<<<<<< + * warn_msg = format + * sys.stdout.write('GEOS_NOTICE: %s\n' % warn_msg) + */ + /*except:*/ { + __Pyx_AddTraceback("geos.notice_h"); + __pyx_1 = __Pyx_GetExcValue(); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; goto __pyx_L1;} + Py_DECREF(__pyx_1); __pyx_1 = 0; + + /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/geos.pyx":104 + * warn_msg = format % message + * except: + * warn_msg = format # <<<<<<<<<<<<<< + * sys.stdout.write('GEOS_NOTICE: %s\n' % warn_msg) + * + */ + Py_INCREF(__pyx_v_format); + Py_DECREF(__pyx_v_warn_msg); + __pyx_v_warn_msg = __pyx_v_format; + goto __pyx_L3; + } + __pyx_L3:; + + /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/geos.pyx":105 + * except: + * warn_msg = format + * sys.stdout.write('GEOS_NOTICE: %s\n' % warn_msg) # <<<<<<<<<<<<<< + * + * cdef void error_h(char *fmt, char*msg): + */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n_sys); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; goto __pyx_L1;} + __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_stdout); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; goto __pyx_L1;} + Py_DECREF(__pyx_1); __pyx_1 = 0; + __pyx_1 = PyObject_GetAttr(__pyx_2, __pyx_n_write); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + __pyx_2 = PyNumber_Remainder(__pyx_k7p, __pyx_v_warn_msg); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; goto __pyx_L1;} + __pyx_3 = PyTuple_New(1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; goto __pyx_L1;} + PyTuple_SET_ITEM(__pyx_3, 0, __pyx_2); + __pyx_2 = 0; + __pyx_2 = PyObject_CallObject(__pyx_1, __pyx_3); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; goto __pyx_L1;} + Py_DECREF(__pyx_1); __pyx_1 = 0; + Py_DECREF(__pyx_3); __pyx_3 = 0; + Py_DECREF(__pyx_2); __pyx_2 = 0; + + goto __pyx_L0; + __pyx_L1:; + Py_XDECREF(__pyx_1); + Py_XDECREF(__pyx_2); + Py_XDECREF(__pyx_3); + __Pyx_WriteUnraisable("geos.notice_h"); + __pyx_L0:; + Py_DECREF(__pyx_v_format); + Py_DECREF(__pyx_v_message); + Py_DECREF(__pyx_v_warn_msg); +} + +static PyObject *__pyx_n_stderr; + +static PyObject *__pyx_k8p; + +static char (__pyx_k8[]) = "GEOS_ERROR: %s\n"; + +static void __pyx_f_4geos_error_h(char (*__pyx_v_fmt),char (*__pyx_v_msg)) { + PyObject *__pyx_v_format; + PyObject *__pyx_v_message; + PyObject *__pyx_v_warn_msg; + PyObject *__pyx_1 = 0; + PyObject *__pyx_2 = 0; + PyObject *__pyx_3 = 0; + __pyx_v_format = Py_None; Py_INCREF(Py_None); + __pyx_v_message = Py_None; Py_INCREF(Py_None); + __pyx_v_warn_msg = Py_None; Py_INCREF(Py_None); + + /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/geos.pyx":108 + * + * cdef void error_h(char *fmt, char*msg): + * format = PyString_FromString(fmt) # <<<<<<<<<<<<<< + * message = PyString_FromString(msg) + * try: + */ + __pyx_1 = PyString_FromString(__pyx_v_fmt); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; goto __pyx_L1;} + Py_DECREF(__pyx_v_format); + __pyx_v_format = __pyx_1; + __pyx_1 = 0; + + /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/geos.pyx":109 + * cdef void error_h(char *fmt, char*msg): + * format = PyString_FromString(fmt) + * message = PyString_FromString(msg) # <<<<<<<<<<<<<< + * try: + * warn_msg = format % message + */ + __pyx_1 = PyString_FromString(__pyx_v_msg); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; goto __pyx_L1;} + Py_DECREF(__pyx_v_message); + __pyx_v_message = __pyx_1; + __pyx_1 = 0; + + /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/geos.pyx":110 + * format = PyString_FromString(fmt) + * message = PyString_FromString(msg) + * try: # <<<<<<<<<<<<<< + * warn_msg = format % message + * except: + */ + /*try:*/ { + + /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/geos.pyx":111 + * message = PyString_FromString(msg) + * try: + * warn_msg = format % message # <<<<<<<<<<<<<< + * except: + * warn_msg = format + */ + __pyx_1 = PyNumber_Remainder(__pyx_v_format, __pyx_v_message); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; goto __pyx_L2;} + Py_DECREF(__pyx_v_warn_msg); + __pyx_v_warn_msg = __pyx_1; + __pyx_1 = 0; + } + goto __pyx_L3; + __pyx_L2:; + Py_XDECREF(__pyx_1); __pyx_1 = 0; + + /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/geos.pyx":112 + * try: + * warn_msg = format % message + * except: # <<<<<<<<<<<<<< + * warn_msg = format + * sys.stderr.write('GEOS_ERROR: %s\n' % warn_msg) + */ + /*except:*/ { + __Pyx_AddTraceback("geos.error_h"); + __pyx_1 = __Pyx_GetExcValue(); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; goto __pyx_L1;} + Py_DECREF(__pyx_1); __pyx_1 = 0; + + /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/geos.pyx":113 + * warn_msg = format % message + * except: + * warn_msg = format # <<<<<<<<<<<<<< + * sys.stderr.write('GEOS_ERROR: %s\n' % warn_msg) + * + */ + Py_INCREF(__pyx_v_format); + Py_DECREF(__pyx_v_warn_msg); + __pyx_v_warn_msg = __pyx_v_format; + goto __pyx_L3; + } + __pyx_L3:; + + /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/geos.pyx":114 + * except: + * warn_msg = format + * sys.stderr.write('GEOS_ERROR: %s\n' % warn_msg) # <<<<<<<<<<<<<< + * + * # The initGEOS routine should be called first, however, that routine takes + */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n_sys); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; goto __pyx_L1;} + __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_stderr); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; goto __pyx_L1;} + Py_DECREF(__pyx_1); __pyx_1 = 0; + __pyx_1 = PyObject_GetAttr(__pyx_2, __pyx_n_write); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + __pyx_2 = PyNumber_Remainder(__pyx_k8p, __pyx_v_warn_msg); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; goto __pyx_L1;} + __pyx_3 = PyTuple_New(1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; goto __pyx_L1;} + PyTuple_SET_ITEM(__pyx_3, 0, __pyx_2); + __pyx_2 = 0; + __pyx_2 = PyObject_CallObject(__pyx_1, __pyx_3); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; goto __pyx_L1;} + Py_DECREF(__pyx_1); __pyx_1 = 0; + Py_DECREF(__pyx_3); __pyx_3 = 0; + Py_DECREF(__pyx_2); __pyx_2 = 0; + + goto __pyx_L0; + __pyx_L1:; + Py_XDECREF(__pyx_1); + Py_XDECREF(__pyx_2); + Py_XDECREF(__pyx_3); + __Pyx_WriteUnraisable("geos.error_h"); + __pyx_L0:; + Py_DECREF(__pyx_v_format); + Py_DECREF(__pyx_v_message); + Py_DECREF(__pyx_v_warn_msg); +} + +static PyObject *__pyx_f_py_4geos_12BaseGeometry_is_valid(PyObject *__pyx_v_self, PyObject *unused); /*proto*/ +static PyObject *__pyx_f_py_4geos_12BaseGeometry_is_valid(PyObject *__pyx_v_self, PyObject *unused) { + char __pyx_v_valid; + PyObject *__pyx_r; + char __pyx_1; + Py_INCREF(__pyx_v_self); + + /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/geos.pyx":129 + * def is_valid(self): + * cdef char valid + * valid = GEOSisValid(self._geom) # <<<<<<<<<<<<<< + * if valid: + * return True + */ + __pyx_v_valid = GEOSisValid(((struct __pyx_obj_4geos_BaseGeometry *)__pyx_v_self)->_geom); + + /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/geos.pyx":130 + * cdef char valid + * valid = GEOSisValid(self._geom) + * if valid: # <<<<<<<<<<<<<< + * return True + * else: + */ + __pyx_1 = __pyx_v_valid; + if (__pyx_1) { + + /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/geos.pyx":131 + * valid = GEOSisValid(self._geom) + * if valid: + * return True # <<<<<<<<<<<<<< + * else: + * return False + */ + Py_INCREF(Py_True); + __pyx_r = Py_True; + goto __pyx_L0; + goto __pyx_L2; + } + /*else*/ { + + /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/geos.pyx":133 + * return True + * else: + * return False # <<<<<<<<<<<<<< + * + * def geom_type(self): + */ + Py_INCREF(Py_False); + __pyx_r = Py_False; + goto __pyx_L0; + } + __pyx_L2:; + + __pyx_r = Py_None; Py_INCREF(Py_None); + __pyx_L0:; + Py_DECREF(__pyx_v_self); + return __pyx_r; +} + +static PyObject *__pyx_f_py_4geos_12BaseGeometry_geom_type(PyObject *__pyx_v_self, PyObject *unused); /*proto*/ +static PyObject *__pyx_f_py_4geos_12BaseGeometry_geom_type(PyObject *__pyx_v_self, PyObject *unused) { + PyObject *__pyx_r; + PyObject *__pyx_1 = 0; + Py_INCREF(__pyx_v_self); + + /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/geos.pyx":136 + * + * def geom_type(self): + * return PyString_FromString(GEOSGeomType(self._geom)) # <<<<<<<<<<<<<< + * + * def within(self, BaseGeometry geom): + */ + __pyx_1 = PyString_FromString(GEOSGeomType(((struct __pyx_obj_4geos_BaseGeometry *)__pyx_v_self)->_geom)); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; goto __pyx_L1;} + __pyx_r = __pyx_1; + __pyx_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; Py_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1:; + Py_XDECREF(__pyx_1); + __Pyx_AddTraceback("geos.BaseGeometry.geom_type"); + __pyx_r = 0; + __pyx_L0:; + Py_DECREF(__pyx_v_self); + return __pyx_r; +} + +static PyObject *__pyx_f_py_4geos_12BaseGeometry_within(PyObject *__pyx_v_self, PyObject *__pyx_v_geom); /*proto*/ +static PyObject *__pyx_f_py_4geos_12BaseGeometry_within(PyObject *__pyx_v_self, PyObject *__pyx_v_geom) { + GEOSGeom (*__pyx_v_g1); + GEOSGeom (*__pyx_v_g2); + char __pyx_v_answer; + PyObject *__pyx_r; + char __pyx_1; + Py_INCREF(__pyx_v_self); + Py_INCREF(__pyx_v_geom); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_geom), __pyx_ptype_4geos_BaseGeometry, 1, "geom"))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; goto __pyx_L1;} + + /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/geos.pyx":141 + * cdef GEOSGeom *g1, *g2 + * cdef char answer + * g1 = self._geom # <<<<<<<<<<<<<< + * g2 = geom._geom + * answer = GEOSWithin(g1, g2) + */ + __pyx_v_g1 = ((struct __pyx_obj_4geos_BaseGeometry *)__pyx_v_self)->_geom; + + /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/geos.pyx":142 + * cdef char answer + * g1 = self._geom + * g2 = geom._geom # <<<<<<<<<<<<<< + * answer = GEOSWithin(g1, g2) + * if answer: + */ + __pyx_v_g2 = ((struct __pyx_obj_4geos_BaseGeometry *)__pyx_v_geom)->_geom; + + /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/geos.pyx":143 + * g1 = self._geom + * g2 = geom._geom + * answer = GEOSWithin(g1, g2) # <<<<<<<<<<<<<< + * if answer: + * return True + */ + __pyx_v_answer = GEOSWithin(__pyx_v_g1,__pyx_v_g2); + + /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/geos.pyx":144 + * g2 = geom._geom + * answer = GEOSWithin(g1, g2) + * if answer: # <<<<<<<<<<<<<< + * return True + * else: + */ + __pyx_1 = __pyx_v_answer; + if (__pyx_1) { + + /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/geos.pyx":145 + * answer = GEOSWithin(g1, g2) + * if answer: + * return True # <<<<<<<<<<<<<< + * else: + * return False + */ + Py_INCREF(Py_True); + __pyx_r = Py_True; + goto __pyx_L0; + goto __pyx_L2; + } + /*else*/ { + + /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/geos.pyx":147 + * return True + * else: + * return False # <<<<<<<<<<<<<< + * + * def intersects(self, BaseGeometry geom): + */ + Py_INCREF(Py_False); + __pyx_r = Py_False; + goto __pyx_L0; + } + __pyx_L2:; + + __pyx_r = Py_None; Py_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1:; + __Pyx_AddTraceback("geos.BaseGeometry.within"); + __pyx_r = 0; + __pyx_L0:; + Py_DECREF(__pyx_v_self); + Py_DECREF(__pyx_v_geom); + return __pyx_r; +} + +static PyObject *__pyx_f_py_4geos_12BaseGeometry_intersects(PyObject *__pyx_v_self, PyObject *__pyx_v_geom); /*proto*/ +static PyObject *__pyx_f_py_4geos_12BaseGeometry_intersects(PyObject *__pyx_v_self, PyObject *__pyx_v_geom) { + GEOSGeom (*__pyx_v_g1); + GEOSGeom (*__pyx_v_g2); + char __pyx_v_answer; + PyObject *__pyx_r; + char __pyx_1; + Py_INCREF(__pyx_v_self); + Py_INCREF(__pyx_v_geom); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_geom), __pyx_ptype_4geos_BaseGeometry, 1, "geom"))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; goto __pyx_L1;} + + /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/geos.pyx":152 + * cdef GEOSGeom *g1, *g2 + * cdef char answer + * g1 = self._geom # <<<<<<<<<<<<<< + * g2 = geom._geom + * answer = GEOSIntersects(g1, g2) + */ + __pyx_v_g1 = ((struct __pyx_obj_4geos_BaseGeometry *)__pyx_v_self)->_geom; + + /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/geos.pyx":153 + * cdef char answer + * g1 = self._geom + * g2 = geom._geom # <<<<<<<<<<<<<< + * answer = GEOSIntersects(g1, g2) + * if answer: + */ + __pyx_v_g2 = ((struct __pyx_obj_4geos_BaseGeometry *)__pyx_v_geom)->_geom; + + /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/geos.pyx":154 + * g1 = self._geom + * g2 = geom._geom + * answer = GEOSIntersects(g1, g2) # <<<<<<<<<<<<<< + * if answer: + * return True + */ + __pyx_v_answer = GEOSIntersects(__pyx_v_g1,__pyx_v_g2); + + /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/geos.pyx":155 + * g2 = geom._geom + * answer = GEOSIntersects(g1, g2) + * if answer: # <<<<<<<<<<<<<< + * return True + * else: + */ + __pyx_1 = __pyx_v_answer; + if (__pyx_1) { + + /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/geos.pyx":156 + * answer = GEOSIntersects(g1, g2) + * if answer: + * return True # <<<<<<<<<<<<<< + * else: + * return False + */ + Py_INCREF(Py_True); + __pyx_r = Py_True; + goto __pyx_L0; + goto __pyx_L2; + } + /*else*/ { + + /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/geos.pyx":158 + * return True + * else: + * return False # <<<<<<<<<<<<<< + * + * def intersection(self, BaseGeometry geom): + */ + Py_INCREF(Py_False); + __pyx_r = Py_False; + goto __pyx_L0; + } + __pyx_L2:; + + __pyx_r = Py_None; Py_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1:; + __Pyx_AddTraceback("geos.BaseGeometry.intersects"); + __pyx_r = 0; + __pyx_L0:; + Py_DECREF(__pyx_v_self); + Py_DECREF(__pyx_v_geom); + return __pyx_r; +} + +static PyObject *__pyx_n_append; +static PyObject *__pyx_n_NotImplementedError; + +static PyObject *__pyx_k9p; + +static PyObject *__pyx_builtin_NotImplementedError; + +static char (__pyx_k9[]) = "intersections of type '%s' not yet implemented"; + +static PyObject *__pyx_f_py_4geos_12BaseGeometry_intersection(PyObject *__pyx_v_self, PyObject *__pyx_v_geom); /*proto*/ +static PyObject *__pyx_f_py_4geos_12BaseGeometry_intersection(PyObject *__pyx_v_self, PyObject *__pyx_v_geom) { + GEOSGeom (*__pyx_v_g1); + GEOSGeom (*__pyx_v_g2); + GEOSGeom (*__pyx_v_g3); + GEOSGeom (*__pyx_v_gout); + int __pyx_v_numgeoms; + int __pyx_v_i; + int __pyx_v_typeid; + PyObject *__pyx_v_p; + PyObject *__pyx_v_pout; + PyObject *__pyx_r; + int __pyx_1; + PyObject *__pyx_2 = 0; + PyObject *__pyx_3 = 0; + PyObject *__pyx_4 = 0; + Py_INCREF(__pyx_v_self); + Py_INCREF(__pyx_v_geom); + __pyx_v_p = Py_None; Py_INCREF(Py_None); + __pyx_v_pout = Py_None; Py_INCREF(Py_None); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_geom), __pyx_ptype_4geos_BaseGeometry, 1, "geom"))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; goto __pyx_L1;} + + /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/geos.pyx":164 + * cdef char answer + * cdef int numgeoms, i, typeid + * g1 = self._geom # <<<<<<<<<<<<<< + * g2 = geom._geom + * g3 = GEOSIntersection(g1, g2) + */ + __pyx_v_g1 = ((struct __pyx_obj_4geos_BaseGeometry *)__pyx_v_self)->_geom; + + /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/geos.pyx":165 + * cdef int numgeoms, i, typeid + * g1 = self._geom + * g2 = geom._geom # <<<<<<<<<<<<<< + * g3 = GEOSIntersection(g1, g2) + * typeid = GEOSGeomTypeId(g3) + */ + __pyx_v_g2 = ((struct __pyx_obj_4geos_BaseGeometry *)__pyx_v_geom)->_geom; + + /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/geos.pyx":166 + * g1 = self._geom + * g2 = geom._geom + * g3 = GEOSIntersection(g1, g2) # <<<<<<<<<<<<<< + * typeid = GEOSGeomTypeId(g3) + * if typeid == GEOS_POLYGON: + */ + __pyx_v_g3 = GEOSIntersection(__pyx_v_g1,__pyx_v_g2); + + /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/geos.pyx":167 + * g2 = geom._geom + * g3 = GEOSIntersection(g1, g2) + * typeid = GEOSGeomTypeId(g3) # <<<<<<<<<<<<<< + * if typeid == GEOS_POLYGON: + * p = Polygon() # create an empty Polygon instance + */ + __pyx_v_typeid = GEOSGeomTypeId(__pyx_v_g3); + + /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/geos.pyx":168 + * g3 = GEOSIntersection(g1, g2) + * typeid = GEOSGeomTypeId(g3) + * if typeid == GEOS_POLYGON: # <<<<<<<<<<<<<< + * p = Polygon() # create an empty Polygon instance + * p = _add_geom(p,g3) # add geometry to it. + */ + __pyx_1 = (__pyx_v_typeid == GEOS_POLYGON); + if (__pyx_1) { + + /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/geos.pyx":169 + * typeid = GEOSGeomTypeId(g3) + * if typeid == GEOS_POLYGON: + * p = Polygon() # create an empty Polygon instance # <<<<<<<<<<<<<< + * p = _add_geom(p,g3) # add geometry to it. + * # above should be faster than this .. + */ + __pyx_2 = PyObject_CallObject(((PyObject*)__pyx_ptype_4geos_Polygon), 0); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; goto __pyx_L1;} + Py_DECREF(__pyx_v_p); + __pyx_v_p = __pyx_2; + __pyx_2 = 0; + + /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/geos.pyx":170 + * if typeid == GEOS_POLYGON: + * p = Polygon() # create an empty Polygon instance + * p = _add_geom(p,g3) # add geometry to it. # <<<<<<<<<<<<<< + * # above should be faster than this .. + * #b = _get_coords(g3) + */ + if (!__Pyx_TypeTest(__pyx_v_p, __pyx_ptype_4geos_BaseGeometry)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; goto __pyx_L1;} + __pyx_2 = __pyx_f_4geos__add_geom(((struct __pyx_obj_4geos_BaseGeometry *)__pyx_v_p),__pyx_v_g3); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; goto __pyx_L1;} + Py_DECREF(__pyx_v_p); + __pyx_v_p = __pyx_2; + __pyx_2 = 0; + + /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/geos.pyx":174 + * #b = _get_coords(g3) + * #p = Polygon(b) + * pout = [p] # return a list with a single element # <<<<<<<<<<<<<< + * elif typeid == GEOS_LINESTRING: + * p = LineString() + */ + __pyx_2 = PyList_New(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; goto __pyx_L1;} + Py_INCREF(__pyx_v_p); + PyList_SET_ITEM(__pyx_2, 0, __pyx_v_p); + Py_DECREF(__pyx_v_pout); + __pyx_v_pout = __pyx_2; + __pyx_2 = 0; + goto __pyx_L2; + } + __pyx_1 = (__pyx_v_typeid == GEOS_LINESTRING); + if (__pyx_1) { + + /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/geos.pyx":176 + * pout = [p] # return a list with a single element + * elif typeid == GEOS_LINESTRING: + * p = LineString() # <<<<<<<<<<<<<< + * p = _add_geom(p,g3) + * return [p] + */ + __pyx_2 = PyObject_CallObject(((PyObject*)__pyx_ptype_4geos_LineString), 0); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; goto __pyx_L1;} + Py_DECREF(__pyx_v_p); + __pyx_v_p = __pyx_2; + __pyx_2 = 0; + + /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/geos.pyx":177 + * elif typeid == GEOS_LINESTRING: + * p = LineString() + * p = _add_geom(p,g3) # <<<<<<<<<<<<<< + * return [p] + * elif typeid == GEOS_MULTIPOLYGON: + */ + if (!__Pyx_TypeTest(__pyx_v_p, __pyx_ptype_4geos_BaseGeometry)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; goto __pyx_L1;} + __pyx_2 = __pyx_f_4geos__add_geom(((struct __pyx_obj_4geos_BaseGeometry *)__pyx_v_p),__pyx_v_g3); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; goto __pyx_L1;} + Py_DECREF(__pyx_v_p); + __pyx_v_p = __pyx_2; + __pyx_2 = 0; + + /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/geos.pyx":178 + * p = LineString() + * p = _add_geom(p,g3) + * return [p] # <<<<<<<<<<<<<< + * elif typeid == GEOS_MULTIPOLYGON: + * numgeoms = GEOSGetNumGeometries(g3) + */ + __pyx_2 = PyList_New(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; goto __pyx_L1;} + Py_INCREF(__pyx_v_p); + PyList_SET_ITEM(__pyx_2, 0, __pyx_v_p); + __pyx_r = __pyx_2; + __pyx_2 = 0; + goto __pyx_L0; + goto __pyx_L2; + } + __pyx_1 = (__pyx_v_typeid == GEOS_MULTIPOLYGON); + if (__pyx_1) { + + /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/geos.pyx":180 + * return [p] + * elif typeid == GEOS_MULTIPOLYGON: + * numgeoms = GEOSGetNumGeometries(g3) # <<<<<<<<<<<<<< + * pout = [] + * for i from 0 <= i < numgeoms: + */ + __pyx_v_numgeoms = GEOSGetNumGeometries(__pyx_v_g3); + + /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/geos.pyx":181 + * elif typeid == GEOS_MULTIPOLYGON: + * numgeoms = GEOSGetNumGeometries(g3) + * pout = [] # <<<<<<<<<<<<<< + * for i from 0 <= i < numgeoms: + * gout = GEOSGetGeometryN(g3, i) + */ + __pyx_2 = PyList_New(0); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; goto __pyx_L1;} + Py_DECREF(__pyx_v_pout); + __pyx_v_pout = __pyx_2; + __pyx_2 = 0; + + /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/geos.pyx":182 + * numgeoms = GEOSGetNumGeometries(g3) + * pout = [] + * for i from 0 <= i < numgeoms: # <<<<<<<<<<<<<< + * gout = GEOSGetGeometryN(g3, i) + * p = Polygon() # create an empty Polygon instance + */ + for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_numgeoms; __pyx_v_i++) { + + /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/geos.pyx":183 + * pout = [] + * for i from 0 <= i < numgeoms: + * gout = GEOSGetGeometryN(g3, i) # <<<<<<<<<<<<<< + * p = Polygon() # create an empty Polygon instance + * p = _add_geom(p,gout) # add geometry to it. + */ + __pyx_v_gout = GEOSGetGeometryN(__pyx_v_g3,__pyx_v_i); + + /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/geos.pyx":184 + * for i from 0 <= i < numgeoms: + * gout = GEOSGetGeometryN(g3, i) + * p = Polygon() # create an empty Polygon instance # <<<<<<<<<<<<<< + * p = _add_geom(p,gout) # add geometry to it. + * pout.append(p) + */ + __pyx_2 = PyObject_CallObject(((PyObject*)__pyx_ptype_4geos_Polygon), 0); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; goto __pyx_L1;} + Py_DECREF(__pyx_v_p); + __pyx_v_p = __pyx_2; + __pyx_2 = 0; + + /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/geos.pyx":185 + * gout = GEOSGetGeometryN(g3, i) + * p = Polygon() # create an empty Polygon instance + * p = _add_geom(p,gout) # add geometry to it. # <<<<<<<<<<<<<< + * pout.append(p) + * elif typeid == GEOS_MULTILINESTRING: + */ + if (!__Pyx_TypeTest(__pyx_v_p, __pyx_ptype_4geos_BaseGeometry)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; goto __pyx_L1;} + __pyx_2 = __pyx_f_4geos__add_geom(((struct __pyx_obj_4geos_BaseGeometry *)__pyx_v_p),__pyx_v_gout); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; goto __pyx_L1;} + Py_DECREF(__pyx_v_p); + __pyx_v_p = __pyx_2; + __pyx_2 = 0; + + /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/geos.pyx":186 + * p = Polygon() # create an empty Polygon instance + * p = _add_geom(p,gout) # add geometry to it. + * pout.append(p) # <<<<<<<<<<<<<< + * elif typeid == GEOS_MULTILINESTRING: + * numgeoms = GEOSGetNumGeometries(g3) + */ + __pyx_2 = PyObject_GetAttr(__pyx_v_pout, __pyx_n_append); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; goto __pyx_L1;} + __pyx_3 = PyTuple_New(1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; goto __pyx_L1;} + Py_INCREF(__pyx_v_p); + PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_p); + __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + Py_DECREF(__pyx_3); __pyx_3 = 0; + Py_DECREF(__pyx_4); __pyx_4 = 0; + } + goto __pyx_L2; + } + __pyx_1 = (__pyx_v_typeid == GEOS_MULTILINESTRING); + if (__pyx_1) { + + /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/geos.pyx":188 + * pout.append(p) + * elif typeid == GEOS_MULTILINESTRING: + * numgeoms = GEOSGetNumGeometries(g3) # <<<<<<<<<<<<<< + * pout = [] + * for i from 0 <= i < numgeoms: + */ + __pyx_v_numgeoms = GEOSGetNumGeometries(__pyx_v_g3); + + /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/geos.pyx":189 + * elif typeid == GEOS_MULTILINESTRING: + * numgeoms = GEOSGetNumGeometries(g3) + * pout = [] # <<<<<<<<<<<<<< + * for i from 0 <= i < numgeoms: + * gout = GEOSGetGeometryN(g3, i) + */ + __pyx_2 = PyList_New(0); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; goto __pyx_L1;} + Py_DECREF(__pyx_v_pout); + __pyx_v_pout = __pyx_2; + __pyx_2 = 0; + + /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/geos.pyx":190 + * numgeoms = GEOSGetNumGeometries(g3) + * pout = [] + * for i from 0 <= i < numgeoms: # <<<<<<<<<<<<<< + * gout = GEOSGetGeometryN(g3, i) + * p = LineString() # create an empty Polygon instance + */ + for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_numgeoms; __pyx_v_i++) { + + /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/geos.pyx":191 + * pout = [] + * for i from 0 <= i < numgeoms: + * gout = GEOSGetGeometryN(g3, i) # <<<<<<<<<<<<<< + * p = LineString() # create an empty Polygon instance + * p = _add_geom(p,gout) # add geometry to it. + */ + __pyx_v_gout = GEOSGetGeometryN(__pyx_v_g3,__pyx_v_i); + + /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/geos.pyx":192 + * for i from 0 <= i < numgeoms: + * gout = GEOSGetGeometryN(g3, i) + * p = LineString() # create an empty Polygon instance # <<<<<<<<<<<<<< + * p = _add_geom(p,gout) # add geometry to it. + * pout.append(p) + */ + __pyx_3 = PyObject_CallObject(((PyObject*)__pyx_ptype_4geos_LineString), 0); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; goto __pyx_L1;} + Py_DECREF(__pyx_v_p); + __pyx_v_p = __pyx_3; + __pyx_3 = 0; + + /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/geos.pyx":193 + * gout = GEOSGetGeometryN(g3, i) + * p = LineString() # create an empty Polygon instance + * p = _add_geom(p,gout) # add geometry to it. # <<<<<<<<<<<<<< + * pout.append(p) + * else: + */ + if (!__Pyx_TypeTest(__pyx_v_p, __pyx_ptype_4geos_BaseGeometry)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; goto __pyx_L1;} + __pyx_4 = __pyx_f_4geos__add_geom(((struct __pyx_obj_4geos_BaseGeometry *)__pyx_v_p),__pyx_v_gout); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; goto __pyx_L1;} + Py_DECREF(__pyx_v_p); + __pyx_v_p = __pyx_4; + __pyx_4 = 0; + + /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/geos.pyx":194 + * p = LineString() # create an empty Polygon instance + * p = _add_geom(p,gout) # add geometry to it. + * pout.append(p) # <<<<<<<<<<<<<< + * else: + * raise NotImplementedError("intersections of type '%s' not yet implemented" % (type)) + */ + __pyx_2 = PyObject_GetAttr(__pyx_v_pout, __pyx_n_append); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; goto __pyx_L1;} + __pyx_3 = PyTuple_New(1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; goto __pyx_L1;} + Py_INCREF(__pyx_v_p); + PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_p); + __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + Py_DECREF(__pyx_3); __pyx_3 = 0; + Py_DECREF(__pyx_4); __pyx_4 = 0; + } + goto __pyx_L2; + } + /*else*/ { + + /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/geos.pyx":196 + * pout.append(p) + * else: + * raise NotImplementedError("intersections of type '%s' not yet implemented" % (type)) # <<<<<<<<<<<<<< + * return pout + * + */ + __pyx_2 = PyNumber_Remainder(__pyx_k9p, ((PyObject*)&PyType_Type)); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; goto __pyx_L1;} + __pyx_3 = PyTuple_New(1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; goto __pyx_L1;} + PyTuple_SET_ITEM(__pyx_3, 0, __pyx_2); + __pyx_2 = 0; + __pyx_4 = PyObject_CallObject(__pyx_builtin_NotImplementedError, __pyx_3); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; goto __pyx_L1;} + Py_DECREF(__pyx_3); __pyx_3 = 0; + __Pyx_Raise(__pyx_4, 0, 0); + Py_DECREF(__pyx_4); __pyx_4 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; goto __pyx_L1;} + } + __pyx_L2:; + + /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/geos.pyx":197 + * else: + * raise NotImplementedError("intersections of type '%s' not yet implemented" % (type)) + * return pout # <<<<<<<<<<<<<< + * + * def get_coords(self): + */ + Py_INCREF(__pyx_v_pout); + __pyx_r = __pyx_v_pout; + goto __pyx_L0; + + __pyx_r = Py_None; Py_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1:; + Py_XDECREF(__pyx_2); + Py_XDECREF(__pyx_3); + Py_XDECREF(__pyx_4); + __Pyx_AddTraceback("geos.BaseGeometry.intersection"); + __pyx_r = 0; + __pyx_L0:; + Py_DECREF(__pyx_v_p); + Py_DECREF(__pyx_v_pout); + Py_DECREF(__pyx_v_self); + Py_DECREF(__pyx_v_geom); + return __pyx_r; +} + +static PyObject *__pyx_f_py_4geos_12BaseGeometry_get_coords(PyObject *__pyx_v_self, PyObject *unused); /*proto*/ +static PyObject *__pyx_f_py_4geos_12BaseGeometry_get_coords(PyObject *__pyx_v_self, PyObject *unused) { + PyObject *__pyx_r; + PyObject *__pyx_1 = 0; + Py_INCREF(__pyx_v_self); + + /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/geos.pyx":200 + * + * def get_coords(self): + * return _get_coords(self._geom) # <<<<<<<<<<<<<< + * + * cdef class Polygon(BaseGeometry): + */ + __pyx_1 = __pyx_f_4geos__get_coords(((struct __pyx_obj_4geos_BaseGeometry *)__pyx_v_self)->_geom); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; goto __pyx_L1;} + __pyx_r = __pyx_1; + __pyx_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; Py_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1:; + Py_XDECREF(__pyx_1); + __Pyx_AddTraceback("geos.BaseGeometry.get_coords"); + __pyx_r = 0; + __pyx_L0:; + Py_DECREF(__pyx_v_self); + return __pyx_r; +} + +static PyObject *__pyx_num_neg_1; +static PyObject *__pyx_num_0; +static PyObject *__pyx_num_1; + +static PyObject *__pyx_n_copy; +static PyObject *__pyx_n_shape; + +static int __pyx_f_py_4geos_7Polygon___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_f_py_4geos_7Polygon___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyArrayObject *__pyx_v_b = 0; + unsigned int __pyx_v_M; + unsigned int __pyx_v_m; + unsigned int __pyx_v_i; + double __pyx_v_dx; + double __pyx_v_dy; + double (*__pyx_v_bbuffer); + GEOSCoordSeq (*__pyx_v_cs); + GEOSGeom (*__pyx_v_lr); + int __pyx_r; + int __pyx_1; + PyObject *__pyx_2 = 0; + PyObject *__pyx_3 = 0; + PyObject *__pyx_4 = 0; + unsigned int __pyx_5; + PyObject *__pyx_6 = 0; + static char *__pyx_argnames[] = {"b",0}; + __pyx_v_b = __pyx_k4; + if (unlikely(!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "|O", __pyx_argnames, &__pyx_v_b))) return -1; + Py_INCREF((PyObject *)__pyx_v_self); + Py_INCREF(__pyx_v_b); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_b), __pyx_ptype_4geos_ndarray, 1, "b"))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; goto __pyx_L1;} + + /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/geos.pyx":214 + * + * # just return an empty class + * if b is None: # <<<<<<<<<<<<<< + * return + * + */ + __pyx_1 = (((PyObject *)__pyx_v_b) == Py_None); + if (__pyx_1) { + + /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/geos.pyx":215 + * # just return an empty class + * if b is None: + * return # <<<<<<<<<<<<<< + * + * # make sure data is contiguous. + */ + __pyx_r = 0; + goto __pyx_L0; + goto __pyx_L2; + } + __pyx_L2:; + + /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/geos.pyx":219 + * # make sure data is contiguous. + * # if not, make a local copy. + * if not PyArray_ISCONTIGUOUS(b): # <<<<<<<<<<<<<< + * b = b.copy() + * + */ + __pyx_1 = (!PyArray_ISCONTIGUOUS(__pyx_v_b)); + if (__pyx_1) { + + /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/geos.pyx":220 + * # if not, make a local copy. + * if not PyArray_ISCONTIGUOUS(b): + * b = b.copy() # <<<<<<<<<<<<<< + * + * m = b.shape[0] + */ + __pyx_2 = PyObject_GetAttr(((PyObject *)__pyx_v_b), __pyx_n_copy); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; goto __pyx_L1;} + __pyx_3 = PyObject_CallObject(__pyx_2, 0); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + if (!__Pyx_TypeTest(__pyx_3, __pyx_ptype_4geos_ndarray)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; goto __pyx_L1;} + Py_DECREF(((PyObject *)__pyx_v_b)); + __pyx_v_b = ((PyArrayObject *)__pyx_3); + __pyx_3 = 0; + goto __pyx_L3; + } + __pyx_L3:; + + /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/geos.pyx":222 + * b = b.copy() + * + * m = b.shape[0] # <<<<<<<<<<<<<< + * + * # Add closing coordinates to sequence? + */ + __pyx_2 = PyObject_GetAttr(((PyObject *)__pyx_v_b), __pyx_n_shape); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; goto __pyx_L1;} + if (PyList_CheckExact(__pyx_2) && 0 <= 0 && 0 < PyList_GET_SIZE(__pyx_2)) { + __pyx_4 = PyList_GET_ITEM(__pyx_2, 0); Py_INCREF(__pyx_4); + } else if (PyTuple_CheckExact(__pyx_2) && 0 <= 0 && 0 < PyTuple_GET_SIZE(__pyx_2)) { + __pyx_4 = PyTuple_GET_ITEM(__pyx_2, 0); Py_INCREF(__pyx_4); + } else { + __pyx_3 = PyInt_FromLong(0); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; goto __pyx_L1;} + __pyx_4 = PyObject_GetItem(__pyx_2, __pyx_3); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; goto __pyx_L1;} + Py_DECREF(__pyx_3); __pyx_3 = 0; + } + Py_DECREF(__pyx_2); __pyx_2 = 0; + __pyx_5 = PyInt_AsUnsignedLongMask(__pyx_4); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; goto __pyx_L1;} + Py_DECREF(__pyx_4); __pyx_4 = 0; + __pyx_v_m = __pyx_5; + + /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/geos.pyx":225 + * + * # Add closing coordinates to sequence? + * if b[-1,0] != b[0,0] or b[-1,1] != b[0,1]: # <<<<<<<<<<<<<< + * M = m + 1 + * else: + */ + __pyx_3 = PyTuple_New(2); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; goto __pyx_L1;} + Py_INCREF(__pyx_num_neg_1); + PyTuple_SET_ITEM(__pyx_3, 0, __pyx_num_neg_1); + Py_INCREF(__pyx_num_0); + PyTuple_SET_ITEM(__pyx_3, 1, __pyx_num_0); + __pyx_4 = PyObject_GetItem(((PyObject *)__pyx_v_b), __pyx_3); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; goto __pyx_L1;} + Py_DECREF(__pyx_3); __pyx_3 = 0; + __pyx_3 = PyTuple_New(2); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; goto __pyx_L1;} + Py_INCREF(__pyx_num_0); + PyTuple_SET_ITEM(__pyx_3, 0, __pyx_num_0); + Py_INCREF(__pyx_num_0); + PyTuple_SET_ITEM(__pyx_3, 1, __pyx_num_0); + __pyx_6 = PyObject_GetItem(((PyObject *)__pyx_v_b), __pyx_3); if (unlikely(!__pyx_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; goto __pyx_L1;} + Py_DECREF(__pyx_3); __pyx_3 = 0; + __pyx_2 = PyObject_RichCompare(__pyx_4, __pyx_6, Py_NE); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; goto __pyx_L1;} + Py_DECREF(__pyx_4); __pyx_4 = 0; + Py_DECREF(__pyx_6); __pyx_6 = 0; + __pyx_1 = __Pyx_PyObject_IsTrue(__pyx_2); if (unlikely(__pyx_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; goto __pyx_L1;} + if (!__pyx_1) { + Py_DECREF(__pyx_2); __pyx_2 = 0; + __pyx_3 = PyTuple_New(2); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; goto __pyx_L1;} + Py_INCREF(__pyx_num_neg_1); + PyTuple_SET_ITEM(__pyx_3, 0, __pyx_num_neg_1); + Py_INCREF(__pyx_num_1); + PyTuple_SET_ITEM(__pyx_3, 1, __pyx_num_1); + __pyx_4 = PyObject_GetItem(((PyObject *)__pyx_v_b), __pyx_3); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; goto __pyx_L1;} + Py_DECREF(__pyx_3); __pyx_3 = 0; + __pyx_6 = PyTuple_New(2); if (unlikely(!__pyx_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; goto __pyx_L1;} + Py_INCREF(__pyx_num_0); + PyTuple_SET_ITEM(__pyx_6, 0, __pyx_num_0); + Py_INCREF(__pyx_num_1); + PyTuple_SET_ITEM(__pyx_6, 1, __pyx_num_1); + __pyx_3 = PyObject_GetItem(((PyObject *)__pyx_v_b), __pyx_6); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; goto __pyx_L1;} + Py_DECREF(__pyx_6); __pyx_6 = 0; + __pyx_2 = PyObject_RichCompare(__pyx_4, __pyx_3, Py_NE); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; goto __pyx_L1;} + Py_DECREF(__pyx_4); __pyx_4 = 0; + Py_DECREF(__pyx_3); __pyx_3 = 0; + } + __pyx_1 = __Pyx_PyObject_IsTrue(__pyx_2); if (unlikely(__pyx_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; goto __pyx_L1;} + Py_DECREF(__pyx_2); __pyx_2 = 0; + if (__pyx_1) { + + /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/geos.pyx":226 + * # Add closing coordinates to sequence? + * if b[-1,0] != b[0,0] or b[-1,1] != b[0,1]: + * M = m + 1 # <<<<<<<<<<<<<< + * else: + * M = m + */ + __pyx_v_M = (__pyx_v_m + 1); + goto __pyx_L4; + } + /*else*/ { + + /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/geos.pyx":228 + * M = m + 1 + * else: + * M = m # <<<<<<<<<<<<<< + * self._npts = M + * + */ + __pyx_v_M = __pyx_v_m; + } + __pyx_L4:; + + /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/geos.pyx":229 + * else: + * M = m + * self._npts = M # <<<<<<<<<<<<<< + * + * # Create a coordinate sequence + */ + ((struct __pyx_obj_4geos_Polygon *)__pyx_v_self)->__pyx_base._npts = __pyx_v_M; + + /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/geos.pyx":232 + * + * # Create a coordinate sequence + * cs = GEOSCoordSeq_create(M, 2) # <<<<<<<<<<<<<< + * + * # add to coordinate sequence + */ + __pyx_v_cs = GEOSCoordSeq_create(__pyx_v_M,2); + + /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/geos.pyx":235 + * + * # add to coordinate sequence + * bbuffer = <double *>b.data # <<<<<<<<<<<<<< + * for i from 0 <= i < m: + * dx = bbuffer[2*i] + */ + __pyx_v_bbuffer = ((double (*))__pyx_v_b->data); + + /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/geos.pyx":236 + * # add to coordinate sequence + * bbuffer = <double *>b.data + * for i from 0 <= i < m: # <<<<<<<<<<<<<< + * dx = bbuffer[2*i] + * dy = bbuffer[2*i+1] + */ + for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_m; __pyx_v_i++) { + + /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/geos.pyx":237 + * bbuffer = <double *>b.data + * for i from 0 <= i < m: + * dx = bbuffer[2*i] # <<<<<<<<<<<<<< + * dy = bbuffer[2*i+1] + * # Because of a bug in the GEOS C API, + */ + __pyx_v_dx = (__pyx_v_bbuffer[(2 * __pyx_v_i)]); + + /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/geos.pyx":238 + * for i from 0 <= i < m: + * dx = bbuffer[2*i] + * dy = bbuffer[2*i+1] # <<<<<<<<<<<<<< + * # Because of a bug in the GEOS C API, + * # always set X before Y + */ + __pyx_v_dy = (__pyx_v_bbuffer[((2 * __pyx_v_i) + 1)]); + + /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/geos.pyx":241 + * # Because of a bug in the GEOS C API, + * # always set X before Y + * GEOSCoordSeq_setX(cs, i, dx) # <<<<<<<<<<<<<< + * GEOSCoordSeq_setY(cs, i, dy) + * + */ + GEOSCoordSeq_setX(__pyx_v_cs,__pyx_v_i,__pyx_v_dx); + + /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/geos.pyx":242 + * # always set X before Y + * GEOSCoordSeq_setX(cs, i, dx) + * GEOSCoordSeq_setY(cs, i, dy) # <<<<<<<<<<<<<< + * + * # Add closing coordinates to sequence? + */ + GEOSCoordSeq_setY(__pyx_v_cs,__pyx_v_i,__pyx_v_dy); + } + + /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/geos.pyx":245 + * + * # Add closing coordinates to sequence? + * if M > m: # <<<<<<<<<<<<<< + * dx = bbuffer[0] + * dy = bbuffer[1] + */ + __pyx_1 = (__pyx_v_M > __pyx_v_m); + if (__pyx_1) { + + /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/geos.pyx":246 + * # Add closing coordinates to sequence? + * if M > m: + * dx = bbuffer[0] # <<<<<<<<<<<<<< + * dy = bbuffer[1] + * GEOSCoordSeq_setX(cs, M-1, dx) + */ + __pyx_v_dx = (__pyx_v_bbuffer[0]); + + /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/geos.pyx":247 + * if M > m: + * dx = bbuffer[0] + * dy = bbuffer[1] # <<<<<<<<<<<<<< + * GEOSCoordSeq_setX(cs, M-1, dx) + * GEOSCoordSeq_setY(cs, M-1, dy) + */ + __pyx_v_dy = (__pyx_v_bbuffer[1]); + + /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/geos.pyx":248 + * dx = bbuffer[0] + * dy = bbuffer[1] + * GEOSCoordSeq_setX(cs, M-1, dx) # <<<<<<<<<<<<<< + * GEOSCoordSeq_setY(cs, M-1, dy) + * + */ + GEOSCoordSeq_setX(__pyx_v_cs,(__pyx_v_M - 1),__pyx_v_dx); + + /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/geos.pyx":249 + * dy = bbuffer[1] + * GEOSCoordSeq_setX(cs, M-1, dx) + * GEOSCoordSeq_setY(cs, M-1, dy) # <<<<<<<<<<<<<< + * + * # create LinearRing + */ + GEOSCoordSeq_setY(__pyx_v_cs,(__pyx_v_M - 1),__pyx_v_dy); + goto __pyx_L7; + } + __pyx_L7:; + + /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/geos.pyx":252 + * + * # create LinearRing + * lr = GEOSGeom_createLinearRing(cs) # <<<<<<<<<<<<<< + * + * # create Polygon from LinearRing (assuming no holes) + */ + __pyx_v_lr = GEOSGeom_createLinearRing(__pyx_v_cs); + + /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/geos.pyx":255 + * + * # create Polygon from LinearRing (assuming no holes) + * self._geom = GEOSGeom_createPolygon(lr,NULL,0) # <<<<<<<<<<<<<< + * + * def area(self): + */ + ((struct __pyx_obj_4geos_Polygon *)__pyx_v_self)->__pyx_base._geom = GEOSGeom_createPolygon(__pyx_v_lr,NULL,0); + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1:; + Py_XDECREF(__pyx_2); + Py_XDECREF(__pyx_3); + Py_XDECREF(__pyx_4); + Py_XDECREF(__pyx_6); + __Pyx_AddTraceback("geos.Polygon.__init__"); + __pyx_r = -1; + __pyx_L0:; + Py_DECREF((PyObject *)__pyx_v_self); + Py_DECREF(__pyx_v_b); + return __pyx_r; +} + +static PyObject *__pyx_f_py_4geos_7Polygon_area(PyObject *__pyx_v_self, PyObject *unused); /*proto*/ +static PyObject *__pyx_f_py_4geos_7Polygon_area(PyObject *__pyx_v_self, PyObject *unused) { + double __pyx_v_area; + PyObject *__pyx_r; + PyObject *__pyx_1 = 0; + Py_INCREF((PyObject *)__pyx_v_self); + + /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/geos.pyx":259 + * def area(self): + * cdef double area + * GEOS... [truncated message content] |