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_ShapeLandCover.h"
20 #include "HYDROGUI_OCCDisplayer.h"
22 #include <HYDROData_LandCover.h>
24 #include <AIS_InteractiveContext.hxx>
26 HYDROGUI_ShapeLandCover::HYDROGUI_ShapeLandCover( HYDROGUI_OCCDisplayer* theDisplayer,
27 const Handle(AIS_InteractiveContext)& theContext,
28 const Handle_HYDROData_LandCover& theLandCover,
30 const bool theIsScalarMode )
31 : HYDROGUI_Shape( theContext, theLandCover, theZLayer ),
32 myDisplayer( theDisplayer ),
33 myIsScalarMapMode( theIsScalarMode )
37 HYDROGUI_ShapeLandCover::~HYDROGUI_ShapeLandCover()
41 void HYDROGUI_ShapeLandCover::update( bool theIsUpdateViewer, bool isDeactivateSelection )
43 setIsToUpdate( false );
45 Handle(HYDROData_LandCover) aLandCoverObj =
46 Handle(HYDROData_LandCover)::DownCast( getObject() );
48 TopoDS_Shape aLandCoverShape = aLandCoverObj->GetShape();
49 if ( !aLandCoverShape.IsNull() ) {
50 setShape( aLandCoverShape, false, false );
53 if ( !myIsScalarMapMode ) {
54 QColor aFillingColor = aLandCoverObj->GetFillingColor();
55 QColor aBorderColor = aLandCoverObj->GetBorderColor();
57 setFillingColor( aFillingColor, false, false );
58 setBorderColor( aBorderColor, false, false );
60 updateShape( false, false );
63 HYDROGUI_Shape::update( theIsUpdateViewer, isDeactivateSelection );
66 void HYDROGUI_ShapeLandCover::setScalarMapModeEnabled( const bool theIsToEnable )
68 myIsScalarMapMode = theIsToEnable;
71 void HYDROGUI_ShapeLandCover::setVisible( const bool theState,
72 const bool theIsUpdateViewer )
74 HYDROGUI_Shape::setVisible( theState, theIsUpdateViewer );
75 myDisplayer->SetToUpdateColorScale();
78 void HYDROGUI_ShapeLandCover::displayShape( const bool theIsUpdateViewer )
80 HYDROGUI_Shape::displayShape( theIsUpdateViewer );
81 myDisplayer->SetToUpdateColorScale();
84 void HYDROGUI_ShapeLandCover::display( const bool theIsUpdateViewer )
86 HYDROGUI_Shape::display( theIsUpdateViewer );
87 myDisplayer->SetToUpdateColorScale();
90 void HYDROGUI_ShapeLandCover::erase( const bool theIsUpdateViewer )
92 HYDROGUI_Shape::erase( theIsUpdateViewer );
93 myDisplayer->SetToUpdateColorScale();