Salome HOME
NRI : Remove OCC_LIBS.
[modules/kernel.git] / src / OBJECT / SALOME_Actor.h
1 //  File      : SALOME_Actor.h
2 //  Created   : Wed Feb 20 17:24:59 2002
3 //  Author    : Nicolas REJNERI
4 //  Project   : SALOME
5 //  Module    : SALOME
6 //  Copyright : Open CASCADE 2002
7 //  $Header$
8
9
10 #ifndef SALOME_ACTOR_H
11 #define SALOME_ACTOR_H
12
13 // SALOME Includes
14 #ifndef _Handle_SALOME_InteractiveObject_HeaderFile
15 #include <Handle_SALOME_InteractiveObject.hxx>
16 #endif
17 #include "SALOME_InteractiveObject.hxx"
18
19 //VTK Includes
20 #include <vtkLODActor.h>
21
22 class SALOME_Actor : public vtkLODActor 
23 {
24  protected:
25   //constructor should be protected due to first implementation of this class
26   //it was abstract class
27   SALOME_Actor();
28   ~SALOME_Actor();
29  public:
30   vtkTypeMacro(SALOME_Actor,vtkActor);
31
32   // Description:
33   // This causes the actor to be rendered. It, in turn, will render the actor`s
34   // property and then mapper.
35   virtual void Render(vtkRenderer *, vtkMapper *);
36
37   // Description:
38   // This method is used internally by the rendering process.
39   // We overide the superclass method to properly set the estimated render time.
40   virtual int RenderOpaqueGeometry(vtkViewport *viewport);
41
42   // Description:
43   // Release any graphics resources that are being consumed by this actor.
44   // The parameter window could be used to determine which graphic
45   // resources to release.
46   virtual void ReleaseGraphicsResources(vtkWindow *);
47
48   virtual void ShallowCopy(vtkProp *prop);
49
50   virtual Standard_Boolean hasIO() { return !myIO.IsNull(); }
51   virtual Handle_SALOME_InteractiveObject getIO() { return myIO; } 
52   void setIO(const Handle(SALOME_InteractiveObject)& io) { myIO = io; }
53
54   virtual Standard_CString getName()     { return myName; }
55   virtual void setName(Standard_CString aName)
56     {
57       myName = aName;
58       if ( hasIO() )
59         myIO->setName(aName);
60     }
61
62   virtual int getDisplayMode() { return myDisplayMode; }
63   virtual void setDisplayMode(int mode) { myDisplayMode = mode; }
64
65   virtual bool hasHighlight() { return false; }  
66   virtual void highlight(Standard_Boolean highlight) { ishighlighted = highlight; }  
67   virtual Standard_Boolean isHighlighted() { return ishighlighted; }
68
69   virtual void SetOpacity(float opa) { m_opacity = opa; }
70   virtual float GetOpacity() { return m_opacity; }
71
72   virtual void SetColor(float r,float g,float b) {};
73   virtual void GetColor(float& r,float& g,float& b) {};
74
75   virtual void SetPreviewProperty(vtkProperty* Prop) { PreviewProperty = Prop; }
76
77   virtual void SetPreSelected(Standard_Boolean presel = Standard_False)   { ispreselected = presel; }
78
79   // Used to obtain all dependent actors
80   virtual void GetChildActors(vtkActorCollection*) {};
81   
82   //virtual void ApplyScaling ( vtkMapper*  newMapper, bool recover = false ); 
83   virtual void SetMapper ( vtkMapper*  newMapper ); 
84   virtual vtkMapper* GetInitialMapper() { return m_Initial; } 
85
86  protected:
87   vtkProperty         *PreviewProperty;
88   Standard_Boolean    ispreselected;
89
90   Handle_SALOME_InteractiveObject myIO;
91   Standard_CString myName;
92
93   float   m_opacity;
94   Standard_Boolean    ishighlighted;
95   int myDisplayMode;
96
97   vtkMapper*   m_Initial;
98 };
99 #endif // SALOME_ACTOR_H