Salome HOME
Porting to Qt4.
[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
42 class GEOM_OBJECT_EXPORT GEOM_Actor : public SALOME_Actor {
43  public:
44   vtkTypeMacro(GEOM_Actor,SALOME_Actor);
45
46   static GEOM_Actor* New();
47
48   // Description:
49   // This causes the actor to be rendered. It, in turn, will render the actor's
50   // property and then mapper.
51   virtual void Render(vtkRenderer *, vtkMapper *);
52
53   // Description:
54   // Release any graphics resources that are being consumed by this actor.
55   // The parameter window could be used to determine which graphic
56   // resources to release.
57   void ReleaseGraphicsResources(vtkWindow *);
58
59   const TopoDS_Shape& getTopo();
60   void setInputShape(const TopoDS_Shape& ashape, double adef1,
61                      int imode, bool isVector = false);
62
63   double getDeflection();
64   void setDeflection(double adefl);
65
66   double isVector() { return myIsVector; }
67
68   // SubShape
69   void SubShapeOn();
70   void SubShapeOff();
71   
72   // Display Mode
73   virtual void setDisplayMode(int);
74
75   // Highlight
76   virtual void highlight(bool theHighlight);
77   virtual bool hasHighlight() { return true; }
78
79   void ShallowCopy(vtkProp *prop);
80
81   // Properties
82   void SetHighlightProperty(vtkProperty* Prop);
83   void SetWireframeProperty(vtkProperty* Prop);
84   void SetShadingProperty(vtkProperty* Prop);
85
86   // Opacity
87   void SetOpacity(vtkFloatingPointType opa);
88   vtkFloatingPointType GetOpacity();
89
90   // Color
91   void SetColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b);
92   void GetColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b);
93
94   virtual bool IsInfinite() {return myIsInfinite;}  
95  protected:
96
97   GEOM_Actor();
98   ~GEOM_Actor();
99   GEOM_Actor(const GEOM_Actor&) {};
100   void operator=(const GEOM_Actor&) {};
101
102   void CreateWireframeMapper();
103   void CreateShadingMapper();
104   void CreateMapper(int theMode);
105   void GetMatrix(vtkCamera* theCam, vtkMatrix4x4 *result);
106
107
108  private:
109
110   bool subshape;
111   bool myIsInfinite;
112
113   TopoDS_Shape myShape;
114   double deflection;
115   bool myIsVector;
116
117   vtkMapper* ShadingMapper;
118   vtkMapper* WireframeMapper;
119
120   vtkProperty* ShadingProperty;
121   vtkProperty* WireframeProperty;
122   vtkProperty* HighlightProperty;
123 };
124
125
126 #endif //GEOM_ACTOR_H
127