Computer Assited Medical Intervention Tool Kit  version 4.0
sdk/libraries/core/component/Component.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * $CAMITK_LICENCE_BEGIN$
3  *
4  * CamiTK - Computer Assisted Medical Intervention ToolKit
5  * (c) 2001-2016 Univ. Grenoble Alpes, CNRS, TIMC-IMAG UMR 5525 (GMCAO)
6  *
7  * Visit http://camitk.imag.fr for more information
8  *
9  * This file is part of CamiTK.
10  *
11  * CamiTK is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * CamiTK is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU Lesser General Public License version 3 for more details.
19  *
20  * You should have received a copy of the GNU Lesser General Public License
21  * version 3 along with CamiTK. If not, see <http://www.gnu.org/licenses/>.
22  *
23  * $CAMITK_LICENCE_END$
24  ****************************************************************************/
25 
26 #ifndef CAMITK_COMPONENT_H
27 #define CAMITK_COMPONENT_H
28 
29 // -- Core stuff
30 #include "InterfaceNode.h"
31 #include "InterfaceGeometry.h"
32 #include "InterfaceBitMap.h"
33 #include "InterfaceProperty.h"
34 #include "InterfaceFrame.h"
35 #include "AbortException.h"
36 #include "Log.h"
37 
38 // -- QT stuff
39 #include <QPixmap>
40 #include <QMenu>
41 #include <QVector>
42 
43 // -- vtk stuff
44 #include <vtkWindowLevelLookupTable.h>
45 #include <vtkImageData.h>
46 #include <vtkPointSet.h>
47 #include <vtkSmartPointer.h>
48 #include <vtkAlgorithmOutput.h>
49 #include <vtkActor.h>
50 #include <vtkAxesActor.h>
51 #include <vtkActor2D.h>
52 #include <vtkImageActor.h>
53 #include <vtkTransform.h>
54 
55 // -- vtk stuff Classes
56 class vtkActor;
57 class vtkTexture;
58 class vtkPointSet;
59 class vtkUnstructuredGridAlgorithm;
60 class vtkDataSetToUnstructuredGridFilter;
61 class vtkWindowLevelLookupTable;
62 
63 // -----------------------------------------------------------------------
64 //
65 // Delegation macros
66 // (And your dream comes true)
67 //
68 // -----------------------------------------------------------------------
69 
74 #define invoke0(HANDLER,METHOD) \
75 if (HANDLER) \
76  HANDLER->METHOD();
77 
78 #define invoke1(HANDLER,METHOD,PARAM) \
79 if (HANDLER) \
80  HANDLER->METHOD(PARAM);
81 
82 #define invoke2(HANDLER,METHOD,PARAM1,PARAM2) \
83 if (HANDLER) \
84  HANDLER->METHOD(PARAM1,PARAM2);
85 
86 #define invoke3(HANDLER,METHOD,PARAM1,PARAM2,PARAM3) \
87 if (HANDLER) \
88  HANDLER->METHOD(PARAM1,PARAM2,PARAM3);
89 
90 #define invoke4(HANDLER,METHOD,PARAM1,PARAM2,PARAM3,PARAM4) \
91 if (HANDLER) \
92  HANDLER->METHOD(PARAM1,PARAM2,PARAM3,PARAM4);
93 
98 #define invokeGet0(HANDLER,METHOD) \
99 if (HANDLER) \
100  return HANDLER->METHOD();
101 
102 #define invokeGet1(HANDLER,METHOD,PARAM) \
103 if (HANDLER) \
104  return HANDLER->METHOD(PARAM);
105 
106 #define invokeGet2(HANDLER,METHOD,PARAM1,PARAM2) \
107 if (HANDLER) \
108  return HANDLER->METHOD(PARAM1,PARAM2);
109 
110 #define invokeGet3(HANDLER,METHOD,PARAM1,PARAM2,PARAM3) \
111 if (HANDLER) \
112  return HANDLER->METHOD(PARAM1,PARAM2,PARAM3);
113 
114 #define invokeGet4(HANDLER,METHOD,PARAM1,PARAM2,PARAM3,PARAM4) \
115 if (HANDLER) \
116  return HANDLER->METHOD(PARAM1,PARAM2,PARAM3,PARAM4);
117 
121 #define invokeChildren0(METHOD) \
122 foreach (Component *child, childrenComponent) { \
123  child->METHOD(); \
124  }
125 
126 #define invokeChildren1(METHOD,PARAM) \
127 foreach (Component *child, childrenComponent) { \
128  child->METHOD(PARAM); \
129  }
130 
131 #define invokeChildren2(METHOD,PARAM1,PARAM2) \
132 foreach (Component *child, childrenComponent) { \
133  child->METHOD(PARAM1,PARAM2); \
134  }
135 
136 #define invokeChildren3(METHOD,PARAM1,PARAM2,PARAM3) \
137 foreach (Component *child, childrenComponent) { \
138  child->METHOD(PARAM1,PARAM2,PARAM3); \
139  }
140 
141 #define invokeChildren4(METHOD,PARAM1,PARAM2,PARAM3,PARAM4) \
142 foreach (Component *child, childrenComponent) { \
143  child->METHOD(PARAM1,PARAM2,PARAM3,PARAM4); \
144  }
145 
151 #define delegate0(HANDLER,METHOD) \
152 virtual void METHOD() { \
153  invoke0(HANDLER,METHOD) \
154  }
155 
156 #define delegate1(HANDLER,METHOD,PARAM_TYPE) \
157 virtual void METHOD(PARAM_TYPE param) { \
158  invoke1(HANDLER,METHOD,param) \
159  }
160 
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) \
164  }
165 
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) \
169  }
170 
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) \
174  }
175 
182 #define delegateGet0(HANDLER,METHOD,TYPE) \
183 virtual TYPE METHOD() { \
184  invokeGet0(HANDLER,METHOD) \
185  else \
186  return 0; \
187  }
188 
189 #define delegateGet1(HANDLER,METHOD,TYPE,PARAM_TYPE) \
190 virtual TYPE METHOD(PARAM_TYPE param) { \
191  invokeGet1(HANDLER,METHOD,param) \
192  else \
193  return 0; \
194  }
195 
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) \
199  else \
200  return 0; \
201  }
202 
205 #define delegateConstGet0(HANDLER,METHOD,TYPE) \
206 virtual TYPE METHOD() const { \
207  invokeGet0(HANDLER,METHOD) \
208  else \
209  return 0; \
210  }
211 
212 #define delegateConstGet1(HANDLER,METHOD,TYPE,PARAM_TYPE) \
213 virtual TYPE METHOD(PARAM_TYPE param) const { \
214  invokeGet1(HANDLER,METHOD,param) \
215  else \
216  return 0; \
217  }
218 
223 #define delegateAndInvokeChildren1(HANDLER,METHOD,PARAM_TYPE) \
224 virtual void METHOD(PARAM_TYPE param) { \
225  invoke1(HANDLER,METHOD,param) \
226  invokeChildren1(METHOD,param) \
227  }
228 
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) \
233  }
234 
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) \
239  }
240 
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) \
245  }
246 
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) \
251  }
252 
253 
254 namespace camitk {
255 // -- Core stuff classes
256 class Geometry;
257 class Slice;
258 class Viewer;
259 class Frame;
260 
261 
299 class CAMITK_API Component : public InterfaceProperty, public InterfaceNode, public InterfaceGeometry, public InterfaceBitMap, public InterfaceFrame {
300  Q_OBJECT
301 
302 public:
311  NO_REPRESENTATION
312  };
313 
317 
325  Component(const QString & file, const QString & name, Representation rep = NO_REPRESENTATION);
326 
334  Component(Component *parentComponent, const QString & name, Representation rep = NO_REPRESENTATION) throw(AbortException);
335 
343  virtual ~Component();
344 
348  Representation getRepresentation() const;
349 
351  bool isTopLevel() const;
352 
354  virtual Component * getParentComponent();
355 
357  virtual Component * getTopLevelComponent();
358 
360  virtual InterfaceFrame * getFrame();
361 
363  virtual void setModified(bool modified = true);
364 
366  virtual bool getModified() const;
367 
369  virtual void setVisibility(Viewer *, bool);
370 
372  virtual bool getVisibility(Viewer *) const;
373 
375  virtual void refresh() const;
376 
383  virtual void refreshInterfaceNode();
384 
386  virtual bool isSelected() const;
387 
392  virtual void setSelected(const bool b, const bool recursive = true);
393 
395  const QString getFileName() const;
396 
398  void setFileName(const QString &);
399 
401  bool event(QEvent* e);
402 
404  QMenu * getActionMenu();
406 
411  QStringList getHierarchy();
414 
416  bool isInstanceOf(QString className);
417 
419  // TODO CAMITK_DEPRECATED. This section list all the methods marked as deprecated. They are to be removed in CamiTK 4.0
428  virtual QWidget * getPropertyWidget(QWidget* parent = 0) {
429  return NULL;
430  }
432 
437  virtual unsigned int getNumberOfPropertyWidget() {
438  if (this->getPropertyWidget())
439  return 1;
440  else
441  return 0;
442  }
443 
448  virtual QWidget * getPropertyWidgetAt(unsigned int i, QWidget* parent = 0) {
449  if (this->getPropertyWidget() && (i==0))
450  return this->getPropertyWidget();
451  else
452  return NULL;
453  }
454 
463  virtual QObject * getPropertyObject() {
464  return this;
465  }
466 
473  void updateProperty(QString name, QVariant value);
474 
476  // TODO CAMITK_DEPRECATED. This section list all the methods marked as deprecated. They are to be removed in CamiTK 4.0
489  virtual bool setDynamicProperty(const char *name, const QVariant &value, const char *description = "", bool isReadOnly=false);
490 
498  virtual inline void setIndexOfPropertyExplorerTab(unsigned int index) {
499  this->indexOfPropertyExplorerTab = index;
500  }
501 
509  virtual inline unsigned int getIndexOfPropertyExplorerTab() {
510  return this->indexOfPropertyExplorerTab;
511  }
512 
518  QMenu * getActionAndPopupMenu();
520 
527  Q_INVOKABLE virtual Property* getProperty(QString name);
528 
537  virtual bool addProperty(Property*);
539 
544  //-- the methods below are commented because the default comment in InterfaceNode lacks some information...
546  virtual void addChild(InterfaceNode *);
547  virtual void attachChild(InterfaceNode *);
551  virtual void removeChild(InterfaceNode *);
552 
554  virtual void setParent(InterfaceNode *);
555 
556  //--not commented because Doxygen automatically use the inherited documentation (set INHERIT_DOCS flag to YES in the Doxyfile)
557  virtual void deleteChildren();
558  virtual QString getName() const;
559  virtual void setName(const QString&);
560  virtual const ComponentList & getChildren();
561  virtual bool doubleClicked();
562  virtual InterfaceNode * getParent();
563  virtual QPixmap getIcon();
564 
568  virtual bool inItalic() const;
569 
571  virtual QMenu * getPopupMenu(QWidget* parent = 0) {
572  return NULL;
573  }
575 
580  const QString getLabel() const;
583 
585  void setLabel(QString newName);
586 
587  delegateGet0(myGeometry, getPointSet, vtkSmartPointer<vtkPointSet> )
588 
589  delegate1(myGeometry, setPointSet, vtkSmartPointer<vtkPointSet> )
590 
591  delegate1(myGeometry, setPointData, vtkSmartPointer<vtkDataArray> )
592 
593  delegateConstGet0(myGeometry, getDataPort, vtkSmartPointer<vtkAlgorithmOutput> )
594 
595  delegate1(myGeometry, setDataConnection, vtkSmartPointer<vtkAlgorithmOutput> )
596 
597  delegateGet1(myGeometry, getActor, vtkSmartPointer<vtkActor>, const RenderingModes)
598 
599  // TODO : uses an object myRepresentation (which is a Geometry or a Slice)
600  // to use a single delegate macro
601  virtual vtkSmartPointer<vtkProp> getProp(const QString &param) {
602  if (myGeometry)
603  return myGeometry->getProp(param);
604  else if(mySlice)
605  return mySlice->getProp(param);
606  return NULL;
607  }
608 
609  virtual unsigned int getNumberOfProp() const {
610  if (myGeometry)
611  return myGeometry->getNumberOfProp();
612  else if (mySlice)
613  return mySlice->getNumberOfProp();
614  return 0;
615  }
616 
617  virtual vtkSmartPointer<vtkProp> getProp(unsigned int index) {
618  if (myGeometry)
619  return myGeometry->getProp(index);
620  else if (mySlice)
621  return mySlice->getProp(index);
622  return 0;
623  }
624 
625  virtual bool addProp(const QString &name, vtkSmartPointer<vtkProp> prop) {
626  if (myGeometry)
627  return myGeometry->addProp(name, prop);
628  else if (mySlice)
629  return mySlice->addProp(name, prop);
630  return false;
631  }
632 
633 
634  virtual bool removeProp(const QString & name) {
635  if (myGeometry)
636  return myGeometry->removeProp(name);
637  else if (mySlice)
638  return mySlice->removeProp(name);
639  return false;
640  }
641  // END TODO
642 
643 
647  virtual void pointPicked(vtkIdType, bool) {}
648 
652  virtual void cellPicked(vtkIdType, bool) {}
653 
654  // --
655 
657  virtual void getBounds(double *bounds);
658 
662  virtual double getBoundingRadius();
663 
664  delegate4(myGeometry, setPointPosition, const unsigned int, const double, const double, const double)
665 
666  delegateAndInvokeChildren1(myGeometry, setRenderingModes, const RenderingModes)
667 
669  virtual const InterfaceGeometry::RenderingModes getRenderingModes() const;
670 
671  delegateAndInvokeChildren1(myGeometry, setEnhancedModes, const EnhancedModes)
672 
673  delegateConstGet0(myGeometry, getEnhancedModes, const EnhancedModes)
674 
675  delegateAndInvokeChildren1Array(myGeometry, setActorColor, const RenderingModes, double, 4)
676 
677  delegateAndInvokeChildren4(myGeometry, setActorColor, const RenderingModes, const double, const double, const double)
678 
680  virtual void getActorColor(const RenderingModes, double [4]);
681 
682  delegateAndInvokeChildren3(myGeometry, setColor, const double, const double, const double)
683 
684  delegateAndInvokeChildren4(myGeometry, setColor, const double, const double, const double, const double)
685 
686  delegateAndInvokeChildren2(myGeometry, setActorOpacity, const RenderingModes, const double)
687 
688  delegateConstGet1(myGeometry, getActorOpacity, double, const RenderingModes)
689 
690  delegateAndInvokeChildren1(myGeometry, setOpacity, const double)
691 
692  delegate2(myGeometry, setMapperScalarRange, double, double)
693 
694  delegate1(myGeometry, setTexture, vtkSmartPointer<vtkTexture>)
695 
696  virtual void setGlyphType(const GlyphTypes type, const double size = 0.0);
697 
698  delegate1(myGeometry, setLinesAsTubes, bool)
699 
700  delegate1(myGeometry, setMeshWorldTransform, vtkSmartPointer<vtkTransform>)
701 
703 
708  delegateConstGet0(mySlice, getImageData, vtkSmartPointer<vtkImageData>)
710 
711  delegate1(mySlice, setOriginalVolume, vtkSmartPointer<vtkImageData>)
712 
713  delegateConstGet0(mySlice, get2DImageActor, vtkSmartPointer<vtkImageActor>)
714 
715  delegateConstGet0(mySlice, get3DImageActor, vtkSmartPointer<vtkImageActor>)
716 
717  delegateConstGet0(mySlice, getPickPlaneActor, vtkSmartPointer<vtkActor>)
718 
719  delegateGet0(mySlice, getPixelActor, vtkSmartPointer<vtkActor>)
720 
721 // delegateGet0(mySlice, get2DAxesActor, vtkSmartPointer<vtkAxesActor>)
722 
723  delegate3(mySlice, pixelPicked, double, double, double)
724 
725  delegate0(mySlice, updatePickPlane)
726 
727  delegate1(mySlice, setSlice, int)
728 
729  delegate3(mySlice, setSlice, double, double, double)
730 
731  delegate1(mySlice, setRotationX, double)
732 
733  delegate1(mySlice, setRotationY, double)
734 
735  delegate1(mySlice, setRotationZ, double)
736 
737  delegateConstGet0(mySlice, getNumberOfColors, int)
738 
739  delegate3(mySlice, setPixelRealPosition, double, double, double)
740 
741  delegate1(mySlice, setImageWorldTransform, vtkSmartPointer<vtkTransform>)
742 
744  virtual double getRotationX() const;
745 
747  virtual double getRotationY() const;
748 
750  virtual double getRotationZ() const;
751 
753  virtual int getNumberOfSlices() const;
754 
756  virtual int getSlice() const;
758 
759 
764  const QString & getFrameName() const {
766  if(!myFrame)
767  CAMITK_ERROR("Component", "getFrameName", "Delegate myFrame is not instanciated.")
768  return myFrame->getFrameName();
769  }
770 
771  delegate1(myFrame, setFrameName, QString)
772 
773  InterfaceFrame* getParentFrame() const {
774  if(!myFrame)
775  CAMITK_ERROR("Component", "getParentFrame", "Delegate myFrame is not instanciated.")
776  return myFrame->getParentFrame();
777  }
778 
779  void setParentFrame(InterfaceFrame* frame, bool keepTransform = true) {
780  if(!myFrame)
781  CAMITK_ERROR("Component", "setParentFrame", "Delegate myFrame is not instanciated.")
782  return myFrame->setParentFrame(frame, keepTransform);
783  }
784 
785  const QVector<InterfaceFrame *> & getChildrenFrame() const {
786  if(!myFrame)
787  CAMITK_ERROR("Component", "getChildrenFrame", "Delegate myFrame is not instanciated.")
788  return myFrame->getChildrenFrame();
789  }
790 
791  const vtkSmartPointer<vtkTransform> getTransformFromWorld() const {
792  if(!myFrame)
793  CAMITK_ERROR("Component", "getTransformFromWorld", "Delegate myFrame is not instanciated.")
794  return myFrame->getTransformFromWorld();
795  }
796 
797  const vtkSmartPointer<vtkTransform> getTransform() const {
798  if(!myFrame)
799  CAMITK_ERROR("Component", "getTransform", "Delegate myFrame is not instanciated.")
800  return myFrame->getTransform();
801  }
802 
803  const vtkSmartPointer<vtkTransform> getTransformFromFrame(InterfaceFrame * frame) const {
804  if(!myFrame)
805  CAMITK_ERROR("Component", "getTransformFromFrame", "Delegate myFrame is not instanciated.")
806  return myFrame->getTransformFromFrame(frame);
807  }
808 
809  delegate1(myFrame, setTransform, vtkSmartPointer<vtkTransform>)
810 
811  delegate0(myFrame, resetTransform)
812 
813  delegate3(myFrame, translate, double, double, double)
814 
815  delegate3(myFrame, rotate, double, double, double)
816 
817  delegate3(myFrame, rotateVTK, double, double, double)
818 
819  delegate3(myFrame, setTransformTranslation, double, double, double)
820 
821  delegate3(myFrame, setTransformTranslationVTK, double, double, double)
822 
823  delegate3(myFrame, setTransformRotation, double, double, double)
824 
825  delegate3(myFrame, setTransformRotationVTK, double, double, double)
826 
827  vtkSmartPointer<vtkAxesActor> getFrameAxisActor() {
828  if(!myFrame)
829  CAMITK_ERROR("Component", "getFrameAxisActor", "Delegate myFrame is not instanciated.")
830  return myFrame->getFrameAxisActor();
831  }
832 
833  delegate2(myFrame, setFrameVisibility, Viewer *, bool)
834 
835  bool getFrameVisibility(Viewer * viewer) const {
836  if(!myFrame)
837  CAMITK_ERROR("Component", "getFrameVisibility", "Delegate myFrame is not instanciated.")
838  return myFrame->getFrameVisibility(viewer);
839  }
840 
841  delegate1(myFrame, addFrameChild, InterfaceFrame *)
842 
843  delegate1(myFrame, removeFrameChild, InterfaceFrame *)
845 
846 
847 protected:
849  InterfaceGeometry * myGeometry;
850 
852  InterfaceBitMap * mySlice;
853 
855  InterfaceNode * myParentNode;
856 
858  InterfaceFrame * myFrame;
859 
861  ComponentList childrenComponent;
862 
864  bool isSelectedFlag;
865 
867  bool modifiedFlag;
868 
870  QString myFileName;
871 
873  unsigned int indexOfPropertyExplorerTab;
874 
875 
876 private:
879 
882  void init();
883 
885  Representation myService;
886 
888  QString myName;
889 
894  virtual void initRepresentation() = 0;
895 
897  QMap<Viewer *, bool> myViewers;
898 
900  QMenu * actionsMenu;
901 
903  QMap<QString, Property*> propertyMap;
905 
909  static QSet<Viewer*> allViewers;
913 
914 };
915 
916 
917 // -------------------- isSelected --------------------
918 inline bool Component::isSelected() const {
919  return isSelectedFlag;
920 }
921 
922 // -------------------- doubleClicked --------------------
924  // always false by default. You must overload this method in Components to change its behaviour.
925  return false;
926 }
927 
928 // -------------------- getChildren --------------------
930  return childrenComponent;
931 }
932 
933 // -------------------- getName --------------------
934 inline QString Component::getName() const {
935  return myName;
936 }
937 
938 // -------------------- getParent --------------------
940  return ((Component*) myParentNode);
941 }
942 
943 // -------------------- getFrame --------------------
945  return myFrame;
946 }
947 
948 // -------------------- getPixmap ------------------
949 inline QPixmap Component::getIcon() {
950  return QPixmap(0, 0); // this is a NULL QPixmap in the Qt sense. QPixmap::isNull will then return true;
951 }
952 
953 // -------------------- inItalic --------------------
954 inline bool Component::inItalic() const {
955  return false;
956 }
957 
958 // -------------------- setName --------------------
959 inline void Component::setName(const QString & n) {
960  myName = n;
961  if (myGeometry)
962  myGeometry->setLabel(n);
963 }
964 
965 // -------------------- setModified --------------------
966 inline void Component::setModified(bool modification) {
967  modifiedFlag = modification;
968 }
969 
970 // -------------------- getModified --------------------
971 inline bool Component::getModified() const {
972  return modifiedFlag;
973 }
974 
975 // -------------------- getModified --------------------
976 inline const QString Component::getLabel() const {
977  return getName();
978 }
979 // -------------------- getModified --------------------
980 inline void Component::setLabel(QString newName) {
981  setLabel(newName);
982 }
983 
984 }
985 
986 #endif
987 
#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