]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
refs #569: scalar map coloring of Land Covers (scalar bar part)
authormzn <mzn@opencascade.com>
Wed, 24 Jun 2015 06:48:37 +0000 (09:48 +0300)
committermzn <mzn@opencascade.com>
Wed, 24 Jun 2015 06:48:37 +0000 (09:48 +0300)
14 files changed:
src/HYDROData/HYDROData_StricklerTable.cxx
src/HYDROData/HYDROData_StricklerTable.h
src/HYDROGUI/CMakeLists.txt
src/HYDROGUI/HYDROGUI_LandCoverColoringOp.cxx [new file with mode: 0644]
src/HYDROGUI/HYDROGUI_LandCoverColoringOp.h [new file with mode: 0644]
src/HYDROGUI/HYDROGUI_Module.cxx
src/HYDROGUI/HYDROGUI_Module.h
src/HYDROGUI/HYDROGUI_OCCDisplayer.cxx
src/HYDROGUI/HYDROGUI_OCCDisplayer.h
src/HYDROGUI/HYDROGUI_Operations.cxx
src/HYDROGUI/HYDROGUI_Operations.h
src/HYDROGUI/HYDROGUI_ShowHideOp.cxx
src/HYDROGUI/HYDROGUI_StricklerTableOp.cxx
src/HYDROGUI/resources/HYDROGUI_msg_en.ts

index 68995e824be7ab26e9824459bf25e8a1567d3a3c..0e68479d54660cb49495689a2cf3daf0e710de94 100644 (file)
@@ -130,6 +130,24 @@ void HYDROData_StricklerTable::Set( const TCollection_ExtendedString& theType, d
     aMap->SetReal( theType, theCoefficient );
 }
 
+void HYDROData_StricklerTable::GetCoefficientRange( double& theMin, double& theMax ) const
+{
+  theMin = 0;
+  theMax = 0;
+  
+  Handle(TDataStd_NamedData) aMap = Map();
+  Standard_Boolean isFirst = Standard_True;
+  for ( TDataStd_DataMapIteratorOfDataMapOfStringReal it( aMap->GetRealsContainer() ); it.More(); it.Next() ) {
+    Standard_Real aValue = it.Value();
+    if ( theMin == 0 || aValue < theMin ) {
+      theMin = aValue;
+    }
+    if ( theMax == 0 || aValue > theMax ) {
+      theMax = aValue;
+    }
+  }
+}
+
 TColStd_SequenceOfExtendedString HYDROData_StricklerTable::GetTypes() const
 {
     TColStd_SequenceOfExtendedString aSeq;
@@ -142,6 +160,13 @@ TColStd_SequenceOfExtendedString HYDROData_StricklerTable::GetTypes() const
     return aSeq;
 }
 
+bool HYDROData_StricklerTable::HasType( const TCollection_ExtendedString& theType ) const
+{
+  Handle(TDataStd_NamedData) aMap = Map();
+  
+  return !aMap.IsNull() && aMap->HasReal( theType );
+}
+
 void HYDROData_StricklerTable::Clear()
 {
     Handle(TDataStd_NamedData) aMap = Map();
index bbc553bec135c93187bd1ffeaf9fd418205d750a..856786c7d574a34af32be557b306b688abf39f3b 100644 (file)
@@ -51,8 +51,12 @@ public:
   HYDRODATA_EXPORT double Get( const TCollection_ExtendedString& theType, double theDefault ) const;
   HYDRODATA_EXPORT void Set( const TCollection_ExtendedString& theType, double theCoefficient );
 
+  HYDRODATA_EXPORT void GetCoefficientRange( double& theMin, double& theMax ) const;
+
   HYDRODATA_EXPORT TColStd_SequenceOfExtendedString GetTypes() const;
 
+  HYDRODATA_EXPORT bool HasType( const TCollection_ExtendedString& theType ) const;
+
   HYDRODATA_EXPORT void Clear();
 
   HYDRODATA_EXPORT virtual QStringList DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const;
index 4be75c780915e058d19f38132062ab040ff9013c..fce2c9e66ae3507b09c686ab1f831d28fd4ada0d 100644 (file)
@@ -130,6 +130,7 @@ set(PROJECT_HEADERS
     HYDROGUI_ObjListBox.h
     HYDROGUI_RecognizeContoursDlg.h
     HYDROGUI_RecognizeContoursOp.h
+    HYDROGUI_LandCoverColoringOp.h
 )
 
 QT4_WRAP_CPP(PROJECT_HEADERS_MOC ${PROJECT_HEADERS})
@@ -263,6 +264,7 @@ set(PROJECT_SOURCES
     HYDROGUI_ObjListBox.cxx
     HYDROGUI_RecognizeContoursDlg.cxx
     HYDROGUI_RecognizeContoursOp.cxx
+    HYDROGUI_LandCoverColoringOp.cxx
 )
 
 add_definitions(
diff --git a/src/HYDROGUI/HYDROGUI_LandCoverColoringOp.cxx b/src/HYDROGUI/HYDROGUI_LandCoverColoringOp.cxx
new file mode 100644 (file)
index 0000000..0cf45ce
--- /dev/null
@@ -0,0 +1,91 @@
+// 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, 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
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include "HYDROGUI_LandCoverColoringOp.h"
+
+#include "HYDROGUI_Module.h"
+#include "HYDROGUI_OCCDisplayer.h"
+#include "HYDROGUI_Operations.h"
+#include "HYDROGUI_Tool.h"
+#include "HYDROGUI_UpdateFlags.h"
+
+#include <HYDROData_Iterator.h>
+#include <HYDROData_Bathymetry.h>
+#include <HYDROData_StricklerTable.h>
+
+#include <LightApp_Application.h>
+
+#include <OCCViewer_ViewModel.h>
+#include <OCCViewer_ViewManager.h>
+
+
+HYDROGUI_LandCoverColoringOp::HYDROGUI_LandCoverColoringOp( HYDROGUI_Module* theModule, int theId )
+: HYDROGUI_Operation( theModule ),
+  myId( theId )
+{
+  QString aName;
+  switch( myId )
+  {
+    case LandCoverScalarMapModeOnId:  aName = tr( "LC_SCALARMAP_COLORING_ON" ); break;
+    case LandCoverScalarMapModeOffId: aName = tr( "LC_SCALARMAP_COLORING_OFF" ); break;
+    default: break;
+  }
+  setName( aName );
+}
+
+HYDROGUI_LandCoverColoringOp::~HYDROGUI_LandCoverColoringOp()
+{
+}
+
+void HYDROGUI_LandCoverColoringOp::startOperation()
+{
+  HYDROGUI_Operation::startOperation();
+
+  HYDROGUI_Module* aModule = module();
+
+  LightApp_Application* anApp = module()->getApp();
+  OCCViewer_ViewManager* aViewManager =
+    dynamic_cast<OCCViewer_ViewManager*>( anApp->getViewManager( OCCViewer_Viewer::Type(), true ) );
+
+  size_t aViewId = (size_t)aViewManager->getViewModel();
+
+  Handle(HYDROData_StricklerTable) aTable;
+
+  if ( myId == LandCoverScalarMapModeOnId ) {
+    aTable = Handle(HYDROData_StricklerTable)::DownCast( HYDROGUI_Tool::GetSelectedObject( module() ) );
+    if ( !aTable.IsNull() ) {
+      aModule->setLandCoverColoringTable( aViewId, aTable );
+    }
+  } else if ( myId == LandCoverScalarMapModeOffId ) {
+    aModule->setLandCoversScalarMapModeOff( aViewId );
+  }
+    
+  // Hide bathymetries
+  HYDROData_Iterator anIterator( doc(), KIND_BATHYMETRY );
+  for( ; anIterator.More(); anIterator.Next() ) {
+    Handle(HYDROData_Bathymetry) aBath =
+      Handle(HYDROData_Bathymetry)::DownCast( anIterator.Current() );  
+    if ( !aBath.IsNull() && aModule->isObjectVisible( aViewId, aBath ) ) {
+      aModule->setObjectVisible( aViewId, aBath, false );
+    }
+  }
+
+  aModule->getOCCDisplayer()->SetToUpdateColorScale();
+  aModule->update( UF_OCCViewer );
+  commit();
+}
diff --git a/src/HYDROGUI/HYDROGUI_LandCoverColoringOp.h b/src/HYDROGUI/HYDROGUI_LandCoverColoringOp.h
new file mode 100644 (file)
index 0000000..c931018
--- /dev/null
@@ -0,0 +1,44 @@
+// 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, 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
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef HYDROGUI_LandCoverColoringOp_H
+#define HYDROGUI_LandCoverColoringOp_H
+
+#include "HYDROGUI_Operation.h"
+
+/** 
+ * \class HYDROGUI_LandCoverColoringOp
+ * \brief The class intended for scalar map coloring of Land Covers
+ */
+class HYDROGUI_LandCoverColoringOp : public HYDROGUI_Operation
+{
+  Q_OBJECT
+
+public:
+
+  HYDROGUI_LandCoverColoringOp( HYDROGUI_Module* theModule, int theId );
+  virtual ~HYDROGUI_LandCoverColoringOp();
+
+protected:
+  virtual void startOperation();
+
+private:
+  int myId;
+};
+
+#endif
index 9127cb74a747cd7926b26e0583279c62fbf4f614..a340182ee10c4163b5d4d334cde6f3094248b6c1 100644 (file)
@@ -46,6 +46,7 @@
 #include <HYDROData_Profile.h>
 #include <HYDROData_Lambert93.h>
 #include <HYDROData_Polyline3D.h>
+#include <HYDROData_StricklerTable.h>
 
 #include <HYDROData_OperationsFactory.h>
 
@@ -479,7 +480,7 @@ void HYDROGUI_Module::contextMenuPopup( const QString& theClient,
     }
 
     if ( !anIsObjectCanBeColored )
-      anIsObjectCanBeColored = HYDROGUI_SetColorOp::CanObjectBeColored( anObject );
+      anIsObjectCanBeColored = HYDROGUI_SetColorOp::CanObjectBeColored( anObject, this );
   }
 
   // Check if all selected objects are profiles
@@ -653,6 +654,11 @@ void HYDROGUI_Module::contextMenuPopup( const QString& theClient,
         theMenu->addAction( action( ExportStricklerTableFromFileId ) );
         theMenu->addAction( action( DuplicateStricklerTableId ) );
         theMenu->addSeparator();
+
+        if ( !isLandCoversScalarMapModeOn( anActiveViewId ) ) {
+          theMenu->addAction( action( LandCoverScalarMapModeOnId ) );
+          theMenu->addSeparator();
+        }
       }
       else if( anIsLandCover )
       {
@@ -718,6 +724,11 @@ void HYDROGUI_Module::contextMenuPopup( const QString& theClient,
     theMenu->addSeparator();
     theMenu->addAction( action( SetZLevelId ) );
     theMenu->addSeparator();
+
+    if ( isLandCoversScalarMapModeOn( anActiveViewId ) ) {
+      theMenu->addAction( action( LandCoverScalarMapModeOffId ) );
+      theMenu->addSeparator();
+    }
   }
 
   if( anIsObjectBrowser || anIsGraphicsView || anIsOCCView || anIsVTKView )
@@ -1036,6 +1047,10 @@ void HYDROGUI_Module::setObjectVisible( const int theViewId,
         if ( visState != Qtx::UnpresentableState )
             treeModel->setVisibilityState( id, theState ? Qtx::ShownState : Qtx::HiddenState );
     }
+
+    if ( theObject->GetKind() == KIND_BATHYMETRY && theState ) {
+      setLandCoversScalarMapModeOff( theViewId );
+    }
   }
 }
 
@@ -1439,8 +1454,11 @@ void HYDROGUI_Module::onViewManagerRemoved( SUIT_ViewManager* theViewManager )
     if ( anOCCViewManager )
     {
       OCCViewer_Viewer* anOCCViewer = anOCCViewManager->getOCCViewer();
-      if ( anOCCViewer )
-        removeViewShapes( (size_t)anOCCViewer );
+      if ( anOCCViewer ) {
+        int aViewerId = (size_t)anOCCViewer;
+        removeViewShapes( aViewerId );
+        setLandCoversScalarMapModeOff( aViewerId );
+      }
     }
 
     if ( getVTKDisplayer()->IsApplicable( theViewManager ) )
@@ -1748,3 +1766,32 @@ void HYDROGUI_Module::onObjectClicked( SUIT_DataObject* theObject, int theColumn
 
   update( UF_OCCViewer | ( visState == Qtx::ShownState ? UF_FitAll : 0 ) );
 }
+
+Handle(HYDROData_StricklerTable) HYDROGUI_Module::getLandCoverColoringTable( const int theViewId ) const
+{
+  Handle(HYDROData_StricklerTable) aTable;
+
+  if ( myLandCoverColoringMap.contains( theViewId ) ) {
+    aTable = myLandCoverColoringMap.value( theViewId );
+  }
+
+  return aTable;
+}
+
+void HYDROGUI_Module::setLandCoverColoringTable( const int theViewId,
+                                                 const Handle(HYDROData_StricklerTable)& theTable )
+{
+  if ( !theTable.IsNull() ) {
+    myLandCoverColoringMap.insert( theViewId, theTable );
+  }
+}
+
+void HYDROGUI_Module::setLandCoversScalarMapModeOff( const int theViewId )
+{
+  myLandCoverColoringMap.remove( theViewId );
+}
+
+bool HYDROGUI_Module::isLandCoversScalarMapModeOn( const int theViewId ) const
+{
+  return myLandCoverColoringMap.contains( theViewId );
+}
index a1a0bd540b92a5e0e6dfa4a5cc640d0ab14738fa..3798c08d62a01fea7729a6b25c898e1291286927 100644 (file)
@@ -35,6 +35,8 @@ class SVTK_Viewer;
 class SUIT_ViewWindow;
 class SUIT_ViewManager;
 
+class Handle(HYDROData_StricklerTable);
+
 class HYDROGUI_DataModel;
 class HYDROGUI_Displayer;
 class HYDROGUI_OCCDisplayer;
@@ -109,6 +111,8 @@ public:
   typedef QList<HYDROGUI_VTKPrs*> ListOfVTKPrs;
   typedef QMap<int,ListOfVTKPrs> ViewId2ListOfVTKPrs;
 
+  typedef QMap<int, Handle(HYDROData_StricklerTable)> ViewId2StricklerTable;
+
 public:
   HYDROGUI_Module();
   virtual ~HYDROGUI_Module();
@@ -204,6 +208,34 @@ public:
    */
   QCursor                         getPrefEditCursor() const;
 
+  /**
+   * Returns Strickler table used for Land Cover scalar map coloring in the given view.
+   * @param theViewId the view id
+   * @return the Strickler table used for scalar map coloring of Land Covers in the given view;
+             null - if scalar map coloring is off for the view  
+   */
+  Handle(HYDROData_StricklerTable) getLandCoverColoringTable( const int theViewId ) const;
+
+  /**
+   * Set Strickler table to be used for Land Cover scalar map coloring in the given view.
+   * @param theViewId the view id
+   * @param theTable the Strickler table
+   */
+  void                             setLandCoverColoringTable( const int theViewId,
+                                                              const Handle(HYDROData_StricklerTable)& theTable );
+  /**
+   * Set Land Cover scalar map coloring mode off for the given view.
+   * @param theViewId the view id
+   */
+  void                             setLandCoversScalarMapModeOff( const int theViewId );
+
+  /**
+   * Check if Land Cover scalar map coloring mode is on in the given view.
+   * @param theViewId the view id
+   * @return true if the mode is on, false if the mode is off
+   */
+  bool                             isLandCoversScalarMapModeOn( const int theViewId ) const;
+
 protected:
   CAM_DataModel*                  createDataModel();
 
@@ -279,6 +311,8 @@ private:
   bool                            myIsUpdateEnabled;
 
   QStringList                     myGeomObjectsToImport; ///< entries of GEOM objects to be imported
+
+  ViewId2StricklerTable           myLandCoverColoringMap;
 };
 
 #endif
index 40256a51b2e6b54640a4812ff8cd00e5e8df8d62..5707d78b092e816914b72c652cd5ad5db5c82818 100644 (file)
 #include "HYDROGUI_Operation.h"
 #include "HYDROGUI_DataObject.h"
 #include "HYDROGUI_ZLayers.h"
+
 #include <HYDROData_Bathymetry.h>
+#include <HYDROData_LandCover.h>
+#include <HYDROData_StricklerTable.h>
 
 #include <AIS_InteractiveContext.hxx>
 #include <AIS_ListIteratorOfListOfInteractive.hxx>
@@ -402,14 +405,17 @@ void HYDROGUI_OCCDisplayer::UpdateColorScale( const OCCViewer_Viewer* theViewer
 {
   if( !myToUpdateColorScale )
     return;
-
+  
   OCCViewer_ViewWindow* aWnd = dynamic_cast<OCCViewer_ViewWindow*>( theViewer->getViewManager()->getActiveView() );
   Handle(V3d_View) aView = aWnd->getViewPort()->getView();
-
+    
   int aViewerId = (size_t)theViewer;//TODO: check if viewer id is correct
-  QList<HYDROGUI_Shape*> aShapes = module()->getObjectShapes( aViewerId, KIND_BATHYMETRY );
+  bool isLandCoverColoringOn = module()->isLandCoversScalarMapModeOn( aViewerId );
+    
+  QList<HYDROGUI_Shape*> aLandCoverShapes = module()->getObjectShapes( aViewerId, KIND_LAND_COVER );
+  QList<HYDROGUI_Shape*> aBathShapes = module()->getObjectShapes( aViewerId, KIND_BATHYMETRY );
 
-  bool isDisplayColorScale = !aShapes.empty();
+  bool isDisplayColorScale = !aBathShapes.empty() || isLandCoverColoringOn;
   Standard_Real anXPos = 0.05; //TODO
   Standard_Real anYPos = 0.1; //TODO
   Standard_Real aWidth = 0.2; //TODO
@@ -418,27 +424,42 @@ void HYDROGUI_OCCDisplayer::UpdateColorScale( const OCCViewer_Viewer* theViewer
   Standard_Integer aNbIntervals = 20; //TODO
   TCollection_ExtendedString aColorScaleTitle = "";//TODO
 
-  Standard_Real aColorScaleMin = 0, aColorScaleMax = 1, aMin, aMax;
-  bool isFirst = true;
-  foreach( HYDROGUI_Shape* aShape, aShapes )
-  {
-    HYDROGUI_ShapeBathymetry* aBathShape = dynamic_cast<HYDROGUI_ShapeBathymetry*>( aShape );
-    if( !aBathShape || !aBathShape->isVisible() )
-      continue;
+  Standard_Real aColorScaleMin = 0, aColorScaleMax = 1;
+
+  // Get range
+  Handle(HYDROData_StricklerTable) aTable;
+  TColStd_SequenceOfExtendedString aTableTypes;
+  if ( isLandCoverColoringOn ) {
+    aTable = module()->getLandCoverColoringTable( aViewerId );
+    if ( !aTable.IsNull() ) {
+      aColorScaleTitle = TCollection_ExtendedString( aTable->GetName().toLatin1().constData() );
+      aTable->GetCoefficientRange( aColorScaleMin, aColorScaleMax );
+      aTableTypes = aTable->GetTypes();
+    }
+  } else {
+    Standard_Real aMin, aMax;
+    bool isFirst = true;
+    foreach( HYDROGUI_Shape* aShape, aBathShapes )
+    {
+      HYDROGUI_ShapeBathymetry* aBathShape = dynamic_cast<HYDROGUI_ShapeBathymetry*>( aShape );
+      if( !aBathShape || !aBathShape->isVisible() )
+        continue;
 
-    aBathShape->GetRange( aMin, aMax );
+      aBathShape->GetRange( aMin, aMax );
 
-    if( isFirst || aMin < aColorScaleMin )
-      aColorScaleMin = aMin;
-    if( isFirst || aMax > aColorScaleMax )
-      aColorScaleMax = aMax;
+      if( isFirst || aMin < aColorScaleMin )
+        aColorScaleMin = aMin;
+      if( isFirst || aMax > aColorScaleMax )
+        aColorScaleMax = aMax;
 
-    isFirst = false;
+      isFirst = false;
+    }
   }
 
+  Handle(Aspect_ColorScale) aColorScale;
   if( isDisplayColorScale )
   {
-    Handle(Aspect_ColorScale) aColorScale = aView->ColorScale();
+    aColorScale = aView->ColorScale();
     if( !aColorScale.IsNull() )
     {
       aColorScale->SetXPosition( anXPos );
@@ -452,13 +473,14 @@ void HYDROGUI_OCCDisplayer::UpdateColorScale( const OCCViewer_Viewer* theViewer
       aColorScale->SetTitle( aColorScaleTitle );
       aColorScale->SetRange( aColorScaleMin, aColorScaleMax );
 
-      foreach( HYDROGUI_Shape* aShape, aShapes )
-      {
-        HYDROGUI_ShapeBathymetry* aBathShape = dynamic_cast<HYDROGUI_ShapeBathymetry*>( aShape );
-        if( !aBathShape || !aBathShape->isVisible() )
-          continue;
+      if ( !isLandCoverColoringOn ) {
+        foreach( HYDROGUI_Shape* aShape, aBathShapes ) {
+          HYDROGUI_ShapeBathymetry* aBathShape = dynamic_cast<HYDROGUI_ShapeBathymetry*>( aShape );
+          if( !aBathShape || !aBathShape->isVisible() )
+            continue;
 
-        aBathShape->UpdateWithColorScale( aColorScale );
+          aBathShape->UpdateWithColorScale( aColorScale );
+        }
       }
     }
     if( !aView->ColorScaleIsDisplayed() )
@@ -470,5 +492,40 @@ void HYDROGUI_OCCDisplayer::UpdateColorScale( const OCCViewer_Viewer* theViewer
       aView->ColorScaleErase();
   }
 
+  bool isScaleColoringOn = isDisplayColorScale && !aColorScale.IsNull();
+  foreach( HYDROGUI_Shape* aShape, aLandCoverShapes ) {
+    if ( !aShape || !aShape->isVisible() ) {
+      continue;
+    }
+
+    Handle(HYDROData_LandCover) aLandCover = 
+      Handle(HYDROData_LandCover)::DownCast( aShape->getObject() );
+
+    if ( aLandCover.IsNull() ) {
+      continue;
+    }
+
+    QColor aUndefinedColor( Qt::gray );
+    QColor aColor = isLandCoverColoringOn ? aUndefinedColor : aLandCover->GetFillingColor();
+    
+    if ( isLandCoverColoringOn && !aTable.IsNull() ) {
+      TCollection_ExtendedString aStricklerType = 
+        aLandCover->GetStricklerType().toLatin1().constData();
+     
+      if ( aTable->HasType( aStricklerType ) ) {
+        double aStricklerCoeff = aTable->Get( aStricklerType, 0 );
+        Quantity_Color aShapeColor;
+        if ( aColorScale->FindColor( aStricklerCoeff, aShapeColor ) ) {
+          aColor = QColor( aShapeColor.Red() * 255, 
+                           aShapeColor.Green() * 255,
+                           aShapeColor.Blue() * 255 );
+        }
+      }
+    }
+    
+    //@MZN aShape->update( false, false );
+    aShape->setFillingColor( aColor, true, true );
+  }
+
   myToUpdateColorScale = false;
 }
index bd89dfe291095c74e7b7112e713a80642ede679e..b454518df71d61c18382af2604aa433b2434ec6b 100644 (file)
@@ -109,7 +109,7 @@ protected:
   void                            purgeObjects( const int theViewerId );
 
   void UpdateColorScale( const OCCViewer_Viewer* );
-
+  
 private:
   /**
    * \brief Creates new OCC shape.
index 57d8f8185ad5e591ea4f3730ed11ae7c133a3bcc..ad34f778a3fed7121b7017a1218ef59bc1e24e0f 100644 (file)
@@ -66,6 +66,7 @@
 #include "HYDROGUI_ExportSinusXOp.h"
 #include "HYDROGUI_MergePolylinesOp.h"
 #include "HYDROGUI_SplitPolylinesOp.h"
+#include "HYDROGUI_LandCoverColoringOp.h"
 
 #include <HYDROData_Document.h>
 #include <HYDROData_Obstacle.h>
@@ -213,6 +214,9 @@ void HYDROGUI_Module::createActions()
 
   createAction( SplitPolylinesId, "SPLIT_POLYLINES", "SPLIT_POLYLINES_ICO" );
   createAction( MergePolylinesId, "MERGE_POLYLINES", "MERGE_POLYLINES_ICO" );
+
+  createAction( LandCoverScalarMapModeOnId, "LC_SCALARMAP_COLORING_ON" );
+  createAction( LandCoverScalarMapModeOffId, "LC_SCALARMAP_COLORING_OFF" );
 }
 
 void HYDROGUI_Module::createMenus()
@@ -607,6 +611,10 @@ LightApp_Operation* HYDROGUI_Module::createOperation( const int theId ) const
   case MergePolylinesId:
     anOp = new HYDROGUI_MergePolylinesOp( aModule );
     break;
+  case LandCoverScalarMapModeOnId:
+  case LandCoverScalarMapModeOffId:
+    anOp = new HYDROGUI_LandCoverColoringOp( aModule, theId );
+    break;
   }
 
   if( !anOp )
index b03423b96c42d3aee1d74f5509a402bfe5306557..5d5c73bbf34511d4aec52dc6ee5a6d241b284d5c 100644 (file)
@@ -126,6 +126,9 @@ enum OperationId
 
   SplitPolylinesId,
   MergePolylinesId,
+
+  LandCoverScalarMapModeOnId,
+  LandCoverScalarMapModeOffId
 };
 
 #endif
index 066d0190f2bb90ba836c3c300cc40785c31fce2f..16be7aff3764b5a5c74b14143d9cb6c9ab099a2a 100644 (file)
@@ -21,6 +21,7 @@
 #include <GraphicsView_Viewer.h>
 
 #include "HYDROGUI_Module.h"
+#include "HYDROGUI_OCCDisplayer.h"
 #include "HYDROGUI_Operations.h"
 #include "HYDROGUI_Tool.h"
 #include "HYDROGUI_UpdateFlags.h"
@@ -171,6 +172,8 @@ void HYDROGUI_ShowHideOp::startOperation()
       anUpdateFlags |= UF_FitAll;
   }
 
+  aModule->getOCCDisplayer()->SetToUpdateColorScale(); //@MZN
+
   // Set VTK viewer active if show a bathymetry
   if ( aVTKMgr )
   {
index 7f021249af4ac11fc8a8be0fdbb1fcebf164a77d..dc915f301f4464604900e1599bb46733598c7bf5 100644 (file)
 
 #include "HYDROGUI_StricklerTableDlg.h"
 #include "HYDROGUI_DataObject.h"
+#include "HYDROGUI_Module.h"
+#include "HYDROGUI_OCCDisplayer.h"
 #include "HYDROGUI_Operations.h"
 #include "HYDROGUI_Tool.h"
+#include "HYDROGUI_UpdateFlags.h"
 
 #include <HYDROData_Document.h>
 
@@ -181,9 +184,11 @@ bool HYDROGUI_StricklerTableOp::processApply( int& theUpdateFlags, QString& theE
     {
         QString anEntry = HYDROGUI_DataObject::dataObjectEntry( aStricklerTableObj );
         theBrowseObjectsEntries.append( anEntry );
+    } else {
+      module()->getOCCDisplayer()->SetToUpdateColorScale();
     }
 
-    theUpdateFlags |= UF_ObjBrowser;
+    theUpdateFlags |= UF_ObjBrowser | UF_OCCViewer;
 
     return true;
 }
index ab66dc7f5ffe25771cb8ee9b587474d5221af742..5ad6ad6356f04b1a7ba4211543af7a995698cb02 100644 (file)
@@ -1668,6 +1668,32 @@ Would you like to remove all references from the image?</translation>
       <translation>Recognize contours</translation>
     </message>
 
+    <message>
+      <source>MEN_LC_SCALARMAP_COLORING_ON</source>
+      <translation>Use as scalar scale</translation>
+    </message>
+    <message>
+      <source>DSK_LC_SCALARMAP_COLORING_ON</source>
+      <translation>Use the table as a scalar scale for Land Covers coloring</translation>
+    </message>
+    <message>
+      <source>STB_LC_SCALARMAP_COLORING_ON</source>
+      <translation>Use as scalar scale</translation>
+    </message>
+
+    <message>
+      <source>MEN_LC_SCALARMAP_COLORING_OFF</source>
+      <translation>Scalar map mode off</translation>
+    </message>
+    <message>
+      <source>DSK_LC_SCALARMAP_COLORING_OFF</source>
+      <translation>Turn off Land Covers scalar map coloring mode</translation>
+    </message>
+    <message>
+      <source>STB_LC_SCALARMAP_COLORING_OFF</source>
+      <translation>Scalar map mode off</translation>
+    </message>
+
   </context>
   
   <context>