]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
refs #580: further GUI development.
authormkr <mkr@opencascade.com>
Thu, 18 Jun 2015 14:43:09 +0000 (17:43 +0300)
committermkr <mkr@opencascade.com>
Thu, 18 Jun 2015 14:43:09 +0000 (17:43 +0300)
src/HYDROGUI/HYDROGUI_CalculationDlg.cxx
src/HYDROGUI/HYDROGUI_CalculationDlg.h
src/HYDROGUI/HYDROGUI_CalculationOp.cxx
src/HYDROGUI/HYDROGUI_CalculationOp.h
src/HYDROGUI/HYDROGUI_Zone.cxx
src/HYDROGUI/HYDROGUI_Zone.h

index c727437116b6f305cd9fafe62842a94a5fec6ce5..21773bc8b77b0dedb0daa536927977ca9d82e572 100644 (file)
@@ -585,7 +585,7 @@ void HYDROGUI_CalculationDlg::onZonesDropped( const QList<SUIT_DataObject*>& the
       HYDROGUI_Region* aRegion = dynamic_cast<HYDROGUI_Region*>(theTargetParent);
       if ( aRegion )
       {
-        emit moveZones( theTargetParent, aZonesList );
+        emit moveZones( theTargetParent, aZonesList, false );
       }
     }
   }
@@ -658,12 +658,49 @@ void HYDROGUI_CalculationDlg::onSelected( SUIT_DataObject* theObject )
 
 void HYDROGUI_CalculationDlg::onLandCoverZoneSelected( SUIT_DataObject* theObject )
 {
-  // TODO: implement this function
+  bool doShow = false;
+  HYDROGUI_Zone* aZone = dynamic_cast<HYDROGUI_Zone*>( theObject );
+  if ( aZone )
+  {
+    doShow = aZone->isMergingNeed();
+  }
+
+  if ( doShow )
+  {
+    // Fill the merge type combo box
+    bool prevBlock = myStricklerTypeChoice->blockSignals( true );
+    myCurrentZone = aZone;
+    myStricklerTypeChoice->clear();
+    myStricklerTypeChoice->addItem( tr("MERGE_UNKNOWN"), HYDROData_Zone::Merge_UNKNOWN );
+    /*QStringList aList = aZone->getStricklerTypes();
+    for ( int i = 0; i < aList.length(); i++ )
+    {
+      myStricklerTypeChoice->addItem( aList.at( i ), HYDROData_Zone::Merge_Object );
+    }
+    // Select the current choice if any
+    int aCurIndex = 0;
+    switch ( aZone->getMergeType() )
+    {
+      case HYDROData_Zone::Merge_Object:
+        aCurIndex = 1 + aList.indexOf( aZone->text( HYDROGUI_DataObject::AltitudeObjId ) );
+        break;
+      default:
+        aCurIndex = 0; // Select unknown by default
+    }
+    myStricklerTypeChoice->setCurrentIndex( aCurIndex );*/
+    myStricklerTypeChoice->blockSignals( prevBlock );
+  }
+
+  myStricklerTypeChoice->setVisible( doShow );
+  myStricklerTypeChoice->setEnabled( getLandCoverMode() == HYDROData_CalculationCase::MANUAL );
+  myStricklerTypeChoice->setVisible( doShow );
 }
 
 void HYDROGUI_CalculationDlg::onMergeStricklerTypeSelected( int theIndex )
 {
-  // TODO: implement this function
+  int aType = myStricklerTypeChoice->itemData( theIndex ).toInt();
+  QString aText = myStricklerTypeChoice->itemText( theIndex );
+  emit setMergeStricklerType( aType, aText );
 }
 
 void HYDROGUI_CalculationDlg::onLandCoverZonesDropped( const QList<SUIT_DataObject*>& theList, 
@@ -843,12 +880,20 @@ void HYDROGUI_CalculationDlg::setEditedObject( const Handle(HYDROData_Calculatio
 
   // Build the calculation case subtree
   module()->getDataModel()->buildCaseTree( myBrowser->root(), myEditedObject );
+  // TODO: build subtree items corresponding to regions constructed on land covers
+  //...
 
   myBrowser->updateTree();
   myBrowser->openLevels();
   myBrowser->adjustColumnsWidth();
   myBrowser->setAutoUpdate( true );
   myBrowser->setUpdateModified( true );
+
+  myLandCoverBrowser->updateTree();
+  myLandCoverBrowser->openLevels();
+  myLandCoverBrowser->adjustColumnsWidth();
+  myLandCoverBrowser->setAutoUpdate( true );
+  myLandCoverBrowser->setUpdateModified( true );
 }
 
 HYDROGUI_Zone* HYDROGUI_CalculationDlg::getCurrentZone() const
@@ -968,7 +1013,7 @@ void HYDROGUI_CalculationDlg::setEditZonesEnabled( const bool theIsEnabled )
   Enable/disable land covers drag'n'drop and renaming.
   @param theIsEnabled if true - land covers drag'n'drop and renaming will be enabled
 */
-void HYDROGUI_CalculationDlg::setEditLandCoversEnabled( const bool theIsEnabled )
+void HYDROGUI_CalculationDlg::setEditLandCoverZonesEnabled( const bool theIsEnabled )
 {
   myLandCoverBrowser->setReadOnly( !theIsEnabled );
 }
index da597e869202ec723517a96ac4bcf04e564fda6c..d6105168c3d8807675d5ba204a60bd93d406b9b0 100644 (file)
@@ -78,7 +78,7 @@ public:
   void                       setAvailableGroups( const QStringList& );
 
   void                       setEditZonesEnabled( const bool theIsEnabled );
-  void                       setEditLandCoversEnabled( const bool theIsEnabled );
+  void                       setEditLandCoverZonesEnabled( const bool theIsEnabled );
 
   HYDROData_ListOfRules      getRules() const;
   void                       setRules( const HYDROData_ListOfRules& theRules ) const;
@@ -150,7 +150,7 @@ signals:
   void                       boundarySelected( const QString & theObjName );
   void                       setMergeType( int theMergeType, QString& theBathymetryName );
   void                       createRegion( const QList<SUIT_DataObject*>& theZonesList );
-  void                       moveZones( SUIT_DataObject* theRegion, const QList<SUIT_DataObject*>& theZonesList );
+  void                       moveZones( SUIT_DataObject* theRegion, const QList<SUIT_DataObject*>& theZonesList, bool theLandCover );
   void                       clickedInZonesBrowser( SUIT_DataObject* );
 
   void                       changeLandCoverMode( int theMode );
@@ -163,6 +163,7 @@ signals:
   void                       createLandCoverRegion( const QList<SUIT_DataObject*>& theLandCoverZonesList );
   
   void                       StricklerTableSelected( const QString & theObjName );
+  void                       setMergeStricklerType( int theMergeType, QString& theStricklerTypeName );
 
 protected:
 
index 94ea5dbb51fa6a60374ebd9e12ad1f7266ce251f..e6b9ea7248c52770ed199955b3765dd8e553c3e7 100644 (file)
@@ -223,8 +223,9 @@ HYDROGUI_InputPanel* HYDROGUI_CalculationOp::createInputPanel() const
   connect( aPanel, SIGNAL( Back( const int ) ), SLOT( onHideZones( const int ) ) );
   //connect( aPanel, SIGNAL( clicked( SUIT_DataObject* ) ), SLOT( onSelected( SUIT_DataObject* ) ) );
   connect( aPanel, SIGNAL( setMergeType( int, QString& ) ), SLOT( onSetMergeType( int, QString& ) ) );
-  connect( aPanel, SIGNAL( moveZones( SUIT_DataObject*, const QList<SUIT_DataObject*>& ) ),
-    SLOT( onMoveZones( SUIT_DataObject*, const QList<SUIT_DataObject*>& ) ) );
+  connect( aPanel, SIGNAL( setMergeStricklerType( int, QString& ) ), SLOT( onSetMergeStricklerType( int, QString& ) ) );
+  connect( aPanel, SIGNAL( moveZones( SUIT_DataObject*, const QList<SUIT_DataObject*>&, bool ) ),
+    SLOT( onMoveZones( SUIT_DataObject*, const QList<SUIT_DataObject*>&, bool ) ) );
   connect( aPanel, SIGNAL( createRegion( const QList<SUIT_DataObject*>& ) ),
     SLOT( onCreateRegion( const QList<SUIT_DataObject*>& ) ) );
   connect( aPanel, SIGNAL( clickedInZonesBrowser( SUIT_DataObject* ) ),
@@ -460,7 +461,9 @@ void HYDROGUI_CalculationOp::onClickedInZonesBrowser( SUIT_DataObject* theItem )
   }
 }
 
-void HYDROGUI_CalculationOp::onMoveZones( SUIT_DataObject* theRegionItem, const QList<SUIT_DataObject*>& theZonesList )
+void HYDROGUI_CalculationOp::onMoveZones( SUIT_DataObject* theRegionItem,
+                                          const QList<SUIT_DataObject*>& theZonesList,
+                                          bool theLandCover )
 {
   HYDROGUI_Region* aRegion = dynamic_cast<HYDROGUI_Region*>(theRegionItem);
   if ( aRegion )
@@ -483,9 +486,9 @@ void HYDROGUI_CalculationOp::onMoveZones( SUIT_DataObject* theRegionItem, const
         ::qobject_cast<HYDROGUI_CalculationDlg*>( inputPanel() );
       if ( aPanel )
       {
-        aPanel->refreshZonesBrowser();
+        theLandCover ? aPanel->refreshLandCoverZonesBrowser(): aPanel->refreshZonesBrowser();
       }
-      createPreview( false );
+      createPreview( theLandCover );
     }
   }
 }
@@ -538,6 +541,26 @@ void HYDROGUI_CalculationOp::onSetMergeType( int theMergeType, QString& theAltit
   }
 }
 
+void HYDROGUI_CalculationOp::onSetMergeStricklerType( int theMergeType, QString& theStricklerTypeName )
+{
+  HYDROGUI_CalculationDlg* aPanel = 
+    ::qobject_cast<HYDROGUI_CalculationDlg*>( inputPanel() );
+  if ( aPanel )
+  {
+    HYDROGUI_Zone* aZone = aPanel->getCurrentZone();
+    if ( aZone )
+    {
+      aZone->setMergeStricklerType( theMergeType, theStricklerTypeName );
+      HYDROGUI_Shape* aShape = module()->getObjectShape( HYDROGUI_Module::VMR_PreviewCaseZones, aZone->modelObject() );
+      if ( aShape )
+      {
+        aShape->update( true, false );
+      }
+    }
+    aPanel->refreshLandCoverZonesBrowser();
+  }
+}
+
 void HYDROGUI_CalculationOp::onAddObjects()
 {
   HYDROGUI_CalculationDlg* aPanel = 
@@ -1040,7 +1063,7 @@ void HYDROGUI_CalculationOp::onNext( const int theIndex )
         }
       }
     }
-    aPanel->setEditLandCoversEnabled( aMode == HYDROData_CalculationCase::MANUAL );
+    aPanel->setEditLandCoverZonesEnabled( aMode == HYDROData_CalculationCase::MANUAL );
 
     bool anIsToUpdateOb = false;
     if ( myEditedObject->IsMustBeUpdated() )
index 2e0c0fae3d305dde5889119164972357ae118d0c..dfcf2f6f597581a7d90a49cfdb00ff80f00643b9 100644 (file)
@@ -99,11 +99,16 @@ protected slots:
    * Set the given bathymetry merge type to the current zone.
    */
   void                            onSetMergeType( int theMergeType, QString& theBathymetryName );
+  /**
+   * Set the given Strickler merge type to the current zone.
+   */
+  void                            onSetMergeStricklerType( int theMergeType, QString& theStricklerTypeName );
   /**
    * Selected zones are moved to the existing region.
    */
   void                            onMoveZones( SUIT_DataObject* theRegionItem, 
-                                               const QList<SUIT_DataObject*>& theZonesList );
+                                               const QList<SUIT_DataObject*>& theZonesList,
+                                               bool theLandCover );
   /**
    * Selected zones are moved to the new region to be created.
    */
index 9b6b304b0fd944eaa04f64a956eea07a0845608e..7cb2c5262247c5db0c8d73528473256d4693b393 100644 (file)
@@ -270,6 +270,11 @@ void HYDROGUI_Zone::setMergeType( int theMergeType, QString theAltitudeName )
   }
 }
 
+void HYDROGUI_Zone::setMergeStricklerType( int theMergeType, QString theStricklerTypeName)
+{
+  // TODO: implement this method
+}
+
 /*!
   \brief Check if this object is can't be renamed in place
 
index aaf7a2ded1b9e165a1085e08198978fe77bba1d4..76e2e428ec929d43ab2381afc81f56b94c005b5e 100644 (file)
@@ -86,6 +86,11 @@ public:
    * If the type is Merge_Object then use the second parameter to set the merge bathymetry.
    */
   void        setMergeType( int theMergeType, QString theAltitudeName = QString() );
+  /**
+   * Set the merging type for conflict strickler types. 
+   * If the type is Merge_Object then use the second parameter to set the merge Strickler type.
+   */
+  void        setMergeStricklerType( int theMergeType, QString theStricklerTypeName = QString() );
 
 private:
   QString getRefObjectNames() const;