Salome HOME
This commit was generated by cvs2git to create branch 'IMPORT'.
[modules/smesh.git] / src / OBJECT / SMESH_Actor.h
1 //  File      : SMESH_Actor.h
2 //  Created   : Mon May 13 22:30:51 2002
3 //  Author    : Nicolas REJNERI
4
5 //  Project   : SALOME
6 //  Module    : SMESH
7 //  Copyright : Open CASCADE 2002
8 //  $Header$
9
10
11 #ifndef SMESH_ACTOR_H
12 #define SMESH_ACTOR_H
13
14 #include "SALOME_Actor.h"
15
16 // VTK Includes
17 #include <vtkActor.h>
18 #include <vtkDataSetMapper.h>
19 #include <vtkUnstructuredGridReader.h>
20
21 // Open CASCADE Includes
22 #include <TColStd_IndexedMapOfInteger.hxx>
23 #include <TColStd_DataMapOfIntegerInteger.hxx>
24
25 typedef struct rgbStruct
26 {
27   float r;
28   float g;
29   float b;
30 } RGBStruct;
31
32 class SMESH_Actor : public SALOME_Actor {
33
34  public:
35   vtkTypeMacro(SMESH_Actor,SALOME_Actor);
36
37   static SMESH_Actor* New();
38
39   // Description:
40   // This causes the actor to be rendered. It, in turn, will render the actor`s
41   // property and then mapper.
42   virtual void Render(vtkRenderer *, vtkMapper *);
43
44   // Description:
45   // This method is used internally by the rendering process.
46   // We overide the superclass method to properly set the estimated render time.
47   int RenderOpaqueGeometry(vtkViewport *viewport);
48
49   void ShallowCopy(vtkProp *prop);
50
51   void setReader(vtkUnstructuredGridReader* r) ;
52   vtkUnstructuredGridReader* getReader();
53
54   // Highlight
55   virtual bool hasHighlight() { return true; }  
56
57   vtkMapper* getMapper();
58
59   void setDisplayMode(int);
60
61   void SetColor(float r,float g,float b);
62   void GetColor(float& r,float& g,float& b);
63   void SetHighlightColor(float r,float g,float b);
64   void GetHighlightColor(float& r,float& g,float& b);
65   void SetPreselectedColor(float r,float g,float b);
66   void GetPreselectedColor(float& r,float& g,float& b);
67
68   void SetEdgeColor(float r,float g,float b);
69   void GetEdgeColor(float& r,float& g,float& b);
70   void SetEdgeHighlightColor(float r,float g,float b);
71   void GetEdgeHighlightColor(float& r,float& g,float& b);
72   void SetEdgePreselectedColor(float r,float g,float b);
73   void GetEdgePreselectedColor(float& r,float& g,float& b);
74
75   void SetNodeColor(float r,float g,float b);
76   void GetNodeColor(float& r,float& g,float& b);
77  
78   void SetNodeSize(int size) ;
79   int  GetNodeSize() ;
80
81
82   void ClearNode();
83   void ClearElement();
84
85   void RemoveNode(int idSMESHDSnode);
86   void RemoveElement(int idSMESHDSelement);
87
88   void AddNode(int idSMESHDSnode, int idVTKnode);
89   void AddElement(int idSMESHDSelement, int idVTKelement);
90
91   int GetIdVTKNode(int idSMESHDSnode);
92   int GetIdVTKElement(int idSMESHDSelement);
93
94   int GetIdSMESHDSNode(int idVTKnode);
95   int GetIdSMESHDSElement(int idVTKelement);
96
97   void SetIdsVTKNode(const TColStd_DataMapOfIntegerInteger& mapVTK);
98   void SetIdsSMESHDSNode(const TColStd_DataMapOfIntegerInteger& mapSMESHDS);
99
100   void SetIdsVTKElement(const TColStd_DataMapOfIntegerInteger& mapVTK);
101   void SetIdsSMESHDSElement(const TColStd_DataMapOfIntegerInteger& mapSMESHDS);
102
103   vtkDataSet* DataSource;
104   vtkActor*   EdgeDevice;
105   vtkActor*   EdgeShrinkDevice;
106
107   float GetShrinkFactor();
108   void  SetShrinkFactor(float value );
109
110   void GetChildActors(vtkActorCollection*);
111
112   void SetVisibility(bool visibility);
113
114  protected:
115
116   SMESH_Actor();
117   ~SMESH_Actor();
118   SMESH_Actor(const SMESH_Actor&) {};
119   void operator=(const SMESH_Actor&) {};
120
121   vtkUnstructuredGridReader* myReader;
122
123   float myShrinkFactor;
124
125   RGBStruct edgeColor;
126   RGBStruct edgeHighlightColor;
127   RGBStruct edgePreselectedColor;
128
129   RGBStruct actorColor;
130   RGBStruct actorHighlightColor;
131   RGBStruct actorPreselectedColor;
132
133   RGBStruct actorNodeColor; // LPN
134   int       actorNodeSize;  // LPN
135
136 };
137 #endif //SMESH_ACTOR_H