mirror of
https://github.com/OPM/ResInsight.git
synced 2026-10-12 08:25:03 -05:00
Update multiplot source stepping - append plot (#9030)
* Make sure we append a new plot for all plots that matches the current source stepper, allows stepping and appending multiple plots at once
This commit is contained in:
1 parent
d146ada592
commit
2fdd5875ea
3 files changed
+157
-37
No files matched your search
@@ -1292,52 +1292,54 @@ void RimSummaryMultiPlot::appendSubPlotByStepping( int direction )
|
|||||||
{
|
{
|
||||||
if ( summaryPlots().empty() ) return;
|
if ( summaryPlots().empty() ) return;
|
||||||
|
|
||||||
auto newPlots = RicSummaryPlotBuilder::duplicatePlots( { summaryPlots().back() } );
|
// find matching plots
|
||||||
|
std::vector<RimPlot*> plots = m_sourceStepping->plotsMatchingStepSettings( summaryPlots() );
|
||||||
|
if ( plots.empty() ) return;
|
||||||
|
|
||||||
|
// duplicate them
|
||||||
|
auto newPlots = RicSummaryPlotBuilder::duplicatePlots( plots );
|
||||||
if ( newPlots.empty() ) return;
|
if ( newPlots.empty() ) return;
|
||||||
|
|
||||||
RimSummaryPlot* newPlot = dynamic_cast<RimSummaryPlot*>( newPlots[0] );
|
for ( auto plot : newPlots )
|
||||||
if ( newPlot == nullptr ) return;
|
|
||||||
|
|
||||||
if ( m_sourceStepping()->stepDimension() == RimSummaryDataSourceStepping::SourceSteppingDimension::SUMMARY_CASE )
|
|
||||||
{
|
{
|
||||||
|
RimSummaryPlot* newPlot = dynamic_cast<RimSummaryPlot*>( plot );
|
||||||
|
if ( newPlot == nullptr ) continue;
|
||||||
|
|
||||||
|
addPlot( newPlot );
|
||||||
newPlot->resolveReferencesRecursively();
|
newPlot->resolveReferencesRecursively();
|
||||||
|
|
||||||
RimSummaryCase* newCase = m_sourceStepping()->stepCase( direction );
|
if ( m_sourceStepping()->stepDimension() == RimSummaryDataSourceStepping::SourceSteppingDimension::SUMMARY_CASE )
|
||||||
for ( auto curve : newPlot->allCurves( RimSummaryDataSourceStepping::Axis::Y_AXIS ) )
|
|
||||||
{
|
{
|
||||||
curve->setSummaryCaseX( newCase );
|
RimSummaryCase* newCase = m_sourceStepping()->stepCase( direction );
|
||||||
curve->setSummaryCaseY( newCase );
|
for ( auto curve : newPlot->allCurves( RimSummaryDataSourceStepping::Axis::Y_AXIS ) )
|
||||||
|
{
|
||||||
|
curve->setSummaryCaseX( newCase );
|
||||||
|
curve->setSummaryCaseY( newCase );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
else if ( m_sourceStepping()->stepDimension() == RimSummaryDataSourceStepping::SourceSteppingDimension::ENSEMBLE )
|
||||||
else if ( m_sourceStepping()->stepDimension() == RimSummaryDataSourceStepping::SourceSteppingDimension::ENSEMBLE )
|
|
||||||
{
|
|
||||||
newPlot->resolveReferencesRecursively();
|
|
||||||
|
|
||||||
RimSummaryCaseCollection* newEnsemble = m_sourceStepping()->stepEnsemble( direction );
|
|
||||||
for ( auto curveSet : newPlot->curveSets() )
|
|
||||||
{
|
{
|
||||||
curveSet->setSummaryCaseCollection( newEnsemble );
|
RimSummaryCaseCollection* newEnsemble = m_sourceStepping()->stepEnsemble( direction );
|
||||||
|
for ( auto curveSet : newPlot->curveSets() )
|
||||||
|
{
|
||||||
|
curveSet->setSummaryCaseCollection( newEnsemble );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
else
|
|
||||||
{
|
|
||||||
auto mods = RimSummaryAddressModifier::createAddressModifiersForPlot( newPlot );
|
|
||||||
for ( auto& mod : mods )
|
|
||||||
{
|
{
|
||||||
auto modifiedAdr = m_sourceStepping()->stepAddress( mod.address(), direction );
|
auto mods = RimSummaryAddressModifier::createAddressModifiersForPlot( newPlot );
|
||||||
mod.setAddress( modifiedAdr );
|
for ( auto& mod : mods )
|
||||||
|
{
|
||||||
|
auto modifiedAdr = m_sourceStepping()->stepAddress( mod.address(), direction );
|
||||||
|
mod.setAddress( modifiedAdr );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
addPlot( newPlot );
|
loadDataAndUpdate();
|
||||||
|
|
||||||
newPlot->resolveReferencesRecursively();
|
|
||||||
newPlot->loadDataAndUpdate();
|
|
||||||
|
|
||||||
updatePlotWindowTitle();
|
|
||||||
updateConnectedEditors();
|
updateConnectedEditors();
|
||||||
|
|
||||||
RiuPlotMainWindowTools::selectAsCurrentItem( newPlot, true );
|
RiuPlotMainWindowTools::selectAsCurrentItem( newPlots.back(), true );
|
||||||
|
|
||||||
updateSourceStepper();
|
updateSourceStepper();
|
||||||
RiuPlotMainWindowTools::refreshToolbars();
|
RiuPlotMainWindowTools::refreshToolbars();
|
||||||
|
|||||||
@@ -28,6 +28,7 @@
|
|||||||
#include "RimEnsembleCurveSet.h"
|
#include "RimEnsembleCurveSet.h"
|
||||||
#include "RimEnsembleCurveSetCollection.h"
|
#include "RimEnsembleCurveSetCollection.h"
|
||||||
#include "RimProject.h"
|
#include "RimProject.h"
|
||||||
|
#include "RimSummaryAddressModifier.h"
|
||||||
#include "RimSummaryCase.h"
|
#include "RimSummaryCase.h"
|
||||||
#include "RimSummaryCaseMainCollection.h"
|
#include "RimSummaryCaseMainCollection.h"
|
||||||
#include "RimSummaryCrossPlot.h"
|
#include "RimSummaryCrossPlot.h"
|
||||||
@@ -1030,9 +1031,9 @@ RifEclipseSummaryAddress RimSummaryPlotSourceStepping::stepAddress( RifEclipseSu
|
|||||||
|
|
||||||
case RimSummaryDataSourceStepping::SourceSteppingDimension::REGION:
|
case RimSummaryDataSourceStepping::SourceSteppingDimension::REGION:
|
||||||
{
|
{
|
||||||
auto ids = analyzer.identifierTexts( RifEclipseSummaryAddress::SUMMARY_REGION, "" );
|
auto ids = analyzer.identifierTexts( RifEclipseSummaryAddress::SUMMARY_REGION, "" );
|
||||||
int curRegion = addr.regionNumber();
|
QString curRegion = QString::number( addr.regionNumber() );
|
||||||
auto found = std::find( ids.begin(), ids.end(), curRegion );
|
auto found = std::find( ids.begin(), ids.end(), curRegion );
|
||||||
if ( found != ids.end() )
|
if ( found != ids.end() )
|
||||||
{
|
{
|
||||||
if ( direction > 0 )
|
if ( direction > 0 )
|
||||||
@@ -1100,9 +1101,9 @@ RifEclipseSummaryAddress RimSummaryPlotSourceStepping::stepAddress( RifEclipseSu
|
|||||||
|
|
||||||
case RimSummaryDataSourceStepping::SourceSteppingDimension::AQUIFER:
|
case RimSummaryDataSourceStepping::SourceSteppingDimension::AQUIFER:
|
||||||
{
|
{
|
||||||
auto ids = analyzer.identifierTexts( RifEclipseSummaryAddress::SUMMARY_AQUIFER, "" );
|
auto ids = analyzer.identifierTexts( RifEclipseSummaryAddress::SUMMARY_AQUIFER, "" );
|
||||||
int curRegion = addr.aquiferNumber();
|
QString curAq = QString::number( addr.aquiferNumber() );
|
||||||
auto found = std::find( ids.begin(), ids.end(), curRegion );
|
auto found = std::find( ids.begin(), ids.end(), curAq );
|
||||||
if ( found != ids.end() )
|
if ( found != ids.end() )
|
||||||
{
|
{
|
||||||
if ( direction > 0 )
|
if ( direction > 0 )
|
||||||
@@ -1331,3 +1332,116 @@ void RimSummaryPlotSourceStepping::updateStepIndex( int direction )
|
|||||||
bool notifyChange = false;
|
bool notifyChange = false;
|
||||||
modifyCurrentIndex( valueField, direction, notifyChange );
|
modifyCurrentIndex( valueField, direction, notifyChange );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
std::vector<RimPlot*> RimSummaryPlotSourceStepping::plotsMatchingStepSettings( std::vector<RimSummaryPlot*> plots )
|
||||||
|
{
|
||||||
|
std::vector<RimPlot*> matchingPlots;
|
||||||
|
|
||||||
|
int caseIdToMatch = -1;
|
||||||
|
int ensembleIdToMatch = -1;
|
||||||
|
std::string wellNameToMatch;
|
||||||
|
std::string groupNameToMatch;
|
||||||
|
int regionToMatch = -1;
|
||||||
|
std::string vectorToMatch;
|
||||||
|
std::string blockToMatch;
|
||||||
|
int aquiferToMatch = -1;
|
||||||
|
|
||||||
|
switch ( m_stepDimension() )
|
||||||
|
{
|
||||||
|
case RimSummaryDataSourceStepping::SourceSteppingDimension::SUMMARY_CASE:
|
||||||
|
if ( m_summaryCase() ) caseIdToMatch = m_summaryCase()->caseId();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case RimSummaryDataSourceStepping::SourceSteppingDimension::ENSEMBLE:
|
||||||
|
if ( m_ensemble() ) ensembleIdToMatch = m_ensemble()->ensembleId();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case RimSummaryDataSourceStepping::SourceSteppingDimension::WELL:
|
||||||
|
wellNameToMatch = m_wellName().toStdString();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case RimSummaryDataSourceStepping::SourceSteppingDimension::GROUP:
|
||||||
|
groupNameToMatch = m_groupName().toStdString();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case RimSummaryDataSourceStepping::SourceSteppingDimension::REGION:
|
||||||
|
regionToMatch = m_region();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case RimSummaryDataSourceStepping::SourceSteppingDimension::VECTOR:
|
||||||
|
vectorToMatch = m_vectorName().toStdString();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case RimSummaryDataSourceStepping::SourceSteppingDimension::BLOCK:
|
||||||
|
blockToMatch = m_cellBlock().toStdString();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case RimSummaryDataSourceStepping::SourceSteppingDimension::AQUIFER:
|
||||||
|
aquiferToMatch = m_aquifer();
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
for ( auto plot : plots )
|
||||||
|
{
|
||||||
|
bool isMatching = false;
|
||||||
|
|
||||||
|
if ( caseIdToMatch != -1 )
|
||||||
|
{
|
||||||
|
auto curves = plot->summaryCurves();
|
||||||
|
for ( auto c : curves )
|
||||||
|
{
|
||||||
|
if ( c->summaryCaseY()->caseId() == caseIdToMatch ) isMatching = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if ( ensembleIdToMatch != -1 )
|
||||||
|
{
|
||||||
|
auto curves = plot->curveSets();
|
||||||
|
for ( auto c : curves )
|
||||||
|
{
|
||||||
|
if ( c->ensembleId() == ensembleIdToMatch ) isMatching = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
auto addresses = RimSummaryAddressModifier::createEclipseSummaryAddress( plot );
|
||||||
|
|
||||||
|
for ( const auto& a : addresses )
|
||||||
|
{
|
||||||
|
if ( !wellNameToMatch.empty() && a.wellName() == wellNameToMatch )
|
||||||
|
{
|
||||||
|
isMatching = true;
|
||||||
|
}
|
||||||
|
else if ( !vectorToMatch.empty() && a.vectorName() == vectorToMatch )
|
||||||
|
{
|
||||||
|
isMatching = true;
|
||||||
|
}
|
||||||
|
else if ( !groupNameToMatch.empty() && a.groupName() == groupNameToMatch )
|
||||||
|
{
|
||||||
|
isMatching = true;
|
||||||
|
}
|
||||||
|
else if ( regionToMatch != -1 && a.regionNumber() == regionToMatch )
|
||||||
|
{
|
||||||
|
isMatching = true;
|
||||||
|
}
|
||||||
|
else if ( !blockToMatch.empty() && a.blockAsString() == blockToMatch )
|
||||||
|
{
|
||||||
|
isMatching = true;
|
||||||
|
}
|
||||||
|
else if ( aquiferToMatch != -1 && a.aquiferNumber() == aquiferToMatch )
|
||||||
|
{
|
||||||
|
isMatching = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( isMatching ) matchingPlots.push_back( plot );
|
||||||
|
}
|
||||||
|
|
||||||
|
return matchingPlots;
|
||||||
|
}
|
||||||
@@ -36,6 +36,8 @@ class RifSummaryReaderInterface;
|
|||||||
class RimSummaryCaseCollection;
|
class RimSummaryCaseCollection;
|
||||||
class RifEclipseSummaryAddress;
|
class RifEclipseSummaryAddress;
|
||||||
class RiaSummaryAddressAnalyzer;
|
class RiaSummaryAddressAnalyzer;
|
||||||
|
class RimSummaryPlot;
|
||||||
|
class RimPlot;
|
||||||
|
|
||||||
//==================================================================================================
|
//==================================================================================================
|
||||||
///
|
///
|
||||||
@@ -66,6 +68,8 @@ public:
|
|||||||
|
|
||||||
void updateStepIndex( int direction );
|
void updateStepIndex( int direction );
|
||||||
|
|
||||||
|
std::vector<RimPlot*> plotsMatchingStepSettings( std::vector<RimSummaryPlot*> plots );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user