Salome HOME
refs #416: to store the open state of object browser items in the binary array
[modules/gui.git] / src / SVTK / SALOME_Actor.h
index a8c9ac999134dd011d9694ad704b4e8de281cfac..57340054983f8e99877d5c141425a4da76af35e9 100644 (file)
@@ -1,30 +1,29 @@
-//  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2014  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
+// 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.
+// 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.
 //
-//  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.
+// 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
+// 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
+// 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 SALOME_ACTOR_H
 #define SALOME_ACTOR_H
 
@@ -39,18 +38,22 @@ class Handle(SALOME_InteractiveObject);
 #undef min
 #undef max
 
-#include "VTKViewer_Actor.h"
+#include <VTKViewer_Actor.h>
+#include <VTKViewer_MarkerDef.h>
 
 #include <vtkSmartPointer.h>
 
+class vtkAbstractPicker;
 class vtkPointPicker;
 class vtkCellPicker;
 class vtkOutlineSource;
 class vtkInteractorStyle;
 class vtkRenderWindowInteractor;
 
+class VTKViewer_FramedTextActor;
+
 class SVTK_Actor;
-class SVTK_RectPicker;
+class SVTK_AreaPicker;
 class SVTK_InteractorStyle;
 
 SVTK_EXPORT extern int SALOME_POINT_SIZE;
@@ -103,14 +106,14 @@ class SVTK_EXPORT SALOME_Actor : public VTKViewer_Actor
   //! Apply additional position
   virtual
   void
-  SetPosition(vtkFloatingPointType _arg1, 
-             vtkFloatingPointType _arg2, 
-             vtkFloatingPointType _arg3);
+  SetPosition(double _arg1, 
+              double _arg2, 
+              double _arg3);
 
   //! Apply additional position
   virtual
   void
-  SetPosition(vtkFloatingPointType _arg[3]);
+  SetPosition(double _arg[3]);
 
   //----------------------------------------------------------------------------
   //! Visibility management
@@ -118,6 +121,11 @@ class SVTK_EXPORT SALOME_Actor : public VTKViewer_Actor
   void
   SetVisibility( int );
 
+  //! Gets know whether the actor should be displayed or not
+  virtual
+  bool
+  ShouldBeDisplayed();
+
   //----------------------------------------------------------------------------
   //! To publish the actor an all its internal devices
   virtual
@@ -165,15 +173,72 @@ class SVTK_EXPORT SALOME_Actor : public VTKViewer_Actor
   virtual
   bool
   PreHighlight(vtkInteractorStyle* theInteractorStyle, 
-              SVTK_SelectionEvent* theSelectionEvent,
-              bool theIsHighlight);
+               SVTK_SelectionEvent* theSelectionEvent,
+               bool theIsHighlight);
 
   //! To process highlight (called from #SVTK_InteractorStyle)
   virtual 
   bool
   Highlight(vtkInteractorStyle* theInteractorStyle, 
-           SVTK_SelectionEvent* theSelectionEvent,
-           bool theIsHighlight);
+            SVTK_SelectionEvent* theSelectionEvent,
+            bool theIsHighlight);
+
+  //----------------------------------------------------------------------------
+  //! To get flag of displaying of name actor
+  virtual
+  bool
+  IsDisplayNameActor() const;
+
+  //! To set flag of displaying of name actor
+  virtual
+  void
+  SetIsDisplayNameActor(bool theIsDisplayNameActor);
+
+  //! To set text of name actor
+  virtual
+  void
+  SetNameActorText(const char* theText);
+
+  //! To set offset of name actor
+  virtual
+  void
+  SetNameActorOffset(int theOffset[2]);
+
+  //! To get size of name actor
+  virtual
+  void
+  GetNameActorSize(vtkRenderer* theRenderer, int theSize[2]) const;
+
+  //! To update visibility of name actors
+  virtual
+  void
+  UpdateNameActors();
+
+  //----------------------------------------------------------------------------
+  //! Set standard point marker
+  virtual
+  void
+  SetMarkerStd( VTK::MarkerType, VTK::MarkerScale );
+
+  //! Set custom point marker
+  virtual
+  void
+  SetMarkerTexture( int, VTK::MarkerTexture );
+
+  //! Get type of the point marker
+  virtual
+  VTK::MarkerType
+  GetMarkerType();
+
+  //! Get scale of the point marker
+  virtual
+  VTK::MarkerScale
+  GetMarkerScale();
+
+  //! Get texture identifier of the point marker
+  virtual
+  int
+  GetMarkerTexture();
 
   //----------------------------------------------------------------------------
   //! To set up a picker for nodal selection (initialized by #SVTK_Renderer::AddActor)
@@ -186,11 +251,15 @@ class SVTK_EXPORT SALOME_Actor : public VTKViewer_Actor
 
   //! To set up a picker for point rectangle selection (initialized by #SVTK_Renderer::AddActor)
   void
-  SetPointRectPicker(SVTK_RectPicker* theRectPicker);
+  SetPointAreaPicker(SVTK_AreaPicker* theAreaPicker);
 
   //! To set up a picker for cell rectangle selection (initialized by #SVTK_Renderer::AddActor)
   void
-  SetCellRectPicker(SVTK_RectPicker* theRectPicker);
+  SetCellAreaPicker(SVTK_AreaPicker* theAreaPicker);
+
+  //----------------------------------------------------------------------------
+  //! To find a gravity center of object
+  double* GetGravityCenter( int );
 
   //----------------------------------------------------------------------------
   //! To set up a prehighlight property (initialized by #SVTK_Renderer::AddActor)
@@ -220,16 +289,30 @@ class SVTK_EXPORT SALOME_Actor : public VTKViewer_Actor
   vtkSmartPointer<vtkPointPicker> myPointPicker;
   vtkSmartPointer<vtkCellPicker> myCellPicker;
 
-  vtkSmartPointer<SVTK_RectPicker> myPointRectPicker;
-  vtkSmartPointer<SVTK_RectPicker> myCellRectPicker;
+  vtkSmartPointer<SVTK_AreaPicker> myPointAreaPicker;
+  vtkSmartPointer<SVTK_AreaPicker> myCellAreaPicker;
 
   vtkSmartPointer<SVTK_Actor> myPreHighlightActor;
   vtkSmartPointer<SVTK_Actor> myHighlightActor;
 
   vtkSmartPointer<VTKViewer_Actor> myOutlineActor;
   vtkSmartPointer<vtkOutlineSource> myOutline;
+
+  bool myIsDisplayNameActor;
+  vtkSmartPointer<VTKViewer_FramedTextActor> myNameActor;
 };
 
+namespace SVTK
+{
+  class SVTK_EXPORT TPickLimiter
+  {
+    vtkAbstractPicker* myPicker;
+  public:
+    TPickLimiter(vtkAbstractPicker*, SALOME_Actor*);
+    ~TPickLimiter();
+  };
+}
+
 #ifdef WIN32
 #pragma warning ( default:4251 )
 #endif