From: mzn Date: Wed, 24 Jun 2015 07:05:00 +0000 (+0300) Subject: refs #569: Land Covers should not be colored manually in scalar map mode X-Git-Tag: v1.4.2~42 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=07bc10851fc7e6470b7e9440d1ea6afa1bce1435;p=modules%2Fhydro.git refs #569: Land Covers should not be colored manually in scalar map mode --- diff --git a/src/HYDROGUI/HYDROGUI_SetColorOp.cxx b/src/HYDROGUI/HYDROGUI_SetColorOp.cxx index 45b88dee..cca862a6 100644 --- a/src/HYDROGUI/HYDROGUI_SetColorOp.cxx +++ b/src/HYDROGUI/HYDROGUI_SetColorOp.cxx @@ -44,14 +44,21 @@ HYDROGUI_SetColorOp::~HYDROGUI_SetColorOp() { } -bool HYDROGUI_SetColorOp::CanObjectBeColored( const Handle(HYDROData_Entity)& theObject ) +bool HYDROGUI_SetColorOp::CanObjectBeColored( const Handle(HYDROData_Entity)& theObject, + HYDROGUI_Module* theModule ) { if ( theObject.IsNull() ) return false; - return theObject->IsKind( STANDARD_TYPE(HYDROData_Object) ) || - theObject->IsKind( STANDARD_TYPE(HYDROData_IPolyline) ) || - theObject->IsKind( STANDARD_TYPE(HYDROData_LandCover) ); + bool isCanBeColored = false; + if ( theObject->IsKind( STANDARD_TYPE(HYDROData_LandCover) ) ) { + size_t anActiveViewId = HYDROGUI_Tool::GetActiveOCCViewId( theModule ); + isCanBeColored = !theModule->isLandCoversScalarMapModeOn( anActiveViewId ); + } + + return isCanBeColored || + theObject->IsKind( STANDARD_TYPE(HYDROData_Object) ) || + theObject->IsKind( STANDARD_TYPE(HYDROData_IPolyline) ); } void HYDROGUI_SetColorOp::startOperation() @@ -61,7 +68,7 @@ void HYDROGUI_SetColorOp::startOperation() // Get the selected object //myEditedObject = Handle(HYDROData_Object)::DownCast( HYDROGUI_Tool::GetSelectedObject( module() ) ); myEditedObject = HYDROGUI_Tool::GetSelectedObject( module() ); - if ( !CanObjectBeColored( myEditedObject ) ) + if ( !CanObjectBeColored( myEditedObject, module() ) ) { abort(); return; diff --git a/src/HYDROGUI/HYDROGUI_SetColorOp.h b/src/HYDROGUI/HYDROGUI_SetColorOp.h index ceb6f7ac..cd9affd8 100644 --- a/src/HYDROGUI/HYDROGUI_SetColorOp.h +++ b/src/HYDROGUI/HYDROGUI_SetColorOp.h @@ -34,7 +34,8 @@ public: virtual ~HYDROGUI_SetColorOp(); - static bool CanObjectBeColored( const Handle(HYDROData_Entity)& theObject ); + static bool CanObjectBeColored( const Handle(HYDROData_Entity)& theObject, + HYDROGUI_Module* theModule ); protected: virtual void startOperation();