1 // Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 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, or (at your option) any later version.
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.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 // SMESH OBJECT : interactive object for SMESH visualization
24 // File : SMESH_DeviceActor.h
25 // Author : Nicolas REJNERI
29 #ifndef SMESH_DEVICE_ACTOR_H
30 #define SMESH_DEVICE_ACTOR_H
32 #include <VTKViewer_GeometryFilter.h>
33 #include <VTKViewer_MarkerDef.h>
34 #include "SMESH_Controls.hxx"
35 #include "SMESH_Object.h"
37 #include <vtkLODActor.h>
38 #include <vtkSmartPointer.h>
43 class vtkShrinkFilter;
44 class vtkUnstructuredGrid;
46 class vtkImplicitBoolean;
47 class vtkPassThroughFilter;
48 class vtkPlaneCollection;
50 class VTKViewer_Transform;
51 class VTKViewer_TransformFilter;
52 class VTKViewer_ExtractUnstructuredGrid;
53 class VTKViewer_PolyDataMapper;
55 class SMESH_ExtractGeometry;
56 class SMESH_FaceOrientationFilter;
57 class SMESH_ScalarBarActor;
60 class SMESHOBJECT_EXPORT SMESH_DeviceActor: public vtkLODActor{
61 friend class SMESH_ActorDef;
64 vtkTypeMacro(SMESH_DeviceActor,vtkLODActor);
65 static SMESH_DeviceActor* New();
67 void SetStoreClippingMapping(bool theStoreMapping);
68 void SetStoreGemetryMapping(bool theStoreMapping);
69 void SetStoreIDMapping(bool theStoreMapping);
71 virtual int GetNodeObjId(int theVtkID);
72 virtual double* GetNodeCoord(int theObjID);
74 virtual int GetElemObjId(int theVtkID);
75 virtual vtkCell* GetElemCell(int theObjID);
77 virtual void SetTransform(VTKViewer_Transform* theTransform);
78 virtual unsigned long int GetMTime();
80 virtual void SetFacesOriented(bool theIsFacesOriented);
81 virtual bool GetFacesOriented() { return myIsFacesOriented; }
83 virtual void SetFacesOrientationColor(double r,double g,double b);
84 virtual void GetFacesOrientationColor(double& r,double& g,double& b);
86 virtual void SetFacesOrientationScale(double theScale);
87 virtual double GetFacesOrientationScale();
89 virtual void SetFacesOrientation3DVectors(bool theState);
90 virtual bool GetFacesOrientation3DVectors();
92 //----------------------------------------------------------------------------
93 //! Setting for displaying quadratic elements
94 virtual void SetQuadraticArcMode(bool theFlag);
95 virtual bool GetQuadraticArcMode();
97 virtual void SetQuadraticArcAngle(double theMaxAngle);
98 virtual double GetQuadraticArcAngle();
100 void UpdateFaceOrientation();
102 double GetShrinkFactor();
103 void SetShrinkFactor(double value);
105 bool IsShrunkable() { return myIsShrinkable;}
106 bool IsShrunk() { return myIsShrunk;}
110 enum EReperesent { ePoint, eWireframe, eSurface, eInsideframe};
111 EReperesent GetRepresentation(){ return myRepresentation;}
112 void SetRepresentation(EReperesent theMode);
114 virtual void SetVisibility(int theMode);
115 virtual int GetVisibility();
117 virtual void AddToRender(vtkRenderer* theRenderer);
118 virtual void RemoveFromRender(vtkRenderer* theRenderer);
120 VTKViewer_ExtractUnstructuredGrid* GetExtractUnstructuredGrid();
121 vtkUnstructuredGrid* GetUnstructuredGrid();
123 void SetPlaneCollection( vtkPlaneCollection* theCollection );
125 void SetControlMode(SMESH::Controls::FunctorPtr theFunctor,
126 SMESH_ScalarBarActor* theScalarBarActor,
127 vtkLookupTable* theLookupTable);
128 void SetExtControlMode(SMESH::Controls::FunctorPtr theFunctor,
129 SMESH_ScalarBarActor* theScalarBarActor,
130 vtkLookupTable* theLookupTable);
131 void SetExtControlMode(SMESH::Controls::FunctorPtr theFunctor);
133 bool IsHighlited() { return myIsHighlited;}
134 void SetHighlited(bool theIsHighlited);
138 SetCoincident3DAllowed(bool theIsFeatureEdgesAllowed);
142 IsCoincident3DAllowed() const;
144 virtual void Render(vtkRenderer *, vtkMapper *);
146 void SetImplicitFunctionUsed(bool theIsImplicitFunctionUsed);
147 bool IsImplicitFunctionUsed() const{ return myIsImplicitFunctionUsed;}
149 void SetMarkerEnabled( bool );
150 void SetBallEnabled( bool );
151 void SetBallScale( double );
152 void SetMarkerStd( VTK::MarkerType, VTK::MarkerScale );
153 void SetMarkerTexture( int, VTK::MarkerTexture );
154 VTK::MarkerType GetMarkerType();
155 VTK::MarkerScale GetMarkerScale();
156 int GetMarkerTexture();
157 double GetBallScale();
160 void Init(TVisualObjPtr theVisualObj, vtkImplicitBoolean* theImplicitBoolean);
161 void SetUnstructuredGrid(vtkUnstructuredGrid* theGrid);
163 VTKViewer_PolyDataMapper *myMapper;
164 TVisualObjPtr myVisualObj;
166 vtkSmartPointer<vtkPlaneCollection> myPlaneCollection;
168 vtkProperty *myProperty;
169 EReperesent myRepresentation;
171 SMESH_ExtractGeometry* myExtractGeometry;
172 bool myIsImplicitFunctionUsed;
174 vtkMergeFilter* myMergeFilter;
175 VTKViewer_ExtractUnstructuredGrid* myExtractUnstructuredGrid;
177 bool myIsFacesOriented;
178 SMESH_FaceOrientationFilter* myFaceOrientationFilter;
179 vtkPolyDataMapper* myFaceOrientationDataMapper;
180 vtkActor* myFaceOrientation;
182 bool myStoreClippingMapping;
183 VTKViewer_GeometryFilter *myGeomFilter;
184 VTKViewer_TransformFilter *myTransformFilter;
185 std::vector<vtkPassThroughFilter*> myPassFilter;
187 vtkShrinkFilter* myShrinkFilter;
193 double myPolygonOffsetFactor;
194 double myPolygonOffsetUnits;
197 SetPolygonOffsetParameters(double factor,
201 GetPolygonOffsetParameters(double& factor,
204 factor = myPolygonOffsetFactor;
205 units = myPolygonOffsetUnits;
209 ~SMESH_DeviceActor();
210 SMESH_DeviceActor(const SMESH_DeviceActor&);
211 void operator=(const SMESH_DeviceActor&);
216 #endif //SMESH_DEVICE_ACTOR_H