Salome HOME
This commit was generated by cvs2git to create tag 'V1_4_0b2'.
[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 "VTKViewer_Common.h"
34 #include "SALOME_InteractiveObject.hxx"
35 #ifndef _Handle_SALOME_InteractiveObject_HeaderFile
36 #include "Handle_SALOME_InteractiveObject.hxx"
37 #endif
38 #include <vector.h>
39
40 class SALOME_Transform;
41 class SALOME_TransformFilter;
42 class SALOME_PassThroughFilter;
43
44 extern int SALOME_POINT_SIZE;
45
46 class SALOME_Actor : public vtkLODActor{
47  protected:
48   //constructor should be protected due to first implementation of this class
49   //it was abstract class
50   SALOME_Actor();
51   ~SALOME_Actor();
52  public:
53   static SALOME_Actor* New();
54
55   vtkTypeMacro(SALOME_Actor,vtkLODActor);
56
57   // Description:
58   // This causes the actor to be rendered. It, in turn, will render the actor`s
59   // property and then mapper.
60   //virtual void Render(vtkRenderer *, vtkMapper *);
61
62   // Description:
63   // This method is used internally by the rendering process.
64   // We overide the superclass method to properly set the estimated render time.
65   //virtual int RenderOpaqueGeometry(vtkViewport *viewport);
66
67   // Description:
68   // Release any graphics resources that are being consumed by this actor.
69   // The parameter window could be used to determine which graphic
70   // resources to release.
71   //virtual void ReleaseGraphicsResources(vtkWindow *);
72
73   virtual Standard_Boolean hasIO() { return !myIO.IsNull(); }
74   virtual Handle_SALOME_InteractiveObject getIO() { return myIO; } 
75   virtual void setIO(const Handle(SALOME_InteractiveObject)& io) { myIO = io; }
76
77   virtual Standard_CString getName()     { return myName; }
78   virtual void setName(Standard_CString aName){
79     myName = aName;
80     if(hasIO()) myIO->setName(aName);
81   }
82
83   virtual int getDisplayMode() { return myDisplayMode; }
84   virtual void setDisplayMode(int mode) { myDisplayMode = mode; }
85
86   virtual bool hasHighlight() { return false; }  
87   virtual void highlight(Standard_Boolean highlight) { ishighlighted = highlight; }  
88   virtual Standard_Boolean isHighlighted() { return ishighlighted; }
89
90   virtual void SetOpacity(float opa) { m_opacity = opa; }
91   virtual float GetOpacity() { return m_opacity; }
92
93   virtual void SetColor(float r,float g,float b) {};
94   virtual void GetColor(float& r,float& g,float& b) {};
95
96   vtkSetObjectMacro(PreviewProperty,vtkProperty);
97
98   virtual void SetPreSelected(Standard_Boolean presel = Standard_False)   { ispreselected = presel; }
99
100   // Used to obtain all dependent actors
101   virtual void GetChildActors(vtkActorCollection*) {};
102   
103   virtual void AddToRender(vtkRenderer* theRenderer); 
104   virtual void RemoveFromRender(vtkRenderer* theRenderer);
105
106   virtual vtkPolyData* GetPolyDataInput(); 
107   virtual void SetMapper(vtkMapper* theMapper); 
108   virtual void SetTransform(SALOME_Transform* theTransform); 
109
110   virtual unsigned long int GetMTime();
111
112   virtual void SetRepresentation(int theMode);
113   virtual int GetRepresentation();
114
115   // Infinitive means actor without size (point for example
116   // which is not taken into account in calculation of boundaries of the scene
117   virtual bool IsInfinitive() { return false; }
118     
119  protected:
120   vtkProperty         *PreviewProperty;
121   Standard_Boolean    ispreselected;
122
123   Handle_SALOME_InteractiveObject myIO;
124   Standard_CString myName;
125
126   float   m_opacity;
127   Standard_Boolean    ishighlighted;
128   int myDisplayMode;
129
130   SALOME_Transform *myTransform;
131   std::vector<SALOME_PassThroughFilter*> myPassFilter;
132   SALOME_TransformFilter *myTransformFilter;
133   vtkProperty *myProperty;
134   int myRepresentation;
135 };
136
137 #endif // SALOME_ACTOR_H