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_ActorDef.h
25 // Author : Nicolas REJNERI
29 #ifndef SMESH_ACTORDEF_H
30 #define SMESH_ACTORDEF_H
32 #include "SMESH_Actor.h"
33 #include "SMESH_Object.h"
36 class vtkShrinkFilter;
37 class vtkPolyDataMapper;
38 class vtkUnstructuredGrid;
46 class vtkLabeledDataMapper;
47 class vtkSelectVisiblePoints;
49 class vtkScalarBarActor;
53 class vtkImplicitBoolean;
57 class SMESH_DeviceActor;
60 class SMESH_ActorDef : public SMESH_Actor{
61 friend class SMESH_VisualObj;
62 friend class SMESH_Actor;
65 vtkTypeMacro(SMESH_ActorDef,SMESH_Actor);
67 virtual void ReleaseGraphicsResources(vtkWindow *renWin);
68 virtual int RenderOpaqueGeometry(vtkViewport *viewport);
69 virtual int RenderTranslucentGeometry(vtkViewport *viewport);
70 virtual void Render(vtkRenderer *ren);
72 virtual void AddToRender(vtkRenderer* theRenderer);
73 virtual void RemoveFromRender(vtkRenderer* theRenderer);
75 virtual bool hasHighlight() { return true; }
76 virtual void highlight(bool theHighlight);
77 virtual void SetPreSelected(bool thePreselect = false);
79 virtual bool IsInfinitive();
81 virtual void SetOpacity(float theValue);
82 virtual float GetOpacity();
84 virtual void SetSufaceColor(float r,float g,float b);
85 virtual void GetSufaceColor(float& r,float& g,float& b);
87 virtual void SetBackSufaceColor(float r,float g,float b);
88 virtual void GetBackSufaceColor(float& r,float& g,float& b);
90 virtual void SetEdgeColor(float r,float g,float b);
91 virtual void GetEdgeColor(float& r,float& g,float& b);
93 virtual void SetNodeColor(float r,float g,float b);
94 virtual void GetNodeColor(float& r,float& g,float& b);
96 virtual void SetHighlightColor(float r,float g,float b);
97 virtual void GetHighlightColor(float& r,float& g,float& b);
99 virtual void SetPreHighlightColor(float r,float g,float b);
100 virtual void GetPreHighlightColor(float& r,float& g,float& b);
102 virtual float GetLineWidth();
103 virtual void SetLineWidth(float theVal);
105 virtual void SetNodeSize(float size) ;
106 virtual float GetNodeSize() ;
108 virtual int GetNodeObjId(int theVtkID);
109 virtual float* GetNodeCoord(int theObjID);
111 virtual int GetElemObjId(int theVtkID);
112 virtual vtkCell* GetElemCell(int theObjID);
114 virtual int GetObjDimension( const int theObjId );
116 virtual void SetVisibility(int theMode);
117 void SetVisibility(int theMode, bool theIsUpdateRepersentation);
119 virtual void SetRepresentation(int theMode);
121 virtual unsigned int GetEntityMode() const { return myEntityMode;}
122 virtual void SetEntityMode(unsigned int theMode);
124 virtual void SetPointRepresentation(bool theIsPointsVisible);
125 virtual bool GetPointRepresentation();
127 virtual float* GetBounds();
128 virtual void SetTransform(SALOME_Transform* theTransform);
130 virtual vtkUnstructuredGrid* GetUnstructuredGrid();
131 virtual vtkDataSet* GetInput();
132 virtual vtkMapper* GetMapper();
134 virtual float GetShrinkFactor();
135 virtual void SetShrinkFactor(float theValue);
137 virtual bool IsShrunkable() { return myIsShrinkable;}
138 virtual bool IsShrunk() { return myIsShrunk;}
139 virtual void SetShrink();
140 virtual void UnShrink();
142 virtual void SetPointsLabeled(bool theIsPointsLabeled);
143 virtual bool GetPointsLabeled(){ return myIsPointsLabeled;}
145 virtual void SetCellsLabeled(bool theIsCellsLabeled);
146 virtual bool GetCellsLabeled(){ return myIsCellsLabeled;}
148 virtual void SetControlMode(eControl theMode);
149 virtual eControl GetControlMode(){ return myControlMode;}
151 enum e1DControl{e1DNone, e1DColored, e1DHighlited};
152 e1DControl Get1DControlMode(){ return my1DColorMode;}
154 virtual vtkScalarBarActor* GetScalarBarActor(){ return myScalarBarActor;}
156 virtual void SetPlaneParam(float theDir[3], float theDist, vtkPlane* thePlane);
157 virtual void GetPlaneParam(float theDir[3], float& theDist, vtkPlane* thePlane);
159 virtual vtkImplicitBoolean* GetPlaneContainer();
161 virtual TVisualObjPtr GetObject() { return myVisualObj;}
163 virtual void SetControlsPrecision( const long p ) { myControlsPrecision = p; }
164 virtual long GetControlsPrecision() const { return myControlsPrecision; }
167 TVisualObjPtr myVisualObj;
168 vtkTimeStamp* myTimeStamp;
170 vtkScalarBarActor* myScalarBarActor;
171 vtkLookupTable* myLookupTable;
173 vtkProperty* mySurfaceProp;
174 vtkProperty* myBackSurfaceProp;
175 vtkProperty* myEdgeProp;
176 vtkProperty* myNodeProp;
178 SMESH_DeviceActor* myBaseActor;
179 SMESH_DeviceActor* myNodeActor;
180 SMESH_DeviceActor* myPickableActor;
182 vtkProperty* myHighlightProp;
183 vtkProperty* myPreselectProp;
184 SMESH_DeviceActor* myHighlitableActor;
185 SMESH_DeviceActor* myNodeHighlitableActor;
187 eControl myControlMode;
188 SMESH_DeviceActor* my2DActor;
189 SMESH_DeviceActor* my3DActor;
190 SMESH_DeviceActor* myControlActor;
192 e1DControl my1DColorMode;
193 vtkProperty* my1DProp;
194 SMESH_DeviceActor* my1DActor;
195 vtkProperty* my1DExtProp;
196 SMESH_DeviceActor* my1DExtActor;
198 unsigned int myEntityMode;
199 bool myIsPointsVisible;
204 bool myIsPointsLabeled;
205 vtkUnstructuredGrid* myPointsNumDataSet;
206 vtkActor2D *myPointLabels;
207 vtkMaskPoints* myPtsMaskPoints;
208 vtkLabeledDataMapper* myPtsLabeledDataMapper;
209 vtkSelectVisiblePoints* myPtsSelectVisiblePoints;
211 bool myIsCellsLabeled;
212 vtkUnstructuredGrid* myCellsNumDataSet;
213 vtkActor2D *myCellsLabels;
214 vtkMaskPoints* myClsMaskPoints;
215 vtkCellCenters* myCellCenters;
216 vtkLabeledDataMapper* myClsLabeledDataMapper;
217 vtkSelectVisiblePoints* myClsSelectVisiblePoints;
219 vtkImplicitBoolean* myImplicitBoolean;
221 long myControlsPrecision;
226 bool Init(TVisualObjPtr theVisualObj,
227 const char* theEntry,
231 void SetIsShrunkable(bool theShrunkable);
232 void UpdateHighlight();
236 // hide the two parameter Render() method from the user and the compiler.
237 virtual void Render(vtkRenderer *, vtkMapper *) {};
238 virtual void ShallowCopy(vtkProp *prop);
239 virtual void SetMapper(vtkMapper *);
240 static SMESH_ActorDef* New();
243 SMESH_ActorDef(const SMESH_ActorDef&);
244 void operator=(const SMESH_ActorDef&);
248 #endif //SMESH_ACTORDEF_H