26 #ifndef CAMITK_COMPONENT_H 27 #define CAMITK_COMPONENT_H 43 #include <vtkWindowLevelLookupTable.h> 44 #include <vtkImageData.h> 45 #include <vtkPointSet.h> 46 #include <vtkSmartPointer.h> 47 #include <vtkAlgorithmOutput.h> 49 #include <vtkAxesActor.h> 50 #include <vtkActor2D.h> 51 #include <vtkImageActor.h> 52 #include <vtkTransform.h> 58 class vtkUnstructuredGridAlgorithm;
59 class vtkDataSetToUnstructuredGridFilter;
60 class vtkWindowLevelLookupTable;
73 #define invoke0(HANDLER,METHOD) \ 77 #define invoke1(HANDLER,METHOD,PARAM) \ 79 HANDLER->METHOD(PARAM); 81 #define invoke2(HANDLER,METHOD,PARAM1,PARAM2) \ 83 HANDLER->METHOD(PARAM1,PARAM2); 85 #define invoke3(HANDLER,METHOD,PARAM1,PARAM2,PARAM3) \ 87 HANDLER->METHOD(PARAM1,PARAM2,PARAM3); 89 #define invoke4(HANDLER,METHOD,PARAM1,PARAM2,PARAM3,PARAM4) \ 91 HANDLER->METHOD(PARAM1,PARAM2,PARAM3,PARAM4); 97 #define invokeGet0(HANDLER,METHOD) \ 99 return HANDLER->METHOD(); 101 #define invokeGet1(HANDLER,METHOD,PARAM) \ 103 return HANDLER->METHOD(PARAM); 105 #define invokeGet2(HANDLER,METHOD,PARAM1,PARAM2) \ 107 return HANDLER->METHOD(PARAM1,PARAM2); 109 #define invokeGet3(HANDLER,METHOD,PARAM1,PARAM2,PARAM3) \ 111 return HANDLER->METHOD(PARAM1,PARAM2,PARAM3); 113 #define invokeGet4(HANDLER,METHOD,PARAM1,PARAM2,PARAM3,PARAM4) \ 115 return HANDLER->METHOD(PARAM1,PARAM2,PARAM3,PARAM4); 120 #define invokeChildren0(METHOD) \ 121 foreach (Component *child, childrenComponent) { \ 125 #define invokeChildren1(METHOD,PARAM) \ 126 foreach (Component *child, childrenComponent) { \ 127 child->METHOD(PARAM); \ 130 #define invokeChildren2(METHOD,PARAM1,PARAM2) \ 131 foreach (Component *child, childrenComponent) { \ 132 child->METHOD(PARAM1,PARAM2); \ 135 #define invokeChildren3(METHOD,PARAM1,PARAM2,PARAM3) \ 136 foreach (Component *child, childrenComponent) { \ 137 child->METHOD(PARAM1,PARAM2,PARAM3); \ 140 #define invokeChildren4(METHOD,PARAM1,PARAM2,PARAM3,PARAM4) \ 141 foreach (Component *child, childrenComponent) { \ 142 child->METHOD(PARAM1,PARAM2,PARAM3,PARAM4); \ 150 #define delegate0(HANDLER,METHOD) \ 151 virtual void METHOD() { \ 152 invoke0(HANDLER,METHOD) \ 155 #define delegate1(HANDLER,METHOD,PARAM_TYPE) \ 156 virtual void METHOD(PARAM_TYPE param) { \ 157 invoke1(HANDLER,METHOD,param) \ 160 #define delegate2(HANDLER,METHOD,PARAM_TYPE1,PARAM_TYPE2) \ 161 virtual void METHOD(PARAM_TYPE1 param1, PARAM_TYPE2 param2) { \ 162 invoke2(HANDLER,METHOD,param1,param2) \ 165 #define delegate3(HANDLER,METHOD,PARAM_TYPE1,PARAM_TYPE2,PARAM_TYPE3) \ 166 virtual void METHOD(PARAM_TYPE1 param1, PARAM_TYPE2 param2, PARAM_TYPE3 param3) { \ 167 invoke3(HANDLER,METHOD,param1,param2,param3) \ 170 #define delegate4(HANDLER,METHOD,PARAM_TYPE1,PARAM_TYPE2,PARAM_TYPE3, PARAM_TYPE4) \ 171 virtual void METHOD(PARAM_TYPE1 param1, PARAM_TYPE2 param2, PARAM_TYPE3 param3, PARAM_TYPE4 param4) { \ 172 invoke4(HANDLER,METHOD,param1,param2,param3,param4) \ 181 #define delegateGet0(HANDLER,METHOD,TYPE) \ 182 virtual TYPE METHOD() { \ 183 invokeGet0(HANDLER,METHOD) \ 188 #define delegateGet1(HANDLER,METHOD,TYPE,PARAM_TYPE) \ 189 virtual TYPE METHOD(PARAM_TYPE param) { \ 190 invokeGet1(HANDLER,METHOD,param) \ 195 #define delegateGet2(HANDLER,METHOD,TYPE,PARAM1_TYPE,PARAM2_TYPE) \ 196 virtual TYPE METHOD(PARAM1_TYPE param1, PARAM2_TYPE param2) { \ 197 invokeGet2(HANDLER,METHOD,param1,param2) \ 204 #define delegateConstGet0(HANDLER,METHOD,TYPE) \ 205 virtual TYPE METHOD() const { \ 206 invokeGet0(HANDLER,METHOD) \ 211 #define delegateConstGet1(HANDLER,METHOD,TYPE,PARAM_TYPE) \ 212 virtual TYPE METHOD(PARAM_TYPE param) const { \ 213 invokeGet1(HANDLER,METHOD,param) \ 222 #define delegateAndInvokeChildren1(HANDLER,METHOD,PARAM_TYPE) \ 223 virtual void METHOD(PARAM_TYPE param) { \ 224 invoke1(HANDLER,METHOD,param) \ 225 invokeChildren1(METHOD,param) \ 228 #define delegateAndInvokeChildren2(HANDLER,METHOD,PARAM_TYPE1,PARAM_TYPE2) \ 229 virtual void METHOD(PARAM_TYPE1 param1, PARAM_TYPE2 param2) { \ 230 invoke2(HANDLER,METHOD,param1,param2) \ 231 invokeChildren2(METHOD,param1,param2) \ 234 #define delegateAndInvokeChildren1Array(HANDLER,METHOD,PARAM_TYPE1,PARAM_TYPE2,DIM) \ 235 virtual void METHOD(PARAM_TYPE1 param1, PARAM_TYPE2 param2[DIM]) { \ 236 invoke2(HANDLER,METHOD,param1,param2) \ 237 invokeChildren2(METHOD,param1,param2) \ 240 #define delegateAndInvokeChildren3(HANDLER,METHOD,PARAM_TYPE1,PARAM_TYPE2,PARAM_TYPE3) \ 241 virtual void METHOD(PARAM_TYPE1 param1, PARAM_TYPE2 param2, PARAM_TYPE3 param3) { \ 242 invoke3(HANDLER,METHOD,param1,param2,param3) \ 243 invokeChildren3(METHOD,param1,param2,param3) \ 246 #define delegateAndInvokeChildren4(HANDLER,METHOD,PARAM_TYPE1,PARAM_TYPE2,PARAM_TYPE3,PARAM_TYPE4) \ 247 virtual void METHOD(PARAM_TYPE1 param1, PARAM_TYPE2 param2, PARAM_TYPE3 param3,PARAM_TYPE4 param4) { \ 248 invoke4(HANDLER,METHOD,param1,param2,param3,param4) \ 249 invokeChildren4(METHOD,param1,param2,param3,param4) \ 352 bool isTopLevel()
const;
358 virtual Component* getTopLevelComponent();
364 virtual void setModified(
bool modified =
true);
367 virtual bool getModified()
const;
370 virtual void setVisibility(
Viewer*,
bool);
373 virtual bool getVisibility(
Viewer*)
const;
376 virtual void refresh()
const;
384 virtual void refreshInterfaceNode();
387 virtual bool isSelected()
const;
393 virtual void setSelected(
const bool b,
const bool recursive =
true);
396 const QString getFileName()
const;
399 void setFileName(
const QString&);
402 bool event(QEvent* e)
override;
405 QMenu* getActionMenu();
412 QStringList getHierarchy()
const override;
417 bool isInstanceOf(QString className)
const override;
453 void updateProperty(QString name, QVariant value)
override;
463 this->indexOfPropertyExplorerTab = index;
474 return this->indexOfPropertyExplorerTab;
483 Q_INVOKABLE
Property* getProperty(QString name)
override;
493 bool addProperty(
Property*)
override;
513 void deleteChildren()
override;
514 QString getName()
const override;
515 void setName(
const QString&)
override;
517 bool doubleClicked()
override;
519 QPixmap getIcon()
override;
524 bool inItalic()
const override;
536 const QString getLabel()
const override;
541 void setLabel(QString newName)
override;
543 delegateGet0(myGeometry, getPointSet, vtkSmartPointer<vtkPointSet>)
545 delegate1(myGeometry, setPointSet, vtkSmartPointer<vtkPointSet>)
547 delegate1(myGeometry, setPointData, vtkSmartPointer<vtkDataArray>)
551 delegate1(myGeometry, setDataConnection, vtkSmartPointer<vtkAlgorithmOutput>)
553 delegateGet1(myGeometry, getActor, vtkSmartPointer<vtkActor>, const RenderingModes)
557 vtkSmartPointer<vtkProp> getProp(const QString& param) {
559 return myGeometry->getProp(param);
562 return mySlice->getProp(param);
569 return myGeometry->getNumberOfProp();
572 return mySlice->getNumberOfProp();
577 vtkSmartPointer<vtkProp>
getProp(
unsigned int index) {
579 return myGeometry->getProp(index);
582 return mySlice->getProp(index);
587 bool addProp(
const QString& name, vtkSmartPointer<vtkProp> prop) {
589 return myGeometry->addProp(name, prop);
592 return mySlice->addProp(name, prop);
600 return myGeometry->removeProp(name);
603 return mySlice->removeProp(name);
623 void getBounds(
double* bounds)
override;
628 double getBoundingRadius()
override;
630 delegate4(myGeometry, setPointPosition,
const unsigned int,
const double,
const double,
const double)
646 void getActorColor(const RenderingModes,
double [4]) override;
658 delegate2(myGeometry, setMapperScalarRange,
double,
double)
660 delegate1(myGeometry, setTexture, vtkSmartPointer<vtkTexture>)
662 void setGlyphType(const GlyphTypes type, const
double size = 0.0) override;
664 delegate1(myGeometry, setLinesAsTubes,
bool)
666 delegate1(myGeometry, setMeshWorldTransform, vtkSmartPointer<vtkTransform>)
677 delegate1(mySlice, setOriginalVolume, vtkSmartPointer<vtkImageData>)
689 delegate3(mySlice, pixelPicked,
double,
double,
double)
699 delegate3(mySlice, setPixelRealPosition,
double,
double,
double)
701 delegate1(mySlice, setImageWorldTransform, vtkSmartPointer<vtkTransform>)
704 int getNumberOfSlices() const override;
707 int getSlice() const override;
715 const QString& getFrameName() const override;
718 delegate1(myFrame, setFrameName, QString)
722 void setParentFrame(
InterfaceFrame* frame,
bool keepTransform = true) override;
724 const QVector<
InterfaceFrame*>& getChildrenFrame() const override;
726 const vtkSmartPointer<vtkTransform> getTransformFromWorld() const override;
728 const vtkSmartPointer<vtkTransform> getTransform() const override;
730 const vtkSmartPointer<vtkTransform> getTransformFromFrame(
InterfaceFrame* frame) const override;
732 delegate1(myFrame, setTransform, vtkSmartPointer<vtkTransform>)
736 delegate3(myFrame, translate,
double,
double,
double)
740 delegate3(myFrame, rotateVTK,
double,
double,
double)
742 delegate3(myFrame, setTransformTranslation,
double,
double,
double)
744 delegate3(myFrame, setTransformTranslationVTK,
double,
double,
double)
746 delegate3(myFrame, setTransformRotation,
double,
double,
double)
748 delegate3(myFrame, setTransformRotationVTK,
double,
double,
double)
750 vtkSmartPointer<vtkAxesActor> getFrameAxisActor() override;
754 bool getFrameVisibility(Viewer* viewer) const override;
788 unsigned int indexOfPropertyExplorerTab;
809 virtual
void initRepresentation() = 0;
812 QMap<Viewer*,
bool> myViewers;
824 static QSet<Viewer*> allViewers;
834 return isSelectedFlag;
845 return childrenComponent;
865 return QPixmap(0, 0);
877 myGeometry->setLabel(n);
883 modifiedFlag = modification;
#define delegateAndInvokeChildren4(HANDLER, METHOD, PARAM_TYPE1, PARAM_TYPE2, PARAM_TYPE3, PARAM_TYPE4)
Definition: sdk/libraries/core/component/Component.h:246
This class describe what are the methods to implement in order to manage dynamic properties.
Definition: InterfaceProperty.h:43
This class describes what are the methods to implement for a BitMap.
Definition: InterfaceBitMap.h:63
#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:181
virtual InterfaceFrame * getFrame()
get the associated frame
Definition: sdk/libraries/core/component/Component.h:859
InterfaceNode * getParent() override
get the parent Component
Definition: sdk/libraries/core/component/Component.h:854
#define delegate1(HANDLER, METHOD, PARAM_TYPE)
Definition: sdk/libraries/core/component/Component.h:155
QPixmap getIcon() override
Get the pixmap that will be displayed for this node.
Definition: sdk/libraries/core/component/Component.h:864
unsigned int getNumberOfPropertyWidget()
get the number of alternative property widgets
Definition: sdk/libraries/core/component/Component.h:423
#define delegateAndInvokeChildren3(HANDLER, METHOD, PARAM_TYPE1, PARAM_TYPE2, PARAM_TYPE3)
Definition: sdk/libraries/core/component/Component.h:240
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:165
this Component can be displayed as a SLICE
Definition: sdk/libraries/core/component/Component.h:309
This class describe what are the methods to implement for a hierarchical tree node.
Definition: InterfaceNode.h:58
bool inItalic() const override
A component name is not displayed in italic by default.
Definition: sdk/libraries/core/component/Component.h:869
Definition: Action.cpp:36
this Component can be displayed as a GEOMETRY
Definition: sdk/libraries/core/component/Component.h:308
void pointPicked(vtkIdType, bool)
an inherited class can redefine this method something specific.
Definition: sdk/libraries/core/component/Component.h:613
unsigned int getNumberOfProp() const
return the number of additional prop
Definition: sdk/libraries/core/component/Component.h:567
A Component represents something that could be included in the explorer view, the interactive 3D view...
Definition: sdk/libraries/core/component/Component.h:298
This class describes what are the methods to implement in order to manage a Component position in spa...
Definition: InterfaceFrame.h:64
#define CAMITK_API
Definition: CamiTKAPI.h:49
virtual void setModified(bool modified=true)
set the modified flag
Definition: sdk/libraries/core/component/Component.h:882
bool removeProp(const QString &name)
remove a given additional prop.
Definition: sdk/libraries/core/component/Component.h:598
void setIndexOfPropertyExplorerTab(unsigned int index)
Set the index of the tab in the ProperlyExplorer to select for display.
Definition: sdk/libraries/core/component/Component.h:462
bool doubleClicked() override
this method is called each time the InterfaceNode is double clicked by the user.
Definition: sdk/libraries/core/component/Component.h:838
const ComponentList & getChildren() override
get the list of the InterfaceNode children (sub items in the hierarchy)
Definition: sdk/libraries/core/component/Component.h:844
#define delegateAndInvokeChildren1Array(HANDLER, METHOD, PARAM_TYPE1, PARAM_TYPE2, DIM)
Definition: sdk/libraries/core/component/Component.h:234
QWidget * getPropertyWidgetAt(unsigned int i)
Get the ith alternative property widget.
Definition: sdk/libraries/core/component/Component.h:431
#define delegate4(HANDLER, METHOD, PARAM_TYPE1, PARAM_TYPE2, PARAM_TYPE3, PARAM_TYPE4)
Definition: sdk/libraries/core/component/Component.h:170
unsigned int getIndexOfPropertyExplorerTab()
Get the index of the tab in the ProperlyExplorer to select for display.
Definition: sdk/libraries/core/component/Component.h:473
#define delegate2(HANDLER, METHOD, PARAM_TYPE1, PARAM_TYPE2)
Definition: sdk/libraries/core/component/Component.h:160
QString getName() const override
get the name to be displayed
Definition: sdk/libraries/core/component/Component.h:849
QList< Component * > ComponentList
A list of Component.
Definition: CamiTKAPI.h:89
#define delegateGet1(HANDLER, METHOD, TYPE, PARAM_TYPE)
Definition: sdk/libraries/core/component/Component.h:188
vtkSmartPointer< vtkProp > getProp(unsigned int index)
return an additional prop by its index
Definition: sdk/libraries/core/component/Component.h:577
void setName(const QString &) override
set the name to be displayed
Definition: sdk/libraries/core/component/Component.h:874
Representation
The different representation that can be implemented to represent this Component in the InteractiveVi...
Definition: sdk/libraries/core/component/Component.h:307
virtual bool getModified() const
set the modified flag
Definition: sdk/libraries/core/component/Component.h:887
void setLabel(QString newName) override
set the string used to display the label, do the same as setName
Definition: sdk/libraries/core/component/Component.h:896
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:150
#define delegateAndInvokeChildren2(HANDLER, METHOD, PARAM_TYPE1, PARAM_TYPE2)
Definition: sdk/libraries/core/component/Component.h:228
#define delegateConstGet1(HANDLER, METHOD, TYPE, PARAM_TYPE)
Definition: sdk/libraries/core/component/Component.h:211
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:587
void cellPicked(vtkIdType, bool)
an inherited class can redefine this method something specific.
Definition: sdk/libraries/core/component/Component.h:618
const QString getLabel() const override
Definition: sdk/libraries/core/component/Component.h:892
QObject * getPropertyObject()
Get the property object that could be understood by PropertyEditor.
Definition: sdk/libraries/core/component/Component.h:443
#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:222
QMenu * getPopupMenu(QWidget *parent=nullptr)
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:527
#define delegateConstGet0(HANDLER, METHOD, TYPE)
delegateConstGet macros: Same as delegateGet but for const METHOD
Definition: sdk/libraries/core/component/Component.h:204
This class describes a property that can be used in components and actions or any class that needs to...
Definition: Property.h:291