1 #ifndef VTKVIEVER_ACTOR_H
2 #define VTKVIEVER_ACTOR_H
6 #include <vtkLODActor.h>
7 #include <vtkProperty.h>
8 #include <vtkShrinkFilter.h>
9 #include <vtkDataSetMapper.h>
10 #include <vtkUnstructuredGrid.h>
18 class VTKViewer_Transform;
19 class VTKViewer_GeometryFilter;
20 class VTKViewer_TransformFilter;
21 class VTKViewer_PassThroughFilter;
23 #define VTKViewer_POINT_SIZE 3
24 /*! \class vtkLODActor
25 * \brief For more information see <a href="http://www.vtk.org/">VTK documentation</a>
27 class VTKVIEWER_EXPORT VTKViewer_Actor : public vtkLODActor
30 /*!Create new instance of actor.*/
31 static VTKViewer_Actor* New();
33 vtkTypeMacro( VTKViewer_Actor, vtkLODActor );
35 /*!Get name of the actor*/
36 virtual const char* getName() { return myName.c_str(); }
37 /*!Set name of the actor*/
38 virtual void setName(const char* theName){ myName = theName;}
40 //! To generate highlight automaticaly
41 virtual bool hasHighlight() { return false; }
43 virtual void highlight(bool theHighlight) { myIsHighlighted = theHighlight; }
45 virtual bool isHighlighted() { return myIsHighlighted; }
47 virtual void SetOpacity(float theOpacity);
48 virtual float GetOpacity();
50 virtual void SetColor(float r,float g,float b);
51 virtual void GetColor(float& r,float& g,float& b);
52 void SetColor(const float theRGB[3]){ SetColor(theRGB[0],theRGB[1],theRGB[2]); }
54 vtkSetObjectMacro(PreviewProperty,vtkProperty);
56 virtual void SetPreSelected(bool thePreselect = false) { myIsPreselected = thePreselect;}
58 //! Used to obtain all dependent actors
59 virtual void GetChildActors(vtkActorCollection*) {};
61 virtual void AddToRender(vtkRenderer* theRenderer);
62 virtual void RemoveFromRender(vtkRenderer* theRenderer);
65 /** @name For selection mapping purpose */
67 virtual int GetNodeObjId(int theVtkID) { return theVtkID;}
68 virtual float* GetNodeCoord(int theObjID);
70 virtual int GetElemObjId(int theVtkID) { return theVtkID;}
71 virtual vtkCell* GetElemCell(int theObjID);
74 virtual int GetObjDimension( const int theObjId );
76 virtual void SetMapper(vtkMapper* theMapper);
77 virtual vtkDataSet* GetInput();
79 virtual void SetTransform(VTKViewer_Transform* theTransform);
80 virtual unsigned long int GetMTime();
82 virtual void SetRepresentation(int theMode);
83 virtual int GetRepresentation();
85 virtual int getDisplayMode();
86 virtual void setDisplayMode(int theMode);
88 /*! Infinitive means actor without size (point for example), \n
89 * which is not taken into account in calculation of boundaries of the scene
91 void SetInfinitive(bool theIsInfinite) { myIsInfinite = theIsInfinite; }
92 virtual bool IsInfinitive();
94 void SetResolveCoincidentTopology(bool theIsResolve);
95 void SetPolygonOffsetParameters(float factor, float units);
96 void GetPolygonOffsetParameters(float& factor, float& units);
98 virtual void Render(vtkRenderer *, vtkMapper *);
101 /*!resolve coincedent topology flag*/
102 bool myIsResolveCoincidentTopology;
103 /*!polygon offset factor*/
104 float myPolygonOffsetFactor;
105 /*!polygon offset units*/
106 float myPolygonOffsetUnits;
111 /*!preview property*/
112 vtkProperty *PreviewProperty;
113 /*!preselected flag*/
114 bool myIsPreselected;
118 /*!highlighted flag*/
119 bool myIsHighlighted;
125 /*!store mapping flag*/
128 VTKViewer_GeometryFilter *myGeomFilter;
129 /*!transform filter*/
130 VTKViewer_TransformFilter *myTransformFilter;
131 /*!vector of passive filters(siz filters used)*/
132 std::vector<VTKViewer_PassThroughFilter*> myPassFilter;
134 /*!presentation mode*/
135 int myRepresentation;
137 vtkProperty *myProperty;
139 //! Main method, which calculate output.
140 void InitPipeLine(vtkMapper* theMapper);