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"
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_Actor : public SALOME_Actor{
61 friend class SMESH_VisualObj;
64 vtkTypeMacro(SMESH_Actor,SALOME_Actor);
65 static SMESH_Actor* New(TVisualObjPtr theVisualObj,
70 virtual void ReleaseGraphicsResources(vtkWindow *renWin);
71 virtual int RenderOpaqueGeometry(vtkViewport *viewport);
72 virtual int RenderTranslucentGeometry(vtkViewport *viewport);
73 virtual void Render(vtkRenderer *ren);
75 virtual void AddToRender(vtkRenderer* theRenderer);
76 virtual void RemoveFromRender(vtkRenderer* theRenderer);
78 virtual bool hasHighlight() { return true; }
79 virtual void highlight(bool theHighlight);
80 virtual void SetPreSelected(bool thePreselect = false);
82 virtual bool IsInfinitive();
84 virtual void SetOpacity(float theValue);
85 virtual float GetOpacity();
87 void SetSufaceColor(float r,float g,float b);
88 void GetSufaceColor(float& r,float& g,float& b);
90 void SetBackSufaceColor(float r,float g,float b);
91 void GetBackSufaceColor(float& r,float& g,float& b);
93 void SetEdgeColor(float r,float g,float b);
94 void GetEdgeColor(float& r,float& g,float& b);
96 void SetNodeColor(float r,float g,float b);
97 void GetNodeColor(float& r,float& g,float& b);
99 void SetHighlightColor(float r,float g,float b);
100 void GetHighlightColor(float& r,float& g,float& b);
102 void SetPreHighlightColor(float r,float g,float b);
103 void GetPreHighlightColor(float& r,float& g,float& b);
105 float GetLineWidth();
106 void SetLineWidth(float theVal);
108 void SetNodeSize(float size) ;
109 float GetNodeSize() ;
111 virtual int GetNodeObjId(int theVtkID);
112 virtual float* GetNodeCoord(int theObjID);
114 virtual int GetElemObjId(int theVtkID);
115 virtual vtkCell* GetElemCell(int theObjID);
117 virtual int GetObjDimension( const int theObjId );
119 virtual void SetVisibility(int theMode);
120 void SetVisibility(int theMode, bool theIsUpdateRepersentation);
122 enum EReperesent { ePoint, eEdge, eSurface};
123 virtual void SetRepresentation(int theMode);
124 void SetPointRepresentation(bool theIsPointsVisible);
125 bool GetPointRepresentation();
127 virtual float* GetBounds();
128 virtual void SetTransform(SALOME_Transform* theTransform);
130 vtkUnstructuredGrid* GetUnstructuredGrid();
131 virtual vtkDataSet* GetInput();
132 virtual vtkMapper* GetMapper();
134 virtual float GetShrinkFactor();
135 virtual void SetShrinkFactor(float value );
137 virtual bool IsShrunkable() { return myIsShrinkable;}
138 virtual bool IsShrunk() { return myIsShrunk;}
139 virtual void SetShrink();
140 virtual void UnShrink();
142 void SetPointsLabeled(bool theIsPointsLabeled);
143 bool GetPointsLabeled(){ return myIsPointsLabeled;}
145 void SetCellsLabeled(bool theIsCellsLabeled);
146 bool GetCellsLabeled(){ return myIsCellsLabeled;}
148 enum eControl{eNone, eLengthEdges, eFreeBorders, eFreeEdges, eMultiConnection,
149 eArea, eTaper, eAspectRatio, eMinimumAngle, eWarping, eSkew};
150 void SetControlMode(eControl theMode);
151 eControl GetControlMode(){ return myColorMode;}
153 enum e1DControl{e1DNone, e1DColored, e1DHighlited};
154 e1DControl Get1DControlMode(){ return my1DColorMode;}
156 vtkScalarBarActor* GetScalarBarActor(){ return myScalarBarActor;}
158 void SetPlaneParam(float theDir[3], float theDist, vtkPlane* thePlane);
159 void GetPlaneParam(float theDir[3], float& theDist, vtkPlane* thePlane);
161 vtkImplicitBoolean* GetPlaneContainer();
163 TVisualObjPtr GetObject() { return myVisualObj;}
165 void SetControlsPrecision( const long p ) { myControlsPrecision = p; }
166 long GetControlsPrecision() const { return myControlsPrecision; }
169 TVisualObjPtr myVisualObj;
170 vtkTimeStamp* myTimeStamp;
172 vtkScalarBarActor* myScalarBarActor;
173 vtkLookupTable* myLookupTable;
175 vtkProperty* mySurfaceProp;
176 vtkProperty* myBackSurfaceProp;
177 vtkProperty* myEdgeProp;
178 vtkProperty* myNodeProp;
180 SMESH_DeviceActor* myBaseActor;
181 SMESH_DeviceActor* myNodeActor;
182 SMESH_DeviceActor* myPickableActor;
184 vtkProperty* myHighlightProp;
185 vtkProperty* myPreselectProp;
186 SMESH_DeviceActor* myHighlitableActor;
187 SMESH_DeviceActor* myNodeHighlitableActor;
189 eControl myColorMode;
190 SMESH_DeviceActor* my2DActor;
191 SMESH_DeviceActor* my3DActor;
192 SMESH_DeviceActor* myControlActor;
194 e1DControl my1DColorMode;
195 vtkProperty* my1DProp;
196 SMESH_DeviceActor* my1DActor;
197 vtkProperty* my1DExtProp;
198 SMESH_DeviceActor* my1DExtActor;
200 bool myIsPointsVisible;
205 bool myIsPointsLabeled;
206 vtkUnstructuredGrid* myPointsNumDataSet;
207 vtkActor2D *myPointLabels;
208 vtkMaskPoints* myPtsMaskPoints;
209 vtkLabeledDataMapper* myPtsLabeledDataMapper;
210 vtkSelectVisiblePoints* myPtsSelectVisiblePoints;
212 bool myIsCellsLabeled;
213 vtkUnstructuredGrid* myCellsNumDataSet;
214 vtkActor2D *myCellsLabels;
215 vtkMaskPoints* myClsMaskPoints;
216 vtkCellCenters* myCellCenters;
217 vtkLabeledDataMapper* myClsLabeledDataMapper;
218 vtkSelectVisiblePoints* myClsSelectVisiblePoints;
220 vtkImplicitBoolean* myImplicitBoolean;
222 long myControlsPrecision;
227 bool Init(TVisualObjPtr theVisualObj,
228 const char* theEntry,
232 void SetIsShrunkable(bool theShrunkable);
233 void UpdateHighlight();
237 // hide the two parameter Render() method from the user and the compiler.
238 virtual void Render(vtkRenderer *, vtkMapper *) {};
239 virtual void ShallowCopy(vtkProp *prop);
240 virtual void SetMapper(vtkMapper *);
241 static SMESH_Actor* New();
244 SMESH_Actor(const SMESH_Actor&);
245 void operator=(const SMESH_Actor&);
249 #endif //SMESH_ACTOR_H