-// 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
-// $Header$
-
+// Copyright (C) 2007-2010 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.
+//
+// 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
+//
+// 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>
-// VTK Includes
-#include <vtkActor.h>
-#include <vtkPolyDataMapper.h>
-#include <vtkPolyData.h>
-#include <vtkPolyDataNormals.h>
-#include <vtkProperty.h>
-
-#ifdef _WIN_32
-#define VTKOCC_EXPORT __declspec (dllexport)
-#else
-#define VTKOCC_EXPORT
-#endif
+#include <vtkTimeStamp.h>
+#include <vtkSmartPointer.h>
-#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
+class vtkProp;
+class vtkProperty;
+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;
-namespace VISU {
- class Prs3d_i;
+#if !defined(VTK_XVERSION)
+#define VTK_XVERSION (VTK_MAJOR_VERSION<<16)+(VTK_MINOR_VERSION<<8)+(VTK_BUILD_VERSION)
+#endif
+
+namespace SVTK
+{
+ namespace Representation
+ {
+ const Type Surfaceframe = Insideframe + 1;
+ const Type FeatureEdges = Insideframe + 2;
+ }
}
-class VISU_ScalarBarActor;
+namespace VISU
+{
+ class Prs3d_i;
+}
-class VTKOCC_EXPORT VISU_Actor : public SALOME_Actor {
- friend class VISU::Prs3d_i;
+//----------------------------------------------------------------------------
+class VISU_OBJECT_EXPORT VISU_Actor : public VISU_ActorBase
+{
public:
- vtkTypeMacro(VISU_Actor,SALOME_Actor);
+ vtkTypeMacro(VISU_Actor, VISU_ActorBase);
- Standard_Boolean IsHighlighting;
+ //static
+ //VISU_Actor*
+ //New();
- static VISU_Actor* New();
+ //! Copies all properties from the given actor
+ virtual
+ void
+ DeepCopy(VISU_Actor *theActor);
- void setActor(vtkActor *Actor);
+ virtual
+ void
+ ShallowCopyPL(VISU_PipeLine* thePipeLine);
- void ShallowCopy(vtkProp *prop);
+ //----------------------------------------------------------------------------
+ virtual
+ void
+ setIO(const Handle(SALOME_InteractiveObject)& theIO);
- void highlight(Standard_Boolean highlight);
- Standard_Boolean isHighlighted() { return true; };
+ //----------------------------------------------------------------------------
+ VISU::Prs3d_i*
+ GetPrs3d();
- void SetOpacity(float opa) {};
- float GetOpacity()
- { return 0;};
+ virtual
+ void
+ SetPrs3d(VISU::Prs3d_i* thePrs3d);
- Standard_Boolean HasScalarBar()
- { return myHasScalarBar; }
+ virtual
+ void
+ SetVisibility(int theMode);
- void setScalarBar(VISU_ScalarBarActor* theBar);
- VISU_ScalarBarActor* getScalarBar()
- { return myScalarBar; }
+ bool
+ ShouldBeDisplayed();
+ virtual
+ void
+ SetPosition( double thePosition[3] );
- void setIO(const Handle(SALOME_InteractiveObject)& io)
- { SALOME_Actor::setIO(io); myName = io->getName(); }
-
+ virtual
+ void
+ SetPosition( double theX, double theY, double theZ );
- VISU::Prs3d_i* getPrs3d() { return Presentation; }
- void setPrs3d(VISU::Prs3d_i* thePrs) { Presentation = thePrs; }
-
- vtkDataSet *DataSource;
- VISU_Actor* EdgeDevice;
+ //----------------------------------------------------------------------------
+ virtual
+ VISU_PipeLine*
+ GetPipeLine();
- Standard_Boolean IsShrinkable;
- Standard_Boolean IsShrunk;
- int VisuActorType;
- Standard_Boolean ResultAtNode;
- int VectorComponent;
- char FieldName[40];
+ virtual
+ void
+ SetPipeLine(VISU_PipeLine* thePipeLine);
- Standard_Boolean IsDefined;
+ //----------------------------------------------------------------------------
+ virtual
+ void
+ SetRepresentation(int theMode);
- float VABounds[6];
- void setVABounds(const float bounds[6]);
- void getVABounds(float bounds[6]);
+ //----------------------------------------------------------------------------
+ virtual
+ bool
+ IsShrunkable();
- ~VISU_Actor();
+ 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);
+
+ virtual
+ vtkIdType
+ GetNodeVTKID(vtkIdType theID);
+
+ virtual
+ vtkFloatingPointType*
+ GetNodeCoord(vtkIdType theObjID);
+
+ virtual
+ vtkIdType
+ GetElemObjId(vtkIdType theID);
+
+ virtual
+ vtkIdType
+ GetElemVTKID(vtkIdType theID);
+
+ virtual
+ vtkCell*
+ GetElemCell(vtkIdType theObjID);
+
+ //----------------------------------------------------------------------------
+ virtual void RemoveAllClippingPlanes();
+
+ virtual vtkIdType GetNumberOfClippingPlanes();
+
+ virtual bool AddClippingPlane(vtkPlane* thePlane);
+
+ virtual vtkPlane* GetClippingPlane(vtkIdType theID);
+
+ virtual vtkImplicitFunctionCollection* GetClippingPlanes();
+
+ //----------------------------------------------------------------------------
+ //! Apply the picking settings on the actor.
+ void
+ UpdatePickingSettings();
+
+ //----------------------------------------------------------------------------
+ //! Methods for values labeling
+ virtual
+ void
+ SetValuesLabeled( const bool theIsValLabeled );
+
+ virtual
+ bool
+ GetValuesLabeled() const;
+
+ virtual
+ vtkDataSet*
+ GetValLabelsInput();
+
+ vtkTextProperty*
+ GetsValLabelsProps() const;
+
+ enum EQuadratic2DRepresentation { eLines = 0, eArcs };
+
+ virtual
+ EQuadratic2DRepresentation GetQuadratic2DRepresentation() const;
+
+ virtual void
+ SetQuadratic2DRepresentation( EQuadratic2DRepresentation theMode );
+
+
protected:
VISU_Actor();
-
- Standard_Boolean myHasScalarBar;
- VISU_ScalarBarActor* myScalarBar;
- VISU::Prs3d_i* Presentation;
+ 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:
- vtkProperty* HighlightProperty;
+ void
+ ResetTextActor();
+
+ //----------------------------------------------------------------------------
+ protected:
+ vtkFloatingPointType myPriority;
+ bool myIsVTKMapping;
+ VISU::Prs3d_i* myPrs3d;
+ vtkSmartPointer<VISU_PipeLine> myPipeLine;
+
+ vtkSmartPointer<VTKViewer_ShrinkFilter> myShrinkFilter;
+ bool myIsShrinkable;
+ bool myIsShrunk;
+
+ vtkSmartPointer<vtkTextMapper> myAnnotationMapper;
+#if (VTK_XVERSION < 0x050100)
+ vtkSmartPointer<vtkTextActor> myAnnotationActor;
+#else
+ vtkSmartPointer<vtkActor2D> myAnnotationActor;
+#endif
+ 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