-// VISU OBJECT : interactive object for VISU entities implementation
+// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
//
-// 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
+// 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 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
//
-// File : VISU_Actor.h
-// Author : Laurent CORNABE with the help of Nicolas REJNERI
-// Module : VISU
-// $Header$
-
-using namespace std;
+// VISU OBJECT : interactive object for VISU entities implementation
+// File :
+// Author :
+// Module : VISU
+//
#ifndef VISU_ACTOR_H
#define VISU_ACTOR_H
+#include "VISU_OBJECT.h"
+
#include "SALOME_Actor.h"
+#include "VISU_ActorBase.h"
+#include "VISU_BoostSignals.h"
+#include "SVTK_DeviceActor.h"
+
#include <string>
+#include <vtkTimeStamp.h>
+#include <vtkSmartPointer.h>
class vtkProp;
-class vtkPolyData;
class vtkProperty;
-class vtkPolyDataMapper;
+class vtkTextMapper;
+class vtkTextActor;
+class vtkInteractorStyle;
+class vtkCallbackCommand;
+class VTKViewer_ShrinkFilter;
+class VISU_PipeLine;
+class vtkPlane;
+class vtkImplicitFunctionCollection;
+class vtkFeatureEdges;
+class vtkTextProperty;
+class vtkCellCenters;
+class vtkLabeledDataMapper;
+class vtkMaskPoints;
+class vtkActor2D;
+
+class VTKViewer_FramedTextActor;
+
+class VISU_SelectVisiblePoints;
+
+#if !defined(VTK_XVERSION)
+#define VTK_XVERSION (VTK_MAJOR_VERSION<<16)+(VTK_MINOR_VERSION<<8)+(VTK_BUILD_VERSION)
+#endif
-namespace VISU {
- class Prs3d_i;
+namespace SVTK
+{
+ namespace Representation
+ {
+ const Type Surfaceframe = Insideframe + 1;
+ const Type FeatureEdges = Insideframe + 2;
+ }
}
-class VISU_ScalarBarActor;
-#ifdef _WIN_32
-#define VTKOCC_EXPORT __declspec (dllexport)
-#else
-#define VTKOCC_EXPORT VTK_EXPORT
-#endif
+namespace VISU
+{
+ class Prs3d_i;
+}
-class VTKOCC_EXPORT VISU_Actor : public SALOME_Actor {
+//----------------------------------------------------------------------------
+class VISU_OBJECT_EXPORT VISU_Actor : public VISU_ActorBase
+{
public:
- vtkTypeMacro(VISU_Actor,SALOME_Actor);
- void ShallowCopy(vtkProp *prop);
- static VISU_Actor* New();
- ~VISU_Actor();
+ vtkTypeMacro(VISU_Actor, VISU_ActorBase);
+
+ //static
+ //VISU_Actor*
+ //New();
+
+ //! Copies all properties from the given actor
+ virtual
+ void
+ DeepCopy(VISU_Actor *theActor);
- virtual void setIO(const Handle(SALOME_InteractiveObject)& theIO);
+ 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);
+
+ virtual
+ void
+ SetVisibility(int theMode);
+
+ bool
+ ShouldBeDisplayed();
+
+ virtual
+ void
+ SetPosition( double thePosition[3] );
+
+ virtual
+ void
+ SetPosition( double theX, double theY, double theZ );
+
+ //----------------------------------------------------------------------------
+ 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(vtkFloatingPointType theFactor = 0.8);
+
+ virtual
+ vtkFloatingPointType
+ GetShrinkFactor();
+
+ //----------------------------------------------------------------------------
+ virtual
+ bool
+ IsFeatureEdgesAllowed();
+
+ virtual
+ void
+ SetFeatureEdgesAllowed(bool theIsFeatureEdgesAllowed);
+
+ virtual
+ bool
+ IsFeatureEdgesEnabled();
+
+ virtual
+ void
+ SetFeatureEdgesEnabled(bool theIsFeatureEdgesEnabled);
+
+ virtual
+ vtkFloatingPointType
+ GetFeatureEdgesAngle();
+
+ virtual
+ void
+ SetFeatureEdgesAngle(vtkFloatingPointType theAngle = 30.0);
+
+ virtual
+ void
+ GetFeatureEdgesFlags(bool& theIsFeatureEdges,
+ bool& theIsBoundaryEdges,
+ bool& theIsManifoldEdges,
+ bool& theIsNonManifoldEdges);
+
+ virtual
+ void
+ SetFeatureEdgesFlags(bool theIsFeatureEdges,
+ bool theIsBoundaryEdges,
+ bool theIsManifoldEdges,
+ bool theIsNonManifoldEdges);
+
+ virtual
+ bool
+ GetFeatureEdgesColoring();
+
+ virtual
+ void
+ SetFeatureEdgesColoring(bool theIsColoring);
+
+ //----------------------------------------------------------------------------
+ virtual
+ void
+ SetOpacity(vtkFloatingPointType theValue);
+
+ virtual
+ vtkFloatingPointType
+ GetOpacity();
+
+ virtual
+ void
+ SetLineWidth(vtkFloatingPointType theLineWidth);
+
+ virtual
+ vtkFloatingPointType
+ GetLineWidth();
+
+ //----------------------------------------------------------------------------
+ virtual
+ void
+ AddToRender( vtkRenderer* );
+
+ virtual
+ void
+ RemoveFromRender( vtkRenderer* );
+
+ //----------------------------------------------------------------------------
+ //! Just to update visibility of the highlight devices
+ virtual
+ void
+ highlight(bool theHighlight);
+
+ //! To process prehighlight (called from #SVTK_InteractorStyle)
+ virtual
+ bool
+ PreHighlight(vtkInteractorStyle* theInteractorStyle,
+ SVTK_SelectionEvent* theSelectionEvent,
+ bool theIsHighlight);
+
+ //! To process highlight (called from #SVTK_InteractorStyle)
+ virtual
+ bool
+ Highlight(vtkInteractorStyle* theInteractorStyle,
+ SVTK_SelectionEvent* theSelectionEvent,
+ bool theIsHighlight);
+
+ //! Internal highlight.
+ virtual
+ void
+ Highlight(bool theIsHighlight);
+
+ virtual
+ void
+ SetVTKMapping(bool theIsVTKMapping);
+
+ virtual
+ bool
+ IsVTKMapping() const;
+
+ virtual
+ vtkDataSet*
+ GetInput();
+
+ //! Gets memory size used by the instance (bytes).
+ virtual
+ unsigned long int
+ GetMemorySize();
+
+ //----------------------------------------------------------------------------
+ virtual
+ vtkIdType
+ GetNodeObjId(vtkIdType theID);
- VISU::Prs3d_i* getPrs3d(){ return myPrs3d;}
- virtual void setPrs3d(VISU::Prs3d_i* thePrs3d);
+ virtual
+ vtkIdType
+ GetNodeVTKID(vtkIdType theID);
- VISU_Actor* GetParent(){ return myParent;}
- virtual void SetParent(VISU_Actor* theParent);
+ virtual
+ vtkFloatingPointType*
+ GetNodeCoord(vtkIdType theObjID);
- void highlight(Standard_Boolean highlight);
- Standard_Boolean isHighlighted() { return true; };
+ virtual
+ vtkIdType
+ GetElemObjId(vtkIdType theID);
- void SetOpacity(float opa) {};
- float GetOpacity() { return 0;};
+ virtual
+ vtkIdType
+ GetElemVTKID(vtkIdType theID);
- virtual void SetMapper(vtkMapper* theMapper);
+ virtual
+ vtkCell*
+ GetElemCell(vtkIdType theObjID);
- virtual void SetShrinkable(bool theIsShrinkable);
- virtual bool GetShrinkable() { return myIsShrinkable;}
+ //----------------------------------------------------------------------------
+ virtual void RemoveAllClippingPlanes();
- virtual bool isShrunk() { return myIsShrunk;}
- virtual void setShrink(float theFactor = 0.8);
- virtual void unShrink();
+ virtual vtkIdType GetNumberOfClippingPlanes();
- virtual void SetVisibility(int theMode);
- virtual int GetVisibility();
+ virtual bool AddClippingPlane(vtkPlane* thePlane);
- virtual void SetProperty(vtkProperty* theProperty);
- virtual vtkProperty* GetProperty();
+ virtual vtkPlane* GetClippingPlane(vtkIdType theID);
- virtual void SetLineWidth(float theLineWidth);
- virtual float GetLineWidth();
+ virtual vtkImplicitFunctionCollection* GetClippingPlanes();
- virtual void SetRepresentation(int theMode);
- virtual int GetRepresentation();
-
- bool IsHighlighting;
- std::string myFieldName;
+ //----------------------------------------------------------------------------
+ //! Apply the picking settings on the actor.
+ void
+ UpdatePickingSettings();
- protected:
- VISU_Actor();
-
- VISU_Actor* myParent;
- VISU::Prs3d_i* myPrs3d;
- vtkProperty* HighlightProperty;
- bool myIsShrinkable;
- bool myIsShrunk;
-};
+ //----------------------------------------------------------------------------
+ //! Methods for values labeling
+ virtual
+ void
+ SetValuesLabeled( const bool theIsValLabeled );
-//=======================================================================
+ virtual
+ bool
+ GetValuesLabeled() const;
-class VTKOCC_EXPORT VISUScalarMap_Actor : public VISU_Actor {
- public:
- vtkTypeMacro(VISUScalarMap_Actor,VISU_Actor);
- static VISUScalarMap_Actor* New();
- ~VISUScalarMap_Actor();
+ virtual
+ vtkDataSet*
+ GetValLabelsInput();
- virtual void AddToRender(vtkRenderer* theRenderer);
- virtual void RemoveFromRender(vtkRenderer* theRenderer);
+ vtkTextProperty*
+ GetsValLabelsProps() const;
- 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;}
+ enum EQuadratic2DRepresentation { eLines = 0, eArcs };
+ virtual
+ EQuadratic2DRepresentation GetQuadratic2DRepresentation() const;
+
+ virtual void
+ SetQuadratic2DRepresentation( EQuadratic2DRepresentation theMode );
+
+
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);
-
- virtual void SetLineWidth(float theLineWidth);
- virtual float GetLineWidth();
-
- virtual void SetRepresentation(int theMode);
- virtual int GetRepresentation() { return myRepresentation;};
+ VISU_Actor();
- virtual void SetVisibility(int theMode);
- virtual int GetVisibility() { return myVisibility;}
+ virtual
+ ~VISU_Actor();
+
+ virtual
+ void
+ SetMapperInput(vtkDataSet* theDataSet) = 0;
+
+ virtual
+ VISU_PipeLine*
+ GetCurrentPL();
+
+ //----------------------------------------------------------------------------
+ bool
+ isSubElementsHighlighted();
+
+ //----------------------------------------------------------------------------
+ vtkSmartPointer<vtkCallbackCommand> myEventCallbackCommand;
+
+ //! Main process VTK event method
+ static
+ void
+ ProcessEvents(vtkObject* theObject,
+ unsigned long theEvent,
+ void* theClientData,
+ void* theCallData);
+
+ //----------------------------------------------------------------------------
+ private:
+ void
+ ResetTextActor();
+
+ //----------------------------------------------------------------------------
+ protected:
+ vtkFloatingPointType myPriority;
+ bool myIsVTKMapping;
+ VISU::Prs3d_i* myPrs3d;
+ vtkSmartPointer<VISU_PipeLine> myPipeLine;
- virtual void SetShrinkable(bool theIsShrinkable);
+ vtkSmartPointer<VTKViewer_ShrinkFilter> myShrinkFilter;
+ bool myIsShrinkable;
+ bool myIsShrunk;
- virtual void setShrink(float theFactor = 0.8);
- virtual void unShrink();
+ vtkSmartPointer<vtkTextMapper> myAnnotationMapper;
+#if (VTK_XVERSION < 0x050100)
+ vtkSmartPointer<vtkTextActor> myAnnotationActor;
+#else
+ vtkSmartPointer<vtkActor2D> myAnnotationActor;
+#endif
- protected:
- VISUMesh_Actor();
- int myRepresentation, myVisibility;
- vtkPolyDataMapper* myEdgeMapper;
- VISU_Actor *mySurfaceActor, *myEdgeActor;
+ vtkSmartPointer<VTKViewer_FramedTextActor> myTextActor;
+
+ vtkSmartPointer<vtkFeatureEdges> myFeatureEdges;
+ bool myIsFeatureEdgesAllowed;
+ bool myIsFeatureEdgesEnabled;
+
+ Selection_Mode myLastSelectionMode;
+ bool myIsSubElementsHighlighted;
+
+ // fields for values labeling
+ bool myIsValLabeled;
+ vtkDataSet* myValLblDataSet;
+ vtkActor2D* myValLabels;
+ vtkMaskPoints* myValMaskPoints;
+ vtkCellCenters* myValCellCenters;
+ vtkLabeledDataMapper* myValLabeledDataMapper;
+ VISU_SelectVisiblePoints* myValSelectVisiblePoints;
};
-//=======================================================================
-
#endif //VISU_ACTOR_H
-
-