/* Generated by Cython 0.9.6.14 on Tue May 20 09:25:58 2008 */
#define PY_SSIZE_T_CLEAN
#include "Python.h"
#include "structmember.h"
#ifndef PY_LONG_LONG
#define PY_LONG_LONG LONG_LONG
#endif
#if PY_VERSION_HEX < 0x02050000
typedef int Py_ssize_t;
#define PY_SSIZE_T_MAX INT_MAX
#define PY_SSIZE_T_MIN INT_MIN
#define PyInt_FromSsize_t(z) PyInt_FromLong(z)
#define PyInt_AsSsize_t(o) PyInt_AsLong(o)
#define PyNumber_Index(o) PyNumber_Int(o)
#define PyIndex_Check(o) PyNumber_Check(o)
#endif
#if PY_VERSION_HEX < 0x02040000
#define METH_COEXIST 0
#endif
#ifndef __stdcall
#define __stdcall
#endif
#ifndef __cdecl
#define __cdecl
#endif
#ifdef __cplusplus
#define __PYX_EXTERN_C extern "C"
#else
#define __PYX_EXTERN_C extern
#endif
#include <math.h>
#include "numpy/arrayobject.h"
#include "geos_c.h"
#ifdef __GNUC__
#define INLINE __inline__
#elif _WIN32
#define INLINE __inline
#else
#define INLINE
#endif
typedef struct {PyObject **p; char *s;} __Pyx_InternTabEntry; /*proto*/
typedef struct {PyObject **p; char *s; long n; int is_unicode;} __Pyx_StringTabEntry; /*proto*/
static int __pyx_skip_dispatch = 0;
/* Type Conversion Predeclarations */
#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 char * __pyx_cfilenm= __FILE__;
static char *__pyx_filename;
static char **__pyx_f;
static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, char *name, int exact); /*proto*/
static INLINE void __Pyx_RaiseArgtupleTooLong(Py_ssize_t num_expected, Py_ssize_t num_found); /*proto*/
static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list); /*proto*/
static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
static void __Pyx_WriteUnraisable(char *name); /*proto*/
static 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 int __Pyx_InternStrings(__Pyx_InternTabEntry *t); /*proto*/
static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/
static PyTypeObject *__Pyx_ImportType(char *module_name, char *class_name, long size); /*proto*/
static PyObject *__Pyx_ImportModule(char *name); /*proto*/
static void __Pyx_AddTraceback(char *funcname); /*proto*/
/* Declarations */
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":127
* 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":214
* 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":270
* 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":302
* 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;
};
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_3[] = "0.1";
static char __pyx_k_4[] = "2.2.3-CAPI-1.1.1";
static char __pyx_k_5[] = "version 2.2.3 of the geos library is required";
static PyObject *__pyx_n_is_valid;
static PyObject *__pyx_n_geom_type;
static PyObject *__pyx_n_within;
static PyObject *__pyx_n_intersects;
static PyObject *__pyx_n_intersection;
static PyObject *__pyx_n_get_coords;
static PyObject *__pyx_n___dealloc__;
static PyObject *__pyx_n___reduce__;
static PyObject *__pyx_n___init__;
static PyObject *__pyx_n_area;
static PyObject *__pyx_n_sys;
static PyObject *__pyx_n_numpy;
static PyObject *__pyx_n___version__;
static PyObject *__pyx_n___geos_version__;
static PyObject *__pyx_n_ValueError;
static PyObject *__pyx_k_3p;
static PyObject *__pyx_k_4p;
static PyObject *__pyx_k_5p;
static PyObject *__pyx_builtin_ValueError;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":100
* 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 PyObject *__pyx_n_stdout;
static PyObject *__pyx_n_write;
static PyObject *__pyx_k_6p;
static char __pyx_k_6[] = "GEOS_NOTICE: %s\n";
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;
__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":101
*
* cdef void notice_h(char *fmt, char*msg):
* format = PyString_FromString(fmt) # <<<<<<<<<<<<<<
* message = PyString_FromString(msg)
* try:
*/
__pyx_1 = PyString_FromString(__pyx_v_fmt); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(__pyx_v_format);
__pyx_v_format = __pyx_1;
__pyx_1 = 0;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":102
* cdef void notice_h(char *fmt, char*msg):
* format = PyString_FromString(fmt)
* message = PyString_FromString(msg) # <<<<<<<<<<<<<<
* try:
* warn_msg = format % message
*/
__pyx_1 = PyString_FromString(__pyx_v_msg); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(__pyx_v_message);
__pyx_v_message = __pyx_1;
__pyx_1 = 0;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":103
* format = PyString_FromString(fmt)
* message = PyString_FromString(msg)
* try: # <<<<<<<<<<<<<<
* warn_msg = format % message
* except:
*/
/*try:*/ {
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":104
* message = PyString_FromString(msg)
* try:
* warn_msg = format % message # <<<<<<<<<<<<<<
* except:
* warn_msg = format
*/
__pyx_1 = PyNumber_Remainder(__pyx_v_format, __pyx_v_message); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L2;}
Py_DECREF(__pyx_v_warn_msg);
__pyx_v_warn_msg = __pyx_1;
__pyx_1 = 0;
}
goto __pyx_L3;
__pyx_L2:;
Py_XDECREF(__pyx_1); __pyx_1 = 0;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":105
* 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 = 105; __pyx_clineno = __LINE__; goto __pyx_L1;}
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":106
* 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_L3;
}
__pyx_L3:;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":107
* except:
* warn_msg = format
* sys.stdout.write('GEOS_NOTICE: %s\n' % warn_msg) # <<<<<<<<<<<<<<
*
* cdef void error_h(char *fmt, char*msg):
*/
__pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n_sys); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1;}
__pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_stdout); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
__pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_write); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
__pyx_1 = PyNumber_Remainder(__pyx_k_6p, __pyx_v_warn_msg); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1;}
__pyx_2 = PyTuple_New(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1;}
PyTuple_SET_ITEM(__pyx_2, 0, __pyx_1);
__pyx_1 = 0;
__pyx_1 = PyObject_Call(__pyx_3, ((PyObject *)__pyx_2), NULL); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(__pyx_3); __pyx_3 = 0;
Py_DECREF(((PyObject *)__pyx_2)); __pyx_2 = 0;
Py_DECREF(__pyx_1); __pyx_1 = 0;
goto __pyx_L0;
__pyx_L1:;
Py_XDECREF(__pyx_1);
Py_XDECREF(__pyx_2);
Py_XDECREF(__pyx_3);
__Pyx_WriteUnraisable("_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":109
* 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 PyObject *__pyx_n_stderr;
static PyObject *__pyx_k_7p;
static char __pyx_k_7[] = "GEOS_ERROR: %s\n";
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;
__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":110
*
* cdef void error_h(char *fmt, char*msg):
* format = PyString_FromString(fmt) # <<<<<<<<<<<<<<
* message = PyString_FromString(msg)
* try:
*/
__pyx_1 = PyString_FromString(__pyx_v_fmt); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(__pyx_v_format);
__pyx_v_format = __pyx_1;
__pyx_1 = 0;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":111
* cdef void error_h(char *fmt, char*msg):
* format = PyString_FromString(fmt)
* message = PyString_FromString(msg) # <<<<<<<<<<<<<<
* try:
* warn_msg = format % message
*/
__pyx_1 = PyString_FromString(__pyx_v_msg); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(__pyx_v_message);
__pyx_v_message = __pyx_1;
__pyx_1 = 0;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":112
* format = PyString_FromString(fmt)
* message = PyString_FromString(msg)
* try: # <<<<<<<<<<<<<<
* warn_msg = format % message
* except:
*/
/*try:*/ {
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":113
* message = PyString_FromString(msg)
* try:
* warn_msg = format % message # <<<<<<<<<<<<<<
* except:
* warn_msg = format
*/
__pyx_1 = PyNumber_Remainder(__pyx_v_format, __pyx_v_message); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L2;}
Py_DECREF(__pyx_v_warn_msg);
__pyx_v_warn_msg = __pyx_1;
__pyx_1 = 0;
}
goto __pyx_L3;
__pyx_L2:;
Py_XDECREF(__pyx_1); __pyx_1 = 0;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":114
* 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 = 114; __pyx_clineno = __LINE__; goto __pyx_L1;}
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":115
* 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_L3;
}
__pyx_L3:;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":116
* except:
* warn_msg = format
* sys.stderr.write('GEOS_ERROR: %s\n' % warn_msg) # <<<<<<<<<<<<<<
*
* # check library version
*/
__pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n_sys); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1;}
__pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_stderr); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
__pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_write); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
__pyx_1 = PyNumber_Remainder(__pyx_k_7p, __pyx_v_warn_msg); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1;}
__pyx_2 = PyTuple_New(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1;}
PyTuple_SET_ITEM(__pyx_2, 0, __pyx_1);
__pyx_1 = 0;
__pyx_1 = PyObject_Call(__pyx_3, ((PyObject *)__pyx_2), NULL); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(__pyx_3); __pyx_3 = 0;
Py_DECREF(((PyObject *)__pyx_2)); __pyx_2 = 0;
Py_DECREF(__pyx_1); __pyx_1 = 0;
goto __pyx_L0;
__pyx_L1:;
Py_XDECREF(__pyx_1);
Py_XDECREF(__pyx_2);
Py_XDECREF(__pyx_3);
__Pyx_WriteUnraisable("_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":119
*
* # 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":120
* # check library version
* cdef geos_version():
* return PyString_FromString(GEOSversion()) # <<<<<<<<<<<<<<
* __geos_version__ = geos_version() # module variable.
* if __geos_version__ != "2.2.3-CAPI-1.1.1":
*/
__pyx_1 = PyString_FromString(GEOSversion()); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1;}
__pyx_r = __pyx_1;
__pyx_1 = 0;
goto __pyx_L0;
__pyx_r = Py_None; Py_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1:;
Py_XDECREF(__pyx_1);
__Pyx_AddTraceback("_geoslib.geos_version");
__pyx_r = 0;
__pyx_L0:;
return __pyx_r;
}
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":132
* 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;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":134
* 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":135
* 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":136
* valid = GEOSisValid(self._geom)
* if valid:
* return True # <<<<<<<<<<<<<<
* else:
* return False
*/
Py_INCREF(Py_True);
__pyx_r = Py_True;
goto __pyx_L0;
goto __pyx_L4;
}
/*else*/ {
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":138
* return True
* else:
* return False # <<<<<<<<<<<<<<
*
* def geom_type(self):
*/
Py_INCREF(Py_False);
__pyx_r = Py_False;
goto __pyx_L0;
}
__pyx_L4:;
__pyx_r = Py_None; Py_INCREF(Py_None);
__pyx_L0:;
return __pyx_r;
}
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":140
* 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":141
*
* 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 = 141; __pyx_clineno = __LINE__; goto __pyx_L1;}
__pyx_r = __pyx_1;
__pyx_1 = 0;
goto __pyx_L0;
__pyx_r = Py_None; Py_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1:;
Py_XDECREF(__pyx_1);
__Pyx_AddTraceback("_geoslib.BaseGeometry.geom_type");
__pyx_r = NULL;
__pyx_L0:;
return __pyx_r;
}
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":143
* 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;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_geom), __pyx_ptype_8_geoslib_BaseGeometry, 1, "geom", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1;}
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":146
* cdef GEOSGeom *g1, *g2
* cdef char answer
* g1 = self._geom # <<<<<<<<<<<<<<
* g2 = geom._geom
* answer = GEOSWithin(g1, g2)
*/
__pyx_v_g1 = ((struct __pyx_obj_8_geoslib_BaseGeometry *)__pyx_v_self)->_geom;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":147
* 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":148
* g1 = self._geom
* g2 = geom._geom
* answer = GEOSWithin(g1, g2) # <<<<<<<<<<<<<<
* if answer:
* return True
*/
__pyx_v_answer = GEOSWithin(__pyx_v_g1, __pyx_v_g2);
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":149
* 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":150
* answer = GEOSWithin(g1, g2)
* if answer:
* return True # <<<<<<<<<<<<<<
* else:
* return False
*/
Py_INCREF(Py_True);
__pyx_r = Py_True;
goto __pyx_L0;
goto __pyx_L4;
}
/*else*/ {
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":152
* return True
* else:
* return False # <<<<<<<<<<<<<<
*
* def intersects(self, BaseGeometry geom):
*/
Py_INCREF(Py_False);
__pyx_r = Py_False;
goto __pyx_L0;
}
__pyx_L4:;
__pyx_r = Py_None; Py_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1:;
__Pyx_AddTraceback("_geoslib.BaseGeometry.within");
__pyx_r = NULL;
__pyx_L0:;
return __pyx_r;
}
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":154
* return False
*
* 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;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_geom), __pyx_ptype_8_geoslib_BaseGeometry, 1, "geom", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1;}
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":157
* cdef GEOSGeom *g1, *g2
* cdef char answer
* g1 = self._geom # <<<<<<<<<<<<<<
* g2 = geom._geom
* answer = GEOSIntersects(g1, g2)
*/
__pyx_v_g1 = ((struct __pyx_obj_8_geoslib_BaseGeometry *)__pyx_v_self)->_geom;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":158
* 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":159
* g1 = self._geom
* g2 = geom._geom
* answer = GEOSIntersects(g1, g2) # <<<<<<<<<<<<<<
* if answer:
* return True
*/
__pyx_v_answer = GEOSIntersects(__pyx_v_g1, __pyx_v_g2);
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":160
* 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":161
* answer = GEOSIntersects(g1, g2)
* if answer:
* return True # <<<<<<<<<<<<<<
* else:
* return False
*/
Py_INCREF(Py_True);
__pyx_r = Py_True;
goto __pyx_L0;
goto __pyx_L4;
}
/*else*/ {
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":163
* return True
* else:
* return False # <<<<<<<<<<<<<<
*
* def intersection(self, BaseGeometry geom):
*/
Py_INCREF(Py_False);
__pyx_r = Py_False;
goto __pyx_L0;
}
__pyx_L4:;
__pyx_r = Py_None; Py_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1:;
__Pyx_AddTraceback("_geoslib.BaseGeometry.intersects");
__pyx_r = NULL;
__pyx_L0:;
return __pyx_r;
}
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":165
* return False
*
* def intersection(self, BaseGeometry geom): # <<<<<<<<<<<<<<
* cdef GEOSGeom *g1, *g2, *g3, *gout
* cdef char answer
*/
static PyObject *__pyx_n_append;
static PyObject *__pyx_n_NotImplementedError;
static PyObject *__pyx_k_8p;
static PyObject *__pyx_builtin_NotImplementedError;
static char __pyx_k_8[] = "intersections of type '%s' not yet implemented";
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;
__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 = 165; __pyx_clineno = __LINE__; goto __pyx_L1;}
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":169
* cdef char answer
* cdef int numgeoms, i, typeid
* g1 = self._geom # <<<<<<<<<<<<<<
* g2 = geom._geom
* g3 = GEOSIntersection(g1, g2)
*/
__pyx_v_g1 = ((struct __pyx_obj_8_geoslib_BaseGeometry *)__pyx_v_self)->_geom;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":170
* cdef int numgeoms, i, typeid
* g1 = self._geom
* g2 = geom._geom # <<<<<<<<<<<<<<
* g3 = GEOSIntersection(g1, g2)
* typeid = GEOSGeomTypeId(g3)
*/
__pyx_v_g2 = ((struct __pyx_obj_8_geoslib_BaseGeometry *)__pyx_v_geom)->_geom;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":171
* g1 = self._geom
* g2 = geom._geom
* g3 = GEOSIntersection(g1, g2) # <<<<<<<<<<<<<<
* typeid = GEOSGeomTypeId(g3)
* if typeid == GEOS_POLYGON:
*/
__pyx_v_g3 = GEOSIntersection(__pyx_v_g1, __pyx_v_g2);
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":172
* g2 = geom._geom
* g3 = GEOSIntersection(g1, g2)
* typeid = GEOSGeomTypeId(g3) # <<<<<<<<<<<<<<
* if typeid == GEOS_POLYGON:
* b = _get_coords(g3)
*/
__pyx_v_typeid = GEOSGeomTypeId(__pyx_v_g3);
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":173
* g3 = GEOSIntersection(g1, g2)
* typeid = GEOSGeomTypeId(g3)
* if typeid == GEOS_POLYGON: # <<<<<<<<<<<<<<
* b = _get_coords(g3)
* p = Polygon(b)
*/
__pyx_1 = (__pyx_v_typeid == GEOS_POLYGON);
if (__pyx_1) {
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":174
* 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 = 174; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(__pyx_v_b);
__pyx_v_b = __pyx_2;
__pyx_2 = 0;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":175
* if typeid == GEOS_POLYGON:
* b = _get_coords(g3)
* p = Polygon(b) # <<<<<<<<<<<<<<
* pout = [p]
* elif typeid == GEOS_LINESTRING:
*/
__pyx_2 = PyTuple_New(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_INCREF(__pyx_v_b);
PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_b);
__pyx_3 = PyObject_Call(((PyObject*)__pyx_ptype_8_geoslib_Polygon), ((PyObject *)__pyx_2), NULL); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1;}
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":176
* b = _get_coords(g3)
* p = Polygon(b)
* pout = [p] # <<<<<<<<<<<<<<
* elif typeid == GEOS_LINESTRING:
* b = _get_coords(g3)
*/
__pyx_2 = PyList_New(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_INCREF(__pyx_v_p);
PyList_SET_ITEM(__pyx_2, 0, __pyx_v_p);
Py_DECREF(__pyx_v_pout);
__pyx_v_pout = ((PyObject *)__pyx_2);
__pyx_2 = 0;
goto __pyx_L4;
}
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":177
* p = Polygon(b)
* pout = [p]
* elif typeid == GEOS_LINESTRING: # <<<<<<<<<<<<<<
* b = _get_coords(g3)
* p = LineString(b)
*/
__pyx_1 = (__pyx_v_typeid == GEOS_LINESTRING);
if (__pyx_1) {
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":178
* 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 = 178; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(__pyx_v_b);
__pyx_v_b = __pyx_3;
__pyx_3 = 0;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":179
* elif typeid == GEOS_LINESTRING:
* b = _get_coords(g3)
* p = LineString(b) # <<<<<<<<<<<<<<
* pout = [p]
* elif typeid == GEOS_MULTIPOLYGON:
*/
__pyx_2 = PyTuple_New(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_INCREF(__pyx_v_b);
PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_b);
__pyx_3 = PyObject_Call(((PyObject*)__pyx_ptype_8_geoslib_LineString), ((PyObject *)__pyx_2), NULL); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1;}
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":180
* b = _get_coords(g3)
* p = LineString(b)
* pout = [p] # <<<<<<<<<<<<<<
* elif typeid == GEOS_MULTIPOLYGON:
* numgeoms = GEOSGetNumGeometries(g3)
*/
__pyx_2 = PyList_New(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_INCREF(__pyx_v_p);
PyList_SET_ITEM(__pyx_2, 0, __pyx_v_p);
Py_DECREF(__pyx_v_pout);
__pyx_v_pout = ((PyObject *)__pyx_2);
__pyx_2 = 0;
goto __pyx_L4;
}
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":181
* p = LineString(b)
* pout = [p]
* elif typeid == GEOS_MULTIPOLYGON: # <<<<<<<<<<<<<<
* numgeoms = GEOSGetNumGeometries(g3)
* pout = []
*/
__pyx_1 = (__pyx_v_typeid == GEOS_MULTIPOLYGON);
if (__pyx_1) {
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":182
* pout = [p]
* elif typeid == GEOS_MULTIPOLYGON:
* numgeoms = GEOSGetNumGeometries(g3) # <<<<<<<<<<<<<<
* pout = []
* for i from 0 <= i < numgeoms:
*/
__pyx_v_numgeoms = GEOSGetNumGeometries(__pyx_v_g3);
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":183
* elif typeid == GEOS_MULTIPOLYGON:
* numgeoms = GEOSGetNumGeometries(g3)
* pout = [] # <<<<<<<<<<<<<<
* for i from 0 <= i < numgeoms:
* gout = GEOSGetGeometryN(g3, i)
*/
__pyx_3 = PyList_New(0); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(__pyx_v_pout);
__pyx_v_pout = ((PyObject *)__pyx_3);
__pyx_3 = 0;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":184
* numgeoms = GEOSGetNumGeometries(g3)
* pout = []
* for i from 0 <= i < numgeoms: # <<<<<<<<<<<<<<
* gout = GEOSGetGeometryN(g3, i)
* b = _get_coords(gout)
*/
for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_numgeoms; __pyx_v_i++) {
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":185
* pout = []
* for i from 0 <= i < numgeoms:
* gout = GEOSGetGeometryN(g3, i) # <<<<<<<<<<<<<<
* b = _get_coords(gout)
* p = Polygon(b)
*/
__pyx_v_gout = GEOSGetGeometryN(__pyx_v_g3, __pyx_v_i);
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":186
* for i from 0 <= i < numgeoms:
* gout = GEOSGetGeometryN(g3, i)
* b = _get_coords(gout) # <<<<<<<<<<<<<<
* p = Polygon(b)
* pout.append(p)
*/
__pyx_2 = __pyx_f_8_geoslib__get_coords(__pyx_v_gout); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(__pyx_v_b);
__pyx_v_b = __pyx_2;
__pyx_2 = 0;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":187
* gout = GEOSGetGeometryN(g3, i)
* b = _get_coords(gout)
* p = Polygon(b) # <<<<<<<<<<<<<<
* pout.append(p)
* elif typeid == GEOS_MULTILINESTRING:
*/
__pyx_3 = PyTuple_New(1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_INCREF(__pyx_v_b);
PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_b);
__pyx_2 = PyObject_Call(((PyObject*)__pyx_ptype_8_geoslib_Polygon), ((PyObject *)__pyx_3), NULL); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1;}
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":188
* 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 = 188; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(__pyx_3); __pyx_3 = 0;
}
goto __pyx_L4;
}
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":189
* p = Polygon(b)
* pout.append(p)
* elif typeid == GEOS_MULTILINESTRING: # <<<<<<<<<<<<<<
* numgeoms = GEOSGetNumGeometries(g3)
* pout = []
*/
__pyx_1 = (__pyx_v_typeid == GEOS_MULTILINESTRING);
if (__pyx_1) {
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":190
* pout.append(p)
* elif typeid == GEOS_MULTILINESTRING:
* numgeoms = GEOSGetNumGeometries(g3) # <<<<<<<<<<<<<<
* pout = []
* for i from 0 <= i < numgeoms:
*/
__pyx_v_numgeoms = GEOSGetNumGeometries(__pyx_v_g3);
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":191
* 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 = 191; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(__pyx_v_pout);
__pyx_v_pout = ((PyObject *)__pyx_2);
__pyx_2 = 0;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":192
* numgeoms = GEOSGetNumGeometries(g3)
* pout = []
* for i from 0 <= i < numgeoms: # <<<<<<<<<<<<<<
* gout = GEOSGetGeometryN(g3, i)
* b = _get_coords(gout)
*/
for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_numgeoms; __pyx_v_i++) {
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":193
* pout = []
* for i from 0 <= i < numgeoms:
* gout = GEOSGetGeometryN(g3, i) # <<<<<<<<<<<<<<
* b = _get_coords(gout)
* p = LineString(b)
*/
__pyx_v_gout = GEOSGetGeometryN(__pyx_v_g3, __pyx_v_i);
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":194
* 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 = 194; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(__pyx_v_b);
__pyx_v_b = __pyx_3;
__pyx_3 = 0;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":195
* 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 = 195; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_INCREF(__pyx_v_b);
PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_b);
__pyx_3 = PyObject_Call(((PyObject*)__pyx_ptype_8_geoslib_LineString), ((PyObject *)__pyx_2), NULL); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1;}
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":196
* 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 = 196; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
}
goto __pyx_L4;
}
/*else*/ {
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":198
* pout.append(p)
* else:
* type = PyString_FromString(GEOSGeomType(g3)) # <<<<<<<<<<<<<<
* raise NotImplementedError("intersections of type '%s' not yet implemented" % (type))
* GEOSGeom_destroy(g3)
*/
__pyx_3 = PyString_FromString(GEOSGeomType(__pyx_v_g3)); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(__pyx_v_type);
__pyx_v_type = __pyx_3;
__pyx_3 = 0;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":199
* else:
* type = PyString_FromString(GEOSGeomType(g3))
* raise NotImplementedError("intersections of type '%s' not yet implemented" % (type)) # <<<<<<<<<<<<<<
* GEOSGeom_destroy(g3)
* return pout
*/
__pyx_2 = PyNumber_Remainder(__pyx_k_8p, __pyx_v_type); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1;}
__pyx_3 = PyTuple_New(1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1;}
PyTuple_SET_ITEM(__pyx_3, 0, __pyx_2);
__pyx_2 = 0;
__pyx_2 = PyObject_Call(__pyx_builtin_NotImplementedError, ((PyObject *)__pyx_3), NULL); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(((PyObject *)__pyx_3)); __pyx_3 = 0;
__Pyx_Raise(__pyx_2, 0, 0);
Py_DECREF(__pyx_2); __pyx_2 = 0;
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1;}
}
__pyx_L4:;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":200
* type = PyString_FromString(GEOSGeomType(g3))
* raise NotImplementedError("intersections of type '%s' not yet implemented" % (type))
* GEOSGeom_destroy(g3) # <<<<<<<<<<<<<<
* return pout
*
*/
GEOSGeom_destroy(__pyx_v_g3);
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":201
* raise NotImplementedError("intersections of type '%s' not yet implemented" % (type))
* GEOSGeom_destroy(g3)
* return pout # <<<<<<<<<<<<<<
*
* def get_coords(self):
*/
Py_INCREF(__pyx_v_pout);
__pyx_r = __pyx_v_pout;
goto __pyx_L0;
__pyx_r = Py_None; Py_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1:;
Py_XDECREF(__pyx_2);
Py_XDECREF(__pyx_3);
__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":203
* 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":204
*
* 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 = 204; __pyx_clineno = __LINE__; goto __pyx_L1;}
__pyx_r = __pyx_1;
__pyx_1 = 0;
goto __pyx_L0;
__pyx_r = Py_None; Py_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1:;
Py_XDECREF(__pyx_1);
__Pyx_AddTraceback("_geoslib.BaseGeometry.get_coords");
__pyx_r = NULL;
__pyx_L0:;
return __pyx_r;
}
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":206
* 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":208
* 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":210
* GEOSGeom_destroy(self._geom)
*
* def __reduce__(self): # <<<<<<<<<<<<<<
* """special method that allows geos instance to be pickled"""
* return (self.__class__,(self.boundary,))
*/
static PyObject *__pyx_n___class__;
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":212
* 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_n___class__); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1;}
__pyx_2 = PyTuple_New(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1;}
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 = 212; __pyx_clineno = __LINE__; goto __pyx_L1;}
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:;
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":216
* cdef class Polygon(BaseGeometry):
*
* def __init__(self, ndarray b): # <<<<<<<<<<<<<<
* cdef unsigned int M, m, i
* cdef double dx, dy
*/
static PyObject *__pyx_int_neg_1;
static PyObject *__pyx_int_0;
static PyObject *__pyx_int_1;
static PyObject *__pyx_n_copy;
static PyObject *__pyx_n_shape;
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;
PyObject *__pyx_4 = 0;
unsigned int __pyx_5;
PyObject *__pyx_6 = 0;
static char *__pyx_argnames[] = {"b",0};
if (likely(!__pyx_kwds) && likely(PyTuple_GET_SIZE(__pyx_args) == 1)) {
__pyx_v_b = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0));
}
else {
if (unlikely(!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O", __pyx_argnames, &__pyx_v_b))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L2;}
}
goto __pyx_L3;
__pyx_L2:;
__Pyx_AddTraceback("_geoslib.Polygon.__init__");
return -1;
__pyx_L3:;
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 = 216; __pyx_clineno = __LINE__; goto __pyx_L1;}
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":225
* # make sure data is contiguous.
* # if not, make a local copy.
* if not PyArray_ISCONTIGUOUS(b): # <<<<<<<<<<<<<<
* b = b.copy()
*
*/
__pyx_1 = (!PyArray_ISCONTIGUOUS(__pyx_v_b));
if (__pyx_1) {
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":226
* # if not, make a local copy.
* if not PyArray_ISCONTIGUOUS(b):
* b = b.copy() # <<<<<<<<<<<<<<
*
* m = b.shape[0]
*/
__pyx_2 = PyObject_GetAttr(((PyObject *)__pyx_v_b), __pyx_n_copy); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1;}
__pyx_3 = PyObject_Call(__pyx_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
if (!(__Pyx_TypeTest(__pyx_3, __pyx_ptype_8_geoslib_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(((PyObject *)__pyx_v_b));
__pyx_v_b = ((PyArrayObject *)__pyx_3);
__pyx_3 = 0;
goto __pyx_L4;
}
__pyx_L4:;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":228
* b = b.copy()
*
* m = b.shape[0] # <<<<<<<<<<<<<<
*
* # Add closing coordinates to sequence?
*/
__pyx_2 = PyObject_GetAttr(((PyObject *)__pyx_v_b), __pyx_n_shape); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1;}
if (PyList_CheckExact(__pyx_2) && 0 <= 0 && 0 < PyList_GET_SIZE(__pyx_2)) {
__pyx_4 = PyList_GET_ITEM(__pyx_2, 0); Py_INCREF(__pyx_4);
} else if (PyTuple_CheckExact(__pyx_2) && 0 <= 0 && 0 < PyTuple_GET_SIZE(__pyx_2)) {
__pyx_4 = PyTuple_GET_ITEM(__pyx_2, 0); Py_INCREF(__pyx_4);
} else {
__pyx_3 = PyInt_FromLong(0); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1;}
__pyx_4 = PyObject_GetItem(__pyx_2, __pyx_3); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(__pyx_3); __pyx_3 = 0;
}
Py_DECREF(__pyx_2); __pyx_2 = 0;
__pyx_5 = PyInt_AsUnsignedLongMask(__pyx_4); if (unlikely((__pyx_5 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(__pyx_4); __pyx_4 = 0;
__pyx_v_m = __pyx_5;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":231
*
* # Add closing coordinates to sequence?
* if b[-1,0] != b[0,0] or b[-1,1] != b[0,1]: # <<<<<<<<<<<<<<
* M = m + 1
* else:
*/
__pyx_3 = PyTuple_New(2); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_INCREF(__pyx_int_neg_1);
PyTuple_SET_ITEM(__pyx_3, 0, __pyx_int_neg_1);
Py_INCREF(__pyx_int_0);
PyTuple_SET_ITEM(__pyx_3, 1, __pyx_int_0);
__pyx_4 = PyObject_GetItem(((PyObject *)__pyx_v_b), ((PyObject *)__pyx_3)); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(((PyObject *)__pyx_3)); __pyx_3 = 0;
__pyx_3 = PyTuple_New(2); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_INCREF(__pyx_int_0);
PyTuple_SET_ITEM(__pyx_3, 0, __pyx_int_0);
Py_INCREF(__pyx_int_0);
PyTuple_SET_ITEM(__pyx_3, 1, __pyx_int_0);
__pyx_6 = PyObject_GetItem(((PyObject *)__pyx_v_b), ((PyObject *)__pyx_3)); if (unlikely(!__pyx_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(((PyObject *)__pyx_3)); __pyx_3 = 0;
__pyx_2 = PyObject_RichCompare(__pyx_4, __pyx_6, Py_NE); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(__pyx_4); __pyx_4 = 0;
Py_DECREF(__pyx_6); __pyx_6 = 0;
__pyx_1 = __Pyx_PyObject_IsTrue(__pyx_2); if (unlikely(__pyx_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1;}
if (!__pyx_1) {
Py_DECREF(__pyx_2); __pyx_2 = 0;
__pyx_3 = PyTuple_New(2); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1;}
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_4 = PyObject_GetItem(((PyObject *)__pyx_v_b), ((PyObject *)__pyx_3)); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(((PyObject *)__pyx_3)); __pyx_3 = 0;
__pyx_6 = PyTuple_New(2); if (unlikely(!__pyx_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_INCREF(__pyx_int_0);
PyTuple_SET_ITEM(__pyx_6, 0, __pyx_int_0);
Py_INCREF(__pyx_int_1);
PyTuple_SET_ITEM(__pyx_6, 1, __pyx_int_1);
__pyx_3 = PyObject_GetItem(((PyObject *)__pyx_v_b), ((PyObject *)__pyx_6)); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(((PyObject *)__pyx_6)); __pyx_6 = 0;
__pyx_2 = PyObject_RichCompare(__pyx_4, __pyx_3, Py_NE); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(__pyx_4); __pyx_4 = 0;
Py_DECREF(__pyx_3); __pyx_3 = 0;
}
__pyx_1 = __Pyx_PyObject_IsTrue(__pyx_2); if (unlikely(__pyx_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
if (__pyx_1) {
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":232
* # 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_L5;
}
/*else*/ {
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":234
* M = m + 1
* else:
* M = m # <<<<<<<<<<<<<<
* self._npts = M
*
*/
__pyx_v_M = __pyx_v_m;
}
__pyx_L5:;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":235
* 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":238
*
* # Create a coordinate sequence
* cs = GEOSCoordSeq_create(M, 2) # <<<<<<<<<<<<<<
*
* # add to coordinate sequence
*/
__pyx_v_cs = GEOSCoordSeq_create(__pyx_v_M, 2);
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":241
*
* # add to coordinate sequence
* bbuffer = <double *>b.data # <<<<<<<<<<<<<<
* for i from 0 <= i < m:
* dx = bbuffer[2*i]
*/
__pyx_v_bbuffer = ((double *)__pyx_v_b->data);
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":242
* # add to coordinate sequence
* bbuffer = <double *>b.data
* for i from 0 <= i < m: # <<<<<<<<<<<<<<
* dx = bbuffer[2*i]
* dy = bbuffer[2*i+1]
*/
for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_m; __pyx_v_i++) {
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":243
* bbuffer = <double *>b.data
* for i from 0 <= i < m:
* dx = bbuffer[2*i] # <<<<<<<<<<<<<<
* dy = bbuffer[2*i+1]
* # Because of a bug in the GEOS C API,
*/
__pyx_v_dx = (__pyx_v_bbuffer[(2 * __pyx_v_i)]);
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":244
* for i from 0 <= i < m:
* dx = bbuffer[2*i]
* dy = bbuffer[2*i+1] # <<<<<<<<<<<<<<
* # Because of a bug in the GEOS C API,
* # always set X before Y
*/
__pyx_v_dy = (__pyx_v_bbuffer[((2 * __pyx_v_i) + 1)]);
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":247
* # Because of a bug in the GEOS C API,
* # always set X before Y
* GEOSCoordSeq_setX(cs, i, dx) # <<<<<<<<<<<<<<
* GEOSCoordSeq_setY(cs, i, dy)
*
*/
GEOSCoordSeq_setX(__pyx_v_cs, __pyx_v_i, __pyx_v_dx);
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":248
* # always set X before Y
* GEOSCoordSeq_setX(cs, i, dx)
* GEOSCoordSeq_setY(cs, i, dy) # <<<<<<<<<<<<<<
*
* # Add closing coordinates to sequence?
*/
GEOSCoordSeq_setY(__pyx_v_cs, __pyx_v_i, __pyx_v_dy);
}
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":251
*
* # Add closing coordinates to sequence?
* if M > m: # <<<<<<<<<<<<<<
* dx = bbuffer[0]
* dy = bbuffer[1]
*/
__pyx_1 = (__pyx_v_M > __pyx_v_m);
if (__pyx_1) {
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":252
* # Add closing coordinates to sequence?
* if M > m:
* dx = bbuffer[0] # <<<<<<<<<<<<<<
* dy = bbuffer[1]
* GEOSCoordSeq_setX(cs, M-1, dx)
*/
__pyx_v_dx = (__pyx_v_bbuffer[0]);
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":253
* if M > m:
* dx = bbuffer[0]
* dy = bbuffer[1] # <<<<<<<<<<<<<<
* GEOSCoordSeq_setX(cs, M-1, dx)
* GEOSCoordSeq_setY(cs, M-1, dy)
*/
__pyx_v_dy = (__pyx_v_bbuffer[1]);
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":254
* dx = bbuffer[0]
* dy = bbuffer[1]
* GEOSCoordSeq_setX(cs, M-1, dx) # <<<<<<<<<<<<<<
* GEOSCoordSeq_setY(cs, M-1, dy)
*
*/
GEOSCoordSeq_setX(__pyx_v_cs, (__pyx_v_M - 1), __pyx_v_dx);
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":255
* dy = bbuffer[1]
* GEOSCoordSeq_setX(cs, M-1, dx)
* GEOSCoordSeq_setY(cs, M-1, dy) # <<<<<<<<<<<<<<
*
* # create LinearRing
*/
GEOSCoordSeq_setY(__pyx_v_cs, (__pyx_v_M - 1), __pyx_v_dy);
goto __pyx_L8;
}
__pyx_L8:;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":258
*
* # create LinearRing
* lr = GEOSGeom_createLinearRing(cs) # <<<<<<<<<<<<<<
*
* # create Polygon from LinearRing (assuming no holes)
*/
__pyx_v_lr = GEOSGeom_createLinearRing(__pyx_v_cs);
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":261
*
* # 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":262
* # create Polygon from LinearRing (assuming no holes)
* self._geom = GEOSGeom_createPolygon(lr,NULL,0)
* self.boundary = b # <<<<<<<<<<<<<<
*
*
*/
Py_INCREF(((PyObject *)__pyx_v_b));
Py_DECREF(((struct __pyx_obj_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:;
Py_XDECREF(__pyx_2);
Py_XDECREF(__pyx_3);
Py_XDECREF(__pyx_4);
Py_XDECREF(__pyx_6);
__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":265
*
*
* 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":267
* 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":268
* cdef double area
* GEOSArea(self._geom, &area)
* return area # <<<<<<<<<<<<<<
*
* cdef class LineString(BaseGeometry):
*/
__pyx_1 = PyFloat_FromDouble(__pyx_v_area); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1;}
__pyx_r = __pyx_1;
__pyx_1 = 0;
goto __pyx_L0;
__pyx_r = Py_None; Py_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1:;
Py_XDECREF(__pyx_1);
__Pyx_AddTraceback("_geoslib.Polygon.area");
__pyx_r = NULL;
__pyx_L0:;
return __pyx_r;
}
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":271
*
* 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;
PyObject *__pyx_4 = 0;
int __pyx_5;
static char *__pyx_argnames[] = {"b",0};
if (likely(!__pyx_kwds) && likely(PyTuple_GET_SIZE(__pyx_args) == 1)) {
__pyx_v_b = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0));
}
else {
if (unlikely(!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O", __pyx_argnames, &__pyx_v_b))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L2;}
}
goto __pyx_L3;
__pyx_L2:;
__Pyx_AddTraceback("_geoslib.LineString.__init__");
return -1;
__pyx_L3:;
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 = 271; __pyx_clineno = __LINE__; goto __pyx_L1;}
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":279
* # make sure data is contiguous.
* # if not, make a local copy.
* if not PyArray_ISCONTIGUOUS(b): # <<<<<<<<<<<<<<
* b = b.copy()
*
*/
__pyx_1 = (!PyArray_ISCONTIGUOUS(__pyx_v_b));
if (__pyx_1) {
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":280
* # if not, make a local copy.
* if not PyArray_ISCONTIGUOUS(b):
* b = b.copy() # <<<<<<<<<<<<<<
*
* M = b.shape[0]
*/
__pyx_2 = PyObject_GetAttr(((PyObject *)__pyx_v_b), __pyx_n_copy); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L1;}
__pyx_3 = PyObject_Call(__pyx_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
if (!(__Pyx_TypeTest(__pyx_3, __pyx_ptype_8_geoslib_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(((PyObject *)__pyx_v_b));
__pyx_v_b = ((PyArrayObject *)__pyx_3);
__pyx_3 = 0;
goto __pyx_L4;
}
__pyx_L4:;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":282
* b = b.copy()
*
* M = b.shape[0] # <<<<<<<<<<<<<<
* self._npts = M
*
*/
__pyx_2 = PyObject_GetAttr(((PyObject *)__pyx_v_b), __pyx_n_shape); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1;}
if (PyList_CheckExact(__pyx_2) && 0 <= 0 && 0 < PyList_GET_SIZE(__pyx_2)) {
__pyx_4 = PyList_GET_ITEM(__pyx_2, 0); Py_INCREF(__pyx_4);
} else if (PyTuple_CheckExact(__pyx_2) && 0 <= 0 && 0 < PyTuple_GET_SIZE(__pyx_2)) {
__pyx_4 = PyTuple_GET_ITEM(__pyx_2, 0); Py_INCREF(__pyx_4);
} else {
__pyx_3 = PyInt_FromLong(0); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1;}
__pyx_4 = PyObject_GetItem(__pyx_2, __pyx_3); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(__pyx_3); __pyx_3 = 0;
}
Py_DECREF(__pyx_2); __pyx_2 = 0;
__pyx_5 = __pyx_PyInt_int(__pyx_4); if (unlikely((__pyx_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(__pyx_4); __pyx_4 = 0;
__pyx_v_M = __pyx_5;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":283
*
* 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":286
*
* # Create a coordinate sequence
* cs = GEOSCoordSeq_create(M, 2) # <<<<<<<<<<<<<<
*
* # add to coordinate sequence
*/
__pyx_v_cs = GEOSCoordSeq_create(__pyx_v_M, 2);
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":289
*
* # add to coordinate sequence
* bbuffer = <double *>b.data # <<<<<<<<<<<<<<
* for i from 0 <= i < M:
* dx = bbuffer[2*i]
*/
__pyx_v_bbuffer = ((double *)__pyx_v_b->data);
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":290
* # add to coordinate sequence
* bbuffer = <double *>b.data
* for i from 0 <= i < M: # <<<<<<<<<<<<<<
* dx = bbuffer[2*i]
* dy = bbuffer[2*i+1]
*/
for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_M; __pyx_v_i++) {
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":291
* bbuffer = <double *>b.data
* for i from 0 <= i < M:
* dx = bbuffer[2*i] # <<<<<<<<<<<<<<
* dy = bbuffer[2*i+1]
* # Because of a bug in the GEOS C API,
*/
__pyx_v_dx = (__pyx_v_bbuffer[(2 * __pyx_v_i)]);
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":292
* for i from 0 <= i < M:
* dx = bbuffer[2*i]
* dy = bbuffer[2*i+1] # <<<<<<<<<<<<<<
* # Because of a bug in the GEOS C API,
* # always set X before Y
*/
__pyx_v_dy = (__pyx_v_bbuffer[((2 * __pyx_v_i) + 1)]);
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":295
* # Because of a bug in the GEOS C API,
* # always set X before Y
* GEOSCoordSeq_setX(cs, i, dx) # <<<<<<<<<<<<<<
* GEOSCoordSeq_setY(cs, i, dy)
*
*/
GEOSCoordSeq_setX(__pyx_v_cs, __pyx_v_i, __pyx_v_dx);
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":296
* # always set X before Y
* GEOSCoordSeq_setX(cs, i, dx)
* GEOSCoordSeq_setY(cs, i, dy) # <<<<<<<<<<<<<<
*
* # create LineString
*/
GEOSCoordSeq_setY(__pyx_v_cs, __pyx_v_i, __pyx_v_dy);
}
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":299
*
* # 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":300
* # create LineString
* self._geom = GEOSGeom_createLineString(cs)
* self.boundary = b # <<<<<<<<<<<<<<
*
* cdef class Point(BaseGeometry):
*/
Py_INCREF(((PyObject *)__pyx_v_b));
Py_DECREF(((struct __pyx_obj_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:;
Py_XDECREF(__pyx_2);
Py_XDECREF(__pyx_3);
Py_XDECREF(__pyx_4);
__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":304
* 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;
PyObject *__pyx_2 = 0;
double __pyx_3;
static char *__pyx_argnames[] = {"b",0};
if (likely(!__pyx_kwds) && likely(PyTuple_GET_SIZE(__pyx_args) == 1)) {
__pyx_v_b = PyTuple_GET_ITEM(__pyx_args, 0);
}
else {
if (unlikely(!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O", __pyx_argnames, &__pyx_v_b))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L2;}
}
goto __pyx_L3;
__pyx_L2:;
__Pyx_AddTraceback("_geoslib.Point.__init__");
return -1;
__pyx_L3:;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":308
* cdef GEOSCoordSeq *cs
* # Create a coordinate sequence
* cs = GEOSCoordSeq_create(1, 2) # <<<<<<<<<<<<<<
* dx = b[0]; dy = b[1]
* GEOSCoordSeq_setX(cs, 0, dx)
*/
__pyx_v_cs = GEOSCoordSeq_create(1, 2);
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":309
* # Create a coordinate sequence
* cs = GEOSCoordSeq_create(1, 2)
* dx = b[0]; dy = b[1] # <<<<<<<<<<<<<<
* GEOSCoordSeq_setX(cs, 0, dx)
* GEOSCoordSeq_setY(cs, 0, dy)
*/
if (PyList_CheckExact(__pyx_v_b) && 0 <= 0 && 0 < PyList_GET_SIZE(__pyx_v_b)) {
__pyx_2 = PyList_GET_ITEM(__pyx_v_b, 0); Py_INCREF(__pyx_2);
} else if (PyTuple_CheckExact(__pyx_v_b) && 0 <= 0 && 0 < PyTuple_GET_SIZE(__pyx_v_b)) {
__pyx_2 = PyTuple_GET_ITEM(__pyx_v_b, 0); Py_INCREF(__pyx_2);
} else {
__pyx_1 = PyInt_FromLong(0); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1;}
__pyx_2 = PyObject_GetItem(__pyx_v_b, __pyx_1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
}
__pyx_3 = __pyx_PyFloat_AsDouble(__pyx_2); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
__pyx_v_dx = __pyx_3;
if (PyList_CheckExact(__pyx_v_b) && 0 <= 1 && 1 < PyList_GET_SIZE(__pyx_v_b)) {
__pyx_2 = PyList_GET_ITEM(__pyx_v_b, 1); Py_INCREF(__pyx_2);
} else if (PyTuple_CheckExact(__pyx_v_b) && 0 <= 1 && 1 < PyTuple_GET_SIZE(__pyx_v_b)) {
__pyx_2 = PyTuple_GET_ITEM(__pyx_v_b, 1); Py_INCREF(__pyx_2);
} else {
__pyx_1 = PyInt_FromLong(1); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1;}
__pyx_2 = PyObject_GetItem(__pyx_v_b, __pyx_1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
}
__pyx_3 = __pyx_PyFloat_AsDouble(__pyx_2); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
__pyx_v_dy = __pyx_3;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":310
* cs = GEOSCoordSeq_create(1, 2)
* dx = b[0]; dy = b[1]
* GEOSCoordSeq_setX(cs, 0, dx) # <<<<<<<<<<<<<<
* GEOSCoordSeq_setY(cs, 0, dy)
* self._geom = GEOSGeom_createPoint(cs)
*/
GEOSCoordSeq_setX(__pyx_v_cs, 0, __pyx_v_dx);
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":311
* dx = b[0]; dy = b[1]
* GEOSCoordSeq_setX(cs, 0, dx)
* GEOSCoordSeq_setY(cs, 0, dy) # <<<<<<<<<<<<<<
* self._geom = GEOSGeom_createPoint(cs)
* self._npts = 1
*/
GEOSCoordSeq_setY(__pyx_v_cs, 0, __pyx_v_dy);
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":312
* GEOSCoordSeq_setX(cs, 0, dx)
* GEOSCoordSeq_setY(cs, 0, dy)
* self._geom = GEOSGeom_createPoint(cs) # <<<<<<<<<<<<<<
* self._npts = 1
* self.boundary = b
*/
((struct __pyx_obj_8_geoslib_Point *)__pyx_v_self)->__pyx_base._geom = GEOSGeom_createPoint(__pyx_v_cs);
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":313
* 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":314
* self._geom = GEOSGeom_createPoint(cs)
* self._npts = 1
* self.boundary = b # <<<<<<<<<<<<<<
*
* cdef _get_coords(GEOSGeom *geom):
*/
Py_INCREF(__pyx_v_b);
Py_DECREF(((struct __pyx_obj_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:;
Py_XDECREF(__pyx_1);
Py_XDECREF(__pyx_2);
__Pyx_AddTraceback("_geoslib.Point.__init__");
__pyx_r = -1;
__pyx_L0:;
return __pyx_r;
}
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":316
* self.boundary = b
*
* cdef _get_coords(GEOSGeom *geom): # <<<<<<<<<<<<<<
* cdef GEOSCoordSeq *cs
* cdef GEOSGeom *lr
*/
static PyObject *__pyx_int_2;
static PyObject *__pyx_n_empty;
static PyObject *__pyx_n_float64;
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":323
* cdef ndarray b
* cdef double *bbuffer
* if GEOSGeomTypeId(geom) == GEOS_POLYGON: # <<<<<<<<<<<<<<
* lr = GEOSGetExteriorRing(geom)
* cs = GEOSGeom_getCoordSeq(lr)
*/
__pyx_1 = (GEOSGeomTypeId(__pyx_v_geom) == GEOS_POLYGON);
if (__pyx_1) {
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":324
* cdef double *bbuffer
* if GEOSGeomTypeId(geom) == GEOS_POLYGON:
* lr = GEOSGetExteriorRing(geom) # <<<<<<<<<<<<<<
* cs = GEOSGeom_getCoordSeq(lr)
* else:
*/
__pyx_v_lr = GEOSGetExteriorRing(__pyx_v_geom);
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":325
* if GEOSGeomTypeId(geom) == GEOS_POLYGON:
* lr = GEOSGetExteriorRing(geom)
* cs = GEOSGeom_getCoordSeq(lr) # <<<<<<<<<<<<<<
* else:
* cs = GEOSGeom_getCoordSeq(geom)
*/
__pyx_v_cs = GEOSGeom_getCoordSeq(__pyx_v_lr);
goto __pyx_L2;
}
/*else*/ {
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":327
* 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_L2:;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":328
* else:
* cs = GEOSGeom_getCoordSeq(geom)
* GEOSCoordSeq_getSize(cs, &M) # <<<<<<<<<<<<<<
* b = numpy.empty((M,2), numpy.float64)
* bbuffer = <double *>b.data
*/
GEOSCoordSeq_getSize(__pyx_v_cs, (&__pyx_v_M));
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":329
* cs = GEOSGeom_getCoordSeq(geom)
* GEOSCoordSeq_getSize(cs, &M)
* b = numpy.empty((M,2), numpy.float64) # <<<<<<<<<<<<<<
* bbuffer = <double *>b.data
* for i from 0 <= i < M:
*/
__pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_numpy); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1;}
__pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_empty); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
__pyx_2 = PyLong_FromUnsignedLong(__pyx_v_M); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1;}
__pyx_4 = PyTuple_New(2); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1;}
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_n_numpy); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1;}
__pyx_5 = PyObject_GetAttr(__pyx_2, __pyx_n_float64); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
__pyx_2 = PyTuple_New(2); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1;}
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 = 329; __pyx_clineno = __LINE__; goto __pyx_L1;}
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 = 329; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(((PyObject *)__pyx_v_b));
__pyx_v_b = ((PyArrayObject *)__pyx_4);
__pyx_4 = 0;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":330
* GEOSCoordSeq_getSize(cs, &M)
* b = numpy.empty((M,2), numpy.float64)
* bbuffer = <double *>b.data # <<<<<<<<<<<<<<
* for i from 0 <= i < M:
* GEOSCoordSeq_getX(cs, i, &dx)
*/
__pyx_v_bbuffer = ((double *)__pyx_v_b->data);
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":331
* b = numpy.empty((M,2), numpy.float64)
* bbuffer = <double *>b.data
* for i from 0 <= i < M: # <<<<<<<<<<<<<<
* GEOSCoordSeq_getX(cs, i, &dx)
* GEOSCoordSeq_getY(cs, i, &dy)
*/
for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_M; __pyx_v_i++) {
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":332
* bbuffer = <double *>b.data
* for i from 0 <= i < M:
* GEOSCoordSeq_getX(cs, i, &dx) # <<<<<<<<<<<<<<
* GEOSCoordSeq_getY(cs, i, &dy)
* bbuffer[2*i] = dx
*/
GEOSCoordSeq_getX(__pyx_v_cs, __pyx_v_i, (&__pyx_v_dx));
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":333
* for i from 0 <= i < M:
* GEOSCoordSeq_getX(cs, i, &dx)
* GEOSCoordSeq_getY(cs, i, &dy) # <<<<<<<<<<<<<<
* bbuffer[2*i] = dx
* bbuffer[2*i+1] = dy
*/
GEOSCoordSeq_getY(__pyx_v_cs, __pyx_v_i, (&__pyx_v_dy));
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":334
* GEOSCoordSeq_getX(cs, i, &dx)
* GEOSCoordSeq_getY(cs, i, &dy)
* bbuffer[2*i] = dx # <<<<<<<<<<<<<<
* bbuffer[2*i+1] = dy
* return b
*/
(__pyx_v_bbuffer[(2 * __pyx_v_i)]) = __pyx_v_dx;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":335
* GEOSCoordSeq_getY(cs, i, &dy)
* bbuffer[2*i] = dx
* bbuffer[2*i+1] = dy # <<<<<<<<<<<<<<
* return b
*/
(__pyx_v_bbuffer[((2 * __pyx_v_i) + 1)]) = __pyx_v_dy;
}
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":336
* bbuffer[2*i] = dx
* bbuffer[2*i+1] = dy
* return b # <<<<<<<<<<<<<<
*/
Py_INCREF(((PyObject *)__pyx_v_b));
__pyx_r = ((PyObject *)__pyx_v_b);
goto __pyx_L0;
__pyx_r = Py_None; Py_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1:;
Py_XDECREF(__pyx_2);
Py_XDECREF(__pyx_3);
Py_XDECREF(__pyx_4);
Py_XDECREF(__pyx_5);
__Pyx_AddTraceback("_geoslib._get_coords");
__pyx_r = 0;
__pyx_L0:;
Py_DECREF(__pyx_v_b);
return __pyx_r;
}
static __Pyx_InternTabEntry __pyx_intern_tab[] = {
{&__pyx_n_NotImplementedError, "NotImplementedError"},
{&__pyx_n_ValueError, "ValueError"},
{&__pyx_n___class__, "__class__"},
{&__pyx_n___dealloc__, "__dealloc__"},
{&__pyx_n___geos_version__, "__geos_version__"},
{&__pyx_n___init__, "__init__"},
{&__pyx_n___reduce__, "__reduce__"},
{&__pyx_n___version__, "__version__"},
{&__pyx_n_append, "append"},
{&__pyx_n_area, "area"},
{&__pyx_n_copy, "copy"},
{&__pyx_n_empty, "empty"},
{&__pyx_n_float64, "float64"},
{&__pyx_n_geom_type, "geom_type"},
{&__pyx_n_get_coords, "get_coords"},
{&__pyx_n_intersection, "intersection"},
{&__pyx_n_intersects, "intersects"},
{&__pyx_n_is_valid, "is_valid"},
{&__pyx_n_numpy, "numpy"},
{&__pyx_n_shape, "shape"},
{&__pyx_n_stderr, "stderr"},
{&__pyx_n_stdout, "stdout"},
{&__pyx_n_sys, "sys"},
{&__pyx_n_within, "within"},
{&__pyx_n_write, "write"},
{0, 0}
};
static __Pyx_StringTabEntry __pyx_string_tab[] = {
{&__pyx_k_3p, __pyx_k_3, sizeof(__pyx_k_3), 0},
{&__pyx_k_4p, __pyx_k_4, sizeof(__pyx_k_4), 0},
{&__pyx_k_5p, __pyx_k_5, sizeof(__pyx_k_5), 0},
{&__pyx_k_6p, __pyx_k_6, sizeof(__pyx_k_6), 0},
{&__pyx_k_7p, __pyx_k_7, sizeof(__pyx_k_7), 0},
{&__pyx_k_8p, __pyx_k_8, sizeof(__pyx_k_8), 0},
{0, 0, 0, 0}
};
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);
++o->ob_refcnt;
__pyx_pf_8_geoslib_12BaseGeometry___dealloc__(o);
if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
--o->ob_refcnt;
PyErr_Restore(etype, eval, etb);
}
Py_XDECREF(p->boundary);
(*o->ob_type->tp_free)(o);
}
static int __pyx_tp_traverse_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},
{"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*/
0, /*nb_divide*/
0, /*nb_remainder*/
0, /*nb_divmod*/
0, /*nb_power*/
0, /*nb_negative*/
0, /*nb_positive*/
0, /*nb_absolute*/
0, /*nb_nonzero*/
0, /*nb_invert*/
0, /*nb_lshift*/
0, /*nb_rshift*/
0, /*nb_and*/
0, /*nb_xor*/
0, /*nb_or*/
0, /*nb_coerce*/
0, /*nb_int*/
0, /*nb_long*/
0, /*nb_float*/
0, /*nb_oct*/
0, /*nb_hex*/
0, /*nb_inplace_add*/
0, /*nb_inplace_subtract*/
0, /*nb_inplace_multiply*/
0, /*nb_inplace_divide*/
0, /*nb_inplace_remainder*/
0, /*nb_inplace_power*/
0, /*nb_inplace_lshift*/
0, /*nb_inplace_rshift*/
0, /*nb_inplace_and*/
0, /*nb_inplace_xor*/
0, /*nb_inplace_or*/
0, /*nb_floor_divide*/
0, /*nb_true_divide*/
0, /*nb_inplace_floor_divide*/
0, /*nb_inplace_true_divide*/
#if Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX
0, /*nb_index*/
#endif
};
static PySequenceMethods __pyx_tp_as_sequence_BaseGeometry = {
0, /*sq_length*/
0, /*sq_concat*/
0, /*sq_repeat*/
0, /*sq_item*/
0, /*sq_slice*/
0, /*sq_ass_item*/
0, /*sq_ass_slice*/
0, /*sq_contains*/
0, /*sq_inplace_concat*/
0, /*sq_inplace_repeat*/
};
static PyMappingMethods __pyx_tp_as_mapping_BaseGeometry = {
0, /*mp_length*/
0, /*mp_subscript*/
0, /*mp_ass_subscript*/
};
static PyBufferProcs __pyx_tp_as_buffer_BaseGeometry = {
0, /*bf_getreadbuffer*/
0, /*bf_getwritebuffer*/
0, /*bf_getsegcount*/
0, /*bf_getcharbuffer*/
};
PyTypeObject __pyx_type_8_geoslib_BaseGeometry = {
PyObject_HEAD_INIT(0)
0, /*ob_size*/
"_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_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*/
0, /*nb_divide*/
0, /*nb_remainder*/
0, /*nb_divmod*/
0, /*nb_power*/
0, /*nb_negative*/
0, /*nb_positive*/
0, /*nb_absolute*/
0, /*nb_nonzero*/
0, /*nb_invert*/
0, /*nb_lshift*/
0, /*nb_rshift*/
0, /*nb_and*/
0, /*nb_xor*/
0, /*nb_or*/
0, /*nb_coerce*/
0, /*nb_int*/
0, /*nb_long*/
0, /*nb_float*/
0, /*nb_oct*/
0, /*nb_hex*/
0, /*nb_inplace_add*/
0, /*nb_inplace_subtract*/
0, /*nb_inplace_multiply*/
0, /*nb_inplace_divide*/
0, /*nb_inplace_remainder*/
0, /*nb_inplace_power*/
0, /*nb_inplace_lshift*/
0, /*nb_inplace_rshift*/
0, /*nb_inplace_and*/
0, /*nb_inplace_xor*/
0, /*nb_inplace_or*/
0, /*nb_floor_divide*/
0, /*nb_true_divide*/
0, /*nb_inplace_floor_divide*/
0, /*nb_inplace_true_divide*/
#if Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX
0, /*nb_index*/
#endif
};
static PySequenceMethods __pyx_tp_as_sequence_Polygon = {
0, /*sq_length*/
0, /*sq_concat*/
0, /*sq_repeat*/
0, /*sq_item*/
0, /*sq_slice*/
0, /*sq_ass_item*/
0, /*sq_ass_slice*/
0, /*sq_contains*/
0, /*sq_inplace_concat*/
0, /*sq_inplace_repeat*/
};
static PyMappingMethods __pyx_tp_as_mapping_Polygon = {
0, /*mp_length*/
0, /*mp_subscript*/
0, /*mp_ass_subscript*/
};
static PyBufferProcs __pyx_tp_as_buffer_Polygon = {
0, /*bf_getreadbuffer*/
0, /*bf_getwritebuffer*/
0, /*bf_getsegcount*/
0, /*bf_getcharbuffer*/
};
PyTypeObject __pyx_type_8_geoslib_Polygon = {
PyObject_HEAD_INIT(0)
0, /*ob_size*/
"_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_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*/
0, /*nb_divide*/
0, /*nb_remainder*/
0, /*nb_divmod*/
0, /*nb_power*/
0, /*nb_negative*/
0, /*nb_positive*/
0, /*nb_absolute*/
0, /*nb_nonzero*/
0, /*nb_invert*/
0, /*nb_lshift*/
0, /*nb_rshift*/
0, /*nb_and*/
0, /*nb_xor*/
0, /*nb_or*/
0, /*nb_coerce*/
0, /*nb_int*/
0, /*nb_long*/
0, /*nb_float*/
0, /*nb_oct*/
0, /*nb_hex*/
0, /*nb_inplace_add*/
0, /*nb_inplace_subtract*/
0, /*nb_inplace_multiply*/
0, /*nb_inplace_divide*/
0, /*nb_inplace_remainder*/
0, /*nb_inplace_power*/
0, /*nb_inplace_lshift*/
0, /*nb_inplace_rshift*/
0, /*nb_inplace_and*/
0, /*nb_inplace_xor*/
0, /*nb_inplace_or*/
0, /*nb_floor_divide*/
0, /*nb_true_divide*/
0, /*nb_inplace_floor_divide*/
0, /*nb_inplace_true_divide*/
#if Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX
0, /*nb_index*/
#endif
};
static PySequenceMethods __pyx_tp_as_sequence_LineString = {
0, /*sq_length*/
0, /*sq_concat*/
0, /*sq_repeat*/
0, /*sq_item*/
0, /*sq_slice*/
0, /*sq_ass_item*/
0, /*sq_ass_slice*/
0, /*sq_contains*/
0, /*sq_inplace_concat*/
0, /*sq_inplace_repeat*/
};
static PyMappingMethods __pyx_tp_as_mapping_LineString = {
0, /*mp_length*/
0, /*mp_subscript*/
0, /*mp_ass_subscript*/
};
static PyBufferProcs __pyx_tp_as_buffer_LineString = {
0, /*bf_getreadbuffer*/
0, /*bf_getwritebuffer*/
0, /*bf_getsegcount*/
0, /*bf_getcharbuffer*/
};
PyTypeObject __pyx_type_8_geoslib_LineString = {
PyObject_HEAD_INIT(0)
0, /*ob_size*/
"_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_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*/
0, /*nb_divide*/
0, /*nb_remainder*/
0, /*nb_divmod*/
0, /*nb_power*/
0, /*nb_negative*/
0, /*nb_positive*/
0, /*nb_absolute*/
0, /*nb_nonzero*/
0, /*nb_invert*/
0, /*nb_lshift*/
0, /*nb_rshift*/
0, /*nb_and*/
0, /*nb_xor*/
0, /*nb_or*/
0, /*nb_coerce*/
0, /*nb_int*/
0, /*nb_long*/
0, /*nb_float*/
0, /*nb_oct*/
0, /*nb_hex*/
0, /*nb_inplace_add*/
0, /*nb_inplace_subtract*/
0, /*nb_inplace_multiply*/
0, /*nb_inplace_divide*/
0, /*nb_inplace_remainder*/
0, /*nb_inplace_power*/
0, /*nb_inplace_lshift*/
0, /*nb_inplace_rshift*/
0, /*nb_inplace_and*/
0, /*nb_inplace_xor*/
0, /*nb_inplace_or*/
0, /*nb_floor_divide*/
0, /*nb_true_divide*/
0, /*nb_inplace_floor_divide*/
0, /*nb_inplace_true_divide*/
#if Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX
0, /*nb_index*/
#endif
};
static PySequenceMethods __pyx_tp_as_sequence_Point = {
0, /*sq_length*/
0, /*sq_concat*/
0, /*sq_repeat*/
0, /*sq_item*/
0, /*sq_slice*/
0, /*sq_ass_item*/
0, /*sq_ass_slice*/
0, /*sq_contains*/
0, /*sq_inplace_concat*/
0, /*sq_inplace_repeat*/
};
static PyMappingMethods __pyx_tp_as_mapping_Point = {
0, /*mp_length*/
0, /*mp_subscript*/
0, /*mp_ass_subscript*/
};
static PyBufferProcs __pyx_tp_as_buffer_Point = {
0, /*bf_getreadbuffer*/
0, /*bf_getwritebuffer*/
0, /*bf_getsegcount*/
0, /*bf_getcharbuffer*/
};
PyTypeObject __pyx_type_8_geoslib_Point = {
PyObject_HEAD_INIT(0)
0, /*ob_size*/
"_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_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*/
PyMODINIT_FUNC init_geoslib(void); /*proto*/
PyMODINIT_FUNC init_geoslib(void) {
PyObject *__pyx_1 = 0;
PyObject *__pyx_2 = 0;
int __pyx_3;
/*--- Libary function declarations ---*/
__pyx_init_filenames();
/*--- Module creation code ---*/
__pyx_m = Py_InitModule4("_geoslib", __pyx_methods, 0, 0, PYTHON_API_VERSION);
if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1;};
__pyx_b = PyImport_AddModule("__builtin__");
if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1;};
if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1;};
/*--- Intern code ---*/
__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;};
__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;};
__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;};
__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;};
if (__Pyx_InternStrings(__pyx_intern_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1;};
/*--- String init code ---*/
if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1;};
/*--- Builtin init code ---*/
__pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1;}
__pyx_builtin_NotImplementedError = __Pyx_GetName(__pyx_b, __pyx_n_NotImplementedError); if (!__pyx_builtin_NotImplementedError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1;}
__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;}
__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;}
if (PyType_Ready(&__pyx_type_8_geoslib_BaseGeometry) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1;}
if (PyObject_SetAttrString(__pyx_m, "BaseGeometry", (PyObject *)&__pyx_type_8_geoslib_BaseGeometry) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1;}
__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 = 214; __pyx_clineno = __LINE__; goto __pyx_L1;}
if (PyObject_SetAttrString(__pyx_m, "Polygon", (PyObject *)&__pyx_type_8_geoslib_Polygon) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1;}
__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 = 270; __pyx_clineno = __LINE__; goto __pyx_L1;}
if (PyObject_SetAttrString(__pyx_m, "LineString", (PyObject *)&__pyx_type_8_geoslib_LineString) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1;}
__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 = 302; __pyx_clineno = __LINE__; goto __pyx_L1;}
if (PyObject_SetAttrString(__pyx_m, "Point", (PyObject *)&__pyx_type_8_geoslib_Point) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1;}
__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_n_sys, 0); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1;}
if (PyObject_SetAttr(__pyx_m, __pyx_n_sys, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":2
* import sys
* import numpy # <<<<<<<<<<<<<<
*
* __version__ = "0.1"
*/
__pyx_1 = __Pyx_Import(__pyx_n_numpy, 0); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1;}
if (PyObject_SetAttr(__pyx_m, __pyx_n_numpy, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":4
* import numpy
*
* __version__ = "0.1" # <<<<<<<<<<<<<<
*
* # need some python C API functions for strings.
*/
if (PyObject_SetAttr(__pyx_m, __pyx_n___version__, __pyx_k_3p) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1;}
/* "/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":121
* cdef geos_version():
* return PyString_FromString(GEOSversion())
* __geos_version__ = geos_version() # module variable. # <<<<<<<<<<<<<<
* if __geos_version__ != "2.2.3-CAPI-1.1.1":
* raise ValueError('version 2.2.3 of the geos library is required')
*/
__pyx_1 = __pyx_f_8_geoslib_geos_version(); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1;}
if (PyObject_SetAttr(__pyx_m, __pyx_n___geos_version__, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":122
* return PyString_FromString(GEOSversion())
* __geos_version__ = geos_version() # module variable.
* if __geos_version__ != "2.2.3-CAPI-1.1.1": # <<<<<<<<<<<<<<
* raise ValueError('version 2.2.3 of the geos library is required')
* # intialize GEOS (parameters are notice and error function callbacks).
*/
__pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n___geos_version__); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1;}
__pyx_2 = PyObject_RichCompare(__pyx_1, __pyx_k_4p, Py_NE); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
__pyx_3 = __Pyx_PyObject_IsTrue(__pyx_2); if (unlikely(__pyx_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
if (__pyx_3) {
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":123
* __geos_version__ = geos_version() # module variable.
* if __geos_version__ != "2.2.3-CAPI-1.1.1":
* raise ValueError('version 2.2.3 of the geos library is required') # <<<<<<<<<<<<<<
* # intialize GEOS (parameters are notice and error function callbacks).
* initGEOS(notice_h, error_h)
*/
__pyx_1 = PyTuple_New(1); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_INCREF(__pyx_k_5p);
PyTuple_SET_ITEM(__pyx_1, 0, __pyx_k_5p);
__pyx_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_1), NULL); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 0;
__Pyx_Raise(__pyx_2, 0, 0);
Py_DECREF(__pyx_2); __pyx_2 = 0;
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1;}
goto __pyx_L5;
}
__pyx_L5:;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":125
* raise ValueError('version 2.2.3 of the geos library is required')
* # intialize GEOS (parameters are notice and error function callbacks).
* initGEOS(notice_h, error_h) # <<<<<<<<<<<<<<
*
* cdef class BaseGeometry:
*/
initGEOS(__pyx_f_8_geoslib_notice_h, __pyx_f_8_geoslib_error_h);
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":316
* self.boundary = b
*
* cdef _get_coords(GEOSGeom *geom): # <<<<<<<<<<<<<<
* cdef GEOSCoordSeq *cs
* cdef GEOSGeom *lr
*/
return;
__pyx_L1:;
Py_XDECREF(__pyx_1);
Py_XDECREF(__pyx_2);
__Pyx_AddTraceback("_geoslib");
}
static char *__pyx_filenames[] = {
"_geoslib.pyx",
};
/* Runtime support code */
static void __pyx_init_filenames(void) {
__pyx_f = __pyx_filenames;
}
static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, char *name, 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 (obj->ob_type == 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, obj->ob_type->tp_name);
return 0;
}
static INLINE void __Pyx_RaiseArgtupleTooLong(
Py_ssize_t num_expected,
Py_ssize_t num_found)
{
const char* error_message =
#if PY_VERSION_HEX < 0x02050000
"function takes at most %d positional arguments (%d given)";
#else
"function takes at most %zd positional arguments (%zd given)";
#endif
PyErr_Format(PyExc_TypeError, error_message, num_expected, num_found);
}
static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list) {
PyObject *__import__ = 0;
PyObject *empty_list = 0;
PyObject *module = 0;
PyObject *global_dict = 0;
PyObject *empty_dict = 0;
PyObject *list;
__import__ = PyObject_GetAttrString(__pyx_b, "__import__");
if (!__import__)
goto bad;
if (from_list)
list = from_list;
else {
empty_list = PyList_New(0);
if (!empty_list)
goto bad;
list = empty_list;
}
global_dict = PyModule_GetDict(__pyx_m);
if (!global_dict)
goto bad;
empty_dict = PyDict_New();
if (!empty_dict)
goto bad;
module = PyObject_CallFunction(__import__, "OOOO",
name, global_dict, empty_dict, list);
bad:
Py_XDECREF(empty_list);
Py_XDECREF(__import__);
Py_XDECREF(empty_dict);
return module;
}
static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) {
PyObject *result;
result = PyObject_GetAttr(dict, name);
if (!result)
PyErr_SetObject(PyExc_NameError, name);
return result;
}
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) {
Py_XINCREF(type);
Py_XINCREF(value);
Py_XINCREF(tb);
/* First, check the traceback argument, replacing None with NULL. */
if (tb == Py_None) {
Py_DECREF(tb);
tb = 0;
}
else if (tb != NULL && !PyTraceBack_Check(tb)) {
PyErr_SetString(PyExc_TypeError,
"raise: arg 3 must be a traceback or None");
goto raise_error;
}
/* Next, replace a missing value with None */
if (value == NULL) {
value = Py_None;
Py_INCREF(value);
}
#if PY_VERSION_HEX < 0x02050000
if (!PyClass_Check(type))
#else
if (!PyType_Check(type))
#endif
{
/* Raising an instance. The value should be a dummy. */
if (value != Py_None) {
PyErr_SetString(PyExc_TypeError,
"instance exception may not have a separate value");
goto raise_error;
}
/* Normalize to raise <class>, <instance> */
Py_DECREF(value);
value = type;
#if PY_VERSION_HEX < 0x02050000
if (PyInstance_Check(type)) {
type = (PyObject*) ((PyInstanceObject*)type)->in_class;
Py_INCREF(type);
}
else {
type = 0;
PyErr_SetString(PyExc_TypeError,
"raise: exception must be an old-style class or instance");
goto raise_error;
}
#else
type = (PyObject*) type->ob_type;
Py_INCREF(type);
if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
PyErr_SetString(PyExc_TypeError,
"raise: exception class must be a subclass of BaseException");
goto raise_error;
}
#endif
}
PyErr_Restore(type, value, tb);
return;
raise_error:
Py_XDECREF(value);
Py_XDECREF(type);
Py_XDECREF(tb);
return;
}
static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) {
PyObject *tmp_type, *tmp_value, *tmp_tb;
PyThreadState *tstate = PyThreadState_Get();
PyErr_Fetch(type, value, tb);
PyErr_NormalizeException(type, value, tb);
if (PyErr_Occurred())
goto bad;
Py_INCREF(*type);
Py_INCREF(*value);
Py_INCREF(*tb);
tmp_type = tstate->exc_type;
tmp_value = tstate->exc_value;
tmp_tb = tstate->exc_traceback;
tstate->exc_type = *type;
tstate->exc_value = *value;
tstate->exc_traceback = *tb;
/* Make sure tstate is in a consistent state when we XDECREF
these objects (XDECREF may run arbitrary code). */
Py_XDECREF(tmp_type);
Py_XDECREF(tmp_value);
Py_XDECREF(tmp_tb);
return 0;
bad:
Py_XDECREF(*type);
Py_XDECREF(*value);
Py_XDECREF(*tb);
return -1;
}
static void __Pyx_WriteUnraisable(char *name) {
PyObject *old_exc, *old_val, *old_tb;
PyObject *ctx;
PyErr_Fetch(&old_exc, &old_val, &old_tb);
ctx = PyString_FromString(name);
PyErr_Restore(old_exc, old_val, old_tb);
if (!ctx)
ctx = Py_None;
PyErr_WriteUnraisable(ctx);
}
static int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
if (!type) {
PyErr_Format(PyExc_SystemError, "Missing type object");
return 0;
}
if (obj == Py_None || PyObject_TypeCheck(obj, type))
return 1;
PyErr_Format(PyExc_TypeError, "Cannot convert %s to %s",
obj->ob_type->tp_name, type->tp_name);
return 0;
}
static int __Pyx_InternStrings(__Pyx_InternTabEntry *t) {
while (t->p) {
*t->p = PyString_InternFromString(t->s);
if (!*t->p)
return -1;
++t;
}
return 0;
}
static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
while (t->p) {
if (t->is_unicode) {
*t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
} else {
*t->p = PyString_FromStringAndSize(t->s, t->n - 1);
}
if (!*t->p)
return -1;
++t;
}
return 0;
}
#ifndef __PYX_HAVE_RT_ImportType
#define __PYX_HAVE_RT_ImportType
static PyTypeObject *__Pyx_ImportType(char *module_name, char *class_name,
long size)
{
PyObject *py_module = 0;
PyObject *result = 0;
PyObject *py_name = 0;
py_name = PyString_FromString(module_name);
if (!py_name)
goto bad;
py_module = __Pyx_ImportModule(module_name);
if (!py_module)
goto bad;
result = PyObject_GetAttrString(py_module, class_name);
if (!result)
goto bad;
if (!PyType_Check(result)) {
PyErr_Format(PyExc_TypeError,
"%s.%s is not a type object",
module_name, class_name);
goto bad;
}
if (((PyTypeObject *)result)->tp_basicsize != size) {
PyErr_Format(PyExc_ValueError,
"%s.%s does not appear to be the correct type object",
module_name, class_name);
goto bad;
}
return (PyTypeObject *)result;
bad:
Py_XDECREF(py_name);
Py_XDECREF(result);
return 0;
}
#endif
#ifndef __PYX_HAVE_RT_ImportModule
#define __PYX_HAVE_RT_ImportModule
static PyObject *__Pyx_ImportModule(char *name) {
PyObject *py_name = 0;
PyObject *py_module = 0;
py_name = PyString_FromString(name);
if (!py_name)
goto bad;
py_module = PyImport_Import(py_name);
Py_DECREF(py_name);
return py_module;
bad:
Py_XDECREF(py_name);
return 0;
}
#endif
#include "compile.h"
#include "frameobject.h"
#include "traceback.h"
static void __Pyx_AddTraceback(char *funcname) {
PyObject *py_srcfile = 0;
PyObject *py_funcname = 0;
PyObject *py_globals = 0;
PyObject *empty_string = 0;
PyCodeObject *py_code = 0;
PyFrameObject *py_frame = 0;
py_srcfile = PyString_FromString(__pyx_filename);
if (!py_srcfile) goto bad;
if (__pyx_clineno) {
py_funcname = PyString_FromFormat( "%s (%s:%u)", funcname, __pyx_cfilenm, __pyx_clineno);
}
else {
py_funcname = PyString_FromString(funcname);
}
if (!py_funcname) goto bad;
py_globals = PyModule_GetDict(__pyx_m);
if (!py_globals) goto bad;
empty_string = PyString_FromString("");
if (!empty_string) goto bad;
py_code = PyCode_New(
0, /*int argcount,*/
0, /*int nlocals,*/
0, /*int stacksize,*/
0, /*int flags,*/
empty_string, /*PyObject *code,*/
__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);
}
/* 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);
}
}