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