1 // Copyright (C) 2014-2015 EDF-R&D
2 // This library is free software; you can redistribute it and/or
3 // modify it under the terms of the GNU Lesser General Public
4 // License as published by the Free Software Foundation; either
5 // version 2.1 of the License, or (at your option) any later version.
7 // This library is distributed in the hope that it will be useful,
8 // but WITHOUT ANY WARRANTY; without even the implied warranty of
9 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
10 // Lesser General Public License for more details.
12 // You should have received a copy of the GNU Lesser General Public
13 // License along with this library; if not, write to the Free Software
14 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 #ifndef HYDROGUI_VTKPrs_H
20 #define HYDROGUI_VTKPrs_H
22 #include <HYDROData_Entity.h>
23 #include <HYDROData_AltitudeObject.h>
25 #include <SALOME_InteractiveObject.hxx>
27 #include <vtkActorCollection.h>
31 template <class ActorType> ActorType* getActor(SVTK_Prs* thePrs);
34 * Get a VTK actor of the given presentation. Create a new one if there is no actor yet.
36 template <class ActorType>
37 ActorType* getActor(SVTK_Prs* thePrs)
39 ActorType* anActor = 0;
40 vtkActorCollection* aContent = thePrs->GetObjects();
43 // Remove old actor because of the problem of GEOM_Actor updating.
44 //anActor = dynamic_cast<ActorType*>( aContent->GetLastActor() );
45 aContent->RemoveAllItems();
49 anActor = ActorType::New();
50 thePrs->AddObject( anActor );
58 Class : HYDROGUI_VTKPrs
59 Description : Base class for all HYDRO presentation in VTK viewer
61 class HYDROGUI_VTKPrs : public SVTK_Prs
64 HYDROGUI_VTKPrs( const Handle(HYDROData_Entity)& theObject );
65 virtual ~HYDROGUI_VTKPrs();
67 virtual void compute();
68 virtual bool needScalarBar() { return false; }
70 static double InvalidZValue() { return HYDROData_AltitudeObject::GetInvalidAltitude(); }
73 Handle(HYDROData_Entity) getObject() const { return myObject; }
74 Handle(SALOME_InteractiveObject) getIO() const { return myIO; }
76 bool getIsToUpdate() const { return myIsToUpdate; }
77 void setIsToUpdate( bool theState ) { myIsToUpdate = theState; }
79 * \brief Set the range of Z values for the color mapping.
81 virtual void setZRange( double theRange[] );
83 * \brief Get the range of Z values for the color mapping.
85 virtual double* getZRange() { return myZRange; }
87 * \brief Get an actual Z values range of the presented object.
89 virtual double* getInternalZRange() { return myInternalZRange; }
92 virtual vtkMapper* mapper() { return 0; }
94 double myInternalZRange[2]; //!< Actual Z values range of the presented object
97 Handle(HYDROData_Entity) myObject;
98 Handle(SALOME_InteractiveObject) myIO;
100 double myZRange[2]; //!< Imposed Z values range for colors mapping