Salome HOME
Merging from V3_2_6pre4
[modules/geom.git] / src / OBJECT / GEOM_Actor.h
1 //  GEOM OBJECT : interactive object for Geometry entities visualization
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.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 //
23 //
24 //  File   : GEOM_Actor.h
25 //  Author : Christophe ATTANASIO
26 //  Module : GEOM
27 //  $Header$
28
29 #ifndef GEOM_ACTOR_H
30 #define GEOM_ACTOR_H
31
32 #include "GEOM_OBJECT_defs.hxx"
33
34 #include "SALOME_Actor.h"
35
36 //OpenCASCADE
37 #include <TopoDS_Shape.hxx>
38 #include <TopoDS.hxx>
39
40 class vtkCamera;
41 class TopoDS_Shape;
42
43 class GEOM_OBJECT_EXPORT GEOM_Actor : public SALOME_Actor {
44  public:
45   vtkTypeMacro(GEOM_Actor,SALOME_Actor);
46
47   static GEOM_Actor* New();
48
49   // Description:
50   // This causes the actor to be rendered. It, in turn, will render the actor's
51   // property and then mapper.
52   virtual void Render(vtkRenderer *, vtkMapper *);
53
54   // Description:
55   // Release any graphics resources that are being consumed by this actor.
56   // The parameter window could be used to determine which graphic
57   // resources to release.
58   void ReleaseGraphicsResources(vtkWindow *);
59
60   const TopoDS_Shape& getTopo();
61   void setInputShape(const TopoDS_Shape& ashape, double adef1,
62                      int imode, bool isVector = false);
63
64   double getDeflection();
65   void setDeflection(double adefl);
66
67   double isVector() { return myIsVector; }
68
69   // SubShape
70   void SubShapeOn();
71   void SubShapeOff();
72   
73   // Display Mode
74   virtual void setDisplayMode(int);
75
76   // Highlight
77   virtual void highlight(bool theHighlight);
78   virtual bool hasHighlight() { return true; }
79
80   void ShallowCopy(vtkProp *prop);
81
82   // Properties
83   void SetHighlightProperty(vtkProperty* Prop);
84   void SetWireframeProperty(vtkProperty* Prop);
85   void SetShadingProperty(vtkProperty* Prop);
86
87   // Opacity
88   void SetOpacity(vtkFloatingPointType opa);
89   vtkFloatingPointType GetOpacity();
90
91   // Color
92   void SetColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b);
93   void GetColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b);
94
95   virtual bool IsInfinite() {return myIsInfinite;}  
96  protected:
97
98   GEOM_Actor();
99   ~GEOM_Actor();
100   GEOM_Actor(const GEOM_Actor&) {};
101   void operator=(const GEOM_Actor&) {};
102
103   void CreateWireframeMapper();
104   void CreateShadingMapper();
105   void CreateMapper(int theMode);
106   void GetMatrix(vtkCamera* theCam, vtkMatrix4x4 *result);
107
108
109  private:
110
111   bool subshape;
112   bool myIsInfinite;
113
114   TopoDS_Shape myShape;
115   double deflection;
116   bool myIsVector;
117
118   vtkMapper* ShadingMapper;
119   vtkMapper* WireframeMapper;
120
121   vtkProperty* ShadingProperty;
122   vtkProperty* WireframeProperty;
123   vtkProperty* HighlightProperty;
124 };
125
126
127 #endif //GEOM_ACTOR_H
128