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

Added Lua bindings for BoolProperty, ButtonProperty, MhdImageWriter, and DevilImageWriter.

parent 3d488fb7
......@@ -6,11 +6,7 @@
%{
#include "core/datastructures/abstractdata.h"
#include "core/datastructures/imagedata.h"
#include "core/properties/genericproperty.h"
#include "core/properties/numericproperty.h"
#include "core/properties/floatingpointproperty.h"
#include "core/properties/datanameproperty.h"
#include "core/properties/transferfunctionproperty.h"
#include "core/properties/allproperties.h"
#include "core/pipeline/abstractprocessor.h"
#include "core/pipeline/autoevaluationpipeline.h"
#include "core/pipeline/visualizationprocessor.h"
......@@ -56,6 +52,16 @@ namespace campvis {
virtual void addSharedProperty(AbstractProperty* prop);
};
class ButtonProperty : public AbstractProperty {
public:
ButtonProperty(const std::string& name, const std::string& title);
virtual ~ButtonProperty();
void click();
sigslot::signal0 s_clicked;
};
template<typename T>
class GenericProperty : public AbstractProperty {
public:
......@@ -66,6 +72,9 @@ namespace campvis {
virtual void setValue(const T& value);
};
%template(BoolProperty) GenericProperty<bool>;
typedef GenericProperty<bool> BoolProperty;
%template(StringProperty) GenericProperty<std::string>;
typedef GenericProperty<std::string> StringProperty;
......@@ -257,12 +266,12 @@ namespace campvis {
/* Downcast the return value of HasPropertyCollection::getProperty to appropriate subclass */
%factory(AbstractProperty* campvis::HasPropertyCollection::getProperty,
campvis::FloatProperty, campvis::IVec2Property, campvis::TransferFunctionProperty,
campvis::DataNameProperty, campvis::StringProperty);
campvis::DataNameProperty, campvis::StringProperty, campvis::ButtonProperty, campvis::BoolProperty);
/* Downcast the return value of HasPropertyCollection::getNestedProperty to appropriate subclass */
%factory(AbstractProperty* campvis::HasPropertyCollection::getNestedProperty,
campvis::FloatProperty, campvis::IVec2Property, campvis::TransferFunctionProperty,
campvis::DataNameProperty, campvis::StringProperty);
campvis::DataNameProperty, campvis::StringProperty, campvis::ButtonProperty, campvis::BoolProperty);
/* HasPropertyCollection */
......
%module devil
%include std_string.i
%import "core/bindings/campvis.i"
%{
#include "core/pipeline/visualizationprocessor.h"
#include "core/pipeline/autoevaluationpipeline.h"
#include "modules/devil/processors/devilimagereader.h"
#include "modules/devil/processors/devilimagewriter.h"
%}
namespace campvis {
class DevilImageWriter : public AbstractProcessor {
public:
DevilImageWriter();
virtual ~DevilImageWriter();
virtual const std::string getName() const;
%immutable;
DataNameProperty p_inputImage; ///< image ID for image to write
StringProperty p_url; ///< URL for file to write
BoolProperty p_writeDepthImage; ///< Flag whether to save also depth image
%mutable;
};
}
%luacode {
print("Module campvis-devil loaded")
}
......@@ -5,6 +5,7 @@
#include "core/pipeline/visualizationprocessor.h"
#include "core/pipeline/autoevaluationpipeline.h"
#include "modules/io/processors/mhdimagereader.h"
#include "modules/io/processors/mhdimagewriter.h"
%}
......@@ -28,8 +29,23 @@ namespace campvis {
const std::string getName() const;
};
class MhdImageWriter : public AbstractProcessor {
public:
MhdImageWriter();
virtual ~MhdImageWriter();
virtual const std::string getName() const;
%immutable;
DataNameProperty p_inputImage;
StringProperty p_fileName;
ButtonProperty p_saveFile;
%mutable;
};
}
%luacode {
print("Module campvis-io loaded")
}
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