diff --git a/enable/api.py b/enable/api.py index 07714c053..cd73ab000 100644 --- a/enable/api.py +++ b/enable/api.py @@ -63,6 +63,4 @@ from .viewport import Viewport from .window import Window -from ._cython_speedups import points_in_polygon - from .primitives.api import Annotater, Box, Line, Polygon diff --git a/enable/primitives/polygon.py b/enable/primitives/polygon.py index b03a97af9..4c196bf53 100644 --- a/enable/primitives/polygon.py +++ b/enable/primitives/polygon.py @@ -5,13 +5,13 @@ from numpy import array # Enthought library imports. -from kiva.constants import EOF_FILL_STROKE, FILL, FILL_STROKE +from kiva.api import EOF_FILL_STROKE, FILL, FILL_STROKE, points_in_polygon from traits.api import (Any, Event, Float, HasTraits, Instance, List, Property, Trait, Tuple) from traitsui.api import Group, View # Local imports. -from enable.api import border_size_trait, points_in_polygon, Component +from enable.api import border_size_trait, Component from enable.colors import ColorTrait diff --git a/examples/kiva/agg/polygon_hit_test.py b/examples/kiva/agg/polygon_hit_test.py index 30601ae79..5d016259d 100644 --- a/examples/kiva/agg/polygon_hit_test.py +++ b/examples/kiva/agg/polygon_hit_test.py @@ -1,17 +1,17 @@ import numpy -from kiva import agg +from kiva.api import points_in_polygon poly = numpy.array((( 0.0, 0.0), (10.0, 0.0), (10.0, 10.0), ( 0.0, 10.0))) -print(agg.point_in_polygon(-1,-1,poly)) -print(agg.point_in_polygon(0.0,0.0,poly)) -print(agg.point_in_polygon(5,5,poly)) -print(agg.point_in_polygon(10,10,poly)) -print(agg.point_in_polygon(15,15,poly)) +print(point_in_polygon(-1,-1,poly)) +print(point_in_polygon(0.0,0.0,poly)) +print(point_in_polygon(5,5,poly)) +print(point_in_polygon(10,10,poly)) +print(point_in_polygon(15,15,poly)) pts = numpy.array(((-1.0, -1.0), ( 0.1, 0.0), @@ -21,7 +21,7 @@ ( 10.0, 10.0), ( 15.0, 15.0))) -results = agg.points_in_polygon(pts, poly) +results = points_in_polygon(pts, poly) print(results) @@ -29,7 +29,7 @@ import time t1 = time.clock() -results = agg.points_in_polygon(pts, poly) +results = points_in_polygon(pts, poly) t2 = time.clock() print('points_in_polygon() for %d pts in %d point polygon (sec): %f' % \ (len(pts), len(poly), t2-t1)) @@ -51,7 +51,7 @@ ( 0.0, 10.0))) t1 = time.clock() -results = agg.points_in_polygon(pts, poly) +results = points_in_polygon(pts, poly) t2 = time.clock() print('points_in_polygon() for %d pts in %d point polygon (sec): %f' % \ (len(pts), len(poly), t2-t1)) diff --git a/enable/_cython_speedups.cpp b/kiva/_cython_speedups.cpp similarity index 99% rename from enable/_cython_speedups.cpp rename to kiva/_cython_speedups.cpp index 968c734b6..5aa2934e1 100644 --- a/enable/_cython_speedups.cpp +++ b/kiva/_cython_speedups.cpp @@ -275,8 +275,8 @@ static CYTHON_INLINE float __PYX_NAN() { #endif #endif -#define __PYX_HAVE__enable___cython_speedups -#define __PYX_HAVE_API__enable___cython_speedups +#define __PYX_HAVE__kiva___cython_speedups +#define __PYX_HAVE_API__kiva___cython_speedups #include "stdint.h" #include "_hit_test.h" #include "pythread.h" @@ -499,8 +499,8 @@ static const char *__pyx_filename; static const char *__pyx_f[] = { - "enable/_cython_speedups.pyx", - "stringsource", + "kiva/_cython_speedups.pyx", + "kiva/stringsource", }; /* MemviewSliceStruct.proto */ struct __pyx_memoryview_obj; @@ -1229,9 +1229,9 @@ static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memo /* Module declarations from 'libc.stdint' */ -/* Module declarations from 'enable._hit_test' */ +/* Module declarations from 'kiva._hit_test' */ -/* Module declarations from 'enable._cython_speedups' */ +/* Module declarations from 'kiva._cython_speedups' */ static PyTypeObject *__pyx_array_type = 0; static PyTypeObject *__pyx_MemviewEnum_type = 0; static PyTypeObject *__pyx_memoryview_type = 0; @@ -1277,10 +1277,10 @@ static void __pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice *, int, size static void __pyx_memoryview__slice_assign_scalar(char *, Py_ssize_t *, Py_ssize_t *, int, size_t, void *); /*proto*/ static __Pyx_TypeInfo __Pyx_TypeInfo_double = { "double", NULL, sizeof(double), { 0 }, 0, 'R', 0, 0 }; static __Pyx_TypeInfo __Pyx_TypeInfo_nn_uint8_t = { "uint8_t", NULL, sizeof(uint8_t), { 0 }, 0, IS_UNSIGNED(uint8_t) ? 'U' : 'I', IS_UNSIGNED(uint8_t), 0 }; -#define __Pyx_MODULE_NAME "enable._cython_speedups" -int __pyx_module_is_main_enable___cython_speedups = 0; +#define __Pyx_MODULE_NAME "kiva._cython_speedups" +int __pyx_module_is_main_kiva___cython_speedups = 0; -/* Implementation of 'enable._cython_speedups' */ +/* Implementation of 'kiva._cython_speedups' */ static PyObject *__pyx_builtin_ValueError; static PyObject *__pyx_builtin_MemoryError; static PyObject *__pyx_builtin_enumerate; @@ -1350,10 +1350,10 @@ static const char __pyx_k_points_in_polygon[] = "points_in_polygon"; static const char __pyx_k_strided_and_direct[] = ""; static const char __pyx_k_strided_and_indirect[] = ""; static const char __pyx_k_contiguous_and_direct[] = ""; +static const char __pyx_k_kiva__cython_speedups[] = "kiva._cython_speedups"; static const char __pyx_k_MemoryView_of_r_object[] = ""; static const char __pyx_k_MemoryView_of_r_at_0x_x[] = ""; static const char __pyx_k_contiguous_and_indirect[] = ""; -static const char __pyx_k_enable__cython_speedups[] = "enable._cython_speedups"; static const char __pyx_k_Cannot_index_with_type_s[] = "Cannot index with type '%s'"; static const char __pyx_k_points_in_polygon_line_6[] = "points_in_polygon (line 6)"; static const char __pyx_k_Invalid_shape_in_axis_d_d[] = "Invalid shape in axis %d: %d."; @@ -1361,7 +1361,7 @@ static const char __pyx_k_itemsize_0_for_cython_array[] = "itemsize <= 0 for cyt static const char __pyx_k_unable_to_allocate_array_data[] = "unable to allocate array data."; static const char __pyx_k_strided_and_direct_or_indirect[] = ""; static const char __pyx_k_Test_whether_point_pairs_in_pts[] = "Test whether point pairs in pts are within the polygon, poly_pts.\n\n Parameters\n ----------\n pts\n an Nx2 array of x,y point pairs (floating point). Each point is tested\n to determine whether it falls within the polygon defined by `poly_pts`.\n poly_pts\n an Mx2 array of x,y point pairs (floating point) that define the\n boundaries of a polygon. The last point is considered to be connected\n to the first point.\n return\n a 1D array of integers. 1 is returned if the corresponding x,y pair\n in `pts` falls within `poly_pts`. 0 is returned otherwise.\n\n This algorithm works for complex polygons.\n\n Note: If the test point is on the border of the polygon, this\n algorithm will deliver unpredictable results; i.e. the result\n may be \"inside\" or \"outside\" depending on arbitrary factors\n such as how the polygon is oriented with respect to the\n coordinate system.\n\n Adapted from: http://www.alienryderflex.com/polygon/\n\n Example::\n\n >>> import numpy as np\n >>> from enable import points_in_polygon\n >>> poly = np.array(((0.0, 0.0),\n (10.0, 0.0),\n (10.0, 10.0),\n (0.0, 10.0)))\n >>> pts = np.array(((-1.0, -1.0),\n (5.0, 5.0),\n (15.0, 15.0)))\n >>> results = points_in_polygon(pts, poly)\n [0 1 0]\n\n "; -static const char __pyx_k_Users_john_source_python_enthou[] = "/Users/john/source/python/enthought/ets/enable/enable/_cython_speedups.pyx"; +static const char __pyx_k_Users_john_source_python_enthou[] = "/Users/john/source/python/enthought/enable/kiva/_cython_speedups.pyx"; static const char __pyx_k_pts_must_be_an_Nx2_or_2xN_array[] = "pts must be an Nx2 or 2xN array"; static const char __pyx_k_Buffer_view_does_not_expose_stri[] = "Buffer view does not expose strides"; static const char __pyx_k_Can_only_create_a_buffer_that_is[] = "Can only create a buffer that is contiguous in memory."; @@ -1405,7 +1405,6 @@ static PyObject *__pyx_kp_s_contiguous_and_direct; static PyObject *__pyx_kp_s_contiguous_and_indirect; static PyObject *__pyx_n_s_dtype; static PyObject *__pyx_n_s_dtype_is_object; -static PyObject *__pyx_n_s_enable__cython_speedups; static PyObject *__pyx_n_s_encode; static PyObject *__pyx_n_s_enumerate; static PyObject *__pyx_n_s_error; @@ -1419,6 +1418,7 @@ static PyObject *__pyx_n_s_id; static PyObject *__pyx_n_s_import; static PyObject *__pyx_n_s_itemsize; static PyObject *__pyx_kp_s_itemsize_0_for_cython_array; +static PyObject *__pyx_n_s_kiva__cython_speedups; static PyObject *__pyx_n_s_main; static PyObject *__pyx_n_s_memview; static PyObject *__pyx_n_s_mode; @@ -1459,7 +1459,7 @@ static PyObject *__pyx_kp_s_unable_to_allocate_shape_and_str; static PyObject *__pyx_n_s_unpack; static PyObject *__pyx_n_s_use_winding; static PyObject *__pyx_n_s_zeros; -static PyObject *__pyx_pf_6enable_16_cython_speedups_points_in_polygon(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_pts, PyObject *__pyx_v_poly_pts, PyObject *__pyx_v_use_winding); /* proto */ +static PyObject *__pyx_pf_4kiva_16_cython_speedups_points_in_polygon(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_pts, PyObject *__pyx_v_poly_pts, PyObject *__pyx_v_use_winding); /* proto */ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, PyObject *__pyx_v_format, PyObject *__pyx_v_mode, int __pyx_v_allocate_buffer); /* proto */ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(struct __pyx_array_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */ static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *__pyx_v_self); /* proto */ @@ -1525,7 +1525,7 @@ static PyObject *__pyx_tuple__23; static PyObject *__pyx_tuple__24; static PyObject *__pyx_codeobj__19; -/* "enable/_cython_speedups.pyx":6 +/* "kiva/_cython_speedups.pyx":6 * * * def points_in_polygon(pts, poly_pts, use_winding=False): # <<<<<<<<<<<<<< @@ -1534,10 +1534,10 @@ static PyObject *__pyx_codeobj__19; */ /* Python wrapper */ -static PyObject *__pyx_pw_6enable_16_cython_speedups_1points_in_polygon(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_6enable_16_cython_speedups_points_in_polygon[] = "Test whether point pairs in pts are within the polygon, poly_pts.\n\n Parameters\n ----------\n pts\n an Nx2 array of x,y point pairs (floating point). Each point is tested\n to determine whether it falls within the polygon defined by `poly_pts`.\n poly_pts\n an Mx2 array of x,y point pairs (floating point) that define the\n boundaries of a polygon. The last point is considered to be connected\n to the first point.\n return\n a 1D array of integers. 1 is returned if the corresponding x,y pair\n in `pts` falls within `poly_pts`. 0 is returned otherwise.\n\n This algorithm works for complex polygons.\n\n Note: If the test point is on the border of the polygon, this\n algorithm will deliver unpredictable results; i.e. the result\n may be \"inside\" or \"outside\" depending on arbitrary factors\n such as how the polygon is oriented with respect to the\n coordinate system.\n\n Adapted from: http://www.alienryderflex.com/polygon/\n\n Example::\n\n >>> import numpy as np\n >>> from enable import points_in_polygon\n >>> poly = np.array(((0.0, 0.0),\n (10.0, 0.0),\n (10.0, 10.0),\n (0.0, 10.0)))\n >>> pts = np.array(((-1.0, -1.0),\n (5.0, 5.0),\n (15.0, 15.0)))\n >>> results = points_in_polygon(pts, poly)\n [0 1 0]\n\n "; -static PyMethodDef __pyx_mdef_6enable_16_cython_speedups_1points_in_polygon = {"points_in_polygon", (PyCFunction)__pyx_pw_6enable_16_cython_speedups_1points_in_polygon, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6enable_16_cython_speedups_points_in_polygon}; -static PyObject *__pyx_pw_6enable_16_cython_speedups_1points_in_polygon(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_4kiva_16_cython_speedups_1points_in_polygon(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4kiva_16_cython_speedups_points_in_polygon[] = "Test whether point pairs in pts are within the polygon, poly_pts.\n\n Parameters\n ----------\n pts\n an Nx2 array of x,y point pairs (floating point). Each point is tested\n to determine whether it falls within the polygon defined by `poly_pts`.\n poly_pts\n an Mx2 array of x,y point pairs (floating point) that define the\n boundaries of a polygon. The last point is considered to be connected\n to the first point.\n return\n a 1D array of integers. 1 is returned if the corresponding x,y pair\n in `pts` falls within `poly_pts`. 0 is returned otherwise.\n\n This algorithm works for complex polygons.\n\n Note: If the test point is on the border of the polygon, this\n algorithm will deliver unpredictable results; i.e. the result\n may be \"inside\" or \"outside\" depending on arbitrary factors\n such as how the polygon is oriented with respect to the\n coordinate system.\n\n Adapted from: http://www.alienryderflex.com/polygon/\n\n Example::\n\n >>> import numpy as np\n >>> from enable import points_in_polygon\n >>> poly = np.array(((0.0, 0.0),\n (10.0, 0.0),\n (10.0, 10.0),\n (0.0, 10.0)))\n >>> pts = np.array(((-1.0, -1.0),\n (5.0, 5.0),\n (15.0, 15.0)))\n >>> results = points_in_polygon(pts, poly)\n [0 1 0]\n\n "; +static PyMethodDef __pyx_mdef_4kiva_16_cython_speedups_1points_in_polygon = {"points_in_polygon", (PyCFunction)__pyx_pw_4kiva_16_cython_speedups_1points_in_polygon, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4kiva_16_cython_speedups_points_in_polygon}; +static PyObject *__pyx_pw_4kiva_16_cython_speedups_1points_in_polygon(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_pts = 0; PyObject *__pyx_v_poly_pts = 0; PyObject *__pyx_v_use_winding = 0; @@ -1594,18 +1594,18 @@ static PyObject *__pyx_pw_6enable_16_cython_speedups_1points_in_polygon(PyObject __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("points_in_polygon", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 6, __pyx_L3_error) __pyx_L3_error:; - __Pyx_AddTraceback("enable._cython_speedups.points_in_polygon", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("kiva._cython_speedups.points_in_polygon", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_6enable_16_cython_speedups_points_in_polygon(__pyx_self, __pyx_v_pts, __pyx_v_poly_pts, __pyx_v_use_winding); + __pyx_r = __pyx_pf_4kiva_16_cython_speedups_points_in_polygon(__pyx_self, __pyx_v_pts, __pyx_v_poly_pts, __pyx_v_use_winding); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_6enable_16_cython_speedups_points_in_polygon(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_pts, PyObject *__pyx_v_poly_pts, PyObject *__pyx_v_use_winding) { +static PyObject *__pyx_pf_4kiva_16_cython_speedups_points_in_polygon(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_pts, PyObject *__pyx_v_poly_pts, PyObject *__pyx_v_use_winding) { __Pyx_memviewslice __pyx_v_pts_view = { 0, 0, { 0 }, { 0 }, { 0 } }; __Pyx_memviewslice __pyx_v_poly_pts_view = { 0, 0, { 0 }, { 0 }, { 0 } }; __Pyx_memviewslice __pyx_v_results = { 0, 0, { 0 }, { 0 }, { 0 } }; @@ -1634,7 +1634,7 @@ static PyObject *__pyx_pf_6enable_16_cython_speedups_points_in_polygon(CYTHON_UN __Pyx_INCREF(__pyx_v_pts); __Pyx_INCREF(__pyx_v_poly_pts); - /* "enable/_cython_speedups.pyx":49 + /* "kiva/_cython_speedups.pyx":49 * * # Check the shape of pts and transpose if necessary. * pts = np.asarray(pts, dtype=np.float64) # <<<<<<<<<<<<<< @@ -1668,7 +1668,7 @@ static PyObject *__pyx_pf_6enable_16_cython_speedups_points_in_polygon(CYTHON_UN __Pyx_DECREF_SET(__pyx_v_pts, __pyx_t_5); __pyx_t_5 = 0; - /* "enable/_cython_speedups.pyx":50 + /* "kiva/_cython_speedups.pyx":50 * # Check the shape of pts and transpose if necessary. * pts = np.asarray(pts, dtype=np.float64) * if pts.ndim == 1: # <<<<<<<<<<<<<< @@ -1684,7 +1684,7 @@ static PyObject *__pyx_pf_6enable_16_cython_speedups_points_in_polygon(CYTHON_UN __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { - /* "enable/_cython_speedups.pyx":51 + /* "kiva/_cython_speedups.pyx":51 * pts = np.asarray(pts, dtype=np.float64) * if pts.ndim == 1: * pts = np.reshape(pts, (1,) + np.shape(pts)) # <<<<<<<<<<<<<< @@ -1759,7 +1759,7 @@ static PyObject *__pyx_pf_6enable_16_cython_speedups_points_in_polygon(CYTHON_UN __Pyx_DECREF_SET(__pyx_v_pts, __pyx_t_3); __pyx_t_3 = 0; - /* "enable/_cython_speedups.pyx":50 + /* "kiva/_cython_speedups.pyx":50 * # Check the shape of pts and transpose if necessary. * pts = np.asarray(pts, dtype=np.float64) * if pts.ndim == 1: # <<<<<<<<<<<<<< @@ -1768,7 +1768,7 @@ static PyObject *__pyx_pf_6enable_16_cython_speedups_points_in_polygon(CYTHON_UN */ } - /* "enable/_cython_speedups.pyx":52 + /* "kiva/_cython_speedups.pyx":52 * if pts.ndim == 1: * pts = np.reshape(pts, (1,) + np.shape(pts)) * if np.shape(pts)[1] != 2: # <<<<<<<<<<<<<< @@ -1814,7 +1814,7 @@ static PyObject *__pyx_pf_6enable_16_cython_speedups_points_in_polygon(CYTHON_UN __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { - /* "enable/_cython_speedups.pyx":53 + /* "kiva/_cython_speedups.pyx":53 * pts = np.reshape(pts, (1,) + np.shape(pts)) * if np.shape(pts)[1] != 2: * if np.shape(pts)[0] == 2: # <<<<<<<<<<<<<< @@ -1861,7 +1861,7 @@ static PyObject *__pyx_pf_6enable_16_cython_speedups_points_in_polygon(CYTHON_UN __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { - /* "enable/_cython_speedups.pyx":54 + /* "kiva/_cython_speedups.pyx":54 * if np.shape(pts)[1] != 2: * if np.shape(pts)[0] == 2: * pts = np.transpose(pts) # <<<<<<<<<<<<<< @@ -1901,7 +1901,7 @@ static PyObject *__pyx_pf_6enable_16_cython_speedups_points_in_polygon(CYTHON_UN __Pyx_DECREF_SET(__pyx_v_pts, __pyx_t_3); __pyx_t_3 = 0; - /* "enable/_cython_speedups.pyx":53 + /* "kiva/_cython_speedups.pyx":53 * pts = np.reshape(pts, (1,) + np.shape(pts)) * if np.shape(pts)[1] != 2: * if np.shape(pts)[0] == 2: # <<<<<<<<<<<<<< @@ -1911,7 +1911,7 @@ static PyObject *__pyx_pf_6enable_16_cython_speedups_points_in_polygon(CYTHON_UN goto __pyx_L5; } - /* "enable/_cython_speedups.pyx":56 + /* "kiva/_cython_speedups.pyx":56 * pts = np.transpose(pts) * else: * raise ValueError('pts must be an Nx2 or 2xN array') # <<<<<<<<<<<<<< @@ -1927,7 +1927,7 @@ static PyObject *__pyx_pf_6enable_16_cython_speedups_points_in_polygon(CYTHON_UN } __pyx_L5:; - /* "enable/_cython_speedups.pyx":52 + /* "kiva/_cython_speedups.pyx":52 * if pts.ndim == 1: * pts = np.reshape(pts, (1,) + np.shape(pts)) * if np.shape(pts)[1] != 2: # <<<<<<<<<<<<<< @@ -1936,7 +1936,7 @@ static PyObject *__pyx_pf_6enable_16_cython_speedups_points_in_polygon(CYTHON_UN */ } - /* "enable/_cython_speedups.pyx":59 + /* "kiva/_cython_speedups.pyx":59 * * # Check the shape of poly_pts and transpose if necessary * poly_pts = np.asarray(poly_pts, dtype=np.float64) # <<<<<<<<<<<<<< @@ -1970,7 +1970,7 @@ static PyObject *__pyx_pf_6enable_16_cython_speedups_points_in_polygon(CYTHON_UN __Pyx_DECREF_SET(__pyx_v_poly_pts, __pyx_t_5); __pyx_t_5 = 0; - /* "enable/_cython_speedups.pyx":60 + /* "kiva/_cython_speedups.pyx":60 * # Check the shape of poly_pts and transpose if necessary * poly_pts = np.asarray(poly_pts, dtype=np.float64) * if poly_pts.ndim == 1: # <<<<<<<<<<<<<< @@ -1986,7 +1986,7 @@ static PyObject *__pyx_pf_6enable_16_cython_speedups_points_in_polygon(CYTHON_UN __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (__pyx_t_6) { - /* "enable/_cython_speedups.pyx":61 + /* "kiva/_cython_speedups.pyx":61 * poly_pts = np.asarray(poly_pts, dtype=np.float64) * if poly_pts.ndim == 1: * poly_pts = np.reshape(poly_pts, (1,) + np.shape(poly_pts)) # <<<<<<<<<<<<<< @@ -2061,7 +2061,7 @@ static PyObject *__pyx_pf_6enable_16_cython_speedups_points_in_polygon(CYTHON_UN __Pyx_DECREF_SET(__pyx_v_poly_pts, __pyx_t_7); __pyx_t_7 = 0; - /* "enable/_cython_speedups.pyx":60 + /* "kiva/_cython_speedups.pyx":60 * # Check the shape of poly_pts and transpose if necessary * poly_pts = np.asarray(poly_pts, dtype=np.float64) * if poly_pts.ndim == 1: # <<<<<<<<<<<<<< @@ -2070,7 +2070,7 @@ static PyObject *__pyx_pf_6enable_16_cython_speedups_points_in_polygon(CYTHON_UN */ } - /* "enable/_cython_speedups.pyx":62 + /* "kiva/_cython_speedups.pyx":62 * if poly_pts.ndim == 1: * poly_pts = np.reshape(poly_pts, (1,) + np.shape(poly_pts)) * if np.shape(poly_pts)[1] != 2: # <<<<<<<<<<<<<< @@ -2116,7 +2116,7 @@ static PyObject *__pyx_pf_6enable_16_cython_speedups_points_in_polygon(CYTHON_UN __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (__pyx_t_6) { - /* "enable/_cython_speedups.pyx":63 + /* "kiva/_cython_speedups.pyx":63 * poly_pts = np.reshape(poly_pts, (1,) + np.shape(poly_pts)) * if np.shape(poly_pts)[1] != 2: * if np.shape(poly_pts)[0] == 2: # <<<<<<<<<<<<<< @@ -2163,7 +2163,7 @@ static PyObject *__pyx_pf_6enable_16_cython_speedups_points_in_polygon(CYTHON_UN __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (__pyx_t_6) { - /* "enable/_cython_speedups.pyx":64 + /* "kiva/_cython_speedups.pyx":64 * if np.shape(poly_pts)[1] != 2: * if np.shape(poly_pts)[0] == 2: * poly_pts = np.transpose(poly_pts) # <<<<<<<<<<<<<< @@ -2203,7 +2203,7 @@ static PyObject *__pyx_pf_6enable_16_cython_speedups_points_in_polygon(CYTHON_UN __Pyx_DECREF_SET(__pyx_v_poly_pts, __pyx_t_7); __pyx_t_7 = 0; - /* "enable/_cython_speedups.pyx":63 + /* "kiva/_cython_speedups.pyx":63 * poly_pts = np.reshape(poly_pts, (1,) + np.shape(poly_pts)) * if np.shape(poly_pts)[1] != 2: * if np.shape(poly_pts)[0] == 2: # <<<<<<<<<<<<<< @@ -2213,7 +2213,7 @@ static PyObject *__pyx_pf_6enable_16_cython_speedups_points_in_polygon(CYTHON_UN goto __pyx_L8; } - /* "enable/_cython_speedups.pyx":66 + /* "kiva/_cython_speedups.pyx":66 * poly_pts = np.transpose(poly_pts) * else: * raise ValueError('poly_pts must be an Nx2 or 2xN array') # <<<<<<<<<<<<<< @@ -2229,7 +2229,7 @@ static PyObject *__pyx_pf_6enable_16_cython_speedups_points_in_polygon(CYTHON_UN } __pyx_L8:; - /* "enable/_cython_speedups.pyx":62 + /* "kiva/_cython_speedups.pyx":62 * if poly_pts.ndim == 1: * poly_pts = np.reshape(poly_pts, (1,) + np.shape(poly_pts)) * if np.shape(poly_pts)[1] != 2: # <<<<<<<<<<<<<< @@ -2238,7 +2238,7 @@ static PyObject *__pyx_pf_6enable_16_cython_speedups_points_in_polygon(CYTHON_UN */ } - /* "enable/_cython_speedups.pyx":68 + /* "kiva/_cython_speedups.pyx":68 * raise ValueError('poly_pts must be an Nx2 or 2xN array') * * cdef double[:, ::1] pts_view = pts # <<<<<<<<<<<<<< @@ -2251,7 +2251,7 @@ static PyObject *__pyx_pf_6enable_16_cython_speedups_points_in_polygon(CYTHON_UN __pyx_t_9.memview = NULL; __pyx_t_9.data = NULL; - /* "enable/_cython_speedups.pyx":69 + /* "kiva/_cython_speedups.pyx":69 * * cdef double[:, ::1] pts_view = pts * cdef double[:, ::1] poly_pts_view = poly_pts # <<<<<<<<<<<<<< @@ -2264,7 +2264,7 @@ static PyObject *__pyx_pf_6enable_16_cython_speedups_points_in_polygon(CYTHON_UN __pyx_t_9.memview = NULL; __pyx_t_9.data = NULL; - /* "enable/_cython_speedups.pyx":70 + /* "kiva/_cython_speedups.pyx":70 * cdef double[:, ::1] pts_view = pts * cdef double[:, ::1] poly_pts_view = poly_pts * cdef uint8_t[::1] results = np.zeros(len(pts), dtype=np.uint8) # <<<<<<<<<<<<<< @@ -2305,7 +2305,7 @@ static PyObject *__pyx_pf_6enable_16_cython_speedups_points_in_polygon(CYTHON_UN __pyx_t_10.memview = NULL; __pyx_t_10.data = NULL; - /* "enable/_cython_speedups.pyx":72 + /* "kiva/_cython_speedups.pyx":72 * cdef uint8_t[::1] results = np.zeros(len(pts), dtype=np.uint8) * * if use_winding: # <<<<<<<<<<<<<< @@ -2315,7 +2315,7 @@ static PyObject *__pyx_pf_6enable_16_cython_speedups_points_in_polygon(CYTHON_UN __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_use_winding); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 72, __pyx_L1_error) if (__pyx_t_6) { - /* "enable/_cython_speedups.pyx":73 + /* "kiva/_cython_speedups.pyx":73 * * if use_winding: * _hit_test.points_in_polygon_winding(&pts_view[0][0], pts_view.shape[0], # <<<<<<<<<<<<<< @@ -2353,7 +2353,7 @@ __pyx_t_12 = 0; __PYX_ERR(0, 73, __pyx_L1_error) } - /* "enable/_cython_speedups.pyx":74 + /* "kiva/_cython_speedups.pyx":74 * if use_winding: * _hit_test.points_in_polygon_winding(&pts_view[0][0], pts_view.shape[0], * &poly_pts_view[0][0], # <<<<<<<<<<<<<< @@ -2391,7 +2391,7 @@ __pyx_t_15 = 0; __PYX_ERR(0, 74, __pyx_L1_error) } - /* "enable/_cython_speedups.pyx":76 + /* "kiva/_cython_speedups.pyx":76 * &poly_pts_view[0][0], * poly_pts_view.shape[0], * &results[0], results.shape[0]) # <<<<<<<<<<<<<< @@ -2409,18 +2409,18 @@ __pyx_t_15 = 0; __PYX_ERR(0, 76, __pyx_L1_error) } - /* "enable/_cython_speedups.pyx":73 + /* "kiva/_cython_speedups.pyx":73 * * if use_winding: * _hit_test.points_in_polygon_winding(&pts_view[0][0], pts_view.shape[0], # <<<<<<<<<<<<<< * &poly_pts_view[0][0], * poly_pts_view.shape[0], */ - enable::points_in_polygon_winding((&(*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_t_11.data) + __pyx_t_12)) )))), (__pyx_v_pts_view.shape[0]), (&(*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_t_14.data) + __pyx_t_15)) )))), (__pyx_v_poly_pts_view.shape[0]), (&(*((uint8_t *) ( /* dim=0 */ ((char *) (((uint8_t *) __pyx_v_results.data) + __pyx_t_16)) )))), (__pyx_v_results.shape[0])); + kiva::points_in_polygon_winding((&(*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_t_11.data) + __pyx_t_12)) )))), (__pyx_v_pts_view.shape[0]), (&(*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_t_14.data) + __pyx_t_15)) )))), (__pyx_v_poly_pts_view.shape[0]), (&(*((uint8_t *) ( /* dim=0 */ ((char *) (((uint8_t *) __pyx_v_results.data) + __pyx_t_16)) )))), (__pyx_v_results.shape[0])); __PYX_XDEC_MEMVIEW(&__pyx_t_11, 1); __PYX_XDEC_MEMVIEW(&__pyx_t_14, 1); - /* "enable/_cython_speedups.pyx":72 + /* "kiva/_cython_speedups.pyx":72 * cdef uint8_t[::1] results = np.zeros(len(pts), dtype=np.uint8) * * if use_winding: # <<<<<<<<<<<<<< @@ -2430,7 +2430,7 @@ __pyx_t_15 = 0; goto __pyx_L9; } - /* "enable/_cython_speedups.pyx":78 + /* "kiva/_cython_speedups.pyx":78 * &results[0], results.shape[0]) * else: * _hit_test.points_in_polygon(&pts_view[0][0], pts_view.shape[0], # <<<<<<<<<<<<<< @@ -2469,7 +2469,7 @@ __pyx_t_17 = 0; __PYX_ERR(0, 78, __pyx_L1_error) } - /* "enable/_cython_speedups.pyx":79 + /* "kiva/_cython_speedups.pyx":79 * else: * _hit_test.points_in_polygon(&pts_view[0][0], pts_view.shape[0], * &poly_pts_view[0][0], # <<<<<<<<<<<<<< @@ -2507,7 +2507,7 @@ __pyx_t_18 = 0; __PYX_ERR(0, 79, __pyx_L1_error) } - /* "enable/_cython_speedups.pyx":81 + /* "kiva/_cython_speedups.pyx":81 * &poly_pts_view[0][0], * poly_pts_view.shape[0], * &results[0], results.shape[0]) # <<<<<<<<<<<<<< @@ -2525,20 +2525,20 @@ __pyx_t_18 = 0; __PYX_ERR(0, 81, __pyx_L1_error) } - /* "enable/_cython_speedups.pyx":78 + /* "kiva/_cython_speedups.pyx":78 * &results[0], results.shape[0]) * else: * _hit_test.points_in_polygon(&pts_view[0][0], pts_view.shape[0], # <<<<<<<<<<<<<< * &poly_pts_view[0][0], * poly_pts_view.shape[0], */ - enable::points_in_polygon((&(*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_t_14.data) + __pyx_t_17)) )))), (__pyx_v_pts_view.shape[0]), (&(*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_t_11.data) + __pyx_t_18)) )))), (__pyx_v_poly_pts_view.shape[0]), (&(*((uint8_t *) ( /* dim=0 */ ((char *) (((uint8_t *) __pyx_v_results.data) + __pyx_t_19)) )))), (__pyx_v_results.shape[0])); + kiva::points_in_polygon((&(*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_t_14.data) + __pyx_t_17)) )))), (__pyx_v_pts_view.shape[0]), (&(*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_t_11.data) + __pyx_t_18)) )))), (__pyx_v_poly_pts_view.shape[0]), (&(*((uint8_t *) ( /* dim=0 */ ((char *) (((uint8_t *) __pyx_v_results.data) + __pyx_t_19)) )))), (__pyx_v_results.shape[0])); __PYX_XDEC_MEMVIEW(&__pyx_t_14, 1); __PYX_XDEC_MEMVIEW(&__pyx_t_11, 1); } __pyx_L9:; - /* "enable/_cython_speedups.pyx":83 + /* "kiva/_cython_speedups.pyx":83 * &results[0], results.shape[0]) * * return results.base.astype(np.bool_) # <<<<<<<<<<<<<< @@ -2587,7 +2587,7 @@ __pyx_t_18 = 0; __pyx_t_5 = 0; goto __pyx_L0; - /* "enable/_cython_speedups.pyx":6 + /* "kiva/_cython_speedups.pyx":6 * * * def points_in_polygon(pts, poly_pts, use_winding=False): # <<<<<<<<<<<<<< @@ -2607,7 +2607,7 @@ __pyx_t_18 = 0; __PYX_XDEC_MEMVIEW(&__pyx_t_10, 1); __PYX_XDEC_MEMVIEW(&__pyx_t_11, 1); __PYX_XDEC_MEMVIEW(&__pyx_t_14, 1); - __Pyx_AddTraceback("enable._cython_speedups.points_in_polygon", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("kiva._cython_speedups.points_in_polygon", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __PYX_XDEC_MEMVIEW(&__pyx_v_pts_view, 1); @@ -14315,7 +14315,7 @@ static PyBufferProcs __pyx_tp_as_buffer_array = { static PyTypeObject __pyx_type___pyx_array = { PyVarObject_HEAD_INIT(0, 0) - "enable._cython_speedups.array", /*tp_name*/ + "kiva._cython_speedups.array", /*tp_name*/ sizeof(struct __pyx_array_obj), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc_array, /*tp_dealloc*/ @@ -14421,7 +14421,7 @@ static PyMethodDef __pyx_methods_Enum[] = { static PyTypeObject __pyx_type___pyx_MemviewEnum = { PyVarObject_HEAD_INIT(0, 0) - "enable._cython_speedups.Enum", /*tp_name*/ + "kiva._cython_speedups.Enum", /*tp_name*/ sizeof(struct __pyx_MemviewEnum_obj), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc_Enum, /*tp_dealloc*/ @@ -14668,7 +14668,7 @@ static PyBufferProcs __pyx_tp_as_buffer_memoryview = { static PyTypeObject __pyx_type___pyx_memoryview = { PyVarObject_HEAD_INIT(0, 0) - "enable._cython_speedups.memoryview", /*tp_name*/ + "kiva._cython_speedups.memoryview", /*tp_name*/ sizeof(struct __pyx_memoryview_obj), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc_memoryview, /*tp_dealloc*/ @@ -14793,7 +14793,7 @@ static struct PyGetSetDef __pyx_getsets__memoryviewslice[] = { static PyTypeObject __pyx_type___pyx_memoryviewslice = { PyVarObject_HEAD_INIT(0, 0) - "enable._cython_speedups._memoryviewslice", /*tp_name*/ + "kiva._cython_speedups._memoryviewslice", /*tp_name*/ sizeof(struct __pyx_memoryviewslice_obj), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc__memoryviewslice, /*tp_dealloc*/ @@ -14912,7 +14912,6 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_kp_s_contiguous_and_indirect, __pyx_k_contiguous_and_indirect, sizeof(__pyx_k_contiguous_and_indirect), 0, 0, 1, 0}, {&__pyx_n_s_dtype, __pyx_k_dtype, sizeof(__pyx_k_dtype), 0, 0, 1, 1}, {&__pyx_n_s_dtype_is_object, __pyx_k_dtype_is_object, sizeof(__pyx_k_dtype_is_object), 0, 0, 1, 1}, - {&__pyx_n_s_enable__cython_speedups, __pyx_k_enable__cython_speedups, sizeof(__pyx_k_enable__cython_speedups), 0, 0, 1, 1}, {&__pyx_n_s_encode, __pyx_k_encode, sizeof(__pyx_k_encode), 0, 0, 1, 1}, {&__pyx_n_s_enumerate, __pyx_k_enumerate, sizeof(__pyx_k_enumerate), 0, 0, 1, 1}, {&__pyx_n_s_error, __pyx_k_error, sizeof(__pyx_k_error), 0, 0, 1, 1}, @@ -14926,6 +14925,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1}, {&__pyx_n_s_itemsize, __pyx_k_itemsize, sizeof(__pyx_k_itemsize), 0, 0, 1, 1}, {&__pyx_kp_s_itemsize_0_for_cython_array, __pyx_k_itemsize_0_for_cython_array, sizeof(__pyx_k_itemsize_0_for_cython_array), 0, 0, 1, 0}, + {&__pyx_n_s_kiva__cython_speedups, __pyx_k_kiva__cython_speedups, sizeof(__pyx_k_kiva__cython_speedups), 0, 0, 1, 1}, {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1}, {&__pyx_n_s_memview, __pyx_k_memview, sizeof(__pyx_k_memview), 0, 0, 1, 1}, {&__pyx_n_s_mode, __pyx_k_mode, sizeof(__pyx_k_mode), 0, 0, 1, 1}, @@ -14986,7 +14986,7 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); - /* "enable/_cython_speedups.pyx":51 + /* "kiva/_cython_speedups.pyx":51 * pts = np.asarray(pts, dtype=np.float64) * if pts.ndim == 1: * pts = np.reshape(pts, (1,) + np.shape(pts)) # <<<<<<<<<<<<<< @@ -14997,7 +14997,7 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GOTREF(__pyx_tuple_); __Pyx_GIVEREF(__pyx_tuple_); - /* "enable/_cython_speedups.pyx":56 + /* "kiva/_cython_speedups.pyx":56 * pts = np.transpose(pts) * else: * raise ValueError('pts must be an Nx2 or 2xN array') # <<<<<<<<<<<<<< @@ -15008,7 +15008,7 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GOTREF(__pyx_tuple__2); __Pyx_GIVEREF(__pyx_tuple__2); - /* "enable/_cython_speedups.pyx":61 + /* "kiva/_cython_speedups.pyx":61 * poly_pts = np.asarray(poly_pts, dtype=np.float64) * if poly_pts.ndim == 1: * poly_pts = np.reshape(poly_pts, (1,) + np.shape(poly_pts)) # <<<<<<<<<<<<<< @@ -15019,7 +15019,7 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GOTREF(__pyx_tuple__3); __Pyx_GIVEREF(__pyx_tuple__3); - /* "enable/_cython_speedups.pyx":66 + /* "kiva/_cython_speedups.pyx":66 * poly_pts = np.transpose(poly_pts) * else: * raise ValueError('poly_pts must be an Nx2 or 2xN array') # <<<<<<<<<<<<<< @@ -15176,7 +15176,7 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GOTREF(__pyx_tuple__17); __Pyx_GIVEREF(__pyx_tuple__17); - /* "enable/_cython_speedups.pyx":6 + /* "kiva/_cython_speedups.pyx":6 * * * def points_in_polygon(pts, poly_pts, use_winding=False): # <<<<<<<<<<<<<< @@ -15326,14 +15326,14 @@ PyMODINIT_FUNC PyInit__cython_speedups(void) #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT) if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif - if (__pyx_module_is_main_enable___cython_speedups) { + if (__pyx_module_is_main_kiva___cython_speedups) { if (PyObject_SetAttrString(__pyx_m, "__name__", __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error) } #if PY_MAJOR_VERSION >= 3 { PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error) - if (!PyDict_GetItemString(modules, "enable._cython_speedups")) { - if (unlikely(PyDict_SetItemString(modules, "enable._cython_speedups", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error) + if (!PyDict_GetItemString(modules, "kiva._cython_speedups")) { + if (unlikely(PyDict_SetItemString(modules, "kiva._cython_speedups", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error) } } #endif @@ -15388,7 +15388,7 @@ PyMODINIT_FUNC PyInit__cython_speedups(void) if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif - /* "enable/_cython_speedups.pyx":2 + /* "kiva/_cython_speedups.pyx":2 * from libc.stdint cimport uint8_t * import numpy as np # <<<<<<<<<<<<<< * cimport _hit_test @@ -15399,19 +15399,19 @@ PyMODINIT_FUNC PyInit__cython_speedups(void) if (PyDict_SetItem(__pyx_d, __pyx_n_s_np, __pyx_t_1) < 0) __PYX_ERR(0, 2, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "enable/_cython_speedups.pyx":6 + /* "kiva/_cython_speedups.pyx":6 * * * def points_in_polygon(pts, poly_pts, use_winding=False): # <<<<<<<<<<<<<< * """Test whether point pairs in pts are within the polygon, poly_pts. * */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6enable_16_cython_speedups_1points_in_polygon, NULL, __pyx_n_s_enable__cython_speedups); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 6, __pyx_L1_error) + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4kiva_16_cython_speedups_1points_in_polygon, NULL, __pyx_n_s_kiva__cython_speedups); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 6, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_points_in_polygon, __pyx_t_1) < 0) __PYX_ERR(0, 6, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "enable/_cython_speedups.pyx":1 + /* "kiva/_cython_speedups.pyx":1 * from libc.stdint cimport uint8_t # <<<<<<<<<<<<<< * import numpy as np * cimport _hit_test @@ -15572,11 +15572,11 @@ PyMODINIT_FUNC PyInit__cython_speedups(void) __Pyx_XDECREF(__pyx_t_1); if (__pyx_m) { if (__pyx_d) { - __Pyx_AddTraceback("init enable._cython_speedups", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("init kiva._cython_speedups", __pyx_clineno, __pyx_lineno, __pyx_filename); } Py_DECREF(__pyx_m); __pyx_m = 0; } else if (!PyErr_Occurred()) { - PyErr_SetString(PyExc_ImportError, "init enable._cython_speedups"); + PyErr_SetString(PyExc_ImportError, "init kiva._cython_speedups"); } __pyx_L0:; __Pyx_RefNannyFinishContext(); diff --git a/enable/_cython_speedups.pyx b/kiva/_cython_speedups.pyx similarity index 100% rename from enable/_cython_speedups.pyx rename to kiva/_cython_speedups.pyx diff --git a/enable/_hit_test.cpp b/kiva/_hit_test.cpp similarity index 99% rename from enable/_hit_test.cpp rename to kiva/_hit_test.cpp index 3d425885d..f9be2e411 100644 --- a/enable/_hit_test.cpp +++ b/kiva/_hit_test.cpp @@ -1,6 +1,6 @@ #include "_hit_test.h" -namespace enable +namespace kiva { // Adapted from: http://www.alienryderflex.com/polygon/ // diff --git a/enable/_hit_test.h b/kiva/_hit_test.h similarity index 89% rename from enable/_hit_test.h rename to kiva/_hit_test.h index 2dbda67ec..f8e37d8ea 100644 --- a/enable/_hit_test.h +++ b/kiva/_hit_test.h @@ -1,7 +1,7 @@ -#ifndef ENABLE_HIT_TEST_H -#define ENABLE_HIT_TEST_H +#ifndef KIVA_HIT_TEST_H +#define KIVA_HIT_TEST_H -namespace enable +namespace kiva { bool point_in_polygon(double x, double y, double* poly_pts, int Npoly_pts); diff --git a/enable/_hit_test.pxd b/kiva/_hit_test.pxd similarity index 88% rename from enable/_hit_test.pxd rename to kiva/_hit_test.pxd index ec8e2baa1..ac2ff6d96 100644 --- a/enable/_hit_test.pxd +++ b/kiva/_hit_test.pxd @@ -1,6 +1,6 @@ -cdef extern from "_hit_test.h" namespace "enable": +cdef extern from "_hit_test.h" namespace "kiva": void points_in_polygon(double* pts, int Npts, double* poly_pts, int Npoly_pts, unsigned char* results, int Nresults) diff --git a/kiva/api.py b/kiva/api.py new file mode 100644 index 000000000..074561e8c --- /dev/null +++ b/kiva/api.py @@ -0,0 +1,23 @@ +# flake8: noqa +from .affine import ( + affine_identity, affine_from_values, affine_from_scale, + affine_from_rotation, affine_from_translation, + scale, rotate, translate, concat, invert, is_identity, affine_params, + tsr_factor, trs_factor, transform_point, transform_points, IDENTITY +) +from .constants import ( + NO_DASH, CAP_ROUND, CAP_BUTT, CAP_SQUARE, + JOIN_ROUND, JOIN_BEVEL, JOIN_MITER, + FILL, EOF_FILL, STROKE, FILL_STROKE, EOF_FILL_STROKE, + NORMAL, BOLD, ITALIC, BOLD_ITALIC, DEFAULT, + SWISS, ROMAN, MODERN, DECORATIVE, SCRIPT, TELETYPE, + TEXT_FILL, TEXT_STROKE, TEXT_FILL_STROKE, TEXT_INVISIBLE, TEXT_FILL_CLIP, + TEXT_STROKE_CLIP, TEXT_FILL_STROKE_CLIP, TEXT_CLIP, TEXT_OUTLINE, + POINT, LINE, LINES, RECT, CLOSE, CURVE_TO, QUAD_CURVE_TO, ARC, ARC_TO, + SCALE_CTM, TRANSLATE_CTM, ROTATE_CTM, CONCAT_CTM, LOAD_CTM, + NO_MARKER, SQUARE_MARKER, DIAMOND_MARKER, CIRCLE_MARKER, + CROSSED_CIRCLE_MARKER, CROSS_MARKER, TRIANGLE_MARKER, + INVERTED_TRIANGLE_MARKER, PLUS_MARKER, DOT_MARKER, PIXEL_MARKER +) +from ._cython_speedups import points_in_polygon +from .fonttools import Font diff --git a/kiva/setup.py b/kiva/setup.py index d82e8c3ab..dbe3c2921 100644 --- a/kiva/setup.py +++ b/kiva/setup.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -#------------------------------------------------------------------------------ +# ----------------------------------------------------------------------------- # Copyright (c) 2005, Enthought, Inc. # All rights reserved. # @@ -11,10 +11,11 @@ # # Author: Enthought, Inc. # Description: -#------------------------------------------------------------------------------ +# ----------------------------------------------------------------------------- import sys -import os + +from numpy import get_include def configuration(parent_package=None, top_path=None): @@ -39,4 +40,8 @@ def configuration(parent_package=None, top_path=None): config.get_version() + ext_sources = ['_cython_speedups.cpp', '_hit_test.cpp'] + config.add_extension('kiva._cython_speedups', sources=ext_sources, + include_dirs=['.', get_include()]) + return config diff --git a/enable/tests/points_in_polygon_test.py b/kiva/tests/points_in_polygon_test.py similarity index 98% rename from enable/tests/points_in_polygon_test.py rename to kiva/tests/points_in_polygon_test.py index 3663752d2..8efea2a8a 100644 --- a/enable/tests/points_in_polygon_test.py +++ b/kiva/tests/points_in_polygon_test.py @@ -2,7 +2,7 @@ from numpy import array, allclose -from enable.api import points_in_polygon +from kiva.api import points_in_polygon class TestPointsInPolygon(unittest.TestCase): diff --git a/setup.py b/setup.py index a0292c7f2..a2476b20e 100644 --- a/setup.py +++ b/setup.py @@ -32,7 +32,6 @@ import shutil import subprocess -from numpy import get_include from numpy.distutils.core import setup from numpy.distutils.misc_util import is_string @@ -136,10 +135,6 @@ def configuration(parent_package='', top_path=None): quiet=True, ) - ext_sources = ['enable/_cython_speedups.cpp', 'enable/_hit_test.cpp'] - config.add_extension('enable._cython_speedups', sources=ext_sources, - include_dirs=['enable', get_include()]) - config.add_subpackage('kiva') return config