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 #include "HYDROGUI_ShapeLandCoverMap.h"
20 #include "HYDROGUI_OCCDisplayer.h"
21 #include "HYDROGUI_LandCoverMapPrs.h"
23 #include <HYDROData_LandCoverMap.h>
25 #include <AIS_InteractiveContext.hxx>
27 HYDROGUI_ShapeLandCoverMap::HYDROGUI_ShapeLandCoverMap( HYDROGUI_OCCDisplayer* theDisplayer,
28 const Handle(AIS_InteractiveContext)& theContext,
29 const Handle_HYDROData_LandCoverMap& theLandCoverMap,
31 const bool theIsScalarMode )
32 : HYDROGUI_Shape( theContext, theLandCoverMap, theZLayer ),
33 myDisplayer( theDisplayer ),
34 myIsScalarMapMode( theIsScalarMode )
38 HYDROGUI_ShapeLandCoverMap::~HYDROGUI_ShapeLandCoverMap()
42 void HYDROGUI_ShapeLandCoverMap::update( bool theIsUpdateViewer, bool isDeactivateSelection )
44 setIsToUpdate( false );
46 Handle(HYDROData_LandCoverMap) aLandCoverMapObj =
47 Handle(HYDROData_LandCoverMap)::DownCast( getObject() );
49 TopoDS_Shape aLandCoverMapShape = aLandCoverMapObj->GetShape();
50 if ( !aLandCoverMapShape.IsNull() ) {
51 setShape( aLandCoverMapShape, false, false );
54 if ( !myIsScalarMapMode ) {
56 QColor aFillingColor = Qt::gray;//aLandCoverMapObj->GetFillingColor();
57 QColor aBorderColor = Qt::black;//aLandCoverMapObj->GetBorderColor();
59 setFillingColor( aFillingColor, false, false );
60 setBorderColor( aBorderColor, false, false );
62 updateShape( false, false );
65 HYDROGUI_Shape::update( theIsUpdateViewer, isDeactivateSelection );
68 void HYDROGUI_ShapeLandCoverMap::setScalarMapModeEnabled( const bool theIsToEnable )
70 myIsScalarMapMode = theIsToEnable;
73 void HYDROGUI_ShapeLandCoverMap::setVisible( const bool theState,
74 const bool theIsUpdateViewer )
76 HYDROGUI_Shape::setVisible( theState, theIsUpdateViewer );
77 myDisplayer->SetToUpdateColorScale();
80 void HYDROGUI_ShapeLandCoverMap::displayShape( const bool theIsUpdateViewer )
82 HYDROGUI_Shape::displayShape( theIsUpdateViewer );
83 myDisplayer->SetToUpdateColorScale();
86 Handle_AIS_InteractiveObject HYDROGUI_ShapeLandCoverMap::createShape() const
88 Handle(HYDROData_LandCoverMap) aLandCoverMap = Handle(HYDROData_LandCoverMap)::DownCast( getObject() );
89 if ( !aLandCoverMap.IsNull() )
90 return new HYDROGUI_LandCoverMapPrs( aLandCoverMap );
94 void HYDROGUI_ShapeLandCoverMap::display( const bool theIsUpdateViewer )
96 HYDROGUI_Shape::display( theIsUpdateViewer );
97 myDisplayer->SetToUpdateColorScale();
100 void HYDROGUI_ShapeLandCoverMap::erase( const bool theIsUpdateViewer )
102 HYDROGUI_Shape::erase( theIsUpdateViewer );
103 myDisplayer->SetToUpdateColorScale();