/* Generated by Cython 0.9.6.8 on Thu Nov 15 13:56:55 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
#ifndef WIN32
#define __stdcall
#define __cdecl
#endif
#ifdef __cplusplus
#define __PYX_EXTERN_C extern "C"
#else
#define __PYX_EXTERN_C extern
#endif
#include <math.h>
#include "numpy/arrayobject.h"
#include "geos_c.h"
#ifdef __GNUC__
#define INLINE __inline__
#elif _WIN32
#define INLINE __inline
#else
#define INLINE
#endif
typedef struct {PyObject **p; char *s;} __Pyx_InternTabEntry; /*proto*/
typedef struct {PyObject **p; char *s; long n; int is_unicode;} __Pyx_StringTabEntry; /*proto*/
static INLINE Py_ssize_t __pyx_PyIndex_AsSsize_t(PyObject* b) {
Py_ssize_t ival;
PyObject* x = PyNumber_Index(b);
if (!x) return -1;
ival = PyInt_AsSsize_t(x);
Py_DECREF(x);
return ival;
}
#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);
}
static int __pyx_skip_dispatch = 0;
#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_GetName(PyObject *dict, PyObject *name); /*proto*/
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
static void __Pyx_WriteUnraisable(char *name); /*proto*/
static int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*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 PyObject *__Pyx_ImportModule(char *name); /*proto*/
static void __Pyx_AddTraceback(char *funcname); /*proto*/
static int __Pyx_RegisterCleanup(); /*proto*/
static PyObject* cleanup(PyObject *self, PyObject *unused); /*proto*/
static PyMethodDef cleanup_def = {"__cleanup", (PyCFunction)&cleanup, METH_NOARGS, 0};
/* Declarations from numpy */
/* Declarations from _geos */
struct __pyx_obj_5_geos_BaseGeometry {
PyObject_HEAD
GEOSGeom *_geom;
unsigned int _npts;
PyObject *boundary;
};
struct __pyx_obj_5_geos_Polygon {
struct __pyx_obj_5_geos_BaseGeometry __pyx_base;
};
struct __pyx_obj_5_geos_LineString {
struct __pyx_obj_5_geos_BaseGeometry __pyx_base;
};
struct __pyx_obj_5_geos_Point {
struct __pyx_obj_5_geos_BaseGeometry __pyx_base;
PyObject *x;
PyObject *y;
};
static PyTypeObject *__pyx_ptype_5_geos_ndarray = 0;
static PyTypeObject *__pyx_ptype_5_geos_BaseGeometry = 0;
static PyTypeObject *__pyx_ptype_5_geos_Polygon = 0;
static PyTypeObject *__pyx_ptype_5_geos_LineString = 0;
static PyTypeObject *__pyx_ptype_5_geos_Point = 0;
static void __pyx_f_5_geos_notice_h(char *,char *); /*proto*/
static void __pyx_f_5_geos_error_h(char *,char *); /*proto*/
static PyObject *__pyx_f_5_geos_geos_version(void); /*proto*/
static PyObject *__pyx_f_5_geos__get_coords(GEOSGeom *); /*proto*/
/* Implementation of _geos */
static char __pyx_k3[] = "0.1";
static char __pyx_k4[] = "2.2.3-CAPI-1.1.1";
static char __pyx_k5[] = "version 2.2.3 of the geos library is required";
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___dealloc__;
static PyObject *__pyx_n___reduce__;
static PyObject *__pyx_n___init__;
static PyObject *__pyx_n_area;
static PyObject *__pyx_n_sys;
static PyObject *__pyx_n_numpy;
static PyObject *__pyx_n___version__;
static PyObject *__pyx_n___geos_version__;
static PyObject *__pyx_n_ValueError;
static PyObject *__pyx_k3p;
static PyObject *__pyx_k4p;
static PyObject *__pyx_k5p;
static PyObject *__pyx_builtin_ValueError;
static PyObject *__pyx_n_stdout;
static PyObject *__pyx_n_write;
static PyObject *__pyx_k6p;
static char __pyx_k6[] = "GEOS_NOTICE: %s\n";
static void __pyx_f_5_geos_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);
/* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":101
*
* 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 = 101; goto __pyx_L1;}
Py_DECREF(__pyx_v_format);
__pyx_v_format = __pyx_1;
__pyx_1 = 0;
/* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":102
* 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 = 102; goto __pyx_L1;}
Py_DECREF(__pyx_v_message);
__pyx_v_message = __pyx_1;
__pyx_1 = 0;
/* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":103
* format = PyString_FromString(fmt)
* message = PyString_FromString(msg)
* try: # <<<<<<<<<<<<<<
* warn_msg = format % message
* except:
*/
/*try:*/ {
__pyx_1 = PyNumber_Remainder(__pyx_v_format, __pyx_v_message); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; 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;
/* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":105
* try:
* warn_msg = format % message
* except: # <<<<<<<<<<<<<<
* warn_msg = format
* sys.stdout.write('GEOS_NOTICE: %s\n' % warn_msg)
*/
/*except:*/ {
__Pyx_AddTraceback("_geos.notice_h");
if (__Pyx_GetException(&__pyx_1, &__pyx_2, &__pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; goto __pyx_L1;}
Py_INCREF(__pyx_v_format);
Py_DECREF(__pyx_v_warn_msg);
__pyx_v_warn_msg = __pyx_v_format;
Py_DECREF(__pyx_1); __pyx_1 = 0;
Py_DECREF(__pyx_2); __pyx_2 = 0;
Py_DECREF(__pyx_3); __pyx_3 = 0;
goto __pyx_L3;
}
__pyx_L3:;
/* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":107
* 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 = 107; goto __pyx_L1;}
__pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_stdout); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; goto __pyx_L1;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
__pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_write); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
__pyx_1 = PyNumber_Remainder(__pyx_k6p, __pyx_v_warn_msg); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; goto __pyx_L1;}
__pyx_2 = PyTuple_New(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; goto __pyx_L1;}
PyTuple_SET_ITEM(__pyx_2, 0, __pyx_1);
__pyx_1 = 0;
__pyx_1 = PyObject_CallObject(__pyx_3, __pyx_2); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; goto __pyx_L1;}
Py_DECREF(__pyx_3); __pyx_3 = 0;
Py_DECREF(__pyx_2); __pyx_2 = 0;
Py_DECREF(__pyx_1); __pyx_1 = 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_k7p;
static char __pyx_k7[] = "GEOS_ERROR: %s\n";
static void __pyx_f_5_geos_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);
/* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":110
*
* 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 = 110; goto __pyx_L1;}
Py_DECREF(__pyx_v_format);
__pyx_v_format = __pyx_1;
__pyx_1 = 0;
/* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":111
* 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 = 111; goto __pyx_L1;}
Py_DECREF(__pyx_v_message);
__pyx_v_message = __pyx_1;
__pyx_1 = 0;
/* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":112
* format = PyString_FromString(fmt)
* message = PyString_FromString(msg)
* try: # <<<<<<<<<<<<<<
* warn_msg = format % message
* except:
*/
/*try:*/ {
__pyx_1 = PyNumber_Remainder(__pyx_v_format, __pyx_v_message); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; 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;
/* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":114
* try:
* warn_msg = format % message
* except: # <<<<<<<<<<<<<<
* warn_msg = format
* sys.stderr.write('GEOS_ERROR: %s\n' % warn_msg)
*/
/*except:*/ {
__Pyx_AddTraceback("_geos.error_h");
if (__Pyx_GetException(&__pyx_1, &__pyx_2, &__pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; goto __pyx_L1;}
Py_INCREF(__pyx_v_format);
Py_DECREF(__pyx_v_warn_msg);
__pyx_v_warn_msg = __pyx_v_format;
Py_DECREF(__pyx_1); __pyx_1 = 0;
Py_DECREF(__pyx_2); __pyx_2 = 0;
Py_DECREF(__pyx_3); __pyx_3 = 0;
goto __pyx_L3;
}
__pyx_L3:;
/* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":116
* except:
* warn_msg = format
* sys.stderr.write('GEOS_ERROR: %s\n' % warn_msg) # <<<<<<<<<<<<<<
*
* # check library version
*/
__pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n_sys); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; goto __pyx_L1;}
__pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_stderr); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; goto __pyx_L1;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
__pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_write); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
__pyx_1 = PyNumber_Remainder(__pyx_k7p, __pyx_v_warn_msg); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; goto __pyx_L1;}
__pyx_2 = PyTuple_New(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; goto __pyx_L1;}
PyTuple_SET_ITEM(__pyx_2, 0, __pyx_1);
__pyx_1 = 0;
__pyx_1 = PyObject_CallObject(__pyx_3, __pyx_2); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; goto __pyx_L1;}
Py_DECREF(__pyx_3); __pyx_3 = 0;
Py_DECREF(__pyx_2); __pyx_2 = 0;
Py_DECREF(__pyx_1); __pyx_1 = 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_5_geos_geos_version(void) {
PyObject *__pyx_r;
PyObject *__pyx_1 = 0;
__pyx_1 = PyString_FromString(GEOSversion()); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; 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.geos_version");
__pyx_r = 0;
__pyx_L0:;
return __pyx_r;
}
static PyObject *__pyx_pf_5_geos_12BaseGeometry_is_valid(PyObject *__pyx_v_self, PyObject *unused); /*proto*/
static PyObject *__pyx_pf_5_geos_12BaseGeometry_is_valid(PyObject *__pyx_v_self, PyObject *unused) {
char __pyx_v_valid;
PyObject *__pyx_r;
char __pyx_1;
Py_INCREF(__pyx_v_self);
/* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":134
* def is_valid(self):
* cdef char valid
* valid = GEOSisValid(self._geom) # <<<<<<<<<<<<<<
* if valid:
* return True
*/
__pyx_v_valid = GEOSisValid(((struct __pyx_obj_5_geos_BaseGeometry *)__pyx_v_self)->_geom);
/* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":135
* cdef char valid
* valid = GEOSisValid(self._geom)
* if valid: # <<<<<<<<<<<<<<
* return True
* else:
*/
__pyx_1 = __pyx_v_valid;
if (__pyx_1) {
Py_INCREF(Py_True);
__pyx_r = Py_True;
goto __pyx_L0;
goto __pyx_L2;
}
/*else*/ {
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_pf_5_geos_12BaseGeometry_geom_type(PyObject *__pyx_v_self, PyObject *unused); /*proto*/
static PyObject *__pyx_pf_5_geos_12BaseGeometry_geom_type(PyObject *__pyx_v_self, PyObject *unused) {
PyObject *__pyx_r;
PyObject *__pyx_1 = 0;
Py_INCREF(__pyx_v_self);
__pyx_1 = PyString_FromString(GEOSGeomType(((struct __pyx_obj_5_geos_BaseGeometry *)__pyx_v_self)->_geom)); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; 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 = NULL;
__pyx_L0:;
Py_DECREF(__pyx_v_self);
return __pyx_r;
}
static PyObject *__pyx_pf_5_geos_12BaseGeometry_within(PyObject *__pyx_v_self, PyObject *__pyx_v_geom); /*proto*/
static PyObject *__pyx_pf_5_geos_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_5_geos_BaseGeometry, 1, "geom"))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; goto __pyx_L1;}
/* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":146
* cdef GEOSGeom *g1, *g2
* cdef char answer
* g1 = self._geom # <<<<<<<<<<<<<<
* g2 = geom._geom
* answer = GEOSWithin(g1, g2)
*/
__pyx_v_g1 = ((struct __pyx_obj_5_geos_BaseGeometry *)__pyx_v_self)->_geom;
/* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":147
* cdef char answer
* g1 = self._geom
* g2 = geom._geom # <<<<<<<<<<<<<<
* answer = GEOSWithin(g1, g2)
* if answer:
*/
__pyx_v_g2 = ((struct __pyx_obj_5_geos_BaseGeometry *)__pyx_v_geom)->_geom;
/* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":148
* g1 = self._geom
* g2 = geom._geom
* answer = GEOSWithin(g1, g2) # <<<<<<<<<<<<<<
* if answer:
* return True
*/
__pyx_v_answer = GEOSWithin(__pyx_v_g1,__pyx_v_g2);
/* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":149
* g2 = geom._geom
* answer = GEOSWithin(g1, g2)
* if answer: # <<<<<<<<<<<<<<
* return True
* else:
*/
__pyx_1 = __pyx_v_answer;
if (__pyx_1) {
Py_INCREF(Py_True);
__pyx_r = Py_True;
goto __pyx_L0;
goto __pyx_L2;
}
/*else*/ {
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 = NULL;
__pyx_L0:;
Py_DECREF(__pyx_v_self);
Py_DECREF(__pyx_v_geom);
return __pyx_r;
}
static PyObject *__pyx_pf_5_geos_12BaseGeometry_intersects(PyObject *__pyx_v_self, PyObject *__pyx_v_geom); /*proto*/
static PyObject *__pyx_pf_5_geos_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_5_geos_BaseGeometry, 1, "geom"))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; goto __pyx_L1;}
/* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":157
* cdef GEOSGeom *g1, *g2
* cdef char answer
* g1 = self._geom # <<<<<<<<<<<<<<
* g2 = geom._geom
* answer = GEOSIntersects(g1, g2)
*/
__pyx_v_g1 = ((struct __pyx_obj_5_geos_BaseGeometry *)__pyx_v_self)->_geom;
/* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":158
* cdef char answer
* g1 = self._geom
* g2 = geom._geom # <<<<<<<<<<<<<<
* answer = GEOSIntersects(g1, g2)
* if answer:
*/
__pyx_v_g2 = ((struct __pyx_obj_5_geos_BaseGeometry *)__pyx_v_geom)->_geom;
/* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":159
* g1 = self._geom
* g2 = geom._geom
* answer = GEOSIntersects(g1, g2) # <<<<<<<<<<<<<<
* if answer:
* return True
*/
__pyx_v_answer = GEOSIntersects(__pyx_v_g1,__pyx_v_g2);
/* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":160
* g2 = geom._geom
* answer = GEOSIntersects(g1, g2)
* if answer: # <<<<<<<<<<<<<<
* return True
* else:
*/
__pyx_1 = __pyx_v_answer;
if (__pyx_1) {
Py_INCREF(Py_True);
__pyx_r = Py_True;
goto __pyx_L0;
goto __pyx_L2;
}
/*else*/ {
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 = NULL;
__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_k8p;
static PyObject *__pyx_builtin_NotImplementedError;
static char __pyx_k8[] = "intersections of type '%s' not yet implemented";
static PyObject *__pyx_pf_5_geos_12BaseGeometry_intersection(PyObject *__pyx_v_self, PyObject *__pyx_v_geom); /*proto*/
static PyObject *__pyx_pf_5_geos_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_b;
PyObject *__pyx_v_p;
PyObject *__pyx_v_pout;
PyObject *__pyx_v_type;
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_b = Py_None; Py_INCREF(Py_None);
__pyx_v_p = Py_None; Py_INCREF(Py_None);
__pyx_v_pout = Py_None; Py_INCREF(Py_None);
__pyx_v_type = Py_None; Py_INCREF(Py_None);
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_geom), __pyx_ptype_5_geos_BaseGeometry, 1, "geom"))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; goto __pyx_L1;}
/* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":169
* cdef char answer
* cdef int numgeoms, i, typeid
* g1 = self._geom # <<<<<<<<<<<<<<
* g2 = geom._geom
* g3 = GEOSIntersection(g1, g2)
*/
__pyx_v_g1 = ((struct __pyx_obj_5_geos_BaseGeometry *)__pyx_v_self)->_geom;
/* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":170
* cdef int numgeoms, i, typeid
* g1 = self._geom
* g2 = geom._geom # <<<<<<<<<<<<<<
* g3 = GEOSIntersection(g1, g2)
* typeid = GEOSGeomTypeId(g3)
*/
__pyx_v_g2 = ((struct __pyx_obj_5_geos_BaseGeometry *)__pyx_v_geom)->_geom;
/* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":171
* 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);
/* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":172
* g2 = geom._geom
* g3 = GEOSIntersection(g1, g2)
* typeid = GEOSGeomTypeId(g3) # <<<<<<<<<<<<<<
* if typeid == GEOS_POLYGON:
* b = _get_coords(g3)
*/
__pyx_v_typeid = GEOSGeomTypeId(__pyx_v_g3);
/* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":173
* g3 = GEOSIntersection(g1, g2)
* typeid = GEOSGeomTypeId(g3)
* if typeid == GEOS_POLYGON: # <<<<<<<<<<<<<<
* b = _get_coords(g3)
* p = Polygon(b)
*/
__pyx_1 = (__pyx_v_typeid == GEOS_POLYGON);
if (__pyx_1) {
/* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":174
* typeid = GEOSGeomTypeId(g3)
* if typeid == GEOS_POLYGON:
* b = _get_coords(g3) # <<<<<<<<<<<<<<
* p = Polygon(b)
* pout = [p]
*/
__pyx_2 = __pyx_f_5_geos__get_coords(__pyx_v_g3); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; goto __pyx_L1;}
Py_DECREF(__pyx_v_b);
__pyx_v_b = __pyx_2;
__pyx_2 = 0;
/* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":175
* if typeid == GEOS_POLYGON:
* b = _get_coords(g3)
* p = Polygon(b) # <<<<<<<<<<<<<<
* pout = [p]
* elif typeid == GEOS_LINESTRING:
*/
__pyx_2 = PyTuple_New(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; goto __pyx_L1;}
Py_INCREF(__pyx_v_b);
PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_b);
__pyx_3 = PyObject_CallObject(((PyObject*)__pyx_ptype_5_geos_Polygon), __pyx_2); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
Py_DECREF(__pyx_v_p);
__pyx_v_p = __pyx_3;
__pyx_3 = 0;
/* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":176
* b = _get_coords(g3)
* p = Polygon(b)
* pout = [p] # <<<<<<<<<<<<<<
* elif typeid == GEOS_LINESTRING:
* b = _get_coords(g3)
*/
__pyx_2 = PyList_New(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; 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) {
/* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":178
* pout = [p]
* elif typeid == GEOS_LINESTRING:
* b = _get_coords(g3) # <<<<<<<<<<<<<<
* p = LineString(b)
* pout = [p]
*/
__pyx_3 = __pyx_f_5_geos__get_coords(__pyx_v_g3); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; goto __pyx_L1;}
Py_DECREF(__pyx_v_b);
__pyx_v_b = __pyx_3;
__pyx_3 = 0;
/* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":179
* elif typeid == GEOS_LINESTRING:
* b = _get_coords(g3)
* p = LineString(b) # <<<<<<<<<<<<<<
* pout = [p]
* elif typeid == GEOS_MULTIPOLYGON:
*/
__pyx_2 = PyTuple_New(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; goto __pyx_L1;}
Py_INCREF(__pyx_v_b);
PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_b);
__pyx_3 = PyObject_CallObject(((PyObject*)__pyx_ptype_5_geos_LineString), __pyx_2); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
Py_DECREF(__pyx_v_p);
__pyx_v_p = __pyx_3;
__pyx_3 = 0;
/* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":180
* b = _get_coords(g3)
* p = LineString(b)
* pout = [p] # <<<<<<<<<<<<<<
* elif typeid == GEOS_MULTIPOLYGON:
* numgeoms = GEOSGetNumGeometries(g3)
*/
__pyx_2 = PyList_New(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; 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_MULTIPOLYGON);
if (__pyx_1) {
/* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":182
* pout = [p]
* elif typeid == GEOS_MULTIPOLYGON:
* numgeoms = GEOSGetNumGeometries(g3) # <<<<<<<<<<<<<<
* pout = []
* for i from 0 <= i < numgeoms:
*/
__pyx_v_numgeoms = GEOSGetNumGeometries(__pyx_v_g3);
/* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":183
* elif typeid == GEOS_MULTIPOLYGON:
* numgeoms = GEOSGetNumGeometries(g3)
* pout = [] # <<<<<<<<<<<<<<
* for i from 0 <= i < numgeoms:
* gout = GEOSGetGeometryN(g3, i)
*/
__pyx_3 = PyList_New(0); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; goto __pyx_L1;}
Py_DECREF(__pyx_v_pout);
__pyx_v_pout = __pyx_3;
__pyx_3 = 0;
/* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":184
* numgeoms = GEOSGetNumGeometries(g3)
* pout = []
* for i from 0 <= i < numgeoms: # <<<<<<<<<<<<<<
* gout = GEOSGetGeometryN(g3, i)
* b = _get_coords(gout)
*/
for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_numgeoms; __pyx_v_i++) {
/* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":185
* pout = []
* for i from 0 <= i < numgeoms:
* gout = GEOSGetGeometryN(g3, i) # <<<<<<<<<<<<<<
* b = _get_coords(gout)
* p = Polygon(b)
*/
__pyx_v_gout = GEOSGetGeometryN(__pyx_v_g3,__pyx_v_i);
/* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":186
* for i from 0 <= i < numgeoms:
* gout = GEOSGetGeometryN(g3, i)
* b = _get_coords(gout) # <<<<<<<<<<<<<<
* p = Polygon(b)
* pout.append(p)
*/
__pyx_2 = __pyx_f_5_geos__get_coords(__pyx_v_gout); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; goto __pyx_L1;}
Py_DECREF(__pyx_v_b);
__pyx_v_b = __pyx_2;
__pyx_2 = 0;
/* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":187
* gout = GEOSGetGeometryN(g3, i)
* b = _get_coords(gout)
* p = Polygon(b) # <<<<<<<<<<<<<<
* pout.append(p)
* elif typeid == GEOS_MULTILINESTRING:
*/
__pyx_3 = PyTuple_New(1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; goto __pyx_L1;}
Py_INCREF(__pyx_v_b);
PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_b);
__pyx_2 = PyObject_CallObject(((PyObject*)__pyx_ptype_5_geos_Polygon), __pyx_3); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; goto __pyx_L1;}
Py_DECREF(__pyx_3); __pyx_3 = 0;
Py_DECREF(__pyx_v_p);
__pyx_v_p = __pyx_2;
__pyx_2 = 0;
/* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":188
* b = _get_coords(gout)
* p = Polygon(b)
* pout.append(p) # <<<<<<<<<<<<<<
* elif typeid == GEOS_MULTILINESTRING:
* numgeoms = GEOSGetNumGeometries(g3)
*/
__pyx_3 = PyObject_GetAttr(__pyx_v_pout, __pyx_n_append); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; goto __pyx_L1;}
__pyx_2 = PyTuple_New(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; goto __pyx_L1;}
Py_INCREF(__pyx_v_p);
PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_p);
__pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; goto __pyx_L1;}
Py_DECREF(__pyx_3); __pyx_3 = 0;
Py_DECREF(__pyx_2); __pyx_2 = 0;
Py_DECREF(__pyx_4); __pyx_4 = 0;
}
goto __pyx_L2;
}
__pyx_1 = (__pyx_v_typeid == GEOS_MULTILINESTRING);
if (__pyx_1) {
/* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":190
* pout.append(p)
* elif typeid == GEOS_MULTILINESTRING:
* numgeoms = GEOSGetNumGeometries(g3) # <<<<<<<<<<<<<<
* pout = []
* for i from 0 <= i < numgeoms:
*/
__pyx_v_numgeoms = GEOSGetNumGeometries(__pyx_v_g3);
/* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":191
* elif typeid == GEOS_MULTILINESTRING:
* numgeoms = GEOSGetNumGeometries(g3)
* pout = [] # <<<<<<<<<<<<<<
* for i from 0 <= i < numgeoms:
* gout = GEOSGetGeometryN(g3, i)
*/
__pyx_3 = PyList_New(0); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; goto __pyx_L1;}
Py_DECREF(__pyx_v_pout);
__pyx_v_pout = __pyx_3;
__pyx_3 = 0;
/* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":192
* numgeoms = GEOSGetNumGeometries(g3)
* pout = []
* for i from 0 <= i < numgeoms: # <<<<<<<<<<<<<<
* gout = GEOSGetGeometryN(g3, i)
* b = _get_coords(gout)
*/
for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_numgeoms; __pyx_v_i++) {
/* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":193
* pout = []
* for i from 0 <= i < numgeoms:
* gout = GEOSGetGeometryN(g3, i) # <<<<<<<<<<<<<<
* b = _get_coords(gout)
* p = LineString(b)
*/
__pyx_v_gout = GEOSGetGeometryN(__pyx_v_g3,__pyx_v_i);
/* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":194
* for i from 0 <= i < numgeoms:
* gout = GEOSGetGeometryN(g3, i)
* b = _get_coords(gout) # <<<<<<<<<<<<<<
* p = LineString(b)
* pout.append(p)
*/
__pyx_2 = __pyx_f_5_geos__get_coords(__pyx_v_gout); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; goto __pyx_L1;}
Py_DECREF(__pyx_v_b);
__pyx_v_b = __pyx_2;
__pyx_2 = 0;
/* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":195
* gout = GEOSGetGeometryN(g3, i)
* b = _get_coords(gout)
* p = LineString(b) # <<<<<<<<<<<<<<
* pout.append(p)
* else:
*/
__pyx_4 = PyTuple_New(1); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; goto __pyx_L1;}
Py_INCREF(__pyx_v_b);
PyTuple_SET_ITEM(__pyx_4, 0, __pyx_v_b);
__pyx_3 = PyObject_CallObject(((PyObject*)__pyx_ptype_5_geos_LineString), __pyx_4); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; goto __pyx_L1;}
Py_DECREF(__pyx_4); __pyx_4 = 0;
Py_DECREF(__pyx_v_p);
__pyx_v_p = __pyx_3;
__pyx_3 = 0;
/* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":196
* b = _get_coords(gout)
* p = LineString(b)
* pout.append(p) # <<<<<<<<<<<<<<
* else:
* type = PyString_FromString(GEOSGeomType(g3))
*/
__pyx_2 = PyObject_GetAttr(__pyx_v_pout, __pyx_n_append); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; goto __pyx_L1;}
__pyx_4 = PyTuple_New(1); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; goto __pyx_L1;}
Py_INCREF(__pyx_v_p);
PyTuple_SET_ITEM(__pyx_4, 0, __pyx_v_p);
__pyx_3 = PyObject_CallObject(__pyx_2, __pyx_4); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
Py_DECREF(__pyx_4); __pyx_4 = 0;
Py_DECREF(__pyx_3); __pyx_3 = 0;
}
goto __pyx_L2;
}
/*else*/ {
/* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":198
* pout.append(p)
* else:
* type = PyString_FromString(GEOSGeomType(g3)) # <<<<<<<<<<<<<<
* raise NotImplementedError("intersections of type '%s' not yet implemented" % (type))
* GEOSGeom_destroy(g3)
*/
__pyx_2 = PyString_FromString(GEOSGeomType(__pyx_v_g3)); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; goto __pyx_L1;}
Py_DECREF(__pyx_v_type);
__pyx_v_type = __pyx_2;
__pyx_2 = 0;
/* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":199
* else:
* type = PyString_FromString(GEOSGeomType(g3))
* raise NotImplementedError("intersections of type '%s' not yet implemented" % (type)) # <<<<<<<<<<<<<<
* GEOSGeom_destroy(g3)
* return pout
*/
__pyx_4 = PyNumber_Remainder(__pyx_k8p, __pyx_v_type); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; goto __pyx_L1;}
__pyx_3 = PyTuple_New(1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; goto __pyx_L1;}
PyTuple_SET_ITEM(__pyx_3, 0, __pyx_4);
__pyx_4 = 0;
__pyx_2 = PyObject_CallObject(__pyx_builtin_NotImplementedError, __pyx_3); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; goto __pyx_L1;}
Py_DECREF(__pyx_3); __pyx_3 = 0;
__Pyx_Raise(__pyx_2, 0, 0);
Py_DECREF(__pyx_2); __pyx_2 = 0;
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; goto __pyx_L1;}
}
__pyx_L2:;
/* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":200
* type = PyString_FromString(GEOSGeomType(g3))
* raise NotImplementedError("intersections of type '%s' not yet implemented" % (type))
* GEOSGeom_destroy(g3) # <<<<<<<<<<<<<<
* return pout
*
*/
GEOSGeom_destroy(__pyx_v_g3);
/* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":201
* raise NotImplementedError("intersections of type '%s' not yet implemented" % (type))
* GEOSGeom_destroy(g3)
* 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 = NULL;
__pyx_L0:;
Py_DECREF(__pyx_v_b);
Py_DECREF(__pyx_v_p);
Py_DECREF(__pyx_v_pout);
Py_DECREF(__pyx_v_type);
Py_DECREF(__pyx_v_self);
Py_DECREF(__pyx_v_geom);
return __pyx_r;
}
static PyObject *__pyx_pf_5_geos_12BaseGeometry_get_coords(PyObject *__pyx_v_self, PyObject *unused); /*proto*/
static PyObject *__pyx_pf_5_geos_12BaseGeometry_get_coords(PyObject *__pyx_v_self, PyObject *unused) {
PyObject *__pyx_r;
PyObject *__pyx_1 = 0;
Py_INCREF(__pyx_v_self);
__pyx_1 = __pyx_f_5_geos__get_coords(((struct __pyx_obj_5_geos_BaseGeometry *)__pyx_v_self)->_geom); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; 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 = NULL;
__pyx_L0:;
Py_DECREF(__pyx_v_self);
return __pyx_r;
}
static void __pyx_pf_5_geos_12BaseGeometry___dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pf_5_geos_12BaseGeometry___dealloc__(PyObject *__pyx_v_self) {
Py_INCREF(__pyx_v_self);
GEOSGeom_destroy(((struct __pyx_obj_5_geos_BaseGeometry *)__pyx_v_self)->_geom);
Py_DECREF(__pyx_v_self);
}
static PyObject *__pyx_n___class__;
static PyObject *__pyx_pf_5_geos_12BaseGeometry___reduce__(PyObject *__pyx_v_self, PyObject *unused); /*proto*/
static char __pyx_doc_5_geos_12BaseGeometry___reduce__[] = "special method that allows geos instance to be pickled";
static PyObject *__pyx_pf_5_geos_12BaseGeometry___reduce__(PyObject *__pyx_v_self, PyObject *unused) {
PyObject *__pyx_r;
PyObject *__pyx_1 = 0;
PyObject *__pyx_2 = 0;
PyObject *__pyx_3 = 0;
Py_INCREF(__pyx_v_self);
__pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n___class__); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; goto __pyx_L1;}
__pyx_2 = PyTuple_New(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; goto __pyx_L1;}
Py_INCREF(((struct __pyx_obj_5_geos_BaseGeometry *)__pyx_v_self)->boundary);
PyTuple_SET_ITEM(__pyx_2, 0, ((struct __pyx_obj_5_geos_BaseGeometry *)__pyx_v_self)->boundary);
__pyx_3 = PyTuple_New(2); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; goto __pyx_L1;}
PyTuple_SET_ITEM(__pyx_3, 0, __pyx_1);
PyTuple_SET_ITEM(__pyx_3, 1, __pyx_2);
__pyx_1 = 0;
__pyx_2 = 0;
__pyx_r = __pyx_3;
__pyx_3 = 0;
goto __pyx_L0;
__pyx_r = Py_None; Py_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1:;
Py_XDECREF(__pyx_1);
Py_XDECREF(__pyx_2);
Py_XDECREF(__pyx_3);
__Pyx_AddTraceback("_geos.BaseGeometry.__reduce__");
__pyx_r = NULL;
__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_pf_5_geos_7Polygon___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_5_geos_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};
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_5_geos_ndarray, 1, "b"))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; goto __pyx_L1;}
/* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":225
* # 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) {
__pyx_2 = PyObject_GetAttr(((PyObject *)__pyx_v_b), __pyx_n_copy); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; goto __pyx_L1;}
__pyx_3 = PyObject_CallObject(__pyx_2, 0); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
if (!__Pyx_TypeTest(__pyx_3, __pyx_ptype_5_geos_ndarray)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; goto __pyx_L1;}
Py_DECREF(((PyObject *)__pyx_v_b));
__pyx_v_b = ((PyArrayObject *)__pyx_3);
__pyx_3 = 0;
goto __pyx_L2;
}
__pyx_L2:;
/* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":228
* 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 = 228; 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 = 228; goto __pyx_L1;}
__pyx_4 = PyObject_GetItem(__pyx_2, __pyx_3); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; 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 = 228; goto __pyx_L1;}
Py_DECREF(__pyx_4); __pyx_4 = 0;
__pyx_v_m = __pyx_5;
/* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":231
*
* # 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 = 231; 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 = 231; 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 = 231; 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 = 231; 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 = 231; 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 = 231; 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 = 231; 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 = 231; 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 = 231; 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 = 231; 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 = 231; 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 = 231; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
if (__pyx_1) {
__pyx_v_M = (__pyx_v_m + 1);
goto __pyx_L3;
}
/*else*/ {
__pyx_v_M = __pyx_v_m;
}
__pyx_L3:;
/* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":235
* else:
* M = m
* self._npts = M # <<<<<<<<<<<<<<
*
* # Create a coordinate sequence
*/
((struct __pyx_obj_5_geos_Polygon *)__pyx_v_self)->__pyx_base._npts = __pyx_v_M;
/* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":238
*
* # Create a coordinate sequence
* cs = GEOSCoordSeq_create(M, 2) # <<<<<<<<<<<<<<
*
* # add to coordinate sequence
*/
__pyx_v_cs = GEOSCoordSeq_create(__pyx_v_M,2);
/* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":241
*
* # 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);
/* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":242
* # 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++) {
/* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":243
* 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)]);
/* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":244
* 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)]);
/* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":247
* # 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);
/* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":248
* # 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);
}
/* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":251
*
* # 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) {
/* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":252
* # 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]);
/* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":253
* 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]);
/* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":254
* 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);
/* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":255
* 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_L6;
}
__pyx_L6:;
/* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":258
*
* # create LinearRing
* lr = GEOSGeom_createLinearRing(cs) # <<<<<<<<<<<<<<
*
* # create Polygon from LinearRing (assuming no holes)
*/
__pyx_v_lr = GEOSGeom_createLinearRing(__pyx_v_cs);
/* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":261
*
* # create Polygon from LinearRing (assuming no holes)
* self._geom = GEOSGeom_createPolygon(lr,NULL,0) # <<<<<<<<<<<<<<
* self.boundary = b
*
*/
((struct __pyx_obj_5_geos_Polygon *)__pyx_v_self)->__pyx_base._geom = GEOSGeom_createPolygon(__pyx_v_lr,NULL,0);
/* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":262
* # create Polygon from LinearRing (assuming no holes)
* self._geom = GEOSGeom_createPolygon(lr,NULL,0)
* self.boundary = b # <<<<<<<<<<<<<<
*
*
*/
Py_INCREF(((PyObject *)__pyx_v_b));
Py_DECREF(((struct __pyx_obj_5_geos_Polygon *)__pyx_v_self)->__pyx_base.boundary);
((struct __pyx_obj_5_geos_Polygon *)__pyx_v_self)->__pyx_base.boundary = ((PyObject *)__pyx_v_b);
__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_pf_5_geos_7Polygon_area(PyObject *__pyx_v_self, PyObject *unused); /*proto*/
static PyObject *__pyx_pf_5_geos_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);
/* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":267
* def area(self):
* cdef double area
* GEOSArea(self._geom, &area) # <<<<<<<<<<<<<<
* return area
*
*/
GEOSArea(((struct __pyx_obj_5_geos_Polygon *)__pyx_v_self)->__pyx_base._geom,(&__pyx_v_area));
/* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":268
* cdef double area
* GEOSArea(self._geom, &area)
* return area # <<<<<<<<<<<<<<
*
* cdef class LineString(BaseGeometry):
*/
__pyx_1 = PyFloat_FromDouble(__pyx_v_area); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 268; 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.Polygon.area");
__pyx_r = NULL;
__pyx_L0:;
Py_DECREF((PyObject *)__pyx_v_self);
return __pyx_r;
}
static int __pyx_pf_5_geos_10LineString___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_5_geos_10LineString___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyArrayObject *__pyx_v_b = 0;
double __pyx_v_dx;
double __pyx_v_dy;
GEOSCoordSeq *__pyx_v_cs;
int __pyx_v_i;
int __pyx_v_M;
double *__pyx_v_bbuffer;
int __pyx_r;
int __pyx_1;
PyObject *__pyx_2 = 0;
PyObject *__pyx_3 = 0;
PyObject *__pyx_4 = 0;
int __pyx_5;
static char *__pyx_argnames[] = {"b",0};
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_5_geos_ndarray, 1, "b"))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 271; goto __pyx_L1;}
/* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":279
* # 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) {
__pyx_2 = PyObject_GetAttr(((PyObject *)__pyx_v_b), __pyx_n_copy); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 280; goto __pyx_L1;}
__pyx_3 = PyObject_CallObject(__pyx_2, 0); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 280; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
if (!__Pyx_TypeTest(__pyx_3, __pyx_ptype_5_geos_ndarray)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 280; goto __pyx_L1;}
Py_DECREF(((PyObject *)__pyx_v_b));
__pyx_v_b = ((PyArrayObject *)__pyx_3);
__pyx_3 = 0;
goto __pyx_L2;
}
__pyx_L2:;
/* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":282
* b = b.copy()
*
* M = b.shape[0] # <<<<<<<<<<<<<<
* self._npts = M
*
*/
__pyx_2 = PyObject_GetAttr(((PyObject *)__pyx_v_b), __pyx_n_shape); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; 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 = 282; goto __pyx_L1;}
__pyx_4 = PyObject_GetItem(__pyx_2, __pyx_3); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; goto __pyx_L1;}
Py_DECREF(__pyx_3); __pyx_3 = 0;
}
Py_DECREF(__pyx_2); __pyx_2 = 0;
__pyx_5 = PyInt_AsLong(__pyx_4); if (unlikely((__pyx_5 == -1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; goto __pyx_L1;}
Py_DECREF(__pyx_4); __pyx_4 = 0;
__pyx_v_M = __pyx_5;
/* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":283
*
* M = b.shape[0]
* self._npts = M # <<<<<<<<<<<<<<
*
* # Create a coordinate sequence
*/
((struct __pyx_obj_5_geos_LineString *)__pyx_v_self)->__pyx_base._npts = __pyx_v_M;
/* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":286
*
* # Create a coordinate sequence
* cs = GEOSCoordSeq_create(M, 2) # <<<<<<<<<<<<<<
*
* # add to coordinate sequence
*/
__pyx_v_cs = GEOSCoordSeq_create(__pyx_v_M,2);
/* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":289
*
* # 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);
/* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":290
* # 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++) {
/* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":291
* 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)]);
/* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":292
* 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)]);
/* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":295
* # 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);
/* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":296
* # always set X before Y
* GEOSCoordSeq_setX(cs, i, dx)
* GEOSCoordSeq_setY(cs, i, dy) # <<<<<<<<<<<<<<
*
* # create LineString
*/
GEOSCoordSeq_setY(__pyx_v_cs,__pyx_v_i,__pyx_v_dy);
}
/* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":299
*
* # create LineString
* self._geom = GEOSGeom_createLineString(cs) # <<<<<<<<<<<<<<
* self.boundary = b
*
*/
((struct __pyx_obj_5_geos_LineString *)__pyx_v_self)->__pyx_base._geom = GEOSGeom_createLineString(__pyx_v_cs);
/* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":300
* # create LineString
* self._geom = GEOSGeom_createLineString(cs)
* self.boundary = b # <<<<<<<<<<<<<<
*
* cdef class Point(BaseGeometry):
*/
Py_INCREF(((PyObject *)__pyx_v_b));
Py_DECREF(((struct __pyx_obj_5_geos_LineString *)__pyx_v_self)->__pyx_base.boundary);
((struct __pyx_obj_5_geos_LineString *)__pyx_v_self)->__pyx_base.boundary = ((PyObject *)__pyx_v_b);
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1:;
Py_XDECREF(__pyx_2);
Py_XDECREF(__pyx_3);
Py_XDECREF(__pyx_4);
__Pyx_AddTraceback("_geos.LineString.__init__");
__pyx_r = -1;
__pyx_L0:;
Py_DECREF((PyObject *)__pyx_v_self);
Py_DECREF(__pyx_v_b);
return __pyx_r;
}
static int __pyx_pf_5_geos_5Point___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_5_geos_5Point___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_b = 0;
double __pyx_v_dx;
double __pyx_v_dy;
GEOSCoordSeq *__pyx_v_cs;
int __pyx_r;
PyObject *__pyx_1 = 0;
PyObject *__pyx_2 = 0;
double __pyx_3;
static char *__pyx_argnames[] = {"b",0};
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);
/* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":308
* cdef GEOSCoordSeq *cs
* # Create a coordinate sequence
* cs = GEOSCoordSeq_create(1, 2) # <<<<<<<<<<<<<<
* dx = b[0]; dy = b[1]
* GEOSCoordSeq_setX(cs, 0, dx)
*/
__pyx_v_cs = GEOSCoordSeq_create(1,2);
/* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":309
* # Create a coordinate sequence
* cs = GEOSCoordSeq_create(1, 2)
* dx = b[0]; dy = b[1] # <<<<<<<<<<<<<<
* GEOSCoordSeq_setX(cs, 0, dx)
* GEOSCoordSeq_setY(cs, 0, dy)
*/
if (PyList_CheckExact(__pyx_v_b) && 0 <= 0 && 0 < PyList_GET_SIZE(__pyx_v_b)) {
__pyx_2 = PyList_GET_ITEM(__pyx_v_b, 0); Py_INCREF(__pyx_2);
} else if (PyTuple_CheckExact(__pyx_v_b) && 0 <= 0 && 0 < PyTuple_GET_SIZE(__pyx_v_b)) {
__pyx_2 = PyTuple_GET_ITEM(__pyx_v_b, 0); Py_INCREF(__pyx_2);
} else {
__pyx_1 = PyInt_FromLong(0); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; goto __pyx_L1;}
__pyx_2 = PyObject_GetItem(__pyx_v_b, __pyx_1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; goto __pyx_L1;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
}
__pyx_3 = PyFloat_AsDouble(__pyx_2); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
__pyx_v_dx = __pyx_3;
/* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":309
* # Create a coordinate sequence
* cs = GEOSCoordSeq_create(1, 2)
* dx = b[0]; dy = b[1] # <<<<<<<<<<<<<<
* GEOSCoordSeq_setX(cs, 0, dx)
* GEOSCoordSeq_setY(cs, 0, dy)
*/
if (PyList_CheckExact(__pyx_v_b) && 0 <= 1 && 1 < PyList_GET_SIZE(__pyx_v_b)) {
__pyx_2 = PyList_GET_ITEM(__pyx_v_b, 1); Py_INCREF(__pyx_2);
} else if (PyTuple_CheckExact(__pyx_v_b) && 0 <= 1 && 1 < PyTuple_GET_SIZE(__pyx_v_b)) {
__pyx_2 = PyTuple_GET_ITEM(__pyx_v_b, 1); Py_INCREF(__pyx_2);
} else {
__pyx_1 = PyInt_FromLong(1); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; goto __pyx_L1;}
__pyx_2 = PyObject_GetItem(__pyx_v_b, __pyx_1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; goto __pyx_L1;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
}
__pyx_3 = PyFloat_AsDouble(__pyx_2); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
__pyx_v_dy = __pyx_3;
/* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":310
* cs = GEOSCoordSeq_create(1, 2)
* dx = b[0]; dy = b[1]
* GEOSCoordSeq_setX(cs, 0, dx) # <<<<<<<<<<<<<<
* GEOSCoordSeq_setY(cs, 0, dy)
* self._geom = GEOSGeom_createPoint(cs)
*/
GEOSCoordSeq_setX(__pyx_v_cs,0,__pyx_v_dx);
/* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":311
* dx = b[0]; dy = b[1]
* GEOSCoordSeq_setX(cs, 0, dx)
* GEOSCoordSeq_setY(cs, 0, dy) # <<<<<<<<<<<<<<
* self._geom = GEOSGeom_createPoint(cs)
* self._npts = 1
*/
GEOSCoordSeq_setY(__pyx_v_cs,0,__pyx_v_dy);
/* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":312
* GEOSCoordSeq_setX(cs, 0, dx)
* GEOSCoordSeq_setY(cs, 0, dy)
* self._geom = GEOSGeom_createPoint(cs) # <<<<<<<<<<<<<<
* self._npts = 1
* self.boundary = b
*/
((struct __pyx_obj_5_geos_Point *)__pyx_v_self)->__pyx_base._geom = GEOSGeom_createPoint(__pyx_v_cs);
/* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":313
* GEOSCoordSeq_setY(cs, 0, dy)
* self._geom = GEOSGeom_createPoint(cs)
* self._npts = 1 # <<<<<<<<<<<<<<
* self.boundary = b
*
*/
((struct __pyx_obj_5_geos_Point *)__pyx_v_self)->__pyx_base._npts = 1;
/* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":314
* self._geom = GEOSGeom_createPoint(cs)
* self._npts = 1
* self.boundary = b # <<<<<<<<<<<<<<
*
* cdef _get_coords(GEOSGeom *geom):
*/
Py_INCREF(__pyx_v_b);
Py_DECREF(((struct __pyx_obj_5_geos_Point *)__pyx_v_self)->__pyx_base.boundary);
((struct __pyx_obj_5_geos_Point *)__pyx_v_self)->__pyx_base.boundary = __pyx_v_b;
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1:;
Py_XDECREF(__pyx_1);
Py_XDECREF(__pyx_2);
__Pyx_AddTraceback("_geos.Point.__init__");
__pyx_r = -1;
__pyx_L0:;
Py_DECREF((PyObject *)__pyx_v_self);
Py_DECREF(__pyx_v_b);
return __pyx_r;
}
static PyObject *__pyx_num_2;
static PyObject *__pyx_n_empty;
static PyObject *__pyx_n_float64;
static PyObject *__pyx_f_5_geos__get_coords(GEOSGeom *__pyx_v_geom) {
GEOSCoordSeq *__pyx_v_cs;
GEOSGeom *__pyx_v_lr;
unsigned int __pyx_v_i;
unsigned int __pyx_v_M;
double __pyx_v_dx;
double __pyx_v_dy;
PyArrayObject *__pyx_v_b;
double *__pyx_v_bbuffer;
PyObject *__pyx_r;
int __pyx_1;
PyObject *__pyx_2 = 0;
PyObject *__pyx_3 = 0;
PyObject *__pyx_4 = 0;
PyObject *__pyx_5 = 0;
__pyx_v_b = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
/* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":323
* cdef ndarray b
* cdef double *bbuffer
* if GEOSGeomTypeId(geom) == GEOS_POLYGON: # <<<<<<<<<<<<<<
* lr = GEOSGetExteriorRing(geom)
* cs = GEOSGeom_getCoordSeq(lr)
*/
__pyx_1 = (GEOSGeomTypeId(__pyx_v_geom) == GEOS_POLYGON);
if (__pyx_1) {
/* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":324
* cdef double *bbuffer
* if GEOSGeomTypeId(geom) == GEOS_POLYGON:
* lr = GEOSGetExteriorRing(geom) # <<<<<<<<<<<<<<
* cs = GEOSGeom_getCoordSeq(lr)
* else:
*/
__pyx_v_lr = GEOSGetExteriorRing(__pyx_v_geom);
/* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":325
* if GEOSGeomTypeId(geom) == GEOS_POLYGON:
* lr = GEOSGetExteriorRing(geom)
* cs = GEOSGeom_getCoordSeq(lr) # <<<<<<<<<<<<<<
* else:
* cs = GEOSGeom_getCoordSeq(geom)
*/
__pyx_v_cs = GEOSGeom_getCoordSeq(__pyx_v_lr);
goto __pyx_L2;
}
/*else*/ {
__pyx_v_cs = GEOSGeom_getCoordSeq(__pyx_v_geom);
}
__pyx_L2:;
/* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":328
* else:
* cs = GEOSGeom_getCoordSeq(geom)
* GEOSCoordSeq_getSize(cs, &M) # <<<<<<<<<<<<<<
* b = numpy.empty((M,2), numpy.float64)
* bbuffer = <double *>b.data
*/
GEOSCoordSeq_getSize(__pyx_v_cs,(&__pyx_v_M));
/* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":329
* cs = GEOSGeom_getCoordSeq(geom)
* GEOSCoordSeq_getSize(cs, &M)
* b = numpy.empty((M,2), numpy.float64) # <<<<<<<<<<<<<<
* bbuffer = <double *>b.data
* for i from 0 <= i < M:
*/
__pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_numpy); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; goto __pyx_L1;}
__pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_empty); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
__pyx_2 = PyLong_FromUnsignedLong(__pyx_v_M); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; goto __pyx_L1;}
__pyx_4 = PyTuple_New(2); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; goto __pyx_L1;}
PyTuple_SET_ITEM(__pyx_4, 0, __pyx_2);
Py_INCREF(__pyx_num_2);
PyTuple_SET_ITEM(__pyx_4, 1, __pyx_num_2);
__pyx_2 = 0;
__pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_numpy); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; goto __pyx_L1;}
__pyx_5 = PyObject_GetAttr(__pyx_2, __pyx_n_float64); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
__pyx_2 = PyTuple_New(2); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; goto __pyx_L1;}
PyTuple_SET_ITEM(__pyx_2, 0, __pyx_4);
PyTuple_SET_ITEM(__pyx_2, 1, __pyx_5);
__pyx_4 = 0;
__pyx_5 = 0;
__pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; goto __pyx_L1;}
Py_DECREF(__pyx_3); __pyx_3 = 0;
Py_DECREF(__pyx_2); __pyx_2 = 0;
if (!__Pyx_TypeTest(__pyx_4, __pyx_ptype_5_geos_ndarray)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; goto __pyx_L1;}
Py_DECREF(((PyObject *)__pyx_v_b));
__pyx_v_b = ((PyArrayObject *)__pyx_4);
__pyx_4 = 0;
/* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":330
* GEOSCoordSeq_getSize(cs, &M)
* b = numpy.empty((M,2), numpy.float64)
* bbuffer = <double *>b.data # <<<<<<<<<<<<<<
* for i from 0 <= i < M:
* GEOSCoordSeq_getX(cs, i, &dx)
*/
__pyx_v_bbuffer = ((double *)__pyx_v_b->data);
/* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":331
* b = numpy.empty((M,2), numpy.float64)
* bbuffer = <double *>b.data
* for i from 0 <= i < M: # <<<<<<<<<<<<<<
* GEOSCoordSeq_getX(cs, i, &dx)
* GEOSCoordSeq_getY(cs, i, &dy)
*/
for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_M; __pyx_v_i++) {
/* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":332
* bbuffer = <double *>b.data
* for i from 0 <= i < M:
* GEOSCoordSeq_getX(cs, i, &dx) # <<<<<<<<<<<<<<
* GEOSCoordSeq_getY(cs, i, &dy)
* bbuffer[2*i] = dx
*/
GEOSCoordSeq_getX(__pyx_v_cs,__pyx_v_i,(&__pyx_v_dx));
/* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":333
* for i from 0 <= i < M:
* GEOSCoordSeq_getX(cs, i, &dx)
* GEOSCoordSeq_getY(cs, i, &dy) # <<<<<<<<<<<<<<
* bbuffer[2*i] = dx
* bbuffer[2*i+1] = dy
*/
GEOSCoordSeq_getY(__pyx_v_cs,__pyx_v_i,(&__pyx_v_dy));
/* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":334
* GEOSCoordSeq_getX(cs, i, &dx)
* GEOSCoordSeq_getY(cs, i, &dy)
* bbuffer[2*i] = dx # <<<<<<<<<<<<<<
* bbuffer[2*i+1] = dy
* return b
*/
(__pyx_v_bbuffer[(2 * __pyx_v_i)]) = __pyx_v_dx;
/* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":335
* GEOSCoordSeq_getY(cs, i, &dy)
* bbuffer[2*i] = dx
* bbuffer[2*i+1] = dy # <<<<<<<<<<<<<<
* return b
*/
(__pyx_v_bbuffer[((2 * __pyx_v_i) + 1)]) = __pyx_v_dy;
}
/* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":336
* bbuffer[2*i] = dx
* bbuffer[2*i+1] = dy
* return b # <<<<<<<<<<<<<<
*/
Py_INCREF(((PyObject *)__pyx_v_b));
__pyx_r = ((PyObject *)__pyx_v_b);
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);
Py_XDECREF(__pyx_5);
__Pyx_AddTraceback("_geos._get_coords");
__pyx_r = 0;
__pyx_L0:;
Py_DECREF(__pyx_v_b);
return __pyx_r;
}
static __Pyx_InternTabEntry __pyx_intern_tab[] = {
{&__pyx_n_NotImplementedError, "NotImplementedError"},
{&__pyx_n_ValueError, "ValueError"},
{&__pyx_n___class__, "__class__"},
{&__pyx_n___dealloc__, "__dealloc__"},
{&__pyx_n___geos_version__, "__geos_version__"},
{&__pyx_n___init__, "__init__"},
{&__pyx_n___reduce__, "__reduce__"},
{&__pyx_n___version__, "__version__"},
{&__pyx_n_append, "append"},
{&__pyx_n_area, "area"},
{&__pyx_n_copy, "copy"},
{&__pyx_n_empty, "empty"},
{&__pyx_n_float64, "float64"},
{&__pyx_n_geom_type, "geom_type"},
{&__pyx_n_get_coords, "get_coords"},
{&__pyx_n_intersection, "intersection"},
{&__pyx_n_intersects, "intersects"},
{&__pyx_n_is_valid, "is_valid"},
{&__pyx_n_numpy, "numpy"},
{&__pyx_n_shape, "shape"},
{&__pyx_n_stderr, "stderr"},
{&__pyx_n_stdout, "stdout"},
{&__pyx_n_sys, "sys"},
{&__pyx_n_within, "within"},
{&__pyx_n_write, "write"},
{0, 0}
};
static __Pyx_StringTabEntry __pyx_string_tab[] = {
{&__pyx_k3p, __pyx_k3, sizeof(__pyx_k3), 0},
{&__pyx_k4p, __pyx_k4, sizeof(__pyx_k4), 0},
{&__pyx_k5p, __pyx_k5, sizeof(__pyx_k5), 0},
{&__pyx_k6p, __pyx_k6, sizeof(__pyx_k6), 0},
{&__pyx_k7p, __pyx_k7, sizeof(__pyx_k7), 0},
{&__pyx_k8p, __pyx_k8, sizeof(__pyx_k8), 0},
{0, 0, 0, 0}
};
static PyObject *__pyx_tp_new_5_geos_BaseGeometry(PyTypeObject *t, PyObject *a, PyObject *k) {
struct __pyx_obj_5_geos_BaseGeometry *p;
PyObject *o = (*t->tp_alloc)(t, 0);
if (!o) return 0;
p = ((struct __pyx_obj_5_geos_BaseGeometry *)o);
p->boundary = Py_None; Py_INCREF(Py_None);
return o;
}
static void __pyx_tp_dealloc_5_geos_BaseGeometry(PyObject *o) {
struct __pyx_obj_5_geos_BaseGeometry *p = (struct __pyx_obj_5_geos_BaseGeometry *)o;
{
PyObject *etype, *eval, *etb;
PyErr_Fetch(&etype, &eval, &etb);
++o->ob_refcnt;
__pyx_pf_5_geos_12BaseGeometry___dealloc__(o);
if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
--o->ob_refcnt;
PyErr_Restore(etype, eval, etb);
}
Py_XDECREF(p->boundary);
(*o->ob_type->tp_free)(o);
}
static int __pyx_tp_traverse_5_geos_BaseGeometry(PyObject *o, visitproc v, void *a) {
int e;
struct __pyx_obj_5_geos_BaseGeometry *p = (struct __pyx_obj_5_geos_BaseGeometry *)o;
if (p->boundary) {
e = (*v)(p->boundary, a); if (e) return e;
}
return 0;
}
static int __pyx_tp_clear_5_geos_BaseGeometry(PyObject *o) {
struct __pyx_obj_5_geos_BaseGeometry *p = (struct __pyx_obj_5_geos_BaseGeometry *)o;
Py_XDECREF(p->boundary);
p->boundary = Py_None; Py_INCREF(Py_None);
return 0;
}
static struct PyMethodDef __pyx_methods_5_geos_BaseGeometry[] = {
{"is_valid", (PyCFunction)__pyx_pf_5_geos_12BaseGeometry_is_valid, METH_NOARGS, 0},
{"geom_type", (PyCFunction)__pyx_pf_5_geos_12BaseGeometry_geom_type, METH_NOARGS, 0},
{"within", (PyCFunction)__pyx_pf_5_geos_12BaseGeometry_within, METH_O, 0},
{"intersects", (PyCFunction)__pyx_pf_5_geos_12BaseGeometry_intersects, METH_O, 0},
{"intersection", (PyCFunction)__pyx_pf_5_geos_12BaseGeometry_intersection, METH_O, 0},
{"get_coords", (PyCFunction)__pyx_pf_5_geos_12BaseGeometry_get_coords, METH_NOARGS, 0},
{"__reduce__", (PyCFunction)__pyx_pf_5_geos_12BaseGeometry___reduce__, METH_NOARGS, __pyx_doc_5_geos_12BaseGeometry___reduce__},
{0, 0, 0, 0}
};
static struct PyMemberDef __pyx_members_5_geos_BaseGeometry[] = {
{"boundary", T_OBJECT, offsetof(struct __pyx_obj_5_geos_BaseGeometry, boundary), 0, 0},
{0, 0, 0, 0, 0}
};
static PyNumberMethods __pyx_tp_as_number_BaseGeometry = {
0, /*nb_add*/
0, /*nb_subtract*/
0, /*nb_multiply*/
0, /*nb_divide*/
0, /*nb_remainder*/
0, /*nb_divmod*/
0, /*nb_power*/
0, /*nb_negative*/
0, /*nb_positive*/
0, /*nb_absolute*/
0, /*nb_nonzero*/
0, /*nb_invert*/
0, /*nb_lshift*/
0, /*nb_rshift*/
0, /*nb_and*/
0, /*nb_xor*/
0, /*nb_or*/
0, /*nb_coerce*/
0, /*nb_int*/
0, /*nb_long*/
0, /*nb_float*/
0, /*nb_oct*/
0, /*nb_hex*/
0, /*nb_inplace_add*/
0, /*nb_inplace_subtract*/
0, /*nb_inplace_multiply*/
0, /*nb_inplace_divide*/
0, /*nb_inplace_remainder*/
0, /*nb_inplace_power*/
0, /*nb_inplace_lshift*/
0, /*nb_inplace_rshift*/
0, /*nb_inplace_and*/
0, /*nb_inplace_xor*/
0, /*nb_inplace_or*/
0, /*nb_floor_divide*/
0, /*nb_true_divide*/
0, /*nb_inplace_floor_divide*/
0, /*nb_inplace_true_divide*/
#if Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX
0, /*nb_index*/
#endif
};
static PySequenceMethods __pyx_tp_as_sequence_BaseGeometry = {
0, /*sq_length*/
0, /*sq_concat*/
0, /*sq_repeat*/
0, /*sq_item*/
0, /*sq_slice*/
0, /*sq_ass_item*/
0, /*sq_ass_slice*/
0, /*sq_contains*/
0, /*sq_inplace_concat*/
0, /*sq_inplace_repeat*/
};
static PyMappingMethods __pyx_tp_as_mapping_BaseGeometry = {
0, /*mp_length*/
0, /*mp_subscript*/
0, /*mp_ass_subscript*/
};
static PyBufferProcs __pyx_tp_as_buffer_BaseGeometry = {
0, /*bf_getreadbuffer*/
0, /*bf_getwritebuffer*/
0, /*bf_getsegcount*/
0, /*bf_getcharbuffer*/
};
PyTypeObject __pyx_type_5_geos_BaseGeometry = {
PyObject_HEAD_INIT(0)
0, /*ob_size*/
"_geos.BaseGeometry", /*tp_name*/
sizeof(struct __pyx_obj_5_geos_BaseGeometry), /*tp_basicsize*/
0, /*tp_itemsize*/
__pyx_tp_dealloc_5_geos_BaseGeometry, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
0, /*tp_compare*/
0, /*tp_repr*/
&__pyx_tp_as_number_BaseGeometry, /*tp_as_number*/
&__pyx_tp_as_sequence_BaseGeometry, /*tp_as_sequence*/
&__pyx_tp_as_mapping_BaseGeometry, /*tp_as_mapping*/
0, /*tp_hash*/
0, /*tp_call*/
0, /*tp_str*/
0, /*tp_getattro*/
0, /*tp_setattro*/
&__pyx_tp_as_buffer_BaseGeometry, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
0, /*tp_doc*/
__pyx_tp_traverse_5_geos_BaseGeometry, /*tp_traverse*/
__pyx_tp_clear_5_geos_BaseGeometry, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
__pyx_methods_5_geos_BaseGeometry, /*tp_methods*/
__pyx_members_5_geos_BaseGeometry, /*tp_members*/
0, /*tp_getset*/
0, /*tp_base*/
0, /*tp_dict*/
0, /*tp_descr_get*/
0, /*tp_descr_set*/
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
__pyx_tp_new_5_geos_BaseGeometry, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
0, /*tp_mro*/
0, /*tp_cache*/
0, /*tp_subclasses*/
0, /*tp_weaklist*/
};
static PyObject *__pyx_tp_new_5_geos_Polygon(PyTypeObject *t, PyObject *a, PyObject *k) {
PyObject *o = __pyx_ptype_5_geos_BaseGeometry->tp_new(t, a, k);
if (!o) return 0;
return o;
}
static void __pyx_tp_dealloc_5_geos_Polygon(PyObject *o) {
__pyx_ptype_5_geos_BaseGeometry->tp_dealloc(o);
}
static int __pyx_tp_traverse_5_geos_Polygon(PyObject *o, visitproc v, void *a) {
int e;
e = __pyx_ptype_5_geos_BaseGeometry->tp_traverse(o, v, a); if (e) return e;
return 0;
}
static int __pyx_tp_clear_5_geos_Polygon(PyObject *o) {
__pyx_ptype_5_geos_BaseGeometry->tp_clear(o);
return 0;
}
static struct PyMethodDef __pyx_methods_5_geos_Polygon[] = {
{"area", (PyCFunction)__pyx_pf_5_geos_7Polygon_area, METH_NOARGS, 0},
{0, 0, 0, 0}
};
static PyNumberMethods __pyx_tp_as_number_Polygon = {
0, /*nb_add*/
0, /*nb_subtract*/
0, /*nb_multiply*/
0, /*nb_divide*/
0, /*nb_remainder*/
0, /*nb_divmod*/
0, /*nb_power*/
0, /*nb_negative*/
0, /*nb_positive*/
0, /*nb_absolute*/
0, /*nb_nonzero*/
0, /*nb_invert*/
0, /*nb_lshift*/
0, /*nb_rshift*/
0, /*nb_and*/
0, /*nb_xor*/
0, /*nb_or*/
0, /*nb_coerce*/
0, /*nb_int*/
0, /*nb_long*/
0, /*nb_float*/
0, /*nb_oct*/
0, /*nb_hex*/
0, /*nb_inplace_add*/
0, /*nb_inplace_subtract*/
0, /*nb_inplace_multiply*/
0, /*nb_inplace_divide*/
0, /*nb_inplace_remainder*/
0, /*nb_inplace_power*/
0, /*nb_inplace_lshift*/
0, /*nb_inplace_rshift*/
0, /*nb_inplace_and*/
0, /*nb_inplace_xor*/
0, /*nb_inplace_or*/
0, /*nb_floor_divide*/
0, /*nb_true_divide*/
0, /*nb_inplace_floor_divide*/
0, /*nb_inplace_true_divide*/
#if Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX
0, /*nb_index*/
#endif
};
static PySequenceMethods __pyx_tp_as_sequence_Polygon = {
0, /*sq_length*/
0, /*sq_concat*/
0, /*sq_repeat*/
0, /*sq_item*/
0, /*sq_slice*/
0, /*sq_ass_item*/
0, /*sq_ass_slice*/
0, /*sq_contains*/
0, /*sq_inplace_concat*/
0, /*sq_inplace_repeat*/
};
static PyMappingMethods __pyx_tp_as_mapping_Polygon = {
0, /*mp_length*/
0, /*mp_subscript*/
0, /*mp_ass_subscript*/
};
static PyBufferProcs __pyx_tp_as_buffer_Polygon = {
0, /*bf_getreadbuffer*/
0, /*bf_getwritebuffer*/
0, /*bf_getsegcount*/
0, /*bf_getcharbuffer*/
};
PyTypeObject __pyx_type_5_geos_Polygon = {
PyObject_HEAD_INIT(0)
0, /*ob_size*/
"_geos.Polygon", /*tp_name*/
sizeof(struct __pyx_obj_5_geos_Polygon), /*tp_basicsize*/
0, /*tp_itemsize*/
__pyx_tp_dealloc_5_geos_Polygon, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
0, /*tp_compare*/
0, /*tp_repr*/
&__pyx_tp_as_number_Polygon, /*tp_as_number*/
&__pyx_tp_as_sequence_Polygon, /*tp_as_sequence*/
&__pyx_tp_as_mapping_Polygon, /*tp_as_mapping*/
0, /*tp_hash*/
0, /*tp_call*/
0, /*tp_str*/
0, /*tp_getattro*/
0, /*tp_setattro*/
&__pyx_tp_as_buffer_Polygon, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
0, /*tp_doc*/
__pyx_tp_traverse_5_geos_Polygon, /*tp_traverse*/
__pyx_tp_clear_5_geos_Polygon, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
__pyx_methods_5_geos_Polygon, /*tp_methods*/
0, /*tp_members*/
0, /*tp_getset*/
0, /*tp_base*/
0, /*tp_dict*/
0, /*tp_descr_get*/
0, /*tp_descr_set*/
0, /*tp_dictoffset*/
__pyx_pf_5_geos_7Polygon___init__, /*tp_init*/
0, /*tp_alloc*/
__pyx_tp_new_5_geos_Polygon, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
0, /*tp_mro*/
0, /*tp_cache*/
0, /*tp_subclasses*/
0, /*tp_weaklist*/
};
static PyObject *__pyx_tp_new_5_geos_LineString(PyTypeObject *t, PyObject *a, PyObject *k) {
PyObject *o = __pyx_ptype_5_geos_BaseGeometry->tp_new(t, a, k);
if (!o) return 0;
return o;
}
static void __pyx_tp_dealloc_5_geos_LineString(PyObject *o) {
__pyx_ptype_5_geos_BaseGeometry->tp_dealloc(o);
}
static int __pyx_tp_traverse_5_geos_LineString(PyObject *o, visitproc v, void *a) {
int e;
e = __pyx_ptype_5_geos_BaseGeometry->tp_traverse(o, v, a); if (e) return e;
return 0;
}
static int __pyx_tp_clear_5_geos_LineString(PyObject *o) {
__pyx_ptype_5_geos_BaseGeometry->tp_clear(o);
return 0;
}
static struct PyMethodDef __pyx_methods_5_geos_LineString[] = {
{0, 0, 0, 0}
};
static PyNumberMethods __pyx_tp_as_number_LineString = {
0, /*nb_add*/
0, /*nb_subtract*/
0, /*nb_multiply*/
0, /*nb_divide*/
0, /*nb_remainder*/
0, /*nb_divmod*/
0, /*nb_power*/
0, /*nb_negative*/
0, /*nb_positive*/
0, /*nb_absolute*/
0, /*nb_nonzero*/
0, /*nb_invert*/
0, /*nb_lshift*/
0, /*nb_rshift*/
0, /*nb_and*/
0, /*nb_xor*/
0, /*nb_or*/
0, /*nb_coerce*/
0, /*nb_int*/
0, /*nb_long*/
0, /*nb_float*/
0, /*nb_oct*/
0, /*nb_hex*/
0, /*nb_inplace_add*/
0, /*nb_inplace_subtract*/
0, /*nb_inplace_multiply*/
0, /*nb_inplace_divide*/
0, /*nb_inplace_remainder*/
0, /*nb_inplace_power*/
0, /*nb_inplace_lshift*/
0, /*nb_inplace_rshift*/
0, /*nb_inplace_and*/
0, /*nb_inplace_xor*/
0, /*nb_inplace_or*/
0, /*nb_floor_divide*/
0, /*nb_true_divide*/
0, /*nb_inplace_floor_divide*/
0, /*nb_inplace_true_divide*/
#if Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX
0, /*nb_index*/
#endif
};
static PySequenceMethods __pyx_tp_as_sequence_LineString = {
0, /*sq_length*/
0, /*sq_concat*/
0, /*sq_repeat*/
0, /*sq_item*/
0, /*sq_slice*/
0, /*sq_ass_item*/
0, /*sq_ass_slice*/
0, /*sq_contains*/
0, /*sq_inplace_concat*/
0, /*sq_inplace_repeat*/
};
static PyMappingMethods __pyx_tp_as_mapping_LineString = {
0, /*mp_length*/
0, /*mp_subscript*/
0, /*mp_ass_subscript*/
};
static PyBufferProcs __pyx_tp_as_buffer_LineString = {
0, /*bf_getreadbuffer*/
0, /*bf_getwritebuffer*/
0, /*bf_getsegcount*/
0, /*bf_getcharbuffer*/
};
PyTypeObject __pyx_type_5_geos_LineString = {
PyObject_HEAD_INIT(0)
0, /*ob_size*/
"_geos.LineString", /*tp_name*/
sizeof(struct __pyx_obj_5_geos_LineString), /*tp_basicsize*/
0, /*tp_itemsize*/
__pyx_tp_dealloc_5_geos_LineString, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
0, /*tp_compare*/
0, /*tp_repr*/
&__pyx_tp_as_number_LineString, /*tp_as_number*/
&__pyx_tp_as_sequence_LineString, /*tp_as_sequence*/
&__pyx_tp_as_mapping_LineString, /*tp_as_mapping*/
0, /*tp_hash*/
0, /*tp_call*/
0, /*tp_str*/
0, /*tp_getattro*/
0, /*tp_setattro*/
&__pyx_tp_as_buffer_LineString, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
0, /*tp_doc*/
__pyx_tp_traverse_5_geos_LineString, /*tp_traverse*/
__pyx_tp_clear_5_geos_LineString, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
__pyx_methods_5_geos_LineString, /*tp_methods*/
0, /*tp_members*/
0, /*tp_getset*/
0, /*tp_base*/
0, /*tp_dict*/
0, /*tp_descr_get*/
0, /*tp_descr_set*/
0, /*tp_dictoffset*/
__pyx_pf_5_geos_10LineString___init__, /*tp_init*/
0, /*tp_alloc*/
__pyx_tp_new_5_geos_LineString, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
0, /*tp_mro*/
0, /*tp_cache*/
0, /*tp_subclasses*/
0, /*tp_weaklist*/
};
static PyObject *__pyx_tp_new_5_geos_Point(PyTypeObject *t, PyObject *a, PyObject *k) {
struct __pyx_obj_5_geos_Point *p;
PyObject *o = __pyx_ptype_5_geos_BaseGeometry->tp_new(t, a, k);
if (!o) return 0;
p = ((struct __pyx_obj_5_geos_Point *)o);
p->x = Py_None; Py_INCREF(Py_None);
p->y = Py_None; Py_INCREF(Py_None);
return o;
}
static void __pyx_tp_dealloc_5_geos_Point(PyObject *o) {
struct __pyx_obj_5_geos_Point *p = (struct __pyx_obj_5_geos_Point *)o;
Py_XDECREF(p->x);
Py_XDECREF(p->y);
__pyx_ptype_5_geos_BaseGeometry->tp_dealloc(o);
}
static int __pyx_tp_traverse_5_geos_Point(PyObject *o, visitproc v, void *a) {
int e;
struct __pyx_obj_5_geos_Point *p = (struct __pyx_obj_5_geos_Point *)o;
e = __pyx_ptype_5_geos_BaseGeometry->tp_traverse(o, v, a); if (e) return e;
if (p->x) {
e = (*v)(p->x, a); if (e) return e;
}
if (p->y) {
e = (*v)(p->y, a); if (e) return e;
}
return 0;
}
static int __pyx_tp_clear_5_geos_Point(PyObject *o) {
struct __pyx_obj_5_geos_Point *p = (struct __pyx_obj_5_geos_Point *)o;
__pyx_ptype_5_geos_BaseGeometry->tp_clear(o);
Py_XDECREF(p->x);
p->x = Py_None; Py_INCREF(Py_None);
Py_XDECREF(p->y);
p->y = Py_None; Py_INCREF(Py_None);
return 0;
}
static struct PyMethodDef __pyx_methods_5_geos_Point[] = {
{0, 0, 0, 0}
};
static struct PyMemberDef __pyx_members_5_geos_Point[] = {
{"x", T_OBJECT, offsetof(struct __pyx_obj_5_geos_Point, x), 0, 0},
{"y", T_OBJECT, offsetof(struct __pyx_obj_5_geos_Point, y), 0, 0},
{0, 0, 0, 0, 0}
};
static PyNumberMethods __pyx_tp_as_number_Point = {
0, /*nb_add*/
0, /*nb_subtract*/
0, /*nb_multiply*/
0, /*nb_divide*/
0, /*nb_remainder*/
0, /*nb_divmod*/
0, /*nb_power*/
0, /*nb_negative*/
0, /*nb_positive*/
0, /*nb_absolute*/
0, /*nb_nonzero*/
0, /*nb_invert*/
0, /*nb_lshift*/
0, /*nb_rshift*/
0, /*nb_and*/
0, /*nb_xor*/
0, /*nb_or*/
0, /*nb_coerce*/
0, /*nb_int*/
0, /*nb_long*/
0, /*nb_float*/
0, /*nb_oct*/
0, /*nb_hex*/
0, /*nb_inplace_add*/
0, /*nb_inplace_subtract*/
0, /*nb_inplace_multiply*/
0, /*nb_inplace_divide*/
0, /*nb_inplace_remainder*/
0, /*nb_inplace_power*/
0, /*nb_inplace_lshift*/
0, /*nb_inplace_rshift*/
0, /*nb_inplace_and*/
0, /*nb_inplace_xor*/
0, /*nb_inplace_or*/
0, /*nb_floor_divide*/
0, /*nb_true_divide*/
0, /*nb_inplace_floor_divide*/
0, /*nb_inplace_true_divide*/
#if Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX
0, /*nb_index*/
#endif
};
static PySequenceMethods __pyx_tp_as_sequence_Point = {
0, /*sq_length*/
0, /*sq_concat*/
0, /*sq_repeat*/
0, /*sq_item*/
0, /*sq_slice*/
0, /*sq_ass_item*/
0, /*sq_ass_slice*/
0, /*sq_contains*/
0, /*sq_inplace_concat*/
0, /*sq_inplace_repeat*/
};
static PyMappingMethods __pyx_tp_as_mapping_Point = {
0, /*mp_length*/
0, /*mp_subscript*/
0, /*mp_ass_subscript*/
};
static PyBufferProcs __pyx_tp_as_buffer_Point = {
0, /*bf_getreadbuffer*/
0, /*bf_getwritebuffer*/
0, /*bf_getsegcount*/
0, /*bf_getcharbuffer*/
};
PyTypeObject __pyx_type_5_geos_Point = {
PyObject_HEAD_INIT(0)
0, /*ob_size*/
"_geos.Point", /*tp_name*/
sizeof(struct __pyx_obj_5_geos_Point), /*tp_basicsize*/
0, /*tp_itemsize*/
__pyx_tp_dealloc_5_geos_Point, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
0, /*tp_compare*/
0, /*tp_repr*/
&__pyx_tp_as_number_Point, /*tp_as_number*/
&__pyx_tp_as_sequence_Point, /*tp_as_sequence*/
&__pyx_tp_as_mapping_Point, /*tp_as_mapping*/
0, /*tp_hash*/
0, /*tp_call*/
0, /*tp_str*/
0, /*tp_getattro*/
0, /*tp_setattro*/
&__pyx_tp_as_buffer_Point, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
0, /*tp_doc*/
__pyx_tp_traverse_5_geos_Point, /*tp_traverse*/
__pyx_tp_clear_5_geos_Point, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
__pyx_methods_5_geos_Point, /*tp_methods*/
__pyx_members_5_geos_Point, /*tp_members*/
0, /*tp_getset*/
0, /*tp_base*/
0, /*tp_dict*/
0, /*tp_descr_get*/
0, /*tp_descr_set*/
0, /*tp_dictoffset*/
__pyx_pf_5_geos_5Point___init__, /*tp_init*/
0, /*tp_alloc*/
__pyx_tp_new_5_geos_Point, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
0, /*tp_mro*/
0, /*tp_cache*/
0, /*tp_subclasses*/
0, /*tp_weaklist*/
};
static struct PyMethodDef __pyx_methods[] = {
{0, 0, 0, 0}
};
static void __pyx_init_filenames(void); /*proto*/
PyMODINIT_FUNC init_geos(void); /*proto*/
PyMODINIT_FUNC init_geos(void) {
PyObject *__pyx_1 = 0;
PyObject *__pyx_2 = 0;
int __pyx_3;
/*--- Libary function declarations ---*/
__pyx_init_filenames();
/*--- Module creation code ---*/
__pyx_m = Py_InitModule4("_geos", __pyx_methods, 0, 0, PYTHON_API_VERSION);
if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;};
__pyx_b = PyImport_AddModule("__builtin__");
if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;};
if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;};
/*--- Intern code ---*/
__pyx_num_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_num_neg_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;};
__pyx_num_0 = PyInt_FromLong(0); if (unlikely(!__pyx_num_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;};
__pyx_num_1 = PyInt_FromLong(1); if (unlikely(!__pyx_num_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;};
__pyx_num_2 = PyInt_FromLong(2); if (unlikely(!__pyx_num_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;};
if (__Pyx_InternStrings(__pyx_intern_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;};
/*--- String init code ---*/
if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;};
/*--- Builtin init code ---*/
__pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; goto __pyx_L1;}
__pyx_builtin_NotImplementedError = __Pyx_GetName(__pyx_b, __pyx_n_NotImplementedError); if (!__pyx_builtin_NotImplementedError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; goto __pyx_L1;}
/*--- Global init code ---*/
/*--- Function export code ---*/
/*--- Function import code ---*/
/*--- Type init code ---*/
__pyx_ptype_5_geos_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject)); if (unlikely(!__pyx_ptype_5_geos_ndarray)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; goto __pyx_L1;}
__pyx_type_5_geos_BaseGeometry.tp_free = _PyObject_GC_Del;
if (PyType_Ready(&__pyx_type_5_geos_BaseGeometry) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; goto __pyx_L1;}
if (PyObject_SetAttrString(__pyx_m, "BaseGeometry", (PyObject *)&__pyx_type_5_geos_BaseGeometry) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; goto __pyx_L1;}
__pyx_ptype_5_geos_BaseGeometry = &__pyx_type_5_geos_BaseGeometry;
__pyx_type_5_geos_Polygon.tp_base = __pyx_ptype_5_geos_BaseGeometry;
if (PyType_Ready(&__pyx_type_5_geos_Polygon) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; goto __pyx_L1;}
if (PyObject_SetAttrString(__pyx_m, "Polygon", (PyObject *)&__pyx_type_5_geos_Polygon) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; goto __pyx_L1;}
__pyx_ptype_5_geos_Polygon = &__pyx_type_5_geos_Polygon;
__pyx_type_5_geos_LineString.tp_base = __pyx_ptype_5_geos_BaseGeometry;
if (PyType_Ready(&__pyx_type_5_geos_LineString) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; goto __pyx_L1;}
if (PyObject_SetAttrString(__pyx_m, "LineString", (PyObject *)&__pyx_type_5_geos_LineString) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; goto __pyx_L1;}
__pyx_ptype_5_geos_LineString = &__pyx_type_5_geos_LineString;
__pyx_type_5_geos_Point.tp_base = __pyx_ptype_5_geos_BaseGeometry;
__pyx_type_5_geos_Point.tp_free = _PyObject_GC_Del;
if (PyType_Ready(&__pyx_type_5_geos_Point) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; goto __pyx_L1;}
if (PyObject_SetAttrString(__pyx_m, "Point", (PyObject *)&__pyx_type_5_geos_Point) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; goto __pyx_L1;}
__pyx_ptype_5_geos_Point = &__pyx_type_5_geos_Point;
/*--- Type import code ---*/
/*--- Execution code ---*/
/* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":1
* import sys # <<<<<<<<<<<<<<
* import numpy
*
*/
__pyx_1 = __Pyx_Import(__pyx_n_sys, 0); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;}
if (PyObject_SetAttr(__pyx_m, __pyx_n_sys, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
/* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":2
* import sys
* import numpy # <<<<<<<<<<<<<<
*
* __version__ = "0.1"
*/
__pyx_1 = __Pyx_Import(__pyx_n_numpy, 0); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; goto __pyx_L1;}
if (PyObject_SetAttr(__pyx_m, __pyx_n_numpy, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; goto __pyx_L1;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
/* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":4
* import numpy
*
* __version__ = "0.1" # <<<<<<<<<<<<<<
*
* # need some python C API functions for strings.
*/
if (PyObject_SetAttr(__pyx_m, __pyx_n___version__, __pyx_k3p) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; goto __pyx_L1;}
/* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":26
*
* # Initialize numpy
* import_array() # <<<<<<<<<<<<<<
*
* # GENERAL NOTES:
*/
import_array();
/* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":121
* cdef geos_version():
* return PyString_FromString(GEOSversion())
* __geos_version__ = geos_version() # module variable. # <<<<<<<<<<<<<<
* if __geos_version__ != "2.2.3-CAPI-1.1.1":
* raise ValueError('version 2.2.3 of the geos library is required')
*/
__pyx_1 = __pyx_f_5_geos_geos_version(); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; goto __pyx_L1;}
if (PyObject_SetAttr(__pyx_m, __pyx_n___geos_version__, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; goto __pyx_L1;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
/* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":122
* return PyString_FromString(GEOSversion())
* __geos_version__ = geos_version() # module variable.
* if __geos_version__ != "2.2.3-CAPI-1.1.1": # <<<<<<<<<<<<<<
* raise ValueError('version 2.2.3 of the geos library is required')
* # intialize GEOS (parameters are notice and error function callbacks).
*/
__pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n___geos_version__); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; goto __pyx_L1;}
__pyx_2 = PyObject_RichCompare(__pyx_1, __pyx_k4p, Py_NE); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; goto __pyx_L1;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
__pyx_3 = __Pyx_PyObject_IsTrue(__pyx_2); if (unlikely(__pyx_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
if (__pyx_3) {
__pyx_1 = PyTuple_New(1); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; goto __pyx_L1;}
Py_INCREF(__pyx_k5p);
PyTuple_SET_ITEM(__pyx_1, 0, __pyx_k5p);
__pyx_2 = PyObject_CallObject(__pyx_builtin_ValueError, __pyx_1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; goto __pyx_L1;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
__Pyx_Raise(__pyx_2, 0, 0);
Py_DECREF(__pyx_2); __pyx_2 = 0;
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; goto __pyx_L1;}
goto __pyx_L5;
}
__pyx_L5:;
/* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":125
* raise ValueError('version 2.2.3 of the geos library is required')
* # intialize GEOS (parameters are notice and error function callbacks).
* initGEOS(notice_h, error_h) # <<<<<<<<<<<<<<
*
* cdef class BaseGeometry:
*/
initGEOS(__pyx_f_5_geos_notice_h,__pyx_f_5_geos_error_h);
/* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":316
* self.boundary = b
*
* cdef _get_coords(GEOSGeom *geom): # <<<<<<<<<<<<<<
* cdef GEOSCoordSeq *cs
* cdef GEOSGeom *lr
*/
if (__Pyx_RegisterCleanup()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;};
return;
__pyx_L1:;
Py_XDECREF(__pyx_1);
Py_XDECREF(__pyx_2);
__Pyx_AddTraceback("_geos");
}
static PyObject* cleanup(PyObject *self, PyObject *unused) {
/*--- Builtin cleanup code ---*/
Py_DECREF(__pyx_builtin_ValueError); __pyx_builtin_ValueError = 0;
Py_DECREF(__pyx_builtin_NotImplementedError); __pyx_builtin_NotImplementedError = 0;
/*--- Intern cleanup code ---*/
Py_DECREF(__pyx_num_neg_1); __pyx_num_neg_1 = 0;
Py_DECREF(__pyx_num_0); __pyx_num_0 = 0;
Py_DECREF(__pyx_num_1); __pyx_num_1 = 0;
Py_DECREF(__pyx_num_2); __pyx_num_2 = 0;
Py_DECREF(__pyx_n_intersects); __pyx_n_intersects = 0;
Py_DECREF(__pyx_n_stdout); __pyx_n_stdout = 0;
Py_DECREF(__pyx_n_get_coords); __pyx_n_get_coords = 0;
Py_DECREF(__pyx_n___reduce__); __pyx_n___reduce__ = 0;
Py_DECREF(__pyx_n_shape); __pyx_n_shape = 0;
Py_DECREF(__pyx_n_append); __pyx_n_append = 0;
Py_DECREF(__pyx_n_copy); __pyx_n_copy = 0;
Py_DECREF(__pyx_n_area); __pyx_n_area = 0;
Py_DECREF(__pyx_n___class__); __pyx_n___class__ = 0;
Py_DECREF(__pyx_n_write); __pyx_n_write = 0;
Py_DECREF(__pyx_n_is_valid); __pyx_n_is_valid = 0;
Py_DECREF(__pyx_n___init__); __pyx_n___init__ = 0;
Py_DECREF(__pyx_n___geos_version__); __pyx_n___geos_version__ = 0;
Py_DECREF(__pyx_n_numpy); __pyx_n_numpy = 0;
Py_DECREF(__pyx_n_ValueError); __pyx_n_ValueError = 0;
Py_DECREF(__pyx_n_empty); __pyx_n_empty = 0;
Py_DECREF(__pyx_n_within); __pyx_n_within = 0;
Py_DECREF(__pyx_n_sys); __pyx_n_sys = 0;
Py_DECREF(__pyx_n_intersection); __pyx_n_intersection = 0;
Py_DECREF(__pyx_n___version__); __pyx_n___version__ = 0;
Py_DECREF(__pyx_n_geom_type); __pyx_n_geom_type = 0;
Py_DECREF(__pyx_n___dealloc__); __pyx_n___dealloc__ = 0;
Py_DECREF(__pyx_n_float64); __pyx_n_float64 = 0;
Py_DECREF(__pyx_n_stderr); __pyx_n_stderr = 0;
Py_DECREF(__pyx_n_NotImplementedError); __pyx_n_NotImplementedError = 0;
Py_INCREF(Py_None); return Py_None;
}
static char *__pyx_filenames[] = {
"_geos.pyx",
};
/* Runtime support code */
static void __pyx_init_filenames(void) {
__pyx_f = __pyx_filenames;
}
static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, char *name) {
if (!type) {
PyErr_Format(PyExc_SystemError, "Missing type object");
return 0;
}
if ((none_allowed && obj == Py_None) || PyObject_TypeCheck(obj, type))
return 1;
PyErr_Format(PyExc_TypeError,
"Argument '%s' has incorrect type (expected %s, got %s)",
name, type->tp_name, obj->ob_type->tp_name);
return 0;
}
static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list) {
PyObject *__import__ = 0;
PyObject *empty_list = 0;
PyObject *module = 0;
PyObject *global_dict = 0;
PyObject *empty_dict = 0;
PyObject *list;
__import__ = PyObject_GetAttrString(__pyx_b, "__import__");
if (!__import__)
goto bad;
if (from_list)
list = from_list;
else {
empty_list = PyList_New(0);
if (!empty_list)
goto bad;
list = empty_list;
}
global_dict = PyModule_GetDict(__pyx_m);
if (!global_dict)
goto bad;
empty_dict = PyDict_New();
if (!empty_dict)
goto bad;
module = PyObject_CallFunction(__import__, "OOOO",
name, global_dict, empty_dict, list);
bad:
Py_XDECREF(empty_list);
Py_XDECREF(__import__);
Py_XDECREF(empty_dict);
return module;
}
static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) {
PyObject *result;
result = PyObject_GetAttr(dict, name);
if (!result)
PyErr_SetObject(PyExc_NameError, name);
return result;
}
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) {
Py_XINCREF(type);
Py_XINCREF(value);
Py_XINCREF(tb);
/* First, check the traceback argument, replacing None with NULL. */
if (tb == Py_None) {
Py_DECREF(tb);
tb = 0;
}
else if (tb != NULL && !PyTraceBack_Check(tb)) {
PyErr_SetString(PyExc_TypeError,
"raise: arg 3 must be a traceback or None");
goto raise_error;
}
/* Next, replace a missing value with None */
if (value == NULL) {
value = Py_None;
Py_INCREF(value);
}
#if PY_VERSION_HEX < 0x02050000
if (!PyClass_Check(type))
#else
if (!PyType_Check(type))
#endif
{
/* Raising an instance. The value should be a dummy. */
if (value != Py_None) {
PyErr_SetString(PyExc_TypeError,
"instance exception may not have a separate value");
goto raise_error;
}
/* Normalize to raise <class>, <instance> */
Py_DECREF(value);
value = type;
#if PY_VERSION_HEX < 0x02050000
if (PyInstance_Check(type)) {
type = (PyObject*) ((PyInstanceObject*)type)->in_class;
Py_INCREF(type);
}
else {
PyErr_SetString(PyExc_TypeError,
"raise: exception must be an old-style class or instance");
goto raise_error;
}
#else
type = (PyObject*) type->ob_type;
Py_INCREF(type);
if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
PyErr_SetString(PyExc_TypeError,
"raise: exception class must be a subclass of BaseException");
goto raise_error;
}
#endif
}
PyErr_Restore(type, value, tb);
return;
raise_error:
Py_XDECREF(value);
Py_XDECREF(type);
Py_XDECREF(tb);
return;
}
static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) {
PyObject *tmp_type, *tmp_value, *tmp_tb;
PyThreadState *tstate = PyThreadState_Get();
PyErr_Fetch(type, value, tb);
PyErr_NormalizeException(type, value, tb);
if (PyErr_Occurred())
goto bad;
Py_INCREF(*type);
Py_INCREF(*value);
Py_INCREF(*tb);
tmp_type = tstate->exc_type;
tmp_value = tstate->exc_value;
tmp_tb = tstate->exc_traceback;
tstate->exc_type = *type;
tstate->exc_value = *value;
tstate->exc_traceback = *tb;
/* Make sure tstate is in a consistent state when we XDECREF
these objects (XDECREF may run arbitrary code). */
Py_XDECREF(tmp_type);
Py_XDECREF(tmp_value);
Py_XDECREF(tmp_tb);
return 0;
bad:
Py_XDECREF(*type);
Py_XDECREF(*value);
Py_XDECREF(*tb);
return -1;
}
static void __Pyx_WriteUnraisable(char *name) {
PyObject *old_exc, *old_val, *old_tb;
PyObject *ctx;
PyErr_Fetch(&old_exc, &old_val, &old_tb);
ctx = PyString_FromString(name);
PyErr_Restore(old_exc, old_val, old_tb);
if (!ctx)
ctx = Py_None;
PyErr_WriteUnraisable(ctx);
}
static int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
if (!type) {
PyErr_Format(PyExc_SystemError, "Missing type object");
return 0;
}
if (obj == Py_None || PyObject_TypeCheck(obj, type))
return 1;
PyErr_Format(PyExc_TypeError, "Cannot convert %s to %s",
obj->ob_type->tp_name, type->tp_name);
return 0;
}
static int __Pyx_InternStrings(__Pyx_InternTabEntry *t) {
while (t->p) {
*t->p = PyString_InternFromString(t->s);
if (!*t->p)
return -1;
++t;
}
return 0;
}
static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
while (t->p) {
if (t->is_unicode) {
*t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
} else {
*t->p = PyString_FromStringAndSize(t->s, t->n - 1);
}
if (!*t->p)
return -1;
++t;
}
return 0;
}
#ifndef __PYX_HAVE_RT_ImportType
#define __PYX_HAVE_RT_ImportType
static PyTypeObject *__Pyx_ImportType(char *module_name, char *class_name,
long size)
{
PyObject *py_module = 0;
PyObject *result = 0;
py_module = __Pyx_ImportModule(module_name);
if (!py_module)
goto bad;
result = PyObject_GetAttrString(py_module, class_name);
if (!result)
goto bad;
if (!PyType_Check(result)) {
PyErr_Format(PyExc_TypeError,
"%s.%s is not a type object",
module_name, class_name);
goto bad;
}
if (((PyTypeObject *)result)->tp_basicsize != size) {
PyErr_Format(PyExc_ValueError,
"%s.%s does not appear to be the correct type object",
module_name, class_name);
goto bad;
}
return (PyTypeObject *)result;
bad:
Py_XDECREF(result);
return 0;
}
#endif
#ifndef __PYX_HAVE_RT_ImportModule
#define __PYX_HAVE_RT_ImportModule
static PyObject *__Pyx_ImportModule(char *name) {
PyObject *py_name = 0;
PyObject *py_module = 0;
py_name = PyString_FromString(name);
if (!py_name)
goto bad;
py_module = PyImport_Import(py_name);
Py_DECREF(py_name);
return py_module;
bad:
Py_XDECREF(py_name);
return 0;
}
#endif
#include "compile.h"
#include "frameobject.h"
#include "traceback.h"
static void __Pyx_AddTraceback(char *funcname) {
PyObject *py_srcfile = 0;
PyObject *py_funcname = 0;
PyObject *py_globals = 0;
PyObject *empty_tuple = 0;
PyObject *empty_string = 0;
PyCodeObject *py_code = 0;
PyFrameObject *py_frame = 0;
py_srcfile = PyString_FromString(__pyx_filename);
if (!py_srcfile) goto bad;
py_funcname = PyString_FromString(funcname);
if (!py_funcname) goto bad;
py_globals = PyModule_GetDict(__pyx_m);
if (!py_globals) goto bad;
empty_tuple = PyTuple_New(0);
if (!empty_tuple) goto bad;
empty_string = PyString_FromString("");
if (!empty_string) goto bad;
py_code = PyCode_New(
0, /*int argcount,*/
0, /*int nlocals,*/
0, /*int stacksize,*/
0, /*int flags,*/
empty_string, /*PyObject *code,*/
empty_tuple, /*PyObject *consts,*/
empty_tuple, /*PyObject *names,*/
empty_tuple, /*PyObject *varnames,*/
empty_tuple, /*PyObject *freevars,*/
empty_tuple, /*PyObject *cellvars,*/
py_srcfile, /*PyObject *filename,*/
py_funcname, /*PyObject *name,*/
__pyx_lineno, /*int firstlineno,*/
empty_string /*PyObject *lnotab*/
);
if (!py_code) goto bad;
py_frame = PyFrame_New(
PyThreadState_Get(), /*PyThreadState *tstate,*/
py_code, /*PyCodeObject *code,*/
py_globals, /*PyObject *globals,*/
0 /*PyObject *locals*/
);
if (!py_frame) goto bad;
py_frame->f_lineno = __pyx_lineno;
PyTraceBack_Here(py_frame);
bad:
Py_XDECREF(py_srcfile);
Py_XDECREF(py_funcname);
Py_XDECREF(empty_tuple);
Py_XDECREF(empty_string);
Py_XDECREF(py_code);
Py_XDECREF(py_frame);
}
static int __Pyx_RegisterCleanup() {
/* Don't use Py_AtExit because that has a 32-call limit
* and is called after python finalization.
*/
PyObject *cleanup_func = 0;
PyObject *atexit = 0;
PyObject *reg = 0;
PyObject *args = 0;
PyObject *res = 0;
int ret = -1;
cleanup_func = PyCFunction_New(&cleanup_def, 0);
args = PyTuple_New(1);
if (!cleanup_func || !args)
goto bad;
PyTuple_SET_ITEM(args, 0, cleanup_func);
cleanup_func = 0;
atexit = __Pyx_ImportModule("atexit");
if (!atexit)
goto bad;
reg = PyObject_GetAttrString(atexit, "register");
if (!reg)
goto bad;
res = PyObject_CallObject(reg, args);
if (!res)
goto bad;
ret = 0;
bad:
Py_XDECREF(cleanup_func);
Py_XDECREF(atexit);
Py_XDECREF(reg);
Py_XDECREF(args);
Py_XDECREF(res);
return ret;
}