X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2FHYDROGUI%2FHYDROGUI_VTKPrs.h;h=3974fea3e2907d00257640f713e990927df0c7dc;hb=3524c916e16d5c5c545c0ddbda4b570139612afe;hp=d679856a466197351ac1fd6aab13d177cd73fbe9;hpb=d5288d46b0d85156f7666edf2cef050dc6655eae;p=modules%2Fhydro.git diff --git a/src/HYDROGUI/HYDROGUI_VTKPrs.h b/src/HYDROGUI/HYDROGUI_VTKPrs.h index d679856a..3974fea3 100644 --- a/src/HYDROGUI/HYDROGUI_VTKPrs.h +++ b/src/HYDROGUI/HYDROGUI_VTKPrs.h @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2015 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 @@ -6,7 +6,7 @@ // 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. +// 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 @@ -24,9 +24,39 @@ #define HYDROGUI_VTKPrs_H #include +#include #include #include +#include + +class vtkMapper; + +template ActorType* getActor(SVTK_Prs* thePrs); + +/** + * Get a VTK actor of the given presentation. Create a new one if there is no actor yet. + */ +template +ActorType* getActor(SVTK_Prs* thePrs) +{ + ActorType* anActor = 0; + vtkActorCollection* aContent = thePrs->GetObjects(); + if ( aContent ) + { + // Remove old actor because of the problem of GEOM_Actor updating. + //anActor = dynamic_cast( aContent->GetLastActor() ); + aContent->RemoveAllItems(); + } + if ( !anActor ) + { + anActor = ActorType::New(); + thePrs->AddObject( anActor ); + anActor->Delete(); + } + return anActor; +} + /* Class : HYDROGUI_VTKPrs @@ -39,6 +69,9 @@ public: virtual ~HYDROGUI_VTKPrs(); virtual void compute(); + virtual bool needScalarBar() { return false; } + + static double InvalidZValue() { return HYDROData_AltitudeObject::GetInvalidAltitude(); } public: Handle(HYDROData_Entity) getObject() const { return myObject; } @@ -46,11 +79,29 @@ public: bool getIsToUpdate() const { return myIsToUpdate; } void setIsToUpdate( bool theState ) { myIsToUpdate = theState; } + /** + * \brief Set the range of Z values for the color mapping. + */ + virtual void setZRange( double theRange[] ); + /** + * \brief Get the range of Z values for the color mapping. + */ + virtual double* getZRange() { return myZRange; } + /** + * \brief Get an actual Z values range of the presented object. + */ + virtual double* getInternalZRange() { return myInternalZRange; } + +protected: + virtual vtkMapper* mapper() { return 0; } + + double myInternalZRange[2]; //!< Actual Z values range of the presented object private: Handle(HYDROData_Entity) myObject; Handle(SALOME_InteractiveObject) myIO; bool myIsToUpdate; + double myZRange[2]; //!< Imposed Z values range for colors mapping }; #endif