Salome HOME
ENV: Windows porting.
[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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
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 "SALOME_Actor.h"
33
34 //OpenCASCADE
35 #include <TopoDS_Shape.hxx>
36 #include <TopoDS.hxx>
37
38 class vtkCamera;
39 class TopoDS_Shape;
40
41 #ifdef WNT
42 #include <SALOME_WNT.hxx>
43 #else
44 #define SALOME_WNT_EXPORT
45 #endif
46
47 class SALOME_WNT_EXPORT GEOM_Actor : public SALOME_Actor {
48  public:
49   vtkTypeMacro(GEOM_Actor,SALOME_Actor);
50
51   static GEOM_Actor* New();
52
53   // Description:
54   // This causes the actor to be rendered. It, in turn, will render the actor's
55   // property and then mapper.
56   virtual void Render(vtkRenderer *, vtkMapper *);
57
58   // Description:
59   // Release any graphics resources that are being consumed by this actor.
60   // The parameter window could be used to determine which graphic
61   // resources to release.
62   void ReleaseGraphicsResources(vtkWindow *);
63
64   const TopoDS_Shape& getTopo();
65   void setInputShape(const TopoDS_Shape& ashape,double adef1,int imode);
66
67   double getDeflection();
68   void setDeflection(double adefl);
69
70   // SubShape
71   void SubShapeOn();
72   void SubShapeOff();
73   
74   // Display Mode
75   virtual void setDisplayMode(int);
76
77   // Highlight
78   virtual void highlight(bool theHighlight);
79   virtual bool hasHighlight() { return true; }
80
81   void ShallowCopy(vtkProp *prop);
82
83   // Properties
84   void SetHighlightProperty(vtkProperty* Prop);
85   void SetWireframeProperty(vtkProperty* Prop);
86   void SetShadingProperty(vtkProperty* Prop);
87
88   // Opacity
89   void SetOpacity(float opa);
90   float GetOpacity();
91
92   // Color
93   void SetColor(float r,float g,float b);
94   void GetColor(float& r,float& g,float& b);
95
96   virtual bool IsInfinite() {return myIsInfinite;}  
97  protected:
98
99   GEOM_Actor();
100   ~GEOM_Actor();
101   GEOM_Actor(const GEOM_Actor&) {};
102   void operator=(const GEOM_Actor&) {};
103
104   void CreateWireframeMapper();
105   void CreateShadingMapper();
106   void CreateMapper(int theMode);
107   void GetMatrix(vtkCamera* theCam, vtkMatrix4x4 *result);
108
109
110  private:
111
112   bool subshape;
113   bool myIsInfinite;
114
115   TopoDS_Shape myShape;
116   double deflection;
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