Salome HOME
Merge remote-tracking branch 'origin/BR_1323_0' into BR_2017
authorasl <asl@opencascade.com>
Tue, 7 Nov 2017 12:29:06 +0000 (15:29 +0300)
committerasl <asl@opencascade.com>
Tue, 7 Nov 2017 12:29:06 +0000 (15:29 +0300)
# Conflicts:
# src/HYDROGUI/CMakeLists.txt
# src/HYDROGUI/HYDROGUI_Operations.cxx
# src/HYDROGUI/HYDROGUI_Operations.h

22 files changed:
src/HYDROGUI/CMakeLists.txt
src/HYDROGUI/HYDROGUI_DataModel.cxx
src/HYDROGUI/HYDROGUI_DataObject.cxx
src/HYDROGUI/HYDROGUI_Module.cxx
src/HYDROGUI/HYDROGUI_Operations.cxx
src/HYDROGUI/HYDROGUI_Operations.h
src/HYDROGUI/HYDROGUI_SubmersibleOp.cxx
src/HYDROGUI/HYDROGUI_Tool2.cxx
src/HYDROGUI/HYDROGUI_Tool2.h
src/HYDROGUI/HYDROGUI_UnSubmersibleOp.cxx [new file with mode: 0644]
src/HYDROGUI/HYDROGUI_UnSubmersibleOp.h [new file with mode: 0644]
src/HYDROGUI/HYDROGUI_ZoneTool.cxx [new file with mode: 0644]
src/HYDROGUI/HYDROGUI_ZoneTool.h [new file with mode: 0644]
src/HYDROGUI/resources/HYDROGUI_images.ts
src/HYDROGUI/resources/HYDROGUI_msg_en.ts
src/HYDROGUI/resources/icon_imm_uns_zone.png [new file with mode: 0644]
src/HYDROGUI/resources/icon_mimm_uns_zone.png [new file with mode: 0644]
src/HYDROGUI/resources/icon_sumb_16.png [new file with mode: 0644]
src/HYDROGUI/resources/icon_unsumb_16.png [new file with mode: 0644]
src/HYDRO_tests/ExternalFiles.cmake
src/HYDRO_tests/reference_data/CMakeLists.txt
src/HYDRO_tests/reference_data/zone_random_colors.png [new file with mode: 0644]

index 3d0a360755466200f527c572a0aeb3ed9b01f19d..e090945181dfcf802fc75b6f68e52c49d99570e4 100644 (file)
@@ -96,6 +96,7 @@ set(PROJECT_HEADERS
     HYDROGUI_StricklerTableOp.h
     HYDROGUI_StricklerTypeComboBox.h
     HYDROGUI_SubmersibleOp.h
+    HYDROGUI_UnSubmersibleOp.h
     HYDROGUI_Tool.h
     HYDROGUI_Tool2.h
     HYDROGUI_TwoImagesDlg.h
@@ -149,6 +150,8 @@ set(PROJECT_HEADERS
     HYDROGUI_Overview.h
     HYDROGUI_PolylineStyleOp.h
     HYDROGUI_PolylineStyleDlg.h
+    HYDROGUI_ZoneTool.h
+       HYDROGUI_RegenerateRegionColorsOp.h
 )
 
 QT_WRAP_MOC(PROJECT_HEADERS_MOC ${PROJECT_HEADERS})
@@ -246,6 +249,7 @@ set(PROJECT_SOURCES
     HYDROGUI_SplitPolylinesDlg.cxx
     HYDROGUI_SplitPolylinesOp.cxx
     HYDROGUI_SubmersibleOp.cxx
+    HYDROGUI_UnSubmersibleOp.cxx
     HYDROGUI_Tool.cxx
     HYDROGUI_Tool2.cxx
     HYDROGUI_TwoImagesDlg.cxx
@@ -300,6 +304,8 @@ set(PROJECT_SOURCES
     HYDROGUI_Overview.cxx
     HYDROGUI_PolylineStyleOp.cxx
     HYDROGUI_PolylineStyleDlg.cxx
+    HYDROGUI_ZoneTool.cxx
+       HYDROGUI_RegenerateRegionColorsOp.cxx
 )
 
 add_definitions(
index 63249c73daedf1b515ce767a6c1ffe8181ec9a77..95862a4d423727f9ff39bd971250d6c0b08002c3 100644 (file)
@@ -713,6 +713,7 @@ QString HYDROGUI_DataModel::partitionName( const ObjectKind theObjectKind )
     case KIND_NATURAL_OBJECT:    return "NATURAL_OBJECTS";
     case KIND_STRICKLER_TABLE:   return "STRICKLER_TABLES";
     case KIND_LAND_COVER_MAP:    return "LAND_COVER_MAPS";
+    case KIND_REGION:            return "REGIONS";
     default: break;
   }
   return QString();
index ffaefe8310e87cec6bf41946c0397ce212f8b349..116afcc2ee641cd2b2aa1a816ef9c668384788b3 100644 (file)
 #include "HYDROGUI_DataObject.h"
 
 #include <HYDROData_DummyObject3D.h>
+#include <HYDROData_ImmersibleZone.h>
 #include <HYDROData_Object.h>
+#include <HYDROData_ArtificialObject.h>
+#include <HYDROData_NaturalObject.h>
 
 #include <TDF_Tool.hxx>
 
@@ -32,6 +35,7 @@
 #include <SUIT_Study.h>
 
 #include <QPixmap>
+#include <QPainter>
 
 HYDROGUI_DataObject::HYDROGUI_DataObject( SUIT_DataObject* theParent, 
                                           Handle(HYDROData_Entity) theData,
@@ -144,6 +148,15 @@ QPixmap HYDROGUI_DataObject::icon( const int theId ) const
   {
     QString anIcon;
     Handle(HYDROData_Entity) aDataObject = modelObject();
+    Handle(HYDROData_Object) anObject;
+    Handle(HYDROData_ArtificialObject) anAObject = Handle( HYDROData_ArtificialObject )::DownCast(aDataObject);
+    Handle(HYDROData_NaturalObject) aNObject = Handle( HYDROData_NaturalObject )::DownCast(aDataObject);
+    
+    if (!anAObject.IsNull())
+      anObject = anAObject;
+    if (!aNObject.IsNull())
+      anObject = aNObject;
+
     if( aDataObject.IsNull() )
     {
       anIcon = QObject::tr( "HYDRO_TYPE0_ICO" ); // KIND_UNKNOWN
@@ -153,6 +166,7 @@ QPixmap HYDROGUI_DataObject::icon( const int theId ) const
       QString aNeedUpdate( aDataObject->IsMustBeUpdated( HYDROData_Entity::Geom_All ) ? "M_" : "" );
 
       int anObjectKind = (int)aDataObject->GetKind();
+      bool IsUnsImmZone = false;
       if ( anObjectKind == KIND_DUMMY_3D )
       {
         Handle(HYDROData_DummyObject3D) anObject3D = 
@@ -162,8 +176,29 @@ QPixmap HYDROGUI_DataObject::icon( const int theId ) const
         if ( !aFatherObj.IsNull() )
           anObjectKind = aFatherObj->GetKind();
       }
-
-      anIcon = QObject::tr( QString("HYDRO_%1TYPE%2_ICO").arg( aNeedUpdate ).arg( anObjectKind ).toLatin1() );
+      else if ( !anObject.IsNull() )
+      {
+        bool IsSubm = anObject->IsSubmersible();
+        QString anIcon1 = QObject::tr( QString("HYDRO_%1TYPE%2_ICO").arg( aNeedUpdate ).arg( anObjectKind ).toLatin1() );
+        QString anIcon2;
+        if (IsSubm) 
+          anIcon2 = QObject::tr( QString("HYDRO_SUBMERSIBLE16_ICO").toLatin1());
+        else
+          anIcon2 = QObject::tr( QString("HYDRO_UNSUBMERSIBLE16_ICO").toLatin1());
+
+        QPixmap qpm1 = aResMgr->loadPixmap( "HYDRO", anIcon1 );
+        QPixmap qpm2 = aResMgr->loadPixmap( "HYDRO", anIcon2 );
+        QPixmap qpmD(32,16);
+        qpmD.fill(QColor(0,0,0));
+        QPainter painter;
+        painter.begin(&qpmD);
+        painter.drawPixmap(0, 0, qpm1);
+        painter.drawPixmap(16, 0, qpm2);
+        painter.end();
+        return qpmD;
+      }
+      else
+        anIcon = QObject::tr( QString("HYDRO_%1TYPE%2_ICO").arg( aNeedUpdate ).arg( anObjectKind ).toLatin1() );
     }
 
     return aResMgr->loadPixmap( "HYDRO", anIcon );
index 3a3d2b642aa51a645537b710c5f555b7a8b54097..c21abdfc7e6d1919df266a149ed60ac297ff0233 100644 (file)
@@ -49,6 +49,8 @@
 #include <HYDROData_Lambert93.h>
 #include <HYDROData_Polyline3D.h>
 #include <HYDROData_StricklerTable.h>
+#include <HYDROData_ArtificialObject.h>
+#include <HYDROData_NaturalObject.h>
 
 #include <HYDROData_OperationsFactory.h>
 
@@ -568,6 +570,14 @@ void HYDROGUI_Module::contextMenuPopup( const QString& theClient,
       }
       theMenu->addSeparator();
     }
+    else
+    {
+      Handle(HYDROData_CalculationCase) aCalcCase;
+      QString outStr;
+      HYDROGUI_Tool::IsSelectedPartOfCalcCase(this, aCalcCase, outStr);
+      if (outStr == HYDROGUI_DataModel::partitionName( KIND_REGION ))
+        theMenu->addAction( action( RegenerateRegionColorsId ) );
+    }
   }
 
   if( anIsSelectedDataObjects )
@@ -810,13 +820,32 @@ void HYDROGUI_Module::contextMenuPopup( const QString& theClient,
   {
     if( aSeq.Size() > 0 )
     {
-      Handle( HYDROData_Object ) anObject = Handle( HYDROData_Object )::DownCast( aSeq.First() );
+      Handle( HYDROData_Entity ) aFirstEnt = aSeq.First();
+      Handle(HYDROData_Object) anObject;
+      Handle(HYDROData_ArtificialObject) anAObject = Handle( HYDROData_ArtificialObject )::DownCast(aFirstEnt);
+      Handle(HYDROData_NaturalObject) aNObject = Handle( HYDROData_NaturalObject )::DownCast(aFirstEnt);
+
+      if (!anAObject.IsNull())
+        anObject = anAObject;
+      if (!aNObject.IsNull())
+        anObject = aNObject;
+
       if( !anObject.IsNull() )
       {
         theMenu->addSeparator();
-        theMenu->addAction( action( SubmersibleId ) );
-        action( SubmersibleId )->setCheckable( true );
-        action( SubmersibleId )->setChecked( anObject->IsSubmersible() );
+        bool IsSubmersible = anObject->IsSubmersible();
+        if (!IsSubmersible)
+        {
+          theMenu->addAction( action( SubmersibleId ) );
+          action( SubmersibleId )->setCheckable(true);
+          action( SubmersibleId )->setChecked(true);
+        }
+        else
+        {
+          theMenu->addAction( action( UnSubmersibleId ) );
+          action( UnSubmersibleId )->setCheckable(true);
+          action( UnSubmersibleId )->setChecked(true);
+        }
       }
     }
   }
index 8909b8759b28724c4019358963bd045f63506d2e..259ac301301ba35c5e44a68a781a1906cee16030 100644 (file)
@@ -60,6 +60,7 @@
 #include "HYDROGUI_ProfileInterpolateOp.h"
 #include "HYDROGUI_RecognizeContoursOp.h"
 #include "HYDROGUI_SubmersibleOp.h"
+#include "HYDROGUI_UnSubmersibleOp.h"
 #include "HYDROGUI_StricklerTableOp.h"
 #include "HYDROGUI_DuplicateOp.h"
 #include "HYDROGUI_LandCoverMapOp.h"
@@ -73,6 +74,7 @@
 #include "HYDROGUI_BathymetrySelectionOp.h"
 #include "HYDROGUI_BathymetryOp.h"
 #include "HYDROGUI_PolylineStyleOp.h"
+#include "HYDROGUI_RegenerateRegionColorsOp.h"
 
 #include <HYDROData_Document.h>
 #include <HYDROData_Obstacle.h>
@@ -234,6 +236,7 @@ void HYDROGUI_Module::createActions()
   createAction( ProfileInterpolateId, "PROFILE_INTERPOLATE", "PROFILE_INTERPOLATE_ICO" );
 
   createAction( SubmersibleId, "SUBMERSIBLE", "SUBMERSIBLE_ICO" );
+  createAction( UnSubmersibleId, "UNSUBMERSIBLE", "HYDRO_UNSUBMERSIBLE16_ICO" );
   createAction( ExportToShapeFileID, "EXPORT_TO_SHAPE_FILE", "EXPORT_TO_SHAPE_FILE_ICO" );
 
   createAction( PolylineExtractionId, "POLYLINE_EXTRACTION" );
@@ -244,6 +247,8 @@ void HYDROGUI_Module::createActions()
   createAction( LandCoverScalarMapModeOffId, "LC_SCALARMAP_COLORING_OFF" );
 
   createAction( ShowHideArrows, "SHOW_HIDE_ARROWS" );
+  createAction( RegenerateRegionColorsId, "REGENERATE_REGION_COLORS" );
+
 }
 
 void HYDROGUI_Module::createMenus()
@@ -748,6 +753,9 @@ LightApp_Operation* HYDROGUI_Module::createOperation( const int theId ) const
   case SubmersibleId:
     anOp = new HYDROGUI_SubmersibleOp( aModule );
     break;
+  case UnSubmersibleId:
+    anOp = new HYDROGUI_UnSubmersibleOp( aModule );
+    break;
   case PolylineExtractionId:
     anOp = new HYDROGUI_PolylineExtractionOp( aModule );
     break;
@@ -761,6 +769,8 @@ LightApp_Operation* HYDROGUI_Module::createOperation( const int theId ) const
   case LandCoverScalarMapModeOffId:
     anOp = new HYDROGUI_LandCoverColoringOp( aModule, theId );
     break;
+  case RegenerateRegionColorsId:
+     anOp = new HYDROGUI_RegenerateRegionColorsOp( aModule );
   }
 
   if( !anOp )
index fdd3048da307485937a438391a83bd97564c8288..88afbe3cd3e11cb9b3f160987739651e0605afd2 100644 (file)
@@ -110,6 +110,7 @@ enum OperationId
 
   RecognizeContoursId,
   SubmersibleId,
+  UnSubmersibleId,
   ImportPolylineId,
   ImportSinusXId,
   ExportSinusXId,
@@ -145,6 +146,7 @@ enum OperationId
   BathymetryRescaleDefaultId,
 
   ShowHideArrows,
+  RegenerateRegionColorsId
 };
 
 #endif
index 47ca42f6ed19ad8bcdff834034678f1a178d254d..af10438a09c6870961c39140ce80b2f179937b29 100644 (file)
@@ -46,7 +46,9 @@ bool HYDROGUI_SubmersibleOp::processApply( int& theUpdateFlags, QString& theErro
   theUpdateFlags = 0;
   if( isOK )
   {
-    myObject->SetIsSubmersible( !myObject->IsSubmersible() );
+    bool IsSubmersible = myObject->IsSubmersible();
+    if (!IsSubmersible)
+      myObject->SetIsSubmersible( true );
     theUpdateFlags = 0;
   }
   return isOK;
index ef1962e806843c903ee22a05a0b1f0821fc2bd86..3dda8c6bd2ad89fceb4254dfae98dd670bd5b927 100644 (file)
@@ -54,7 +54,28 @@ int HYDROGUI_Tool::GetActiveStudyId()
   return 0;
 }
 
-
+static bool GetCalCaseSubT(const QString& aHydroPref, 
+  const QString& anEntry, 
+  const QString& SubTPostFix,
+  HYDROGUI_DataModel* aModel,
+  Handle(HYDROData_CalculationCase)& theOutCalCase)
+{
+  int aFiB = anEntry.lastIndexOf(SubTPostFix, -1, Qt::CaseInsensitive);
+  if (aFiB != -1)
+  {
+    QString RightTruncEntry = anEntry.left(anEntry.length() - SubTPostFix.length());
+    Handle(HYDROData_CalculationCase) CalCase = 
+      Handle(HYDROData_CalculationCase)::DownCast (aModel->objectByEntry( RightTruncEntry, KIND_CALCULATION ));
+    if (CalCase)
+    {
+      theOutCalCase = CalCase;
+      return true;
+    }
+    else
+      return false;
+  }
+  return false;
+}
 
 void HYDROGUI_Tool::SetActiveViewManager( HYDROGUI_Module* theModule,
                                           SUIT_ViewManager* theViewManager )
@@ -251,8 +272,71 @@ ObjectKind HYDROGUI_Tool::GetSelectedPartition( HYDROGUI_Module* theModule )
   return KIND_UNKNOWN;
 }
 
+bool HYDROGUI_Tool::IsSelectedPartOfCalcCase( HYDROGUI_Module* theModule, Handle(HYDROData_CalculationCase)& theOutCalCase,
+  QString& theOutPart)
+{
+  HYDROGUI_DataModel* aModel = theModule->getDataModel();
+  SUIT_SelectionMgr* aSelectionMgr = theModule->getApp()->selectionMgr();
+  SUIT_DataOwnerPtrList anOwners;
+  aSelectionMgr->selected( anOwners );
 
+  if( anOwners.size() != 1 )
+    return false;
+
+  LightApp_DataOwner* anOwner = dynamic_cast<LightApp_DataOwner*>( anOwners.first().operator->() );
 
+  if( anOwner )
+  {
+    QString anEntry = anOwner->entry();
+    QString aHydroPref = "_" + HYDROGUI_DataObject::entryPrefix();
+    //
+    QString aPostFixBoundary = aHydroPref + HYDROGUI_DataModel::tr("CASE_BOUNDARY");
+    if (GetCalCaseSubT(anEntry, anEntry, aPostFixBoundary, aModel, theOutCalCase ))
+    {
+      theOutPart = HYDROGUI_DataModel::tr("CASE_BOUNDARY");
+      theOutPart.toUpper();
+      return true;
+    }
+    //
+    QString aPostFixAO = aHydroPref + 
+      HYDROGUI_DataModel::tr( HYDROGUI_DataModel::partitionName( KIND_ARTIFICIAL_OBJECT ).toLatin1().constData());
+    if (GetCalCaseSubT(anEntry, anEntry, aPostFixAO, aModel, theOutCalCase ))
+    {
+      aPostFixAO.remove(0, aHydroPref.length());
+      theOutPart = aPostFixAO;
+      return true;
+    }
+    //
+    QString aPostFixNO = aHydroPref + 
+      HYDROGUI_DataModel::tr( HYDROGUI_DataModel::partitionName( KIND_NATURAL_OBJECT ).toLatin1().constData());
+    if (GetCalCaseSubT(anEntry, anEntry, aPostFixNO, aModel, theOutCalCase ))
+    {
+      aPostFixNO.remove(0, aHydroPref.length());
+      theOutPart = aPostFixNO;
+      return true;
+    }
+    //
+    QString aPostFixLCM = aHydroPref + 
+      HYDROGUI_DataModel::tr( HYDROGUI_DataModel::partitionName( KIND_LAND_COVER_MAP ).toLatin1().constData());
+    if (GetCalCaseSubT(anEntry, anEntry, aPostFixLCM, aModel, theOutCalCase ))
+    {
+      aPostFixLCM.remove(0, aHydroPref.length());
+      theOutPart = aPostFixLCM;
+      return true;
+    }
+    //
+    QString aPostFixReg = aHydroPref + 
+      HYDROGUI_DataModel::tr( HYDROGUI_DataModel::partitionName( KIND_REGION ).toLatin1().constData());
+    if (GetCalCaseSubT(anEntry, anEntry, aPostFixReg, aModel, theOutCalCase ))
+    {
+      aPostFixReg.remove(0, aHydroPref.length());
+      theOutPart = aPostFixReg;
+      return true;
+    }
+    //
+  }
+  return false;
+}
 
 QStringList HYDROGUI_Tool::GetSelectedGeomObjects( HYDROGUI_Module* theModule,
                                                    QList<GEOM::shape_type> theTypes )
index 980372accdd67de3de4b3adaece5c9e10db46d46..316f2ded58b43907e06e353ba8b78a3362a6eff1 100644 (file)
@@ -34,6 +34,7 @@ class SUIT_ViewManager;
 class GraphicsView_ViewPort;
 class OCCViewer_ViewFrame;
 class HYDROData_Document;
+class HYDROData_CalculationCase;
 
 namespace HYDROGUI_Tool
 {
@@ -61,6 +62,9 @@ namespace HYDROGUI_Tool
 
   ObjectKind GetSelectedPartition( HYDROGUI_Module* theModule );
 
+  bool IsSelectedPartOfCalcCase( HYDROGUI_Module* theModule, Handle(HYDROData_CalculationCase)& theOutCalCase,
+                                 QString& theOutPart);
+
   Handle(HYDROData_Entity) FindObjectByName( HYDROGUI_Module* theModule,
                                              const QString& theName,
                                              const ObjectKind theObjectKind = KIND_UNKNOWN );
diff --git a/src/HYDROGUI/HYDROGUI_UnSubmersibleOp.cxx b/src/HYDROGUI/HYDROGUI_UnSubmersibleOp.cxx
new file mode 100644 (file)
index 0000000..5fb28bf
--- /dev/null
@@ -0,0 +1,54 @@
+// 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_UnSubmersibleOp.h>
+#include <HYDROGUI_Tool2.h>
+#include <HYDROGUI_Module.h>
+
+HYDROGUI_UnSubmersibleOp::HYDROGUI_UnSubmersibleOp( HYDROGUI_Module* theModule )
+  : HYDROGUI_Operation( theModule )
+{
+}
+
+HYDROGUI_UnSubmersibleOp::~HYDROGUI_UnSubmersibleOp()
+{
+}
+
+void HYDROGUI_UnSubmersibleOp::startOperation()
+{
+  HYDROGUI_Operation::startOperation();
+  myObject = Handle(HYDROData_Object)::DownCast( HYDROGUI_Tool::GetSelectedObject( module() ) );
+  if( myObject.IsNull() )
+    onCancel();
+  else
+    onApply();
+}
+
+bool HYDROGUI_UnSubmersibleOp::processApply( int& theUpdateFlags, QString& theErrorMsg, QStringList& theBrowseObjectsEntries )
+{
+  theUpdateFlags = 0;
+  if( !myObject.IsNull() )
+  {
+    bool IsSubmersible = myObject->IsSubmersible();
+    if (IsSubmersible)
+      myObject->SetIsSubmersible( false );
+    return true;
+  }
+  return false;
+}
+
diff --git a/src/HYDROGUI/HYDROGUI_UnSubmersibleOp.h b/src/HYDROGUI/HYDROGUI_UnSubmersibleOp.h
new file mode 100644 (file)
index 0000000..6d0ffb9
--- /dev/null
@@ -0,0 +1,42 @@
+// 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_UNSubmersibleOP_H
+#define HYDROGUI_UNSubmersibleOP_H
+
+#include <HYDROGUI_Operation.h>
+#include <HYDROData_Object.h>
+
+class HYDROGUI_UnSubmersibleOp : public HYDROGUI_Operation
+{
+  Q_OBJECT
+
+public:
+  HYDROGUI_UnSubmersibleOp( HYDROGUI_Module* theModule );
+  virtual ~HYDROGUI_UnSubmersibleOp();
+
+protected:
+  virtual void startOperation();
+  virtual bool processApply( int& theUpdateFlags, QString& theErrorMsg,
+                             QStringList& theBrowseObjectsEntries );
+
+private:
+  Handle(HYDROData_Object) myObject;
+};
+
+#endif
diff --git a/src/HYDROGUI/HYDROGUI_ZoneTool.cxx b/src/HYDROGUI/HYDROGUI_ZoneTool.cxx
new file mode 100644 (file)
index 0000000..be40340
--- /dev/null
@@ -0,0 +1,74 @@
+// 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_ZoneTool.h>
+#include <HYDROData_Zone.h>
+#include <QColor>
+
+int randHue( int theHue )
+{
+  if( theHue>=0 && theHue<360 )
+    return theHue;
+  else
+    return rand()%360;
+}
+
+int randValue( int theMin, int theMax )
+{
+  return theMin + rand()%(theMax-theMin);
+}
+
+void AssignDefaultColor( const Handle(HYDROData_Zone)& theZone,
+                         int theHue, int theSMargin, int theBMargin )
+{
+  int aHue = randHue( theHue );
+  int aSat = randValue( theSMargin, 255 );
+  int aBri = randValue( theBMargin, 255-theBMargin );
+
+  QColor aColor = QColor::fromHsl( aHue, aSat, aBri );
+  theZone->SetColor( aColor );
+}
+
+namespace HYDROGUI_ZoneTool { 
+
+void AssignDefaultColors( const QList<Handle(HYDROData_Region)>& theRegions, int theSMargin, int theBMargin )
+{
+  foreach( Handle(HYDROData_Region) region, theRegions )
+    AssignDefaultColors( region, theSMargin, theBMargin );
+}
+
+void AssignDefaultColors( const Handle(HYDROData_Region)& theRegion, int theSMargin, int theBMargin )
+{
+  int aHue = randHue( -1 );
+  HYDROData_SequenceOfObjects zones = theRegion->GetZones();
+  HYDROData_SequenceOfObjects::Iterator zonesIt( zones );
+  for( ; zonesIt.More(); zonesIt.Next() )
+  {
+    Handle(HYDROData_Zone) aZone =
+      Handle(HYDROData_Zone)::DownCast( zonesIt.Value() );
+    AssignDefaultColor( aZone, aHue, theSMargin, theBMargin );
+  }
+}
+
+void AssignDefaultColors( const HYDROData_SequenceOfObjects& theRegions, int theSMargin, int theBMargin )
+{
+  for ( int i = 1; i <= theRegions.Length(); i++ )
+    AssignDefaultColors( Handle(HYDROData_Region)::DownCast(theRegions(i)), theSMargin, theBMargin );
+}
+
+};
diff --git a/src/HYDROGUI/HYDROGUI_ZoneTool.h b/src/HYDROGUI/HYDROGUI_ZoneTool.h
new file mode 100644 (file)
index 0000000..8db9c7d
--- /dev/null
@@ -0,0 +1,32 @@
+// 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_ZoneTool_H
+#define HYDROGUI_ZoneTool_H
+
+#include <HYDROData_Region.h>
+
+namespace HYDROGUI_ZoneTool
+{
+  void AssignDefaultColors( const QList<Handle(HYDROData_Region)>&, int theSMargin = 128, int theBMargin = 90 );
+  void AssignDefaultColors( const Handle(HYDROData_Region)&, int theSMargin = 128, int theBMargin = 90 );
+  void AssignDefaultColors( const HYDROData_SequenceOfObjects& theRegions, int theSMargin = 128, int theBMargin = 90 );
+};
+
+
+#endif
index df3ecb21aa9edc7a2408149e296f0ca5469c06aa..4a080b6003ce02410960e071a23a46ff33125202 100644 (file)
       <source>SUBMERSIBLE_ICO</source>
       <translation>icon_submersible.png</translation>
     </message>
+    <message>
+      <source>HYDRO_UNSUBMERSIBLE_ICO</source>
+      <translation>icon_unsubmersible.png</translation>
+    </message>
+    <message>
+      <source>HYDRO_UNSUBMERSIBLE16_ICO</source>
+      <translation>icon_unsumb_16.png</translation>
+    </message>
+    <message>
+      <source>HYDRO_SUBMERSIBLE16_ICO</source>
+      <translation>icon_sumb_16.png</translation>
+    </message>
 
 
     <!-- Icons for objects -->
       <source>HYDRO_TYPE5_ICO</source>
       <translation>icon_imm_zone.png</translation>
     </message>
+    <message>
+      <source>HYDRO_TYPE5U_ICO</source>
+      <translation>icon_imm_uns_zone.png</translation>
+    </message>
     <message>
       <source>HYDRO_TYPE6_ICO</source>
       <translation>icon_river.png</translation>
       <source>HYDRO_M_TYPE5_ICO</source>
       <translation>icon_mimm_zone.png</translation>
     </message>
+    <message>
+      <source>HYDRO_M_TYPE5U_ICO</source>
+      <translation>icon_mimm_uns_zone.png</translation>
+    </message>
     <message>
       <source>HYDRO_M_TYPE6_ICO</source>
       <translation>icon_mriver.png</translation>
index ed6904559e43bf22560a6b34f3e2ab8f86be2166..35ff9864d9b6aa96dae0b8329392db1b0896b4ec 100644 (file)
@@ -1123,6 +1123,10 @@ Would you like to remove all references from the image?</translation>
       <source>DSK_SUBMERSIBLE</source>
       <translation>Submersible</translation>
     </message>
+    <message>
+      <source>DSK_UNSUBMERSIBLE</source>
+      <translation>Unsubmersible</translation>
+    </message>
     <message>
       <source>DSK_EXPORT_TO_SHAPE_FILE</source>
       <translation>Export</translation>
@@ -1508,6 +1512,10 @@ Would you like to remove all references from the image?</translation>
       <source>MEN_SUBMERSIBLE</source>
       <translation>Submersible</translation>
     </message>
+    <message>
+      <source>MEN_UNSUBMERSIBLE</source>
+      <translation>Unsubmersible</translation>
+    </message>
     <message>
       <source>MEN_EXPORT_TO_SHAPE_FILE</source>
       <translation>Export</translation>
@@ -1516,6 +1524,10 @@ Would you like to remove all references from the image?</translation>
       <source>MEN_POLYLINE_EXTRACTION</source>
       <translation>Polyline extraction</translation>
     </message>
+    <message>
+      <source>MEN_REGENERATE_REGION_COLORS</source>
+      <translation>Regenerate region colors</translation>
+    </message>
 
     <message>
       <source>STB_CREATE_CALCULATION</source>
@@ -1854,6 +1866,10 @@ Would you like to remove all references from the image?</translation>
       <source>STB_SUBMERSIBLE</source>
       <translation>If the object is submersible</translation>
     </message>
+    <message>
+      <source>STB_UNSUBMERSIBLE</source>
+      <translation>If the object is non submersible</translation>
+    </message>
     <message>
       <source>STB_EXPORT_TO_SHAPE_FILE</source>
       <translation>Export</translation>
diff --git a/src/HYDROGUI/resources/icon_imm_uns_zone.png b/src/HYDROGUI/resources/icon_imm_uns_zone.png
new file mode 100644 (file)
index 0000000..49ccbbe
Binary files /dev/null and b/src/HYDROGUI/resources/icon_imm_uns_zone.png differ
diff --git a/src/HYDROGUI/resources/icon_mimm_uns_zone.png b/src/HYDROGUI/resources/icon_mimm_uns_zone.png
new file mode 100644 (file)
index 0000000..6067093
Binary files /dev/null and b/src/HYDROGUI/resources/icon_mimm_uns_zone.png differ
diff --git a/src/HYDROGUI/resources/icon_sumb_16.png b/src/HYDROGUI/resources/icon_sumb_16.png
new file mode 100644 (file)
index 0000000..34a7914
Binary files /dev/null and b/src/HYDROGUI/resources/icon_sumb_16.png differ
diff --git a/src/HYDROGUI/resources/icon_unsumb_16.png b/src/HYDROGUI/resources/icon_unsumb_16.png
new file mode 100644 (file)
index 0000000..49ccbbe
Binary files /dev/null and b/src/HYDROGUI/resources/icon_unsumb_16.png differ
index 8bd6f0efe45ef1ea403d35416592bed92bb27455..2b207f3c03f9757f15bb402d02f7bf09a26857e5 100644 (file)
@@ -79,6 +79,7 @@ set( EXTERNAL_FILES
   ../HYDROGUI/HYDROGUI_ListSelector.cxx
   ../HYDROGUI/HYDROGUI_OrderedListWidget.cxx
   ../HYDROGUI/HYDROGUI_Overview.cxx
+  ../HYDROGUI/HYDROGUI_ZoneTool.cxx
   ../HYDROGUI/HYDROGUI_ProfileDlg.cxx
   ../HYDROGUI/HYDROGUI_ViewerDlg.cxx
   ../HYDROGUI/HYDROGUI_AISTrihedron.cxx
@@ -92,6 +93,7 @@ set( MOC_HEADERS
   ../HYDROGUI/HYDROGUI_ListSelector.h
   ../HYDROGUI/HYDROGUI_OrderedListWidget.h
   ../HYDROGUI/HYDROGUI_Overview.h
+  ../HYDROGUI/HYDROGUI_ZoneTool.h
   ../HYDROGUI/HYDROGUI_ProfileDlg.h
   ../HYDROGUI/HYDROGUI_ViewerDlg.h
 )
index d16a47088566cd12d4e8e171f3cb53b5cf364bb0..db6539765ae8e1107693251a3ec06b96d7040b29 100644 (file)
@@ -145,6 +145,7 @@ SET(REFERENCE_DATA
     bathy_rescaled_visible.png
     bathy_text_labels.png
     bathy_prs_fit_selected.png
+    zone_random_colors.png
 )
 
 # Application tests
diff --git a/src/HYDRO_tests/reference_data/zone_random_colors.png b/src/HYDRO_tests/reference_data/zone_random_colors.png
new file mode 100644 (file)
index 0000000..1bf0ab4
Binary files /dev/null and b/src/HYDRO_tests/reference_data/zone_random_colors.png differ