Salome HOME
Join modifications from branch OCC_development_for_3_2_0a2
[modules/visu.git] / src / OBJECT / VISU_Actor.h
index 437bb776860d71ba8549fa39a7d09e77d02a46e0..09d4d4bbc41f22280a2bb6f759736e5f950e9de6 100644 (file)
-//  File      : VISU_Actor.h
-//  Created   : Wed Feb 20 18:04:42 CET 2002
-//  Author    : Laurent CORNABE with the help of Nicolas REJNERI
-//  Project   : SALOME
-//  Module    : VISU
-//  Copyright : PRINCIPIA RD
+//  VISU OBJECT : interactive object for VISU entities implementation
+//
+//  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 
+//
+//
+//
+//  File   : 
+//  Author : 
+//  Module : VISU
 //  $Header$
 
-
 #ifndef VISU_ACTOR_H
 #define VISU_ACTOR_H
 
 #include "SALOME_Actor.h"
+#include "VISU_ActorFactory.h"
+#include "VISU_BoostSignals.h"
 
 #include <string>
-// VTK Includes
-#include <vtkActor.h>
-#include <vtkPolyDataMapper.h>
-#include <vtkPolyData.h>
-#include <vtkPolyDataNormals.h>
-#include <vtkProperty.h>
+#include <vtkSmartPointer.h>
+
+class vtkProp;
+class vtkProperty;
+class vtkDataSetMapper;
+class vtkTextMapper;
+class vtkTextActor;
+class vtkInteractorStyle;
+class VTKViewer_ShrinkFilter;
+class VISU_PipeLine;
 
 #ifdef _WIN_32
 #define VTKOCC_EXPORT __declspec (dllexport)
 #else
-#define VTKOCC_EXPORT
+#define VTKOCC_EXPORT VTK_EXPORT
 #endif
 
-#define VisuActorType_Mesh 1
-#define VisuActorType_BoundingBox 2
-#define VisuActorType_DeformedShape 3
-#define VisuActorType_Vectors 4
-#define VisuActorType_ScalarMap 5
-#define VisuActorType_IsoSurfaces 6
-#define VisuActorType_CutPlanes 7
-#define VisuActorType_Plot2D 8
-#define VisuActorType_StreamLines 9
-
-
-
-namespace VISU { 
+namespace VISU 
+{
   class Prs3d_i;
 }
 
-class VISU_ScalarBarActor;
-
-class VTKOCC_EXPORT VISU_Actor : public SALOME_Actor {
-  friend class VISU::Prs3d_i;
+//----------------------------------------------------------------------------
+class VTKOCC_EXPORT VISU_Actor : 
+  public SALOME_Actor,
+  public boost::signalslib::trackable
+{
  public:
   vtkTypeMacro(VISU_Actor,SALOME_Actor);
 
-  Standard_Boolean IsHighlighting;
-
-  static VISU_Actor* New();
-
-  void setActor(vtkActor *Actor);
-
-  void ShallowCopy(vtkProp *prop);
-
-  void highlight(Standard_Boolean highlight);
-  Standard_Boolean isHighlighted() { return true; };
-
-  void  SetOpacity(float opa) {};
-  float GetOpacity() 
-    { return 0;};
-
-  Standard_Boolean HasScalarBar()
-    { return myHasScalarBar; }
-
-  void setScalarBar(VISU_ScalarBarActor* theBar);
-  VISU_ScalarBarActor* getScalarBar()
-    { return myScalarBar; }
-
-
-  void setIO(const Handle(SALOME_InteractiveObject)& io) 
-    { SALOME_Actor::setIO(io); myName = io->getName(); }
-    
-
-  VISU::Prs3d_i* getPrs3d() { return Presentation; }
-  void setPrs3d(VISU::Prs3d_i* thePrs) { Presentation = thePrs; }
-    
-  vtkDataSet *DataSource;
-  vtkActor*   EdgeDevice;
-
-  Standard_Boolean IsShrinkable;
-  Standard_Boolean IsShrunk;
-  int VisuActorType;
-  Standard_Boolean ResultAtNode;
-  int VectorComponent;
-  char FieldName[40];
-
-  Standard_Boolean IsDefined;
-
-  float VABounds[6];
-  void setVABounds(const float bounds[6]);
-  void getVABounds(float bounds[6]);
-
-  ~VISU_Actor();
+  static 
+  VISU_Actor* 
+  New();
+
+  void
+  ShallowCopy(vtkProp *prop);
+
+  virtual
+  void
+  ShallowCopyPL(VISU_PipeLine* thePipeLine);
+
+  //----------------------------------------------------------------------------
+  virtual
+  void
+  setIO(const Handle(SALOME_InteractiveObject)& theIO);
+
+  //----------------------------------------------------------------------------
+  VISU::Prs3d_i* 
+  GetPrs3d();
+
+  virtual
+  void
+  SetPrs3d(VISU::Prs3d_i* thePrs3d);
+
+  //----------------------------------------------------------------------------
+  VISU::TActorFactory* 
+  GetFactory();
+
+  virtual
+  void
+  SetFactory(VISU::TActorFactory* theActorFactory);
+
+  //----------------------------------------------------------------------------
+  virtual
+  void
+  UpdateFromFactory();
+
+  virtual
+  void
+  RemoveFromRender();
+
+  //----------------------------------------------------------------------------
+  virtual
+  VISU_PipeLine* 
+  GetPipeLine();
+
+  virtual 
+  void
+  SetPipeLine(VISU_PipeLine* thePipeLine);
+
+  //----------------------------------------------------------------------------
+  virtual
+  void
+  SetRepresentation(int theMode);
+
+  //----------------------------------------------------------------------------
+  virtual
+  bool
+  IsShrunkable();
+
+  virtual
+  bool
+  IsShrunk();
+
+  virtual
+  void
+  SetShrink();
+
+  virtual
+  void
+  UnShrink(); 
+
+  virtual
+  void
+  SetShrinkable(bool theIsShrinkable);
+
+  virtual
+  void
+  SetShrinkFactor(float theFactor = 0.8); 
+
+  virtual
+  float
+  GetShrinkFactor();
+
+  //----------------------------------------------------------------------------
+  virtual
+  void
+  SetOpacity(float theValue);
+
+  virtual
+  float
+  GetOpacity();
+
+  virtual
+  void
+  SetLineWidth(float theLineWidth);
+
+  virtual
+  float
+  GetLineWidth();
+  //----------------------------------------------------------------------------
+  virtual
+  void
+  AddToRender( vtkRenderer* ); 
+
+  virtual
+  void
+  RemoveFromRender( vtkRenderer* );
+
+  //----------------------------------------------------------------------------
+  virtual
+  bool
+  PreHighlight(vtkInteractorStyle* theInteractorStyle, 
+              SVTK_SelectionEvent* theSelectionEvent,
+              bool theIsHighlight);
+
+  virtual
+  void 
+  SetVTKMapping(bool theIsVTKMapping); 
+
+  virtual
+  bool 
+  IsVTKMapping() const;
+
+  virtual
+  vtkDataSet* 
+  GetInput(); 
+
+  //----------------------------------------------------------------------------
+  virtual
+  vtkIdType
+  GetNodeObjId(vtkIdType theID);
+
+  virtual
+  vtkIdType
+  GetNodeVTKID(vtkIdType theID);
+
+  virtual
+  float* 
+  GetNodeCoord(vtkIdType theObjID);
+
+  virtual
+  vtkIdType
+  GetElemObjId(vtkIdType theID);
+
+  virtual
+  vtkIdType
+  GetElemVTKID(vtkIdType theID);
+
+  virtual
+  vtkCell* 
+  GetElemCell(vtkIdType theObjID);
+
+  //----------------------------------------------------------------------------
  protected:
   VISU_Actor();
-  
-  Standard_Boolean myHasScalarBar;
-  VISU_ScalarBarActor* myScalarBar;
-  VISU::Prs3d_i* Presentation;
-
- private:
-  vtkProperty* HighlightProperty;
 
+  virtual
+  ~VISU_Actor();
+  virtual 
+  void
+  SetMapperInput(vtkDataSet* theDataSet);
+
+  virtual
+  VISU_PipeLine* 
+  GetCurrentPL();
+
+  //----------------------------------------------------------------------------
+  bool myIsVTKMapping;
+  VISU::Prs3d_i* myPrs3d;
+  vtkSmartPointer<VISU_PipeLine> myPipeLine;
+  vtkSmartPointer<vtkDataSetMapper> myMapper;
+
+  VISU::TActorFactory* myActorFactory;
+  boost::signal1<void,VISU_Actor*> myDestroySignal;
+
+  vtkSmartPointer<VTKViewer_ShrinkFilter> myShrinkFilter;
+  bool myIsShrinkable;
+  bool myIsShrunk;
+
+  vtkSmartPointer<vtkTextMapper> myAnnotationMapper;
+  vtkSmartPointer<vtkTextActor>  myAnnotationActor;
 };
+
 #endif //VISU_ACTOR_H