From 973d8a59b15c12a978544849d369c0c8398944c2 Mon Sep 17 00:00:00 2001 From: rkv Date: Fri, 1 Nov 2013 07:01:51 +0000 Subject: [PATCH] - Merge type selection is implemented in Calculation Case dialog. --- src/HYDROGUI/HYDROGUI_CalculationDlg.cxx | 13 ++++++--- src/HYDROGUI/HYDROGUI_CalculationDlg.h | 1 + src/HYDROGUI/HYDROGUI_CalculationOp.cxx | 1 + src/HYDROGUI/HYDROGUI_Zone.cxx | 37 ++++++++++++++---------- 4 files changed, 32 insertions(+), 20 deletions(-) diff --git a/src/HYDROGUI/HYDROGUI_CalculationDlg.cxx b/src/HYDROGUI/HYDROGUI_CalculationDlg.cxx index 4cf7eb37..e395d6d6 100644 --- a/src/HYDROGUI/HYDROGUI_CalculationDlg.cxx +++ b/src/HYDROGUI/HYDROGUI_CalculationDlg.cxx @@ -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 diff --git a/src/HYDROGUI/HYDROGUI_CalculationDlg.h b/src/HYDROGUI/HYDROGUI_CalculationDlg.h index 3e137479..7db16048 100644 --- a/src/HYDROGUI/HYDROGUI_CalculationDlg.h +++ b/src/HYDROGUI/HYDROGUI_CalculationDlg.h @@ -61,6 +61,7 @@ public: public slots: void onEmptyName(); void onAlreadyExists( QString theName ); + void refreshZonesBrowser(); /** * Process items selection: hide/show bathymetry merge type selector. */ diff --git a/src/HYDROGUI/HYDROGUI_CalculationOp.cxx b/src/HYDROGUI/HYDROGUI_CalculationOp.cxx index 30b2c638..3dab9422 100644 --- a/src/HYDROGUI/HYDROGUI_CalculationOp.cxx +++ b/src/HYDROGUI/HYDROGUI_CalculationOp.cxx @@ -167,6 +167,7 @@ void HYDROGUI_CalculationOp::onSetMergeType( int theMergeType, QString theBathym { aZone->setMergeType( theMergeType, theBathymetryName ); } + aPanel->refreshZonesBrowser(); } } diff --git a/src/HYDROGUI/HYDROGUI_Zone.cxx b/src/HYDROGUI/HYDROGUI_Zone.cxx index 195afa15..3ec240f0 100644 --- a/src/HYDROGUI/HYDROGUI_Zone.cxx +++ b/src/HYDROGUI/HYDROGUI_Zone.cxx @@ -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 ); } -- 2.39.2