Salome HOME
Second integration of PV3D viewer:
[modules/gui.git] / src / VTKViewer / VTKViewer_Actor.h
old mode 100755 (executable)
new mode 100644 (file)
index edd3bcf..aa948f9
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2014  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2024  CEA, EDF, OPEN CASCADE
 //
 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
 
 #include <string>
 #include <vector>
+#include <limits>
+
+#include <NCollection_IndexedMap.hxx>
+#include <NCollection_Map.hxx>
 
 #include <vtkLODActor.h>
 #include <vtkProperty.h>
@@ -42,7 +46,7 @@ class vtkDataSet;
 class vtkCamera;
 class vtkProperty;
 class vtkRenderer;
-class vtkPassThroughFilter;
+class vtkPassThrough;
 
 class VTKViewer_Transform;
 class VTKViewer_GeometryFilter;
@@ -76,7 +80,7 @@ class VTKVIEWER_EXPORT VTKViewer_Actor : public vtkLODActor
  public:
   static VTKViewer_Actor* New();
   
-  vtkTypeMacro(VTKViewer_Actor,vtkLODActor);
+  vtkTypeMacro(VTKViewer_Actor,vtkLODActor)
 
   //----------------------------------------------------------------------------
   //! Get its name
@@ -119,48 +123,53 @@ class VTKVIEWER_EXPORT VTKViewer_Actor : public vtkLODActor
   void
   SetColor(const double theRGB[3]);
 
-  //! Change material\r
-  virtual\r
-  void\r
+  //! Change material
+  virtual
+  void
   SetMaterial(std::vector<vtkProperty*> theProps);
 
-  //! Get current front material\r
-  virtual\r
-  vtkProperty* \r
-  GetFrontMaterial();\r
-\r
-  //! Get current back material\r
-  virtual\r
-  vtkProperty* \r
+  //! Get current front material
+  virtual
+  vtkProperty* 
+  GetFrontMaterial();
+
+  //! Get current back material
+  virtual
+  vtkProperty* 
   GetBackMaterial();
 
   //----------------------------------------------------------------------------
   // For selection mapping purpose
   //! Maps VTK index of a node to corresponding object index
   virtual
-  int 
-  GetNodeObjId(int theVtkID);
+  vtkIdType 
+  GetNodeObjId(vtkIdType theVtkID);
 
   //! Get coordinates of a node for given object index
   virtual
   double*
-  GetNodeCoord(int theObjID);
+  GetNodeCoord(vtkIdType theObjID);
+
+  //! Maps object index of a node to corresponding VTK index
+  virtual
+  vtkIdType 
+  GetNodeVtkId(vtkIdType theObjID);
 
   //! Maps VTK index of a cell to corresponding object index
   virtual 
-  int
-  GetElemObjId(int theVtkID);
+  vtkIdType
+  GetElemObjId(vtkIdType theVtkID);
 
   //! Get corresponding #vtkCell for given object index
   virtual
   vtkCell* 
-  GetElemCell(int theObjID);
+  GetElemCell(vtkIdType theObjID);
 
   //----------------------------------------------------------------------------
   //! Get dimension of corresponding mesh element
   virtual
   int
-  GetObjDimension( const int theObjId );
+  GetObjDimension( const vtkIdType theObjId );
 
   //! To insert some additional filters and then sets the given #vtkMapper
   virtual
@@ -179,7 +188,7 @@ class VTKVIEWER_EXPORT VTKViewer_Actor : public vtkLODActor
 
   //! To calculatate last modified time
   virtual
-  unsigned long int
+  vtkMTimeType
   GetMTime();
 
   //----------------------------------------------------------------------------
@@ -257,6 +266,12 @@ class VTKVIEWER_EXPORT VTKViewer_Actor : public vtkLODActor
   void
   GetPolygonOffsetParameters(double& factor, 
                              double& units);
+  
+  //! Get default ResolveCoincidentTopology parameters
+  static 
+  void
+  GetDefaultPolygonOffsetParameters(double& factor, 
+                                   double& units);
 
   virtual
   void
@@ -305,6 +320,11 @@ class VTKVIEWER_EXPORT VTKViewer_Actor : public vtkLODActor
   GetChildActors(vtkActorCollection*);
 
   //----------------------------------------------------------------------------
+  //! Is notified on enabling/disabling selection
+  virtual
+  void
+  EnableSelection( bool /*enable*/ ) {}
+
   //! Ask, if the descendant of the VTKViewer_Actor will implement its own highlight or not
   virtual
   bool
@@ -361,7 +381,7 @@ class VTKVIEWER_EXPORT VTKViewer_Actor : public vtkLODActor
   bool myStoreMapping;
   VTKViewer_GeometryFilter *myGeomFilter;
   VTKViewer_TransformFilter *myTransformFilter;
-  std::vector<vtkPassThroughFilter*> myPassFilter;
+  std::vector<vtkPassThrough*> myPassFilter;
 
   int myRepresentation;
   vtkProperty *myProperty;
@@ -378,6 +398,22 @@ class VTKVIEWER_EXPORT VTKViewer_Actor : public vtkLODActor
   bool myIsHighlighted;
 };
 
+struct vtkIdHasher
+{
+  static int HashCode(const vtkIdType theValue,  const int theUpperBound)
+  {
+    return static_cast<int> ((theValue & (std::numeric_limits<vtkIdType>::max)()) % theUpperBound + 1);
+  }
+
+  static bool IsEqual( const vtkIdType& id1, const vtkIdType& id2 )
+  {
+    return id1 == id2;
+  }
+};
+
+typedef NCollection_Map< vtkIdType, vtkIdHasher > TVtkIDsMap;
+typedef NCollection_IndexedMap<vtkIdType,vtkIdHasher> TIndexedMapOfVtkId;
+
 #ifdef WIN32
 #pragma warning ( default:4251 )
 #endif