]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
refs #569: Land Covers should not be colored manually in scalar map mode
authormzn <mzn@opencascade.com>
Wed, 24 Jun 2015 07:05:00 +0000 (10:05 +0300)
committermzn <mzn@opencascade.com>
Wed, 24 Jun 2015 07:05:00 +0000 (10:05 +0300)
src/HYDROGUI/HYDROGUI_SetColorOp.cxx
src/HYDROGUI/HYDROGUI_SetColorOp.h

index 45b88dee547714b95df652013d88289608f6d0db..cca862a65321795e3a2e95ffa53e82f40740c2d8 100644 (file)
@@ -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;
index ceb6f7ac56f7b021b6f97ecd89751ecf64f3485b..cd9affd8b01c98dfbc0b424334f75a12c222d50d 100644 (file)
@@ -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();