Salome HOME
NRI : Merge from V1_2.
[modules/visu.git] / src / OBJECT / VISU_Actor.h
1 //  VISU OBJECT : interactive object for VISU entities implementation
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   : VISU_Actor.h
25 //  Author : Laurent CORNABE with the help of Nicolas REJNERI
26 //  Module : VISU
27 //  $Header$
28
29 using namespace std;
30
31 #ifndef VISU_ACTOR_H
32 #define VISU_ACTOR_H
33
34 #include "SALOME_Actor.h"
35 #include <string>
36
37 class vtkProp;
38 class vtkPolyData;
39 class vtkProperty;
40 class vtkPolyDataMapper;
41
42 namespace VISU { 
43   class Prs3d_i;
44 }
45 class VISU_ScalarBarActor;
46
47 #ifdef _WIN_32
48 #define VTKOCC_EXPORT __declspec (dllexport)
49 #else
50 #define VTKOCC_EXPORT VTK_EXPORT
51 #endif
52
53 class VTKOCC_EXPORT VISU_Actor : public SALOME_Actor {
54  public:
55   vtkTypeMacro(VISU_Actor,SALOME_Actor);
56   void ShallowCopy(vtkProp *prop);
57   static VISU_Actor* New();
58   ~VISU_Actor();
59
60   virtual void setIO(const Handle(SALOME_InteractiveObject)& theIO);
61
62   VISU::Prs3d_i* getPrs3d(){ return myPrs3d;}
63   virtual void setPrs3d(VISU::Prs3d_i* thePrs3d);
64
65   VISU_Actor* GetParent(){ return myParent;}
66   virtual void SetParent(VISU_Actor* theParent);
67
68   void highlight(Standard_Boolean highlight);
69   Standard_Boolean isHighlighted() { return true; };
70
71   void  SetOpacity(float opa) {};
72   float GetOpacity() { return 0;};
73
74   virtual void SetMapper(vtkMapper* theMapper); 
75
76   virtual void SetShrinkable(bool theIsShrinkable);
77   virtual bool GetShrinkable() { return myIsShrinkable;}
78
79   virtual bool isShrunk() { return myIsShrunk;}
80   virtual void setShrink(float theFactor = 0.8); 
81   virtual void unShrink(); 
82
83   virtual void SetVisibility(int theMode);
84   virtual int GetVisibility();
85
86   virtual void SetProperty(vtkProperty* theProperty);
87   virtual vtkProperty* GetProperty();
88
89   virtual void SetLineWidth(float theLineWidth);
90   virtual float GetLineWidth();
91
92   virtual void SetRepresentation(int theMode);
93   virtual int GetRepresentation();
94     
95   bool IsHighlighting;
96   std::string myFieldName;
97
98  protected:
99   VISU_Actor();
100  
101   VISU_Actor* myParent;
102   VISU::Prs3d_i* myPrs3d;
103   vtkProperty* HighlightProperty;
104   bool myIsShrinkable;
105   bool myIsShrunk;
106 };
107
108 //=======================================================================
109
110 class VTKOCC_EXPORT VISUScalarMap_Actor : public VISU_Actor {
111  public:
112   vtkTypeMacro(VISUScalarMap_Actor,VISU_Actor);
113   static VISUScalarMap_Actor* New();
114   ~VISUScalarMap_Actor();
115
116   virtual void AddToRender(vtkRenderer* theRenderer); 
117   virtual void RemoveFromRender(vtkRenderer* theRenderer);
118
119   virtual void SetVisibility(int theMode);
120   virtual int GetVisibility();
121
122   virtual VISU_ScalarBarActor* GetScalarBar(){ return myScalarBar;}
123
124   virtual void SetBarVisibility(const bool* theMode);
125   virtual bool GetBarVisibility(){ return *myBarVisibility;}
126
127  protected:
128   VISUScalarMap_Actor();
129   const bool* myBarVisibility;
130   VISU_ScalarBarActor* myScalarBar;
131 };
132
133 //=======================================================================
134
135 class VTKOCC_EXPORT VISUMesh_Actor : public VISU_Actor {
136  public:
137   vtkTypeMacro(VISUMesh_Actor,VISU_Actor);
138   static VISUMesh_Actor* New();
139   ~VISUMesh_Actor();
140
141   virtual void setIO(const Handle(SALOME_InteractiveObject)& theIO);
142   virtual void setPrs3d(VISU::Prs3d_i* thePrs3d);
143
144   virtual void AddToRender(vtkRenderer* theRenderer); 
145   virtual void RemoveFromRender(vtkRenderer* theRenderer);
146
147   virtual void SetMapper(vtkMapper* theMapper); 
148   virtual void SetTransform(SALOME_Transform* theTransform); 
149
150   virtual vtkProperty* GetProperty(); 
151   virtual void SetProperty(vtkProperty* theProperty);
152
153   virtual vtkProperty* GetEdgeProperty(); 
154   virtual void SetEdgeProperty(vtkProperty* theProperty);
155
156   virtual void SetLineWidth(float theLineWidth);
157   virtual float GetLineWidth();
158
159   virtual void SetRepresentation(int theMode);
160   virtual int GetRepresentation() { return myRepresentation;};
161
162   virtual void SetVisibility(int theMode);
163   virtual int GetVisibility() { return myVisibility;}
164
165   virtual void SetShrinkable(bool theIsShrinkable);
166
167   virtual void setShrink(float theFactor = 0.8); 
168   virtual void unShrink(); 
169
170  protected:
171   VISUMesh_Actor();
172   int myRepresentation, myVisibility;
173   vtkPolyDataMapper* myEdgeMapper;
174   VISU_Actor *mySurfaceActor, *myEdgeActor;
175 };
176
177 //=======================================================================
178
179 #endif //VISU_ACTOR_H
180
181