26 #ifndef CAMITK_COMPONENT_H
27 #define CAMITK_COMPONENT_H
41 #include <vtkWindowLevelLookupTable.h>
42 #include <vtkImageData.h>
43 #include <vtkPointSet.h>
44 #include <vtkSmartPointer.h>
45 #include <vtkAlgorithmOutput.h>
47 #include <vtkActor2D.h>
48 #include <vtkImageActor.h>
53 class vtkUnstructuredGridAlgorithm;
54 class vtkDataSetToUnstructuredGridFilter;
55 class vtkWindowLevelLookupTable;
68 #define invoke0(HANDLER,METHOD) \
72 #define invoke1(HANDLER,METHOD,PARAM) \
74 HANDLER->METHOD(PARAM);
76 #define invoke2(HANDLER,METHOD,PARAM1,PARAM2) \
78 HANDLER->METHOD(PARAM1,PARAM2);
80 #define invoke3(HANDLER,METHOD,PARAM1,PARAM2,PARAM3) \
82 HANDLER->METHOD(PARAM1,PARAM2,PARAM3);
84 #define invoke4(HANDLER,METHOD,PARAM1,PARAM2,PARAM3,PARAM4) \
86 HANDLER->METHOD(PARAM1,PARAM2,PARAM3,PARAM4);
92 #define invokeGet0(HANDLER,METHOD) \
94 return HANDLER->METHOD();
96 #define invokeGet1(HANDLER,METHOD,PARAM) \
98 return HANDLER->METHOD(PARAM);
100 #define invokeGet2(HANDLER,METHOD,PARAM1,PARAM2) \
102 return HANDLER->METHOD(PARAM1,PARAM2);
104 #define invokeGet3(HANDLER,METHOD,PARAM1,PARAM2,PARAM3) \
106 return HANDLER->METHOD(PARAM1,PARAM2,PARAM3);
108 #define invokeGet4(HANDLER,METHOD,PARAM1,PARAM2,PARAM3,PARAM4) \
110 return HANDLER->METHOD(PARAM1,PARAM2,PARAM3,PARAM4);
115 #define invokeChildren0(METHOD) \
116 foreach (Component *child, childrenComponent) { \
120 #define invokeChildren1(METHOD,PARAM) \
121 foreach (Component *child, childrenComponent) { \
122 child->METHOD(PARAM); \
125 #define invokeChildren2(METHOD,PARAM1,PARAM2) \
126 foreach (Component *child, childrenComponent) { \
127 child->METHOD(PARAM1,PARAM2); \
130 #define invokeChildren3(METHOD,PARAM1,PARAM2,PARAM3) \
131 foreach (Component *child, childrenComponent) { \
132 child->METHOD(PARAM1,PARAM2,PARAM3); \
135 #define invokeChildren4(METHOD,PARAM1,PARAM2,PARAM3,PARAM4) \
136 foreach (Component *child, childrenComponent) { \
137 child->METHOD(PARAM1,PARAM2,PARAM3,PARAM4); \
145 #define delegate0(HANDLER,METHOD) \
146 virtual void METHOD() { \
147 invoke0(HANDLER,METHOD) \
150 #define delegate1(HANDLER,METHOD,PARAM_TYPE) \
151 virtual void METHOD(PARAM_TYPE param) { \
152 invoke1(HANDLER,METHOD,param) \
155 #define delegate2(HANDLER,METHOD,PARAM_TYPE1,PARAM_TYPE2) \
156 virtual void METHOD(PARAM_TYPE1 param1, PARAM_TYPE2 param2) { \
157 invoke2(HANDLER,METHOD,param1,param2) \
160 #define delegate3(HANDLER,METHOD,PARAM_TYPE1,PARAM_TYPE2,PARAM_TYPE3) \
161 virtual void METHOD(PARAM_TYPE1 param1, PARAM_TYPE2 param2, PARAM_TYPE3 param3) { \
162 invoke3(HANDLER,METHOD,param1,param2,param3) \
165 #define delegate4(HANDLER,METHOD,PARAM_TYPE1,PARAM_TYPE2,PARAM_TYPE3, PARAM_TYPE4) \
166 virtual void METHOD(PARAM_TYPE1 param1, PARAM_TYPE2 param2, PARAM_TYPE3 param3, PARAM_TYPE4 param4) { \
167 invoke4(HANDLER,METHOD,param1,param2,param3,param4) \
176 #define delegateGet0(HANDLER,METHOD,TYPE) \
177 virtual TYPE METHOD() { \
178 invokeGet0(HANDLER,METHOD) \
183 #define delegateGet1(HANDLER,METHOD,TYPE,PARAM_TYPE) \
184 virtual TYPE METHOD(PARAM_TYPE param) { \
185 invokeGet1(HANDLER,METHOD,param) \
190 #define delegateGet2(HANDLER,METHOD,TYPE,PARAM1_TYPE,PARAM2_TYPE) \
191 virtual TYPE METHOD(PARAM1_TYPE param1, PARAM2_TYPE param2) { \
192 invokeGet2(HANDLER,METHOD,param1,param2) \
199 #define delegateConstGet0(HANDLER,METHOD,TYPE) \
200 virtual TYPE METHOD() const { \
201 invokeGet0(HANDLER,METHOD) \
206 #define delegateConstGet1(HANDLER,METHOD,TYPE,PARAM_TYPE) \
207 virtual TYPE METHOD(PARAM_TYPE param) const { \
208 invokeGet1(HANDLER,METHOD,param) \
217 #define delegateAndInvokeChildren1(HANDLER,METHOD,PARAM_TYPE) \
218 virtual void METHOD(PARAM_TYPE param) { \
219 invoke1(HANDLER,METHOD,param) \
220 invokeChildren1(METHOD,param) \
223 #define delegateAndInvokeChildren2(HANDLER,METHOD,PARAM_TYPE1,PARAM_TYPE2) \
224 virtual void METHOD(PARAM_TYPE1 param1, PARAM_TYPE2 param2) { \
225 invoke2(HANDLER,METHOD,param1,param2) \
226 invokeChildren2(METHOD,param1,param2) \
229 #define delegateAndInvokeChildren1Array(HANDLER,METHOD,PARAM_TYPE1,PARAM_TYPE2,DIM) \
230 virtual void METHOD(PARAM_TYPE1 param1, PARAM_TYPE2 param2[DIM]) { \
231 invoke2(HANDLER,METHOD,param1,param2) \
232 invokeChildren2(METHOD,param1,param2) \
235 #define delegateAndInvokeChildren3(HANDLER,METHOD,PARAM_TYPE1,PARAM_TYPE2,PARAM_TYPE3) \
236 virtual void METHOD(PARAM_TYPE1 param1, PARAM_TYPE2 param2, PARAM_TYPE3 param3) { \
237 invoke3(HANDLER,METHOD,param1,param2,param3) \
238 invokeChildren3(METHOD,param1,param2,param3) \
241 #define delegateAndInvokeChildren4(HANDLER,METHOD,PARAM_TYPE1,PARAM_TYPE2,PARAM_TYPE3,PARAM_TYPE4) \
242 virtual void METHOD(PARAM_TYPE1 param1, PARAM_TYPE2 param2, PARAM_TYPE3 param3,PARAM_TYPE4 param4) { \
243 invoke4(HANDLER,METHOD,param1,param2,param3,param4) \
244 invokeChildren4(METHOD,param1,param2,param3,param4) \
318 Component(
const QString &
file,
const QString & name, Representation rep = NO_REPRESENTATION);
335 Representation getRepresentation() const;
338 bool isTopLevel() const;
341 virtual Component * getParentComponent();
344 virtual Component * getTopLevelComponent();
347 virtual
void setModified(
bool modified = true);
350 virtual
bool getModified() const;
353 virtual
void setVisibility(
Viewer *,
bool);
356 virtual
bool getVisibility(Viewer *) const;
359 virtual
void refresh() const;
367 virtual
void refreshInterfaceNode();
370 virtual
bool isSelected() const;
376 virtual
void setSelected(const
bool b, const
bool recursive = true);
379 const QString getFileName() const;
382 void setFileName(const QString &);
385 bool event(QEvent* e);
391 QMenu * getActionAndPopupMenu();
398 QStringList getHierarchy();
403 bool isInstanceOf(QString className);
415 virtual QWidget * getPropertyWidget(QWidget* parent = 0) {
425 if (this->getPropertyWidget())
436 if (this->getPropertyWidget() && (i==0))
437 return this->getPropertyWidget();
460 void updateProperty(QString name, QVariant value);
476 virtual bool setDynamicProperty(
const char *name,
const QVariant &value,
const char *description =
"",
bool isReadOnly=
false);
486 Q_INVOKABLE
virtual Property* getProperty(QString name);
496 virtual bool addProperty(
Property*);
515 virtual void deleteChildren();
516 virtual QString getName()
const;
517 virtual void setName(
const QString&);
519 virtual bool doubleClicked();
521 virtual QPixmap getIcon();
526 virtual bool inItalic()
const;
538 const QString getLabel()
const;
543 void setLabel(QString newName);
545 delegateGet0(myGeometry, getPointSet, vtkSmartPointer<vtkPointSet> )
547 delegate1(myGeometry, setPointSet, vtkSmartPointer<vtkPointSet> )
549 delegate1(myGeometry, setPointData, vtkSmartPointer<vtkDataArray> )
553 delegate1(myGeometry, setDataConnection, vtkSmartPointer<vtkAlgorithmOutput> )
555 delegateGet1(myGeometry, getActor, vtkSmartPointer<vtkActor>, const RenderingModes)
559 virtual vtkSmartPointer<vtkProp> getProp(const QString ¶m)
562 return myGeometry->getProp(param);
564 return mySlice->getProp(param);
570 return myGeometry->getNumberOfProp();
572 return mySlice->getNumberOfProp();
576 virtual vtkSmartPointer<vtkProp>
getProp(
unsigned int index) {
578 return myGeometry->getProp(index);
580 return mySlice->getProp(index);
584 virtual bool addProp(
const QString &name, vtkSmartPointer<vtkProp> prop) {
586 return myGeometry->addProp(name, prop);
588 return mySlice->addProp(name, prop);
595 return myGeometry->removeProp(name);
597 return mySlice->removeProp(name);
616 virtual void getBounds(
double *bounds);
621 virtual double getBoundingRadius();
623 delegate4(myGeometry, setPointPosition,
const unsigned int,
const double,
const double,
const double);
628 virtual const InterfaceGeometry::RenderingModes getRenderingModes()
const;
639 virtual
void getActorColor(const RenderingModes,
double [4]);
651 delegate2(myGeometry, setMapperScalarRange,
double,
double)
653 delegate1(myGeometry, setTexture, vtkSmartPointer<vtkTexture>)
655 virtual
void setGlyphType(const GlyphTypes type, const
double size = 0.0);
657 delegate1(myGeometry, setLinesAsTubes,
bool);
668 delegate1(mySlice, setOriginalVolume, vtkSmartPointer<vtkImageData>)
678 delegate3(mySlice, pixelPicked,
double,
double,
double)
684 delegate3(mySlice, setSlice,
double,
double,
double);
694 delegate3(mySlice, setPixelRealPosition,
double,
double,
double);
697 virtual
double getRotationX() const;
700 virtual
double getRotationY() const;
703 virtual
double getRotationZ() const;
706 virtual
int getNumberOfSlices() const;
709 virtual
int getSlice() const;
754 virtual
void initRepresentation() = 0;
769 static QSet<Viewer*> allViewers;
779 return isSelectedFlag;
790 return childrenComponent;
817 myGeometry->setLabel(n);
822 modifiedFlag = modification;
#define delegateAndInvokeChildren4(HANDLER, METHOD, PARAM_TYPE1, PARAM_TYPE2, PARAM_TYPE3, PARAM_TYPE4)
Definition: sdk/libraries/core/component/Component.h:241
This class describe what are the methods to implement in order to manage dynamic properties.
Definition: InterfaceProperty.h:44
This class describes what are the methods to implement for a BitMap.
Definition: InterfaceBitMap.h:63
virtual const ComponentList & getChildren()
get the list of the InterfaceNode children (sub items in the hierarchy)
Definition: sdk/libraries/core/component/Component.h:789
#define delegateGet0(HANDLER, METHOD, TYPE)
delegateGet macros: Same as delegate macro but for an accessor non-const METHOD, returns a value of t...
Definition: sdk/libraries/core/component/Component.h:176
#define delegate1(HANDLER, METHOD, PARAM_TYPE)
Definition: sdk/libraries/core/component/Component.h:150
virtual bool doubleClicked()
this method is called each time the InterfaceNode is double clicked by the user.
Definition: sdk/libraries/core/component/Component.h:783
Exception class to handle abortion in component instanciation.
Definition: AbortException.h:44
#define delegateAndInvokeChildren3(HANDLER, METHOD, PARAM_TYPE1, PARAM_TYPE2, PARAM_TYPE3)
Definition: sdk/libraries/core/component/Component.h:235
Viewer is an abstract viewer.
Definition: Viewer.h:55
#define delegate3(HANDLER, METHOD, PARAM_TYPE1, PARAM_TYPE2, PARAM_TYPE3)
Definition: sdk/libraries/core/component/Component.h:160
virtual void pointPicked(vtkIdType, bool)
an inherited class can redefine this method something specific.
Definition: sdk/libraries/core/component/Component.h:606
this Component can be displayed as a SLICE
Definition: sdk/libraries/core/component/Component.h:303
Definition: ExtensionWindow.h:41
This class describe what are the methods to implement for a hierarchical tree node.
Definition: InterfaceNode.h:58
this Component can be displayed as a GEOMETRY
Definition: sdk/libraries/core/component/Component.h:302
A Component represents something that could be included in the explorer view, the interactive 3D view...
Definition: sdk/libraries/core/component/Component.h:292
CAMITK_API QList< Component * > ComponentList
A list of Component.
Definition: CamiTKAPI.h:87
#define CAMITK_API
Definition: CamiTKAPI.h:49
virtual void setModified(bool modified=true)
set the modified flag
Definition: sdk/libraries/core/component/Component.h:821
virtual QString getName() const
get the name to be displayed
Definition: sdk/libraries/core/component/Component.h:794
virtual QMenu * getPopupMenu(QWidget *parent=0)
get the popup menu to display (always return NULL, overwrite this method if you want to give here you...
Definition: sdk/libraries/core/component/Component.h:529
#define delegateAndInvokeChildren1Array(HANDLER, METHOD, PARAM_TYPE1, PARAM_TYPE2, DIM)
Definition: sdk/libraries/core/component/Component.h:229
virtual unsigned int getNumberOfPropertyWidget()
get the number of alternative property widgets
Definition: sdk/libraries/core/component/Component.h:424
CamiTK CamiTKDir txt file(STRINGS"${FIND_CAMITK_USER_BASE_DIR}/CamiTK/CamiTKDir.txt"FIND_CAMITK_USER_DIR_LAST_INSTALL) endif() find_program(CAMITK_CONFIG_EXECUTABLE NAMES camitk-config-debug camitk-config PATH_SUFFIXES"bin"PATHS"$
Definition: FindCamiTK.cmake:80
Definition: ExtensionWindow.h:42
virtual QWidget * getPropertyWidgetAt(unsigned int i, QWidget *parent=0)
Get the ith alternative property widget.
Definition: sdk/libraries/core/component/Component.h:435
virtual bool inItalic() const
A component name is not displayed in italic by default.
Definition: sdk/libraries/core/component/Component.h:809
#define delegate4(HANDLER, METHOD, PARAM_TYPE1, PARAM_TYPE2, PARAM_TYPE3, PARAM_TYPE4)
Definition: sdk/libraries/core/component/Component.h:165
virtual bool getModified() const
set the modified flag
Definition: sdk/libraries/core/component/Component.h:826
const QString getLabel() const
Definition: sdk/libraries/core/component/Component.h:831
#define delegate2(HANDLER, METHOD, PARAM_TYPE1, PARAM_TYPE2)
Definition: sdk/libraries/core/component/Component.h:155
virtual InterfaceNode * getParent()
get the parent Component
Definition: sdk/libraries/core/component/Component.h:799
void setLabel(QString newName)
set the string used to display the label, do the same as setName
Definition: sdk/libraries/core/component/Component.h:835
#define delegateGet1(HANDLER, METHOD, TYPE, PARAM_TYPE)
Definition: sdk/libraries/core/component/Component.h:183
virtual unsigned int getNumberOfProp() const
return the number of additional prop
Definition: sdk/libraries/core/component/Component.h:568
Representation
The different representation that can be implemented to represent this Component in the InteractiveVi...
Definition: sdk/libraries/core/component/Component.h:301
virtual QObject * getPropertyObject()
Get the property object that could be understood by PropertyEditor.
Definition: sdk/libraries/core/component/Component.h:450
virtual QPixmap getIcon()
Get the pixmap that will be displayed for this node.
Definition: sdk/libraries/core/component/Component.h:804
This class describes what are the methods to implement for a Geometry (rendering parameters, input/output, filters, picking parameters...)
Definition: InterfaceGeometry.h:61
#define delegate0(HANDLER, METHOD)
delegate macros: completely delegates METHOD to HANDLER, eventually using parameters of given PARAM_T...
Definition: sdk/libraries/core/component/Component.h:145
virtual vtkSmartPointer< vtkProp > getProp(unsigned int index)
return an additional prop by its index
Definition: sdk/libraries/core/component/Component.h:576
virtual bool addProp(const QString &name, vtkSmartPointer< vtkProp > prop)
insert an additional prop, defining it by its name (default visibility = false)
Definition: sdk/libraries/core/component/Component.h:584
virtual bool removeProp(const QString &name)
remove a given additional prop.
Definition: sdk/libraries/core/component/Component.h:593
#define delegateAndInvokeChildren2(HANDLER, METHOD, PARAM_TYPE1, PARAM_TYPE2)
Definition: sdk/libraries/core/component/Component.h:223
#define delegateConstGet1(HANDLER, METHOD, TYPE, PARAM_TYPE)
Definition: sdk/libraries/core/component/Component.h:206
virtual void setName(const QString &)
set the name to be displayed
Definition: sdk/libraries/core/component/Component.h:814
virtual void cellPicked(vtkIdType, bool)
an inherited class can redefine this method something specific.
Definition: sdk/libraries/core/component/Component.h:611
#define delegateAndInvokeChildren1(HANDLER, METHOD, PARAM_TYPE)
delegateAndInvokeChildren macros: Same as delegate but also calls METHOD, eventually with PARAM_TYPE...
Definition: sdk/libraries/core/component/Component.h:217
#define delegateConstGet0(HANDLER, METHOD, TYPE)
delegateConstGet macros: Same as delegateGet but for const METHOD
Definition: sdk/libraries/core/component/Component.h:199
This class describes a property that can be used in components and actions or any class that needs to...
Definition: Property.h:188