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;
45 class vtkLabeledDataMapper;
46 class vtkSelectVisiblePoints;
48 class vtkScalarBarActor;
51 class SMESH_DeviceActor;
52 class SALOME_ExtractUnstructuredGrid;
55 class SMESH_Actor : public SALOME_Actor{
56 friend class SMESH_VisualObj;
59 vtkTypeMacro(SMESH_Actor,SALOME_Actor);
60 static SMESH_Actor* New(TVisualObjPtr theVisualObj,
61 SMESH::FilterManager_ptr theFilterMgr,
66 virtual void ReleaseGraphicsResources(vtkWindow *renWin);
67 virtual int RenderOpaqueGeometry(vtkViewport *viewport);
68 virtual int RenderTranslucentGeometry(vtkViewport *viewport);
69 virtual void Render(vtkRenderer *ren);
71 virtual void AddToRender(vtkRenderer* theRenderer);
72 virtual void RemoveFromRender(vtkRenderer* theRenderer);
74 virtual bool hasHighlight() { return true; }
75 virtual void highlight(Standard_Boolean highlight);
76 virtual void SetPreSelected(Standard_Boolean presel = Standard_False);
78 virtual bool IsInfinitive();
80 virtual void SetOpacity(float theValue);
81 virtual float GetOpacity();
83 void SetSufaceColor(float r,float g,float b);
84 void GetSufaceColor(float& r,float& g,float& b);
86 void SetBackSufaceColor(float r,float g,float b);
87 void GetBackSufaceColor(float& r,float& g,float& b);
89 void SetEdgeColor(float r,float g,float b);
90 void GetEdgeColor(float& r,float& g,float& b);
92 void SetNodeColor(float r,float g,float b);
93 void GetNodeColor(float& r,float& g,float& b);
95 void SetHighlightColor(float r,float g,float b);
96 void GetHighlightColor(float& r,float& g,float& b);
98 void SetPreHighlightColor(float r,float g,float b);
99 void GetPreHighlightColor(float& r,float& g,float& b);
101 float GetLineWidth();
102 void SetLineWidth(float theVal);
104 void SetNodeSize(float size) ;
105 float GetNodeSize() ;
107 virtual int GetObjId(int theVtkID);
108 virtual TVectorId GetVtkId(int theObjID);
110 virtual int GetNodeObjId(int theVtkID);
111 virtual TVectorId GetNodeVtkId(int theObjID);
113 virtual int GetElemObjId(int theVtkID);
114 virtual TVectorId GetElemVtkId(int theObjID);
116 virtual int GetObjDimension( const int theObjId );
118 virtual void SetVisibility(int theMode);
120 enum EReperesent { ePoint, eEdge, eSurface};
121 virtual void SetRepresentation(int theMode);
122 void SetPointRepresentation(int theIsPointsVisible);
123 bool GetPointRepresentation(){ return myIsPointsVisible;}
125 virtual vtkPolyData* GetPolyDataInput();
126 virtual void SetTransform(SALOME_Transform* theTransform);
128 vtkUnstructuredGrid* GetUnstructuredGrid();
129 virtual vtkMapper* GetMapper();
131 float GetShrinkFactor();
132 void SetShrinkFactor(float value );
134 bool IsShrunkable() { return myIsShrinkable;}
135 bool IsShrunk() { return myIsShrunk;}
139 void SetPointsLabeled(bool theIsPointsLabeled);
140 bool GetPointsLabeled(){ return myIsPointsLabeled;}
142 void SetCellsLabeled(bool theIsCellsLabeled);
143 bool GetCellsLabeled(){ return myIsCellsLabeled;}
145 enum eControl{eNone, eLengthEdges, eFreeBorders, eMultiConnection,
146 eArea, eTaper, eAspectRatio, eMinimumAngle, eWarping, eSkew};
147 void SetControlMode(eControl theMode);
148 eControl GetControlMode(){ return myColorMode;}
150 enum e1DControl{e1DNone, e1DColored, e1DHighlited};
151 e1DControl Get1DControlMode(){ return my1DColorMode;}
153 vtkScalarBarActor* GetScalarBarActor(){ return myScalarBarActor;}
155 TVisualObjPtr GetObject() { return myVisualObj;}
158 TVisualObjPtr myVisualObj;
160 SMESH::FilterManager_var myFilterMgr;
161 vtkScalarBarActor* myScalarBarActor;
162 vtkLookupTable* myLookupTable;
164 vtkProperty* mySurfaceProp;
165 vtkProperty* myBackSurfaceProp;
166 vtkProperty* myEdgeProp;
167 vtkProperty* myNodeProp;
169 SMESH_DeviceActor* myBaseActor;
170 SMESH_DeviceActor* myNodeActor;
171 SMESH_DeviceActor* myPickableActor;
173 vtkProperty* myHighlightProp;
174 vtkProperty* myPreselectProp;
175 SMESH_DeviceActor* myHighlitableActor;
177 eControl myColorMode;
178 SMESH_DeviceActor* my2DActor;
179 SMESH_DeviceActor* my3DActor;
180 SMESH_DeviceActor* myControlActor;
182 e1DControl my1DColorMode;
183 vtkProperty* my1DProp;
184 SMESH_DeviceActor* my1DActor;
185 vtkProperty* my1DExtProp;
186 SMESH_DeviceActor* my1DExtActor;
188 bool myIsPointsVisible;
193 bool myIsPointsLabeled;
194 vtkUnstructuredGrid* myPointsNumDataSet;
195 vtkActor2D *myPointLabels;
196 vtkMaskPoints* myPtsMaskPoints;
197 vtkLabeledDataMapper* myPtsLabeledDataMapper;
198 vtkSelectVisiblePoints* myPtsSelectVisiblePoints;
200 bool myIsCellsLabeled;
201 vtkUnstructuredGrid* myCellsNumDataSet;
202 vtkActor2D *myCellsLabels;
203 vtkMaskPoints* myClsMaskPoints;
204 vtkCellCenters* myCellCenters;
205 vtkLabeledDataMapper* myClsLabeledDataMapper;
206 vtkSelectVisiblePoints* myClsSelectVisiblePoints;
211 void Init(TVisualObjPtr theVisualObj,
212 SMESH::FilterManager_ptr theFilterMgr,
213 const char* theEntry,
217 void SetUnstructuredGrid(vtkUnstructuredGrid* theGrid);
218 void SetIsShrunkable(bool theShrunkable);
219 void UpdateHighlight();
222 // hide the two parameter Render() method from the user and the compiler.
223 virtual void Render(vtkRenderer *, vtkMapper *) {};
224 virtual void ShallowCopy(vtkProp *prop);
225 virtual void SetMapper(vtkMapper *);
226 static SMESH_Actor* New();
229 SMESH_Actor(const SMESH_Actor&);
230 void operator=(const SMESH_Actor&);
234 #endif //SMESH_ACTOR_H