X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FVTKViewer%2FVTKViewer_Trihedron.h;h=af0402d1faa68edeb0c9dc732ecf1bc6506bd986;hb=refs%2Fheads%2Fngr%2Fpython3_dev_pv5.4;hp=63bf4bd78ecdb6bc208745ac0c89e8d849b83720;hpb=08209796122a4ed12a8bf21b4b2e3e54119e6f4b;p=modules%2Fgui.git diff --git a/src/VTKViewer/VTKViewer_Trihedron.h b/src/VTKViewer/VTKViewer_Trihedron.h index 63bf4bd78..af0402d1f 100755 --- a/src/VTKViewer/VTKViewer_Trihedron.h +++ b/src/VTKViewer/VTKViewer_Trihedron.h @@ -1,3 +1,25 @@ +// Copyright (C) 2007-2016 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, 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. +// +// 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 +// + #ifndef VTKVIEWER_TRIHEDRON_H #define VTKVIEWER_TRIHEDRON_H @@ -5,6 +27,7 @@ #include #include +#include class vtkRenderer; class vtkActorCollection; @@ -13,9 +36,22 @@ class vtkProperty; class vtkPolyDataMapper; class vtkLineSource; class vtkConeSource; +class vtkVectorText; +class vtkTextActor; +class vtkTextMapper; class VTKViewer_Axis; -class VTKViewer_VectorText; + +#if !defined(VTK_XVERSION) +#define VTK_XVERSION (VTK_MAJOR_VERSION<<16)+(VTK_MINOR_VERSION<<8)+(VTK_BUILD_VERSION) +#endif + +// VTKViewer_UnScaledActor is temporarily replaced with simple vtkTextActor +// This workaround caused by the bug with disappeared labels of the trihedron +// reproduced after migration from qt-4.4.3 to qt-4.5.2 +#if (VTK_XVERSION < 0x050200) +#define IPAL21440 +#endif /*! \class vtkFollower * See vtk documentation @@ -23,7 +59,7 @@ class VTKViewer_VectorText; /*!a subclass of actor that always faces the camera *@see vtkFollower */ -class VTKViewer_UnScaledActor: public vtkFollower +class VTKVIEWER_EXPORT VTKViewer_UnScaledActor: public vtkFollower { VTKViewer_UnScaledActor(const VTKViewer_UnScaledActor&); @@ -34,9 +70,10 @@ public: /*!Create new instance of VTKViewer_UnScaledActor.*/ static VTKViewer_UnScaledActor *New(); + virtual double* GetBounds(); virtual void SetSize(int theSize); virtual void Render(vtkRenderer *theRenderer); - + protected: VTKViewer_UnScaledActor(); /*!Destructor. Do nothing.*/ @@ -48,7 +85,7 @@ protected: /*!a subclass of actor that always faces the camera *@see vtkFollower */ -class VTKViewer_LineActor: public vtkFollower +class VTKVIEWER_EXPORT VTKViewer_LineActor: public vtkFollower { VTKViewer_LineActor(const VTKViewer_LineActor&); @@ -59,15 +96,22 @@ public: /*!Create new instance of VTKViewer_LineActor.*/ static VTKViewer_LineActor *New(); - /*! Sets Lable actor. +#ifdef IPAL21440 + /*! Sets Label actor. + * \param theLabelActor - vtkTextActor + */ + void SetLabelActor(vtkTextActor* theLabelActor); +#else + /*! Sets Label actor. * \param theLabelActor - VTKViewer_UnScaledActor */ void SetLabelActor(VTKViewer_UnScaledActor* theLabelActor); +#endif /*! Sets Arrow actor. * \param theLabelActor - VTKViewer_UnScaledActor */ - void SetArrowActor(VTKViewer_UnScaledActor* theLabelActor); + void SetArrowActor(vtkFollower* theArrowActor); virtual void Render(vtkRenderer *theRenderer); @@ -86,13 +130,16 @@ protected: } /*!Label actor pointer*/ +#ifdef IPAL21440 + vtkTextActor* LabelActor; +#else VTKViewer_UnScaledActor* LabelActor; +#endif /*!Arrow actor pointer*/ - VTKViewer_UnScaledActor* ArrowActor; + vtkFollower* ArrowActor; }; -//**************************************************************** /*!This class provide support trihedron object in vtk viewer.*/ class VTKVIEWER_EXPORT VTKViewer_Trihedron : public vtkObject { @@ -114,14 +161,14 @@ public: static VTKViewer_Trihedron *New(); /*!Sets size of trihedron. - * \param theSize - float value + * \param theSize - double value */ - virtual void SetSize(float theSize); + virtual void SetSize(double theSize); /*! Get size of trihedron. - * \retval mySize - float value + * \retval mySize - double value */ - virtual float GetSize() { return mySize;} + virtual double GetSize() { return mySize;} enum TVisibility{eOff, eOn, eOnlyLineOn}; @@ -152,6 +199,12 @@ public: */ virtual int GetVisibleActorCount(vtkRenderer* theRenderer); + /*! Check if actor belongs to the trihedron object + * \param theActor - vtkActor pointer + * \retval Return true if the actor belongs to the trihedron object + */ + virtual bool OwnActor(const vtkActor* theActor); + protected: /*! Actor collection*/ vtkActorCollection* myPresent; @@ -163,15 +216,14 @@ protected: VTKViewer_Axis* myAxis[3]; /*! Common size for trihedron, for each axis.*/ - float mySize; + double mySize; }; -//**************************************************************** /*!The base class for concreate Axis. * Its only duty is to give correct initialization and destruction * of its pipe-lines */ -class VTKViewer_Axis : public vtkObject +class VTKVIEWER_EXPORT VTKViewer_Axis : public vtkObject { protected: VTKViewer_Axis(); @@ -185,6 +237,7 @@ public: /*! Add to \a theRenderer actors: myLineActor,myLabelActor,myArrowActor */ virtual void AddToRender(vtkRenderer* theRenderer); + virtual void RemoveFromRender(vtkRenderer* theRenderer); /*! Sets visibility for actors: myLineActor,myLabelActor,myArrowActor */ @@ -199,23 +252,36 @@ public: */ virtual void SetCamera(vtkCamera* theCamera); - /*! Sets \a theProperty for actors: myLineActor,myLabelActor,myArrowActor + /*! Sets color for actors: myLineActor,myLabelActor,myArrowActor + * \param theRed - red component of the color + * \param theGreen - green component of the color + * \param theBlue - blue component of the color */ - virtual void SetProperty(vtkProperty* theProperty); + virtual void SetColor(double theRed, double theGreen, double theBlue); /*! Set size of VTKViewer_Axis */ - virtual void SetSize(float theSize); + virtual void SetSize(double theSize); /*! Get label actor. * \retval Return myLabelActor. */ +#ifdef IPAL21440 + virtual vtkTextActor* GetLabel() { return myLabelActor; } +#else virtual VTKViewer_UnScaledActor* GetLabel() { return myLabelActor; } +#endif /*! Get arrow actor. * \retval Return myArrowActor */ - virtual VTKViewer_UnScaledActor* GetArrow() { return myArrowActor; } + virtual vtkFollower* GetArrow() { return myArrowActor; } + + /*! Check if actor belongs to the axis object + * \param theActor - vtkActor pointer + * \retval Return true if the actor belongs to the axis object + */ + virtual bool OwnActor(const vtkActor* theActor); protected: /*! Visibility flag. @@ -228,19 +294,23 @@ protected: /*! \var myRot[3] * Orientation vector */ - float myDir[3], myRot[3]; + double myDir[3], myRot[3]; /*! VTKViewer_LineActor actor pointer */ VTKViewer_LineActor *myLineActor; - /*! VTKViewer_UnScaledActor actor pointer + /*! vtkFollower actor pointer */ - VTKViewer_UnScaledActor *myArrowActor; + vtkFollower *myArrowActor; /*! VTKViewer_UnScaledActor actor pointer */ +#ifdef IPAL21440 + vtkTextActor *myLabelActor; +#else VTKViewer_UnScaledActor *myLabelActor; +#endif /*! \li myMapper[0] - for the Line pipe-line representation * \li myMapper[1] - for the Arrow pipe-line representation @@ -256,9 +326,15 @@ protected: */ vtkConeSource *myConeSource; +#ifdef IPAL21440 + /*! vtkTextMapper pointer (Label) + */ + vtkTextMapper *myTextMapper; +#else /*! VTKViewer_VectorText pointer (Label) */ - VTKViewer_VectorText* myVectorText; + vtkVectorText* myVectorText; +#endif }; #endif