Computer Assited Medical Intervention Tool Kit  version 3.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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-2014 UJF-Grenoble 1, 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 
337  virtual ~Component();
338 
342  Representation getRepresentation() const;
343 
345  bool isTopLevel() const;
346 
348  virtual Component * getParentComponent();
349 
351  virtual Component * getTopLevelComponent();
352 
354  virtual InterfaceFrame * getFrame();
355 
357  virtual void setModified(bool modified = true);
358 
360  virtual bool getModified() const;
361 
363  virtual void setVisibility(Viewer *, bool);
364 
366  virtual bool getVisibility(Viewer *) const;
367 
369  virtual void refresh() const;
370 
377  virtual void refreshInterfaceNode();
378 
380  virtual bool isSelected() const;
381 
386  virtual void setSelected(const bool b, const bool recursive = true);
387 
389  const QString getFileName() const;
390 
392  void setFileName(const QString &);
393 
395  bool event(QEvent* e);
396 
398  QMenu * getActionMenu();
400 
405  QStringList getHierarchy();
408 
410  bool isInstanceOf(QString className);
411 
413  // TODO CAMITK_DEPRECATED. This section list all the methods marked as deprecated. They are to be removed in CamiTK 4.0
422  virtual QWidget * getPropertyWidget(QWidget* parent = 0) {
423  return NULL;
424  }
426 
431  virtual unsigned int getNumberOfPropertyWidget() {
432  if (this->getPropertyWidget())
433  return 1;
434  else
435  return 0;
436  }
437 
442  virtual QWidget * getPropertyWidgetAt(unsigned int i, QWidget* parent = 0) {
443  if (this->getPropertyWidget() && (i==0))
444  return this->getPropertyWidget();
445  else
446  return NULL;
447  }
448 
457  virtual QObject * getPropertyObject() {
458  return this;
459  }
460 
467  void updateProperty(QString name, QVariant value);
468 
470  // TODO CAMITK_DEPRECATED. This section list all the methods marked as deprecated. They are to be removed in CamiTK 4.0
483  virtual bool setDynamicProperty(const char *name, const QVariant &value, const char *description = "", bool isReadOnly=false);
484 
492  virtual inline void setIndexOfPropertyExplorerTab(unsigned int index) {
493  this->indexOfPropertyExplorerTab = index;
494  }
495 
503  virtual inline unsigned int getIndexOfPropertyExplorerTab() {
504  return this->indexOfPropertyExplorerTab;
505  }
506 
512  QMenu * getActionAndPopupMenu();
515 
522  Q_INVOKABLE virtual Property* getProperty(QString name);
523 
532  virtual bool addProperty(Property*);
533 
538  //-- the methods below are commented because the default comment in InterfaceNode lacks some information...
540  virtual void addChild(InterfaceNode *);
541  virtual void attachChild(InterfaceNode *);
545  virtual void removeChild(InterfaceNode *);
546 
548  virtual void setParent(InterfaceNode *);
549 
550  //--not commented because Doxygen automatically use the inherited documentation (set INHERIT_DOCS flag to YES in the Doxyfile)
551  virtual void deleteChildren();
552  virtual QString getName() const;
553  virtual void setName(const QString&);
554  virtual const ComponentList & getChildren();
555  virtual bool doubleClicked();
556  virtual InterfaceNode * getParent();
557  virtual QPixmap getIcon();
558 
562  virtual bool inItalic() const;
563 
565  virtual QMenu * getPopupMenu(QWidget* parent = 0) {
566  return NULL;
567  }
569 
574  const QString getLabel() const;
577 
579  void setLabel(QString newName);
580 
581  delegateGet0(myGeometry, getPointSet, vtkSmartPointer<vtkPointSet> )
582 
583  delegate1(myGeometry, setPointSet, vtkSmartPointer<vtkPointSet> )
584 
585  delegate1(myGeometry, setPointData, vtkSmartPointer<vtkDataArray> )
586 
587  delegateConstGet0(myGeometry, getDataPort, vtkSmartPointer<vtkAlgorithmOutput> )
588 
589  delegate1(myGeometry, setDataConnection, vtkSmartPointer<vtkAlgorithmOutput> )
590 
591  delegateGet1(myGeometry, getActor, vtkSmartPointer<vtkActor>, const RenderingModes)
592 
593  // TODO : uses an object myRepresentation (which is a Geometry or a Slice)
594  // to use a single delegate macro
595  virtual vtkSmartPointer<vtkProp> getProp(const QString &param) {
596  if (myGeometry)
597  return myGeometry->getProp(param);
598  else if(mySlice)
599  return mySlice->getProp(param);
600  return NULL;
601  }
602 
603  virtual unsigned int getNumberOfProp() const {
604  if (myGeometry)
605  return myGeometry->getNumberOfProp();
606  else if (mySlice)
607  return mySlice->getNumberOfProp();
608  return 0;
609  }
610 
611  virtual vtkSmartPointer<vtkProp> getProp(unsigned int index) {
612  if (myGeometry)
613  return myGeometry->getProp(index);
614  else if (mySlice)
615  return mySlice->getProp(index);
616  return 0;
617  }
618 
619  virtual bool addProp(const QString &name, vtkSmartPointer<vtkProp> prop) {
620  if (myGeometry)
621  return myGeometry->addProp(name, prop);
622  else if (mySlice)
623  return mySlice->addProp(name, prop);
624  return false;
625  }
626 
627 
628  virtual bool removeProp(const QString & name) {
629  if (myGeometry)
630  return myGeometry->removeProp(name);
631  else if (mySlice)
632  return mySlice->removeProp(name);
633  return false;
634  }
635  // END TODO
636 
637 
641  virtual void pointPicked(vtkIdType, bool) {}
642 
646  virtual void cellPicked(vtkIdType, bool) {}
647 
648  // --
649 
651  virtual void getBounds(double *bounds);
652 
656  virtual double getBoundingRadius();
657 
658  delegate4(myGeometry, setPointPosition, const unsigned int, const double, const double, const double)
659 
660  delegateAndInvokeChildren1(myGeometry, setRenderingModes, const RenderingModes)
661 
663  virtual const InterfaceGeometry::RenderingModes getRenderingModes() const;
664 
665  delegateAndInvokeChildren1(myGeometry, setEnhancedModes, const EnhancedModes)
666 
667  delegateConstGet0(myGeometry, getEnhancedModes, const EnhancedModes)
668 
669  delegateAndInvokeChildren1Array(myGeometry, setActorColor, const RenderingModes, double, 4)
670 
671  delegateAndInvokeChildren4(myGeometry, setActorColor, const RenderingModes, const double, const double, const double)
672 
674  virtual void getActorColor(const RenderingModes, double [4]);
675 
676  delegateAndInvokeChildren3(myGeometry, setColor, const double, const double, const double)
677 
678  delegateAndInvokeChildren4(myGeometry, setColor, const double, const double, const double, const double)
679 
680  delegateAndInvokeChildren2(myGeometry, setActorOpacity, const RenderingModes, const double)
681 
682  delegateConstGet1(myGeometry, getActorOpacity, double, const RenderingModes)
683 
684  delegateAndInvokeChildren1(myGeometry, setOpacity, const double)
685 
686  delegate2(myGeometry, setMapperScalarRange, double, double)
687 
688  delegate1(myGeometry, setTexture, vtkSmartPointer<vtkTexture>)
689 
690  virtual void setGlyphType(const GlyphTypes type, const double size = 0.0);
691 
692  delegate1(myGeometry, setLinesAsTubes, bool)
693 
694  delegate1(myGeometry, setMeshWorldTransform, vtkSmartPointer<vtkTransform>)
695 
697 
702  delegateConstGet0(mySlice, getImageData, vtkSmartPointer<vtkImageData>)
704 
705  delegate1(mySlice, setOriginalVolume, vtkSmartPointer<vtkImageData>)
706 
707  delegateConstGet0(mySlice, get2DImageActor, vtkSmartPointer<vtkImageActor>)
708 
709  delegateConstGet0(mySlice, get3DImageActor, vtkSmartPointer<vtkImageActor>)
710 
711  delegateConstGet0(mySlice, getPickPlaneActor, vtkSmartPointer<vtkActor>)
712 
713  delegateGet0(mySlice, getPixelActor, vtkSmartPointer<vtkActor>)
714 
715 // delegateGet0(mySlice, get2DAxesActor, vtkSmartPointer<vtkAxesActor>)
716 
717  delegate3(mySlice, pixelPicked, double, double, double)
718 
719  delegate0(mySlice, updatePickPlane)
720 
721  delegate1(mySlice, setSlice, int)
722 
723  delegate3(mySlice, setSlice, double, double, double)
724 
725  delegate1(mySlice, setRotationX, double)
726 
727  delegate1(mySlice, setRotationY, double)
728 
729  delegate1(mySlice, setRotationZ, double)
730 
731  delegateConstGet0(mySlice, getNumberOfColors, int)
732 
733  delegate3(mySlice, setPixelRealPosition, double, double, double)
734 
735  delegate1(mySlice, setImageWorldTransform, vtkSmartPointer<vtkTransform>)
736 
738  virtual double getRotationX() const;
739 
741  virtual double getRotationY() const;
742 
744  virtual double getRotationZ() const;
745 
747  virtual int getNumberOfSlices() const;
748 
750  virtual int getSlice() const;
752 
753 
758  const QString & getFrameName() const {
760  if(!myFrame)
761  CAMITK_ERROR("Component", "getFrameName", "Delegate myFrame is not instanciated.")
762  return myFrame->getFrameName();
763  }
764 
765  delegate1(myFrame, setFrameName, QString)
766 
767  InterfaceFrame* getParentFrame() const {
768  if(!myFrame)
769  CAMITK_ERROR("Component", "getParentFrame", "Delegate myFrame is not instanciated.")
770  return myFrame->getParentFrame();
771  }
772 
773  void setParentFrame(InterfaceFrame* frame, bool keepTransform = true) {
774  if(!myFrame)
775  CAMITK_ERROR("Component", "setParentFrame", "Delegate myFrame is not instanciated.")
776  return myFrame->setParentFrame(frame, keepTransform);
777  }
778 
779  const QVector<InterfaceFrame *> & getChildrenFrame() const {
780  if(!myFrame)
781  CAMITK_ERROR("Component", "getChildrenFrame", "Delegate myFrame is not instanciated.")
782  return myFrame->getChildrenFrame();
783  }
784 
785  const vtkSmartPointer<vtkTransform> getTransformFromWorld() const {
786  if(!myFrame)
787  CAMITK_ERROR("Component", "getTransformFromWorld", "Delegate myFrame is not instanciated.")
788  return myFrame->getTransformFromWorld();
789  }
790 
791  const vtkSmartPointer<vtkTransform> getTransform() const {
792  if(!myFrame)
793  CAMITK_ERROR("Component", "getTransform", "Delegate myFrame is not instanciated.")
794  return myFrame->getTransform();
795  }
796 
797  const vtkSmartPointer<vtkTransform> getTransformFromFrame(InterfaceFrame * frame) const {
798  if(!myFrame)
799  CAMITK_ERROR("Component", "getTransformFromFrame", "Delegate myFrame is not instanciated.")
800  return myFrame->getTransformFromFrame(frame);
801  }
802 
803  delegate1(myFrame, setTransform, vtkSmartPointer<vtkTransform>)
804 
805  delegate0(myFrame, resetTransform)
806 
807  delegate3(myFrame, translate, double, double, double)
808 
809  delegate3(myFrame, rotate, double, double, double)
810 
811  delegate3(myFrame, setTransformTranslation, double, double, double)
812 
813  delegate3(myFrame, setTransformRotation, double, double, double)
814 
815  vtkSmartPointer<vtkAxesActor> getFrameAxisActor() {
816  if(!myFrame)
817  CAMITK_ERROR("Component", "getFrameAxisActor", "Delegate myFrame is not instanciated.")
818  return myFrame->getFrameAxisActor();
819  }
820 
821  delegate2(myFrame, setFrameVisibility, Viewer *, bool)
822 
823  bool getFrameVisibility(Viewer * viewer) const {
824  if(!myFrame)
825  CAMITK_ERROR("Component", "getFrameVisibility", "Delegate myFrame is not instanciated.")
826  return myFrame->getFrameVisibility(viewer);
827  }
828 
829  delegate1(myFrame, addFrameChild, InterfaceFrame *)
830 
831  delegate1(myFrame, removeFrameChild, InterfaceFrame *)
833 
834 
835 protected:
837  InterfaceGeometry * myGeometry;
838 
840  InterfaceBitMap * mySlice;
841 
843  InterfaceNode * myParentNode;
844 
846  InterfaceFrame * myFrame;
847 
849  ComponentList childrenComponent;
850 
852  bool isSelectedFlag;
853 
855  bool modifiedFlag;
856 
858  QString myFileName;
859 
861  unsigned int indexOfPropertyExplorerTab;
862 
863 
864 private:
867 
870  void init();
871 
873  Representation myService;
874 
876  QString myName;
877 
882  virtual void initRepresentation() = 0;
883 
885  QMap<Viewer *, bool> myViewers;
886 
888  QMenu * actionsMenu;
889 
891  QMap<QString, Property*> propertyMap;
893 
897  static QSet<Viewer*> allViewers;
901 
902 };
903 
904 
905 // -------------------- isSelected --------------------
906 inline bool Component::isSelected() const {
907  return isSelectedFlag;
908 }
909 
910 // -------------------- doubleClicked --------------------
912  // always false by default. You must overload this method in Components to change its behaviour.
913  return false;
914 }
915 
916 // -------------------- getChildren --------------------
918  return childrenComponent;
919 }
920 
921 // -------------------- getName --------------------
922 inline QString Component::getName() const {
923  return myName;
924 }
925 
926 // -------------------- getParent --------------------
928  return ((Component*) myParentNode);
929 }
930 
931 // -------------------- getFrame --------------------
933  return myFrame;
934 }
935 
936 // -------------------- getPixmap ------------------
937 inline QPixmap Component::getIcon() {
938  return NULL;
939 }
940 
941 // -------------------- inItalic --------------------
942 inline bool Component::inItalic() const {
943  return false;
944 }
945 
946 // -------------------- setName --------------------
947 inline void Component::setName(const QString & n) {
948  myName = n;
949  if (myGeometry)
950  myGeometry->setLabel(n);
951 }
952 
953 // -------------------- setModified --------------------
954 inline void Component::setModified(bool modification) {
955  modifiedFlag = modification;
956 }
957 
958 // -------------------- getModified --------------------
959 inline bool Component::getModified() const {
960  return modifiedFlag;
961 }
962 
963 // -------------------- getModified --------------------
964 inline const QString Component::getLabel() const {
965  return getName();
966 }
967 // -------------------- getModified --------------------
968 inline void Component::setLabel(QString newName) {
969  setLabel(newName);
970 }
971 
972 }
973 
974 #endif
975 
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