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