mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#5706 Analysis plot source filtering Gui starting to work. (Options, max/min values etc)
No actual filtering yet No support for time range or selected timesteps yet
This commit is contained in:
@@ -257,7 +257,25 @@ std::set<EnsembleParameter> RimAnalysisPlot::ensembleParameters()
|
||||
|
||||
RimCurveDefinitionAnalyser* analyserOfSelectedCurveDefs = getOrCreateSelectedCurveDefAnalyser();
|
||||
|
||||
std::set<RimSummaryCaseCollection*> ensembles;
|
||||
|
||||
for ( RimSummaryCaseCollection* ensemble : analyserOfSelectedCurveDefs->m_ensembles )
|
||||
{
|
||||
if ( ensemble->isEnsemble() )
|
||||
{
|
||||
ensembles.insert( ensemble );
|
||||
}
|
||||
}
|
||||
|
||||
for ( RimSummaryCase* sumCase : analyserOfSelectedCurveDefs->m_singleSummaryCases )
|
||||
{
|
||||
if ( sumCase->ensemble() )
|
||||
{
|
||||
ensembles.insert( sumCase->ensemble() );
|
||||
}
|
||||
}
|
||||
|
||||
for ( RimSummaryCaseCollection* ensemble : ensembles )
|
||||
{
|
||||
std::vector<EnsembleParameter> parameters = ensemble->variationSortedEnsembleParameters();
|
||||
ensembleParms.insert( parameters.begin(), parameters.end() );
|
||||
@@ -269,7 +287,160 @@ std::set<EnsembleParameter> RimAnalysisPlot::ensembleParameters()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAnalysisPlot::maxMinValueFromAddress( const RifEclipseSummaryAddress& address, double* min, double* max )
|
||||
EnsembleParameter RimAnalysisPlot::ensembleParameter( const QString& ensembleParameterName )
|
||||
{
|
||||
std::set<EnsembleParameter> ensembleParms = ensembleParameters();
|
||||
for ( const EnsembleParameter& eParam : ensembleParms )
|
||||
{
|
||||
if ( eParam.name == ensembleParameterName ) return eParam;
|
||||
}
|
||||
|
||||
return EnsembleParameter();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAnalysisPlot::maxMinValueFromAddress( const RifEclipseSummaryAddress& address,
|
||||
RimPlotDataFilterItem::TimeStepSourceType timeStepSourceType,
|
||||
const std::vector<QDateTime>& timeRangeOrSelection,
|
||||
bool useAbsValue,
|
||||
double* minVal,
|
||||
double* maxVal )
|
||||
{
|
||||
std::vector<time_t> selectedTimesteps;
|
||||
double min = std::numeric_limits<double>::infinity();
|
||||
double max = useAbsValue ? 0.0 : -std::numeric_limits<double>::infinity();
|
||||
|
||||
std::function<double( double, double )> minOrAbsMin;
|
||||
std::function<double( double, double )> maxOrAbsMax;
|
||||
|
||||
if ( useAbsValue )
|
||||
{
|
||||
minOrAbsMin = []( double v1, double v2 ) { return std::min( fabs( v1 ), fabs( v2 ) ); };
|
||||
maxOrAbsMax = []( double v1, double v2 ) { return std::max( fabs( v1 ), fabs( v2 ) ); };
|
||||
}
|
||||
else
|
||||
{
|
||||
minOrAbsMin = []( double v1, double v2 ) { return std::min( v1, v2 ); };
|
||||
maxOrAbsMax = []( double v1, double v2 ) { return std::max( v1, v2 ); };
|
||||
}
|
||||
|
||||
if ( timeStepSourceType == RimPlotDataFilterItem::SELECT_TIMESTEPS )
|
||||
{
|
||||
for ( const QDateTime& dateTime : timeRangeOrSelection )
|
||||
{
|
||||
selectedTimesteps.push_back( dateTime.toTime_t() );
|
||||
}
|
||||
}
|
||||
else if ( timeStepSourceType == RimPlotDataFilterItem::PLOT_SOURCE_TIMESTEPS )
|
||||
{
|
||||
for ( const QDateTime& dateTime : m_selectedTimeSteps.v() )
|
||||
{
|
||||
selectedTimesteps.push_back( dateTime.toTime_t() );
|
||||
}
|
||||
}
|
||||
|
||||
std::set<RimSummaryCase*> allSumCases = allSourceCases();
|
||||
|
||||
for ( RimSummaryCase* sumCase : allSumCases )
|
||||
{
|
||||
RifSummaryReaderInterface* reader = sumCase->summaryReader();
|
||||
if ( !reader ) continue;
|
||||
|
||||
if ( reader->hasAddress( address ) )
|
||||
{
|
||||
std::vector<double> values;
|
||||
reader->values( address, &values );
|
||||
|
||||
const std::vector<time_t>& timesteps = reader->timeSteps( address );
|
||||
|
||||
if ( timesteps.size() )
|
||||
{
|
||||
if ( timeStepSourceType == RimPlotDataFilterItem::LAST_TIMESTEP )
|
||||
{
|
||||
min = minOrAbsMin( min, values[timesteps.size() - 1] );
|
||||
max = maxOrAbsMax( max, values[timesteps.size() - 1] );
|
||||
}
|
||||
else if ( timeStepSourceType == RimPlotDataFilterItem::FIRST_TIMESTEP )
|
||||
{
|
||||
min = minOrAbsMin( min, values[0] );
|
||||
max = maxOrAbsMax( max, values[0] );
|
||||
}
|
||||
else if ( timeStepSourceType == RimPlotDataFilterItem::ALL_TIMESTEPS )
|
||||
{
|
||||
for ( size_t tIdx = 0; tIdx < timesteps.size(); ++tIdx )
|
||||
{
|
||||
min = minOrAbsMin( min, values[tIdx] );
|
||||
max = maxOrAbsMax( max, values[tIdx] );
|
||||
}
|
||||
}
|
||||
else if ( timeStepSourceType == RimPlotDataFilterItem::SELECT_TIMESTEP_RANGE )
|
||||
{
|
||||
if ( timeRangeOrSelection.size() >= 2 )
|
||||
{
|
||||
time_t minTime = timeRangeOrSelection.front().toTime_t();
|
||||
time_t maxTime = timeRangeOrSelection.back().toTime_t();
|
||||
|
||||
for ( size_t tIdx = 0; tIdx < timesteps.size(); ++tIdx )
|
||||
{
|
||||
time_t dateTime = timesteps[tIdx];
|
||||
|
||||
if ( minTime <= dateTime && dateTime <= maxTime )
|
||||
{
|
||||
min = minOrAbsMin( min, values[tIdx] );
|
||||
max = maxOrAbsMax( max, values[tIdx] );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ( timeStepSourceType == RimPlotDataFilterItem::LAST_TIMESTEP_WITH_HISTORY )
|
||||
{
|
||||
RifEclipseSummaryAddress historyAddr = address;
|
||||
|
||||
if ( !historyAddr.isHistoryQuantity() ) historyAddr.setQuantityName( address.quantityName() + "H" );
|
||||
|
||||
const std::vector<time_t>& historyTimesteps = reader->timeSteps( historyAddr );
|
||||
if ( historyTimesteps.size() )
|
||||
{
|
||||
min = minOrAbsMin( min, values[historyTimesteps.size() - 1] );
|
||||
max = maxOrAbsMax( max, values[historyTimesteps.size() - 1] );
|
||||
}
|
||||
}
|
||||
else if ( selectedTimesteps.size() )
|
||||
{
|
||||
std::vector<int> selectedTimestepIndices;
|
||||
|
||||
for ( time_t tt : selectedTimesteps )
|
||||
{
|
||||
for ( int timestepIdx = 0; static_cast<unsigned>( timestepIdx ) < timesteps.size(); ++timestepIdx )
|
||||
{
|
||||
if ( timesteps[timestepIdx] == tt )
|
||||
{
|
||||
selectedTimestepIndices.push_back( timestepIdx );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for ( int tsIdx : selectedTimestepIndices )
|
||||
{
|
||||
min = minOrAbsMin( min, values[tsIdx] );
|
||||
max = maxOrAbsMax( max, values[tsIdx] );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
( *minVal ) = min;
|
||||
( *maxVal ) = max;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAnalysisPlot::onFiltersChanged()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -432,31 +603,12 @@ QList<caf::PdmOptionItemInfo> RimAnalysisPlot::calculateValueOptions( const caf:
|
||||
{
|
||||
options.push_back( {"None", QDateTime()} );
|
||||
|
||||
std::set<QDateTime> timeStepUnion;
|
||||
std::set<time_t> timeStepUnion = allAvailableTimeSteps();
|
||||
|
||||
std::set<RimSummaryCase*> timeStepDefiningSumCases = m_analyserOfSelectedCurveDefs->m_singleSummaryCases;
|
||||
for ( RimSummaryCaseCollection* sumCaseColl : m_analyserOfSelectedCurveDefs->m_ensembles )
|
||||
for ( time_t timeT : timeStepUnion )
|
||||
{
|
||||
std::vector<RimSummaryCase*> sumCases = sumCaseColl->allSummaryCases();
|
||||
if ( sumCases.size() )
|
||||
{
|
||||
timeStepDefiningSumCases.insert( sumCases[0] );
|
||||
}
|
||||
}
|
||||
|
||||
for ( RimSummaryCase* sumCase : timeStepDefiningSumCases )
|
||||
{
|
||||
const std::vector<time_t>& timeSteps = sumCase->summaryReader()->timeSteps( RifEclipseSummaryAddress() );
|
||||
|
||||
for ( time_t t : timeSteps )
|
||||
{
|
||||
timeStepUnion.insert( RiaQDateTimeTools::fromTime_t( t ) );
|
||||
}
|
||||
}
|
||||
|
||||
for ( const QDateTime& dateTime : timeStepUnion )
|
||||
{
|
||||
QString formatString = RiaQDateTimeTools::createTimeFormatStringFromDates( {dateTime} );
|
||||
QDateTime dateTime = RiaQDateTimeTools::fromTime_t( timeT );
|
||||
QString formatString = RiaQDateTimeTools::createTimeFormatStringFromDates( {dateTime} );
|
||||
|
||||
options.push_back( {dateTime.toString( formatString ), dateTime} );
|
||||
}
|
||||
@@ -499,6 +651,61 @@ QList<caf::PdmOptionItemInfo> RimAnalysisPlot::calculateValueOptions( const caf:
|
||||
return options;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::set<time_t> RimAnalysisPlot::allAvailableTimeSteps()
|
||||
{
|
||||
std::set<time_t> timeStepUnion;
|
||||
|
||||
for ( RimSummaryCase* sumCase : timestepDefiningSourceCases() )
|
||||
{
|
||||
const std::vector<time_t>& timeSteps = sumCase->summaryReader()->timeSteps( RifEclipseSummaryAddress() );
|
||||
|
||||
for ( time_t t : timeSteps )
|
||||
{
|
||||
timeStepUnion.insert( t );
|
||||
}
|
||||
}
|
||||
|
||||
return timeStepUnion;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::set<RimSummaryCase*> RimAnalysisPlot::timestepDefiningSourceCases()
|
||||
{
|
||||
std::set<RimSummaryCase*> timeStepDefiningSumCases = m_analyserOfSelectedCurveDefs->m_singleSummaryCases;
|
||||
for ( RimSummaryCaseCollection* sumCaseColl : m_analyserOfSelectedCurveDefs->m_ensembles )
|
||||
{
|
||||
std::vector<RimSummaryCase*> sumCases = sumCaseColl->allSummaryCases();
|
||||
if ( sumCases.size() )
|
||||
{
|
||||
timeStepDefiningSumCases.insert( sumCases[0] );
|
||||
}
|
||||
}
|
||||
|
||||
return timeStepDefiningSumCases;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::set<RimSummaryCase*> RimAnalysisPlot::allSourceCases()
|
||||
{
|
||||
std::set<RimSummaryCase*> allSumCases = m_analyserOfSelectedCurveDefs->m_singleSummaryCases;
|
||||
|
||||
for ( RimSummaryCaseCollection* sumCaseColl : m_analyserOfSelectedCurveDefs->m_ensembles )
|
||||
{
|
||||
std::vector<RimSummaryCase*> sumCases = sumCaseColl->allSummaryCases();
|
||||
|
||||
allSumCases.insert( sumCases.begin(), sumCases.end() );
|
||||
}
|
||||
|
||||
return allSumCases;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "RiaSummaryCurveDefinition.h"
|
||||
|
||||
#include "RimPlot.h"
|
||||
#include "RimPlotDataFilterItem.h"
|
||||
#include "RimSummaryCaseCollection.h"
|
||||
|
||||
#include "cafPdmPtrField.h"
|
||||
@@ -54,8 +55,16 @@ public:
|
||||
|
||||
std::set<RifEclipseSummaryAddress> unfilteredAddresses();
|
||||
std::set<EnsembleParameter> ensembleParameters();
|
||||
EnsembleParameter ensembleParameter( const QString& ensembleParameterName );
|
||||
|
||||
void maxMinValueFromAddress( const RifEclipseSummaryAddress& address, double* min, double* max );
|
||||
void maxMinValueFromAddress( const RifEclipseSummaryAddress& address,
|
||||
RimPlotDataFilterItem::TimeStepSourceType timeStepSourceType,
|
||||
const std::vector<QDateTime>& timeRangeOrSelection,
|
||||
bool useAbsValue,
|
||||
double* min,
|
||||
double* max );
|
||||
|
||||
void onFiltersChanged();
|
||||
|
||||
public: // Internal. Public needed for AppEnum setup
|
||||
enum BarOrientation
|
||||
@@ -91,6 +100,12 @@ private:
|
||||
caf::PdmFieldHandle* userDescriptionField() override;
|
||||
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
|
||||
bool* useOptionsOnly ) override;
|
||||
|
||||
std::set<time_t> allAvailableTimeSteps();
|
||||
|
||||
std::set<RimSummaryCase*> timestepDefiningSourceCases();
|
||||
std::set<RimSummaryCase*> allSourceCases();
|
||||
|
||||
// RimViewWindow overrides
|
||||
|
||||
QWidget* viewWidget() override;
|
||||
|
||||
@@ -20,7 +20,9 @@
|
||||
#include "RimAnalysisPlot.h"
|
||||
#include "RimSummaryAddress.h"
|
||||
#include "RimSummaryCaseCollection.h"
|
||||
|
||||
#include "cafPdmUiActionPushButtonEditor.h"
|
||||
#include "cafPdmUiDoubleSliderEditor.h"
|
||||
#include "cafPdmUiLineEditor.h"
|
||||
#include "cafPdmUiListEditor.h"
|
||||
#include "cafPdmUiPushButtonEditor.h"
|
||||
@@ -69,6 +71,8 @@ CAF_PDM_SOURCE_INIT( RimPlotDataFilterItem, "PlotDataFilterItem" );
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimPlotDataFilterItem::RimPlotDataFilterItem()
|
||||
: m_lowerLimit( -std::numeric_limits<double>::infinity() )
|
||||
, m_upperLimit( std::numeric_limits<double>::infinity() )
|
||||
{
|
||||
CAF_PDM_InitObject( "Plot Data Filter", ":/EnsembleCurveSet16x16.png", "", "" );
|
||||
|
||||
@@ -93,7 +97,9 @@ RimPlotDataFilterItem::RimPlotDataFilterItem()
|
||||
CAF_PDM_InitField( &m_useAbsoluteValue, "UseAbsoluteValue", true, "Use Abs(value)", "", "", "" );
|
||||
CAF_PDM_InitField( &m_minTopN, "MinTopN", 20, "N", "", "", "" );
|
||||
CAF_PDM_InitField( &m_max, "Max", 0.0, "Max", "", "", "" );
|
||||
m_max.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleSliderEditor::uiEditorTypeName() );
|
||||
CAF_PDM_InitField( &m_min, "Min", 0.0, "Min", "", "", "" );
|
||||
m_min.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleSliderEditor::uiEditorTypeName() );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_ensembleParameterValueCategories,
|
||||
"EnsembleParameterValueCategories",
|
||||
@@ -104,6 +110,7 @@ RimPlotDataFilterItem::RimPlotDataFilterItem()
|
||||
CAF_PDM_InitFieldNoDefault( &m_consideredTimestepsType, "ConsideredTimestepsType", "Timesteps to Consider", "", "", "" );
|
||||
CAF_PDM_InitFieldNoDefault( &m_explicitlySelectedTimeSteps, "ExplicitlySelectedTimeSteps", "TimeSteps", "", "", "" );
|
||||
m_explicitlySelectedTimeSteps.uiCapability()->setUiEditorTypeName( caf::PdmUiListEditor::uiEditorTypeName() );
|
||||
m_explicitlySelectedTimeSteps.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -113,6 +120,48 @@ RimPlotDataFilterItem::~RimPlotDataFilterItem()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPlotDataFilterItem::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
||||
const QVariant& oldValue,
|
||||
const QVariant& newValue )
|
||||
{
|
||||
RimAnalysisPlot* parentPlot;
|
||||
this->firstAncestorOrThisOfTypeAsserted( parentPlot );
|
||||
|
||||
if ( changedField == &m_filterTarget )
|
||||
{
|
||||
this->updateMaxMinAndDefaultValues( true );
|
||||
parentPlot->onFiltersChanged();
|
||||
}
|
||||
else if ( changedField == &m_filterAddress )
|
||||
{
|
||||
this->updateMaxMinAndDefaultValues( true );
|
||||
parentPlot->onFiltersChanged();
|
||||
}
|
||||
else if ( changedField == &m_filterEnsembleParameter )
|
||||
{
|
||||
this->updateMaxMinAndDefaultValues( true );
|
||||
parentPlot->onFiltersChanged();
|
||||
}
|
||||
else if ( changedField == &m_useAbsoluteValue )
|
||||
{
|
||||
this->updateMaxMinAndDefaultValues( false );
|
||||
parentPlot->onFiltersChanged();
|
||||
}
|
||||
else if ( changedField = &m_filterOperation )
|
||||
{
|
||||
this->updateMaxMinAndDefaultValues( false );
|
||||
parentPlot->onFiltersChanged();
|
||||
}
|
||||
else if ( changedField == &m_consideredTimestepsType || changedField == &m_explicitlySelectedTimeSteps )
|
||||
{
|
||||
this->updateMaxMinAndDefaultValues( false );
|
||||
parentPlot->onFiltersChanged();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -143,17 +192,28 @@ QList<caf::PdmOptionItemInfo>
|
||||
}
|
||||
else if ( fieldNeedingOptions == &m_filterEnsembleParameter )
|
||||
{
|
||||
// if ( m_filterTarget() == ENSEMBLE_CASE )
|
||||
// {
|
||||
// std::set<EnsembleParameter> ensembleParams = parentPlot->ensembleParameters();
|
||||
// for ( const EnsembleParameter& ensParam : ensembleParams )
|
||||
// {
|
||||
// options.push_back( caf::PdmOptionItemInfo( ensParam.uiName(), ensParam.name ) );
|
||||
// }
|
||||
//
|
||||
// options.push_front( caf::PdmOptionItemInfo( RiaDefines::undefinedResultName(),
|
||||
// QVariant::fromValue( RifEclipseSummaryAddress() ) ) );
|
||||
// }
|
||||
if ( m_filterTarget() == ENSEMBLE_CASE )
|
||||
{
|
||||
std::set<EnsembleParameter> ensembleParams = parentPlot->ensembleParameters();
|
||||
for ( const EnsembleParameter& ensParam : ensembleParams )
|
||||
{
|
||||
options.push_back( caf::PdmOptionItemInfo( ensParam.uiName(), ensParam.name ) );
|
||||
}
|
||||
|
||||
options.push_front( caf::PdmOptionItemInfo( RiaDefines::undefinedResultName(),
|
||||
QVariant::fromValue( RifEclipseSummaryAddress() ) ) );
|
||||
}
|
||||
}
|
||||
else if ( fieldNeedingOptions == &m_ensembleParameterValueCategories )
|
||||
{
|
||||
EnsembleParameter eParm = selectedEnsembleParameter();
|
||||
if ( eParm.isText() )
|
||||
{
|
||||
for ( const auto& val : eParm.values )
|
||||
{
|
||||
options.push_back( caf::PdmOptionItemInfo( val.toString(), val.toString() ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return options;
|
||||
@@ -172,38 +232,48 @@ caf::PdmFieldHandle* RimPlotDataFilterItem::objectToggleField()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPlotDataFilterItem::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
||||
{
|
||||
uiOrdering.add( &m_filterTarget, {true, 5, 1} );
|
||||
updateMaxMinAndDefaultValues( false );
|
||||
|
||||
uiOrdering.add( &m_filterTarget, {true, 4, 1} );
|
||||
if ( m_filterTarget() == ENSEMBLE_CASE )
|
||||
{
|
||||
uiOrdering.add( &m_filterEnsembleParameter, {true, 5, 1} );
|
||||
uiOrdering.add( &m_filterEnsembleParameter, {true, 4, 1} );
|
||||
}
|
||||
else
|
||||
{
|
||||
uiOrdering.add( &m_filterQuantityUiField, {true, 5, 1} );
|
||||
uiOrdering.add( &m_filterQuantityUiField, {true, 4, 1} );
|
||||
// uiOrdering.add( &m_filterQuantitySelectButton, {false, 1, 0} );
|
||||
}
|
||||
|
||||
uiOrdering.add( &m_filterOperation, {true, 3, 1} );
|
||||
uiOrdering.add( &m_useAbsoluteValue, {false} );
|
||||
|
||||
if ( m_filterOperation() == RANGE )
|
||||
EnsembleParameter eParm;
|
||||
if ( m_filterTarget() == ENSEMBLE_CASE )
|
||||
{
|
||||
uiOrdering.add( &m_max );
|
||||
uiOrdering.add( &m_min );
|
||||
}
|
||||
else if ( m_filterOperation == TOP_N || m_filterOperation == MIN_N )
|
||||
{
|
||||
uiOrdering.add( &m_minTopN );
|
||||
eParm = selectedEnsembleParameter();
|
||||
}
|
||||
|
||||
if ( m_filterTarget() == ENSEMBLE_CASE && false ) // Ensemble Quantity is a category value
|
||||
if ( m_filterTarget() == ENSEMBLE_CASE && eParm.isText() ) // Ensemble Quantity is a category value
|
||||
{
|
||||
uiOrdering.add( &m_ensembleParameterValueCategories );
|
||||
}
|
||||
|
||||
if ( m_filterTarget() != ENSEMBLE_CASE ) // Ensemble Quantity is a category value
|
||||
else
|
||||
{
|
||||
uiOrdering.add( &m_consideredTimestepsType );
|
||||
uiOrdering.add( &m_filterOperation, {true, 2, 1} );
|
||||
uiOrdering.add( &m_useAbsoluteValue, {false} );
|
||||
|
||||
if ( m_filterOperation() == RANGE )
|
||||
{
|
||||
uiOrdering.add( &m_max, {true, 4, 1} );
|
||||
uiOrdering.add( &m_min, {true, 4, 1} );
|
||||
}
|
||||
else if ( m_filterOperation == TOP_N || m_filterOperation == MIN_N )
|
||||
{
|
||||
uiOrdering.add( &m_minTopN, {true, 4, 1} );
|
||||
}
|
||||
}
|
||||
|
||||
if ( m_filterTarget() != ENSEMBLE_CASE )
|
||||
{
|
||||
uiOrdering.add( &m_consideredTimestepsType, {true, 4, 1} );
|
||||
if ( m_consideredTimestepsType == SELECT_TIMESTEPS || m_consideredTimestepsType == SELECT_TIMESTEP_RANGE )
|
||||
{
|
||||
uiOrdering.add( &m_explicitlySelectedTimeSteps );
|
||||
@@ -212,3 +282,76 @@ void RimPlotDataFilterItem::defineUiOrdering( QString uiConfigName, caf::PdmUiOr
|
||||
|
||||
uiOrdering.skipRemainingFields( true );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPlotDataFilterItem::defineEditorAttribute( const caf::PdmFieldHandle* field,
|
||||
QString uiConfigName,
|
||||
caf::PdmUiEditorAttribute* attribute )
|
||||
{
|
||||
if ( field == &m_min || field == &m_max )
|
||||
{
|
||||
caf::PdmUiDoubleSliderEditorAttribute* myAttr = dynamic_cast<caf::PdmUiDoubleSliderEditorAttribute*>( attribute );
|
||||
if ( !myAttr )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
myAttr->m_minimum = m_lowerLimit;
|
||||
myAttr->m_maximum = m_upperLimit;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPlotDataFilterItem::updateMaxMinAndDefaultValues( bool forceDefault )
|
||||
{
|
||||
RimAnalysisPlot* parentPlot;
|
||||
this->firstAncestorOrThisOfTypeAsserted( parentPlot );
|
||||
|
||||
if ( m_filterTarget == ENSEMBLE_CASE )
|
||||
{
|
||||
if ( !selectedEnsembleParameter().isValid() )
|
||||
{
|
||||
std::set<EnsembleParameter> ensembleParams = parentPlot->ensembleParameters();
|
||||
if ( !ensembleParams.empty() )
|
||||
{
|
||||
m_filterEnsembleParameter = ensembleParams.begin()->name;
|
||||
}
|
||||
}
|
||||
|
||||
EnsembleParameter eParam = selectedEnsembleParameter();
|
||||
if ( eParam.isValid() && eParam.isNumeric() )
|
||||
{
|
||||
if ( RiaCurveDataTools::isValidValue( eParam.minValue, false ) ) m_lowerLimit = eParam.minValue;
|
||||
if ( RiaCurveDataTools::isValidValue( eParam.maxValue, false ) ) m_upperLimit = eParam.maxValue;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
parentPlot->maxMinValueFromAddress( m_filterQuantityUiField,
|
||||
m_consideredTimestepsType(),
|
||||
m_explicitlySelectedTimeSteps(),
|
||||
m_useAbsoluteValue(),
|
||||
&m_lowerLimit,
|
||||
&m_upperLimit );
|
||||
}
|
||||
|
||||
if ( forceDefault || !( m_min >= m_lowerLimit && m_min <= m_upperLimit ) ) m_min = m_lowerLimit;
|
||||
if ( forceDefault || !( m_max >= m_lowerLimit && m_max <= m_upperLimit ) ) m_max = m_upperLimit;
|
||||
|
||||
m_min.uiCapability()->setUiName( QString( "Min (%1)" ).arg( m_lowerLimit ) );
|
||||
m_max.uiCapability()->setUiName( QString( "Max (%1)" ).arg( m_upperLimit ) );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
EnsembleParameter RimPlotDataFilterItem::selectedEnsembleParameter() const
|
||||
{
|
||||
RimAnalysisPlot* parentPlot;
|
||||
this->firstAncestorOrThisOfTypeAsserted( parentPlot );
|
||||
return parentPlot->ensembleParameter( m_filterEnsembleParameter );
|
||||
}
|
||||
|
||||
@@ -26,6 +26,8 @@
|
||||
#include "RifEclipseSummaryAddress.h"
|
||||
#include "RifEclipseSummaryAddressQMetaType.h"
|
||||
|
||||
#include "RimSummaryCaseCollection.h"
|
||||
|
||||
#include <QDateTime>
|
||||
|
||||
class RiuSummaryQwtPlot;
|
||||
@@ -51,12 +53,30 @@ public:
|
||||
RimPlotDataFilterItem();
|
||||
~RimPlotDataFilterItem() override;
|
||||
|
||||
private:
|
||||
virtual void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
||||
enum TimeStepSourceType
|
||||
{
|
||||
PLOT_SOURCE_TIMESTEPS,
|
||||
LAST_TIMESTEP,
|
||||
FIRST_TIMESTEP,
|
||||
LAST_TIMESTEP_WITH_HISTORY,
|
||||
ALL_TIMESTEPS,
|
||||
SELECT_TIMESTEPS,
|
||||
SELECT_TIMESTEP_RANGE
|
||||
};
|
||||
|
||||
virtual caf::PdmFieldHandle* objectToggleField() override;
|
||||
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
|
||||
bool* useOptionsOnly ) override;
|
||||
private:
|
||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
||||
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
||||
void defineEditorAttribute( const caf::PdmFieldHandle* field,
|
||||
QString uiConfigName,
|
||||
caf::PdmUiEditorAttribute* attribute ) override;
|
||||
|
||||
caf::PdmFieldHandle* objectToggleField() override;
|
||||
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
|
||||
bool* useOptionsOnly ) override;
|
||||
|
||||
void updateMaxMinAndDefaultValues( bool forceDefault );
|
||||
EnsembleParameter selectedEnsembleParameter() const;
|
||||
|
||||
caf::PdmField<bool> m_isActive;
|
||||
|
||||
@@ -98,20 +118,9 @@ private:
|
||||
|
||||
// Considered Timesteps
|
||||
|
||||
enum TimeStepSourceType
|
||||
{
|
||||
PLOT_SOURCE_TIMESTEPS,
|
||||
LAST_TIMESTEP,
|
||||
FIRST_TIMESTEP,
|
||||
LAST_TIMESTEP_WITH_HISTORY,
|
||||
ALL_TIMESTEPS,
|
||||
SELECT_TIMESTEPS,
|
||||
SELECT_TIMESTEP_RANGE
|
||||
};
|
||||
friend caf::AppEnum<TimeStepSourceType>;
|
||||
|
||||
caf::PdmField<caf::AppEnum<TimeStepSourceType>> m_consideredTimestepsType;
|
||||
caf::PdmField<std::vector<QDateTime>> m_explicitlySelectedTimeSteps;
|
||||
|
||||
protected:
|
||||
double m_lowerLimit;
|
||||
double m_upperLimit;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user