Salome HOME
Merging with WPdev
[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,int imode);
62
63   double getDeflection();
64   void setDeflection(double adefl);
65
66   // SubShape
67   void SubShapeOn();
68   void SubShapeOff();
69   
70   // Display Mode
71   virtual void setDisplayMode(int);
72
73   // Highlight
74   virtual void highlight(bool theHighlight);
75   virtual bool hasHighlight() { return true; }
76
77   void ShallowCopy(vtkProp *prop);
78
79   // Properties
80   void SetHighlightProperty(vtkProperty* Prop);
81   void SetWireframeProperty(vtkProperty* Prop);
82   void SetShadingProperty(vtkProperty* Prop);
83
84   // Opacity
85   void SetOpacity(vtkFloatingPointType opa);
86   vtkFloatingPointType GetOpacity();
87
88   // Color
89   void SetColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b);
90   void GetColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b);
91
92   virtual bool IsInfinite() {return myIsInfinite;}  
93  protected:
94
95   GEOM_Actor();
96   ~GEOM_Actor();
97   GEOM_Actor(const GEOM_Actor&) {};
98   void operator=(const GEOM_Actor&) {};
99
100   void CreateWireframeMapper();
101   void CreateShadingMapper();
102   void CreateMapper(int theMode);
103   void GetMatrix(vtkCamera* theCam, vtkMatrix4x4 *result);
104
105
106  private:
107
108   bool subshape;
109   bool myIsInfinite;
110
111   TopoDS_Shape myShape;
112   double deflection;
113
114   vtkMapper* ShadingMapper;
115   vtkMapper* WireframeMapper;
116
117   vtkProperty* ShadingProperty;
118   vtkProperty* WireframeProperty;
119   vtkProperty* HighlightProperty;
120 };
121
122
123 #endif //GEOM_ACTOR_H
124