Back to index

salome-smesh  6.5.0
SMESH_DeviceActor.h
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
00004 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
00005 //
00006 // This library is free software; you can redistribute it and/or
00007 // modify it under the terms of the GNU Lesser General Public
00008 // License as published by the Free Software Foundation; either
00009 // version 2.1 of the License.
00010 //
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 // Lesser General Public License for more details.
00015 //
00016 // You should have received a copy of the GNU Lesser General Public
00017 // License along with this library; if not, write to the Free Software
00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00019 //
00020 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00021 //
00022 
00023 //  SMESH OBJECT : interactive object for SMESH visualization
00024 //  File   : SMESH_DeviceActor.h
00025 //  Author : Nicolas REJNERI
00026 //  Module : SMESH
00027 //  $Header: /home/server/cvs/SMESH/SMESH_SRC/src/OBJECT/SMESH_DeviceActor.h,v 1.12.2.3.4.4.2.1 2012-04-13 09:31:05 vsr Exp $
00028 //
00029 #ifndef SMESH_DEVICE_ACTOR_H
00030 #define SMESH_DEVICE_ACTOR_H
00031 
00032 #include <VTKViewer_GeometryFilter.h>
00033 #include <VTKViewer_MarkerDef.h>
00034 #include "SMESH_Controls.hxx"
00035 #include "SMESH_Object.h"
00036 
00037 #include <vtkLODActor.h>
00038 #include <vtkSmartPointer.h>
00039 
00040 class vtkCell;
00041 class vtkProperty;
00042 class vtkMergeFilter;
00043 class vtkShrinkFilter;
00044 class vtkUnstructuredGrid;
00045 class vtkLookupTable;
00046 class vtkImplicitBoolean;
00047 class vtkPassThroughFilter;
00048 
00049 class VTKViewer_Transform;
00050 class VTKViewer_TransformFilter;
00051 class VTKViewer_ExtractUnstructuredGrid;
00052 class VTKViewer_PolyDataMapper;
00053 
00054 class SMESH_ExtractGeometry;
00055 class SMESH_FaceOrientationFilter;
00056 class SMESH_ScalarBarActor;
00057 
00058 
00059 class SMESHOBJECT_EXPORT SMESH_DeviceActor: public vtkLODActor{
00060   friend class SMESH_ActorDef;
00061 
00062  public:
00063   vtkTypeMacro(SMESH_DeviceActor,vtkLODActor);
00064   static SMESH_DeviceActor* New();
00065 
00066   void SetStoreClippingMapping(bool theStoreMapping);
00067   void SetStoreGemetryMapping(bool theStoreMapping);
00068   void SetStoreIDMapping(bool theStoreMapping);
00069 
00070   virtual int GetNodeObjId(int theVtkID);
00071   virtual vtkFloatingPointType* GetNodeCoord(int theObjID);
00072 
00073   virtual int GetElemObjId(int theVtkID);
00074   virtual vtkCell* GetElemCell(int theObjID);
00075 
00076   virtual void SetTransform(VTKViewer_Transform* theTransform); 
00077   virtual unsigned long int GetMTime();
00078 
00079   virtual void SetFacesOriented(bool theIsFacesOriented);
00080   virtual bool GetFacesOriented() { return myIsFacesOriented; }
00081 
00082   virtual void SetFacesOrientationColor(vtkFloatingPointType theColor[3]);
00083   virtual void GetFacesOrientationColor(vtkFloatingPointType theColor[3]);
00084 
00085   virtual void SetFacesOrientationScale(vtkFloatingPointType theScale);
00086   virtual vtkFloatingPointType GetFacesOrientationScale();
00087 
00088   virtual void SetFacesOrientation3DVectors(bool theState);
00089   virtual bool GetFacesOrientation3DVectors();
00090 
00091   //----------------------------------------------------------------------------
00093   virtual void SetQuadraticArcMode(bool theFlag);
00094   virtual bool GetQuadraticArcMode();
00095   
00096   virtual void SetQuadraticArcAngle(vtkFloatingPointType theMaxAngle);
00097   virtual vtkFloatingPointType GetQuadraticArcAngle();
00098   
00099   void UpdateFaceOrientation();
00100 
00101   vtkFloatingPointType GetShrinkFactor();
00102   void  SetShrinkFactor(vtkFloatingPointType value);
00103 
00104   bool IsShrunkable() { return myIsShrinkable;}
00105   bool IsShrunk() { return myIsShrunk;}
00106   void SetShrink(); 
00107   void UnShrink(); 
00108 
00109   enum EReperesent { ePoint, eWireframe, eSurface, eInsideframe};
00110   EReperesent GetRepresentation(){ return myRepresentation;}
00111   void SetRepresentation(EReperesent theMode);
00112 
00113   virtual void SetVisibility(int theMode);
00114   virtual int GetVisibility();
00115 
00116   virtual void AddToRender(vtkRenderer* theRenderer); 
00117   virtual void RemoveFromRender(vtkRenderer* theRenderer);
00118 
00119   VTKViewer_ExtractUnstructuredGrid* GetExtractUnstructuredGrid();
00120   vtkUnstructuredGrid* GetUnstructuredGrid();
00121 
00122   void SetControlMode(SMESH::Controls::FunctorPtr theFunctor,
00123                       SMESH_ScalarBarActor* theScalarBarActor,
00124                       vtkLookupTable* theLookupTable);
00125   void SetExtControlMode(SMESH::Controls::FunctorPtr theFunctor,
00126                          SMESH_ScalarBarActor* theScalarBarActor,
00127                          vtkLookupTable* theLookupTable);
00128   void SetExtControlMode(SMESH::Controls::FunctorPtr theFunctor);
00129 
00130   bool IsHighlited() { return myIsHighlited;}
00131   void SetHighlited(bool theIsHighlited);
00132 
00133   virtual
00134   void
00135   SetCoincident3DAllowed(bool theIsFeatureEdgesAllowed);
00136 
00137   virtual
00138   bool 
00139   IsCoincident3DAllowed() const;
00140 
00141   virtual void Render(vtkRenderer *, vtkMapper *);
00142 
00143   void SetImplicitFunctionUsed(bool theIsImplicitFunctionUsed);
00144   bool IsImplicitFunctionUsed() const{ return myIsImplicitFunctionUsed;}
00145 
00146   void SetMarkerEnabled( bool );
00147   void SetMarkerStd( VTK::MarkerType, VTK::MarkerScale );
00148   void SetMarkerTexture( int, VTK::MarkerTexture );
00149   VTK::MarkerType GetMarkerType();
00150   VTK::MarkerScale GetMarkerScale();
00151   int GetMarkerTexture();
00152 
00153  protected:
00154   void Init(TVisualObjPtr theVisualObj, vtkImplicitBoolean* theImplicitBoolean);
00155   void SetUnstructuredGrid(vtkUnstructuredGrid* theGrid);
00156 
00157   VTKViewer_PolyDataMapper *myMapper;
00158   TVisualObjPtr myVisualObj;
00159 
00160   vtkProperty *myProperty;
00161   EReperesent myRepresentation;
00162 
00163   SMESH_ExtractGeometry* myExtractGeometry;
00164   bool myIsImplicitFunctionUsed;
00165 
00166   vtkMergeFilter* myMergeFilter;
00167   VTKViewer_ExtractUnstructuredGrid* myExtractUnstructuredGrid;
00168 
00169   bool myIsFacesOriented;
00170   SMESH_FaceOrientationFilter* myFaceOrientationFilter;
00171   vtkPolyDataMapper* myFaceOrientationDataMapper;
00172   vtkActor* myFaceOrientation;
00173 
00174   bool myStoreClippingMapping;
00175   VTKViewer_GeometryFilter *myGeomFilter;
00176   VTKViewer_TransformFilter *myTransformFilter;
00177   std::vector<vtkPassThroughFilter*> myPassFilter;
00178 
00179   vtkShrinkFilter* myShrinkFilter;
00180   bool myIsShrinkable;
00181   bool myIsShrunk;
00182   
00183   bool myIsHighlited;
00184 
00185   vtkFloatingPointType myPolygonOffsetFactor;
00186   vtkFloatingPointType myPolygonOffsetUnits;
00187 
00188   void
00189   SetPolygonOffsetParameters(vtkFloatingPointType factor, 
00190                              vtkFloatingPointType units);
00191 
00192   void
00193   GetPolygonOffsetParameters(vtkFloatingPointType& factor, 
00194                              vtkFloatingPointType& units)
00195   {
00196     factor = myPolygonOffsetFactor;
00197     units = myPolygonOffsetUnits;
00198   }
00199 
00200   SMESH_DeviceActor();
00201   ~SMESH_DeviceActor();
00202   SMESH_DeviceActor(const SMESH_DeviceActor&);
00203   void operator=(const SMESH_DeviceActor&);
00204 
00205 };
00206 
00207 
00208 #endif //SMESH_DEVICE_ACTOR_H