26 #ifndef CAMITK_COMPONENT_H 27 #define CAMITK_COMPONENT_H 44 #include <vtkWindowLevelLookupTable.h> 45 #include <vtkImageData.h> 46 #include <vtkPointSet.h> 47 #include <vtkSmartPointer.h> 48 #include <vtkAlgorithmOutput.h> 50 #include <vtkAxesActor.h> 51 #include <vtkActor2D.h> 52 #include <vtkImageActor.h> 53 #include <vtkTransform.h> 59 class vtkUnstructuredGridAlgorithm;
60 class vtkDataSetToUnstructuredGridFilter;
61 class vtkWindowLevelLookupTable;
74 #define invoke0(HANDLER,METHOD) \ 78 #define invoke1(HANDLER,METHOD,PARAM) \ 80 HANDLER->METHOD(PARAM); 82 #define invoke2(HANDLER,METHOD,PARAM1,PARAM2) \ 84 HANDLER->METHOD(PARAM1,PARAM2); 86 #define invoke3(HANDLER,METHOD,PARAM1,PARAM2,PARAM3) \ 88 HANDLER->METHOD(PARAM1,PARAM2,PARAM3); 90 #define invoke4(HANDLER,METHOD,PARAM1,PARAM2,PARAM3,PARAM4) \ 92 HANDLER->METHOD(PARAM1,PARAM2,PARAM3,PARAM4); 98 #define invokeGet0(HANDLER,METHOD) \ 100 return HANDLER->METHOD(); 102 #define invokeGet1(HANDLER,METHOD,PARAM) \ 104 return HANDLER->METHOD(PARAM); 106 #define invokeGet2(HANDLER,METHOD,PARAM1,PARAM2) \ 108 return HANDLER->METHOD(PARAM1,PARAM2); 110 #define invokeGet3(HANDLER,METHOD,PARAM1,PARAM2,PARAM3) \ 112 return HANDLER->METHOD(PARAM1,PARAM2,PARAM3); 114 #define invokeGet4(HANDLER,METHOD,PARAM1,PARAM2,PARAM3,PARAM4) \ 116 return HANDLER->METHOD(PARAM1,PARAM2,PARAM3,PARAM4); 121 #define invokeChildren0(METHOD) \ 122 foreach (Component *child, childrenComponent) { \ 126 #define invokeChildren1(METHOD,PARAM) \ 127 foreach (Component *child, childrenComponent) { \ 128 child->METHOD(PARAM); \ 131 #define invokeChildren2(METHOD,PARAM1,PARAM2) \ 132 foreach (Component *child, childrenComponent) { \ 133 child->METHOD(PARAM1,PARAM2); \ 136 #define invokeChildren3(METHOD,PARAM1,PARAM2,PARAM3) \ 137 foreach (Component *child, childrenComponent) { \ 138 child->METHOD(PARAM1,PARAM2,PARAM3); \ 141 #define invokeChildren4(METHOD,PARAM1,PARAM2,PARAM3,PARAM4) \ 142 foreach (Component *child, childrenComponent) { \ 143 child->METHOD(PARAM1,PARAM2,PARAM3,PARAM4); \ 151 #define delegate0(HANDLER,METHOD) \ 152 virtual void METHOD() { \ 153 invoke0(HANDLER,METHOD) \ 156 #define delegate1(HANDLER,METHOD,PARAM_TYPE) \ 157 virtual void METHOD(PARAM_TYPE param) { \ 158 invoke1(HANDLER,METHOD,param) \ 161 #define delegate2(HANDLER,METHOD,PARAM_TYPE1,PARAM_TYPE2) \ 162 virtual void METHOD(PARAM_TYPE1 param1, PARAM_TYPE2 param2) { \ 163 invoke2(HANDLER,METHOD,param1,param2) \ 166 #define delegate3(HANDLER,METHOD,PARAM_TYPE1,PARAM_TYPE2,PARAM_TYPE3) \ 167 virtual void METHOD(PARAM_TYPE1 param1, PARAM_TYPE2 param2, PARAM_TYPE3 param3) { \ 168 invoke3(HANDLER,METHOD,param1,param2,param3) \ 171 #define delegate4(HANDLER,METHOD,PARAM_TYPE1,PARAM_TYPE2,PARAM_TYPE3, PARAM_TYPE4) \ 172 virtual void METHOD(PARAM_TYPE1 param1, PARAM_TYPE2 param2, PARAM_TYPE3 param3, PARAM_TYPE4 param4) { \ 173 invoke4(HANDLER,METHOD,param1,param2,param3,param4) \ 182 #define delegateGet0(HANDLER,METHOD,TYPE) \ 183 virtual TYPE METHOD() { \ 184 invokeGet0(HANDLER,METHOD) \ 189 #define delegateGet1(HANDLER,METHOD,TYPE,PARAM_TYPE) \ 190 virtual TYPE METHOD(PARAM_TYPE param) { \ 191 invokeGet1(HANDLER,METHOD,param) \ 196 #define delegateGet2(HANDLER,METHOD,TYPE,PARAM1_TYPE,PARAM2_TYPE) \ 197 virtual TYPE METHOD(PARAM1_TYPE param1, PARAM2_TYPE param2) { \ 198 invokeGet2(HANDLER,METHOD,param1,param2) \ 205 #define delegateConstGet0(HANDLER,METHOD,TYPE) \ 206 virtual TYPE METHOD() const { \ 207 invokeGet0(HANDLER,METHOD) \ 212 #define delegateConstGet1(HANDLER,METHOD,TYPE,PARAM_TYPE) \ 213 virtual TYPE METHOD(PARAM_TYPE param) const { \ 214 invokeGet1(HANDLER,METHOD,param) \ 223 #define delegateAndInvokeChildren1(HANDLER,METHOD,PARAM_TYPE) \ 224 virtual void METHOD(PARAM_TYPE param) { \ 225 invoke1(HANDLER,METHOD,param) \ 226 invokeChildren1(METHOD,param) \ 229 #define delegateAndInvokeChildren2(HANDLER,METHOD,PARAM_TYPE1,PARAM_TYPE2) \ 230 virtual void METHOD(PARAM_TYPE1 param1, PARAM_TYPE2 param2) { \ 231 invoke2(HANDLER,METHOD,param1,param2) \ 232 invokeChildren2(METHOD,param1,param2) \ 235 #define delegateAndInvokeChildren1Array(HANDLER,METHOD,PARAM_TYPE1,PARAM_TYPE2,DIM) \ 236 virtual void METHOD(PARAM_TYPE1 param1, PARAM_TYPE2 param2[DIM]) { \ 237 invoke2(HANDLER,METHOD,param1,param2) \ 238 invokeChildren2(METHOD,param1,param2) \ 241 #define delegateAndInvokeChildren3(HANDLER,METHOD,PARAM_TYPE1,PARAM_TYPE2,PARAM_TYPE3) \ 242 virtual void METHOD(PARAM_TYPE1 param1, PARAM_TYPE2 param2, PARAM_TYPE3 param3) { \ 243 invoke3(HANDLER,METHOD,param1,param2,param3) \ 244 invokeChildren3(METHOD,param1,param2,param3) \ 247 #define delegateAndInvokeChildren4(HANDLER,METHOD,PARAM_TYPE1,PARAM_TYPE2,PARAM_TYPE3,PARAM_TYPE4) \ 248 virtual void METHOD(PARAM_TYPE1 param1, PARAM_TYPE2 param2, PARAM_TYPE3 param3,PARAM_TYPE4 param4) { \ 249 invoke4(HANDLER,METHOD,param1,param2,param3,param4) \ 250 invokeChildren4(METHOD,param1,param2,param3,param4) \ 351 bool isTopLevel()
const;
354 virtual Component * getParentComponent();
357 virtual Component * getTopLevelComponent();
363 virtual void setModified(
bool modified =
true);
366 virtual bool getModified()
const;
369 virtual void setVisibility(
Viewer *,
bool);
372 virtual bool getVisibility(
Viewer *)
const;
375 virtual void refresh()
const;
383 virtual void refreshInterfaceNode();
386 virtual bool isSelected()
const;
392 virtual void setSelected(
const bool b,
const bool recursive =
true);
395 const QString getFileName()
const;
398 void setFileName(
const QString &);
401 bool event(QEvent* e);
404 QMenu * getActionMenu();
411 QStringList getHierarchy();
416 bool isInstanceOf(QString className);
428 virtual QWidget * getPropertyWidget(QWidget* parent = 0) {
438 if (this->getPropertyWidget())
449 if (this->getPropertyWidget() && (i==0))
450 return this->getPropertyWidget();
473 void updateProperty(QString name, QVariant value);
489 virtual bool setDynamicProperty(
const char *name,
const QVariant &value,
const char *
description =
"",
bool isReadOnly=
false);
498 virtual inline void setIndexOfPropertyExplorerTab(
unsigned int index) {
499 this->indexOfPropertyExplorerTab = index;
509 virtual inline unsigned int getIndexOfPropertyExplorerTab() {
510 return this->indexOfPropertyExplorerTab;
518 QMenu * getActionAndPopupMenu();
527 Q_INVOKABLE
virtual Property* getProperty(QString name);
537 virtual bool addProperty(
Property*);
557 virtual void deleteChildren();
558 virtual QString getName()
const;
559 virtual void setName(
const QString&);
561 virtual bool doubleClicked();
563 virtual QPixmap getIcon();
568 virtual bool inItalic()
const;
580 const QString getLabel()
const;
585 void setLabel(QString newName);
587 delegateGet0(myGeometry, getPointSet, vtkSmartPointer<vtkPointSet> )
589 delegate1(myGeometry, setPointSet, vtkSmartPointer<vtkPointSet> )
591 delegate1(myGeometry, setPointData, vtkSmartPointer<vtkDataArray> )
595 delegate1(myGeometry, setDataConnection, vtkSmartPointer<vtkAlgorithmOutput> )
597 delegateGet1(myGeometry, getActor, vtkSmartPointer<vtkActor>, const RenderingModes)
601 virtual vtkSmartPointer<vtkProp> getProp(const QString ¶m) {
603 return myGeometry->getProp(param);
605 return mySlice->getProp(param);
611 return myGeometry->getNumberOfProp();
613 return mySlice->getNumberOfProp();
617 virtual vtkSmartPointer<vtkProp>
getProp(
unsigned int index) {
619 return myGeometry->getProp(index);
621 return mySlice->getProp(index);
625 virtual bool addProp(
const QString &name, vtkSmartPointer<vtkProp> prop) {
627 return myGeometry->addProp(name, prop);
629 return mySlice->addProp(name, prop);
636 return myGeometry->removeProp(name);
638 return mySlice->removeProp(name);
657 virtual void getBounds(
double *bounds);
662 virtual double getBoundingRadius();
664 delegate4(myGeometry, setPointPosition,
const unsigned int,
const double,
const double,
const double)
680 virtual
void getActorColor(const RenderingModes,
double [4]);
692 delegate2(myGeometry, setMapperScalarRange,
double,
double)
694 delegate1(myGeometry, setTexture, vtkSmartPointer<vtkTexture>)
696 virtual
void setGlyphType(const GlyphTypes type, const
double size = 0.0);
698 delegate1(myGeometry, setLinesAsTubes,
bool)
700 delegate1(myGeometry, setMeshWorldTransform, vtkSmartPointer<vtkTransform>)
711 delegate1(mySlice, setOriginalVolume, vtkSmartPointer<vtkImageData>)
723 delegate3(mySlice, pixelPicked,
double,
double,
double)
739 delegate3(mySlice, setPixelRealPosition,
double,
double,
double)
741 delegate1(mySlice, setImageWorldTransform, vtkSmartPointer<vtkTransform>)
744 virtual
double getRotationX() const;
747 virtual
double getRotationY() const;
750 virtual
double getRotationZ() const;
753 virtual
int getNumberOfSlices() const;
756 virtual
int getSlice() const;
764 const QString & getFrameName()
const {
767 CAMITK_ERROR(
"Component",
"getFrameName",
"Delegate myFrame is not instanciated.")
768 return myFrame->getFrameName();
775 CAMITK_ERROR(
"Component",
"getParentFrame",
"Delegate myFrame is not instanciated.")
776 return myFrame->getParentFrame();
781 CAMITK_ERROR(
"Component",
"setParentFrame",
"Delegate myFrame is not instanciated.")
782 return myFrame->setParentFrame(frame, keepTransform);
787 CAMITK_ERROR(
"Component",
"getChildrenFrame",
"Delegate myFrame is not instanciated.")
788 return myFrame->getChildrenFrame();
793 CAMITK_ERROR(
"Component",
"getTransformFromWorld",
"Delegate myFrame is not instanciated.")
794 return myFrame->getTransformFromWorld();
799 CAMITK_ERROR(
"Component",
"getTransform",
"Delegate myFrame is not instanciated.")
800 return myFrame->getTransform();
805 CAMITK_ERROR(
"Component",
"getTransformFromFrame",
"Delegate myFrame is not instanciated.")
806 return myFrame->getTransformFromFrame(frame);
809 delegate1(myFrame, setTransform, vtkSmartPointer<vtkTransform>)
813 delegate3(myFrame, translate,
double,
double,
double)
817 delegate3(myFrame, rotateVTK,
double,
double,
double)
819 delegate3(myFrame, setTransformTranslation,
double,
double,
double)
821 delegate3(myFrame, setTransformTranslationVTK,
double,
double,
double)
823 delegate3(myFrame, setTransformRotation,
double,
double,
double)
825 delegate3(myFrame, setTransformRotationVTK,
double,
double,
double)
827 vtkSmartPointer<vtkAxesActor> getFrameAxisActor() {
829 CAMITK_ERROR(
"Component",
"getFrameAxisActor",
"Delegate myFrame is not instanciated.")
830 return myFrame->getFrameAxisActor();
835 bool getFrameVisibility(
Viewer * viewer)
const {
837 CAMITK_ERROR(
"Component",
"getFrameVisibility",
"Delegate myFrame is not instanciated.")
838 return myFrame->getFrameVisibility(viewer);
852 InterfaceBitMap * mySlice;
873 unsigned int indexOfPropertyExplorerTab;
894 virtual
void initRepresentation() = 0;
909 static QSet<
Viewer*> allViewers;
919 return isSelectedFlag;
930 return childrenComponent;
950 return QPixmap(0, 0);
962 myGeometry->setLabel(n);
967 modifiedFlag = modification;
#define delegateAndInvokeChildren4(HANDLER, METHOD, PARAM_TYPE1, PARAM_TYPE2, PARAM_TYPE3, PARAM_TYPE4)
Definition: sdk/libraries/core/component/Component.h:247
This class describe what are the methods to implement in order to manage dynamic properties.
Definition: InterfaceProperty.h:43
virtual const ComponentList & getChildren()
get the list of the InterfaceNode children (sub items in the hierarchy)
Definition: sdk/libraries/core/component/Component.h:929
#define CAMITK_ERROR(CLASSNAME, METHODNAME, MSG)
Definition: Log.h:49
#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:182
virtual InterfaceFrame * getFrame()
get the associated frame
Definition: sdk/libraries/core/component/Component.h:944
#define delegate1(HANDLER, METHOD, PARAM_TYPE)
Definition: sdk/libraries/core/component/Component.h:156
virtual bool doubleClicked()
this method is called each time the InterfaceNode is double clicked by the user.
Definition: sdk/libraries/core/component/Component.h:923
Exception class to handle abortion in component instanciation.
Definition: AbortException.h:43
const char * description
Definition: applications/cepgenerator/main.cpp:37
#define delegateAndInvokeChildren3(HANDLER, METHOD, PARAM_TYPE1, PARAM_TYPE2, PARAM_TYPE3)
Definition: sdk/libraries/core/component/Component.h:241
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:166
virtual void pointPicked(vtkIdType, bool)
an inherited class can redefine this method something specific.
Definition: sdk/libraries/core/component/Component.h:647
this Component can be displayed as a SLICE
Definition: sdk/libraries/core/component/Component.h:310
const vtkSmartPointer< vtkTransform > getTransform() const
Get the transformation with respect to the parent frame.
Definition: sdk/libraries/core/component/Component.h:797
delegate1(myFrame, setFrameName, QString) InterfaceFrame *getParentFrame() const
Definition: sdk/libraries/core/component/Component.h:771
This class describe what are the methods to implement for a hierarchical tree node.
Definition: InterfaceNode.h:58
Definition: Action.cpp:40
const vtkSmartPointer< vtkTransform > getTransformFromWorld() const
Transforms accessors / Modifyers.
Definition: sdk/libraries/core/component/Component.h:791
this Component can be displayed as a GEOMETRY
Definition: sdk/libraries/core/component/Component.h:309
A Component represents something that could be included in the explorer view, the interactive 3D view...
Definition: sdk/libraries/core/component/Component.h:299
This class describes what are the methods to implement in order to manage a Component position in spa...
Definition: InterfaceFrame.h:64
CAMITK_API QList< Component * > ComponentList
A list of Component.
Definition: CamiTKAPI.h:86
#define CAMITK_API
Definition: CamiTKAPI.h:49
const QVector< InterfaceFrame * > & getChildrenFrame() const
Get the Children Frames from the current Frame in the Frame Hierarchy The Frame hierarchy may not be ...
Definition: sdk/libraries/core/component/Component.h:785
virtual QString getName() const
get the name to be displayed
Definition: sdk/libraries/core/component/Component.h:934
virtual void setModified(bool modified=true)
set the modified flag
Definition: sdk/libraries/core/component/Component.h:966
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:571
#define delegateAndInvokeChildren1Array(HANDLER, METHOD, PARAM_TYPE1, PARAM_TYPE2, DIM)
Definition: sdk/libraries/core/component/Component.h:235
virtual unsigned int getNumberOfPropertyWidget()
get the number of alternative property widgets
Definition: sdk/libraries/core/component/Component.h:437
virtual QWidget * getPropertyWidgetAt(unsigned int i, QWidget *parent=0)
Get the ith alternative property widget.
Definition: sdk/libraries/core/component/Component.h:448
#define delegate4(HANDLER, METHOD, PARAM_TYPE1, PARAM_TYPE2, PARAM_TYPE3, PARAM_TYPE4)
Definition: sdk/libraries/core/component/Component.h:171
#define delegate2(HANDLER, METHOD, PARAM_TYPE1, PARAM_TYPE2)
Definition: sdk/libraries/core/component/Component.h:161
void setParentFrame(InterfaceFrame *frame, bool keepTransform=true)
Set the parent frame and update or not its transform during the parent transition.
Definition: sdk/libraries/core/component/Component.h:779
virtual InterfaceNode * getParent()
get the parent Component
Definition: sdk/libraries/core/component/Component.h:939
void setLabel(QString newName)
set the string used to display the label, do the same as setName
Definition: sdk/libraries/core/component/Component.h:980
#define delegateGet1(HANDLER, METHOD, TYPE, PARAM_TYPE)
Definition: sdk/libraries/core/component/Component.h:189
virtual unsigned int getNumberOfProp() const
return the number of additional prop
Definition: sdk/libraries/core/component/Component.h:609
const vtkSmartPointer< vtkTransform > getTransformFromFrame(InterfaceFrame *frame) const
Compute the transformation from any other frame to the current frame.
Definition: sdk/libraries/core/component/Component.h:803
virtual bool inItalic() const
A component name is not displayed in italic by default.
Definition: sdk/libraries/core/component/Component.h:954
Representation
The different representation that can be implemented to represent this Component in the InteractiveVi...
Definition: sdk/libraries/core/component/Component.h:308
virtual bool getModified() const
set the modified flag
Definition: sdk/libraries/core/component/Component.h:971
virtual QObject * getPropertyObject()
Get the property object that could be understood by PropertyEditor.
Definition: sdk/libraries/core/component/Component.h:463
virtual QPixmap getIcon()
Get the pixmap that will be displayed for this node.
Definition: sdk/libraries/core/component/Component.h:949
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:151
virtual vtkSmartPointer< vtkProp > getProp(unsigned int index)
return an additional prop by its index
Definition: sdk/libraries/core/component/Component.h:617
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:625
virtual bool removeProp(const QString &name)
remove a given additional prop.
Definition: sdk/libraries/core/component/Component.h:634
delegate2(myFrame, setFrameVisibility, Viewer *, bool) bool getFrameVisibility(Viewer *viewer) const
Definition: sdk/libraries/core/component/Component.h:833
#define delegateAndInvokeChildren2(HANDLER, METHOD, PARAM_TYPE1, PARAM_TYPE2)
Definition: sdk/libraries/core/component/Component.h:229
#define delegateConstGet1(HANDLER, METHOD, TYPE, PARAM_TYPE)
Definition: sdk/libraries/core/component/Component.h:212
virtual void setName(const QString &)
set the name to be displayed
Definition: sdk/libraries/core/component/Component.h:959
const QString getLabel() const
Definition: sdk/libraries/core/component/Component.h:976
virtual void cellPicked(vtkIdType, bool)
an inherited class can redefine this method something specific.
Definition: sdk/libraries/core/component/Component.h:652
#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:223
#define delegateConstGet0(HANDLER, METHOD, TYPE)
delegateConstGet macros: Same as delegateGet but for const METHOD
Definition: sdk/libraries/core/component/Component.h:205
This class describes a property that can be used in components and actions or any class that needs to...
Definition: Property.h:260