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) \
325 Component(
const QString & file,
const QString &
name, Representation rep = NO_REPRESENTATION);
342 Representation getRepresentation() const;
345 bool isTopLevel() const;
348 virtual Component * getParentComponent();
351 virtual Component * getTopLevelComponent();
357 virtual
void setModified(
bool modified = true);
360 virtual
bool getModified() const;
363 virtual
void setVisibility(
Viewer *,
bool);
366 virtual
bool getVisibility(Viewer *) const;
369 virtual
void refresh() const;
377 virtual
void refreshInterfaceNode();
380 virtual
bool isSelected() const;
386 virtual
void setSelected(const
bool b, const
bool recursive = true);
389 const QString getFileName() const;
392 void setFileName(const QString &);
395 bool event(QEvent* e);
398 QMenu * getActionMenu();
405 QStringList getHierarchy();
410 bool isInstanceOf(QString className);
422 virtual QWidget * getPropertyWidget(QWidget* parent = 0) {
432 if (this->getPropertyWidget())
443 if (this->getPropertyWidget() && (i==0))
444 return this->getPropertyWidget();
467 void updateProperty(QString
name, QVariant value);
483 virtual bool setDynamicProperty(
const char *
name,
const QVariant &value,
const char *
description =
"",
bool isReadOnly=
false);
492 virtual inline void setIndexOfPropertyExplorerTab(
unsigned int index) {
493 this->indexOfPropertyExplorerTab = index;
503 virtual inline unsigned int getIndexOfPropertyExplorerTab() {
504 return this->indexOfPropertyExplorerTab;
512 QMenu * getActionAndPopupMenu();
522 Q_INVOKABLE
virtual Property* getProperty(QString
name);
532 virtual bool addProperty(Property*);
540 virtual void addChild(InterfaceNode *);
541 virtual void attachChild(InterfaceNode *);
545 virtual void removeChild(InterfaceNode *);
548 virtual void setParent(InterfaceNode *);
551 virtual void deleteChildren();
552 virtual QString getName()
const;
553 virtual void setName(
const QString&);
555 virtual bool doubleClicked();
556 virtual InterfaceNode * getParent();
557 virtual QPixmap getIcon();
562 virtual bool inItalic()
const;
574 const QString getLabel()
const;
579 void setLabel(QString newName);
581 delegateGet0(myGeometry, getPointSet, vtkSmartPointer<vtkPointSet> )
583 delegate1(myGeometry, setPointSet, vtkSmartPointer<vtkPointSet> )
585 delegate1(myGeometry, setPointData, vtkSmartPointer<vtkDataArray> )
589 delegate1(myGeometry, setDataConnection, vtkSmartPointer<vtkAlgorithmOutput> )
591 delegateGet1(myGeometry, getActor, vtkSmartPointer<vtkActor>, const RenderingModes)
595 virtual vtkSmartPointer<vtkProp> getProp(const QString ¶m) {
597 return myGeometry->getProp(param);
599 return mySlice->getProp(param);
605 return myGeometry->getNumberOfProp();
607 return mySlice->getNumberOfProp();
611 virtual vtkSmartPointer<vtkProp>
getProp(
unsigned int index) {
613 return myGeometry->getProp(index);
615 return mySlice->getProp(index);
619 virtual bool addProp(
const QString &
name, vtkSmartPointer<vtkProp> prop) {
621 return myGeometry->addProp(name, prop);
623 return mySlice->addProp(name, prop);
630 return myGeometry->removeProp(name);
632 return mySlice->removeProp(name);
651 virtual void getBounds(
double *bounds);
656 virtual double getBoundingRadius();
658 delegate4(myGeometry, setPointPosition,
const unsigned int,
const double,
const double,
const double)
674 virtual
void getActorColor(const RenderingModes,
double [4]);
686 delegate2(myGeometry, setMapperScalarRange,
double,
double)
688 delegate1(myGeometry, setTexture, vtkSmartPointer<vtkTexture>)
690 virtual
void setGlyphType(const GlyphTypes
type, const
double size = 0.0);
692 delegate1(myGeometry, setLinesAsTubes,
bool)
694 delegate1(myGeometry, setMeshWorldTransform, vtkSmartPointer<vtkTransform>)
705 delegate1(mySlice, setOriginalVolume, vtkSmartPointer<vtkImageData>)
717 delegate3(mySlice, pixelPicked,
double,
double,
double)
733 delegate3(mySlice, setPixelRealPosition,
double,
double,
double)
735 delegate1(mySlice, setImageWorldTransform, vtkSmartPointer<vtkTransform>)
738 virtual
double getRotationX() const;
741 virtual
double getRotationY() const;
744 virtual
double getRotationZ() const;
747 virtual
int getNumberOfSlices() const;
750 virtual
int getSlice() const;
758 const QString & getFrameName()
const {
761 CAMITK_ERROR(
"Component",
"getFrameName",
"Delegate myFrame is not instanciated.")
762 return myFrame->getFrameName();
769 CAMITK_ERROR(
"Component",
"getParentFrame",
"Delegate myFrame is not instanciated.")
770 return myFrame->getParentFrame();
775 CAMITK_ERROR(
"Component",
"setParentFrame",
"Delegate myFrame is not instanciated.")
776 return myFrame->setParentFrame(frame, keepTransform);
781 CAMITK_ERROR(
"Component",
"getChildrenFrame",
"Delegate myFrame is not instanciated.")
782 return myFrame->getChildrenFrame();
787 CAMITK_ERROR(
"Component",
"getTransformFromWorld",
"Delegate myFrame is not instanciated.")
788 return myFrame->getTransformFromWorld();
793 CAMITK_ERROR(
"Component",
"getTransform",
"Delegate myFrame is not instanciated.")
794 return myFrame->getTransform();
799 CAMITK_ERROR(
"Component",
"getTransformFromFrame",
"Delegate myFrame is not instanciated.")
800 return myFrame->getTransformFromFrame(frame);
803 delegate1(myFrame, setTransform, vtkSmartPointer<vtkTransform>)
807 delegate3(myFrame, translate,
double,
double,
double)
811 delegate3(myFrame, setTransformTranslation,
double,
double,
double)
813 delegate3(myFrame, setTransformRotation,
double,
double,
double)
815 vtkSmartPointer<vtkAxesActor> getFrameAxisActor() {
817 CAMITK_ERROR(
"Component",
"getFrameAxisActor",
"Delegate myFrame is not instanciated.")
818 return myFrame->getFrameAxisActor();
823 bool getFrameVisibility(
Viewer * viewer)
const {
825 CAMITK_ERROR(
"Component",
"getFrameVisibility",
"Delegate myFrame is not instanciated.")
826 return myFrame->getFrameVisibility(viewer);
840 InterfaceBitMap * mySlice;
861 unsigned int indexOfPropertyExplorerTab;
882 virtual
void initRepresentation() = 0;
897 static QSet<Viewer*> allViewers;
907 return isSelectedFlag;
918 return childrenComponent;
950 myGeometry->setLabel(n);
955 modifiedFlag = modification;
this Component can be displayed as a GEOMETRY
Definition: sdk/libraries/core/component/Component.h:309
#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:917
#define CAMITK_ERROR(CLASSNAME, METHODNAME, MSG)
Definition: Log.h:49
void init()
Definition: obj2pml.cpp:213
#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:932
this Component can be displayed as a SLICE
Definition: sdk/libraries/core/component/Component.h:310
#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:911
delegate2(myFrame, setFrameVisibility, Viewer *, bool) bool getFrameVisibility(Viewer *viewer) const
Definition: sdk/libraries/core/component/Component.h:821
Exception class to handle abortion in component instanciation.
Definition: AbortException.h:43
const char * description
Definition: applications/cepgenerator/main.cpp:37
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:779
#define delegateAndInvokeChildren3(HANDLER, METHOD, PARAM_TYPE1, PARAM_TYPE2, PARAM_TYPE3)
Definition: sdk/libraries/core/component/Component.h:241
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:797
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:641
string name
Definition: select.cpp:111
Representation
The different representation that can be implemented to represent this Component in the InteractiveVi...
Definition: sdk/libraries/core/component/Component.h:308
This class describe what are the methods to implement for a hierarchical tree node.
Definition: InterfaceNode.h:57
Definition: Action.cpp:40
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
virtual void setModified(bool modified=true)
set the modified flag
Definition: sdk/libraries/core/component/Component.h:954
virtual QString getName() const
get the name to be displayed
Definition: sdk/libraries/core/component/Component.h:922
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:565
#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:431
virtual QWidget * getPropertyWidgetAt(unsigned int i, QWidget *parent=0)
Get the ith alternative property widget.
Definition: sdk/libraries/core/component/Component.h:442
virtual bool inItalic() const
A component name is not displayed in italic by default.
Definition: sdk/libraries/core/component/Component.h:942
#define delegate4(HANDLER, METHOD, PARAM_TYPE1, PARAM_TYPE2, PARAM_TYPE3, PARAM_TYPE4)
Definition: sdk/libraries/core/component/Component.h:171
virtual bool getModified() const
set the modified flag
Definition: sdk/libraries/core/component/Component.h:959
const QString getLabel() const
Definition: sdk/libraries/core/component/Component.h:964
const vtkSmartPointer< vtkTransform > getTransformFromWorld() const
Transforms accessors / Modifyers.
Definition: sdk/libraries/core/component/Component.h:785
#define delegate2(HANDLER, METHOD, PARAM_TYPE1, PARAM_TYPE2)
Definition: sdk/libraries/core/component/Component.h:161
StructureProperties::GeometricType type
Definition: ansys2pml.cpp:40
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:773
virtual InterfaceNode * getParent()
get the parent Component
Definition: sdk/libraries/core/component/Component.h:927
void setLabel(QString newName)
set the string used to display the label, do the same as setName
Definition: sdk/libraries/core/component/Component.h:968
#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:603
virtual QObject * getPropertyObject()
Get the property object that could be understood by PropertyEditor.
Definition: sdk/libraries/core/component/Component.h:457
virtual QPixmap getIcon()
Get the pixmap that will be displayed for this node.
Definition: sdk/libraries/core/component/Component.h:937
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:611
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:619
virtual bool removeProp(const QString &name)
remove a given additional prop.
Definition: sdk/libraries/core/component/Component.h:628
#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:947
const vtkSmartPointer< vtkTransform > getTransform() const
Get the transformation with respect to the parent frame.
Definition: sdk/libraries/core/component/Component.h:791
virtual void cellPicked(vtkIdType, bool)
an inherited class can redefine this method something specific.
Definition: sdk/libraries/core/component/Component.h:646
#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:195
delegate1(myFrame, setFrameName, QString) InterfaceFrame *getParentFrame() const
Definition: sdk/libraries/core/component/Component.h:765