2.12.2021, 9:00 - 11:00: Due to updates GitLab may be unavailable for some minutes between 09:00 and 11:00.

Commit bbed0142 authored by Christian Schulte zu Berge's avatar Christian Schulte zu Berge
Browse files

Added Lua bindings for ProcessorFactory and PipelineFactory. Updated signature...

Added Lua bindings for ProcessorFactory and PipelineFactory. Updated signature of CampVisApplication::addPipeline(), removed redundant pipeline name parameter.

refs #643
parent 042cafbc
...@@ -27,7 +27,7 @@ namespace campvis { ...@@ -27,7 +27,7 @@ namespace campvis {
int run(); int run();
%apply SWIGTYPE *DISOWN {AbstractPipeline* pipeline}; %apply SWIGTYPE *DISOWN {AbstractPipeline* pipeline};
void addPipeline(const std::string& name, AbstractPipeline* pipeline); void addPipeline(AbstractPipeline* pipeline);
DataContainer* createAndAddDataContainer(const std::string& name); DataContainer* createAndAddDataContainer(const std::string& name);
%clear AbstractPipeline* pipeline; %clear AbstractPipeline* pipeline;
......
...@@ -143,7 +143,7 @@ namespace campvis { ...@@ -143,7 +143,7 @@ namespace campvis {
std::vector<AbstractPipeline*> pipelines = w->getPipelines(); std::vector<AbstractPipeline*> pipelines = w->getPipelines();
for (auto it = pipelines.begin(); it != pipelines.end(); ++it) { for (auto it = pipelines.begin(); it != pipelines.end(); ++it) {
addPipeline((*it)->getName(), *it); addPipeline(*it);
} }
_workflows.push_back(w); _workflows.push_back(w);
...@@ -161,7 +161,7 @@ namespace campvis { ...@@ -161,7 +161,7 @@ namespace campvis {
DataContainer* dc = createAndAddDataContainer("DataContainer #" + StringUtils::toString(_dataContainers.size() + 1)); DataContainer* dc = createAndAddDataContainer("DataContainer #" + StringUtils::toString(_dataContainers.size() + 1));
AbstractPipeline* p = PipelineFactory::getRef().createPipeline(pipelinesToAdd[i].toStdString(), *dc); AbstractPipeline* p = PipelineFactory::getRef().createPipeline(pipelinesToAdd[i].toStdString(), *dc);
if (p != nullptr) if (p != nullptr)
addPipeline(pipelinesToAdd[i].toStdString(), p); addPipeline(p);
} }
} }
...@@ -223,18 +223,18 @@ namespace campvis { ...@@ -223,18 +223,18 @@ namespace campvis {
} }
void CampVisApplication::addPipeline(const std::string& name, AbstractPipeline* pipeline) { void CampVisApplication::addPipeline(AbstractPipeline* pipeline) {
cgtAssert(pipeline != 0, "Pipeline must not be 0."); cgtAssert(pipeline != 0, "Pipeline must not be 0.");
// create canvas and painter for the pipeline and connect all together // create canvas and painter for the pipeline and connect all together
cgt::QtThreadedCanvas* canvas = new cgt::QtThreadedCanvas("CAMPVis", cgt::ivec2(512, 512)); cgt::QtThreadedCanvas* canvas = new cgt::QtThreadedCanvas(pipeline->getName(), cgt::ivec2(512, 512));
canvas->init(); canvas->init();
pipeline->setCanvas(canvas); pipeline->setCanvas(canvas);
pipeline->getPipelinePainter()->setErrorTexture(_errorTexture); pipeline->getPipelinePainter()->setErrorTexture(_errorTexture);
_pipelines.push_back(pipeline); _pipelines.push_back(pipeline);
_pipelineWindows[pipeline] = _mainWindow->addVisualizationPipelineWidget(name, canvas); _pipelineWindows[pipeline] = _mainWindow->addVisualizationPipelineWidget(pipeline->getName(), canvas);
// initialize context (GLEW) and pipeline in OpenGL thread) // initialize context (GLEW) and pipeline in OpenGL thread)
initGlContextAndPipeline(canvas, pipeline); initGlContextAndPipeline(canvas, pipeline);
......
...@@ -97,10 +97,9 @@ namespace campvis { ...@@ -97,10 +97,9 @@ namespace campvis {
* Each pipeline will automatically get its own OpenGL context, the corresponding CampvisPainter * Each pipeline will automatically get its own OpenGL context, the corresponding CampvisPainter
* and all necessary connections will be created. * and all necessary connections will be created.
* *
* \param name Name of the OpenGL context to create for the pipeline.
* \param vp AbstractPipeline to add. * \param vp AbstractPipeline to add.
*/ */
void addPipeline(const std::string& name, AbstractPipeline* pipeline); void addPipeline(AbstractPipeline* pipeline);
/** /**
* Adds a dock widget to the main window. * Adds a dock widget to the main window.
......
...@@ -426,7 +426,7 @@ namespace campvis { ...@@ -426,7 +426,7 @@ namespace campvis {
dc = _application->createAndAddDataContainer("DataContainer #" + StringUtils::toString(_application->_dataContainers.size() + 1)); dc = _application->createAndAddDataContainer("DataContainer #" + StringUtils::toString(_application->_dataContainers.size() + 1));
} }
AbstractPipeline* p = PipelineFactory::getRef().createPipeline(name, *dc); AbstractPipeline* p = PipelineFactory::getRef().createPipeline(name, *dc);
_application->addPipeline(name, p); _application->addPipeline(p);
} }
void MainWindow::onBtnProcessorFactoryClicked() { void MainWindow::onBtnProcessorFactoryClicked() {
......
...@@ -70,4 +70,4 @@ pipeline.s_init:connect(initCallback) ...@@ -70,4 +70,4 @@ pipeline.s_init:connect(initCallback)
-- so, we now finished creating our LuaDemo. All that's missing is registering it with the CAMPVis application -- so, we now finished creating our LuaDemo. All that's missing is registering it with the CAMPVis application
application:addPipeline(pipeline:getName(), pipeline) application:addPipeline(pipeline)
\ No newline at end of file
...@@ -16,6 +16,8 @@ ...@@ -16,6 +16,8 @@
#include "core/pipeline/abstractprocessor.h" #include "core/pipeline/abstractprocessor.h"
#include "core/pipeline/abstractworkflow.h" #include "core/pipeline/abstractworkflow.h"
#include "core/pipeline/autoevaluationpipeline.h" #include "core/pipeline/autoevaluationpipeline.h"
#include "core/pipeline/pipelinefactory.h"
#include "core/pipeline/processorfactory.h"
#include "core/pipeline/visualizationprocessor.h" #include "core/pipeline/visualizationprocessor.h"
#include "core/classification/tfgeometry1d.h" #include "core/classification/tfgeometry1d.h"
#include "core/classification/tfgeometry2d.h" #include "core/classification/tfgeometry2d.h"
...@@ -50,7 +52,7 @@ namespace sigslot { ...@@ -50,7 +52,7 @@ namespace sigslot {
%template(PairStringDataHandle) std::pair<std::string, campvis::DataHandle>; %template(PairStringDataHandle) std::pair<std::string, campvis::DataHandle>;
%template(VectorOfPairStringDataHandle) std::vector< std::pair< std::string, campvis::DataHandle> >; %template(VectorOfPairStringDataHandle) std::vector< std::pair< std::string, campvis::DataHandle> >;
%template(VectorOfString) std::vector< std::string >;
namespace campvis { namespace campvis {
...@@ -525,6 +527,28 @@ namespace campvis { ...@@ -525,6 +527,28 @@ namespace campvis {
explicit VisualizationProcessor(IVec2Property* viewportSizeProp); explicit VisualizationProcessor(IVec2Property* viewportSizeProp);
~VisualizationProcessor(); ~VisualizationProcessor();
}; };
/* PipelineFactory and ProcessorFactory */
class PipelineFactory {
public:
static PipelineFactory& getRef();
std::vector<std::string> getRegisteredPipelines() const;
AbstractPipeline* createPipeline(const std::string& id, DataContainer& dc) const;
AbstractWorkflow* createWorkflow(const std::string& id) const;
};
class ProcessorFactory {
public:
static ProcessorFactory& getRef();
std::vector<std::string> getRegisteredProcessors() const;
std::vector<std::string> getRegisteredRaycastingProcessors() const;
AbstractProcessor* createProcessor(const std::string& id, IVec2Property* viewPortSizeProp = nullptr) const;
};
} }
%luacode { %luacode {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment