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
25 class VTKVIEWER_EXPORT VTKViewer_Actor : public vtkLODActor
28 static VTKViewer_Actor* New();
30 vtkTypeMacro( VTKViewer_Actor, vtkLODActor );
32 virtual const char* getName() { return myName.c_str(); }
33 virtual void setName(const char* theName){ myName = theName;}
35 // To generate highlight automaticaly
36 virtual bool hasHighlight() { return false; }
37 virtual void highlight(bool theHighlight) { myIsHighlighted = theHighlight; }
38 virtual bool isHighlighted() { return myIsHighlighted; }
40 virtual void SetOpacity(float theOpacity);
41 virtual float GetOpacity();
43 virtual void SetColor(float r,float g,float b);
44 virtual void GetColor(float& r,float& g,float& b);
45 void SetColor(const float theRGB[3]){ SetColor(theRGB[0],theRGB[1],theRGB[2]); }
47 vtkSetObjectMacro(PreviewProperty,vtkProperty);
49 virtual void SetPreSelected(bool thePreselect = false) { myIsPreselected = thePreselect;}
51 // Used to obtain all dependent actors
52 virtual void GetChildActors(vtkActorCollection*) {};
54 virtual void AddToRender(vtkRenderer* theRenderer);
55 virtual void RemoveFromRender(vtkRenderer* theRenderer);
58 // For selection mapping purpose
59 virtual int GetNodeObjId(int theVtkID) { return theVtkID;}
60 virtual float* GetNodeCoord(int theObjID);
62 virtual int GetElemObjId(int theVtkID) { return theVtkID;}
63 virtual vtkCell* GetElemCell(int theObjID);
65 virtual int GetObjDimension( const int theObjId );
67 virtual void SetMapper(vtkMapper* theMapper);
68 virtual vtkDataSet* GetInput();
71 virtual void SetTransform(VTKViewer_Transform* theTransform);
72 virtual unsigned long int GetMTime();
74 virtual void SetRepresentation(int theMode);
75 virtual int GetRepresentation();
77 virtual int getDisplayMode();
78 virtual void setDisplayMode(int theMode);
80 // Infinitive means actor without size (point for example),
81 // which is not taken into account in calculation of boundaries of the scene
82 void SetInfinitive(bool theIsInfinite) { myIsInfinite = theIsInfinite; }
83 virtual bool IsInfinitive();
85 void SetResolveCoincidentTopology(bool theIsResolve);
86 void SetPolygonOffsetParameters(float factor, float units);
87 void GetPolygonOffsetParameters(float& factor, float& units);
89 virtual void Render(vtkRenderer *, vtkMapper *);
92 bool myIsResolveCoincidentTopology;
93 float myPolygonOffsetFactor;
94 float myPolygonOffsetUnits;
98 vtkProperty *PreviewProperty;
102 bool myIsHighlighted;
107 VTKViewer_GeometryFilter *myGeomFilter;
108 VTKViewer_TransformFilter *myTransformFilter;
109 std::vector<VTKViewer_PassThroughFilter*> myPassFilter;
111 int myRepresentation;
112 vtkProperty *myProperty;
114 void InitPipeLine(vtkMapper* theMapper);