Salome HOME
NRI : First integration.
[modules/geom.git] / src / OBJECT / GEOM_Actor.h
1 //  File      : GEOM_Actor.h
2 //  Created   : Wed Feb 20 17:24:59 2002
3 //  Author    : Christophe ATTANASIO
4 //  Project   : SALOME
5 //  Module    : GEOM
6 //  Copyright : Open CASCADE 2002
7 //  $Header$
8
9
10 #ifndef GEOM_ACTOR_H
11 #define GEOM_ACTOR_H
12
13 #include "SALOME_Actor.h"
14
15 //VTK
16 #include <vtkMapper.h>
17 #include <vtkProperty.h>
18 #include <vtkMatrix4x4.h>
19 #include <vtkCamera.h>
20
21 //OpenCASCADE
22 #include <TopoDS_Shape.hxx>
23 #include <TopoDS.hxx>
24
25
26 class TopoDS_Shape;
27
28 #ifdef _WIN_32
29 #define VTKOCC_EXPORT __declspec (dllexport)
30 #else
31 #define VTKOCC_EXPORT
32 #endif
33 class VTKOCC_EXPORT GEOM_Actor : public SALOME_Actor {
34
35
36  public:
37   vtkTypeMacro(GEOM_Actor,SALOME_Actor);
38
39   static GEOM_Actor* New();
40
41   // Description:
42   // This causes the actor to be rendered. It, in turn, will render the actor's
43   // property and then mapper.
44   virtual void Render(vtkRenderer *, vtkMapper *);
45
46   // Description:
47   // Release any graphics resources that are being consumed by this actor.
48   // The parameter window could be used to determine which graphic
49   // resources to release.
50   void ReleaseGraphicsResources(vtkWindow *);
51
52   const TopoDS_Shape& getTopo();
53   void setInputShape(const TopoDS_Shape& ashape,double adef1,int imode);
54
55   double getDeflection();
56   void setDeflection(double adefl);
57
58   // SubShape
59   void SubShapeOn();
60   void SubShapeOff();
61   
62   // Display Mode
63   void setDisplayMode(int);
64
65   // Highlight
66   void highlight(Standard_Boolean highlight);
67   bool hasHighlight();
68
69   void ShallowCopy(vtkProp *prop);
70
71   // Properties
72   void SetHighlightProperty(vtkProperty* Prop);
73   void SetWireframeProperty(vtkProperty* Prop);
74   void SetShadingProperty(vtkProperty* Prop);
75
76   // Opacity
77   void SetOpacity(float opa);
78   float GetOpacity();
79
80   // Color
81   void SetColor(float r,float g,float b);
82   void GetColor(float& r,float& g,float& b);
83   
84  protected:
85
86   GEOM_Actor();
87   ~GEOM_Actor();
88   GEOM_Actor(const GEOM_Actor&) {};
89   void operator=(const GEOM_Actor&) {};
90
91   void CreateWireframeMapper();
92   void CreateShadingMapper();
93   void CreateMapper(int theMode);
94   void GetMatrix(vtkCamera* theCam, vtkMatrix4x4 *result);
95
96
97  private:
98
99   bool subshape;
100
101   TopoDS_Shape myShape;
102   double deflection;
103
104   vtkMapper* ShadingMapper;
105   vtkMapper* WireframeMapper;
106
107   vtkProperty* ShadingProperty;
108   vtkProperty* WireframeProperty;
109   vtkProperty* HighlightProperty;
110
111   int myDisplayMode;
112
113 };
114 #endif //GEOM_ACTOR_H