Version: 8.3.0
SMESH_DeviceActor.h
Go to the documentation of this file.
1 // Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
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.
10 //
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.
15 //
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
19 //
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 
23 // SMESH OBJECT : interactive object for SMESH visualization
24 // File : SMESH_DeviceActor.h
25 // Author : Nicolas REJNERI
26 // Module : SMESH
27 // $Header$
28 //
29 #ifndef SMESH_DEVICE_ACTOR_H
30 #define SMESH_DEVICE_ACTOR_H
31 
32 #include <VTKViewer_GeometryFilter.h>
33 #include <VTKViewer_MarkerDef.h>
34 #include "SMESH_Controls.hxx"
35 #include "SMESH_Object.h"
36 
37 #include <vtkLODActor.h>
38 #include <vtkSmartPointer.h>
39 
40 class vtkCell;
41 class vtkProperty;
42 class vtkMergeFilter;
43 class vtkShrinkFilter;
45 class vtkLookupTable;
46 class vtkImplicitBoolean;
47 class vtkPassThroughFilter;
48 class vtkPlaneCollection;
49 
50 class VTKViewer_Transform;
51 class VTKViewer_TransformFilter;
52 class VTKViewer_ExtractUnstructuredGrid;
53 class VTKViewer_PolyDataMapper;
54 
58 
59 
61  friend class SMESH_ActorDef;
62 
63  public:
65  static SMESH_DeviceActor* New();
66 
67  void SetStoreClippingMapping(bool theStoreMapping);
68  void SetStoreGemetryMapping(bool theStoreMapping);
69  void SetStoreIDMapping(bool theStoreMapping);
70 
71  virtual int GetNodeObjId(int theVtkID);
72  virtual double* GetNodeCoord(int theObjID);
73 
74  virtual int GetElemObjId(int theVtkID);
75  virtual vtkCell* GetElemCell(int theObjID);
76 
77  virtual void SetTransform(VTKViewer_Transform* theTransform);
78  virtual vtkMTimeType GetMTime();
79 
80  virtual void SetFacesOriented(bool theIsFacesOriented);
81  virtual bool GetFacesOriented() { return myIsFacesOriented; }
82 
83  virtual void SetFacesOrientationColor(double r,double g,double b);
84  virtual void GetFacesOrientationColor(double& r,double& g,double& b);
85 
86  virtual void SetFacesOrientationScale(double theScale);
87  virtual double GetFacesOrientationScale();
88 
89  virtual void SetFacesOrientation3DVectors(bool theState);
90  virtual bool GetFacesOrientation3DVectors();
91 
92  //----------------------------------------------------------------------------
94  virtual void SetQuadraticArcMode(bool theFlag);
95  virtual bool GetQuadraticArcMode();
96 
97  virtual void SetQuadraticArcAngle(double theMaxAngle);
98  virtual double GetQuadraticArcAngle();
99 
100  void UpdateFaceOrientation();
101 
102  double GetShrinkFactor();
103  void SetShrinkFactor(double value);
104 
105  bool IsShrunkable() { return myIsShrinkable;}
106  bool IsShrunk() { return myIsShrunk;}
107  void SetShrink();
108  void UnShrink();
109 
110  enum EReperesent { ePoint, eWireframe, eSurface, eInsideframe};
111  EReperesent GetRepresentation(){ return myRepresentation;}
112  void SetRepresentation(EReperesent theMode);
113 
114  virtual void SetVisibility(int theMode);
115  virtual int GetVisibility();
116 
117  virtual void AddToRender(vtkRenderer* theRenderer);
118  virtual void RemoveFromRender(vtkRenderer* theRenderer);
119 
120  VTKViewer_ExtractUnstructuredGrid* GetExtractUnstructuredGrid();
122 
123  void SetPlaneCollection( vtkPlaneCollection* theCollection );
124 
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);
132 
133  bool IsHighlited() { return myIsHighlited;}
134  void SetHighlited(bool theIsHighlited);
135 
136  virtual
137  void
138  SetCoincident3DAllowed(bool theIsFeatureEdgesAllowed);
139 
140  virtual
141  bool
142  IsCoincident3DAllowed() const;
143 
144  virtual void Render(vtkRenderer *, vtkMapper *);
145 
146  void SetImplicitFunctionUsed(bool theIsImplicitFunctionUsed);
147  bool IsImplicitFunctionUsed() const{ return myIsImplicitFunctionUsed;}
148 
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();
158 
159  protected:
160  void Init(TVisualObjPtr theVisualObj, vtkImplicitBoolean* theImplicitBoolean);
161  void SetUnstructuredGrid(vtkUnstructuredGrid* theGrid);
162 
163  VTKViewer_PolyDataMapper *myMapper;
165 
167 
168  vtkProperty *myProperty;
170 
173 
174  vtkMergeFilter* myMergeFilter;
175  VTKViewer_ExtractUnstructuredGrid* myExtractUnstructuredGrid;
176 
179  vtkPolyDataMapper* myFaceOrientationDataMapper;
180  vtkActor* myFaceOrientation;
181 
183  VTKViewer_GeometryFilter *myGeomFilter;
184  VTKViewer_TransformFilter *myTransformFilter;
185  std::vector<vtkPassThroughFilter*> myPassFilter;
186 
187  vtkShrinkFilter* myShrinkFilter;
190 
192 
195 
196  void
197  SetPolygonOffsetParameters(double factor,
198  double units);
199 
200  void
201  GetPolygonOffsetParameters(double& factor,
202  double& units)
203  {
204  factor = myPolygonOffsetFactor;
205  units = myPolygonOffsetUnits;
206  }
207 
211  void operator=(const SMESH_DeviceActor&);
212 
213 };
214 
215 
216 #endif //SMESH_DEVICE_ACTOR_H