]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
- Merge type selection is implemented in Calculation Case dialog.
authorrkv <rkv@opencascade.com>
Fri, 1 Nov 2013 07:01:51 +0000 (07:01 +0000)
committerrkv <rkv@opencascade.com>
Fri, 1 Nov 2013 07:01:51 +0000 (07:01 +0000)
src/HYDROGUI/HYDROGUI_CalculationDlg.cxx
src/HYDROGUI/HYDROGUI_CalculationDlg.h
src/HYDROGUI/HYDROGUI_CalculationOp.cxx
src/HYDROGUI/HYDROGUI_Zone.cxx

index 4cf7eb3720f21998f060e2f604d31f3bc4ff8aa5..e395d6d611b515e5ac19cab26bec1227b9abf103 100644 (file)
@@ -194,9 +194,9 @@ void HYDROGUI_CalculationDlg::onSelected( SUIT_DataObject* theObject )
     bool prevBlock = myBathymetryChoice->blockSignals( true );
     myCurrentZone = aZone;
     myBathymetryChoice->clear();
-    myBathymetryChoice->addItem( QObject::tr("MERGE_UNKNOWN"), HYDROData_Zone::Merge_UNKNOWN );
-    myBathymetryChoice->addItem( QObject::tr("MERGE_ZMIN"), HYDROData_Zone::Merge_ZMIN );
-    myBathymetryChoice->addItem( QObject::tr("MERGE_ZMAX"), HYDROData_Zone::Merge_ZMAX );
+    myBathymetryChoice->addItem( tr("MERGE_UNKNOWN"), HYDROData_Zone::Merge_UNKNOWN );
+    myBathymetryChoice->addItem( tr("MERGE_ZMIN"), HYDROData_Zone::Merge_ZMIN );
+    myBathymetryChoice->addItem( tr("MERGE_ZMAX"), HYDROData_Zone::Merge_ZMAX );
     QStringList aList = aZone->getBathymetries();
     for ( int i = 0; i < aList.length(); i++ )
     {
@@ -213,7 +213,7 @@ void HYDROGUI_CalculationDlg::onSelected( SUIT_DataObject* theObject )
         aCurIndex = 2;
         break;
       case HYDROData_Zone::Merge_Object:
-        aCurIndex = aList.indexOf( aZone->text( HYDROGUI_DataObject::BathymetryId ) );
+        aCurIndex = 3 + aList.indexOf( aZone->text( HYDROGUI_DataObject::BathymetryId ) );
         break;
       default:
         aCurIndex = 0; // Select unknown by default
@@ -281,4 +281,9 @@ void HYDROGUI_CalculationDlg::setEditedObject( const Handle(HYDROData_Calculatio
 HYDROGUI_Zone* HYDROGUI_CalculationDlg::getCurrentZone() const
 {
   return myCurrentZone;
+}
+
+void HYDROGUI_CalculationDlg::refreshZonesBrowser()
+{
+  myBrowser->updateTree();
 }
\ No newline at end of file
index 3e1374790ea67b0458cf387d98fd75ba40ccabde..7db16048eb6500257d880786dccde4177144971c 100644 (file)
@@ -61,6 +61,7 @@ public:
 public slots:
   void                       onEmptyName();
   void                       onAlreadyExists( QString theName );
+  void                       refreshZonesBrowser();
   /**
    * Process items selection: hide/show bathymetry merge type selector.
    */
index 30b2c63850c61ad3bda6e4a93d91f7568d625619..3dab9422c0eb0fecebb2a2df68669719be3c1248 100644 (file)
@@ -167,6 +167,7 @@ void HYDROGUI_CalculationOp::onSetMergeType( int theMergeType, QString theBathym
     {
       aZone->setMergeType( theMergeType, theBathymetryName );
     }
+    aPanel->refreshZonesBrowser();
   }
 }
 
index 195afa157a1b47eb7d11a8cf9efdf4cea3dc3114..3ec240f04002479255ce3a13a672ce8ba9d70c55 100644 (file)
@@ -90,7 +90,8 @@ QString HYDROGUI_Zone::getBathimetryName() const
   if ( !aZone.IsNull() )
   {
     HYDROData_SequenceOfObjects aSeq = aZone->GetGeometryObjects();
-    if ( aZone->IsMergingNeed() || aSeq.Length() == 1 )
+    if ( ( aZone->IsMergingNeed() && aZone->GetMergeType() == HYDROData_Zone::Merge_UNKNOWN ) 
+      || aSeq.Length() == 1 )
     {
       // Collect all used bathymetries names when merging is necessary
       // or just get the name of bathymetry of a single geometry object
@@ -159,25 +160,29 @@ QColor HYDROGUI_Zone::color( const ColorRole theColorRole, const int theColumnId
 {
   // Implement red color for bathymetry conflicts in case creation dialog
   QColor aRes;
-  if( isMergingNeed() )
+  Handle(HYDROData_Zone) aZone = Handle(HYDROData_Zone)::DownCast( modelObject() );
+  if ( !aZone.IsNull() )
   {
-    switch( theColorRole )
+    if ( ( aZone->IsMergingNeed() && aZone->GetMergeType() == HYDROData_Zone::Merge_UNKNOWN ) )
     {
-      case Text:            // editor foreground (text) color
-      case Foreground:      // foreground (text) color
-        aRes = Qt::red;
-        break;
-      case HighlightedText: // highlighted foreground (text) color
-        aRes = Qt::black;
-        break;
-      case Base:            // editor background color
-      case Background:      // background color
-      case Highlight:       // highlight background color
-      default:
-        aRes = Qt::red;
+      switch( theColorRole )
+      {
+        case Text:            // editor foreground (text) color
+        case Foreground:      // foreground (text) color
+          aRes = Qt::red;
+          break;
+        case HighlightedText: // highlighted foreground (text) color
+          aRes = Qt::black;
+          break;
+        case Base:            // editor background color
+        case Background:      // background color
+        case Highlight:       // highlight background color
+        default:
+          aRes = Qt::red;
+      }
     }
   }
-  else
+  if ( !aRes.isValid() )
   {
     aRes = LightApp_DataObject::color( theColorRole, theColumnId );
   }