mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Source stepping and toolbar updates (#8866)
* Move layout options to separate toolbar * Enable stepping on quantities, remove special history curve stepping for now * Allow stepping ensembles and cases * Add step next/prev and add new sub plot
This commit is contained in:
@@ -186,3 +186,25 @@ bool RimDataSourceSteppingTools::updateHistoryAndSummaryQuantityIfMatching( cons
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimDataSourceSteppingTools::updateQuantityIfMatching( const QVariant& oldValue,
|
||||
const QVariant& newValue,
|
||||
RifEclipseSummaryAddress* adr )
|
||||
{
|
||||
if ( !adr ) return false;
|
||||
|
||||
std::string oldString = oldValue.toString().toStdString();
|
||||
std::string newString = newValue.toString().toStdString();
|
||||
|
||||
if ( adr->quantityName() == oldString )
|
||||
{
|
||||
adr->setQuantityName( newString );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -41,4 +41,7 @@ public:
|
||||
static bool updateHistoryAndSummaryQuantityIfMatching( const QVariant& oldValue,
|
||||
const QVariant& newValue,
|
||||
RifEclipseSummaryAddress* adr );
|
||||
|
||||
static bool
|
||||
updateQuantityIfMatching( const QVariant& oldValue, const QVariant& newValue, RifEclipseSummaryAddress* adr );
|
||||
};
|
||||
|
||||
@@ -898,7 +898,15 @@ bool RimMultiPlot::isMouseCursorInsidePlot()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<caf::PdmFieldHandle*> RimMultiPlot::fieldsToShowInToolbar()
|
||||
{
|
||||
return { &m_pagePreviewMode, &m_columnCount, &m_rowsPerPage };
|
||||
return {};
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<caf::PdmFieldHandle*> RimMultiPlot::fieldsToShowInLayoutToolbar()
|
||||
{
|
||||
return { &m_columnCount, &m_rowsPerPage, &m_pagePreviewMode };
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -106,6 +106,7 @@ public:
|
||||
int axisValueFontSize() const;
|
||||
|
||||
virtual std::vector<caf::PdmFieldHandle*> fieldsToShowInToolbar();
|
||||
virtual std::vector<caf::PdmFieldHandle*> fieldsToShowInLayoutToolbar();
|
||||
|
||||
bool isValid() const;
|
||||
|
||||
|
||||
@@ -28,6 +28,8 @@
|
||||
#include "PlotBuilderCommands/RicAppendSummaryPlotsForSummaryCasesFeature.h"
|
||||
#include "PlotBuilderCommands/RicSummaryPlotBuilder.h"
|
||||
|
||||
#include "PlotBuilderCommands/RicSummaryPlotBuilder.h"
|
||||
|
||||
#include "RifEclEclipseSummary.h"
|
||||
#include "RifEclipseRftAddress.h"
|
||||
#include "RifEclipseSummaryAddress.h"
|
||||
@@ -50,6 +52,7 @@
|
||||
#include "RimSummaryPlotSourceStepping.h"
|
||||
#include "RimSummaryTimeAxisProperties.h"
|
||||
|
||||
#include "RiuPlotMainWindowTools.h"
|
||||
#include "RiuSummaryMultiPlotBook.h"
|
||||
#include "RiuSummaryVectorSelectionUi.h"
|
||||
|
||||
@@ -118,6 +121,16 @@ RimSummaryMultiPlot::RimSummaryMultiPlot()
|
||||
m_disableWheelZoom.uiCapability()->setUiEditorTypeName( caf::PdmUiPushButtonEditor::uiEditorTypeName() );
|
||||
m_disableWheelZoom.uiCapability()->setUiIconFromResourceString( ":/DisableZoom.png" );
|
||||
|
||||
CAF_PDM_InitField( &m_appendNextPlot, "AppendNextPlot", false, "", "", "Step Next and Add to New Plot" );
|
||||
m_appendNextPlot.xmlCapability()->disableIO();
|
||||
m_appendNextPlot.uiCapability()->setUiEditorTypeName( caf::PdmUiPushButtonEditor::uiEditorTypeName() );
|
||||
m_appendNextPlot.uiCapability()->setUiIconFromResourceString( ":/AppendNext.png" );
|
||||
|
||||
CAF_PDM_InitField( &m_appendPrevPlot, "AppendPrevPlot", false, "", "", "Step Previous and Add to New Plot" );
|
||||
m_appendPrevPlot.xmlCapability()->disableIO();
|
||||
m_appendPrevPlot.uiCapability()->setUiEditorTypeName( caf::PdmUiPushButtonEditor::uiEditorTypeName() );
|
||||
m_appendPrevPlot.uiCapability()->setUiIconFromResourceString( ":/AppendPrev.png" );
|
||||
|
||||
CAF_PDM_InitField( &m_linkSubPlotAxes, "LinkSubPlotAxes", true, "Link Sub Plot Axes" );
|
||||
CAF_PDM_InitField( &m_autoAdjustAppearance, "AutoAdjustAppearance", false, "Auto Adjust Appearance" );
|
||||
|
||||
@@ -383,6 +396,18 @@ void RimSummaryMultiPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedFi
|
||||
m_createPlotDuplicate = false;
|
||||
duplicate();
|
||||
}
|
||||
else if ( changedField == &m_appendNextPlot )
|
||||
{
|
||||
m_appendNextPlot = false;
|
||||
int stepDirection = 1;
|
||||
appendSubPlotByStepping( stepDirection );
|
||||
}
|
||||
else if ( changedField == &m_appendPrevPlot )
|
||||
{
|
||||
m_appendPrevPlot = false;
|
||||
int stepDirection = -1;
|
||||
appendSubPlotByStepping( stepDirection );
|
||||
}
|
||||
else if ( changedField == &m_autoAdjustAppearance )
|
||||
{
|
||||
checkAndApplyAutoAppearance();
|
||||
@@ -413,13 +438,16 @@ void RimSummaryMultiPlot::updatePlotWindowTitle()
|
||||
{
|
||||
auto subPlotNameHelper = plot->plotTitleHelper();
|
||||
|
||||
// Disable auto plot, as this is required to be able to include the information in the multi plot title
|
||||
// Disable auto plot title, as this is required to be able to include the information in the multi plot title
|
||||
plot->enableAutoPlotTitle( false );
|
||||
|
||||
auto plotName = subPlotNameHelper->aggregatedPlotTitle( *m_nameHelper );
|
||||
plot->setPlotTitleVisible( true );
|
||||
plot->setDescription( plotName );
|
||||
plot->updatePlotTitle();
|
||||
}
|
||||
|
||||
if ( !m_viewer.isNull() ) m_viewer->scheduleTitleUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -495,6 +523,9 @@ std::vector<caf::PdmFieldHandle*> RimSummaryMultiPlot::fieldsToShowInToolbar()
|
||||
toolBarFields.insert( std::end( toolBarFields ), std::begin( fields ), std::end( fields ) );
|
||||
}
|
||||
|
||||
toolBarFields.push_back( &m_appendPrevPlot );
|
||||
toolBarFields.push_back( &m_appendNextPlot );
|
||||
|
||||
auto multiFields = RimMultiPlot::fieldsToShowInToolbar();
|
||||
toolBarFields.insert( std::end( toolBarFields ), std::begin( multiFields ), std::end( multiFields ) );
|
||||
|
||||
@@ -570,6 +601,7 @@ void RimSummaryMultiPlot::initAfterRead()
|
||||
void RimSummaryMultiPlot::onLoadDataAndUpdate()
|
||||
{
|
||||
RimMultiPlot::onLoadDataAndUpdate();
|
||||
updatePlotWindowTitle();
|
||||
|
||||
checkAndApplyAutoAppearance();
|
||||
}
|
||||
@@ -978,3 +1010,86 @@ QWidget* RimSummaryMultiPlot::createViewWidget( QWidget* mainWindowParent )
|
||||
|
||||
return m_viewer;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryMultiPlot::appendSubPlotByStepping( int direction )
|
||||
{
|
||||
if ( summaryPlots().empty() ) return;
|
||||
|
||||
auto newPlots = RicSummaryPlotBuilder::duplicatePlots( { summaryPlots().back() } );
|
||||
if ( newPlots.empty() ) return;
|
||||
|
||||
RimSummaryPlot* newPlot = dynamic_cast<RimSummaryPlot*>( newPlots[0] );
|
||||
if ( newPlot == nullptr ) return;
|
||||
|
||||
if ( m_sourceStepping()->stepDimension() == RimSummaryPlotSourceStepping::SourceSteppingDimension::SUMMARY_CASE )
|
||||
{
|
||||
newPlot->resolveReferencesRecursively();
|
||||
|
||||
RimSummaryCase* newCase = m_sourceStepping()->stepCase( direction );
|
||||
for ( auto curve : newPlot->allCurves( RimSummaryDataSourceStepping::Axis::Y_AXIS ) )
|
||||
{
|
||||
curve->setSummaryCaseX( newCase );
|
||||
curve->setSummaryCaseY( newCase );
|
||||
}
|
||||
}
|
||||
else if ( m_sourceStepping()->stepDimension() == RimSummaryPlotSourceStepping::SourceSteppingDimension::ENSEMBLE )
|
||||
{
|
||||
newPlot->resolveReferencesRecursively();
|
||||
|
||||
RimSummaryCaseCollection* newEnsemble = m_sourceStepping()->stepEnsemble( direction );
|
||||
for ( auto curveSet : newPlot->curveSets() )
|
||||
{
|
||||
curveSet->setSummaryCaseCollection( newEnsemble );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
auto mods = RimSummaryAddressModifier::createAddressModifiersForPlot( newPlot );
|
||||
for ( auto& mod : mods )
|
||||
{
|
||||
auto modifiedAdr = m_sourceStepping()->stepAddress( mod.address(), direction );
|
||||
mod.setAddress( modifiedAdr );
|
||||
}
|
||||
}
|
||||
|
||||
addPlot( newPlot );
|
||||
|
||||
newPlot->resolveReferencesRecursively();
|
||||
newPlot->loadDataAndUpdate();
|
||||
|
||||
updatePlotWindowTitle();
|
||||
updateConnectedEditors();
|
||||
|
||||
RiuPlotMainWindowTools::selectAsCurrentItem( newPlot, true );
|
||||
|
||||
updateSourceStepper();
|
||||
RiuPlotMainWindowTools::refreshToolbars();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryMultiPlot::updateSourceStepper()
|
||||
{
|
||||
if ( summaryPlots().empty() ) return;
|
||||
|
||||
RimSummaryPlot* plot = summaryPlots().back();
|
||||
|
||||
auto sourceStepper = plot->sourceStepper();
|
||||
if ( sourceStepper == nullptr ) return;
|
||||
|
||||
m_sourceStepping->syncWithStepper( sourceStepper );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryMultiPlot::keepVisiblePageAfterUpdate( bool keepPage )
|
||||
{
|
||||
if ( !m_viewer ) return;
|
||||
|
||||
if ( keepPage ) m_viewer->keepCurrentPageAfterUpdate();
|
||||
}
|
||||
|
||||
@@ -102,6 +102,8 @@ public:
|
||||
|
||||
void checkAndApplyAutoAppearance();
|
||||
|
||||
void keepVisiblePageAfterUpdate( bool keepPage );
|
||||
|
||||
protected:
|
||||
bool handleGlobalKeyEvent( QKeyEvent* keyEvent ) override;
|
||||
bool handleGlobalWheelEvent( QWheelEvent* wheelEvent ) override;
|
||||
@@ -118,9 +120,12 @@ private:
|
||||
|
||||
void updatePlotWindowTitle() override;
|
||||
void computeAggregatedAxisRange();
|
||||
void updateSourceStepper();
|
||||
|
||||
void duplicate();
|
||||
|
||||
void appendSubPlotByStepping( int direction );
|
||||
|
||||
void analyzePlotsAndAdjustAppearanceSettings();
|
||||
|
||||
void onSubPlotChanged( const caf::SignalEmitter* emitter );
|
||||
@@ -134,6 +139,9 @@ private:
|
||||
caf::PdmField<bool> m_linkSubPlotAxes;
|
||||
caf::PdmField<bool> m_autoAdjustAppearance;
|
||||
|
||||
caf::PdmField<bool> m_appendNextPlot;
|
||||
caf::PdmField<bool> m_appendPrevPlot;
|
||||
|
||||
caf::PdmField<caf::AppEnum<AxisRangeAggregation>> m_axisRangeAggregation;
|
||||
|
||||
caf::PdmChildField<RimSummaryPlotSourceStepping*> m_sourceStepping;
|
||||
|
||||
@@ -79,7 +79,7 @@ QString RimSummaryNameHelper::aggregatedPlotTitle( const RimSummaryNameHelper& o
|
||||
}
|
||||
|
||||
auto quantity = this->titleQuantity();
|
||||
if ( !other.isPlotDisplayingSingleQuantity() && !quantity.empty() )
|
||||
if ( ( other.titleQuantity() != this->titleQuantity() ) && ( !quantity.empty() ) )
|
||||
{
|
||||
if ( !title.isEmpty() ) title += ", ";
|
||||
title += QString::fromStdString(
|
||||
|
||||
@@ -2751,3 +2751,11 @@ void RimSummaryPlot::onChildDeleted( caf::PdmChildArrayFieldHandle* childAr
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimSummaryPlotSourceStepping* RimSummaryPlot::sourceStepper()
|
||||
{
|
||||
return m_sourceStepping();
|
||||
}
|
||||
|
||||
@@ -204,6 +204,8 @@ public:
|
||||
|
||||
std::vector<RimPlotCurve*> visibleCurvesForLegend() override;
|
||||
|
||||
RimSummaryPlotSourceStepping* sourceStepper();
|
||||
|
||||
public:
|
||||
// RimViewWindow overrides
|
||||
void deleteViewWidget() override;
|
||||
|
||||
@@ -46,6 +46,11 @@
|
||||
#include "cafPdmUiListEditor.h"
|
||||
#include "cafPdmUiToolBarEditor.h"
|
||||
|
||||
#include <QString>
|
||||
|
||||
#include <algorithm>
|
||||
#include <vector>
|
||||
|
||||
namespace caf
|
||||
{
|
||||
template <>
|
||||
@@ -58,6 +63,7 @@ void AppEnum<RimSummaryPlotSourceStepping::SourceSteppingDimension>::setUp()
|
||||
addItem( RimSummaryPlotSourceStepping::SourceSteppingDimension::GROUP, "GROUP", "Group" );
|
||||
addItem( RimSummaryPlotSourceStepping::SourceSteppingDimension::REGION, "REGION", "Region" );
|
||||
addItem( RimSummaryPlotSourceStepping::SourceSteppingDimension::BLOCK, "BLOCK", "Block" );
|
||||
addItem( RimSummaryPlotSourceStepping::SourceSteppingDimension::AQUIFER, "AQUIFER", "Aquifer" );
|
||||
setDefault( RimSummaryPlotSourceStepping::SourceSteppingDimension::QUANTITY );
|
||||
}
|
||||
} // namespace caf
|
||||
@@ -228,58 +234,7 @@ QList<caf::PdmOptionItemInfo>
|
||||
{
|
||||
if ( fieldNeedingOptions == &m_quantity )
|
||||
{
|
||||
RifEclipseSummaryAddress::SummaryVarCategory category = RifEclipseSummaryAddress::SUMMARY_FIELD;
|
||||
|
||||
auto visibleCurveAddresses = addressesForCurvesInPlot();
|
||||
if ( !visibleCurveAddresses.empty() )
|
||||
{
|
||||
category = visibleCurveAddresses.begin()->category();
|
||||
}
|
||||
|
||||
std::map<QString, QString> displayAndValueStrings;
|
||||
|
||||
{
|
||||
RiaSummaryAddressAnalyzer quantityAnalyzer;
|
||||
|
||||
auto subset = RiaSummaryAddressAnalyzer::addressesForCategory( addresses, category );
|
||||
quantityAnalyzer.appendAddresses( subset );
|
||||
|
||||
RiaSummaryAddressAnalyzer analyzerForVisibleCurves;
|
||||
analyzerForVisibleCurves.appendAddresses( visibleCurveAddresses );
|
||||
|
||||
if ( analyzerForVisibleCurves.quantityNamesWithHistory().empty() )
|
||||
{
|
||||
auto quantities = quantityAnalyzer.quantities();
|
||||
for ( const auto& s : quantities )
|
||||
{
|
||||
QString valueString = QString::fromStdString( s );
|
||||
|
||||
displayAndValueStrings[valueString] = valueString;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// The plot displays a mix of simulated and observed vectors
|
||||
// Create a combined item for source stepping
|
||||
|
||||
auto quantitiesWithHistory = quantityAnalyzer.quantityNamesWithHistory();
|
||||
for ( const auto& s : quantitiesWithHistory )
|
||||
{
|
||||
QString valueString = QString::fromStdString( s );
|
||||
QString displayString = valueString + " (H)";
|
||||
|
||||
displayAndValueStrings[displayString] = valueString;
|
||||
}
|
||||
|
||||
auto quantitiesNoHistory = quantityAnalyzer.quantityNamesNoHistory();
|
||||
for ( const auto& s : quantitiesNoHistory )
|
||||
{
|
||||
QString valueString = QString::fromStdString( s );
|
||||
|
||||
displayAndValueStrings[valueString] = valueString;
|
||||
}
|
||||
}
|
||||
}
|
||||
std::map<QString, QString> displayAndValueStrings = optionsForQuantity( addresses );
|
||||
|
||||
for ( const auto& displayAndValue : displayAndValueStrings )
|
||||
{
|
||||
@@ -460,15 +415,15 @@ void RimSummaryPlotSourceStepping::fieldChangedByUi( const caf::PdmFieldHandle*
|
||||
if ( isYAxisStepping() )
|
||||
{
|
||||
auto adr = curve->summaryAddressY();
|
||||
RimDataSourceSteppingTools::updateHistoryAndSummaryQuantityIfMatching( oldValue, newValue, &adr );
|
||||
curve->setSummaryAddressY( adr );
|
||||
if ( RimDataSourceSteppingTools::updateQuantityIfMatching( oldValue, newValue, &adr ) )
|
||||
curve->setSummaryAddressY( adr );
|
||||
}
|
||||
|
||||
if ( isXAxisStepping() )
|
||||
{
|
||||
auto adr = curve->summaryAddressX();
|
||||
RimDataSourceSteppingTools::updateHistoryAndSummaryQuantityIfMatching( oldValue, newValue, &adr );
|
||||
curve->setSummaryAddressX( adr );
|
||||
if ( RimDataSourceSteppingTools::updateQuantityIfMatching( oldValue, newValue, &adr ) )
|
||||
curve->setSummaryAddressX( adr );
|
||||
}
|
||||
|
||||
curve->setDefaultCurveAppearance();
|
||||
@@ -479,14 +434,15 @@ void RimSummaryPlotSourceStepping::fieldChangedByUi( const caf::PdmFieldHandle*
|
||||
for ( auto curveSet : dataSourceSteppingObject()->curveSets() )
|
||||
{
|
||||
auto adr = curveSet->summaryAddress();
|
||||
RimDataSourceSteppingTools::updateHistoryAndSummaryQuantityIfMatching( oldValue, newValue, &adr );
|
||||
curveSet->setSummaryAddress( adr );
|
||||
if ( RimDataSourceSteppingTools::updateQuantityIfMatching( oldValue, newValue, &adr ) )
|
||||
curveSet->setSummaryAddress( adr );
|
||||
}
|
||||
}
|
||||
|
||||
m_quantity.uiCapability()->updateConnectedEditors();
|
||||
triggerLoadDataAndUpdate = true;
|
||||
}
|
||||
|
||||
if ( changedField != &m_quantity )
|
||||
{
|
||||
RifEclipseSummaryAddress::SummaryVarCategory summaryCategoryToModify = RifEclipseSummaryAddress::SUMMARY_INVALID;
|
||||
if ( changedField == &m_wellName )
|
||||
@@ -555,17 +511,21 @@ void RimSummaryPlotSourceStepping::fieldChangedByUi( const caf::PdmFieldHandle*
|
||||
{
|
||||
RimSummaryPlot* summaryPlot = nullptr;
|
||||
this->firstAncestorOrThisOfType( summaryPlot );
|
||||
if ( summaryPlot )
|
||||
{
|
||||
summaryPlot->updatePlotTitle();
|
||||
summaryPlot->loadDataAndUpdate();
|
||||
summaryPlot->updateConnectedEditors();
|
||||
}
|
||||
|
||||
RimSummaryMultiPlot* summaryMultiPlot = dynamic_cast<RimSummaryMultiPlot*>( m_objectForSourceStepping.p() );
|
||||
if ( summaryMultiPlot )
|
||||
{
|
||||
summaryMultiPlot->keepVisiblePageAfterUpdate( true );
|
||||
summaryMultiPlot->loadDataAndUpdate();
|
||||
RiuPlotMainWindow* mainPlotWindow = RiaGuiApplication::instance()->mainPlotWindow();
|
||||
mainPlotWindow->updateMultiPlotToolBar();
|
||||
}
|
||||
else
|
||||
{
|
||||
summaryPlot->updatePlotTitle();
|
||||
summaryPlot->loadDataAndUpdate();
|
||||
summaryPlot->updateConnectedEditors();
|
||||
summaryPlot->curvesChanged.send();
|
||||
}
|
||||
|
||||
RimEnsembleCurveSetCollection* ensembleCurveColl = nullptr;
|
||||
@@ -622,12 +582,6 @@ caf::PdmValueField* RimSummaryPlotSourceStepping::fieldToModify()
|
||||
case SourceSteppingDimension::BLOCK:
|
||||
return &m_cellBlock;
|
||||
|
||||
case SourceSteppingDimension::SEGMENT:
|
||||
return &m_segment;
|
||||
|
||||
case SourceSteppingDimension::COMPLETION:
|
||||
return &m_completion;
|
||||
|
||||
case SourceSteppingDimension::AQUIFER:
|
||||
return &m_aquifer;
|
||||
|
||||
@@ -1024,3 +978,311 @@ std::vector<caf::PdmFieldHandle*> RimSummaryPlotSourceStepping::toolbarFieldsFor
|
||||
|
||||
return fields;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RifEclipseSummaryAddress RimSummaryPlotSourceStepping::stepAddress( RifEclipseSummaryAddress addr, int direction )
|
||||
{
|
||||
auto addresses = adressesForSourceStepping();
|
||||
RiaSummaryAddressAnalyzer analyzer;
|
||||
analyzer.appendAddresses( addresses );
|
||||
|
||||
switch ( m_stepDimension() )
|
||||
{
|
||||
case SourceSteppingDimension::WELL:
|
||||
{
|
||||
auto ids = analyzer.identifierTexts( RifEclipseSummaryAddress::SUMMARY_WELL, "" );
|
||||
auto& curName = addr.wellName();
|
||||
auto found = std::find( ids.begin(), ids.end(), QString::fromStdString( curName ) );
|
||||
if ( found != ids.end() )
|
||||
{
|
||||
if ( direction > 0 )
|
||||
{
|
||||
found++;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( found != ids.begin() ) found--;
|
||||
}
|
||||
if ( found != ids.end() ) addr.setWellName( ( *found ).toStdString() );
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case SourceSteppingDimension::GROUP:
|
||||
{
|
||||
auto ids = analyzer.identifierTexts( RifEclipseSummaryAddress::SUMMARY_GROUP, "" );
|
||||
auto& curName = addr.groupName();
|
||||
auto found = std::find( ids.begin(), ids.end(), QString::fromStdString( curName ) );
|
||||
if ( found != ids.end() )
|
||||
{
|
||||
if ( direction > 0 )
|
||||
{
|
||||
found++;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( found != ids.begin() ) found--;
|
||||
}
|
||||
if ( found != ids.end() ) addr.setGroupName( ( *found ).toStdString() );
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case SourceSteppingDimension::REGION:
|
||||
{
|
||||
auto ids = analyzer.identifierTexts( RifEclipseSummaryAddress::SUMMARY_REGION, "" );
|
||||
int curRegion = addr.regionNumber();
|
||||
auto found = std::find( ids.begin(), ids.end(), curRegion );
|
||||
if ( found != ids.end() )
|
||||
{
|
||||
if ( direction > 0 )
|
||||
{
|
||||
found++;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( found != ids.begin() ) found--;
|
||||
}
|
||||
if ( found != ids.end() ) addr.setRegion( ( *found ).toInt() );
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case SourceSteppingDimension::QUANTITY:
|
||||
{
|
||||
auto options = optionsForQuantity( addresses );
|
||||
|
||||
std::vector<QString> values;
|
||||
for ( auto it = options.begin(); it != options.end(); it++ )
|
||||
{
|
||||
values.push_back( it->second );
|
||||
}
|
||||
|
||||
QString qName = QString::fromStdString( addr.quantityName() );
|
||||
auto found = std::find( values.begin(), values.end(), qName );
|
||||
if ( found != values.end() )
|
||||
{
|
||||
if ( direction > 0 )
|
||||
{
|
||||
found++;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( found != values.begin() ) found--;
|
||||
}
|
||||
if ( found != values.end() ) addr.setQuantityName( ( *found ).toStdString() );
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case SourceSteppingDimension::BLOCK:
|
||||
{
|
||||
auto ids = analyzer.identifierTexts( RifEclipseSummaryAddress::SUMMARY_BLOCK, "" );
|
||||
auto curName = addr.blockAsString();
|
||||
auto found = std::find( ids.begin(), ids.end(), QString::fromStdString( curName ) );
|
||||
if ( found != ids.end() )
|
||||
{
|
||||
if ( direction > 0 )
|
||||
{
|
||||
found++;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( found != ids.begin() ) found--;
|
||||
}
|
||||
if ( found != ids.end() )
|
||||
{
|
||||
addr.setCellIjk( ( *found ).toStdString() );
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case SourceSteppingDimension::AQUIFER:
|
||||
{
|
||||
auto ids = analyzer.identifierTexts( RifEclipseSummaryAddress::SUMMARY_AQUIFER, "" );
|
||||
int curRegion = addr.aquiferNumber();
|
||||
auto found = std::find( ids.begin(), ids.end(), curRegion );
|
||||
if ( found != ids.end() )
|
||||
{
|
||||
if ( direction > 0 )
|
||||
{
|
||||
found++;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( found != ids.begin() ) found--;
|
||||
}
|
||||
if ( found != ids.end() ) addr.setAquiferNumber( ( *found ).toInt() );
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return addr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryPlotSourceStepping::syncWithStepper( RimSummaryPlotSourceStepping* other )
|
||||
{
|
||||
switch ( m_stepDimension() )
|
||||
{
|
||||
case SourceSteppingDimension::SUMMARY_CASE:
|
||||
m_summaryCase = other->m_summaryCase();
|
||||
break;
|
||||
|
||||
case SourceSteppingDimension::ENSEMBLE:
|
||||
m_ensemble = other->m_ensemble();
|
||||
break;
|
||||
|
||||
case SourceSteppingDimension::WELL:
|
||||
m_wellName = other->m_wellName();
|
||||
break;
|
||||
|
||||
case SourceSteppingDimension::GROUP:
|
||||
m_groupName = other->m_groupName();
|
||||
break;
|
||||
|
||||
case SourceSteppingDimension::REGION:
|
||||
m_region = other->m_region();
|
||||
break;
|
||||
|
||||
case SourceSteppingDimension::QUANTITY:
|
||||
m_quantity = other->m_quantity();
|
||||
break;
|
||||
|
||||
case SourceSteppingDimension::BLOCK:
|
||||
m_cellBlock = other->m_cellBlock();
|
||||
break;
|
||||
|
||||
case SourceSteppingDimension::AQUIFER:
|
||||
m_aquifer = other->m_aquifer();
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::map<QString, QString> RimSummaryPlotSourceStepping::optionsForQuantity( std::set<RifEclipseSummaryAddress> addresses )
|
||||
{
|
||||
RifEclipseSummaryAddress::SummaryVarCategory category = RifEclipseSummaryAddress::SUMMARY_FIELD;
|
||||
|
||||
auto visibleCurveAddresses = addressesForCurvesInPlot();
|
||||
if ( !visibleCurveAddresses.empty() )
|
||||
{
|
||||
category = visibleCurveAddresses.begin()->category();
|
||||
}
|
||||
|
||||
std::map<QString, QString> displayAndValueStrings;
|
||||
|
||||
{
|
||||
RiaSummaryAddressAnalyzer quantityAnalyzer;
|
||||
|
||||
auto subset = RiaSummaryAddressAnalyzer::addressesForCategory( addresses, category );
|
||||
quantityAnalyzer.appendAddresses( subset );
|
||||
|
||||
RiaSummaryAddressAnalyzer analyzerForVisibleCurves;
|
||||
analyzerForVisibleCurves.appendAddresses( visibleCurveAddresses );
|
||||
|
||||
auto quantities = quantityAnalyzer.quantities();
|
||||
for ( const auto& s : quantities )
|
||||
{
|
||||
QString valueString = QString::fromStdString( s );
|
||||
|
||||
displayAndValueStrings[valueString] = valueString;
|
||||
}
|
||||
}
|
||||
|
||||
return displayAndValueStrings;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimSummaryPlotSourceStepping::SourceSteppingDimension RimSummaryPlotSourceStepping::stepDimension() const
|
||||
{
|
||||
return m_stepDimension();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimSummaryCase* RimSummaryPlotSourceStepping::stepCase( int direction )
|
||||
{
|
||||
std::vector<RimSummaryCase*> cases;
|
||||
|
||||
auto summaryCases = RimSummaryPlotSourceStepping::summaryCasesForSourceStepping();
|
||||
for ( auto sumCase : summaryCases )
|
||||
{
|
||||
if ( sumCase->ensemble() )
|
||||
{
|
||||
if ( m_includeEnsembleCasesForCaseStepping() )
|
||||
{
|
||||
cases.push_back( sumCase );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
cases.push_back( sumCase );
|
||||
}
|
||||
}
|
||||
|
||||
auto found = std::find( cases.begin(), cases.end(), m_summaryCase() );
|
||||
if ( found != cases.end() )
|
||||
{
|
||||
if ( direction > 0 )
|
||||
{
|
||||
found++;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( found != cases.begin() ) found--;
|
||||
}
|
||||
if ( found != cases.end() ) return *found;
|
||||
}
|
||||
|
||||
return m_summaryCase;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimSummaryCaseCollection* RimSummaryPlotSourceStepping::stepEnsemble( int direction )
|
||||
{
|
||||
std::vector<RimSummaryCaseCollection*> ensembles;
|
||||
|
||||
RimProject* proj = RimProject::current();
|
||||
for ( auto ensemble : proj->summaryGroups() )
|
||||
{
|
||||
if ( ensemble->isEnsemble() )
|
||||
{
|
||||
ensembles.push_back( ensemble );
|
||||
}
|
||||
}
|
||||
|
||||
auto found = std::find( ensembles.begin(), ensembles.end(), m_ensemble() );
|
||||
if ( found != ensembles.end() )
|
||||
{
|
||||
if ( direction > 0 )
|
||||
{
|
||||
found++;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( found != ensembles.begin() ) found--;
|
||||
}
|
||||
if ( found != ensembles.end() ) return *found;
|
||||
}
|
||||
|
||||
return m_ensemble;
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
|
||||
#include <QString>
|
||||
|
||||
#include <map>
|
||||
#include <set>
|
||||
|
||||
class RimSummaryCase;
|
||||
@@ -52,8 +53,6 @@ public:
|
||||
REGION,
|
||||
QUANTITY,
|
||||
BLOCK,
|
||||
SEGMENT,
|
||||
COMPLETION,
|
||||
AQUIFER
|
||||
};
|
||||
|
||||
@@ -68,6 +67,14 @@ public:
|
||||
|
||||
std::vector<caf::PdmFieldHandle*> fieldsToShowInToolbar();
|
||||
|
||||
RifEclipseSummaryAddress stepAddress( RifEclipseSummaryAddress addr, int direction );
|
||||
RimSummaryCase* stepCase( int direction );
|
||||
RimSummaryCaseCollection* stepEnsemble( int direction );
|
||||
|
||||
void syncWithStepper( RimSummaryPlotSourceStepping* other );
|
||||
|
||||
RimSummaryPlotSourceStepping::SourceSteppingDimension stepDimension() const;
|
||||
|
||||
private:
|
||||
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
||||
|
||||
@@ -101,6 +108,8 @@ private:
|
||||
|
||||
RimSummaryDataSourceStepping* dataSourceSteppingObject() const;
|
||||
|
||||
std::map<QString, QString> optionsForQuantity( std::set<RifEclipseSummaryAddress> addresses );
|
||||
|
||||
private:
|
||||
caf::PdmPointer<caf::PdmObject> m_objectForSourceStepping;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user