1 // SMESH OBJECT : interactive object for SMESH visualization
3 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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.
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.
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
20 // See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
24 // File : SMESH_Actor.h
25 // Author : Nicolas REJNERI
32 #include "SALOME_Actor.h"
36 #include <vtkDataSetMapper.h>
37 #include <vtkUnstructuredGridReader.h>
39 // Open CASCADE Includes
40 #include <TColStd_IndexedMapOfInteger.hxx>
41 #include <TColStd_DataMapOfIntegerInteger.hxx>
43 typedef struct rgbStruct
50 class SMESH_Actor : public SALOME_Actor {
53 vtkTypeMacro(SMESH_Actor,SALOME_Actor);
55 static SMESH_Actor* New();
58 // This causes the actor to be rendered. It, in turn, will render the actor`s
59 // property and then mapper.
60 virtual void Render(vtkRenderer *, vtkMapper *);
63 // This method is used internally by the rendering process.
64 // We overide the superclass method to properly set the estimated render time.
65 int RenderOpaqueGeometry(vtkViewport *viewport);
67 void ShallowCopy(vtkProp *prop);
69 void setReader(vtkUnstructuredGridReader* r) ;
70 vtkUnstructuredGridReader* getReader();
73 virtual bool hasHighlight() { return true; }
75 vtkMapper* getMapper();
77 void setDisplayMode(int);
79 void SetColor(float r,float g,float b);
80 void GetColor(float& r,float& g,float& b);
81 void SetHighlightColor(float r,float g,float b);
82 void GetHighlightColor(float& r,float& g,float& b);
83 void SetPreselectedColor(float r,float g,float b);
84 void GetPreselectedColor(float& r,float& g,float& b);
86 void SetEdgeColor(float r,float g,float b);
87 void GetEdgeColor(float& r,float& g,float& b);
88 void SetEdgeHighlightColor(float r,float g,float b);
89 void GetEdgeHighlightColor(float& r,float& g,float& b);
90 void SetEdgePreselectedColor(float r,float g,float b);
91 void GetEdgePreselectedColor(float& r,float& g,float& b);
93 void SetNodeColor(float r,float g,float b);
94 void GetNodeColor(float& r,float& g,float& b);
96 void SetNodeSize(int size) ;
103 void RemoveNode(int idSMESHDSnode);
104 void RemoveElement(int idSMESHDSelement);
106 void AddNode(int idSMESHDSnode, int idVTKnode);
107 void AddElement(int idSMESHDSelement, int idVTKelement);
109 int GetIdVTKNode(int idSMESHDSnode);
110 int GetIdVTKElement(int idSMESHDSelement);
112 int GetIdSMESHDSNode(int idVTKnode);
113 int GetIdSMESHDSElement(int idVTKelement);
115 void SetIdsVTKNode(const TColStd_DataMapOfIntegerInteger& mapVTK);
116 void SetIdsSMESHDSNode(const TColStd_DataMapOfIntegerInteger& mapSMESHDS);
118 void SetIdsVTKElement(const TColStd_DataMapOfIntegerInteger& mapVTK);
119 void SetIdsSMESHDSElement(const TColStd_DataMapOfIntegerInteger& mapSMESHDS);
121 vtkDataSet* DataSource;
122 vtkActor* EdgeDevice;
123 vtkActor* EdgeShrinkDevice;
125 float GetShrinkFactor();
126 void SetShrinkFactor(float value );
128 void GetChildActors(vtkActorCollection*);
130 void SetVisibility(bool visibility);
136 SMESH_Actor(const SMESH_Actor&) {};
137 void operator=(const SMESH_Actor&) {};
139 vtkUnstructuredGridReader* myReader;
141 float myShrinkFactor;
144 RGBStruct edgeHighlightColor;
145 RGBStruct edgePreselectedColor;
147 RGBStruct actorColor;
148 RGBStruct actorHighlightColor;
149 RGBStruct actorPreselectedColor;
151 RGBStruct actorNodeColor; // LPN
152 int actorNodeSize; // LPN
155 #endif //SMESH_ACTOR_H