Skip to content

Commit 2e70b60

Browse files
author
peng.li24
committed
refactor(tests): update module.cpp to use shapely_py::detail
1 parent db65c20 commit 2e70b60

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

tests/module.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,13 @@
1717
namespace py = pybind11;
1818
using namespace shapely::geometry;
1919
using namespace shapely_py;
20+
using namespace shapely_py::detail;
2021

2122
// Re-export native_to_array for module-local use (templated)
2223
namespace {
2324
template <typename T>
2425
py::array_t<T> _native_to_array(const T* data, size_t rows, size_t cols) {
25-
return shapely_py::native_to_array(data, rows, cols);
26+
return shapely_py::detail::native_to_array(data, rows, cols);
2627
}
2728
}
2829

@@ -385,11 +386,14 @@ PYBIND11_MODULE(shapelycpp, m) {
385386
m.def("intersects_polygon_polygon", &intersects_poly_poly);
386387

387388
// ======================================================================
388-
// Project / interpolate (from pycpp)
389+
// Project / interpolate (inlined from pycpp — no standalone helpers)
389390
// ======================================================================
390-
m.def("project_linestring_point", &project_ls_pt);
391+
m.def("project_linestring_point", [](const LineString<double>& l, const Point<double>& p) {
392+
return l.project(p);
393+
}, py::arg("ls"), py::arg("pt"));
391394
m.def("interpolate_linestring", [](const LineString<double>& ls, double dist, bool normalized) {
392-
return interpolate_ls(ls, dist, normalized);
395+
auto r = ls.interpolate(dist, normalized);
396+
return std::make_tuple(r.x, r.y);
393397
}, py::arg("ls"), py::arg("distance"), py::arg("normalized") = false);
394398

395399
// ======================================================================

0 commit comments

Comments
 (0)