mirror of
https://github.com/OPM/ResInsight.git
synced 2026-10-25 06:38:13 -05:00
#12720 Histogram: Recreate summary vector curves when dropping an ensemble
When an ensemble is dropped on a histogram plot showing summary vector curves, create a new curve per distinct vector and time step for the dropped ensemble, matching the existing behavior for ensemble parameter curves.
This commit is contained in:
1 parent
2a19af2321
commit
5674130504
4 files changed
+58
-6
No files matched your search
@@ -228,11 +228,30 @@ std::set<QString> RicHistogramPlotTools::existingEnsembleParameters( RimHistogra
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::set<std::pair<RifEclipseSummaryAddress, QDateTime>> RicHistogramPlotTools::existingSummaryVectors( RimHistogramPlot* plot )
|
||||
{
|
||||
std::set<std::pair<RifEclipseSummaryAddress, QDateTime>> foundVectors;
|
||||
|
||||
for ( auto source : existingDataSources( plot ) )
|
||||
{
|
||||
if ( auto histSource = dynamic_cast<RimEnsembleSummaryVectorHistogramDataSource*>( source ) )
|
||||
{
|
||||
foundVectors.insert( { histSource->summaryAddress(), histSource->timeStep() } );
|
||||
}
|
||||
}
|
||||
|
||||
return foundVectors;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Recreate the data sources shown in the plot for the given ensemble
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicHistogramPlotTools::appendEnsembleToHistogram( RimHistogramPlot* plot, RimSummaryEnsemble* ensemble )
|
||||
{
|
||||
auto currentParameters = existingEnsembleParameters( plot );
|
||||
auto currentVectors = existingSummaryVectors( plot );
|
||||
|
||||
if ( currentParameters.empty() )
|
||||
if ( currentParameters.empty() && currentVectors.empty() )
|
||||
{
|
||||
auto newDataSource = new RimEnsembleParameterHistogramDataSource();
|
||||
newDataSource->setDefaults();
|
||||
@@ -248,4 +267,13 @@ void RicHistogramPlotTools::appendEnsembleToHistogram( RimHistogramPlot* plot, R
|
||||
newDataSource->setEnsembleParameter( parameter );
|
||||
appendEnsembleParameterHistogramCurve( plot, newDataSource );
|
||||
}
|
||||
|
||||
for ( const auto& [address, timeStep] : currentVectors )
|
||||
{
|
||||
auto newDataSource = new RimEnsembleSummaryVectorHistogramDataSource();
|
||||
newDataSource->setEnsemble( ensemble );
|
||||
newDataSource->setSummaryAddress( address );
|
||||
newDataSource->setTimeStep( timeStep );
|
||||
createHistogramCurve( plot, newDataSource );
|
||||
}
|
||||
}
|
||||
@@ -18,9 +18,13 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RifEclipseSummaryAddress.h"
|
||||
|
||||
#include <set>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include <QDateTime>
|
||||
#include <QString>
|
||||
|
||||
class RimHistogramDataSource;
|
||||
@@ -58,7 +62,8 @@ public:
|
||||
|
||||
static void appendEnsembleToHistogram( RimHistogramPlot* plot, RimSummaryEnsemble* ensemble );
|
||||
|
||||
static std::set<QString> existingEnsembleParameters( RimHistogramPlot* plot );
|
||||
static std::set<QString> existingEnsembleParameters( RimHistogramPlot* plot );
|
||||
static std::set<std::pair<RifEclipseSummaryAddress, QDateTime>> existingSummaryVectors( RimHistogramPlot* plot );
|
||||
|
||||
private:
|
||||
static std::vector<RimHistogramDataSource*> existingDataSources( RimHistogramPlot* plot );
|
||||
|
||||
+18
-2
@@ -290,7 +290,7 @@ void RimEnsembleSummaryVectorHistogramDataSource::setEnsemble( RimSummaryEnsembl
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEnsembleSummaryVectorHistogramDataSource::setSummaryAddress( RifEclipseSummaryAddress& summaryAddress )
|
||||
void RimEnsembleSummaryVectorHistogramDataSource::setSummaryAddress( const RifEclipseSummaryAddress& summaryAddress )
|
||||
{
|
||||
m_summaryAddressUiField = summaryAddress;
|
||||
m_summaryAddress->setAddress( m_summaryAddressUiField );
|
||||
@@ -299,11 +299,27 @@ void RimEnsembleSummaryVectorHistogramDataSource::setSummaryAddress( RifEclipseS
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEnsembleSummaryVectorHistogramDataSource::setTimeStep( QDateTime& timeStep )
|
||||
void RimEnsembleSummaryVectorHistogramDataSource::setTimeStep( const QDateTime& timeStep )
|
||||
{
|
||||
m_timeStep = timeStep;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RifEclipseSummaryAddress RimEnsembleSummaryVectorHistogramDataSource::summaryAddress() const
|
||||
{
|
||||
return m_summaryAddress->address();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QDateTime RimEnsembleSummaryVectorHistogramDataSource::timeStep() const
|
||||
{
|
||||
return m_timeStep();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
+5
-2
@@ -42,8 +42,11 @@ public:
|
||||
~RimEnsembleSummaryVectorHistogramDataSource() override;
|
||||
|
||||
void setEnsemble( RimSummaryEnsemble* ensemble );
|
||||
void setSummaryAddress( RifEclipseSummaryAddress& summaryAddress );
|
||||
void setTimeStep( QDateTime& timeStep );
|
||||
void setSummaryAddress( const RifEclipseSummaryAddress& summaryAddress );
|
||||
void setTimeStep( const QDateTime& timeStep );
|
||||
|
||||
RifEclipseSummaryAddress summaryAddress() const;
|
||||
QDateTime timeStep() const;
|
||||
|
||||
std::string unitNameX() const override;
|
||||
std::string unitNameY() const override;
|
||||
|
||||
Reference in new issue
Block a user