/* Generated by Cython 0.10.3 on Wed Dec 17 15:57:37 2008 */
#define PY_SSIZE_T_CLEAN
#include "Python.h"
#include "structmember.h"
#ifndef PY_LONG_LONG
#define PY_LONG_LONG LONG_LONG
#endif
#ifndef DL_EXPORT
#define DL_EXPORT(t) t
#endif
#if PY_VERSION_HEX < 0x02040000
#define METH_COEXIST 0
#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
#if PY_VERSION_HEX < 0x02060000
#define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt)
#define Py_TYPE(ob) (((PyObject*)(ob))->ob_type)
#define Py_SIZE(ob) (((PyVarObject*)(ob))->ob_size)
#define PyVarObject_HEAD_INIT(type, size) \
PyObject_HEAD_INIT(type) size,
#define PyType_Modified(t)
typedef struct {
void *buf;
PyObject *obj;
Py_ssize_t len;
Py_ssize_t itemsize;
int readonly;
int ndim;
char *format;
Py_ssize_t *shape;
Py_ssize_t *strides;
Py_ssize_t *suboffsets;
void *internal;
} Py_buffer;
#define PyBUF_SIMPLE 0
#define PyBUF_WRITABLE 0x0001
#define PyBUF_LOCK 0x0002
#define PyBUF_FORMAT 0x0004
#define PyBUF_ND 0x0008
#define PyBUF_STRIDES (0x0010 | PyBUF_ND)
#define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES)
#define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES)
#define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES)
#define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES)
#endif
#if PY_MAJOR_VERSION < 3
#define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
#else
#define __Pyx_BUILTIN_MODULE_NAME "builtins"
#endif
#if PY_MAJOR_VERSION >= 3
#define Py_TPFLAGS_CHECKTYPES 0
#define Py_TPFLAGS_HAVE_INDEX 0
#endif
#if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3)
#define Py_TPFLAGS_HAVE_NEWBUFFER 0
#endif
#if PY_MAJOR_VERSION >= 3
#define PyBaseString_Type PyUnicode_Type
#define PyString_Type PyBytes_Type
#define PyInt_Type PyLong_Type
#define PyInt_Check(op) PyLong_Check(op)
#define PyInt_CheckExact(op) PyLong_CheckExact(op)
#define PyInt_FromString PyLong_FromString
#define PyInt_FromUnicode PyLong_FromUnicode
#define PyInt_FromLong PyLong_FromLong
#define PyInt_FromSize_t PyLong_FromSize_t
#define PyInt_FromSsize_t PyLong_FromSsize_t
#define PyInt_AsLong PyLong_AsLong
#define PyInt_AS_LONG PyLong_AS_LONG
#define PyInt_AsSsize_t PyLong_AsSsize_t
#define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask
#define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
#define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y)
#else
#define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y)
#define PyBytes_Type PyString_Type
#endif
#if PY_MAJOR_VERSION >= 3
#define PyMethod_New(func, self, klass) PyInstanceMethod_New(func)
#endif
#if !defined(WIN32) && !defined(MS_WINDOWS)
#ifndef __stdcall
#define __stdcall
#endif
#ifndef __cdecl
#define __cdecl
#endif
#else
#define _USE_MATH_DEFINES
#endif
#ifdef __cplusplus
#define __PYX_EXTERN_C extern "C"
#else
#define __PYX_EXTERN_C extern
#endif
#include <math.h>
#define __PYX_HAVE_API___geoslib
#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; long n; char is_unicode; char intern; char is_identifier;} __Pyx_StringTabEntry; /*proto*/
static int __pyx_skip_dispatch = 0;
/* Type Conversion Predeclarations */
#if PY_MAJOR_VERSION < 3
#define __Pyx_PyBytes_FromString PyString_FromString
#define __Pyx_PyBytes_AsString PyString_AsString
#else
#define __Pyx_PyBytes_FromString PyBytes_FromString
#define __Pyx_PyBytes_AsString PyBytes_AsString
#endif
#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);
static INLINE PY_LONG_LONG __pyx_PyInt_AsLongLong(PyObject* x);
static INLINE unsigned PY_LONG_LONG __pyx_PyInt_AsUnsignedLongLong(PyObject* x);
static INLINE Py_ssize_t __pyx_PyIndex_AsSsize_t(PyObject* b);
#define __pyx_PyInt_AsLong(x) (PyInt_CheckExact(x) ? PyInt_AS_LONG(x) : PyInt_AsLong(x))
#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
static INLINE unsigned char __pyx_PyInt_unsigned_char(PyObject* x);
static INLINE unsigned short __pyx_PyInt_unsigned_short(PyObject* x);
static INLINE char __pyx_PyInt_char(PyObject* x);
static INLINE short __pyx_PyInt_short(PyObject* x);
static INLINE int __pyx_PyInt_int(PyObject* x);
static INLINE long __pyx_PyInt_long(PyObject* x);
static INLINE signed char __pyx_PyInt_signed_char(PyObject* x);
static INLINE signed short __pyx_PyInt_signed_short(PyObject* x);
static INLINE signed int __pyx_PyInt_signed_int(PyObject* x);
static INLINE signed long __pyx_PyInt_signed_long(PyObject* x);
static INLINE long double __pyx_PyInt_long_double(PyObject* x);
#ifdef __GNUC__
/* Test for GCC > 2.95 */
#if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))
#define likely(x) __builtin_expect(!!(x), 1)
#define unlikely(x) __builtin_expect(!!(x), 0)
#else /* __GNUC__ > 2 ... */
#define likely(x) (x)
#define unlikely(x) (x)
#endif /* __GNUC__ > 2 ... */
#else /* __GNUC__ */
#define likely(x) (x)
#define unlikely(x) (x)
#endif /* __GNUC__ */
static PyObject *__pyx_m;
static PyObject *__pyx_b;
static PyObject *__pyx_empty_tuple;
static int __pyx_lineno;
static int __pyx_clineno = 0;
static const char * __pyx_cfilenm= __FILE__;
static const char *__pyx_filename;
static const char **__pyx_f;
static void __Pyx_RaiseDoubleKeywordsError(
const char* func_name, PyObject* kw_name); /*proto*/
static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/
static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name); /*proto*/
static INLINE PyObject *__Pyx_GetItemInt(PyObject *o, Py_ssize_t i, int is_unsigned) {
PyObject *r;
if (PyList_CheckExact(o) && 0 <= i && i < PyList_GET_SIZE(o)) {
r = PyList_GET_ITEM(o, i);
Py_INCREF(r);
}
else if (PyTuple_CheckExact(o) && 0 <= i && i < PyTuple_GET_SIZE(o)) {
r = PyTuple_GET_ITEM(o, i);
Py_INCREF(r);
}
else if (Py_TYPE(o)->tp_as_sequence && Py_TYPE(o)->tp_as_sequence->sq_item && (likely(i >= 0) || !is_unsigned))
r = PySequence_GetItem(o, i);
else {
PyObject *j = (likely(i >= 0) || !is_unsigned) ? PyInt_FromLong(i) : PyLong_FromUnsignedLongLong((sizeof(unsigned long long) > sizeof(Py_ssize_t) ? (1ULL << (sizeof(Py_ssize_t)*8)) : 0) + i);
if (!j)
return 0;
r = PyObject_GetItem(o, j);
Py_DECREF(j);
}
return r;
}
static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
const char *name, int exact); /*proto*/
static INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list); /*proto*/
static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
static INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
static INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
static INLINE PyObject* __Pyx_PyObject_Append(PyObject* L, PyObject* x) {
if (likely(PyList_CheckExact(L))) {
if (PyList_Append(L, x) < 0) return NULL;
Py_INCREF(Py_None);
return Py_None; // this is just to have an accurate signature
}
else {
return PyObject_CallMethod(L, "append", "(O)", x);
}
}
static int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/
static void __Pyx_WriteUnraisable(const char *name); /*proto*/
static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, long size); /*proto*/
static PyObject *__Pyx_ImportModule(const char *name); /*proto*/
static void __Pyx_AddTraceback(const char *funcname); /*proto*/
static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/
/* Type declarations */
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":131
* initGEOS(notice_h, error_h)
*
* cdef class BaseGeometry: # <<<<<<<<<<<<<<
* cdef GEOSGeom *_geom
* cdef unsigned int _npts
*/
struct __pyx_obj_8_geoslib_BaseGeometry {
PyObject_HEAD
GEOSGeom *_geom;
unsigned int _npts;
PyObject *boundary;
};
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":250
* return (self.__class__,(self.boundary,))
*
* cdef class Polygon(BaseGeometry): # <<<<<<<<<<<<<<
*
* def __init__(self, ndarray b):
*/
struct __pyx_obj_8_geoslib_Polygon {
struct __pyx_obj_8_geoslib_BaseGeometry __pyx_base;
};
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":306
* return area
*
* cdef class LineString(BaseGeometry): # <<<<<<<<<<<<<<
* def __init__(self, ndarray b):
* cdef double dx, dy
*/
struct __pyx_obj_8_geoslib_LineString {
struct __pyx_obj_8_geoslib_BaseGeometry __pyx_base;
};
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":338
* self.boundary = b
*
* cdef class Point(BaseGeometry): # <<<<<<<<<<<<<<
* cdef public x,y
* def __init__(self, b):
*/
struct __pyx_obj_8_geoslib_Point {
struct __pyx_obj_8_geoslib_BaseGeometry __pyx_base;
PyObject *x;
PyObject *y;
};
/* Module declarations from numpy */
/* Module declarations from _geoslib */
static PyTypeObject *__pyx_ptype_8_geoslib_ndarray = 0;
static PyTypeObject *__pyx_ptype_8_geoslib_BaseGeometry = 0;
static PyTypeObject *__pyx_ptype_8_geoslib_Polygon = 0;
static PyTypeObject *__pyx_ptype_8_geoslib_LineString = 0;
static PyTypeObject *__pyx_ptype_8_geoslib_Point = 0;
static void __pyx_f_8_geoslib_notice_h(char *, char *); /*proto*/
static void __pyx_f_8_geoslib_error_h(char *, char *); /*proto*/
static PyObject *__pyx_f_8_geoslib_geos_version(void); /*proto*/
static PyObject *__pyx_f_8_geoslib__get_coords(GEOSGeom *); /*proto*/
/* Implementation of _geoslib */
static char __pyx_k_1[] = "0.2";
static PyObject *__pyx_int_neg_1;
static PyObject *__pyx_int_0;
static PyObject *__pyx_int_1;
static PyObject *__pyx_int_2;
static char __pyx_k_is_valid[] = "is_valid";
static PyObject *__pyx_kp_is_valid;
static char __pyx_k_geom_type[] = "geom_type";
static PyObject *__pyx_kp_geom_type;
static char __pyx_k_within[] = "within";
static PyObject *__pyx_kp_within;
static char __pyx_k_simplify[] = "simplify";
static PyObject *__pyx_kp_simplify;
static char __pyx_k_intersects[] = "intersects";
static PyObject *__pyx_kp_intersects;
static char __pyx_k_intersection[] = "intersection";
static PyObject *__pyx_kp_intersection;
static char __pyx_k_get_coords[] = "get_coords";
static PyObject *__pyx_kp_get_coords;
static char __pyx_k___dealloc__[] = "__dealloc__";
static PyObject *__pyx_kp___dealloc__;
static char __pyx_k___reduce__[] = "__reduce__";
static PyObject *__pyx_kp___reduce__;
static char __pyx_k___init__[] = "__init__";
static PyObject *__pyx_kp___init__;
static char __pyx_k_area[] = "area";
static PyObject *__pyx_kp_area;
static char __pyx_k_geom[] = "geom";
static PyObject *__pyx_kp_geom;
static char __pyx_k_tol[] = "tol";
static PyObject *__pyx_kp_tol;
static char __pyx_k_b[] = "b";
static PyObject *__pyx_kp_b;
static char __pyx_k_sys[] = "sys";
static PyObject *__pyx_kp_sys;
static char __pyx_k_numpy[] = "numpy";
static PyObject *__pyx_kp_numpy;
static char __pyx_k___version__[] = "__version__";
static PyObject *__pyx_kp___version__;
static char __pyx_k___geos_version__[] = "__geos_version__";
static PyObject *__pyx_kp___geos_version__;
static char __pyx_k_2[] = "__geos_major_version__";
static PyObject *__pyx_kp_2;
static char __pyx_k_stdout[] = "stdout";
static PyObject *__pyx_kp_stdout;
static char __pyx_k_write[] = "write";
static PyObject *__pyx_kp_write;
static char __pyx_k_stderr[] = "stderr";
static PyObject *__pyx_kp_stderr;
static char __pyx_k_NotImplementedError[] = "NotImplementedError";
static PyObject *__pyx_kp_NotImplementedError;
static char __pyx_k_append[] = "append";
static PyObject *__pyx_kp_append;
static char __pyx_k___class__[] = "__class__";
static PyObject *__pyx_kp___class__;
static char __pyx_k_copy[] = "copy";
static PyObject *__pyx_kp_copy;
static char __pyx_k_shape[] = "shape";
static PyObject *__pyx_kp_shape;
static char __pyx_k_empty[] = "empty";
static PyObject *__pyx_kp_empty;
static char __pyx_k_7[] = "float64";
static PyObject *__pyx_kp_7;
static PyObject *__pyx_kp_1;
static PyObject *__pyx_builtin_NotImplementedError;
static PyObject *__pyx_kp_3;
static char __pyx_k_3[] = "GEOS_NOTICE: %s\n";
static PyObject *__pyx_kp_4;
static char __pyx_k_4[] = "GEOS_ERROR: %s\n";
static PyObject *__pyx_kp_5;
static char __pyx_k_5[] = "intersections of type '%s' not yet implemented";
static PyObject *__pyx_kp_6;
static char __pyx_k_6[] = "intersections of type '%s' not yet implemented";
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":102
* int GEOSCoordSeq_getSize(GEOSCoordSeq *s, unsigned int *size)
*
* cdef void notice_h(char *fmt, char*msg): # <<<<<<<<<<<<<<
* format = PyString_FromString(fmt)
* message = PyString_FromString(msg)
*/
static void __pyx_f_8_geoslib_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;
PyObject *__pyx_t_1 = NULL;
__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/src/_geoslib.pyx":103
*
* 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 = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
Py_DECREF(__pyx_v_format);
__pyx_v_format = __pyx_1;
__pyx_1 = 0;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":104
* 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 = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
Py_DECREF(__pyx_v_message);
__pyx_v_message = __pyx_1;
__pyx_1 = 0;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":105
* format = PyString_FromString(fmt)
* message = PyString_FromString(msg)
* try: # <<<<<<<<<<<<<<
* warn_msg = format % message
* except:
*/
{
PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb;
__Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb);
/*try:*/ {
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":106
* message = PyString_FromString(msg)
* try:
* warn_msg = format % message # <<<<<<<<<<<<<<
* except:
* warn_msg = format
*/
__pyx_t_1 = PyNumber_Remainder(__pyx_v_format, __pyx_v_message); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
Py_DECREF(__pyx_v_warn_msg);
__pyx_v_warn_msg = __pyx_t_1;
__pyx_t_1 = 0;
}
Py_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
Py_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0;
Py_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0;
goto __pyx_L8_try;
__pyx_L3_error:;
Py_XDECREF(__pyx_1); __pyx_1 = 0;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":107
* try:
* warn_msg = format % message
* except: # <<<<<<<<<<<<<<
* warn_msg = format
* sys.stdout.write('GEOS_NOTICE: %s\n' % warn_msg)
*/
/*except:*/ {
__Pyx_AddTraceback("_geoslib.notice_h");
if (__Pyx_GetException(&__pyx_1, &__pyx_2, &__pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":108
* warn_msg = format % message
* except:
* warn_msg = format # <<<<<<<<<<<<<<
* sys.stdout.write('GEOS_NOTICE: %s\n' % warn_msg)
*
*/
Py_INCREF(__pyx_v_format);
Py_DECREF(__pyx_v_warn_msg);
__pyx_v_warn_msg = __pyx_v_format;
Py_DECREF(__pyx_1); __pyx_1 = 0;
Py_DECREF(__pyx_2); __pyx_2 = 0;
Py_DECREF(__pyx_3); __pyx_3 = 0;
goto __pyx_L4_exception_handled;
}
__pyx_L5_except_error:;
Py_XDECREF(__pyx_save_exc_type);
Py_XDECREF(__pyx_save_exc_value);
Py_XDECREF(__pyx_save_exc_tb);
goto __pyx_L1_error;
__pyx_L4_exception_handled:;
__Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
__pyx_L8_try:;
}
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":109
* 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_kp_sys); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_kp_stdout); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
__pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_kp_write); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
__pyx_t_1 = PyNumber_Remainder(__pyx_kp_3, __pyx_v_warn_msg); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_1 = PyTuple_New(1); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
PyTuple_SET_ITEM(__pyx_1, 0, __pyx_t_1);
__pyx_t_1 = 0;
__pyx_2 = PyObject_Call(__pyx_3, ((PyObject *)__pyx_1), NULL); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
Py_DECREF(__pyx_3); __pyx_3 = 0;
Py_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 0;
Py_DECREF(__pyx_2); __pyx_2 = 0;
goto __pyx_L0;
__pyx_L1_error:;
Py_XDECREF(__pyx_1);
Py_XDECREF(__pyx_2);
Py_XDECREF(__pyx_3);
__Pyx_WriteUnraisable("_geoslib.notice_h");
__pyx_L0:;
Py_DECREF(__pyx_v_format);
Py_DECREF(__pyx_v_message);
Py_DECREF(__pyx_v_warn_msg);
}
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":111
* sys.stdout.write('GEOS_NOTICE: %s\n' % warn_msg)
*
* cdef void error_h(char *fmt, char*msg): # <<<<<<<<<<<<<<
* format = PyString_FromString(fmt)
* message = PyString_FromString(msg)
*/
static void __pyx_f_8_geoslib_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;
PyObject *__pyx_t_1 = NULL;
__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/src/_geoslib.pyx":112
*
* 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 = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
Py_DECREF(__pyx_v_format);
__pyx_v_format = __pyx_1;
__pyx_1 = 0;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":113
* 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 = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
Py_DECREF(__pyx_v_message);
__pyx_v_message = __pyx_1;
__pyx_1 = 0;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":114
* format = PyString_FromString(fmt)
* message = PyString_FromString(msg)
* try: # <<<<<<<<<<<<<<
* warn_msg = format % message
* except:
*/
{
PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb;
__Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb);
/*try:*/ {
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":115
* message = PyString_FromString(msg)
* try:
* warn_msg = format % message # <<<<<<<<<<<<<<
* except:
* warn_msg = format
*/
__pyx_t_1 = PyNumber_Remainder(__pyx_v_format, __pyx_v_message); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
Py_DECREF(__pyx_v_warn_msg);
__pyx_v_warn_msg = __pyx_t_1;
__pyx_t_1 = 0;
}
Py_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
Py_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0;
Py_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0;
goto __pyx_L8_try;
__pyx_L3_error:;
Py_XDECREF(__pyx_1); __pyx_1 = 0;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":116
* try:
* warn_msg = format % message
* except: # <<<<<<<<<<<<<<
* warn_msg = format
* sys.stderr.write('GEOS_ERROR: %s\n' % warn_msg)
*/
/*except:*/ {
__Pyx_AddTraceback("_geoslib.error_h");
if (__Pyx_GetException(&__pyx_1, &__pyx_2, &__pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":117
* warn_msg = format % message
* except:
* warn_msg = format # <<<<<<<<<<<<<<
* sys.stderr.write('GEOS_ERROR: %s\n' % warn_msg)
*
*/
Py_INCREF(__pyx_v_format);
Py_DECREF(__pyx_v_warn_msg);
__pyx_v_warn_msg = __pyx_v_format;
Py_DECREF(__pyx_1); __pyx_1 = 0;
Py_DECREF(__pyx_2); __pyx_2 = 0;
Py_DECREF(__pyx_3); __pyx_3 = 0;
goto __pyx_L4_exception_handled;
}
__pyx_L5_except_error:;
Py_XDECREF(__pyx_save_exc_type);
Py_XDECREF(__pyx_save_exc_value);
Py_XDECREF(__pyx_save_exc_tb);
goto __pyx_L1_error;
__pyx_L4_exception_handled:;
__Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
__pyx_L8_try:;
}
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":118
* except:
* warn_msg = format
* sys.stderr.write('GEOS_ERROR: %s\n' % warn_msg) # <<<<<<<<<<<<<<
*
* # check library version
*/
__pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_sys); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_kp_stderr); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
__pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_kp_write); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
__pyx_t_1 = PyNumber_Remainder(__pyx_kp_4, __pyx_v_warn_msg); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_1 = PyTuple_New(1); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
PyTuple_SET_ITEM(__pyx_1, 0, __pyx_t_1);
__pyx_t_1 = 0;
__pyx_2 = PyObject_Call(__pyx_3, ((PyObject *)__pyx_1), NULL); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
Py_DECREF(__pyx_3); __pyx_3 = 0;
Py_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 0;
Py_DECREF(__pyx_2); __pyx_2 = 0;
goto __pyx_L0;
__pyx_L1_error:;
Py_XDECREF(__pyx_1);
Py_XDECREF(__pyx_2);
Py_XDECREF(__pyx_3);
__Pyx_WriteUnraisable("_geoslib.error_h");
__pyx_L0:;
Py_DECREF(__pyx_v_format);
Py_DECREF(__pyx_v_message);
Py_DECREF(__pyx_v_warn_msg);
}
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":121
*
* # check library version
* cdef geos_version(): # <<<<<<<<<<<<<<
* return PyString_FromString(GEOSversion())
* __geos_version__ = geos_version() # module variable.
*/
static PyObject *__pyx_f_8_geoslib_geos_version(void) {
PyObject *__pyx_r;
PyObject *__pyx_1 = 0;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":122
* # check library version
* cdef geos_version():
* return PyString_FromString(GEOSversion()) # <<<<<<<<<<<<<<
* __geos_version__ = geos_version() # module variable.
* __geos_major_version__ = GEOS_VERSION_MAJOR
*/
__pyx_1 = PyString_FromString(GEOSversion()); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_r = __pyx_1;
__pyx_1 = 0;
goto __pyx_L0;
__pyx_r = Py_None; Py_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
Py_XDECREF(__pyx_1);
__Pyx_AddTraceback("_geoslib.geos_version");
__pyx_r = 0;
__pyx_L0:;
return __pyx_r;
}
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":136
* cdef public object boundary
*
* def is_valid(self): # <<<<<<<<<<<<<<
* cdef char valid
* valid = GEOSisValid(self._geom)
*/
static PyObject *__pyx_pf_8_geoslib_12BaseGeometry_is_valid(PyObject *__pyx_v_self, PyObject *unused); /*proto*/
static PyObject *__pyx_pf_8_geoslib_12BaseGeometry_is_valid(PyObject *__pyx_v_self, PyObject *unused) {
char __pyx_v_valid;
PyObject *__pyx_r;
char __pyx_1;
PyObject *__pyx_2 = 0;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":138
* def is_valid(self):
* cdef char valid
* valid = GEOSisValid(self._geom) # <<<<<<<<<<<<<<
* if valid:
* return True
*/
__pyx_v_valid = GEOSisValid(((struct __pyx_obj_8_geoslib_BaseGeometry *)__pyx_v_self)->_geom);
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":139
* cdef char valid
* valid = GEOSisValid(self._geom)
* if valid: # <<<<<<<<<<<<<<
* return True
* else:
*/
__pyx_1 = __pyx_v_valid;
if (__pyx_1) {
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":140
* valid = GEOSisValid(self._geom)
* if valid:
* return True # <<<<<<<<<<<<<<
* else:
* return False
*/
__pyx_2 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_r = __pyx_2;
__pyx_2 = 0;
goto __pyx_L0;
goto __pyx_L5;
}
/*else*/ {
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":142
* return True
* else:
* return False # <<<<<<<<<<<<<<
*
* def geom_type(self):
*/
__pyx_2 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_r = __pyx_2;
__pyx_2 = 0;
goto __pyx_L0;
}
__pyx_L5:;
__pyx_r = Py_None; Py_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
Py_XDECREF(__pyx_2);
__Pyx_AddTraceback("_geoslib.BaseGeometry.is_valid");
__pyx_r = NULL;
__pyx_L0:;
return __pyx_r;
}
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":144
* return False
*
* def geom_type(self): # <<<<<<<<<<<<<<
* return PyString_FromString(GEOSGeomType(self._geom))
*
*/
static PyObject *__pyx_pf_8_geoslib_12BaseGeometry_geom_type(PyObject *__pyx_v_self, PyObject *unused); /*proto*/
static PyObject *__pyx_pf_8_geoslib_12BaseGeometry_geom_type(PyObject *__pyx_v_self, PyObject *unused) {
PyObject *__pyx_r;
PyObject *__pyx_1 = 0;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":145
*
* def geom_type(self):
* return PyString_FromString(GEOSGeomType(self._geom)) # <<<<<<<<<<<<<<
*
* def within(self, BaseGeometry geom):
*/
__pyx_1 = PyString_FromString(GEOSGeomType(((struct __pyx_obj_8_geoslib_BaseGeometry *)__pyx_v_self)->_geom)); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_r = __pyx_1;
__pyx_1 = 0;
goto __pyx_L0;
__pyx_r = Py_None; Py_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
Py_XDECREF(__pyx_1);
__Pyx_AddTraceback("_geoslib.BaseGeometry.geom_type");
__pyx_r = NULL;
__pyx_L0:;
return __pyx_r;
}
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":147
* return PyString_FromString(GEOSGeomType(self._geom))
*
* def within(self, BaseGeometry geom): # <<<<<<<<<<<<<<
* cdef GEOSGeom *g1, *g2
* cdef char answer
*/
static PyObject *__pyx_pf_8_geoslib_12BaseGeometry_within(PyObject *__pyx_v_self, PyObject *__pyx_v_geom); /*proto*/
static PyObject *__pyx_pf_8_geoslib_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;
PyObject *__pyx_2 = 0;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_geom), __pyx_ptype_8_geoslib_BaseGeometry, 1, "geom", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":150
* cdef GEOSGeom *g1, *g2
* cdef char answer
* g1 = self._geom # <<<<<<<<<<<<<<
* g2 = geom._geom
* answer = GEOSWithin(g1, g2)
*/
__pyx_v_g1 = ((struct __pyx_obj_8_geoslib_BaseGeometry *)__pyx_v_self)->_geom;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":151
* cdef char answer
* g1 = self._geom
* g2 = geom._geom # <<<<<<<<<<<<<<
* answer = GEOSWithin(g1, g2)
* if answer:
*/
__pyx_v_g2 = ((struct __pyx_obj_8_geoslib_BaseGeometry *)__pyx_v_geom)->_geom;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":152
* 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/src/_geoslib.pyx":153
* g2 = geom._geom
* answer = GEOSWithin(g1, g2)
* if answer: # <<<<<<<<<<<<<<
* return True
* else:
*/
__pyx_1 = __pyx_v_answer;
if (__pyx_1) {
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":154
* answer = GEOSWithin(g1, g2)
* if answer:
* return True # <<<<<<<<<<<<<<
* else:
* return False
*/
__pyx_2 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_r = __pyx_2;
__pyx_2 = 0;
goto __pyx_L0;
goto __pyx_L5;
}
/*else*/ {
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":156
* return True
* else:
* return False # <<<<<<<<<<<<<<
*
* def simplify(self, tol):
*/
__pyx_2 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_r = __pyx_2;
__pyx_2 = 0;
goto __pyx_L0;
}
__pyx_L5:;
__pyx_r = Py_None; Py_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
Py_XDECREF(__pyx_2);
__Pyx_AddTraceback("_geoslib.BaseGeometry.within");
__pyx_r = NULL;
__pyx_L0:;
return __pyx_r;
}
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":158
* return False
*
* def simplify(self, tol): # <<<<<<<<<<<<<<
* cdef GEOSGeom *g1, *g3, *gout
* cdef double tolerance
*/
static PyObject *__pyx_pf_8_geoslib_12BaseGeometry_simplify(PyObject *__pyx_v_self, PyObject *__pyx_v_tol); /*proto*/
static PyObject *__pyx_pf_8_geoslib_12BaseGeometry_simplify(PyObject *__pyx_v_self, PyObject *__pyx_v_tol) {
GEOSGeom *__pyx_v_g1;
GEOSGeom *__pyx_v_g3;
GEOSGeom *__pyx_v_gout;
double __pyx_v_tolerance;
int __pyx_v_numgeoms;
int __pyx_v_typeid;
PyObject *__pyx_v_b;
PyObject *__pyx_v_p;
PyObject *__pyx_v_type;
PyObject *__pyx_r;
int __pyx_1;
double __pyx_2;
PyObject *__pyx_3 = 0;
PyObject *__pyx_4 = 0;
PyObject *__pyx_t_1 = NULL;
__pyx_v_b = Py_None; Py_INCREF(Py_None);
__pyx_v_p = Py_None; Py_INCREF(Py_None);
__pyx_v_type = Py_None; Py_INCREF(Py_None);
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":162
* cdef double tolerance
* cdef int numgeoms, i, typeid
* if GEOS_VERSION_MAJOR > 2: # <<<<<<<<<<<<<<
* g1 = self._geom
* tolerance = tol
*/
__pyx_1 = (GEOS_VERSION_MAJOR > 2);
if (__pyx_1) {
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":163
* cdef int numgeoms, i, typeid
* if GEOS_VERSION_MAJOR > 2:
* g1 = self._geom # <<<<<<<<<<<<<<
* tolerance = tol
* g3 = GEOSSimplify(g1,tolerance)
*/
__pyx_v_g1 = ((struct __pyx_obj_8_geoslib_BaseGeometry *)__pyx_v_self)->_geom;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":164
* if GEOS_VERSION_MAJOR > 2:
* g1 = self._geom
* tolerance = tol # <<<<<<<<<<<<<<
* g3 = GEOSSimplify(g1,tolerance)
* typeid = GEOSGeomTypeId(g3)
*/
__pyx_2 = __pyx_PyFloat_AsDouble(__pyx_v_tol); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_tolerance = __pyx_2;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":165
* g1 = self._geom
* tolerance = tol
* g3 = GEOSSimplify(g1,tolerance) # <<<<<<<<<<<<<<
* typeid = GEOSGeomTypeId(g3)
* if typeid == GEOS_POLYGON:
*/
__pyx_v_g3 = GEOSSimplify(__pyx_v_g1, __pyx_v_tolerance);
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":166
* tolerance = tol
* g3 = GEOSSimplify(g1,tolerance)
* typeid = GEOSGeomTypeId(g3) # <<<<<<<<<<<<<<
* if typeid == GEOS_POLYGON:
* b = _get_coords(g3)
*/
__pyx_v_typeid = GEOSGeomTypeId(__pyx_v_g3);
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":167
* g3 = GEOSSimplify(g1,tolerance)
* typeid = GEOSGeomTypeId(g3)
* if typeid == GEOS_POLYGON: # <<<<<<<<<<<<<<
* b = _get_coords(g3)
* p = Polygon(b)
*/
switch (__pyx_v_typeid) {
case GEOS_POLYGON:
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":168
* typeid = GEOSGeomTypeId(g3)
* if typeid == GEOS_POLYGON:
* b = _get_coords(g3) # <<<<<<<<<<<<<<
* p = Polygon(b)
* elif typeid == GEOS_LINESTRING:
*/
__pyx_3 = __pyx_f_8_geoslib__get_coords(__pyx_v_g3); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
Py_DECREF(__pyx_v_b);
__pyx_v_b = __pyx_3;
__pyx_3 = 0;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":169
* if typeid == GEOS_POLYGON:
* b = _get_coords(g3)
* p = Polygon(b) # <<<<<<<<<<<<<<
* elif typeid == GEOS_LINESTRING:
* b = _get_coords(g3)
*/
__pyx_3 = PyTuple_New(1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
Py_INCREF(__pyx_v_b);
PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_b);
__pyx_4 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_8_geoslib_Polygon)), ((PyObject *)__pyx_3), NULL); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
Py_DECREF(((PyObject *)__pyx_3)); __pyx_3 = 0;
Py_DECREF(__pyx_v_p);
__pyx_v_p = __pyx_4;
__pyx_4 = 0;
break;
case GEOS_LINESTRING:
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":171
* p = Polygon(b)
* elif typeid == GEOS_LINESTRING:
* b = _get_coords(g3) # <<<<<<<<<<<<<<
* p = LineString(b)
* # for multi-geom structures, just return first one.
*/
__pyx_3 = __pyx_f_8_geoslib__get_coords(__pyx_v_g3); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
Py_DECREF(__pyx_v_b);
__pyx_v_b = __pyx_3;
__pyx_3 = 0;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":172
* elif typeid == GEOS_LINESTRING:
* b = _get_coords(g3)
* p = LineString(b) # <<<<<<<<<<<<<<
* # for multi-geom structures, just return first one.
* elif typeid == GEOS_MULTIPOLYGON:
*/
__pyx_4 = PyTuple_New(1); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
Py_INCREF(__pyx_v_b);
PyTuple_SET_ITEM(__pyx_4, 0, __pyx_v_b);
__pyx_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_8_geoslib_LineString)), ((PyObject *)__pyx_4), NULL); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
Py_DECREF(((PyObject *)__pyx_4)); __pyx_4 = 0;
Py_DECREF(__pyx_v_p);
__pyx_v_p = __pyx_3;
__pyx_3 = 0;
break;
case GEOS_MULTIPOLYGON:
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":175
* # for multi-geom structures, just return first one.
* elif typeid == GEOS_MULTIPOLYGON:
* numgeoms = GEOSGetNumGeometries(g3) # <<<<<<<<<<<<<<
* gout = GEOSGetGeometryN(g3, 0)
* b = _get_coords(gout)
*/
__pyx_v_numgeoms = GEOSGetNumGeometries(__pyx_v_g3);
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":176
* elif typeid == GEOS_MULTIPOLYGON:
* numgeoms = GEOSGetNumGeometries(g3)
* gout = GEOSGetGeometryN(g3, 0) # <<<<<<<<<<<<<<
* b = _get_coords(gout)
* p = Polygon(b)
*/
__pyx_v_gout = GEOSGetGeometryN(__pyx_v_g3, 0);
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":177
* numgeoms = GEOSGetNumGeometries(g3)
* gout = GEOSGetGeometryN(g3, 0)
* b = _get_coords(gout) # <<<<<<<<<<<<<<
* p = Polygon(b)
* elif typeid == GEOS_MULTILINESTRING:
*/
__pyx_4 = __pyx_f_8_geoslib__get_coords(__pyx_v_gout); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
Py_DECREF(__pyx_v_b);
__pyx_v_b = __pyx_4;
__pyx_4 = 0;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":178
* gout = GEOSGetGeometryN(g3, 0)
* b = _get_coords(gout)
* p = Polygon(b) # <<<<<<<<<<<<<<
* elif typeid == GEOS_MULTILINESTRING:
* numgeoms = GEOSGetNumGeometries(g3)
*/
__pyx_3 = PyTuple_New(1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
Py_INCREF(__pyx_v_b);
PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_b);
__pyx_4 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_8_geoslib_Polygon)), ((PyObject *)__pyx_3), NULL); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
Py_DECREF(((PyObject *)__pyx_3)); __pyx_3 = 0;
Py_DECREF(__pyx_v_p);
__pyx_v_p = __pyx_4;
__pyx_4 = 0;
break;
case GEOS_MULTILINESTRING:
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":180
* p = Polygon(b)
* elif typeid == GEOS_MULTILINESTRING:
* numgeoms = GEOSGetNumGeometries(g3) # <<<<<<<<<<<<<<
* gout = GEOSGetGeometryN(g3, 0)
* b = _get_coords(gout)
*/
__pyx_v_numgeoms = GEOSGetNumGeometries(__pyx_v_g3);
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":181
* elif typeid == GEOS_MULTILINESTRING:
* numgeoms = GEOSGetNumGeometries(g3)
* gout = GEOSGetGeometryN(g3, 0) # <<<<<<<<<<<<<<
* b = _get_coords(gout)
* p = LineString(b)
*/
__pyx_v_gout = GEOSGetGeometryN(__pyx_v_g3, 0);
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":182
* numgeoms = GEOSGetNumGeometries(g3)
* gout = GEOSGetGeometryN(g3, 0)
* b = _get_coords(gout) # <<<<<<<<<<<<<<
* p = LineString(b)
* else:
*/
__pyx_3 = __pyx_f_8_geoslib__get_coords(__pyx_v_gout); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
Py_DECREF(__pyx_v_b);
__pyx_v_b = __pyx_3;
__pyx_3 = 0;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":183
* gout = GEOSGetGeometryN(g3, 0)
* b = _get_coords(gout)
* p = LineString(b) # <<<<<<<<<<<<<<
* else:
* type = PyString_FromString(GEOSGeomType(g3))
*/
__pyx_4 = PyTuple_New(1); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
Py_INCREF(__pyx_v_b);
PyTuple_SET_ITEM(__pyx_4, 0, __pyx_v_b);
__pyx_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_8_geoslib_LineString)), ((PyObject *)__pyx_4), NULL); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
Py_DECREF(((PyObject *)__pyx_4)); __pyx_4 = 0;
Py_DECREF(__pyx_v_p);
__pyx_v_p = __pyx_3;
__pyx_3 = 0;
break;
default:
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":185
* p = LineString(b)
* else:
* type = PyString_FromString(GEOSGeomType(g3)) # <<<<<<<<<<<<<<
* raise NotImplementedError("intersections of type '%s' not yet implemented" % (type))
* GEOSGeom_destroy(g3)
*/
__pyx_4 = PyString_FromString(GEOSGeomType(__pyx_v_g3)); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
Py_DECREF(__pyx_v_type);
__pyx_v_type = __pyx_4;
__pyx_4 = 0;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":186
* else:
* type = PyString_FromString(GEOSGeomType(g3))
* raise NotImplementedError("intersections of type '%s' not yet implemented" % (type)) # <<<<<<<<<<<<<<
* GEOSGeom_destroy(g3)
* return p
*/
__pyx_t_1 = PyNumber_Remainder(__pyx_kp_5, __pyx_v_type); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_3 = PyTuple_New(1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
PyTuple_SET_ITEM(__pyx_3, 0, __pyx_t_1);
__pyx_t_1 = 0;
__pyx_4 = PyObject_Call(__pyx_builtin_NotImplementedError, ((PyObject *)__pyx_3), NULL); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
Py_DECREF(((PyObject *)__pyx_3)); __pyx_3 = 0;
__Pyx_Raise(__pyx_4, 0, 0);
Py_DECREF(__pyx_4); __pyx_4 = 0;
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
break;
}
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":187
* type = PyString_FromString(GEOSGeomType(g3))
* raise NotImplementedError("intersections of type '%s' not yet implemented" % (type))
* GEOSGeom_destroy(g3) # <<<<<<<<<<<<<<
* return p
*
*/
GEOSGeom_destroy(__pyx_v_g3);
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":188
* raise NotImplementedError("intersections of type '%s' not yet implemented" % (type))
* GEOSGeom_destroy(g3)
* return p # <<<<<<<<<<<<<<
*
* def intersects(self, BaseGeometry geom):
*/
Py_INCREF(__pyx_v_p);
__pyx_r = __pyx_v_p;
goto __pyx_L0;
goto __pyx_L5;
}
__pyx_L5:;
__pyx_r = Py_None; Py_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
Py_XDECREF(__pyx_3);
Py_XDECREF(__pyx_4);
__Pyx_AddTraceback("_geoslib.BaseGeometry.simplify");
__pyx_r = NULL;
__pyx_L0:;
Py_DECREF(__pyx_v_b);
Py_DECREF(__pyx_v_p);
Py_DECREF(__pyx_v_type);
return __pyx_r;
}
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":190
* return p
*
* def intersects(self, BaseGeometry geom): # <<<<<<<<<<<<<<
* cdef GEOSGeom *g1, *g2
* cdef char answer
*/
static PyObject *__pyx_pf_8_geoslib_12BaseGeometry_intersects(PyObject *__pyx_v_self, PyObject *__pyx_v_geom); /*proto*/
static PyObject *__pyx_pf_8_geoslib_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;
PyObject *__pyx_2 = 0;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_geom), __pyx_ptype_8_geoslib_BaseGeometry, 1, "geom", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":193
* cdef GEOSGeom *g1, *g2
* cdef char answer
* g1 = self._geom # <<<<<<<<<<<<<<
* g2 = geom._geom
* answer = GEOSIntersects(g1, g2)
*/
__pyx_v_g1 = ((struct __pyx_obj_8_geoslib_BaseGeometry *)__pyx_v_self)->_geom;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":194
* cdef char answer
* g1 = self._geom
* g2 = geom._geom # <<<<<<<<<<<<<<
* answer = GEOSIntersects(g1, g2)
* if answer:
*/
__pyx_v_g2 = ((struct __pyx_obj_8_geoslib_BaseGeometry *)__pyx_v_geom)->_geom;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":195
* 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/src/_geoslib.pyx":196
* g2 = geom._geom
* answer = GEOSIntersects(g1, g2)
* if answer: # <<<<<<<<<<<<<<
* return True
* else:
*/
__pyx_1 = __pyx_v_answer;
if (__pyx_1) {
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":197
* answer = GEOSIntersects(g1, g2)
* if answer:
* return True # <<<<<<<<<<<<<<
* else:
* return False
*/
__pyx_2 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_r = __pyx_2;
__pyx_2 = 0;
goto __pyx_L0;
goto __pyx_L5;
}
/*else*/ {
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":199
* return True
* else:
* return False # <<<<<<<<<<<<<<
*
* def intersection(self, BaseGeometry geom):
*/
__pyx_2 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_r = __pyx_2;
__pyx_2 = 0;
goto __pyx_L0;
}
__pyx_L5:;
__pyx_r = Py_None; Py_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
Py_XDECREF(__pyx_2);
__Pyx_AddTraceback("_geoslib.BaseGeometry.intersects");
__pyx_r = NULL;
__pyx_L0:;
return __pyx_r;
}
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":201
* return False
*
* def intersection(self, BaseGeometry geom): # <<<<<<<<<<<<<<
* cdef GEOSGeom *g1, *g2, *g3, *gout
* cdef char answer
*/
static PyObject *__pyx_pf_8_geoslib_12BaseGeometry_intersection(PyObject *__pyx_v_self, PyObject *__pyx_v_geom); /*proto*/
static PyObject *__pyx_pf_8_geoslib_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_t_1 = NULL;
__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_8_geoslib_BaseGeometry, 1, "geom", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":205
* cdef char answer
* cdef int numgeoms, i, typeid
* g1 = self._geom # <<<<<<<<<<<<<<
* g2 = geom._geom
* g3 = GEOSIntersection(g1, g2)
*/
__pyx_v_g1 = ((struct __pyx_obj_8_geoslib_BaseGeometry *)__pyx_v_self)->_geom;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":206
* cdef int numgeoms, i, typeid
* g1 = self._geom
* g2 = geom._geom # <<<<<<<<<<<<<<
* g3 = GEOSIntersection(g1, g2)
* typeid = GEOSGeomTypeId(g3)
*/
__pyx_v_g2 = ((struct __pyx_obj_8_geoslib_BaseGeometry *)__pyx_v_geom)->_geom;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":207
* 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/src/_geoslib.pyx":208
* 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/src/_geoslib.pyx":209
* g3 = GEOSIntersection(g1, g2)
* typeid = GEOSGeomTypeId(g3)
* if typeid == GEOS_POLYGON: # <<<<<<<<<<<<<<
* b = _get_coords(g3)
* p = Polygon(b)
*/
switch (__pyx_v_typeid) {
case GEOS_POLYGON:
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":210
* typeid = GEOSGeomTypeId(g3)
* if typeid == GEOS_POLYGON:
* b = _get_coords(g3) # <<<<<<<<<<<<<<
* p = Polygon(b)
* pout = [p]
*/
__pyx_2 = __pyx_f_8_geoslib__get_coords(__pyx_v_g3); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
Py_DECREF(__pyx_v_b);
__pyx_v_b = __pyx_2;
__pyx_2 = 0;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":211
* 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 = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
Py_INCREF(__pyx_v_b);
PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_b);
__pyx_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_8_geoslib_Polygon)), ((PyObject *)__pyx_2), NULL); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
Py_DECREF(((PyObject *)__pyx_2)); __pyx_2 = 0;
Py_DECREF(__pyx_v_p);
__pyx_v_p = __pyx_3;
__pyx_3 = 0;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":212
* 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 = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
Py_INCREF(__pyx_v_p);
PyList_SET_ITEM(__pyx_2, 0, __pyx_v_p);
Py_DECREF(__pyx_v_pout);
__pyx_v_pout = ((PyObject *)__pyx_2);
__pyx_2 = 0;
break;
case GEOS_LINESTRING:
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":214
* pout = [p]
* elif typeid == GEOS_LINESTRING:
* b = _get_coords(g3) # <<<<<<<<<<<<<<
* p = LineString(b)
* pout = [p]
*/
__pyx_3 = __pyx_f_8_geoslib__get_coords(__pyx_v_g3); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
Py_DECREF(__pyx_v_b);
__pyx_v_b = __pyx_3;
__pyx_3 = 0;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":215
* 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 = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
Py_INCREF(__pyx_v_b);
PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_b);
__pyx_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_8_geoslib_LineString)), ((PyObject *)__pyx_2), NULL); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
Py_DECREF(((PyObject *)__pyx_2)); __pyx_2 = 0;
Py_DECREF(__pyx_v_p);
__pyx_v_p = __pyx_3;
__pyx_3 = 0;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":216
* 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 = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
Py_INCREF(__pyx_v_p);
PyList_SET_ITEM(__pyx_2, 0, __pyx_v_p);
Py_DECREF(__pyx_v_pout);
__pyx_v_pout = ((PyObject *)__pyx_2);
__pyx_2 = 0;
break;
case GEOS_MULTIPOLYGON:
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":218
* 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/src/_geoslib.pyx":219
* 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 = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
Py_DECREF(__pyx_v_pout);
__pyx_v_pout = ((PyObject *)__pyx_3);
__pyx_3 = 0;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":220
* 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/src/_geoslib.pyx":221
* 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/src/_geoslib.pyx":222
* for i from 0 <= i < numgeoms:
* gout = GEOSGetGeometryN(g3, i)
* b = _get_coords(gout) # <<<<<<<<<<<<<<
* p = Polygon(b)
* pout.append(p)
*/
__pyx_2 = __pyx_f_8_geoslib__get_coords(__pyx_v_gout); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
Py_DECREF(__pyx_v_b);
__pyx_v_b = __pyx_2;
__pyx_2 = 0;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":223
* 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 = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
Py_INCREF(__pyx_v_b);
PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_b);
__pyx_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_8_geoslib_Polygon)), ((PyObject *)__pyx_3), NULL); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
Py_DECREF(((PyObject *)__pyx_3)); __pyx_3 = 0;
Py_DECREF(__pyx_v_p);
__pyx_v_p = __pyx_2;
__pyx_2 = 0;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":224
* b = _get_coords(gout)
* p = Polygon(b)
* pout.append(p) # <<<<<<<<<<<<<<
* elif typeid == GEOS_MULTILINESTRING:
* numgeoms = GEOSGetNumGeometries(g3)
*/
__pyx_3 = __Pyx_PyObject_Append(__pyx_v_pout, __pyx_v_p); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
Py_DECREF(__pyx_3); __pyx_3 = 0;
}
break;
case GEOS_MULTILINESTRING:
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":226
* 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/src/_geoslib.pyx":227
* elif typeid == GEOS_MULTILINESTRING:
* numgeoms = GEOSGetNumGeometries(g3)
* pout = [] # <<<<<<<<<<<<<<
* for i from 0 <= i < numgeoms:
* gout = GEOSGetGeometryN(g3, i)
*/
__pyx_2 = PyList_New(0); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
Py_DECREF(__pyx_v_pout);
__pyx_v_pout = ((PyObject *)__pyx_2);
__pyx_2 = 0;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":228
* 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/src/_geoslib.pyx":229
* 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/src/_geoslib.pyx":230
* for i from 0 <= i < numgeoms:
* gout = GEOSGetGeometryN(g3, i)
* b = _get_coords(gout) # <<<<<<<<<<<<<<
* p = LineString(b)
* pout.append(p)
*/
__pyx_3 = __pyx_f_8_geoslib__get_coords(__pyx_v_gout); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
Py_DECREF(__pyx_v_b);
__pyx_v_b = __pyx_3;
__pyx_3 = 0;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":231
* gout = GEOSGetGeometryN(g3, i)
* b = _get_coords(gout)
* p = LineString(b) # <<<<<<<<<<<<<<
* pout.append(p)
* else:
*/
__pyx_2 = PyTuple_New(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
Py_INCREF(__pyx_v_b);
PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_b);
__pyx_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_8_geoslib_LineString)), ((PyObject *)__pyx_2), NULL); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
Py_DECREF(((PyObject *)__pyx_2)); __pyx_2 = 0;
Py_DECREF(__pyx_v_p);
__pyx_v_p = __pyx_3;
__pyx_3 = 0;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":232
* b = _get_coords(gout)
* p = LineString(b)
* pout.append(p) # <<<<<<<<<<<<<<
* else:
* type = PyString_FromString(GEOSGeomType(g3))
*/
__pyx_2 = __Pyx_PyObject_Append(__pyx_v_pout, __pyx_v_p); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
}
break;
default:
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":234
* pout.append(p)
* else:
* type = PyString_FromString(GEOSGeomType(g3)) # <<<<<<<<<<<<<<
* raise NotImplementedError("intersections of type '%s' not yet implemented" % (type))
* GEOSGeom_destroy(g3)
*/
__pyx_3 = PyString_FromString(GEOSGeomType(__pyx_v_g3)); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
Py_DECREF(__pyx_v_type);
__pyx_v_type = __pyx_3;
__pyx_3 = 0;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":235
* else:
* type = PyString_FromString(GEOSGeomType(g3))
* raise NotImplementedError("intersections of type '%s' not yet implemented" % (type)) # <<<<<<<<<<<<<<
* GEOSGeom_destroy(g3)
* return pout
*/
__pyx_t_1 = PyNumber_Remainder(__pyx_kp_6, __pyx_v_type); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_2 = PyTuple_New(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
PyTuple_SET_ITEM(__pyx_2, 0, __pyx_t_1);
__pyx_t_1 = 0;
__pyx_3 = PyObject_Call(__pyx_builtin_NotImplementedError, ((PyObject *)__pyx_2), NULL); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
Py_DECREF(((PyObject *)__pyx_2)); __pyx_2 = 0;
__Pyx_Raise(__pyx_3, 0, 0);
Py_DECREF(__pyx_3); __pyx_3 = 0;
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
break;
}
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":236
* 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/src/_geoslib.pyx":237
* 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_error:;
Py_XDECREF(__pyx_2);
Py_XDECREF(__pyx_3);
__Pyx_AddTraceback("_geoslib.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);
return __pyx_r;
}
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":239
* return pout
*
* def get_coords(self): # <<<<<<<<<<<<<<
* return _get_coords(self._geom)
*
*/
static PyObject *__pyx_pf_8_geoslib_12BaseGeometry_get_coords(PyObject *__pyx_v_self, PyObject *unused); /*proto*/
static PyObject *__pyx_pf_8_geoslib_12BaseGeometry_get_coords(PyObject *__pyx_v_self, PyObject *unused) {
PyObject *__pyx_r;
PyObject *__pyx_1 = 0;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":240
*
* def get_coords(self):
* return _get_coords(self._geom) # <<<<<<<<<<<<<<
*
* def __dealloc__(self):
*/
__pyx_1 = __pyx_f_8_geoslib__get_coords(((struct __pyx_obj_8_geoslib_BaseGeometry *)__pyx_v_self)->_geom); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_r = __pyx_1;
__pyx_1 = 0;
goto __pyx_L0;
__pyx_r = Py_None; Py_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
Py_XDECREF(__pyx_1);
__Pyx_AddTraceback("_geoslib.BaseGeometry.get_coords");
__pyx_r = NULL;
__pyx_L0:;
return __pyx_r;
}
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":242
* return _get_coords(self._geom)
*
* def __dealloc__(self): # <<<<<<<<<<<<<<
* """destroy GEOS geometry"""
* GEOSGeom_destroy(self._geom)
*/
static void __pyx_pf_8_geoslib_12BaseGeometry___dealloc__(PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_8_geoslib_12BaseGeometry___dealloc__[] = "destroy GEOS geometry";
static void __pyx_pf_8_geoslib_12BaseGeometry___dealloc__(PyObject *__pyx_v_self) {
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":244
* def __dealloc__(self):
* """destroy GEOS geometry"""
* GEOSGeom_destroy(self._geom) # <<<<<<<<<<<<<<
*
* def __reduce__(self):
*/
GEOSGeom_destroy(((struct __pyx_obj_8_geoslib_BaseGeometry *)__pyx_v_self)->_geom);
}
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":246
* GEOSGeom_destroy(self._geom)
*
* def __reduce__(self): # <<<<<<<<<<<<<<
* """special method that allows geos instance to be pickled"""
* return (self.__class__,(self.boundary,))
*/
static PyObject *__pyx_pf_8_geoslib_12BaseGeometry___reduce__(PyObject *__pyx_v_self, PyObject *unused); /*proto*/
static char __pyx_doc_8_geoslib_12BaseGeometry___reduce__[] = "special method that allows geos instance to be pickled";
static PyObject *__pyx_pf_8_geoslib_12BaseGeometry___reduce__(PyObject *__pyx_v_self, PyObject *unused) {
PyObject *__pyx_r;
PyObject *__pyx_1 = 0;
PyObject *__pyx_2 = 0;
PyObject *__pyx_3 = 0;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":248
* def __reduce__(self):
* """special method that allows geos instance to be pickled"""
* return (self.__class__,(self.boundary,)) # <<<<<<<<<<<<<<
*
* cdef class Polygon(BaseGeometry):
*/
__pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_kp___class__); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_2 = PyTuple_New(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
Py_INCREF(((struct __pyx_obj_8_geoslib_BaseGeometry *)__pyx_v_self)->boundary);
PyTuple_SET_ITEM(__pyx_2, 0, ((struct __pyx_obj_8_geoslib_BaseGeometry *)__pyx_v_self)->boundary);
__pyx_3 = PyTuple_New(2); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
PyTuple_SET_ITEM(__pyx_3, 0, __pyx_1);
PyTuple_SET_ITEM(__pyx_3, 1, ((PyObject *)__pyx_2));
__pyx_1 = 0;
__pyx_2 = 0;
__pyx_r = ((PyObject *)__pyx_3);
__pyx_3 = 0;
goto __pyx_L0;
__pyx_r = Py_None; Py_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
Py_XDECREF(__pyx_1);
Py_XDECREF(__pyx_2);
Py_XDECREF(__pyx_3);
__Pyx_AddTraceback("_geoslib.BaseGeometry.__reduce__");
__pyx_r = NULL;
__pyx_L0:;
return __pyx_r;
}
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":252
* cdef class Polygon(BaseGeometry):
*
* def __init__(self, ndarray b): # <<<<<<<<<<<<<<
* cdef unsigned int M, m, i
* cdef double dx, dy
*/
static int __pyx_pf_8_geoslib_7Polygon___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_8_geoslib_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;
unsigned int __pyx_4;
PyObject *__pyx_5 = 0;
int __pyx_6;
static PyObject **__pyx_pyargnames[] = {&__pyx_kp_b,0};
if (unlikely(__pyx_kwds)) {
PyObject* values[1] = {0};
Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
switch (PyTuple_GET_SIZE(__pyx_args)) {
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
switch (PyTuple_GET_SIZE(__pyx_args)) {
case 0:
values[0] = PyDict_GetItem(__pyx_kwds, __pyx_kp_b);
if (likely(values[0])) kw_args--;
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
__pyx_v_b = ((PyArrayObject *)values[0]);
} else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
goto __pyx_L5_argtuple_error;
} else {
__pyx_v_b = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0));
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("_geoslib.Polygon.__init__");
return -1;
__pyx_L4_argument_unpacking_done:;
Py_INCREF(__pyx_v_b);
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_b), __pyx_ptype_8_geoslib_ndarray, 1, "b", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":261
* # 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) {
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":262
* # if not, make a local copy.
* if not PyArray_ISCONTIGUOUS(b):
* b = b.copy() # <<<<<<<<<<<<<<
*
* m = b.shape[0]
*/
__pyx_2 = PyObject_GetAttr(((PyObject *)__pyx_v_b), __pyx_kp_copy); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_3 = PyObject_Call(__pyx_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
if (!(__Pyx_TypeTest(__pyx_3, __pyx_ptype_8_geoslib_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
Py_DECREF(((PyObject *)__pyx_v_b));
__pyx_v_b = ((PyArrayObject *)__pyx_3);
__pyx_3 = 0;
goto __pyx_L6;
}
__pyx_L6:;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":264
* b = b.copy()
*
* m = b.shape[0] # <<<<<<<<<<<<<<
*
* # Add closing coordinates to sequence?
*/
__pyx_2 = PyObject_GetAttr(((PyObject *)__pyx_v_b), __pyx_kp_shape); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_3 = __Pyx_GetItemInt(__pyx_2, 0, 0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
__pyx_4 = PyInt_AsUnsignedLongMask(__pyx_3); if (unlikely((__pyx_4 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
Py_DECREF(__pyx_3); __pyx_3 = 0;
__pyx_v_m = __pyx_4;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":267
*
* # Add closing coordinates to sequence?
* if b[-1,0] != b[0,0] or b[-1,1] != b[0,1]: # <<<<<<<<<<<<<<
* M = m + 1
* else:
*/
__pyx_2 = PyTuple_New(2); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
Py_INCREF(__pyx_int_neg_1);
PyTuple_SET_ITEM(__pyx_2, 0, __pyx_int_neg_1);
Py_INCREF(__pyx_int_0);
PyTuple_SET_ITEM(__pyx_2, 1, __pyx_int_0);
__pyx_3 = PyObject_GetItem(((PyObject *)__pyx_v_b), ((PyObject *)__pyx_2)); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
Py_DECREF(((PyObject *)__pyx_2)); __pyx_2 = 0;
__pyx_2 = PyTuple_New(2); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
Py_INCREF(__pyx_int_0);
PyTuple_SET_ITEM(__pyx_2, 0, __pyx_int_0);
Py_INCREF(__pyx_int_0);
PyTuple_SET_ITEM(__pyx_2, 1, __pyx_int_0);
__pyx_5 = PyObject_GetItem(((PyObject *)__pyx_v_b), ((PyObject *)__pyx_2)); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
Py_DECREF(((PyObject *)__pyx_2)); __pyx_2 = 0;
__pyx_2 = PyObject_RichCompare(__pyx_3, __pyx_5, Py_NE); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
Py_DECREF(__pyx_3); __pyx_3 = 0;
Py_DECREF(__pyx_5); __pyx_5 = 0;
__pyx_1 = __Pyx_PyObject_IsTrue(__pyx_2); if (unlikely(__pyx_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
if (!__pyx_1) {
__pyx_3 = PyTuple_New(2); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
Py_INCREF(__pyx_int_neg_1);
PyTuple_SET_ITEM(__pyx_3, 0, __pyx_int_neg_1);
Py_INCREF(__pyx_int_1);
PyTuple_SET_ITEM(__pyx_3, 1, __pyx_int_1);
__pyx_5 = PyObject_GetItem(((PyObject *)__pyx_v_b), ((PyObject *)__pyx_3)); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
Py_DECREF(((PyObject *)__pyx_3)); __pyx_3 = 0;
__pyx_2 = PyTuple_New(2); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
Py_INCREF(__pyx_int_0);
PyTuple_SET_ITEM(__pyx_2, 0, __pyx_int_0);
Py_INCREF(__pyx_int_1);
PyTuple_SET_ITEM(__pyx_2, 1, __pyx_int_1);
__pyx_3 = PyObject_GetItem(((PyObject *)__pyx_v_b), ((PyObject *)__pyx_2)); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
Py_DECREF(((PyObject *)__pyx_2)); __pyx_2 = 0;
__pyx_2 = PyObject_RichCompare(__pyx_5, __pyx_3, Py_NE); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
Py_DECREF(__pyx_5); __pyx_5 = 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 = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
}
if (__pyx_1) {
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":268
* # Add closing coordinates to sequence?
* if b[-1,0] != b[0,0] or b[-1,1] != b[0,1]:
* M = m + 1 # <<<<<<<<<<<<<<
* else:
* M = m
*/
__pyx_v_M = (__pyx_v_m + 1);
goto __pyx_L7;
}
/*else*/ {
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":270
* M = m + 1
* else:
* M = m # <<<<<<<<<<<<<<
* self._npts = M
*
*/
__pyx_v_M = __pyx_v_m;
}
__pyx_L7:;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":271
* else:
* M = m
* self._npts = M # <<<<<<<<<<<<<<
*
* # Create a coordinate sequence
*/
((struct __pyx_obj_8_geoslib_Polygon *)__pyx_v_self)->__pyx_base._npts = __pyx_v_M;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":274
*
* # 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/src/_geoslib.pyx":277
*
* # 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/src/_geoslib.pyx":278
* # 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/src/_geoslib.pyx":279
* 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/src/_geoslib.pyx":280
* 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/src/_geoslib.pyx":283
* # 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/src/_geoslib.pyx":284
* # 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/src/_geoslib.pyx":287
*
* # Add closing coordinates to sequence?
* if M > m: # <<<<<<<<<<<<<<
* dx = bbuffer[0]
* dy = bbuffer[1]
*/
__pyx_6 = (__pyx_v_M > __pyx_v_m);
if (__pyx_6) {
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":288
* # 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/src/_geoslib.pyx":289
* 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/src/_geoslib.pyx":290
* 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/src/_geoslib.pyx":291
* 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_L10;
}
__pyx_L10:;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":294
*
* # 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/src/_geoslib.pyx":297
*
* # create Polygon from LinearRing (assuming no holes)
* self._geom = GEOSGeom_createPolygon(lr,NULL,0) # <<<<<<<<<<<<<<
* self.boundary = b
*
*/
((struct __pyx_obj_8_geoslib_Polygon *)__pyx_v_self)->__pyx_base._geom = GEOSGeom_createPolygon(__pyx_v_lr, NULL, 0);
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":298
* # 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_8_geoslib_Polygon *)__pyx_v_self)->__pyx_base.boundary);
((struct __pyx_obj_8_geoslib_Polygon *)__pyx_v_self)->__pyx_base.boundary = ((PyObject *)__pyx_v_b);
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
Py_XDECREF(__pyx_2);
Py_XDECREF(__pyx_3);
Py_XDECREF(__pyx_5);
__Pyx_AddTraceback("_geoslib.Polygon.__init__");
__pyx_r = -1;
__pyx_L0:;
Py_DECREF(__pyx_v_b);
return __pyx_r;
}
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":301
*
*
* def area(self): # <<<<<<<<<<<<<<
* cdef double area
* GEOSArea(self._geom, &area)
*/
static PyObject *__pyx_pf_8_geoslib_7Polygon_area(PyObject *__pyx_v_self, PyObject *unused); /*proto*/
static PyObject *__pyx_pf_8_geoslib_7Polygon_area(PyObject *__pyx_v_self, PyObject *unused) {
double __pyx_v_area;
PyObject *__pyx_r;
PyObject *__pyx_1 = 0;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":303
* def area(self):
* cdef double area
* GEOSArea(self._geom, &area) # <<<<<<<<<<<<<<
* return area
*
*/
GEOSArea(((struct __pyx_obj_8_geoslib_Polygon *)__pyx_v_self)->__pyx_base._geom, (&__pyx_v_area));
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":304
* 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 = 304; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_r = __pyx_1;
__pyx_1 = 0;
goto __pyx_L0;
__pyx_r = Py_None; Py_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
Py_XDECREF(__pyx_1);
__Pyx_AddTraceback("_geoslib.Polygon.area");
__pyx_r = NULL;
__pyx_L0:;
return __pyx_r;
}
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":307
*
* cdef class LineString(BaseGeometry):
* def __init__(self, ndarray b): # <<<<<<<<<<<<<<
* cdef double dx, dy
* cdef GEOSCoordSeq *cs
*/
static int __pyx_pf_8_geoslib_10LineString___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_8_geoslib_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;
int __pyx_4;
static PyObject **__pyx_pyargnames[] = {&__pyx_kp_b,0};
if (unlikely(__pyx_kwds)) {
PyObject* values[1] = {0};
Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
switch (PyTuple_GET_SIZE(__pyx_args)) {
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
switch (PyTuple_GET_SIZE(__pyx_args)) {
case 0:
values[0] = PyDict_GetItem(__pyx_kwds, __pyx_kp_b);
if (likely(values[0])) kw_args--;
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 307; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
__pyx_v_b = ((PyArrayObject *)values[0]);
} else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
goto __pyx_L5_argtuple_error;
} else {
__pyx_v_b = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0));
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 307; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("_geoslib.LineString.__init__");
return -1;
__pyx_L4_argument_unpacking_done:;
Py_INCREF(__pyx_v_b);
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_b), __pyx_ptype_8_geoslib_ndarray, 1, "b", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 307; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":315
* # 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) {
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":316
* # if not, make a local copy.
* if not PyArray_ISCONTIGUOUS(b):
* b = b.copy() # <<<<<<<<<<<<<<
*
* M = b.shape[0]
*/
__pyx_2 = PyObject_GetAttr(((PyObject *)__pyx_v_b), __pyx_kp_copy); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_3 = PyObject_Call(__pyx_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
if (!(__Pyx_TypeTest(__pyx_3, __pyx_ptype_8_geoslib_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
Py_DECREF(((PyObject *)__pyx_v_b));
__pyx_v_b = ((PyArrayObject *)__pyx_3);
__pyx_3 = 0;
goto __pyx_L6;
}
__pyx_L6:;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":318
* b = b.copy()
*
* M = b.shape[0] # <<<<<<<<<<<<<<
* self._npts = M
*
*/
__pyx_2 = PyObject_GetAttr(((PyObject *)__pyx_v_b), __pyx_kp_shape); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_3 = __Pyx_GetItemInt(__pyx_2, 0, 0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
__pyx_4 = __pyx_PyInt_int(__pyx_3); if (unlikely((__pyx_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
Py_DECREF(__pyx_3); __pyx_3 = 0;
__pyx_v_M = __pyx_4;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":319
*
* M = b.shape[0]
* self._npts = M # <<<<<<<<<<<<<<
*
* # Create a coordinate sequence
*/
((struct __pyx_obj_8_geoslib_LineString *)__pyx_v_self)->__pyx_base._npts = __pyx_v_M;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":322
*
* # 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/src/_geoslib.pyx":325
*
* # 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/src/_geoslib.pyx":326
* # 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/src/_geoslib.pyx":327
* 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/src/_geoslib.pyx":328
* 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/src/_geoslib.pyx":331
* # 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/src/_geoslib.pyx":332
* # 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/src/_geoslib.pyx":335
*
* # create LineString
* self._geom = GEOSGeom_createLineString(cs) # <<<<<<<<<<<<<<
* self.boundary = b
*
*/
((struct __pyx_obj_8_geoslib_LineString *)__pyx_v_self)->__pyx_base._geom = GEOSGeom_createLineString(__pyx_v_cs);
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":336
* # 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_8_geoslib_LineString *)__pyx_v_self)->__pyx_base.boundary);
((struct __pyx_obj_8_geoslib_LineString *)__pyx_v_self)->__pyx_base.boundary = ((PyObject *)__pyx_v_b);
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
Py_XDECREF(__pyx_2);
Py_XDECREF(__pyx_3);
__Pyx_AddTraceback("_geoslib.LineString.__init__");
__pyx_r = -1;
__pyx_L0:;
Py_DECREF(__pyx_v_b);
return __pyx_r;
}
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":340
* cdef class Point(BaseGeometry):
* cdef public x,y
* def __init__(self, b): # <<<<<<<<<<<<<<
* cdef double dx, dy
* cdef GEOSCoordSeq *cs
*/
static int __pyx_pf_8_geoslib_5Point___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_8_geoslib_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;
double __pyx_2;
static PyObject **__pyx_pyargnames[] = {&__pyx_kp_b,0};
if (unlikely(__pyx_kwds)) {
PyObject* values[1] = {0};
Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
switch (PyTuple_GET_SIZE(__pyx_args)) {
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
switch (PyTuple_GET_SIZE(__pyx_args)) {
case 0:
values[0] = PyDict_GetItem(__pyx_kwds, __pyx_kp_b);
if (likely(values[0])) kw_args--;
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
__pyx_v_b = values[0];
} else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
goto __pyx_L5_argtuple_error;
} else {
__pyx_v_b = PyTuple_GET_ITEM(__pyx_args, 0);
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("_geoslib.Point.__init__");
return -1;
__pyx_L4_argument_unpacking_done:;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":344
* 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/src/_geoslib.pyx":345
* # 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)
*/
__pyx_1 = __Pyx_GetItemInt(__pyx_v_b, 0, 0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 345; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_2 = __pyx_PyFloat_AsDouble(__pyx_1); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 345; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
__pyx_v_dx = __pyx_2;
__pyx_1 = __Pyx_GetItemInt(__pyx_v_b, 1, 0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 345; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_2 = __pyx_PyFloat_AsDouble(__pyx_1); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 345; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
__pyx_v_dy = __pyx_2;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":346
* 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/src/_geoslib.pyx":347
* 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/src/_geoslib.pyx":348
* GEOSCoordSeq_setX(cs, 0, dx)
* GEOSCoordSeq_setY(cs, 0, dy)
* self._geom = GEOSGeom_createPoint(cs) # <<<<<<<<<<<<<<
* self._npts = 1
* self.boundary = b
*/
((struct __pyx_obj_8_geoslib_Point *)__pyx_v_self)->__pyx_base._geom = GEOSGeom_createPoint(__pyx_v_cs);
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":349
* GEOSCoordSeq_setY(cs, 0, dy)
* self._geom = GEOSGeom_createPoint(cs)
* self._npts = 1 # <<<<<<<<<<<<<<
* self.boundary = b
*
*/
((struct __pyx_obj_8_geoslib_Point *)__pyx_v_self)->__pyx_base._npts = 1;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":350
* 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_8_geoslib_Point *)__pyx_v_self)->__pyx_base.boundary);
((struct __pyx_obj_8_geoslib_Point *)__pyx_v_self)->__pyx_base.boundary = __pyx_v_b;
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
Py_XDECREF(__pyx_1);
__Pyx_AddTraceback("_geoslib.Point.__init__");
__pyx_r = -1;
__pyx_L0:;
return __pyx_r;
}
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":352
* self.boundary = b
*
* cdef _get_coords(GEOSGeom *geom): # <<<<<<<<<<<<<<
* cdef GEOSCoordSeq *cs
* cdef GEOSGeom *lr
*/
static PyObject *__pyx_f_8_geoslib__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/src/_geoslib.pyx":359
* 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/src/_geoslib.pyx":360
* 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/src/_geoslib.pyx":361
* 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_L3;
}
/*else*/ {
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":363
* cs = GEOSGeom_getCoordSeq(lr)
* else:
* cs = GEOSGeom_getCoordSeq(geom) # <<<<<<<<<<<<<<
* GEOSCoordSeq_getSize(cs, &M)
* b = numpy.empty((M,2), numpy.float64)
*/
__pyx_v_cs = GEOSGeom_getCoordSeq(__pyx_v_geom);
}
__pyx_L3:;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":364
* 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/src/_geoslib.pyx":365
* 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_kp_numpy); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_kp_empty); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
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 = 365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_4 = PyTuple_New(2); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
PyTuple_SET_ITEM(__pyx_4, 0, __pyx_2);
Py_INCREF(__pyx_int_2);
PyTuple_SET_ITEM(__pyx_4, 1, __pyx_int_2);
__pyx_2 = 0;
__pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_numpy); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_5 = PyObject_GetAttr(__pyx_2, __pyx_kp_7); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
__pyx_2 = PyTuple_New(2); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
PyTuple_SET_ITEM(__pyx_2, 0, ((PyObject *)__pyx_4));
PyTuple_SET_ITEM(__pyx_2, 1, __pyx_5);
__pyx_4 = 0;
__pyx_5 = 0;
__pyx_4 = PyObject_Call(__pyx_3, ((PyObject *)__pyx_2), NULL); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
Py_DECREF(__pyx_3); __pyx_3 = 0;
Py_DECREF(((PyObject *)__pyx_2)); __pyx_2 = 0;
if (!(__Pyx_TypeTest(__pyx_4, __pyx_ptype_8_geoslib_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
Py_DECREF(((PyObject *)__pyx_v_b));
__pyx_v_b = ((PyArrayObject *)__pyx_4);
__pyx_4 = 0;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":366
* 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/src/_geoslib.pyx":367
* 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/src/_geoslib.pyx":368
* 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/src/_geoslib.pyx":369
* 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/src/_geoslib.pyx":370
* 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/src/_geoslib.pyx":371
* 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/src/_geoslib.pyx":372
* 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_error:;
Py_XDECREF(__pyx_2);
Py_XDECREF(__pyx_3);
Py_XDECREF(__pyx_4);
Py_XDECREF(__pyx_5);
__Pyx_AddTraceback("_geoslib._get_coords");
__pyx_r = 0;
__pyx_L0:;
Py_DECREF(__pyx_v_b);
return __pyx_r;
}
static PyObject *__pyx_tp_new_8_geoslib_BaseGeometry(PyTypeObject *t, PyObject *a, PyObject *k) {
struct __pyx_obj_8_geoslib_BaseGeometry *p;
PyObject *o = (*t->tp_alloc)(t, 0);
if (!o) return 0;
p = ((struct __pyx_obj_8_geoslib_BaseGeometry *)o);
p->boundary = Py_None; Py_INCREF(Py_None);
return o;
}
static void __pyx_tp_dealloc_8_geoslib_BaseGeometry(PyObject *o) {
struct __pyx_obj_8_geoslib_BaseGeometry *p = (struct __pyx_obj_8_geoslib_BaseGeometry *)o;
{
PyObject *etype, *eval, *etb;
PyErr_Fetch(&etype, &eval, &etb);
++Py_REFCNT(o);
__pyx_pf_8_geoslib_12BaseGeometry___dealloc__(o);
if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
--Py_REFCNT(o);
PyErr_Restore(etype, eval, etb);
}
Py_XDECREF(p->boundary);
(*Py_TYPE(o)->tp_free)(o);
}
static int __pyx_tp_traverse_8_geoslib_BaseGeometry(PyObject *o, visitproc v, void *a) {
int e;
struct __pyx_obj_8_geoslib_BaseGeometry *p = (struct __pyx_obj_8_geoslib_BaseGeometry *)o;
if (p->boundary) {
e = (*v)(p->boundary, a); if (e) return e;
}
return 0;
}
static int __pyx_tp_clear_8_geoslib_BaseGeometry(PyObject *o) {
struct __pyx_obj_8_geoslib_BaseGeometry *p = (struct __pyx_obj_8_geoslib_BaseGeometry *)o;
PyObject* tmp;
tmp = ((PyObject*)p->boundary);
p->boundary = Py_None; Py_INCREF(Py_None);
Py_XDECREF(tmp);
return 0;
}
static struct PyMethodDef __pyx_methods_8_geoslib_BaseGeometry[] = {
{"is_valid", (PyCFunction)__pyx_pf_8_geoslib_12BaseGeometry_is_valid, METH_NOARGS, 0},
{"geom_type", (PyCFunction)__pyx_pf_8_geoslib_12BaseGeometry_geom_type, METH_NOARGS, 0},
{"within", (PyCFunction)__pyx_pf_8_geoslib_12BaseGeometry_within, METH_O, 0},
{"simplify", (PyCFunction)__pyx_pf_8_geoslib_12BaseGeometry_simplify, METH_O, 0},
{"intersects", (PyCFunction)__pyx_pf_8_geoslib_12BaseGeometry_intersects, METH_O, 0},
{"intersection", (PyCFunction)__pyx_pf_8_geoslib_12BaseGeometry_intersection, METH_O, 0},
{"get_coords", (PyCFunction)__pyx_pf_8_geoslib_12BaseGeometry_get_coords, METH_NOARGS, 0},
{"__reduce__", (PyCFunction)__pyx_pf_8_geoslib_12BaseGeometry___reduce__, METH_NOARGS, __pyx_doc_8_geoslib_12BaseGeometry___reduce__},
{0, 0, 0, 0}
};
static struct PyMemberDef __pyx_members_8_geoslib_BaseGeometry[] = {
{"boundary", T_OBJECT, offsetof(struct __pyx_obj_8_geoslib_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*/
#if PY_MAJOR_VERSION < 3
0, /*nb_divide*/
#endif
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*/
#if PY_MAJOR_VERSION < 3
0, /*nb_coerce*/
#endif
0, /*nb_int*/
0, /*nb_long*/
0, /*nb_float*/
#if PY_MAJOR_VERSION < 3
0, /*nb_oct*/
#endif
#if PY_MAJOR_VERSION < 3
0, /*nb_hex*/
#endif
0, /*nb_inplace_add*/
0, /*nb_inplace_subtract*/
0, /*nb_inplace_multiply*/
#if PY_MAJOR_VERSION < 3
0, /*nb_inplace_divide*/
#endif
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_MAJOR_VERSION >= 3) || (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 = {
#if PY_MAJOR_VERSION < 3
0, /*bf_getreadbuffer*/
#endif
#if PY_MAJOR_VERSION < 3
0, /*bf_getwritebuffer*/
#endif
#if PY_MAJOR_VERSION < 3
0, /*bf_getsegcount*/
#endif
#if PY_MAJOR_VERSION < 3
0, /*bf_getcharbuffer*/
#endif
#if PY_VERSION_HEX >= 0x02060000
0, /*bf_getbuffer*/
#endif
#if PY_VERSION_HEX >= 0x02060000
0, /*bf_releasebuffer*/
#endif
};
PyTypeObject __pyx_type_8_geoslib_BaseGeometry = {
PyVarObject_HEAD_INIT(0, 0)
"_geoslib.BaseGeometry", /*tp_name*/
sizeof(struct __pyx_obj_8_geoslib_BaseGeometry), /*tp_basicsize*/
0, /*tp_itemsize*/
__pyx_tp_dealloc_8_geoslib_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_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
0, /*tp_doc*/
__pyx_tp_traverse_8_geoslib_BaseGeometry, /*tp_traverse*/
__pyx_tp_clear_8_geoslib_BaseGeometry, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
__pyx_methods_8_geoslib_BaseGeometry, /*tp_methods*/
__pyx_members_8_geoslib_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_8_geoslib_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_8_geoslib_Polygon(PyTypeObject *t, PyObject *a, PyObject *k) {
PyObject *o = __pyx_tp_new_8_geoslib_BaseGeometry(t, a, k);
if (!o) return 0;
return o;
}
static struct PyMethodDef __pyx_methods_8_geoslib_Polygon[] = {
{"area", (PyCFunction)__pyx_pf_8_geoslib_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*/
#if PY_MAJOR_VERSION < 3
0, /*nb_divide*/
#endif
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*/
#if PY_MAJOR_VERSION < 3
0, /*nb_coerce*/
#endif
0, /*nb_int*/
0, /*nb_long*/
0, /*nb_float*/
#if PY_MAJOR_VERSION < 3
0, /*nb_oct*/
#endif
#if PY_MAJOR_VERSION < 3
0, /*nb_hex*/
#endif
0, /*nb_inplace_add*/
0, /*nb_inplace_subtract*/
0, /*nb_inplace_multiply*/
#if PY_MAJOR_VERSION < 3
0, /*nb_inplace_divide*/
#endif
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_MAJOR_VERSION >= 3) || (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 = {
#if PY_MAJOR_VERSION < 3
0, /*bf_getreadbuffer*/
#endif
#if PY_MAJOR_VERSION < 3
0, /*bf_getwritebuffer*/
#endif
#if PY_MAJOR_VERSION < 3
0, /*bf_getsegcount*/
#endif
#if PY_MAJOR_VERSION < 3
0, /*bf_getcharbuffer*/
#endif
#if PY_VERSION_HEX >= 0x02060000
0, /*bf_getbuffer*/
#endif
#if PY_VERSION_HEX >= 0x02060000
0, /*bf_releasebuffer*/
#endif
};
PyTypeObject __pyx_type_8_geoslib_Polygon = {
PyVarObject_HEAD_INIT(0, 0)
"_geoslib.Polygon", /*tp_name*/
sizeof(struct __pyx_obj_8_geoslib_Polygon), /*tp_basicsize*/
0, /*tp_itemsize*/
__pyx_tp_dealloc_8_geoslib_BaseGeometry, /*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_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
0, /*tp_doc*/
__pyx_tp_traverse_8_geoslib_BaseGeometry, /*tp_traverse*/
__pyx_tp_clear_8_geoslib_BaseGeometry, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
__pyx_methods_8_geoslib_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_8_geoslib_7Polygon___init__, /*tp_init*/
0, /*tp_alloc*/
__pyx_tp_new_8_geoslib_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_8_geoslib_LineString(PyTypeObject *t, PyObject *a, PyObject *k) {
PyObject *o = __pyx_tp_new_8_geoslib_BaseGeometry(t, a, k);
if (!o) return 0;
return o;
}
static struct PyMethodDef __pyx_methods_8_geoslib_LineString[] = {
{0, 0, 0, 0}
};
static PyNumberMethods __pyx_tp_as_number_LineString = {
0, /*nb_add*/
0, /*nb_subtract*/
0, /*nb_multiply*/
#if PY_MAJOR_VERSION < 3
0, /*nb_divide*/
#endif
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*/
#if PY_MAJOR_VERSION < 3
0, /*nb_coerce*/
#endif
0, /*nb_int*/
0, /*nb_long*/
0, /*nb_float*/
#if PY_MAJOR_VERSION < 3
0, /*nb_oct*/
#endif
#if PY_MAJOR_VERSION < 3
0, /*nb_hex*/
#endif
0, /*nb_inplace_add*/
0, /*nb_inplace_subtract*/
0, /*nb_inplace_multiply*/
#if PY_MAJOR_VERSION < 3
0, /*nb_inplace_divide*/
#endif
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_MAJOR_VERSION >= 3) || (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 = {
#if PY_MAJOR_VERSION < 3
0, /*bf_getreadbuffer*/
#endif
#if PY_MAJOR_VERSION < 3
0, /*bf_getwritebuffer*/
#endif
#if PY_MAJOR_VERSION < 3
0, /*bf_getsegcount*/
#endif
#if PY_MAJOR_VERSION < 3
0, /*bf_getcharbuffer*/
#endif
#if PY_VERSION_HEX >= 0x02060000
0, /*bf_getbuffer*/
#endif
#if PY_VERSION_HEX >= 0x02060000
0, /*bf_releasebuffer*/
#endif
};
PyTypeObject __pyx_type_8_geoslib_LineString = {
PyVarObject_HEAD_INIT(0, 0)
"_geoslib.LineString", /*tp_name*/
sizeof(struct __pyx_obj_8_geoslib_LineString), /*tp_basicsize*/
0, /*tp_itemsize*/
__pyx_tp_dealloc_8_geoslib_BaseGeometry, /*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_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
0, /*tp_doc*/
__pyx_tp_traverse_8_geoslib_BaseGeometry, /*tp_traverse*/
__pyx_tp_clear_8_geoslib_BaseGeometry, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
__pyx_methods_8_geoslib_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_8_geoslib_10LineString___init__, /*tp_init*/
0, /*tp_alloc*/
__pyx_tp_new_8_geoslib_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_8_geoslib_Point(PyTypeObject *t, PyObject *a, PyObject *k) {
struct __pyx_obj_8_geoslib_Point *p;
PyObject *o = __pyx_tp_new_8_geoslib_BaseGeometry(t, a, k);
if (!o) return 0;
p = ((struct __pyx_obj_8_geoslib_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_8_geoslib_Point(PyObject *o) {
struct __pyx_obj_8_geoslib_Point *p = (struct __pyx_obj_8_geoslib_Point *)o;
Py_XDECREF(p->x);
Py_XDECREF(p->y);
__pyx_tp_dealloc_8_geoslib_BaseGeometry(o);
}
static int __pyx_tp_traverse_8_geoslib_Point(PyObject *o, visitproc v, void *a) {
int e;
struct __pyx_obj_8_geoslib_Point *p = (struct __pyx_obj_8_geoslib_Point *)o;
e = __pyx_tp_traverse_8_geoslib_BaseGeometry(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_8_geoslib_Point(PyObject *o) {
struct __pyx_obj_8_geoslib_Point *p = (struct __pyx_obj_8_geoslib_Point *)o;
PyObject* tmp;
__pyx_tp_clear_8_geoslib_BaseGeometry(o);
tmp = ((PyObject*)p->x);
p->x = Py_None; Py_INCREF(Py_None);
Py_XDECREF(tmp);
tmp = ((PyObject*)p->y);
p->y = Py_None; Py_INCREF(Py_None);
Py_XDECREF(tmp);
return 0;
}
static struct PyMethodDef __pyx_methods_8_geoslib_Point[] = {
{0, 0, 0, 0}
};
static struct PyMemberDef __pyx_members_8_geoslib_Point[] = {
{"x", T_OBJECT, offsetof(struct __pyx_obj_8_geoslib_Point, x), 0, 0},
{"y", T_OBJECT, offsetof(struct __pyx_obj_8_geoslib_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*/
#if PY_MAJOR_VERSION < 3
0, /*nb_divide*/
#endif
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*/
#if PY_MAJOR_VERSION < 3
0, /*nb_coerce*/
#endif
0, /*nb_int*/
0, /*nb_long*/
0, /*nb_float*/
#if PY_MAJOR_VERSION < 3
0, /*nb_oct*/
#endif
#if PY_MAJOR_VERSION < 3
0, /*nb_hex*/
#endif
0, /*nb_inplace_add*/
0, /*nb_inplace_subtract*/
0, /*nb_inplace_multiply*/
#if PY_MAJOR_VERSION < 3
0, /*nb_inplace_divide*/
#endif
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_MAJOR_VERSION >= 3) || (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 = {
#if PY_MAJOR_VERSION < 3
0, /*bf_getreadbuffer*/
#endif
#if PY_MAJOR_VERSION < 3
0, /*bf_getwritebuffer*/
#endif
#if PY_MAJOR_VERSION < 3
0, /*bf_getsegcount*/
#endif
#if PY_MAJOR_VERSION < 3
0, /*bf_getcharbuffer*/
#endif
#if PY_VERSION_HEX >= 0x02060000
0, /*bf_getbuffer*/
#endif
#if PY_VERSION_HEX >= 0x02060000
0, /*bf_releasebuffer*/
#endif
};
PyTypeObject __pyx_type_8_geoslib_Point = {
PyVarObject_HEAD_INIT(0, 0)
"_geoslib.Point", /*tp_name*/
sizeof(struct __pyx_obj_8_geoslib_Point), /*tp_basicsize*/
0, /*tp_itemsize*/
__pyx_tp_dealloc_8_geoslib_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_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
0, /*tp_doc*/
__pyx_tp_traverse_8_geoslib_Point, /*tp_traverse*/
__pyx_tp_clear_8_geoslib_Point, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
__pyx_methods_8_geoslib_Point, /*tp_methods*/
__pyx_members_8_geoslib_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_8_geoslib_5Point___init__, /*tp_init*/
0, /*tp_alloc*/
__pyx_tp_new_8_geoslib_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*/
#if PY_MAJOR_VERSION >= 3
static struct PyModuleDef __pyx_moduledef = {
PyModuleDef_HEAD_INIT,
"_geoslib",
0, /* m_doc */
-1, /* m_size */
__pyx_methods /* m_methods */,
NULL, /* m_reload */
NULL, /* m_traverse */
NULL, /* m_clear */
NULL /* m_free */
};
#endif
static __Pyx_StringTabEntry __pyx_string_tab[] = {
{&__pyx_kp_is_valid, __pyx_k_is_valid, sizeof(__pyx_k_is_valid), 1, 1, 1},
{&__pyx_kp_geom_type, __pyx_k_geom_type, sizeof(__pyx_k_geom_type), 1, 1, 1},
{&__pyx_kp_within, __pyx_k_within, sizeof(__pyx_k_within), 1, 1, 1},
{&__pyx_kp_simplify, __pyx_k_simplify, sizeof(__pyx_k_simplify), 1, 1, 1},
{&__pyx_kp_intersects, __pyx_k_intersects, sizeof(__pyx_k_intersects), 1, 1, 1},
{&__pyx_kp_intersection, __pyx_k_intersection, sizeof(__pyx_k_intersection), 1, 1, 1},
{&__pyx_kp_get_coords, __pyx_k_get_coords, sizeof(__pyx_k_get_coords), 1, 1, 1},
{&__pyx_kp___dealloc__, __pyx_k___dealloc__, sizeof(__pyx_k___dealloc__), 1, 1, 1},
{&__pyx_kp___reduce__, __pyx_k___reduce__, sizeof(__pyx_k___reduce__), 1, 1, 1},
{&__pyx_kp___init__, __pyx_k___init__, sizeof(__pyx_k___init__), 1, 1, 1},
{&__pyx_kp_area, __pyx_k_area, sizeof(__pyx_k_area), 1, 1, 1},
{&__pyx_kp_geom, __pyx_k_geom, sizeof(__pyx_k_geom), 1, 1, 1},
{&__pyx_kp_tol, __pyx_k_tol, sizeof(__pyx_k_tol), 1, 1, 1},
{&__pyx_kp_b, __pyx_k_b, sizeof(__pyx_k_b), 1, 1, 1},
{&__pyx_kp_sys, __pyx_k_sys, sizeof(__pyx_k_sys), 1, 1, 1},
{&__pyx_kp_numpy, __pyx_k_numpy, sizeof(__pyx_k_numpy), 1, 1, 1},
{&__pyx_kp___version__, __pyx_k___version__, sizeof(__pyx_k___version__), 1, 1, 1},
{&__pyx_kp___geos_version__, __pyx_k___geos_version__, sizeof(__pyx_k___geos_version__), 1, 1, 1},
{&__pyx_kp_2, __pyx_k_2, sizeof(__pyx_k_2), 1, 1, 1},
{&__pyx_kp_stdout, __pyx_k_stdout, sizeof(__pyx_k_stdout), 1, 1, 1},
{&__pyx_kp_write, __pyx_k_write, sizeof(__pyx_k_write), 1, 1, 1},
{&__pyx_kp_stderr, __pyx_k_stderr, sizeof(__pyx_k_stderr), 1, 1, 1},
{&__pyx_kp_NotImplementedError, __pyx_k_NotImplementedError, sizeof(__pyx_k_NotImplementedError), 1, 1, 1},
{&__pyx_kp_append, __pyx_k_append, sizeof(__pyx_k_append), 1, 1, 1},
{&__pyx_kp___class__, __pyx_k___class__, sizeof(__pyx_k___class__), 1, 1, 1},
{&__pyx_kp_copy, __pyx_k_copy, sizeof(__pyx_k_copy), 1, 1, 1},
{&__pyx_kp_shape, __pyx_k_shape, sizeof(__pyx_k_shape), 1, 1, 1},
{&__pyx_kp_empty, __pyx_k_empty, sizeof(__pyx_k_empty), 1, 1, 1},
{&__pyx_kp_7, __pyx_k_7, sizeof(__pyx_k_7), 1, 1, 1},
{&__pyx_kp_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 0, 0},
{&__pyx_kp_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 0, 0},
{&__pyx_kp_4, __pyx_k_4, sizeof(__pyx_k_4), 0, 0, 0},
{&__pyx_kp_5, __pyx_k_5, sizeof(__pyx_k_5), 0, 0, 0},
{&__pyx_kp_6, __pyx_k_6, sizeof(__pyx_k_6), 0, 0, 0},
{0, 0, 0, 0, 0, 0}
};
static int __Pyx_InitCachedBuiltins(void) {
__pyx_builtin_NotImplementedError = __Pyx_GetName(__pyx_b, __pyx_kp_NotImplementedError); if (!__pyx_builtin_NotImplementedError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
return 0;
__pyx_L1_error:;
return -1;
}
static int __Pyx_InitGlobals(void) {
__pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
return 0;
__pyx_L1_error:;
return -1;
}
#if PY_MAJOR_VERSION < 3
PyMODINIT_FUNC init_geoslib(void); /*proto*/
PyMODINIT_FUNC init_geoslib(void)
#else
PyMODINIT_FUNC PyInit__geoslib(void); /*proto*/
PyMODINIT_FUNC PyInit__geoslib(void)
#endif
{
PyObject *__pyx_1 = 0;
__pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/*--- Library function declarations ---*/
__pyx_init_filenames();
/*--- Initialize various global constants etc. ---*/
if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/*--- Module creation code ---*/
#if PY_MAJOR_VERSION < 3
__pyx_m = Py_InitModule4("_geoslib", __pyx_methods, 0, 0, PYTHON_API_VERSION);
#else
__pyx_m = PyModule_Create(&__pyx_moduledef);
#endif
if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
#if PY_MAJOR_VERSION < 3
Py_INCREF(__pyx_m);
#endif
__pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME);
if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
/*--- Builtin init code ---*/
if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_skip_dispatch = 0;
/*--- Global init code ---*/
/*--- Function export code ---*/
/*--- Type init code ---*/
__pyx_ptype_8_geoslib_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject)); if (unlikely(!__pyx_ptype_8_geoslib_ndarray)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyType_Ready(&__pyx_type_8_geoslib_BaseGeometry) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "BaseGeometry", (PyObject *)&__pyx_type_8_geoslib_BaseGeometry) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_8_geoslib_BaseGeometry = &__pyx_type_8_geoslib_BaseGeometry;
__pyx_type_8_geoslib_Polygon.tp_base = __pyx_ptype_8_geoslib_BaseGeometry;
if (PyType_Ready(&__pyx_type_8_geoslib_Polygon) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Polygon", (PyObject *)&__pyx_type_8_geoslib_Polygon) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_8_geoslib_Polygon = &__pyx_type_8_geoslib_Polygon;
__pyx_type_8_geoslib_LineString.tp_base = __pyx_ptype_8_geoslib_BaseGeometry;
if (PyType_Ready(&__pyx_type_8_geoslib_LineString) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "LineString", (PyObject *)&__pyx_type_8_geoslib_LineString) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_8_geoslib_LineString = &__pyx_type_8_geoslib_LineString;
__pyx_type_8_geoslib_Point.tp_base = __pyx_ptype_8_geoslib_BaseGeometry;
if (PyType_Ready(&__pyx_type_8_geoslib_Point) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttrString(__pyx_m, "Point", (PyObject *)&__pyx_type_8_geoslib_Point) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_8_geoslib_Point = &__pyx_type_8_geoslib_Point;
/*--- Type import code ---*/
/*--- Function import code ---*/
/*--- Execution code ---*/
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":1
* import sys # <<<<<<<<<<<<<<
* import numpy
*
*/
__pyx_1 = __Pyx_Import(__pyx_kp_sys, 0); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttr(__pyx_m, __pyx_kp_sys, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":2
* import sys
* import numpy # <<<<<<<<<<<<<<
*
* __version__ = "0.2"
*/
__pyx_1 = __Pyx_Import(__pyx_kp_numpy, 0); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttr(__pyx_m, __pyx_kp_numpy, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":4
* import numpy
*
* __version__ = "0.2" # <<<<<<<<<<<<<<
*
* # need some python C API functions for strings.
*/
if (PyObject_SetAttr(__pyx_m, __pyx_kp___version__, __pyx_kp_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":26
*
* # Initialize numpy
* import_array() # <<<<<<<<<<<<<<
*
* # GENERAL NOTES:
*/
import_array();
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":123
* cdef geos_version():
* return PyString_FromString(GEOSversion())
* __geos_version__ = geos_version() # module variable. # <<<<<<<<<<<<<<
* __geos_major_version__ = GEOS_VERSION_MAJOR
* #if __geos_version__ != "2.2.3-CAPI-1.1.1":
*/
__pyx_1 = __pyx_f_8_geoslib_geos_version(); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttr(__pyx_m, __pyx_kp___geos_version__, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":124
* return PyString_FromString(GEOSversion())
* __geos_version__ = geos_version() # module variable.
* __geos_major_version__ = GEOS_VERSION_MAJOR # <<<<<<<<<<<<<<
* #if __geos_version__ != "2.2.3-CAPI-1.1.1":
* # raise ValueError('version 2.2.3 of the geos library is required')
*/
__pyx_1 = PyInt_FromLong(GEOS_VERSION_MAJOR); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (PyObject_SetAttr(__pyx_m, __pyx_kp_2, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":129
*
* # intialize GEOS (parameters are notice and error function callbacks).
* initGEOS(notice_h, error_h) # <<<<<<<<<<<<<<
*
* cdef class BaseGeometry:
*/
initGEOS(__pyx_f_8_geoslib_notice_h, __pyx_f_8_geoslib_error_h);
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":352
* self.boundary = b
*
* cdef _get_coords(GEOSGeom *geom): # <<<<<<<<<<<<<<
* cdef GEOSCoordSeq *cs
* cdef GEOSGeom *lr
*/
#if PY_MAJOR_VERSION < 3
return;
#else
return __pyx_m;
#endif
__pyx_L1_error:;
Py_XDECREF(__pyx_1);
__Pyx_AddTraceback("_geoslib");
#if PY_MAJOR_VERSION >= 3
return NULL;
#endif
}
static const char *__pyx_filenames[] = {
"_geoslib.pyx",
};
/* Runtime support code */
static void __pyx_init_filenames(void) {
__pyx_f = __pyx_filenames;
}
static void __Pyx_RaiseDoubleKeywordsError(
const char* func_name,
PyObject* kw_name)
{
PyErr_Format(PyExc_TypeError,
#if PY_MAJOR_VERSION >= 3
"%s() got multiple values for keyword argument '%U'", func_name, kw_name);
#else
"%s() got multiple values for keyword argument '%s'", func_name,
PyString_AS_STRING(kw_name));
#endif
}
static void __Pyx_RaiseArgtupleInvalid(
const char* func_name,
int exact,
Py_ssize_t num_min,
Py_ssize_t num_max,
Py_ssize_t num_found)
{
Py_ssize_t num_expected;
const char *number, *more_or_less;
if (num_found < num_min) {
num_expected = num_min;
more_or_less = "at least";
} else {
num_expected = num_max;
more_or_less = "at most";
}
if (exact) {
more_or_less = "exactly";
}
number = (num_expected == 1) ? "" : "s";
PyErr_Format(PyExc_TypeError,
#if PY_VERSION_HEX < 0x02050000
"%s() takes %s %d positional argument%s (%d given)",
#else
"%s() takes %s %zd positional argument%s (%zd given)",
#endif
func_name, more_or_less, num_expected, number, num_found);
}
static int __Pyx_ParseOptionalKeywords(
PyObject *kwds,
PyObject **argnames[],
PyObject *kwds2,
PyObject *values[],
Py_ssize_t num_pos_args,
const char* function_name)
{
PyObject *key = 0, *value = 0;
Py_ssize_t pos = 0;
PyObject*** name;
PyObject*** first_kw_arg = argnames + num_pos_args;
while (PyDict_Next(kwds, &pos, &key, &value)) {
#if PY_MAJOR_VERSION < 3
if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) {
#else
if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) {
#endif
goto invalid_keyword_type;
} else {
name = argnames;
while (*name && (**name != key)) name++;
if (*name) {
if (name < first_kw_arg) goto arg_passed_twice;
values[name-argnames] = value;
} else {
for (name = first_kw_arg; *name; name++) {
#if PY_MAJOR_VERSION >= 3
if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) &&
PyUnicode_Compare(**name, key) == 0) break;
#else
if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) &&
strcmp(PyString_AS_STRING(**name),
PyString_AS_STRING(key)) == 0) break;
#endif
}
if (*name) {
values[name-argnames] = value;
} else {
/* unexpected keyword found */
for (name=argnames; name != first_kw_arg; name++) {
if (**name == key) goto arg_passed_twice;
#if PY_MAJOR_VERSION >= 3
if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) &&
PyUnicode_Compare(**name, key) == 0) goto arg_passed_twice;
#else
if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) &&
strcmp(PyString_AS_STRING(**name),
PyString_AS_STRING(key)) == 0) goto arg_passed_twice;
#endif
}
if (kwds2) {
if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
} else {
goto invalid_keyword;
}
}
}
}
}
return 0;
arg_passed_twice:
__Pyx_RaiseDoubleKeywordsError(function_name, **name);
goto bad;
invalid_keyword_type:
PyErr_Format(PyExc_TypeError,
"%s() keywords must be strings", function_name);
goto bad;
invalid_keyword:
PyErr_Format(PyExc_TypeError,
#if PY_MAJOR_VERSION < 3
"%s() got an unexpected keyword argument '%s'",
function_name, PyString_AsString(key));
#else
"%s() got an unexpected keyword argument '%U'",
function_name, key);
#endif
bad:
return -1;
}
static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
const char *name, int exact)
{
if (!type) {
PyErr_Format(PyExc_SystemError, "Missing type object");
return 0;
}
if (none_allowed && obj == Py_None) return 1;
else if (exact) {
if (Py_TYPE(obj) == type) return 1;
}
else {
if (PyObject_TypeCheck(obj, type)) return 1;
}
PyErr_Format(PyExc_TypeError,
"Argument '%s' has incorrect type (expected %s, got %s)",
name, type->tp_name, Py_TYPE(obj)->tp_name);
return 0;
}
static INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb) {
PyThreadState *tstate = PyThreadState_GET();
*type = tstate->exc_type;
*value = tstate->exc_value;
*tb = tstate->exc_traceback;
Py_XINCREF(*type);
Py_XINCREF(*value);
Py_XINCREF(*tb);
}
static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb) {
PyObject *tmp_type, *tmp_value, *tmp_tb;
PyThreadState *tstate = PyThreadState_GET();
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;
Py_XDECREF(tmp_type);
Py_XDECREF(tmp_value);
Py_XDECREF(tmp_tb);
}
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 int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) {
PyObject *tmp_type, *tmp_value, *tmp_tb;
PyThreadState *tstate = PyThreadState_GET();
__Pyx_ErrFetch(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 INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) {
PyObject *tmp_type, *tmp_value, *tmp_tb;
PyThreadState *tstate = PyThreadState_GET();
tmp_type = tstate->curexc_type;
tmp_value = tstate->curexc_value;
tmp_tb = tstate->curexc_traceback;
tstate->curexc_type = type;
tstate->curexc_value = value;
tstate->curexc_traceback = tb;
Py_XDECREF(tmp_type);
Py_XDECREF(tmp_value);
Py_XDECREF(tmp_tb);
}
static INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) {
PyThreadState *tstate = PyThreadState_GET();
*type = tstate->curexc_type;
*value = tstate->curexc_value;
*tb = tstate->curexc_traceback;
tstate->curexc_type = 0;
tstate->curexc_value = 0;
tstate->curexc_traceback = 0;
}
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 {
type = 0;
PyErr_SetString(PyExc_TypeError,
"raise: exception must be an old-style class or instance");
goto raise_error;
}
#else
type = (PyObject*) Py_TYPE(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
}
__Pyx_ErrRestore(type, value, tb);
return;
raise_error:
Py_XDECREF(value);
Py_XDECREF(type);
Py_XDECREF(tb);
return;
}
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",
Py_TYPE(obj)->tp_name, type->tp_name);
return 0;
}
static void __Pyx_WriteUnraisable(const char *name) {
PyObject *old_exc, *old_val, *old_tb;
PyObject *ctx;
__Pyx_ErrFetch(&old_exc, &old_val, &old_tb);
#if PY_MAJOR_VERSION < 3
ctx = PyString_FromString(name);
#else
ctx = PyUnicode_FromString(name);
#endif
__Pyx_ErrRestore(old_exc, old_val, old_tb);
if (!ctx) {
PyErr_WriteUnraisable(Py_None);
} else {
PyErr_WriteUnraisable(ctx);
Py_DECREF(ctx);
}
}
#ifndef __PYX_HAVE_RT_ImportType
#define __PYX_HAVE_RT_ImportType
static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name,
long size)
{
PyObject *py_module = 0;
PyObject *result = 0;
PyObject *py_name = 0;
py_module = __Pyx_ImportModule(module_name);
if (!py_module)
goto bad;
#if PY_MAJOR_VERSION < 3
py_name = PyString_FromString(class_name);
#else
py_name = PyUnicode_FromString(class_name);
#endif
if (!py_name)
goto bad;
result = PyObject_GetAttr(py_module, py_name);
Py_DECREF(py_name);
py_name = 0;
Py_DECREF(py_module);
py_module = 0;
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(py_module);
Py_XDECREF(result);
return 0;
}
#endif
#ifndef __PYX_HAVE_RT_ImportModule
#define __PYX_HAVE_RT_ImportModule
static PyObject *__Pyx_ImportModule(const char *name) {
PyObject *py_name = 0;
PyObject *py_module = 0;
#if PY_MAJOR_VERSION < 3
py_name = PyString_FromString(name);
#else
py_name = PyUnicode_FromString(name);
#endif
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(const char *funcname) {
PyObject *py_srcfile = 0;
PyObject *py_funcname = 0;
PyObject *py_globals = 0;
PyObject *empty_string = 0;
PyCodeObject *py_code = 0;
PyFrameObject *py_frame = 0;
#if PY_MAJOR_VERSION < 3
py_srcfile = PyString_FromString(__pyx_filename);
#else
py_srcfile = PyUnicode_FromString(__pyx_filename);
#endif
if (!py_srcfile) goto bad;
if (__pyx_clineno) {
#if PY_MAJOR_VERSION < 3
py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno);
#else
py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno);
#endif
}
else {
#if PY_MAJOR_VERSION < 3
py_funcname = PyString_FromString(funcname);
#else
py_funcname = PyUnicode_FromString(funcname);
#endif
}
if (!py_funcname) goto bad;
py_globals = PyModule_GetDict(__pyx_m);
if (!py_globals) goto bad;
#if PY_MAJOR_VERSION < 3
empty_string = PyString_FromStringAndSize("", 0);
#else
empty_string = PyBytes_FromStringAndSize("", 0);
#endif
if (!empty_string) goto bad;
py_code = PyCode_New(
0, /*int argcount,*/
#if PY_MAJOR_VERSION >= 3
0, /*int kwonlyargcount,*/
#endif
0, /*int nlocals,*/
0, /*int stacksize,*/
0, /*int flags,*/
empty_string, /*PyObject *code,*/
__pyx_empty_tuple, /*PyObject *consts,*/
__pyx_empty_tuple, /*PyObject *names,*/
__pyx_empty_tuple, /*PyObject *varnames,*/
__pyx_empty_tuple, /*PyObject *freevars,*/
__pyx_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_string);
Py_XDECREF(py_code);
Py_XDECREF(py_frame);
}
static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
while (t->p) {
#if PY_MAJOR_VERSION < 3
if (t->is_unicode && (!t->is_identifier)) {
*t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
} else if (t->intern) {
*t->p = PyString_InternFromString(t->s);
} else {
*t->p = PyString_FromStringAndSize(t->s, t->n - 1);
}
#else /* Python 3+ has unicode identifiers */
if (t->is_identifier || (t->is_unicode && t->intern)) {
*t->p = PyUnicode_InternFromString(t->s);
} else if (t->is_unicode) {
*t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
} else {
*t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
}
#endif
if (!*t->p)
return -1;
++t;
}
return 0;
}
/* Type Conversion Functions */
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;
}
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 INLINE PY_LONG_LONG __pyx_PyInt_AsLongLong(PyObject* x) {
if (PyInt_CheckExact(x)) {
return PyInt_AS_LONG(x);
}
else if (PyLong_CheckExact(x)) {
return PyLong_AsLongLong(x);
}
else {
PY_LONG_LONG val;
PyObject* tmp = PyNumber_Int(x); if (!tmp) return (PY_LONG_LONG)-1;
val = __pyx_PyInt_AsLongLong(tmp);
Py_DECREF(tmp);
return val;
}
}
static INLINE unsigned PY_LONG_LONG __pyx_PyInt_AsUnsignedLongLong(PyObject* x) {
if (PyInt_CheckExact(x)) {
long val = PyInt_AS_LONG(x);
if (unlikely(val < 0)) {
PyErr_SetString(PyExc_TypeError, "Negative assignment to unsigned type.");
return (unsigned PY_LONG_LONG)-1;
}
return val;
}
else if (PyLong_CheckExact(x)) {
return PyLong_AsUnsignedLongLong(x);
}
else {
PY_LONG_LONG val;
PyObject* tmp = PyNumber_Int(x); if (!tmp) return (PY_LONG_LONG)-1;
val = __pyx_PyInt_AsUnsignedLongLong(tmp);
Py_DECREF(tmp);
return val;
}
}
static INLINE unsigned char __pyx_PyInt_unsigned_char(PyObject* x) {
if (sizeof(unsigned char) < sizeof(long)) {
long long_val = __pyx_PyInt_AsLong(x);
unsigned char val = (unsigned char)long_val;
if (unlikely((val != long_val) || (long_val < 0))) {
PyErr_SetString(PyExc_OverflowError, "value too large to convert to unsigned char");
return (unsigned char)-1;
}
return val;
}
else {
return __pyx_PyInt_AsLong(x);
}
}
static INLINE unsigned short __pyx_PyInt_unsigned_short(PyObject* x) {
if (sizeof(unsigned short) < sizeof(long)) {
long long_val = __pyx_PyInt_AsLong(x);
unsigned short val = (unsigned short)long_val;
if (unlikely((val != long_val) || (long_val < 0))) {
PyErr_SetString(PyExc_OverflowError, "value too large to convert to unsigned short");
return (unsigned short)-1;
}
return val;
}
else {
return __pyx_PyInt_AsLong(x);
}
}
static INLINE char __pyx_PyInt_char(PyObject* x) {
if (sizeof(char) < sizeof(long)) {
long long_val = __pyx_PyInt_AsLong(x);
char val = (char)long_val;
if (unlikely((val != long_val) )) {
PyErr_SetString(PyExc_OverflowError, "value too large to convert to char");
return (char)-1;
}
return val;
}
else {
return __pyx_PyInt_AsLong(x);
}
}
static INLINE short __pyx_PyInt_short(PyObject* x) {
if (sizeof(short) < sizeof(long)) {
long long_val = __pyx_PyInt_AsLong(x);
short val = (short)long_val;
if (unlikely((val != long_val) )) {
PyErr_SetString(PyExc_OverflowError, "value too large to convert to short");
return (short)-1;
}
return val;
}
else {
return __pyx_PyInt_AsLong(x);
}
}
static INLINE int __pyx_PyInt_int(PyObject* x) {
if (sizeof(int) < sizeof(long)) {
long long_val = __pyx_PyInt_AsLong(x);
int val = (int)long_val;
if (unlikely((val != long_val) )) {
PyErr_SetString(PyExc_OverflowError, "value too large to convert to int");
return (int)-1;
}
return val;
}
else {
return __pyx_PyInt_AsLong(x);
}
}
static INLINE long __pyx_PyInt_long(PyObject* x) {
if (sizeof(long) < sizeof(long)) {
long long_val = __pyx_PyInt_AsLong(x);
long val = (long)long_val;
if (unlikely((val != long_val) )) {
PyErr_SetString(PyExc_OverflowError, "value too large to convert to long");
return (long)-1;
}
return val;
}
else {
return __pyx_PyInt_AsLong(x);
}
}
static INLINE signed char __pyx_PyInt_signed_char(PyObject* x) {
if (sizeof(signed char) < sizeof(long)) {
long long_val = __pyx_PyInt_AsLong(x);
signed char val = (signed char)long_val;
if (unlikely((val != long_val) )) {
PyErr_SetString(PyExc_OverflowError, "value too large to convert to signed char");
return (signed char)-1;
}
return val;
}
else {
return __pyx_PyInt_AsLong(x);
}
}
static INLINE signed short __pyx_PyInt_signed_short(PyObject* x) {
if (sizeof(signed short) < sizeof(long)) {
long long_val = __pyx_PyInt_AsLong(x);
signed short val = (signed short)long_val;
if (unlikely((val != long_val) )) {
PyErr_SetString(PyExc_OverflowError, "value too large to convert to signed short");
return (signed short)-1;
}
return val;
}
else {
return __pyx_PyInt_AsLong(x);
}
}
static INLINE signed int __pyx_PyInt_signed_int(PyObject* x) {
if (sizeof(signed int) < sizeof(long)) {
long long_val = __pyx_PyInt_AsLong(x);
signed int val = (signed int)long_val;
if (unlikely((val != long_val) )) {
PyErr_SetString(PyExc_OverflowError, "value too large to convert to signed int");
return (signed int)-1;
}
return val;
}
else {
return __pyx_PyInt_AsLong(x);
}
}
static INLINE signed long __pyx_PyInt_signed_long(PyObject* x) {
if (sizeof(signed long) < sizeof(long)) {
long long_val = __pyx_PyInt_AsLong(x);
signed long val = (signed long)long_val;
if (unlikely((val != long_val) )) {
PyErr_SetString(PyExc_OverflowError, "value too large to convert to signed long");
return (signed long)-1;
}
return val;
}
else {
return __pyx_PyInt_AsLong(x);
}
}
static INLINE long double __pyx_PyInt_long_double(PyObject* x) {
if (sizeof(long double) < sizeof(long)) {
long long_val = __pyx_PyInt_AsLong(x);
long double val = (long double)long_val;
if (unlikely((val != long_val) )) {
PyErr_SetString(PyExc_OverflowError, "value too large to convert to long double");
return (long double)-1;
}
return val;
}
else {
return __pyx_PyInt_AsLong(x);
}
}