Salome HOME
This commit was generated by cvs2git to track changes on a CVS vendor
[modules/kernel.git] / src / OBJECT / SALOME_Actor.h
1 //  SALOME OBJECT : implementation of interactive object visualization for OCC and VTK viewers
2 //
3 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
5 // 
6 //  This library is free software; you can redistribute it and/or 
7 //  modify it under the terms of the GNU Lesser General Public 
8 //  License as published by the Free Software Foundation; either 
9 //  version 2.1 of the License. 
10 // 
11 //  This library is distributed in the hope that it will be useful, 
12 //  but WITHOUT ANY WARRANTY; without even the implied warranty of 
13 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
14 //  Lesser General Public License for more details. 
15 // 
16 //  You should have received a copy of the GNU Lesser General Public 
17 //  License along with this library; if not, write to the Free Software 
18 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
19 // 
20 //  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
21 //
22 //
23 //
24 //  File   : SALOME_Actor.h
25 //  Author : Nicolas REJNERI
26 //  Module : SALOME
27 //  $Header$
28
29 #ifndef SALOME_ACTOR_H
30 #define SALOME_ACTOR_H
31
32 // SALOME Includes
33 #include "SALOME_Transform.h"
34 #include "SALOME_InteractiveObject.hxx"
35 #ifndef _Handle_SALOME_InteractiveObject_HeaderFile
36 #include "Handle_SALOME_InteractiveObject.hxx"
37 #endif
38
39 #include <vector.h>
40 #include "VTKViewer_Common.h"
41
42 class SALOME_Actor : public vtkLODActor 
43 {
44  protected:
45   //constructor should be protected due to first implementation of this class
46   //it was abstract class
47   SALOME_Actor();
48   ~SALOME_Actor();
49  public:
50   vtkTypeMacro(SALOME_Actor,vtkActor);
51
52   // Description:
53   // This causes the actor to be rendered. It, in turn, will render the actor`s
54   // property and then mapper.
55   virtual void Render(vtkRenderer *, vtkMapper *);
56
57   // Description:
58   // This method is used internally by the rendering process.
59   // We overide the superclass method to properly set the estimated render time.
60   virtual int RenderOpaqueGeometry(vtkViewport *viewport);
61
62   // Description:
63   // Release any graphics resources that are being consumed by this actor.
64   // The parameter window could be used to determine which graphic
65   // resources to release.
66   virtual void ReleaseGraphicsResources(vtkWindow *);
67
68   virtual Standard_Boolean hasIO() { return !myIO.IsNull(); }
69   virtual Handle_SALOME_InteractiveObject getIO() { return myIO; } 
70   virtual void setIO(const Handle(SALOME_InteractiveObject)& io) { myIO = io; }
71
72   virtual Standard_CString getName()     { return myName; }
73   virtual void setName(Standard_CString aName){
74     myName = aName;
75     if(hasIO()) myIO->setName(aName);
76   }
77
78   virtual int getDisplayMode() { return myDisplayMode; }
79   virtual void setDisplayMode(int mode) { myDisplayMode = mode; }
80
81   virtual bool hasHighlight() { return false; }  
82   virtual void highlight(Standard_Boolean highlight) { ishighlighted = highlight; }  
83   virtual Standard_Boolean isHighlighted() { return ishighlighted; }
84
85   virtual void SetOpacity(float opa) { m_opacity = opa; }
86   virtual float GetOpacity() { return m_opacity; }
87
88   virtual void SetColor(float r,float g,float b) {};
89   virtual void GetColor(float& r,float& g,float& b) {};
90
91   vtkSetObjectMacro(PreviewProperty,vtkProperty);
92
93   virtual void SetPreSelected(Standard_Boolean presel = Standard_False)   { ispreselected = presel; }
94
95   // Used to obtain all dependent actors
96   virtual void GetChildActors(vtkActorCollection*) {};
97   
98   virtual void AddToRender(vtkRenderer* theRenderer); 
99   virtual void RemoveFromRender(vtkRenderer* theRenderer);
100
101   virtual vtkPolyData* GetPolyDataInput(); 
102   virtual void SetMapper(vtkMapper* theMapper); 
103   virtual void SetTransform(SALOME_Transform* theTransform); 
104
105  protected:
106   vtkProperty         *PreviewProperty;
107   Standard_Boolean    ispreselected;
108
109   Handle_SALOME_InteractiveObject myIO;
110   Standard_CString myName;
111
112   float   m_opacity;
113   Standard_Boolean    ishighlighted;
114   int myDisplayMode;
115
116   SALOME_Transform *myTransform;
117   std::vector<SALOME_PassThroughFilter*> myPassFilter;
118   SALOME_TransformFilter *myTransformFilter;
119 };
120 #endif // SALOME_ACTOR_H