Salome HOME
Join modifications from branch OCC_development_for_3_2_0a2
[modules/visu.git] / src / OBJECT / VISU_Actor.h
index 641a944240e471c4c44f401b8e35c073322a63df..09d4d4bbc41f22280a2bb6f759736e5f950e9de6 100644 (file)
 //
 //
 //
-//  File   : VISU_Actor.h
-//  Author : Laurent CORNABE with the help of Nicolas REJNERI
+//  File   : 
+//  Author : 
 //  Module : VISU
 //  $Header$
 
-using namespace std;
-
 #ifndef VISU_ACTOR_H
 #define VISU_ACTOR_H
 
 #include "SALOME_Actor.h"
+#include "VISU_ActorFactory.h"
+#include "VISU_BoostSignals.h"
+
 #include <string>
+#include <vtkSmartPointer.h>
 
 class vtkProp;
-class vtkPolyData;
 class vtkProperty;
-class vtkPolyDataMapper;
-
-namespace VISU { 
-  class Prs3d_i;
-}
-class VISU_ScalarBarActor;
+class vtkDataSetMapper;
+class vtkTextMapper;
+class vtkTextActor;
+class vtkInteractorStyle;
+class VTKViewer_ShrinkFilter;
+class VISU_PipeLine;
 
 #ifdef _WIN_32
 #define VTKOCC_EXPORT __declspec (dllexport)
@@ -50,132 +51,203 @@ class VISU_ScalarBarActor;
 #define VTKOCC_EXPORT VTK_EXPORT
 #endif
 
-class VTKOCC_EXPORT VISU_Actor : public SALOME_Actor {
+namespace VISU 
+{
+  class Prs3d_i;
+}
+
+//----------------------------------------------------------------------------
+class VTKOCC_EXPORT VISU_Actor : 
+  public SALOME_Actor,
+  public boost::signalslib::trackable
+{
  public:
   vtkTypeMacro(VISU_Actor,SALOME_Actor);
-  void ShallowCopy(vtkProp *prop);
-  static VISU_Actor* New();
-  ~VISU_Actor();
-
-  virtual void setIO(const Handle(SALOME_InteractiveObject)& theIO);
-
-  VISU::Prs3d_i* getPrs3d(){ return myPrs3d;}
-  virtual void setPrs3d(VISU::Prs3d_i* thePrs3d);
-
-  VISU_Actor* GetParent(){ return myParent;}
-  virtual void SetParent(VISU_Actor* theParent);
-
-  void highlight(Standard_Boolean highlight);
-  Standard_Boolean isHighlighted() { return true; };
-
-  void  SetOpacity(float opa) {};
-  float GetOpacity() { return 0;};
 
-  virtual void SetMapper(vtkMapper* theMapper); 
-
-  virtual void SetShrinkable(bool theIsShrinkable);
-  virtual bool GetShrinkable() { return myIsShrinkable;}
-
-  virtual bool isShrunk() { return myIsShrunk;}
-  virtual void setShrink(float theFactor = 0.8); 
-  virtual void unShrink(); 
-
-  virtual void SetVisibility(int theMode);
-  virtual int GetVisibility();
-
-  virtual void SetProperty(vtkProperty* theProperty);
-  virtual vtkProperty* GetProperty();
-
-  virtual void SetLineWidth(float theLineWidth);
-  virtual float GetLineWidth();
-
-  virtual void SetRepresentation(int theMode);
-  virtual int GetRepresentation();
-    
-  bool IsHighlighting;
-  std::string myFieldName;
-
- protected:
-  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();
  
-  VISU_Actor* myParent;
-  VISU::Prs3d_i* myPrs3d;
-  vtkProperty* HighlightProperty;
-  bool myIsShrinkable;
-  bool myIsShrunk;
-};
-
-//=======================================================================
-
-class VTKOCC_EXPORT VISUScalarMap_Actor : public VISU_Actor {
- public:
-  vtkTypeMacro(VISUScalarMap_Actor,VISU_Actor);
-  static VISUScalarMap_Actor* New();
-  ~VISUScalarMap_Actor();
-
-  virtual void AddToRender(vtkRenderer* theRenderer); 
-  virtual void RemoveFromRender(vtkRenderer* theRenderer);
-
-  virtual void SetVisibility(int theMode);
-  virtual int GetVisibility();
-
-  virtual VISU_ScalarBarActor* GetScalarBar(){ return myScalarBar;}
-
-  virtual void SetBarVisibility(const bool* theMode);
-  virtual bool GetBarVisibility(){ return *myBarVisibility;}
-
+  //----------------------------------------------------------------------------
+  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:
-  VISUScalarMap_Actor();
-  const bool* myBarVisibility;
-  VISU_ScalarBarActor* myScalarBar;
-};
-
-//=======================================================================
-
-class VTKOCC_EXPORT VISUMesh_Actor : public VISU_Actor {
- public:
-  vtkTypeMacro(VISUMesh_Actor,VISU_Actor);
-  static VISUMesh_Actor* New();
-  ~VISUMesh_Actor();
-
-  virtual void setIO(const Handle(SALOME_InteractiveObject)& theIO);
-  virtual void setPrs3d(VISU::Prs3d_i* thePrs3d);
-
-  virtual void AddToRender(vtkRenderer* theRenderer); 
-  virtual void RemoveFromRender(vtkRenderer* theRenderer);
-
-  virtual void SetMapper(vtkMapper* theMapper); 
-  virtual void SetTransform(SALOME_Transform* theTransform); 
-
-  virtual vtkProperty* GetProperty(); 
-  virtual void SetProperty(vtkProperty* theProperty);
-
-  virtual vtkProperty* GetEdgeProperty(); 
-  virtual void SetEdgeProperty(vtkProperty* theProperty);
+  VISU_Actor();
 
-  virtual void SetLineWidth(float theLineWidth);
-  virtual float GetLineWidth();
+  virtual
+  ~VISU_Actor();
+  virtual 
+  void
+  SetMapperInput(vtkDataSet* theDataSet);
 
-  virtual void SetRepresentation(int theMode);
-  virtual int GetRepresentation() { return myRepresentation;};
+  virtual
+  VISU_PipeLine* 
+  GetCurrentPL();
 
-  virtual void SetVisibility(int theMode);
-  virtual int GetVisibility() { return myVisibility;}
+  //----------------------------------------------------------------------------
+  bool myIsVTKMapping;
+  VISU::Prs3d_i* myPrs3d;
+  vtkSmartPointer<VISU_PipeLine> myPipeLine;
+  vtkSmartPointer<vtkDataSetMapper> myMapper;
 
-  virtual void SetShrinkable(bool theIsShrinkable);
+  VISU::TActorFactory* myActorFactory;
+  boost::signal1<void,VISU_Actor*> myDestroySignal;
 
-  virtual void setShrink(float theFactor = 0.8); 
-  virtual void unShrink(); 
+  vtkSmartPointer<VTKViewer_ShrinkFilter> myShrinkFilter;
+  bool myIsShrinkable;
+  bool myIsShrunk;
 
- protected:
-  VISUMesh_Actor();
-  int myRepresentation, myVisibility;
-  vtkPolyDataMapper* myEdgeMapper;
-  VISU_Actor *mySurfaceActor, *myEdgeActor;
+  vtkSmartPointer<vtkTextMapper> myAnnotationMapper;
+  vtkSmartPointer<vtkTextActor>  myAnnotationActor;
 };
 
-//=======================================================================
-
 #endif //VISU_ACTOR_H
-
-