Salome HOME
Merge branch 'V8_3_asterstudy' into V8_3_BR
[modules/gui.git] / src / VTKViewer / VTKViewer_Actor.h
index 55711a8c018def10181c0c416ac865daa96ca9e2..e09c1e3e5184d211c428b4e3036aef5aeac3ce2e 100755 (executable)
@@ -1,30 +1,28 @@
-//  SALOME OBJECT : implementation of interactive object visualization for OCC and VTK viewers
+// Copyright (C) 2007-2016  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
 //
-//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
-// 
-//  This library is free software; you can redistribute it and/or 
-//  modify it under the terms of the GNU Lesser General Public 
-//  License as published by the Free Software Foundation; either 
-//  version 2.1 of the License. 
-// 
-//  This library is distributed in the hope that it will be useful, 
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
-//  Lesser General Public License for more details. 
-// 
-//  You should have received a copy of the GNU Lesser General Public 
-//  License along with this library; if not, write to the Free Software 
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
-// 
-//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
 //
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
+
+//  SALOME OBJECT : implementation of interactive object visualization for OCC and VTK viewers
 //  File   : SALOME_Actor.h
 //  Author : Nicolas REJNERI
-//  Module : SALOME
-//  $Header$
 
 #ifndef VTKVIEVER_ACTOR_H
 #define VTKVIEVER_ACTOR_H
@@ -35,6 +33,7 @@
 #include <vector>
 
 #include <vtkLODActor.h>
+#include <vtkProperty.h>
 
 class vtkCell;
 class vtkPointPicker;
@@ -43,15 +42,32 @@ class vtkDataSet;
 class vtkCamera;
 class vtkProperty;
 class vtkRenderer;
+class vtkPassThroughFilter;
 
 class VTKViewer_Transform;
 class VTKViewer_GeometryFilter;
 class VTKViewer_TransformFilter;
-class VTKViewer_PassThroughFilter;
 
 extern int VTKViewer_POINT_SIZE;
 extern int VTKViewer_LINE_WIDTH;
 
+namespace VTKViewer
+{
+  namespace Representation
+  {
+    typedef int Type;
+    const Type Points = VTK_POINTS;
+    const Type Wireframe = VTK_WIREFRAME;
+    const Type Surface = VTK_SURFACE;
+    const Type Insideframe = Surface + 1;
+    const Type SurfaceWithEdges = Insideframe + 1;
+  }
+}
+
+#ifdef WIN32
+#pragma warning ( disable:4251 )
+#endif
+
 /*! \class vtkLODActor
  * \brief For more information see <a href="http://www.vtk.org/">VTK documentation</a>
  */
@@ -77,27 +93,46 @@ class VTKVIEWER_EXPORT VTKViewer_Actor : public vtkLODActor
   //! Change opacity
   virtual
   void
-  SetOpacity(float theOpacity);
+  SetOpacity(double theOpacity);
 
   //! Get current opacity
   virtual
-  float 
+  double 
   GetOpacity();
 
   //! Change color
   virtual
   void
-  SetColor(float r,float g,float b);
+  SetColor(double r,
+           double g,
+           double b);
 
   //! Get current color
   virtual
   void
-  GetColor(float& r,float& g,float& b);
+  GetColor(double& r,
+           double& g,
+           double& b);
 
   //! Change color
   virtual
   void
-  SetColor(const float theRGB[3]);
+  SetColor(const double theRGB[3]);
+
+  //! Change material\r
+  virtual\r
+  void\r
+  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
+  GetBackMaterial();
 
   //----------------------------------------------------------------------------
   // For selection mapping purpose
@@ -108,7 +143,7 @@ class VTKVIEWER_EXPORT VTKViewer_Actor : public vtkLODActor
 
   //! Get coordinates of a node for given object index
   virtual
-  float*
+  double*
   GetNodeCoord(int theObjID);
 
   //! Maps VTK index of a cell to corresponding object index
@@ -144,7 +179,7 @@ class VTKVIEWER_EXPORT VTKViewer_Actor : public vtkLODActor
 
   //! To calculatate last modified time
   virtual
-  unsigned long int
+  vtkMTimeType
   GetMTime();
 
   //----------------------------------------------------------------------------
@@ -184,12 +219,12 @@ class VTKVIEWER_EXPORT VTKViewer_Actor : public vtkLODActor
     
   //! To calcualte current bounding box
   virtual
-  float
+  double
   GetBounds();
 
   //! To calcualte current bounding box
   void
-  GetBounds(float bounds[6]);
+  GetBounds(double bounds[6]);
 
   //----------------------------------------------------------------------------
   virtual
@@ -202,7 +237,7 @@ class VTKVIEWER_EXPORT VTKViewer_Actor : public vtkLODActor
 
   virtual
   void
-  SetSize( const float );
+  SetSize( const double );
 
   virtual
   void 
@@ -215,11 +250,13 @@ class VTKVIEWER_EXPORT VTKViewer_Actor : public vtkLODActor
 
   //! Set ResolveCoincidentTopology parameters
   void
-  SetPolygonOffsetParameters(float factor, float units);
+  SetPolygonOffsetParameters(double factor, 
+                             double units);
 
   //! Get current ResolveCoincidentTopology parameters
   void
-  GetPolygonOffsetParameters(float& factor, float& units);
+  GetPolygonOffsetParameters(double& factor, 
+                             double& units);
 
   virtual
   void
@@ -228,7 +265,7 @@ class VTKVIEWER_EXPORT VTKViewer_Actor : public vtkLODActor
   //----------------------------------------------------------------------------
   //! Get current shrink factor
   virtual
-  float
+  double
   GetShrinkFactor();
 
   //! Is the actor is shrunkable
@@ -268,6 +305,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
@@ -278,6 +320,11 @@ class VTKVIEWER_EXPORT VTKViewer_Actor : public vtkLODActor
   bool
   isHighlighted();
 
+  //! Ask, if the VTKViewer_Actor is already preselected
+  virtual
+  bool
+  isPreselected();
+
   //! Set preselection mode
   virtual
   void
@@ -292,22 +339,34 @@ class VTKVIEWER_EXPORT VTKViewer_Actor : public vtkLODActor
   void
   SetPreviewProperty(vtkProperty* theProperty);
 
+  //----------------------------------------------------------------------------
+  //! Setting for displaying quadratic elements
+  virtual void SetQuadraticArcMode(bool theFlag);
+  virtual bool GetQuadraticArcMode() const;
+
+  virtual void   SetQuadraticArcAngle(double theMaxAngle);
+  virtual double GetQuadraticArcAngle() const;
+
+  //----------------------------------------------------------------------------
+  //! Return pointer to the dataset, which used to calculation of the bounding box of the actor
+  virtual vtkDataSet* GetHighlightedDataSet();
+
  protected:
   //----------------------------------------------------------------------------
   bool myIsResolveCoincidentTopology;
-  float myPolygonOffsetFactor;
-  float myPolygonOffsetUnits;
+  double myPolygonOffsetFactor;
+  double myPolygonOffsetUnits;
 
   std::string myName;
 
-  float myOpacity;
+  double myOpacity;
   int myDisplayMode;
   bool myIsInfinite;
 
   bool myStoreMapping;
   VTKViewer_GeometryFilter *myGeomFilter;
   VTKViewer_TransformFilter *myTransformFilter;
-  std::vector<VTKViewer_PassThroughFilter*> myPassFilter;
+  std::vector<vtkPassThroughFilter*> myPassFilter;
 
   int myRepresentation;
   vtkProperty *myProperty;
@@ -324,4 +383,8 @@ class VTKVIEWER_EXPORT VTKViewer_Actor : public vtkLODActor
   bool myIsHighlighted;
 };
 
+#ifdef WIN32
+#pragma warning ( default:4251 )
+#endif
+
 #endif // VTKVIEVER_ACTOR_H