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
27 class VTKVIEWER_EXPORT VTKViewer_Actor : public vtkLODActor
30 static VTKViewer_Actor* New();
32 vtkTypeMacro( VTKViewer_Actor, vtkLODActor );
34 virtual const char* getName() { return myName.c_str(); }
35 virtual void setName(const char* theName){ myName = theName;}
37 //! To generate highlight automaticaly
38 virtual bool hasHighlight() { return false; }
40 virtual void highlight(bool theHighlight) { myIsHighlighted = theHighlight; }
42 virtual bool isHighlighted() { return myIsHighlighted; }
44 virtual void SetOpacity(float theOpacity);
45 virtual float GetOpacity();
47 virtual void SetColor(float r,float g,float b);
48 virtual void GetColor(float& r,float& g,float& b);
49 void SetColor(const float theRGB[3]){ SetColor(theRGB[0],theRGB[1],theRGB[2]); }
51 vtkSetObjectMacro(PreviewProperty,vtkProperty);
53 virtual void SetPreSelected(bool thePreselect = false) { myIsPreselected = thePreselect;}
55 //! Used to obtain all dependent actors
56 virtual void GetChildActors(vtkActorCollection*) {};
58 virtual void AddToRender(vtkRenderer* theRenderer);
59 virtual void RemoveFromRender(vtkRenderer* theRenderer);
62 /*! For selection mapping purpose */
63 virtual int GetNodeObjId(int theVtkID) { return theVtkID;}
64 virtual float* GetNodeCoord(int theObjID);
66 virtual int GetElemObjId(int theVtkID) { return theVtkID;}
67 virtual vtkCell* GetElemCell(int theObjID);
69 virtual int GetObjDimension( const int theObjId );
71 virtual void SetMapper(vtkMapper* theMapper);
72 virtual vtkDataSet* GetInput();
75 virtual void SetTransform(VTKViewer_Transform* theTransform);
76 virtual unsigned long int GetMTime();
78 virtual void SetRepresentation(int theMode);
79 virtual int GetRepresentation();
81 virtual int getDisplayMode();
82 virtual void setDisplayMode(int theMode);
84 //! Infinitive means actor without size (point for example),
85 //! which is not taken into account in calculation of boundaries of the scene
86 void SetInfinitive(bool theIsInfinite) { myIsInfinite = theIsInfinite; }
87 virtual bool IsInfinitive();
89 void SetResolveCoincidentTopology(bool theIsResolve);
90 void SetPolygonOffsetParameters(float factor, float units);
91 void GetPolygonOffsetParameters(float& factor, float& units);
93 virtual void Render(vtkRenderer *, vtkMapper *);
96 bool myIsResolveCoincidentTopology;
97 float myPolygonOffsetFactor;
98 float myPolygonOffsetUnits;
102 vtkProperty *PreviewProperty;
103 bool myIsPreselected;
106 bool myIsHighlighted;
111 VTKViewer_GeometryFilter *myGeomFilter;
112 VTKViewer_TransformFilter *myTransformFilter;
113 std::vector<VTKViewer_PassThroughFilter*> myPassFilter;
115 int myRepresentation;
116 vtkProperty *myProperty;
118 //! Main method, which calculate output.
119 void InitPipeLine(vtkMapper* theMapper);