Skip to content

Commit

Permalink
GmMultiPolyIntersector for python - fix CI errors
Browse files Browse the repository at this point in the history
  • Loading branch information
mkennard-aquaveo committed Jan 3, 2024
1 parent cae84ca commit ac3e692
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions xmsgrid/python/geometry/GmMultiPolyIntersector_py.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include <pybind11/pybind11.h>
#include <pybind11/numpy.h> // Needed for PyUtils.h

#include <xmscore/misc/boost_defines.h>
#include <xmscore/python/misc/PyUtils.h>
#include <xmsgrid/geometry/GmMultiPolyIntersector.h>
#include <xmsgrid/geometry/GmMultiPolyIntersectionSorterTerse.h>
Expand All @@ -19,23 +20,21 @@
namespace py = pybind11;

//----- Python Interface -------------------------------------------------------
PYBIND11_DECLARE_HOLDER_TYPE(T, boost::shared_ptr<T>);
PYBIND11_DECLARE_HOLDER_TYPE(T, BSHP<T>);

void initGmMultiPolyIntersector(py::module &m) {
// GmMultiPolyIntersector class
py::class_<xms::GmMultiPolyIntersector, boost::shared_ptr<xms::GmMultiPolyIntersector>>
gmMpi(m, "GmMultiPolyIntersector");
py::class_<xms::GmMultiPolyIntersector, BSHP<xms::GmMultiPolyIntersector>> gmMpi(m, "GmMultiPolyIntersector");

// ---------------------------------------------------------------------------
// function: init
// ---------------------------------------------------------------------------
gmMpi.def(py::init([](py::iterable points, py::iterable polys, int starting_id,
const std::string& query) {
boost::shared_ptr<xms::VecPt3d> vec_pts = xms::VecPt3dFromPyIter(points);
boost::shared_ptr<xms::VecInt2d> vec_polys = xms::VecInt2dFromPyIter(polys);
boost::shared_ptr<xms::GmMultiPolyIntersectionSorterTerse> sorter(new xms::GmMultiPolyIntersectionSorterTerse);
boost::shared_ptr<xms::GmMultiPolyIntersector> rval(xms::GmMultiPolyIntersector::New(vec_pts, vec_polys, sorter,
starting_id));
BSHP<xms::VecPt3d> vec_pts = xms::VecPt3dFromPyIter(points);
BSHP<xms::VecInt2d> vec_polys = xms::VecInt2dFromPyIter(polys);
BSHP<xms::GmMultiPolyIntersectionSorterTerse> sorter(new xms::GmMultiPolyIntersectionSorterTerse);
BSHP<xms::GmMultiPolyIntersector> rval(xms::GmMultiPolyIntersector::New(*vec_pts, *vec_polys, sorter, starting_id));
rval->SetQuery(query);
return rval;
}), py::arg("points"), py::arg("polys"), py::arg("starting_id") = 1, py::arg("query") = 'covered_by')
Expand Down

0 comments on commit ac3e692

Please sign in to comment.