X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FHYDROGUI%2FHYDROGUI_ShapeLandCoverMap.cxx;h=de07a5b555496cf2dde81591a3fec57647b5b384;hb=4d7943ad749b1b6345aa54907d859dc4b3606900;hp=fddf6e7002960b2da991481b2cfc64b85099781b;hpb=9c947f35615e69e9e54a8c4b074dd1f2be13689c;p=modules%2Fhydro.git diff --git a/src/HYDROGUI/HYDROGUI_ShapeLandCoverMap.cxx b/src/HYDROGUI/HYDROGUI_ShapeLandCoverMap.cxx index fddf6e70..de07a5b5 100644 --- a/src/HYDROGUI/HYDROGUI_ShapeLandCoverMap.cxx +++ b/src/HYDROGUI/HYDROGUI_ShapeLandCoverMap.cxx @@ -19,6 +19,14 @@ #include "HYDROGUI_ShapeLandCoverMap.h" #include "HYDROGUI_OCCDisplayer.h" #include "HYDROGUI_LandCoverMapPrs.h" +#include "HYDROGUI_Tool.h" +#include "HYDROGUI_Module.h" + +#include +#include +#include +#include +#include #include @@ -33,6 +41,7 @@ HYDROGUI_ShapeLandCoverMap::HYDROGUI_ShapeLandCoverMap( HYDROGUI_OCCDisplayer* t myDisplayer( theDisplayer ), myIsScalarMapMode( theIsScalarMode ) { + setFillingColor( QColor(), false, false ); } HYDROGUI_ShapeLandCoverMap::~HYDROGUI_ShapeLandCoverMap() @@ -51,16 +60,9 @@ void HYDROGUI_ShapeLandCoverMap::update( bool theIsUpdateViewer, bool isDeactiva setShape( aLandCoverMapShape, false, false ); } - if ( !myIsScalarMapMode ) { - // TODO - QColor aFillingColor = Qt::gray;//aLandCoverMapObj->GetFillingColor(); - QColor aBorderColor = Qt::black;//aLandCoverMapObj->GetBorderColor(); - - setFillingColor( aFillingColor, false, false ); - setBorderColor( aBorderColor, false, false ); - } else { - updateShape( false, false ); - } + Handle(HYDROGUI_LandCoverMapPrs) aLandCoverMapPrs = Handle(HYDROGUI_LandCoverMapPrs)::DownCast( getAISObject() ); + if ( !aLandCoverMapPrs.IsNull() ) + aLandCoverMapPrs->UpdateColors(); HYDROGUI_Shape::update( theIsUpdateViewer, isDeactivateSelection ); } @@ -68,6 +70,7 @@ void HYDROGUI_ShapeLandCoverMap::update( bool theIsUpdateViewer, bool isDeactiva void HYDROGUI_ShapeLandCoverMap::setScalarMapModeEnabled( const bool theIsToEnable ) { myIsScalarMapMode = theIsToEnable; + update( false, false ); } void HYDROGUI_ShapeLandCoverMap::setVisible( const bool theState, @@ -87,7 +90,38 @@ Handle_AIS_InteractiveObject HYDROGUI_ShapeLandCoverMap::createShape() const { Handle(HYDROData_LandCoverMap) aLandCoverMap = Handle(HYDROData_LandCoverMap)::DownCast( getObject() ); if ( !aLandCoverMap.IsNull() ) - return new HYDROGUI_LandCoverMapPrs( aLandCoverMap ); + { + Handle(HYDROGUI_LandCoverMapPrs) aLandCoverMapPrs = new HYDROGUI_LandCoverMapPrs( aLandCoverMap ); + if ( myIsScalarMapMode ) + { + LightApp_Application* anApp = myDisplayer->module()->getApp(); + OCCViewer_ViewManager* aViewManager = ::qobject_cast( + anApp->getViewManager( OCCViewer_Viewer::Type(), true ) ); + if ( aViewManager ) + { + if ( OCCViewer_Viewer* aViewer = aViewManager->getOCCViewer() ) + { + int aViewerId = (size_t)aViewer; + + // Set Strickler table + Handle(HYDROData_StricklerTable) aTable = + myDisplayer->module()->getLandCoverColoringTable( aViewerId ); + if( !aTable.IsNull() ) + aLandCoverMapPrs->SetTable( aTable ); + + // Set color scale + OCCViewer_ViewWindow* aWnd = dynamic_cast( aViewer->getViewManager()->getActiveView() ); + Handle(V3d_View) aView = aWnd->getViewPort()->getView(); + if( !aView.IsNull() ) + { + Handle(Aspect_ColorScale) aColorScale = aView->ColorScale(); + aLandCoverMapPrs->SetColorScale( aColorScale ); + } + } + } + } + return aLandCoverMapPrs; + } return NULL; }