mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-12 00:16:10 -06:00
#5002 Ensemble RFT curve sets with parameter coloring and separate legends
This commit is contained in:
parent
f56a34843a
commit
7fd4aa1ce9
@ -244,6 +244,14 @@ bool operator<( const RifDataSourceForRftPlt& addr1, const RifDataSourceForRftPl
|
||||
{
|
||||
if ( addr1.summaryCase() && addr2.summaryCase() )
|
||||
{
|
||||
if ( addr1.summaryCase()->caseName() == addr2.summaryCase()->caseName() )
|
||||
{
|
||||
if ( addr1.ensemble() && addr2.ensemble() )
|
||||
{
|
||||
return addr1.ensemble()->name() < addr2.ensemble()->name();
|
||||
}
|
||||
return addr1.ensemble() < addr2.ensemble();
|
||||
}
|
||||
return addr1.summaryCase()->caseName() < addr2.summaryCase()->caseName();
|
||||
}
|
||||
return addr1.summaryCase() < addr2.summaryCase();
|
||||
@ -285,4 +293,4 @@ bool operator<(const RifWellRftAddress& addr1, const RifWellRftAddress& addr2)
|
||||
addr1.wellLogFile() != nullptr && addr2.wellLogFile() != nullptr ? addr1.wellLogFile()->fileName() < addr2.wellLogFile()->fileName() :
|
||||
addr1.wellLogFile() < addr2.wellLogFile());
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
@ -12,6 +12,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RimWellRftPlot.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimWellPltPlot.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimDataSourceForRftPlt.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimWellPlotTools.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimWellRftEnsembleCurveSet.h
|
||||
)
|
||||
|
||||
set (SOURCE_GROUP_SOURCE_FILES
|
||||
@ -27,6 +28,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RimWellRftPlot.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimWellPltPlot.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimDataSourceForRftPlt.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimWellPlotTools.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimWellRftEnsembleCurveSet.cpp
|
||||
)
|
||||
|
||||
list(APPEND CODE_HEADER_FILES
|
||||
|
@ -0,0 +1,242 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2019- Equinor ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RimWellRftEnsembleCurveSet.h"
|
||||
#include "RimEnsembleCurveSetColorManager.h"
|
||||
#include "RimRegularLegendConfig.h"
|
||||
#include "RimSummaryCase.h"
|
||||
#include "RimWellRftPlot.h"
|
||||
|
||||
#include "RiuCvfOverlayItemWidget.h"
|
||||
#include "RiuQwtPlotWidget.h"
|
||||
|
||||
#include "cafPdmUiListEditor.h"
|
||||
#include "cafPdmUiObjectHandle.h"
|
||||
#include "cafPdmUiOrdering.h"
|
||||
#include "cafPdmUiTreeOrdering.h"
|
||||
|
||||
#include <QFrame>
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RimWellRftEnsembleCurveSet, "WellRftEnsembleCurveSet" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimWellRftEnsembleCurveSet::RimWellRftEnsembleCurveSet()
|
||||
{
|
||||
CAF_PDM_InitObject( "Ensemble Curve Set", ":/EnsembleCurveSet16x16.png", "", "" );
|
||||
CAF_PDM_InitFieldNoDefault( &m_ensemble, "Ensemble", "Ensemble", "", "", "" );
|
||||
m_ensemble.uiCapability()->setUiTreeChildrenHidden( true );
|
||||
m_ensemble.uiCapability()->setAutoAddingOptionFromValue( false );
|
||||
|
||||
CAF_PDM_InitField( &m_ensembleColorMode,
|
||||
"ColorMode",
|
||||
ColorModeEnum( ColorMode::SINGLE_COLOR ),
|
||||
"Coloring Mode",
|
||||
"",
|
||||
"",
|
||||
"" );
|
||||
|
||||
CAF_PDM_InitField( &m_ensembleParameter, "EnsembleParameter", QString( "" ), "Ensemble Parameter", "", "", "" );
|
||||
m_ensembleParameter.uiCapability()->setUiEditorTypeName( caf::PdmUiListEditor::uiEditorTypeName() );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_ensembleLegendConfig, "LegendConfig", "", "", "", "" );
|
||||
m_ensembleLegendConfig = new RimRegularLegendConfig();
|
||||
m_ensembleLegendConfig->setColorRange( RimEnsembleCurveSetColorManager::DEFAULT_ENSEMBLE_COLOR_RANGE );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimWellRftEnsembleCurveSet::~RimWellRftEnsembleCurveSet() {}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimSummaryCaseCollection* RimWellRftEnsembleCurveSet::ensemble() const
|
||||
{
|
||||
return m_ensemble;
|
||||
}
|
||||
|
||||
void RimWellRftEnsembleCurveSet::setEnsemble( RimSummaryCaseCollection* ensemble )
|
||||
{
|
||||
m_ensemble = ensemble;
|
||||
this->uiCapability()->setUiName( m_ensemble->name() );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimEnsembleCurveSetColorManager::ColorMode RimWellRftEnsembleCurveSet::colorMode() const
|
||||
{
|
||||
return m_ensembleColorMode();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellRftEnsembleCurveSet::setColorMode( ColorMode mode )
|
||||
{
|
||||
m_ensembleColorMode = mode;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellRftEnsembleCurveSet::initializeLegend()
|
||||
{
|
||||
auto ensembleParam = m_ensemble->ensembleParameter( m_ensembleParameter );
|
||||
m_ensembleLegendConfig->setTitle( m_ensemble->name() + ":\n" + m_ensembleParameter );
|
||||
RimEnsembleCurveSetColorManager::initializeLegendConfig( m_ensembleLegendConfig, ensembleParam );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::Color3f RimWellRftEnsembleCurveSet::caseColor( const RimSummaryCase* summaryCase ) const
|
||||
{
|
||||
auto ensembleParam = m_ensemble->ensembleParameter( m_ensembleParameter );
|
||||
return RimEnsembleCurveSetColorManager::caseColor( m_ensembleLegendConfig, summaryCase, ensembleParam );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimWellRftEnsembleCurveSet::currentEnsembleParameter() const
|
||||
{
|
||||
return m_ensembleParameter;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellRftEnsembleCurveSet::setEnsembleParameter( const QString& parameterName )
|
||||
{
|
||||
m_ensembleParameter = parameterName;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<QString> RimWellRftEnsembleCurveSet::allEnsembleParameters() const
|
||||
{
|
||||
std::set<QString> paramSet;
|
||||
RimSummaryCaseCollection* group = m_ensemble;
|
||||
if ( group )
|
||||
{
|
||||
for ( RimSummaryCase* rimCase : group->allSummaryCases() )
|
||||
{
|
||||
if ( rimCase->caseRealizationParameters() != nullptr )
|
||||
{
|
||||
auto ps = rimCase->caseRealizationParameters()->parameters();
|
||||
for ( auto p : ps )
|
||||
paramSet.insert( p.first );
|
||||
}
|
||||
}
|
||||
}
|
||||
return std::vector<QString>( paramSet.begin(), paramSet.end() );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimRegularLegendConfig* RimWellRftEnsembleCurveSet::legendConfig()
|
||||
{
|
||||
return m_ensembleLegendConfig;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
EnsembleParameter::Type RimWellRftEnsembleCurveSet::currentEnsembleParameterType() const
|
||||
{
|
||||
if ( m_ensembleColorMode() == ColorMode::BY_ENSEMBLE_PARAM )
|
||||
{
|
||||
RimSummaryCaseCollection* group = m_ensemble();
|
||||
QString parameterName = m_ensembleParameter();
|
||||
|
||||
if ( group && !parameterName.isEmpty() )
|
||||
{
|
||||
auto eParam = group->ensembleParameter( parameterName );
|
||||
return eParam.type;
|
||||
}
|
||||
}
|
||||
return EnsembleParameter::TYPE_NONE;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellRftEnsembleCurveSet::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
||||
const QVariant& oldValue,
|
||||
const QVariant& newValue )
|
||||
{
|
||||
if ( changedField == &m_ensembleColorMode || changedField == &m_ensembleParameter )
|
||||
{
|
||||
RimWellRftPlot* rftPlot = nullptr;
|
||||
this->firstAncestorOrThisOfTypeAsserted( rftPlot );
|
||||
rftPlot->syncCurvesFromUiSelection();
|
||||
rftPlot->updateConnectedEditors();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QList<caf::PdmOptionItemInfo>
|
||||
RimWellRftEnsembleCurveSet::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
|
||||
bool* useOptionsOnly )
|
||||
{
|
||||
QList<caf::PdmOptionItemInfo> options;
|
||||
if ( fieldNeedingOptions == &m_ensembleParameter )
|
||||
{
|
||||
for ( const QString& param : allEnsembleParameters() )
|
||||
{
|
||||
options.push_back( caf::PdmOptionItemInfo( param, param ) );
|
||||
}
|
||||
}
|
||||
return options;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellRftEnsembleCurveSet::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
||||
{
|
||||
caf::PdmUiGroup* colorsGroup = uiOrdering.addNewGroup( "Ensemble Curve Colors" );
|
||||
colorsGroup->add( &m_ensembleColorMode );
|
||||
|
||||
if ( m_ensembleColorMode == ColorMode::BY_ENSEMBLE_PARAM )
|
||||
{
|
||||
colorsGroup->add( &m_ensembleParameter );
|
||||
}
|
||||
uiOrdering.skipRemainingFields( true );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellRftEnsembleCurveSet::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering,
|
||||
QString uiConfigName /*= "" */ )
|
||||
{
|
||||
if ( m_ensembleColorMode == ColorMode::BY_ENSEMBLE_PARAM && !m_ensembleParameter().isEmpty() )
|
||||
{
|
||||
uiTreeOrdering.add( m_ensembleLegendConfig() );
|
||||
}
|
||||
uiTreeOrdering.skipRemainingChildren( true );
|
||||
}
|
@ -0,0 +1,75 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2019- Equinor ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RimEnsembleCurveSetColorManager.h"
|
||||
#include "RimSummaryCaseCollection.h"
|
||||
|
||||
#include "cafPdmChildField.h"
|
||||
#include "cafPdmObject.h"
|
||||
#include "cafPdmPtrField.h"
|
||||
#include "cvfColor3.h"
|
||||
|
||||
#include <QPointer>
|
||||
|
||||
class RiuCvfOverlayItemWidget;
|
||||
|
||||
class RimWellRftEnsembleCurveSet : public caf::PdmObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
typedef RimEnsembleCurveSetColorManager::ColorMode ColorMode;
|
||||
typedef RimEnsembleCurveSetColorManager::ColorModeEnum ColorModeEnum;
|
||||
using NameParameterPair = EnsembleParameter::NameParameterPair;
|
||||
|
||||
public:
|
||||
RimWellRftEnsembleCurveSet();
|
||||
~RimWellRftEnsembleCurveSet() override;
|
||||
|
||||
RimSummaryCaseCollection* ensemble() const;
|
||||
void setEnsemble( RimSummaryCaseCollection* ensemble );
|
||||
ColorMode colorMode() const;
|
||||
void setColorMode( ColorMode mode );
|
||||
void initializeLegend();
|
||||
cvf::Color3f caseColor( const RimSummaryCase* summaryCase ) const;
|
||||
QString currentEnsembleParameter() const;
|
||||
|
||||
void setEnsembleParameter( const QString& parameterName );
|
||||
std::vector<QString> allEnsembleParameters() const;
|
||||
RimRegularLegendConfig* legendConfig();
|
||||
EnsembleParameter::Type currentEnsembleParameterType() const;
|
||||
|
||||
protected:
|
||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
||||
const QVariant& oldValue,
|
||||
const QVariant& newValue ) override;
|
||||
|
||||
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
|
||||
bool* useOptionsOnly ) override;
|
||||
|
||||
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
||||
void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "" ) override;
|
||||
|
||||
private:
|
||||
caf::PdmPtrField<RimSummaryCaseCollection*> m_ensemble;
|
||||
caf::PdmField<ColorModeEnum> m_ensembleColorMode;
|
||||
caf::PdmField<QString> m_ensembleParameter;
|
||||
caf::PdmChildField<RimRegularLegendConfig*> m_ensembleLegendConfig;
|
||||
};
|
@ -36,9 +36,11 @@
|
||||
#include "RimEclipseCaseCollection.h"
|
||||
#include "RimEclipseResultCase.h"
|
||||
#include "RimEclipseResultDefinition.h"
|
||||
#include "RimEnsembleCurveSetColorManager.h"
|
||||
#include "RimObservedFmuRftData.h"
|
||||
#include "RimOilField.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimRegularLegendConfig.h"
|
||||
#include "RimSummaryCaseCollection.h"
|
||||
#include "RimTools.h"
|
||||
#include "RimWellLogExtractionCurve.h"
|
||||
@ -53,8 +55,10 @@
|
||||
#include "RimWellPlotTools.h"
|
||||
#include "RimWellPltPlot.h"
|
||||
|
||||
#include "RiuCvfOverlayItemWidget.h"
|
||||
#include "RiuQwtPlotWidget.h"
|
||||
|
||||
#include "cafPdmUiListEditor.h"
|
||||
#include "cafPdmUiTreeOrdering.h"
|
||||
#include "cafPdmUiTreeSelectionEditor.h"
|
||||
|
||||
@ -64,6 +68,8 @@
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RimWellRftPlot, "WellRftPlot" );
|
||||
|
||||
using ColorMode = RimEnsembleCurveSetColorManager::ColorMode;
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -117,6 +123,8 @@ RimWellRftPlot::RimWellRftPlot()
|
||||
m_wellPathCollection.xmlCapability()->disableIO();
|
||||
m_wellPathCollection = RiaApplication::instance()->project()->activeOilField()->wellPathCollection();
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_ensembleCurveSets, "EnsembleCurveSets", "Ensemble Curve Sets", "", "", "" );
|
||||
|
||||
m_nameConfig->setCustomName( "RFT Plot" );
|
||||
m_plotLegendsHorizontal = false;
|
||||
|
||||
@ -301,6 +309,7 @@ void RimWellRftPlot::applyInitialSelections()
|
||||
}
|
||||
}
|
||||
|
||||
createEnsembleCurveSets();
|
||||
syncCurvesFromUiSelection();
|
||||
}
|
||||
|
||||
@ -384,8 +393,8 @@ void RimWellRftPlot::syncCurvesFromUiSelection()
|
||||
CAF_ASSERT( plotTrack );
|
||||
if ( !plotTrack ) return;
|
||||
|
||||
const std::set<RiaRftPltCurveDefinition>& allCurveDefs = selectedCurveDefs();
|
||||
const std::set<RiaRftPltCurveDefinition>& curveDefsInPlot = curveDefsFromCurves();
|
||||
std::set<RiaRftPltCurveDefinition> allCurveDefs = selectedCurveDefs();
|
||||
std::set<RiaRftPltCurveDefinition> curveDefsInPlot = curveDefsFromCurves();
|
||||
|
||||
std::set<RimWellLogCurve*> curvesToDelete;
|
||||
std::set<RiaRftPltCurveDefinition> newCurveDefs;
|
||||
@ -836,7 +845,6 @@ QList<caf::PdmOptionItemInfo> RimWellRftPlot::calculateValueOptions( const caf::
|
||||
|
||||
options = RiaSimWellBranchTools::valueOptionsForBranchIndexField( simulationWellBranches );
|
||||
}
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
@ -897,6 +905,22 @@ void RimWellRftPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellRftPlot::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName )
|
||||
{
|
||||
for ( RimWellRftEnsembleCurveSet* curveSet : m_ensembleCurveSets() )
|
||||
{
|
||||
bool isSelected = false;
|
||||
for ( RimSummaryCaseCollection* selectedCurveSet : selectedEnsembles() )
|
||||
{
|
||||
if ( curveSet->ensemble() == selectedCurveSet )
|
||||
{
|
||||
isSelected = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ( isSelected )
|
||||
{
|
||||
uiTreeOrdering.add( curveSet );
|
||||
}
|
||||
}
|
||||
uiTreeOrdering.skipRemainingChildren( true );
|
||||
}
|
||||
|
||||
@ -910,17 +934,9 @@ void RimWellRftPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering&
|
||||
uiOrdering.add( &m_showEnsembleCurves );
|
||||
uiOrdering.add( &m_showErrorInObservedData );
|
||||
|
||||
bool showingEnsembleData = false;
|
||||
for ( const RifDataSourceForRftPlt& dataSource : m_selectedSources() )
|
||||
{
|
||||
if ( dataSource.sourceType() == RifDataSourceForRftPlt::ENSEMBLE_RFT )
|
||||
{
|
||||
showingEnsembleData = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
m_showStatisticsCurves.uiCapability()->setUiReadOnly( !showingEnsembleData );
|
||||
m_showEnsembleCurves.uiCapability()->setUiReadOnly( !showingEnsembleData );
|
||||
bool ensembleDataSelected = !selectedEnsembles().empty();
|
||||
m_showStatisticsCurves.uiCapability()->setUiReadOnly( !ensembleDataSelected );
|
||||
m_showEnsembleCurves.uiCapability()->setUiReadOnly( !ensembleDataSelected );
|
||||
|
||||
RiaSimWellBranchTools::appendSimWellBranchFieldsIfRequiredFromWellName( &uiOrdering,
|
||||
m_wellPathNameOrSimWellName,
|
||||
@ -1045,7 +1061,7 @@ void RimWellRftPlot::onLoadDataAndUpdate()
|
||||
}
|
||||
|
||||
RimWellLogPlot::onLoadDataAndUpdate();
|
||||
|
||||
createEnsembleCurveSets();
|
||||
updateEditorsFromCurves();
|
||||
|
||||
// Update of curve color must happen here when loading data from project file, as the curve color is blended by the
|
||||
@ -1163,8 +1179,17 @@ cvf::Color3f RimWellRftPlot::findCurveColor( RimWellLogCurve* curve )
|
||||
cvf::Color3f curveColor;
|
||||
if ( curveDef.address().sourceType() == RifDataSourceForRftPlt::SUMMARY_RFT )
|
||||
{
|
||||
RifDataSourceForRftPlt sourceAddress( RifDataSourceForRftPlt::ENSEMBLE_RFT, curveDef.address().ensemble() );
|
||||
curveColor = m_dataSourceColors[sourceAddress];
|
||||
RimWellRftEnsembleCurveSet* ensembleCurveSet = findEnsembleCurveSet( curveDef.address().ensemble() );
|
||||
if ( ensembleCurveSet && ensembleCurveSet->colorMode() == ColorMode::BY_ENSEMBLE_PARAM )
|
||||
{
|
||||
curveColor = ensembleCurveSet->caseColor( curveDef.address().summaryCase() );
|
||||
}
|
||||
else
|
||||
{
|
||||
RifDataSourceForRftPlt sourceAddress( RifDataSourceForRftPlt::ENSEMBLE_RFT, curveDef.address().ensemble() );
|
||||
curveColor = m_dataSourceColors[sourceAddress];
|
||||
}
|
||||
|
||||
if ( m_showStatisticsCurves )
|
||||
{
|
||||
if ( plotByIndex( 0 ) && plotByIndex( 0 )->viewer() )
|
||||
@ -1191,6 +1216,17 @@ void RimWellRftPlot::defineCurveColorsAndSymbols( const std::set<RiaRftPltCurveD
|
||||
m_dataSourceColors.clear();
|
||||
m_timeStepSymbols.clear();
|
||||
|
||||
// Clear all ensemble legends
|
||||
RimWellLogTrack* track = dynamic_cast<RimWellLogTrack*>( plotByIndex( 0 ) );
|
||||
for ( auto ensembleLegendPair : m_ensembleLegendFrames )
|
||||
{
|
||||
if ( track->viewer() && ensembleLegendPair.second )
|
||||
{
|
||||
track->viewer()->removeOverlayFrame( ensembleLegendPair.second );
|
||||
delete ensembleLegendPair.second;
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<cvf::Color3f> colorTable;
|
||||
RiaColorTables::summaryCurveDefaultPaletteColors().color3fArray().toStdVector( &colorTable );
|
||||
|
||||
@ -1218,6 +1254,25 @@ void RimWellRftPlot::defineCurveColorsAndSymbols( const std::set<RiaRftPltCurveD
|
||||
}
|
||||
}
|
||||
|
||||
if ( address.sourceType() == RifDataSourceForRftPlt::ENSEMBLE_RFT && address.ensemble() )
|
||||
{
|
||||
RimWellRftEnsembleCurveSet* curveSet = findEnsembleCurveSet( address.ensemble() );
|
||||
CAF_ASSERT( curveSet );
|
||||
curveSet->initializeLegend();
|
||||
|
||||
if ( curveSet->legendConfig()->showLegend() && curveSet->colorMode() == ColorMode::BY_ENSEMBLE_PARAM &&
|
||||
!curveSet->currentEnsembleParameter().isEmpty() )
|
||||
{
|
||||
if ( !m_ensembleLegendFrames[curveSet] )
|
||||
{
|
||||
m_ensembleLegendFrames[curveSet] = new RiuCvfOverlayItemWidget( track->viewer(),
|
||||
track->viewer()->canvas() );
|
||||
}
|
||||
m_ensembleLegendFrames[curveSet]->updateFromOverlayItem( curveSet->legendConfig()->titledOverlayFrame() );
|
||||
track->viewer()->addOverlayFrame( m_ensembleLegendFrames[curveSet] );
|
||||
}
|
||||
}
|
||||
|
||||
if ( address.sourceType() != RifDataSourceForRftPlt::ENSEMBLE_RFT )
|
||||
{
|
||||
if ( !m_timeStepSymbols.count( curveDefToAdd.timeStep() ) )
|
||||
@ -1229,6 +1284,78 @@ void RimWellRftPlot::defineCurveColorsAndSymbols( const std::set<RiaRftPltCurveD
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimSummaryCaseCollection*> RimWellRftPlot::selectedEnsembles() const
|
||||
{
|
||||
std::vector<RimSummaryCaseCollection*> ensembleSets;
|
||||
for ( const RifDataSourceForRftPlt& dataSource : m_selectedSources() )
|
||||
{
|
||||
if ( dataSource.sourceType() == RifDataSourceForRftPlt::ENSEMBLE_RFT )
|
||||
{
|
||||
ensembleSets.push_back( dataSource.ensemble() );
|
||||
}
|
||||
}
|
||||
return ensembleSets;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellRftPlot::createEnsembleCurveSets()
|
||||
{
|
||||
const std::vector<RimSummaryCaseCollection*> rftEnsembles = RimWellPlotTools::rftEnsemblesForWell(
|
||||
m_wellPathNameOrSimWellName );
|
||||
|
||||
// First delete any curve sets not belonging to the given rftEnsembles
|
||||
std::vector<RimWellRftEnsembleCurveSet*> curveSetsToDelete;
|
||||
for ( RimWellRftEnsembleCurveSet* curveSet : m_ensembleCurveSets() )
|
||||
{
|
||||
if ( std::find( rftEnsembles.begin(), rftEnsembles.end(), curveSet->ensemble() ) == rftEnsembles.end() )
|
||||
{
|
||||
curveSetsToDelete.push_back( curveSet );
|
||||
}
|
||||
}
|
||||
|
||||
for ( RimWellRftEnsembleCurveSet* curveSet : curveSetsToDelete )
|
||||
{
|
||||
m_ensembleCurveSets.removeChildObject( curveSet );
|
||||
delete curveSet;
|
||||
}
|
||||
|
||||
// Then add curves for any ensembles we haven't already added
|
||||
for ( RimSummaryCaseCollection* ensemble : rftEnsembles )
|
||||
{
|
||||
auto it = std::find_if( m_ensembleCurveSets.begin(),
|
||||
m_ensembleCurveSets.end(),
|
||||
[ensemble]( const RimWellRftEnsembleCurveSet* curveSet ) {
|
||||
return curveSet->ensemble() == ensemble;
|
||||
} );
|
||||
if ( it == m_ensembleCurveSets.end() )
|
||||
{
|
||||
RimWellRftEnsembleCurveSet* curveSet = new RimWellRftEnsembleCurveSet;
|
||||
curveSet->setEnsemble( ensemble );
|
||||
m_ensembleCurveSets.push_back( curveSet );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimWellRftEnsembleCurveSet* RimWellRftPlot::findEnsembleCurveSet( RimSummaryCaseCollection* ensemble ) const
|
||||
{
|
||||
for ( RimWellRftEnsembleCurveSet* curveSet : m_ensembleCurveSets() )
|
||||
{
|
||||
if ( ensemble == curveSet->ensemble() )
|
||||
{
|
||||
return curveSet;
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -18,8 +18,10 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RimEnsembleCurveSetColorManager.h"
|
||||
#include "RimViewWindow.h"
|
||||
#include "RimWellLogPlot.h"
|
||||
#include "RimWellRftEnsembleCurveSet.h"
|
||||
|
||||
#include "RifDataSourceForRftPltQMetaType.h"
|
||||
#include "RiuQwtSymbol.h"
|
||||
@ -39,6 +41,7 @@
|
||||
|
||||
class RimEclipseCase;
|
||||
class RimEclipseResultCase;
|
||||
class RimRegularLegendConfig;
|
||||
class RimWellLogCurve;
|
||||
class RimWellLogFileChannel;
|
||||
class RimWellPath;
|
||||
@ -48,6 +51,7 @@ class RigEclipseCaseData;
|
||||
class RiaRftPltCurveDefinition;
|
||||
class RifDataSourceForRftPlt;
|
||||
class RifEclipseRftAddress;
|
||||
class RiuCvfOverlayItemWidget;
|
||||
|
||||
namespace cvf
|
||||
{
|
||||
@ -132,7 +136,13 @@ private:
|
||||
cvf::Color3f findCurveColor( RimWellLogCurve* curve );
|
||||
void defineCurveColorsAndSymbols( const std::set<RiaRftPltCurveDefinition>& allCurveDefs );
|
||||
|
||||
std::vector<RimSummaryCaseCollection*> selectedEnsembles() const;
|
||||
void createEnsembleCurveSets();
|
||||
RimWellRftEnsembleCurveSet* findEnsembleCurveSet( RimSummaryCaseCollection* ensemble ) const;
|
||||
|
||||
private:
|
||||
friend class RimWellRftEnsembleCurveSet;
|
||||
|
||||
caf::PdmField<QString> m_wellPathNameOrSimWellName;
|
||||
caf::PdmField<int> m_branchIndex;
|
||||
caf::PdmField<bool> m_branchDetection;
|
||||
@ -145,10 +155,13 @@ private:
|
||||
|
||||
caf::PdmPtrField<RimWellPathCollection*> m_wellPathCollection;
|
||||
|
||||
caf::PdmField<bool> m_showPlotTitle_OBSOLETE;
|
||||
caf::PdmChildField<RimWellLogPlot*> m_wellLogPlot_OBSOLETE;
|
||||
caf::PdmChildArrayField<RimWellRftEnsembleCurveSet*> m_ensembleCurveSets;
|
||||
std::map<RimWellRftEnsembleCurveSet*, QPointer<RiuCvfOverlayItemWidget>> m_ensembleLegendFrames;
|
||||
|
||||
std::map<RifDataSourceForRftPlt, cvf::Color3f> m_dataSourceColors;
|
||||
std::map<QDateTime, RiuQwtSymbol::PointSymbolEnum> m_timeStepSymbols;
|
||||
bool m_isOnLoad;
|
||||
|
||||
caf::PdmField<bool> m_showPlotTitle_OBSOLETE;
|
||||
caf::PdmChildField<RimWellLogPlot*> m_wellLogPlot_OBSOLETE;
|
||||
};
|
||||
|
@ -36,6 +36,8 @@
|
||||
#include "RimStimPlanColors.h"
|
||||
#include "RimViewLinker.h"
|
||||
#include "RimWellMeasurementInView.h"
|
||||
#include "RimWellRftEnsembleCurveSet.h"
|
||||
#include "RimWellRftPlot.h"
|
||||
|
||||
#include "cafCategoryLegend.h"
|
||||
#include "cafCategoryMapper.h"
|
||||
@ -296,6 +298,13 @@ void RimRegularLegendConfig::fieldChangedByUi( const caf::PdmFieldHandle* change
|
||||
crossPlotCurveSet->destroyCurves();
|
||||
crossPlotCurveSet->loadDataAndUpdate( true );
|
||||
}
|
||||
|
||||
RimWellRftPlot* rftPlot;
|
||||
firstAncestorOrThisOfType( rftPlot );
|
||||
if ( rftPlot )
|
||||
{
|
||||
rftPlot->loadDataAndUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -904,6 +913,7 @@ QList<caf::PdmOptionItemInfo>
|
||||
{
|
||||
bool hasStimPlanParent = false;
|
||||
bool hasEnsembleCurveSetParent = false;
|
||||
bool hasRftPlotParent = false;
|
||||
|
||||
RimStimPlanColors* stimPlanColors = nullptr;
|
||||
this->firstAncestorOrThisOfType( stimPlanColors );
|
||||
@ -916,6 +926,10 @@ QList<caf::PdmOptionItemInfo>
|
||||
RimGridCrossPlotDataSet* crossPlotCurveSet = nullptr;
|
||||
this->firstAncestorOrThisOfType( crossPlotCurveSet );
|
||||
|
||||
RimWellRftEnsembleCurveSet* rftCurveSet = nullptr;
|
||||
this->firstAncestorOrThisOfType( rftCurveSet );
|
||||
if ( rftCurveSet ) hasRftPlotParent = true;
|
||||
|
||||
bool isCategoryResult = false;
|
||||
{
|
||||
RimEclipseCellColors* eclCellColors = nullptr;
|
||||
@ -931,6 +945,7 @@ QList<caf::PdmOptionItemInfo>
|
||||
( gmCellColors && gmCellColors->hasCategoryResult() ) ||
|
||||
( eclCellEdgColors && eclCellEdgColors->hasCategoryResult() ) ||
|
||||
( ensembleCurveSet && ensembleCurveSet->currentEnsembleParameterType() == EnsembleParameter::TYPE_TEXT ) ||
|
||||
( rftCurveSet && rftCurveSet->currentEnsembleParameterType() == EnsembleParameter::TYPE_TEXT ) ||
|
||||
( crossPlotCurveSet && crossPlotCurveSet->groupingByCategoryResult() ) ||
|
||||
( wellMeasurementInView && wellMeasurementInView->hasCategoryResult() ) )
|
||||
{
|
||||
@ -967,7 +982,7 @@ QList<caf::PdmOptionItemInfo>
|
||||
{
|
||||
// This is an app enum field, see cafInternalPdmFieldTypeSpecializations.h for the default specialization of this type
|
||||
std::vector<ColorRangesType> rangeTypes;
|
||||
if ( !hasEnsembleCurveSetParent )
|
||||
if ( !hasEnsembleCurveSetParent && !hasRftPlotParent )
|
||||
{
|
||||
rangeTypes.push_back( NORMAL );
|
||||
rangeTypes.push_back( OPPOSITE_NORMAL );
|
||||
@ -1011,7 +1026,7 @@ QList<caf::PdmOptionItemInfo>
|
||||
|
||||
options.push_back( caf::PdmOptionItemInfo( uiText, RimRegularLegendConfig::AUTOMATIC_ALLTIMESTEPS ) );
|
||||
}
|
||||
if ( !hasStimPlanParent && !hasEnsembleCurveSetParent )
|
||||
if ( !hasStimPlanParent && !hasEnsembleCurveSetParent && !hasRftPlotParent )
|
||||
{
|
||||
options.push_back(
|
||||
caf::PdmOptionItemInfo( RangeModeEnum::uiText( RimRegularLegendConfig::AUTOMATIC_CURRENT_TIMESTEP ),
|
||||
|
@ -139,6 +139,11 @@ public:
|
||||
{
|
||||
return m_currentScalarMapper.p();
|
||||
}
|
||||
const cvf::ScalarMapper* scalarMapper() const
|
||||
{
|
||||
return m_currentScalarMapper.p();
|
||||
}
|
||||
|
||||
bool showLegend() const;
|
||||
|
||||
const caf::TitledOverlayFrame* titledOverlayFrame() const override;
|
||||
|
@ -37,7 +37,6 @@ ${CMAKE_CURRENT_LIST_DIR}/RimEnsembleStatisticsCase.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimDerivedEnsembleCase.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimDerivedEnsembleCaseCollection.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimSummaryPlotFilterTextCurveSetEditor.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimEnsembleParameterColorHandlerInterface.h
|
||||
)
|
||||
|
||||
set (SOURCE_GROUP_SOURCE_FILES
|
||||
@ -78,7 +77,6 @@ ${CMAKE_CURRENT_LIST_DIR}/RimEnsembleStatisticsCase.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimDerivedEnsembleCase.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimDerivedEnsembleCaseCollection.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimSummaryPlotFilterTextCurveSetEditor.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimEnsembleParameterColorHandlerInterface.cpp
|
||||
)
|
||||
|
||||
list(APPEND CODE_HEADER_FILES
|
||||
|
@ -766,11 +766,10 @@ QList<caf::PdmOptionItemInfo> RimEnsembleCurveSet::calculateValueOptions( const
|
||||
auto singleColorOption = ColorModeEnum( ColorMode::SINGLE_COLOR );
|
||||
auto byEnsParamOption = ColorModeEnum( ColorMode::BY_ENSEMBLE_PARAM );
|
||||
|
||||
options.push_back( caf::PdmOptionItemInfo::fromEnumClass( singleColorOption.uiText(), ColorMode::SINGLE_COLOR ) );
|
||||
options.push_back( caf::PdmOptionItemInfo( singleColorOption.uiText(), ColorMode::SINGLE_COLOR ) );
|
||||
if ( !ensembleParameters().empty() )
|
||||
{
|
||||
options.push_back(
|
||||
caf::PdmOptionItemInfo::fromEnumClass( byEnsParamOption.uiText(), ColorMode::BY_ENSEMBLE_PARAM ) );
|
||||
options.push_back( caf::PdmOptionItemInfo( byEnsParamOption.uiText(), ColorMode::BY_ENSEMBLE_PARAM ) );
|
||||
}
|
||||
}
|
||||
else if ( fieldNeedingOptions == &m_ensembleParameter )
|
||||
@ -851,72 +850,18 @@ void RimEnsembleCurveSet::updateCurveColors()
|
||||
if ( group && !parameterName.isEmpty() && !group->allSummaryCases().empty() )
|
||||
{
|
||||
auto ensembleParam = group->ensembleParameter( parameterName );
|
||||
|
||||
if ( ensembleParam.isText() )
|
||||
if ( ensembleParam.isText() || ensembleParam.isNumeric() )
|
||||
{
|
||||
std::set<QString> categories;
|
||||
|
||||
for ( auto value : ensembleParam.values )
|
||||
{
|
||||
categories.insert( value.toString() );
|
||||
}
|
||||
|
||||
std::vector<QString> categoryNames = std::vector<QString>( categories.begin(), categories.end() );
|
||||
m_legendConfig->setNamedCategories( categoryNames );
|
||||
m_legendConfig->setAutomaticRanges( 0, categoryNames.size() - 1, 0, categoryNames.size() - 1 );
|
||||
|
||||
RimEnsembleCurveSetColorManager::initializeLegendConfig( m_legendConfig, ensembleParam );
|
||||
for ( auto& curve : m_curves )
|
||||
{
|
||||
if ( curve->summaryAddressY().category() == RifEclipseSummaryAddress::SUMMARY_ENSEMBLE_STATISTICS )
|
||||
continue;
|
||||
|
||||
RimSummaryCase* rimCase = curve->summaryCaseY();
|
||||
QString tValue = rimCase->hasCaseRealizationParameters()
|
||||
? rimCase->caseRealizationParameters()->parameterValue( parameterName ).textValue()
|
||||
: "";
|
||||
double nValue = m_legendConfig->categoryValueFromCategoryName( tValue );
|
||||
if ( nValue != DOUBLE_INF )
|
||||
{
|
||||
int iValue = static_cast<int>( nValue );
|
||||
curve->setColor( cvf::Color3f( m_legendConfig->scalarMapper()->mapToColor( iValue ) ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
curve->setColor( RiaColorTables::undefinedCellColor() );
|
||||
}
|
||||
curve->updateCurveAppearance();
|
||||
}
|
||||
}
|
||||
else if ( ensembleParam.isNumeric() )
|
||||
{
|
||||
double minValue = DOUBLE_INF;
|
||||
double maxValue = -DOUBLE_INF;
|
||||
|
||||
for ( auto value : ensembleParam.values )
|
||||
{
|
||||
double nValue = value.toDouble();
|
||||
if ( nValue != DOUBLE_INF )
|
||||
{
|
||||
if ( nValue < minValue ) minValue = nValue;
|
||||
if ( nValue > maxValue ) maxValue = nValue;
|
||||
}
|
||||
}
|
||||
|
||||
m_legendConfig->setAutomaticRanges( minValue, maxValue, minValue, maxValue );
|
||||
|
||||
for ( auto& curve : m_curves )
|
||||
{
|
||||
if ( curve->summaryAddressY().category() == RifEclipseSummaryAddress::SUMMARY_ENSEMBLE_STATISTICS )
|
||||
continue;
|
||||
|
||||
RimSummaryCase* rimCase = curve->summaryCaseY();
|
||||
double value = rimCase->hasCaseRealizationParameters()
|
||||
? rimCase->caseRealizationParameters()->parameterValue( parameterName ).numericValue()
|
||||
: DOUBLE_INF;
|
||||
if ( value != DOUBLE_INF )
|
||||
curve->setColor( cvf::Color3f( m_legendConfig->scalarMapper()->mapToColor( value ) ) );
|
||||
else
|
||||
curve->setColor( RiaColorTables::undefinedCellColor() );
|
||||
RimSummaryCase* rimCase = curve->summaryCaseY();
|
||||
cvf::Color3f curveColor = RimEnsembleCurveSetColorManager::caseColor( m_legendConfig,
|
||||
rimCase,
|
||||
ensembleParam );
|
||||
curve->setColor( curveColor );
|
||||
curve->updateCurveAppearance();
|
||||
}
|
||||
}
|
||||
@ -950,7 +895,7 @@ void RimEnsembleCurveSet::updateCurveColors()
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( !m_legendOverlayFrame.isNull() )
|
||||
if ( m_legendOverlayFrame )
|
||||
{
|
||||
plot->viewer()->removeOverlayFrame( m_legendOverlayFrame );
|
||||
}
|
||||
|
@ -19,10 +19,12 @@
|
||||
#pragma once
|
||||
|
||||
#include "RifEclipseSummaryAddress.h"
|
||||
#include "RifEclipseSummaryAddressQMetaType.h"
|
||||
#include "RifSummaryReaderInterface.h"
|
||||
|
||||
#include "RiaDefines.h"
|
||||
|
||||
#include "RimEnsembleCurveSetColorManager.h"
|
||||
#include "RimRegularLegendConfig.h"
|
||||
#include "RimSummaryCase.h"
|
||||
#include "RimSummaryCaseCollection.h"
|
||||
@ -36,8 +38,6 @@
|
||||
#include "cafPdmPtrArrayField.h"
|
||||
#include "cafPdmPtrField.h"
|
||||
|
||||
#include "RifEclipseSummaryAddressQMetaType.h"
|
||||
#include "RimEnsembleParameterColorHandlerInterface.h"
|
||||
#include "cafPdmProxyValueField.h"
|
||||
|
||||
#include <QPointer>
|
||||
@ -57,14 +57,21 @@ class RiuCvfOverlayItemWidget;
|
||||
class QwtPlot;
|
||||
class QwtPlotCurve;
|
||||
class QKeyEvent;
|
||||
class QFrame;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimEnsembleCurveSet : public caf::PdmObject, public RimEnsembleParameterColorHandlerInterface
|
||||
class RimEnsembleCurveSet : public caf::PdmObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
using ColorMode = RimEnsembleCurveSetColorManager::ColorMode;
|
||||
using ColorModeEnum = RimEnsembleCurveSetColorManager::ColorModeEnum;
|
||||
|
||||
using NameParameterPair = EnsembleParameter::NameParameterPair;
|
||||
|
||||
public:
|
||||
RimEnsembleCurveSet();
|
||||
~RimEnsembleCurveSet() override;
|
||||
@ -94,15 +101,16 @@ public:
|
||||
|
||||
RimEnsembleCurveFilterCollection* filterCollection() const;
|
||||
|
||||
ColorMode colorMode() const override;
|
||||
void setColorMode( ColorMode mode ) override;
|
||||
void setEnsembleParameter( const QString& parameterName ) override;
|
||||
void updateEnsembleLegendItem() override;
|
||||
RimRegularLegendConfig* legendConfig() override;
|
||||
QFrame* legendFrame() const override;
|
||||
|
||||
ColorMode colorMode() const;
|
||||
void setColorMode( ColorMode mode );
|
||||
void setEnsembleParameter( const QString& parameterName );
|
||||
EnsembleParameter::Type currentEnsembleParameterType() const;
|
||||
|
||||
RimRegularLegendConfig* legendConfig();
|
||||
|
||||
void updateEnsembleLegendItem();
|
||||
QFrame* legendFrame() const;
|
||||
|
||||
void updateAllCurves();
|
||||
void updateStatisticsCurves();
|
||||
|
||||
|
@ -17,8 +17,28 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RimEnsembleCurveSetColorManager.h"
|
||||
|
||||
#include "RiaColorTables.h"
|
||||
#include "RimEnsembleCurveSet.h"
|
||||
#include "RimEnsembleCurveSetCollection.h"
|
||||
|
||||
#include "RimRegularLegendConfig.h"
|
||||
#include "cvfScalarMapper.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
namespace caf
|
||||
{
|
||||
template <>
|
||||
void AppEnum<RimEnsembleCurveSetColorManager::ColorMode>::setUp()
|
||||
{
|
||||
addItem( RimEnsembleCurveSetColorManager::ColorMode::SINGLE_COLOR, "SINGLE_COLOR", "Single Color" );
|
||||
addItem( RimEnsembleCurveSetColorManager::ColorMode::BY_ENSEMBLE_PARAM, "BY_ENSEMBLE_PARAM", "By Ensemble Parameter" );
|
||||
setDefault( RimEnsembleCurveSetColorManager::ColorMode::SINGLE_COLOR );
|
||||
}
|
||||
} // namespace caf
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -64,6 +84,76 @@ RimRegularLegendConfig::ColorRangesType RimEnsembleCurveSetColorManager::cycledE
|
||||
return crIt->first;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEnsembleCurveSetColorManager::initializeLegendConfig( RimRegularLegendConfig* legendConfig,
|
||||
const EnsembleParameter& ensembleParam )
|
||||
{
|
||||
if ( ensembleParam.isText() )
|
||||
{
|
||||
std::set<QString> categories;
|
||||
|
||||
for ( auto value : ensembleParam.values )
|
||||
{
|
||||
categories.insert( value.toString() );
|
||||
}
|
||||
|
||||
std::vector<QString> categoryNames = std::vector<QString>( categories.begin(), categories.end() );
|
||||
legendConfig->setNamedCategories( categoryNames );
|
||||
legendConfig->setAutomaticRanges( 0, categoryNames.size() - 1, 0, categoryNames.size() - 1 );
|
||||
}
|
||||
else
|
||||
{
|
||||
double minValue = std::numeric_limits<double>::infinity();
|
||||
double maxValue = -std::numeric_limits<double>::infinity();
|
||||
|
||||
for ( auto value : ensembleParam.values )
|
||||
{
|
||||
double nValue = value.toDouble();
|
||||
if ( nValue != std::numeric_limits<double>::infinity() )
|
||||
{
|
||||
if ( nValue < minValue ) minValue = nValue;
|
||||
if ( nValue > maxValue ) maxValue = nValue;
|
||||
}
|
||||
}
|
||||
|
||||
legendConfig->setAutomaticRanges( minValue, maxValue, minValue, maxValue );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::Color3f RimEnsembleCurveSetColorManager::caseColor( const RimRegularLegendConfig* legendConfig,
|
||||
const RimSummaryCase* summaryCase,
|
||||
const EnsembleParameter& ensembleParam )
|
||||
{
|
||||
if ( ensembleParam.isText() )
|
||||
{
|
||||
QString tValue = summaryCase->hasCaseRealizationParameters()
|
||||
? summaryCase->caseRealizationParameters()->parameterValue( ensembleParam.name ).textValue()
|
||||
: "";
|
||||
double nValue = legendConfig->categoryValueFromCategoryName( tValue );
|
||||
if ( nValue != std::numeric_limits<double>::infinity() )
|
||||
{
|
||||
int iValue = static_cast<int>( nValue );
|
||||
return cvf::Color3f( legendConfig->scalarMapper()->mapToColor( iValue ) );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
double value = summaryCase->hasCaseRealizationParameters()
|
||||
? summaryCase->caseRealizationParameters()->parameterValue( ensembleParam.name ).numericValue()
|
||||
: std::numeric_limits<double>::infinity();
|
||||
if ( value != std::numeric_limits<double>::infinity() )
|
||||
{
|
||||
return cvf::Color3f( legendConfig->scalarMapper()->mapToColor( value ) );
|
||||
}
|
||||
}
|
||||
return RiaColorTables::undefinedCellColor();
|
||||
}
|
||||
|
||||
std::map<RimEnsembleCurveSetCollection*, int> RimEnsembleCurveSetColorManager::m_nextColorIndexes;
|
||||
|
||||
std::map<RimEnsembleCurveSetCollection*, std::map<RimEnsembleCurveSet*, RimRegularLegendConfig::ColorRangesType>>
|
||||
|
@ -20,11 +20,12 @@
|
||||
|
||||
#include "RiaDefines.h"
|
||||
|
||||
#include "RimEnsembleCurveSet.h"
|
||||
#include "RimRegularLegendConfig.h"
|
||||
#include "RimSummaryCaseCollection.h"
|
||||
|
||||
#include <map>
|
||||
|
||||
class RimEnsembleCurveSet;
|
||||
class RimEnsembleCurveSetCollection;
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -32,6 +33,15 @@ class RimEnsembleCurveSetCollection;
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
class RimEnsembleCurveSetColorManager
|
||||
{
|
||||
public:
|
||||
enum class ColorMode
|
||||
{
|
||||
SINGLE_COLOR,
|
||||
BY_ENSEMBLE_PARAM
|
||||
};
|
||||
using ColorModeEnum = caf::AppEnum<ColorMode>;
|
||||
using NameParameterPair = EnsembleParameter::NameParameterPair;
|
||||
|
||||
public:
|
||||
static const std::map<RimRegularLegendConfig::ColorRangesType, cvf::Color3ubArray>& EnsembleColorRanges();
|
||||
|
||||
@ -43,6 +53,11 @@ public:
|
||||
return m_ensembleColorRanges.find( colorRange ) != m_ensembleColorRanges.end();
|
||||
}
|
||||
|
||||
static void initializeLegendConfig( RimRegularLegendConfig* legendConfig, const EnsembleParameter& parameter );
|
||||
static cvf::Color3f caseColor( const RimRegularLegendConfig* legendConfig,
|
||||
const RimSummaryCase* summaryCase,
|
||||
const EnsembleParameter& parameter );
|
||||
|
||||
private:
|
||||
static const std::map<RimRegularLegendConfig::ColorRangesType, cvf::Color3ubArray> m_ensembleColorRanges;
|
||||
|
||||
|
@ -1,17 +0,0 @@
|
||||
#include "RimEnsembleParameterColorHandlerInterface.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
namespace caf
|
||||
{
|
||||
template <>
|
||||
void AppEnum<RimEnsembleParameterColorHandlerInterface::ColorMode>::setUp()
|
||||
{
|
||||
addItem( RimEnsembleParameterColorHandlerInterface::ColorMode::SINGLE_COLOR, "SINGLE_COLOR", "Single Color" );
|
||||
addItem( RimEnsembleParameterColorHandlerInterface::ColorMode::BY_ENSEMBLE_PARAM,
|
||||
"BY_ENSEMBLE_PARAM",
|
||||
"By Ensemble Parameter" );
|
||||
setDefault( RimEnsembleParameterColorHandlerInterface::ColorMode::SINGLE_COLOR );
|
||||
}
|
||||
} // namespace caf
|
@ -1,49 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2019- Statoil ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RimSummaryCaseCollection.h"
|
||||
#include "cafAppEnum.h"
|
||||
|
||||
#include <utility>
|
||||
|
||||
class RimRegularLegendConfig;
|
||||
class RiuCvfOverlayItemWidget;
|
||||
|
||||
class QFrame;
|
||||
|
||||
class RimEnsembleParameterColorHandlerInterface
|
||||
{
|
||||
public:
|
||||
enum class ColorMode
|
||||
{
|
||||
SINGLE_COLOR,
|
||||
BY_ENSEMBLE_PARAM
|
||||
};
|
||||
using ColorModeEnum = caf::AppEnum<ColorMode>;
|
||||
using NameParameterPair = EnsembleParameter::NameParameterPair;
|
||||
|
||||
public:
|
||||
virtual ColorMode colorMode() const = 0;
|
||||
virtual void setColorMode( ColorMode mode ) = 0;
|
||||
virtual void setEnsembleParameter( const QString& parameterName ) = 0;
|
||||
virtual void updateEnsembleLegendItem() = 0;
|
||||
virtual RimRegularLegendConfig* legendConfig() = 0;
|
||||
virtual QFrame* legendFrame() const = 0;
|
||||
};
|
@ -22,7 +22,6 @@
|
||||
|
||||
#include "RimEnsembleCurveSet.h"
|
||||
#include "RimEnsembleCurveSetCollection.h"
|
||||
#include "RimEnsembleParameterColorHandlerInterface.h"
|
||||
#include "RimMainPlotCollection.h"
|
||||
#include "RimPlot.h"
|
||||
#include "RimRegularLegendConfig.h"
|
||||
|
Loading…
Reference in New Issue
Block a user