Starting from 2021-07-01, all LRZ GitLab users will be required to explicitly accept the GitLab Terms of Service. Please see the detailed information at https://doku.lrz.de/display/PUBLIC/GitLab and make sure that your projects conform to the requirements.

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 {
int run();
%apply SWIGTYPE *DISOWN {AbstractPipeline* pipeline};
void addPipeline(const std::string& name, AbstractPipeline* pipeline);
void addPipeline(AbstractPipeline* pipeline);
DataContainer* createAndAddDataContainer(const std::string& name);
%clear AbstractPipeline* pipeline;
......
......@@ -143,7 +143,7 @@ namespace campvis {
std::vector<AbstractPipeline*> pipelines = w->getPipelines();
for (auto it = pipelines.begin(); it != pipelines.end(); ++it) {
addPipeline((*it)->getName(), *it);
addPipeline(*it);
}
_workflows.push_back(w);
......@@ -161,7 +161,7 @@ namespace campvis {
DataContainer* dc = createAndAddDataContainer("DataContainer #" + StringUtils::toString(_dataContainers.size() + 1));
AbstractPipeline* p = PipelineFactory::getRef().createPipeline(pipelinesToAdd[i].toStdString(), *dc);
if (p != nullptr)
addPipeline(pipelinesToAdd[i].toStdString(), p);
addPipeline(p);
}
}
......@@ -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.");
// 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();
pipeline->setCanvas(canvas);
pipeline->getPipelinePainter()->setErrorTexture(_errorTexture);
_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)
initGlContextAndPipeline(canvas, pipeline);
......
......@@ -97,10 +97,9 @@ namespace campvis {
* Each pipeline will automatically get its own OpenGL context, the corresponding CampvisPainter
* and all necessary connections will be created.
*
* \param name Name of the OpenGL context to create for the pipeline.
* \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.
......
......@@ -426,7 +426,7 @@ namespace campvis {
dc = _application->createAndAddDataContainer("DataContainer #" + StringUtils::toString(_application->_dataContainers.size() + 1));
}
AbstractPipeline* p = PipelineFactory::getRef().createPipeline(name, *dc);
_application->addPipeline(name, p);
_application->addPipeline(p);
}
void MainWindow::onBtnProcessorFactoryClicked() {
......
......@@ -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
application:addPipeline(pipeline:getName(), pipeline)
\ No newline at end of file
application:addPipeline(pipeline)
......@@ -16,6 +16,8 @@
#include "core/pipeline/abstractprocessor.h"
#include "core/pipeline/abstractworkflow.h"
#include "core/pipeline/autoevaluationpipeline.h"
#include "core/pipeline/pipelinefactory.h"
#include "core/pipeline/processorfactory.h"
#include "core/pipeline/visualizationprocessor.h"
#include "core/classification/tfgeometry1d.h"
#include "core/classification/tfgeometry2d.h"
......@@ -50,7 +52,7 @@ namespace sigslot {
%template(PairStringDataHandle) std::pair<std::string, campvis::DataHandle>;
%template(VectorOfPairStringDataHandle) std::vector< std::pair< std::string, campvis::DataHandle> >;
%template(VectorOfString) std::vector< std::string >;
namespace campvis {
......@@ -525,6 +527,28 @@ namespace campvis {
explicit VisualizationProcessor(IVec2Property* viewportSizeProp);
~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 {
......
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