File tree Expand file tree Collapse file tree 3 files changed +6
-16
lines changed
Expand file tree Collapse file tree 3 files changed +6
-16
lines changed Original file line number Diff line number Diff line change @@ -184,9 +184,6 @@ PyArrayObject* viewToNumpyArray(PointViewPtr view)
184184
185185std::vector<PyArrayObject*> PyPipelineExecutor::getArrays () const
186186{
187- if (!executed ())
188- throw python_error (" call execute() before fetching arrays" );
189-
190187 std::vector<PyArrayObject*> output;
191188 for (auto view: getManagerConst ().views ())
192189 output.push_back (viewToNumpyArray (view));
@@ -248,9 +245,6 @@ PyArrayObject* meshToNumpyArray(const TriangularMesh* mesh)
248245
249246std::vector<PyArrayObject*> PyPipelineExecutor::getMeshes () const
250247{
251- if (!executed ())
252- throw python_error (" call execute() before fetching the mesh" );
253-
254248 std::vector<PyArrayObject*> output;
255249 for (auto view: getManagerConst ().views ())
256250 output.push_back (meshToNumpyArray (view->mesh ()));
Original file line number Diff line number Diff line change @@ -45,20 +45,11 @@ namespace python
4545
4646class Array ;
4747
48- class python_error : public std ::runtime_error
49- {
50- public:
51- inline python_error (std::string const & msg) : std::runtime_error(msg)
52- {}
53- };
54-
5548class PyPipelineExecutor : public PipelineExecutor
5649{
5750public:
5851 PyPipelineExecutor (std::string const & json);
59- PyPipelineExecutor (std::string const & json,
60- std::vector<pdal::python::Array*> arrays);
61-
52+ PyPipelineExecutor (std::string const & json, std::vector<Array*> arrays);
6253 std::vector<PyArrayObject*> getArrays () const ;
6354 std::vector<PyArrayObject*> getMeshes () const ;
6455};
Original file line number Diff line number Diff line change @@ -64,6 +64,7 @@ cdef extern from "PyPipeline.hpp" namespace "pdal::python":
6464 cdef cppclass PyPipelineExecutor:
6565 PyPipelineExecutor(const char * ) except +
6666 PyPipelineExecutor(const char * , vector[Array* ]& ) except +
67+ bool executed() except +
6768 int64_t execute() except +
6869 bool validate() except +
6970 string getPipeline() except +
@@ -117,10 +118,14 @@ cdef class Pipeline:
117118
118119 property arrays :
119120 def __get__ (self ):
121+ if not self ._executor.executed():
122+ raise RuntimeError (" call execute() before fetching arrays" )
120123 return self ._vector_to_list(self ._executor.getArrays())
121124
122125 property meshes :
123126 def __get__ (self ):
127+ if not self ._executor.executed():
128+ raise RuntimeError (" call execute() before fetching the mesh" )
124129 return self ._vector_to_list(self ._executor.getMeshes())
125130
126131 def execute (self ):
You can’t perform that action at this time.
0 commit comments