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 virtual vtkScalarBarActor* GetScalarBarActor(){ return myScalarBarActor;}
153 virtual void SetPlaneParam(float theDir[3], float theDist, vtkPlane* thePlane);
154 virtual void GetPlaneParam(float theDir[3], float& theDist, vtkPlane* thePlane);
156 virtual vtkImplicitBoolean* GetPlaneContainer();
158 virtual TVisualObjPtr GetObject() { return myVisualObj;}
160 virtual void SetControlsPrecision( const long p ) { myControlsPrecision = p; }
161 virtual long GetControlsPrecision() const { return myControlsPrecision; }
164 TVisualObjPtr myVisualObj;
165 vtkTimeStamp* myTimeStamp;
167 vtkScalarBarActor* myScalarBarActor;
168 vtkLookupTable* myLookupTable;
170 vtkProperty* mySurfaceProp;
171 vtkProperty* myBackSurfaceProp;
172 vtkProperty* myEdgeProp;
173 vtkProperty* myNodeProp;
175 SMESH_DeviceActor* myBaseActor;
176 SMESH_DeviceActor* myNodeActor;
177 SMESH_DeviceActor* myPickableActor;
179 vtkProperty* myHighlightProp;
180 vtkProperty* myPreselectProp;
181 SMESH_DeviceActor* myHighlitableActor;
182 SMESH_DeviceActor* myNodeHighlitableActor;
184 eControl myControlMode;
185 SMESH_DeviceActor* my2DActor;
186 SMESH_DeviceActor* my3DActor;
187 SMESH_DeviceActor* myControlActor;
189 vtkProperty* my1DProp;
190 SMESH_DeviceActor* my1DActor;
191 vtkProperty* my1DExtProp;
192 SMESH_DeviceActor* my1DExtActor;
194 unsigned int myEntityMode;
195 bool myIsPointsVisible;
200 bool myIsPointsLabeled;
201 vtkUnstructuredGrid* myPointsNumDataSet;
202 vtkActor2D *myPointLabels;
203 vtkMaskPoints* myPtsMaskPoints;
204 vtkLabeledDataMapper* myPtsLabeledDataMapper;
205 vtkSelectVisiblePoints* myPtsSelectVisiblePoints;
207 bool myIsCellsLabeled;
208 vtkUnstructuredGrid* myCellsNumDataSet;
209 vtkActor2D *myCellsLabels;
210 vtkMaskPoints* myClsMaskPoints;
211 vtkCellCenters* myCellCenters;
212 vtkLabeledDataMapper* myClsLabeledDataMapper;
213 vtkSelectVisiblePoints* myClsSelectVisiblePoints;
215 vtkImplicitBoolean* myImplicitBoolean;
217 long myControlsPrecision;
222 bool Init(TVisualObjPtr theVisualObj,
223 const char* theEntry,
227 void SetIsShrunkable(bool theShrunkable);
228 void UpdateHighlight();
232 // hide the two parameter Render() method from the user and the compiler.
233 virtual void Render(vtkRenderer *, vtkMapper *) {};
234 virtual void ShallowCopy(vtkProp *prop);
235 virtual void SetMapper(vtkMapper *);
236 static SMESH_ActorDef* New();
239 SMESH_ActorDef(const SMESH_ActorDef&);
240 void operator=(const SMESH_ActorDef&);
244 #endif //SMESH_ACTORDEF_H