Salome HOME
Merge branch 'BR_v14_rc' of ssh://git.salome-platform.org/modules/hydro into BR_v14_rc
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_SetColorOp.cxx
index fa24977fa50617448340f140640f298382b402cf..45b88dee547714b95df652013d88289608f6d0db 100644 (file)
@@ -1,12 +1,8 @@
-// Copyright (C) 2007-2013  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
+// Copyright (C) 2014-2015  EDF-R&D
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
 // License as published by the Free Software Foundation; either
-// version 2.1 of the License.
+// version 2.1 of the License, or (at your option) any later version.
 //
 // This library is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -30,6 +26,7 @@
 
 #include <HYDROData_Object.h>
 #include <HYDROData_IPolyline.h>
+#include <HYDROData_LandCover.h>
 
 #include <LightApp_Application.h>
 #include <LightApp_UpdateFlags.h>
@@ -53,7 +50,8 @@ bool HYDROGUI_SetColorOp::CanObjectBeColored( const Handle(HYDROData_Entity)& th
     return false;
 
   return theObject->IsKind( STANDARD_TYPE(HYDROData_Object) ) ||
-         theObject->IsKind( STANDARD_TYPE(HYDROData_IPolyline) );
+         theObject->IsKind( STANDARD_TYPE(HYDROData_IPolyline) ) ||
+         theObject->IsKind( STANDARD_TYPE(HYDROData_LandCover) );
 }
 
 void HYDROGUI_SetColorOp::startOperation()
@@ -99,6 +97,14 @@ void HYDROGUI_SetColorOp::startOperation()
 
     anIsOneColor = true;
   }
+  else if ( myEditedObject->IsKind( STANDARD_TYPE(HYDROData_LandCover) ) )
+  {
+    Handle(HYDROData_LandCover) aLandCover =
+      Handle(HYDROData_LandCover)::DownCast( myEditedObject );
+
+    aFirstColor = aLandCover->GetFillingColor();
+    aSecondColor = aLandCover->GetBorderColor();
+  }
 
   // Create color dialog
   myColorDlg = new HYDROGUI_ColorDlg( module()->getApp()->desktop(), anIsOneColor );
@@ -118,7 +124,8 @@ void HYDROGUI_SetColorOp::startOperation()
 }
 
 bool HYDROGUI_SetColorOp::processApply( int& theUpdateFlags,
-                                        QString& theErrorMsg )
+                                        QString& theErrorMsg,
+                                        QStringList& theBrowseObjectsEntries )
 {
   if ( !myColorDlg || myEditedObject.IsNull() )
     return false;
@@ -149,6 +156,14 @@ bool HYDROGUI_SetColorOp::processApply( int& theUpdateFlags,
 
     aPolyObject->SetWireColor( aFirstColor );
   }
+  else if ( myEditedObject->IsKind( STANDARD_TYPE(HYDROData_LandCover) ) )
+  {
+    Handle(HYDROData_LandCover) aLandCover =
+      Handle(HYDROData_LandCover)::DownCast( myEditedObject );
+
+    aLandCover->SetFillingColor( aFirstColor );
+    aLandCover->SetBorderColor( aSecondColor );
+  }
 
   module()->setIsToUpdate( myEditedObject );