mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#7716 Ensemble Well Logs: Use colors from ensemble curve set
This commit is contained in:
@@ -19,21 +19,19 @@
|
|||||||
#include "RimEnsembleWellLogCurveSet.h"
|
#include "RimEnsembleWellLogCurveSet.h"
|
||||||
|
|
||||||
#include "RiaColorTools.h"
|
#include "RiaColorTools.h"
|
||||||
#include "RiaGuiApplication.h"
|
|
||||||
#include "RiaLogging.h"
|
#include "RiaLogging.h"
|
||||||
#include "RiaPreferences.h"
|
|
||||||
#include "RiaResultNames.h"
|
|
||||||
#include "RiaStatisticsTools.h"
|
|
||||||
#include "RiaSummaryCurveAnalyzer.h"
|
|
||||||
#include "RiaSummaryCurveDefinition.h"
|
|
||||||
#include "RiaTimeTTools.h"
|
|
||||||
|
|
||||||
|
#include "RimEnsembleCurveFilter.h"
|
||||||
|
#include "RimEnsembleCurveFilterCollection.h"
|
||||||
#include "RimEnsembleCurveSet.h"
|
#include "RimEnsembleCurveSet.h"
|
||||||
|
#include "RimEnsembleStatistics.h"
|
||||||
|
#include "RimEnsembleWellLogStatistics.h"
|
||||||
#include "RimEnsembleWellLogStatisticsCurve.h"
|
#include "RimEnsembleWellLogStatisticsCurve.h"
|
||||||
|
#include "RimEnsembleWellLogs.h"
|
||||||
|
#include "RimEnsembleWellLogsCollection.h"
|
||||||
#include "RimMainPlotCollection.h"
|
#include "RimMainPlotCollection.h"
|
||||||
#include "RimOilField.h"
|
#include "RimOilField.h"
|
||||||
#include "RimProject.h"
|
#include "RimProject.h"
|
||||||
#include "RimRegularLegendConfig.h"
|
|
||||||
#include "RimWellLogCurve.h"
|
#include "RimWellLogCurve.h"
|
||||||
#include "RimWellLogFile.h"
|
#include "RimWellLogFile.h"
|
||||||
#include "RimWellLogFileChannel.h"
|
#include "RimWellLogFileChannel.h"
|
||||||
@@ -41,16 +39,6 @@
|
|||||||
#include "RimWellLogPlot.h"
|
#include "RimWellLogPlot.h"
|
||||||
#include "RimWellLogTrack.h"
|
#include "RimWellLogTrack.h"
|
||||||
|
|
||||||
#include "RimEnsembleCurveFilter.h"
|
|
||||||
#include "RimEnsembleCurveFilterCollection.h"
|
|
||||||
#include "RimEnsembleCurveSetCollection.h"
|
|
||||||
#include "RimEnsembleCurveSetColorManager.h"
|
|
||||||
#include "RimEnsembleStatistics.h"
|
|
||||||
#include "RimEnsembleStatisticsCase.h"
|
|
||||||
#include "RimEnsembleWellLogStatistics.h"
|
|
||||||
#include "RimEnsembleWellLogs.h"
|
|
||||||
#include "RimEnsembleWellLogsCollection.h"
|
|
||||||
|
|
||||||
#include "RiuAbstractLegendFrame.h"
|
#include "RiuAbstractLegendFrame.h"
|
||||||
#include "RiuDraggableOverlayFrame.h"
|
#include "RiuDraggableOverlayFrame.h"
|
||||||
#include "RiuPlotMainWindow.h"
|
#include "RiuPlotMainWindow.h"
|
||||||
@@ -66,13 +54,6 @@
|
|||||||
#include "cafPdmUiPushButtonEditor.h"
|
#include "cafPdmUiPushButtonEditor.h"
|
||||||
#include "cafPdmUiSliderEditor.h"
|
#include "cafPdmUiSliderEditor.h"
|
||||||
#include "cafPdmUiTreeOrdering.h"
|
#include "cafPdmUiTreeOrdering.h"
|
||||||
#include "cafPdmUiTreeSelectionEditor.h"
|
|
||||||
#include "cafTitledOverlayFrame.h"
|
|
||||||
|
|
||||||
// TODO: remove?
|
|
||||||
#include "RifEnsembleStatisticsReader.h"
|
|
||||||
|
|
||||||
// #include "cvfScalarMapper.h"
|
|
||||||
|
|
||||||
#include "qwt_plot_curve.h"
|
#include "qwt_plot_curve.h"
|
||||||
#include "qwt_symbol.h"
|
#include "qwt_symbol.h"
|
||||||
@@ -85,6 +66,19 @@
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
int statisticsCurveSymbolSize( RiuQwtSymbol::PointSymbolEnum symbol );
|
int statisticsCurveSymbolSize( RiuQwtSymbol::PointSymbolEnum symbol );
|
||||||
|
|
||||||
|
namespace caf
|
||||||
|
{
|
||||||
|
template <>
|
||||||
|
void AppEnum<RimEnsembleWellLogCurveSet::ColorMode>::setUp()
|
||||||
|
{
|
||||||
|
addItem( RimEnsembleWellLogCurveSet::ColorMode::SINGLE_COLOR, "SINGLE_COLOR", "Single Color" );
|
||||||
|
addItem( RimEnsembleWellLogCurveSet::ColorMode::COLOR_BY_ENSEMBLE_CURVE_SET,
|
||||||
|
"BY_ENSEMBLE_CURVE_SET",
|
||||||
|
"Color by Ensemble Curve Set" );
|
||||||
|
setDefault( RimEnsembleWellLogCurveSet::ColorMode::SINGLE_COLOR );
|
||||||
|
}
|
||||||
|
}; // namespace caf
|
||||||
|
|
||||||
CAF_PDM_SOURCE_INIT( RimEnsembleWellLogCurveSet, "RimEnsembleWellLogCurveSet" );
|
CAF_PDM_SOURCE_INIT( RimEnsembleWellLogCurveSet, "RimEnsembleWellLogCurveSet" );
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -114,19 +108,6 @@ RimEnsembleWellLogCurveSet::RimEnsembleWellLogCurveSet()
|
|||||||
|
|
||||||
CAF_PDM_InitField( &m_color, "Color", RiaColorTools::textColor3f(), "Color", "", "", "" );
|
CAF_PDM_InitField( &m_color, "Color", RiaColorTools::textColor3f(), "Color", "", "", "" );
|
||||||
|
|
||||||
CAF_PDM_InitField( &m_ensembleParameter, "EnsembleParameter", QString( "" ), "Ensemble Parameter", "", "", "" );
|
|
||||||
m_ensembleParameter.uiCapability()->setUiEditorTypeName( caf::PdmUiListEditor::uiEditorTypeName() );
|
|
||||||
|
|
||||||
CAF_PDM_InitFieldNoDefault( &m_legendConfig, "LegendConfig", "", "", "", "" );
|
|
||||||
m_legendConfig = new RimRegularLegendConfig();
|
|
||||||
m_legendConfig->setColorLegend(
|
|
||||||
RimRegularLegendConfig::mapToColorLegend( RimEnsembleCurveSetColorManager::DEFAULT_ENSEMBLE_COLOR_RANGE ) );
|
|
||||||
|
|
||||||
CAF_PDM_InitFieldNoDefault( &m_curveFilters, "CurveFilters", "Curve Filters", "", "", "" );
|
|
||||||
m_curveFilters = new RimEnsembleCurveFilterCollection();
|
|
||||||
m_curveFilters->setUiTreeHidden( true );
|
|
||||||
m_curveFilters->uiCapability()->setUiTreeHidden( true );
|
|
||||||
|
|
||||||
CAF_PDM_InitFieldNoDefault( &m_statistics, "Statistics", "Statistics", "", "", "" );
|
CAF_PDM_InitFieldNoDefault( &m_statistics, "Statistics", "Statistics", "", "", "" );
|
||||||
m_statistics = new RimEnsembleStatistics( this );
|
m_statistics = new RimEnsembleStatistics( this );
|
||||||
m_statistics.uiCapability()->setUiTreeHidden( true );
|
m_statistics.uiCapability()->setUiTreeHidden( true );
|
||||||
@@ -203,8 +184,6 @@ void RimEnsembleWellLogCurveSet::setColor( cvf::Color3f color )
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimEnsembleWellLogCurveSet::loadDataAndUpdate( bool updateParentPlot )
|
void RimEnsembleWellLogCurveSet::loadDataAndUpdate( bool updateParentPlot )
|
||||||
{
|
{
|
||||||
m_curveFilters->loadDataAndUpdate();
|
|
||||||
|
|
||||||
updateAllCurves();
|
updateAllCurves();
|
||||||
updateFilterLegend();
|
updateFilterLegend();
|
||||||
|
|
||||||
@@ -354,14 +333,6 @@ void RimEnsembleWellLogCurveSet::deleteStatisticsCurves()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
RimRegularLegendConfig* RimEnsembleWellLogCurveSet::legendConfig()
|
|
||||||
{
|
|
||||||
return m_legendConfig;
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -378,14 +349,6 @@ void RimEnsembleWellLogCurveSet::onLegendDefinitionChanged()
|
|||||||
updateCurveColors();
|
updateCurveColors();
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
RimEnsembleCurveFilterCollection* RimEnsembleWellLogCurveSet::filterCollection() const
|
|
||||||
{
|
|
||||||
return m_curveFilters;
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -402,33 +365,6 @@ void RimEnsembleWellLogCurveSet::setColorMode( ColorMode mode )
|
|||||||
m_colorMode = mode;
|
m_colorMode = mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
void RimEnsembleWellLogCurveSet::setEnsembleParameter( const QString& parameterName )
|
|
||||||
{
|
|
||||||
m_ensembleParameter = parameterName;
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
RigEnsembleParameter::Type RimEnsembleWellLogCurveSet::currentEnsembleParameterType() const
|
|
||||||
{
|
|
||||||
if ( m_colorMode() == ColorMode::BY_ENSEMBLE_PARAM )
|
|
||||||
{
|
|
||||||
// RimSummaryCaseCollection* group = m_yValuesSummaryCaseCollection();
|
|
||||||
// QString parameterName = m_ensembleParameter();
|
|
||||||
|
|
||||||
// if ( group && !parameterName.isEmpty() )
|
|
||||||
// {
|
|
||||||
// auto eParam = group->ensembleParameter( parameterName );
|
|
||||||
// return eParam.type;
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
return RigEnsembleParameter::TYPE_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -491,8 +427,8 @@ void RimEnsembleWellLogCurveSet::fieldChangedByUi( const caf::PdmFieldHandle* ch
|
|||||||
}
|
}
|
||||||
else if ( changedField == &m_ensembleCurveSet )
|
else if ( changedField == &m_ensembleCurveSet )
|
||||||
{
|
{
|
||||||
|
connectEnsembleCurveSetFilterSignals();
|
||||||
updateAllCurves();
|
updateAllCurves();
|
||||||
|
|
||||||
loadDataAndUpdate( true );
|
loadDataAndUpdate( true );
|
||||||
updateTextInPlot = true;
|
updateTextInPlot = true;
|
||||||
}
|
}
|
||||||
@@ -507,24 +443,8 @@ void RimEnsembleWellLogCurveSet::fieldChangedByUi( const caf::PdmFieldHandle* ch
|
|||||||
|
|
||||||
updateTextInPlot = true;
|
updateTextInPlot = true;
|
||||||
}
|
}
|
||||||
else if ( changedField == &m_ensembleParameter )
|
|
||||||
{
|
|
||||||
updateLegendMappingMode();
|
|
||||||
updateCurveColors();
|
|
||||||
}
|
|
||||||
else if ( changedField == &m_colorMode )
|
else if ( changedField == &m_colorMode )
|
||||||
{
|
{
|
||||||
m_ensembleParameter.uiCapability()->setUiHidden( m_colorMode() != ColorMode::BY_ENSEMBLE_PARAM );
|
|
||||||
|
|
||||||
if ( m_colorMode() == ColorMode::BY_ENSEMBLE_PARAM )
|
|
||||||
{
|
|
||||||
if ( m_ensembleParameter().isEmpty() )
|
|
||||||
{
|
|
||||||
auto params = variationSortedEnsembleParameters();
|
|
||||||
m_ensembleParameter = !params.empty() ? params.front().name : "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
updateCurveColors();
|
updateCurveColors();
|
||||||
|
|
||||||
updateTextInPlot = true;
|
updateTextInPlot = true;
|
||||||
@@ -592,10 +512,6 @@ void RimEnsembleWellLogCurveSet::appendColorGroup( caf::PdmUiOrdering& uiOrderin
|
|||||||
{
|
{
|
||||||
colorsGroup->add( &m_color );
|
colorsGroup->add( &m_color );
|
||||||
}
|
}
|
||||||
else if ( m_colorMode == ColorMode::BY_ENSEMBLE_PARAM )
|
|
||||||
{
|
|
||||||
colorsGroup->add( &m_ensembleParameter );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -604,16 +520,6 @@ void RimEnsembleWellLogCurveSet::appendColorGroup( caf::PdmUiOrdering& uiOrderin
|
|||||||
void RimEnsembleWellLogCurveSet::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering,
|
void RimEnsembleWellLogCurveSet::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering,
|
||||||
QString uiConfigName /*= ""*/ )
|
QString uiConfigName /*= ""*/ )
|
||||||
{
|
{
|
||||||
if ( m_colorMode == ColorMode::BY_ENSEMBLE_PARAM )
|
|
||||||
{
|
|
||||||
uiTreeOrdering.add( m_legendConfig() );
|
|
||||||
}
|
|
||||||
|
|
||||||
for ( auto filter : m_curveFilters->filters() )
|
|
||||||
{
|
|
||||||
uiTreeOrdering.add( filter );
|
|
||||||
}
|
|
||||||
|
|
||||||
uiTreeOrdering.skipRemainingChildren( true );
|
uiTreeOrdering.skipRemainingChildren( true );
|
||||||
|
|
||||||
caf::IconProvider iconProvider = this->uiIconProvider();
|
caf::IconProvider iconProvider = this->uiIconProvider();
|
||||||
@@ -713,26 +619,14 @@ QList<caf::PdmOptionItemInfo>
|
|||||||
}
|
}
|
||||||
else if ( fieldNeedingOptions == &m_colorMode )
|
else if ( fieldNeedingOptions == &m_colorMode )
|
||||||
{
|
{
|
||||||
auto singleColorOption = ColorModeEnum( ColorMode::SINGLE_COLOR );
|
auto singleColorOption = caf::AppEnum<ColorMode>( ColorMode::SINGLE_COLOR );
|
||||||
auto byEnsParamOption = ColorModeEnum( ColorMode::BY_ENSEMBLE_PARAM );
|
|
||||||
|
|
||||||
options.push_back( caf::PdmOptionItemInfo( singleColorOption.uiText(), ColorMode::SINGLE_COLOR ) );
|
options.push_back( caf::PdmOptionItemInfo( singleColorOption.uiText(), ColorMode::SINGLE_COLOR ) );
|
||||||
|
|
||||||
RimEnsembleWellLogs* ensembleWellLogs = m_ensembleWellLogs;
|
if ( m_ensembleWellLogs && m_ensembleCurveSet )
|
||||||
if ( ensembleWellLogs && ensembleWellLogs->hasEnsembleParameters() )
|
|
||||||
{
|
{
|
||||||
options.push_back( caf::PdmOptionItemInfo( byEnsParamOption.uiText(), ColorMode::BY_ENSEMBLE_PARAM ) );
|
auto byEnsembleOption = caf::AppEnum<ColorMode>( ColorMode::COLOR_BY_ENSEMBLE_CURVE_SET );
|
||||||
}
|
options.push_back( caf::PdmOptionItemInfo( byEnsembleOption.uiText(), ColorMode::COLOR_BY_ENSEMBLE_CURVE_SET ) );
|
||||||
}
|
|
||||||
else if ( fieldNeedingOptions == &m_ensembleParameter )
|
|
||||||
{
|
|
||||||
auto params = correlationSortedEnsembleParameters();
|
|
||||||
for ( const auto& paramCorrPair : params )
|
|
||||||
{
|
|
||||||
QString name = paramCorrPair.first.name;
|
|
||||||
double corr = paramCorrPair.second;
|
|
||||||
options.push_back(
|
|
||||||
caf::PdmOptionItemInfo( QString( "%1 (Avg. correlation: %2)" ).arg( name ).arg( corr, 5, 'f', 2 ), name ) );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -770,53 +664,64 @@ void RimEnsembleWellLogCurveSet::updateFilterLegend()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RimSummaryCase* RimEnsembleWellLogCurveSet::findMatchingSummaryCase( RimWellLogFileCurve* wellLogCurve ) const
|
||||||
|
{
|
||||||
|
RimSummaryCaseCollection* summaryCaseCollection = m_ensembleCurveSet->summaryCaseCollection();
|
||||||
|
std::vector<RimSummaryCase*> sumCases = summaryCaseCollection->allSummaryCases();
|
||||||
|
for ( auto sumCase : sumCases )
|
||||||
|
{
|
||||||
|
if ( isSameRealization( sumCase, wellLogCurve->wellLogFile() ) )
|
||||||
|
{
|
||||||
|
return sumCase;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimEnsembleWellLogCurveSet::updateCurveColors()
|
void RimEnsembleWellLogCurveSet::updateCurveColors()
|
||||||
{
|
{
|
||||||
if ( m_colorMode == ColorMode::BY_ENSEMBLE_PARAM )
|
if ( m_colorMode == ColorMode::COLOR_BY_ENSEMBLE_CURVE_SET )
|
||||||
{
|
{
|
||||||
QString parameterName = m_ensembleParameter();
|
if ( m_ensembleCurveSet != nullptr )
|
||||||
|
{
|
||||||
|
// Fint the curves to color (skip the statistics)
|
||||||
|
std::vector<RimWellLogCurve*> curvesToColor;
|
||||||
|
std::vector<RimSummaryCase*> summaryCases;
|
||||||
|
|
||||||
|
for ( auto& curve : m_curves )
|
||||||
{
|
{
|
||||||
QString legendTitle;
|
// Statistics curves have separate color settings
|
||||||
if ( m_isUsingAutoName )
|
if ( dynamic_cast<RimEnsembleWellLogStatisticsCurve*>( curve.p() ) == nullptr )
|
||||||
{
|
{
|
||||||
legendTitle = m_autoGeneratedName();
|
// Look for a matching summary case
|
||||||
|
RimSummaryCase* summaryCase =
|
||||||
|
findMatchingSummaryCase( dynamic_cast<RimWellLogFileCurve*>( curve.p() ) );
|
||||||
|
if ( summaryCase )
|
||||||
|
{
|
||||||
|
summaryCases.push_back( summaryCase );
|
||||||
|
curvesToColor.push_back( curve.p() );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
legendTitle += m_userDefinedName();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
legendTitle += "\n";
|
// Get the colors
|
||||||
legendTitle += parameterName;
|
std::vector<cvf::Color3f> caseColors = m_ensembleCurveSet->generateColorsForCases( summaryCases );
|
||||||
|
|
||||||
m_legendConfig->setTitle( legendTitle );
|
// Apply the colors
|
||||||
|
if ( caseColors.size() != curvesToColor.size() ) return;
|
||||||
|
for ( size_t i = 0; i < curvesToColor.size(); i++ )
|
||||||
|
{
|
||||||
|
curvesToColor[i]->setColor( caseColors[i] );
|
||||||
|
curvesToColor[i]->updateCurveAppearance();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// if ( group && !parameterName.isEmpty() && !group->allSummaryCases().empty() )
|
|
||||||
// {
|
|
||||||
// auto ensembleParam = group->ensembleParameter( parameterName );
|
|
||||||
// if ( ensembleParam.isText() || ensembleParam.isNumeric() )
|
|
||||||
// {
|
|
||||||
// RimEnsembleCurveSetColorManager::initializeLegendConfig( m_legendConfig, ensembleParam );
|
|
||||||
// // for ( auto& curve : m_curves )
|
|
||||||
// // {
|
|
||||||
// // // if ( curve->summaryAddressY().category() ==
|
|
||||||
// // RifEclipseSummaryAddress::SUMMARY_ENSEMBLE_STATISTICS )
|
|
||||||
// // // continue;
|
|
||||||
// // // RimSummaryCase* rimCase = curve->summaryCaseY();
|
|
||||||
// // // cvf::Color3f curveColor =
|
|
||||||
// // // RimEnsembleWellLogCurveSetColorManager::caseColor( m_legendConfig, rimCase,
|
|
||||||
// ensembleParam
|
|
||||||
// // );
|
|
||||||
// // // curve->setColor( curveColor );
|
|
||||||
// // // curve->updateCurveAppearance();
|
|
||||||
// // }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
else if ( m_colorMode == ColorMode::SINGLE_COLOR )
|
else if ( m_colorMode == ColorMode::SINGLE_COLOR )
|
||||||
{
|
{
|
||||||
@@ -835,24 +740,24 @@ void RimEnsembleWellLogCurveSet::updateCurveColors()
|
|||||||
firstAncestorOrThisOfType( plotTrack );
|
firstAncestorOrThisOfType( plotTrack );
|
||||||
if ( plotTrack && plotTrack->viewer() )
|
if ( plotTrack && plotTrack->viewer() )
|
||||||
{
|
{
|
||||||
// if ( m_yValuesSummaryCaseCollection() && isCurvesVisible() && m_colorMode != ColorMode::SINGLE_COLOR &&
|
if ( m_colorMode != ColorMode::SINGLE_COLOR && m_ensembleCurveSet != nullptr &&
|
||||||
// m_legendConfig->showLegend() )
|
m_ensembleCurveSet->colorMode() != RimEnsembleCurveSet::ColorMode::SINGLE_COLOR )
|
||||||
// {
|
{
|
||||||
// if ( !m_legendOverlayFrame )
|
if ( !m_legendOverlayFrame )
|
||||||
// {
|
{
|
||||||
// m_legendOverlayFrame =
|
m_legendOverlayFrame =
|
||||||
// new RiuDraggableOverlayFrame( plot->viewer()->canvas(), plot->viewer()->overlayMargins() );
|
new RiuDraggableOverlayFrame( plotTrack->viewer()->canvas(), plotTrack->viewer()->overlayMargins() );
|
||||||
// }
|
}
|
||||||
// m_legendOverlayFrame->setContentFrame( m_legendConfig->makeLegendFrame() );
|
m_legendOverlayFrame->setContentFrame( m_ensembleCurveSet->legendConfig()->makeLegendFrame() );
|
||||||
// plot->viewer()->addOverlayFrame( m_legendOverlayFrame );
|
plotTrack->viewer()->addOverlayFrame( m_legendOverlayFrame );
|
||||||
// }
|
}
|
||||||
// else
|
else
|
||||||
// {
|
{
|
||||||
// if ( m_legendOverlayFrame )
|
if ( m_legendOverlayFrame )
|
||||||
// {
|
{
|
||||||
// plot->viewer()->removeOverlayFrame( m_legendOverlayFrame );
|
plotTrack->viewer()->removeOverlayFrame( m_legendOverlayFrame );
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
plotTrack->viewer()->scheduleReplot();
|
plotTrack->viewer()->scheduleReplot();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1001,6 +906,8 @@ void RimEnsembleWellLogCurveSet::updateStatisticsCurves( const std::vector<RimWe
|
|||||||
curve->updateCurveVisibility();
|
curve->updateCurveVisibility();
|
||||||
curve->loadDataAndUpdate( false );
|
curve->loadDataAndUpdate( false );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
updateCurveColors();
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -1014,12 +921,12 @@ void RimEnsembleWellLogCurveSet::updateStatisticsCurves()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
RimEnsembleWellLogCurveSet* RimEnsembleWellLogCurveSet::clone() const
|
// RimEnsembleWellLogCurveSet* RimEnsembleWellLogCurveSet::clone() const
|
||||||
{
|
// {
|
||||||
RimEnsembleWellLogCurveSet* copy = dynamic_cast<RimEnsembleWellLogCurveSet*>(
|
// RimEnsembleWellLogCurveSet* copy = dynamic_cast<RimEnsembleWellLogCurveSet*>(
|
||||||
this->xmlCapability()->copyByXmlSerialization( caf::PdmDefaultObjectFactory::instance() ) );
|
// this->xmlCapability()->copyByXmlSerialization( caf::PdmDefaultObjectFactory::instance() ) );
|
||||||
return copy;
|
// return copy;
|
||||||
}
|
// }
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
@@ -1035,45 +942,6 @@ void RimEnsembleWellLogCurveSet::showCurves( bool show )
|
|||||||
void RimEnsembleWellLogCurveSet::updateAllTextInPlot()
|
void RimEnsembleWellLogCurveSet::updateAllTextInPlot()
|
||||||
{
|
{
|
||||||
updateEnsembleLegendItem();
|
updateEnsembleLegendItem();
|
||||||
|
|
||||||
// RimWellLogTrack* summaryPlot = nullptr;
|
|
||||||
// this->firstAncestorOrThisOfTypeAsserted( summaryPlot );
|
|
||||||
// if ( summaryPlot->viewer() )
|
|
||||||
// {
|
|
||||||
// summaryPlot->u
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
std::vector<RigEnsembleParameter> RimEnsembleWellLogCurveSet::variationSortedEnsembleParameters() const
|
|
||||||
{
|
|
||||||
// RimSummaryCaseCollection* ensemble = m_yValuesSummaryCaseCollection;
|
|
||||||
// if ( ensemble )
|
|
||||||
// {
|
|
||||||
// return ensemble->variationSortedEnsembleParameters();
|
|
||||||
// }
|
|
||||||
// else
|
|
||||||
// {
|
|
||||||
return std::vector<RigEnsembleParameter>();
|
|
||||||
//}
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
std::vector<std::pair<RigEnsembleParameter, double>> RimEnsembleWellLogCurveSet::correlationSortedEnsembleParameters() const
|
|
||||||
{
|
|
||||||
// RimSummaryCaseCollection* ensemble = m_yValuesSummaryCaseCollection;
|
|
||||||
// if ( ensemble )
|
|
||||||
// {
|
|
||||||
// return ensemble->correlationSortedEnsembleParameters( summaryAddress() );
|
|
||||||
// }
|
|
||||||
// else
|
|
||||||
// {
|
|
||||||
return std::vector<std::pair<RigEnsembleParameter, double>>();
|
|
||||||
//}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -1219,7 +1087,7 @@ void RimEnsembleWellLogCurveSet::updateEnsembleLegendItem()
|
|||||||
symbol->setPen( curvePen );
|
symbol->setPen( curvePen );
|
||||||
symbol->setSize( 6, 6 );
|
symbol->setSize( 6, 6 );
|
||||||
}
|
}
|
||||||
else if ( m_colorMode == ColorMode::BY_ENSEMBLE_PARAM )
|
else if ( m_colorMode == ColorMode::COLOR_BY_ENSEMBLE_CURVE_SET )
|
||||||
{
|
{
|
||||||
QPixmap p = QPixmap( ":/Legend.png" );
|
QPixmap p = QPixmap( ":/Legend.png" );
|
||||||
|
|
||||||
@@ -1275,18 +1143,18 @@ QString RimEnsembleWellLogCurveSet::createAutoName() const
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimEnsembleWellLogCurveSet::updateLegendMappingMode()
|
void RimEnsembleWellLogCurveSet::connectEnsembleCurveSetFilterSignals()
|
||||||
{
|
{
|
||||||
switch ( currentEnsembleParameterType() )
|
if ( m_ensembleCurveSet() )
|
||||||
{
|
{
|
||||||
case RigEnsembleParameter::TYPE_TEXT:
|
m_ensembleCurveSet()->filterChanged.connect( this, &RimEnsembleWellLogCurveSet::onFilterSourceChanged );
|
||||||
if ( m_legendConfig->mappingMode() != RimRegularLegendConfig::MappingType::CATEGORY_INTEGER )
|
}
|
||||||
m_legendConfig->setMappingMode( RimRegularLegendConfig::MappingType::CATEGORY_INTEGER );
|
}
|
||||||
break;
|
|
||||||
|
|
||||||
case RigEnsembleParameter::TYPE_NUMERIC:
|
//--------------------------------------------------------------------------------------------------
|
||||||
if ( m_legendConfig->mappingMode() == RimRegularLegendConfig::MappingType::CATEGORY_INTEGER )
|
///
|
||||||
m_legendConfig->setMappingMode( RimRegularLegendConfig::MappingType::LINEAR_CONTINUOUS );
|
//--------------------------------------------------------------------------------------------------
|
||||||
break;
|
void RimEnsembleWellLogCurveSet::onFilterSourceChanged( const caf::SignalEmitter* emitter )
|
||||||
}
|
{
|
||||||
|
if ( m_ensembleCurveSet() ) loadDataAndUpdate( true );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,6 @@
|
|||||||
|
|
||||||
#include "RimEnsembleCurveSetColorManager.h"
|
#include "RimEnsembleCurveSetColorManager.h"
|
||||||
#include "RimEnsembleCurveSetInterface.h"
|
#include "RimEnsembleCurveSetInterface.h"
|
||||||
#include "RimRegularLegendConfig.h"
|
|
||||||
|
|
||||||
#include "RigEnsembleParameter.h"
|
#include "RigEnsembleParameter.h"
|
||||||
|
|
||||||
@@ -44,6 +43,7 @@ class RimEnsembleCurveFilterCollection;
|
|||||||
class RimEnsembleStatistics;
|
class RimEnsembleStatistics;
|
||||||
class RimEnsembleStatisticsCase;
|
class RimEnsembleStatisticsCase;
|
||||||
class RimWellLogCurve;
|
class RimWellLogCurve;
|
||||||
|
class RimWellLogFileCurve;
|
||||||
class RimWellLogFile;
|
class RimWellLogFile;
|
||||||
class RimEnsembleWellLogStatistics;
|
class RimEnsembleWellLogStatistics;
|
||||||
|
|
||||||
@@ -51,9 +51,6 @@ class RiuDraggableOverlayFrame;
|
|||||||
|
|
||||||
class QwtPlot;
|
class QwtPlot;
|
||||||
class QwtPlotCurve;
|
class QwtPlotCurve;
|
||||||
class QKeyEvent;
|
|
||||||
class QFrame;
|
|
||||||
class QDate;
|
|
||||||
|
|
||||||
//==================================================================================================
|
//==================================================================================================
|
||||||
///
|
///
|
||||||
@@ -63,10 +60,12 @@ class RimEnsembleWellLogCurveSet : public caf::PdmObject, public RimEnsembleCurv
|
|||||||
CAF_PDM_HEADER_INIT;
|
CAF_PDM_HEADER_INIT;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
using ColorMode = RimEnsembleCurveSetColorManager::ColorMode;
|
enum class ColorMode
|
||||||
using ColorModeEnum = RimEnsembleCurveSetColorManager::ColorModeEnum;
|
{
|
||||||
|
SINGLE_COLOR,
|
||||||
|
COLOR_BY_ENSEMBLE_CURVE_SET
|
||||||
|
};
|
||||||
|
|
||||||
public:
|
|
||||||
RimEnsembleWellLogCurveSet();
|
RimEnsembleWellLogCurveSet();
|
||||||
~RimEnsembleWellLogCurveSet() override;
|
~RimEnsembleWellLogCurveSet() override;
|
||||||
|
|
||||||
@@ -95,14 +94,8 @@ public:
|
|||||||
void setSummaryCaseCollection( RimSummaryCaseCollection* sumCaseCollection );
|
void setSummaryCaseCollection( RimSummaryCaseCollection* sumCaseCollection );
|
||||||
RimSummaryCaseCollection* summaryCaseCollection() const;
|
RimSummaryCaseCollection* summaryCaseCollection() const;
|
||||||
|
|
||||||
RimEnsembleCurveFilterCollection* filterCollection() const;
|
|
||||||
|
|
||||||
ColorMode colorMode() const;
|
ColorMode colorMode() const;
|
||||||
void setColorMode( ColorMode mode );
|
void setColorMode( ColorMode mode );
|
||||||
void setEnsembleParameter( const QString& parameterName );
|
|
||||||
RigEnsembleParameter::Type currentEnsembleParameterType() const;
|
|
||||||
|
|
||||||
RimRegularLegendConfig* legendConfig();
|
|
||||||
|
|
||||||
void updateEnsembleLegendItem();
|
void updateEnsembleLegendItem();
|
||||||
RiuDraggableOverlayFrame* legendFrame() const;
|
RiuDraggableOverlayFrame* legendFrame() const;
|
||||||
@@ -111,9 +104,6 @@ public:
|
|||||||
void showCurves( bool show );
|
void showCurves( bool show );
|
||||||
|
|
||||||
void updateAllTextInPlot();
|
void updateAllTextInPlot();
|
||||||
std::vector<RigEnsembleParameter> variationSortedEnsembleParameters() const;
|
|
||||||
|
|
||||||
std::vector<std::pair<RigEnsembleParameter, double>> correlationSortedEnsembleParameters() const;
|
|
||||||
|
|
||||||
std::vector<RimWellLogFile*> filterEnsembleCases( const std::vector<RimWellLogFile*>& sumCases );
|
std::vector<RimWellLogFile*> filterEnsembleCases( const std::vector<RimWellLogFile*>& sumCases );
|
||||||
void disableStatisticCurves();
|
void disableStatisticCurves();
|
||||||
@@ -156,6 +146,10 @@ private:
|
|||||||
void updateCurveColors();
|
void updateCurveColors();
|
||||||
|
|
||||||
bool isSameRealization( RimSummaryCase* summaryCase, RimWellLogFile* wellLogFile ) const;
|
bool isSameRealization( RimSummaryCase* summaryCase, RimWellLogFile* wellLogFile ) const;
|
||||||
|
RimSummaryCase* findMatchingSummaryCase( RimWellLogFileCurve* wellLogCurve ) const;
|
||||||
|
|
||||||
|
void connectEnsembleCurveSetFilterSignals();
|
||||||
|
void onFilterSourceChanged( const caf::SignalEmitter* emitter );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
caf::PdmField<bool> m_showCurves;
|
caf::PdmField<bool> m_showCurves;
|
||||||
@@ -163,12 +157,9 @@ private:
|
|||||||
caf::PdmPtrArrayField<RimWellLogCurve*> m_curves;
|
caf::PdmPtrArrayField<RimWellLogCurve*> m_curves;
|
||||||
caf::PdmPointer<RimWellLogCurve> m_currentWellLogCurve;
|
caf::PdmPointer<RimWellLogCurve> m_currentWellLogCurve;
|
||||||
|
|
||||||
caf::PdmField<ColorModeEnum> m_colorMode;
|
caf::PdmField<caf::AppEnum<ColorMode>> m_colorMode;
|
||||||
caf::PdmField<cvf::Color3f> m_color;
|
caf::PdmField<cvf::Color3f> m_color;
|
||||||
caf::PdmField<QString> m_ensembleParameter;
|
|
||||||
|
|
||||||
caf::PdmChildField<RimRegularLegendConfig*> m_legendConfig;
|
|
||||||
caf::PdmChildField<RimEnsembleCurveFilterCollection*> m_curveFilters;
|
|
||||||
caf::PdmChildField<RimEnsembleStatistics*> m_statistics;
|
caf::PdmChildField<RimEnsembleStatistics*> m_statistics;
|
||||||
|
|
||||||
caf::PdmField<bool> m_isUsingAutoName;
|
caf::PdmField<bool> m_isUsingAutoName;
|
||||||
|
|||||||
@@ -1436,100 +1436,28 @@ ObjectiveFunctionTimeConfig RimEnsembleCurveSet::objectiveFunctionTimeConfig() c
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimEnsembleCurveSet::updateCurveColors()
|
void RimEnsembleCurveSet::updateLegendTitle()
|
||||||
{
|
{
|
||||||
if ( m_colorMode == ColorMode::BY_ENSEMBLE_PARAM )
|
if ( m_colorMode == ColorMode::BY_ENSEMBLE_PARAM )
|
||||||
{
|
{
|
||||||
RimSummaryCaseCollection* group = m_yValuesSummaryCaseCollection();
|
|
||||||
|
|
||||||
QString parameterName = m_ensembleParameter();
|
QString parameterName = m_ensembleParameter();
|
||||||
|
|
||||||
{
|
|
||||||
QString legendTitle = "Ensemble Parameter";
|
QString legendTitle = "Ensemble Parameter";
|
||||||
legendTitle += "\n";
|
legendTitle += "\n";
|
||||||
legendTitle += parameterName;
|
legendTitle += parameterName;
|
||||||
|
|
||||||
m_legendConfig->setTitle( legendTitle );
|
m_legendConfig->setTitle( legendTitle );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( group && !parameterName.isEmpty() && !group->allSummaryCases().empty() )
|
|
||||||
{
|
|
||||||
auto ensembleParam = group->ensembleParameter( parameterName );
|
|
||||||
if ( ensembleParam.isText() || ensembleParam.isNumeric() )
|
|
||||||
{
|
|
||||||
RimEnsembleCurveSetColorManager::initializeLegendConfig( m_legendConfig, ensembleParam );
|
|
||||||
for ( auto& curve : m_curves )
|
|
||||||
{
|
|
||||||
if ( curve->summaryAddressY().category() == RifEclipseSummaryAddress::SUMMARY_ENSEMBLE_STATISTICS )
|
|
||||||
continue;
|
|
||||||
RimSummaryCase* rimCase = curve->summaryCaseY();
|
|
||||||
cvf::Color3f curveColor =
|
|
||||||
RimEnsembleCurveSetColorManager::caseColor( m_legendConfig, rimCase, ensembleParam );
|
|
||||||
curve->setColor( curveColor );
|
|
||||||
curve->updateCurveAppearance();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if ( m_colorMode == ColorMode::SINGLE_COLOR )
|
|
||||||
{
|
|
||||||
for ( auto& curve : m_curves )
|
|
||||||
{
|
|
||||||
if ( curve->summaryAddressY().category() == RifEclipseSummaryAddress::SUMMARY_ENSEMBLE_STATISTICS )
|
|
||||||
continue;
|
|
||||||
|
|
||||||
curve->setColor( m_color );
|
|
||||||
curve->updateCurveAppearance();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if ( m_colorMode == ColorMode::BY_OBJECTIVE_FUNCTION )
|
else if ( m_colorMode == ColorMode::BY_OBJECTIVE_FUNCTION )
|
||||||
{
|
|
||||||
RimSummaryCaseCollection* group = m_yValuesSummaryCaseCollection();
|
|
||||||
|
|
||||||
{
|
{
|
||||||
QString legendTitle = "Objective Function";
|
QString legendTitle = "Objective Function";
|
||||||
|
|
||||||
legendTitle += "\n";
|
legendTitle += "\n";
|
||||||
legendTitle +=
|
legendTitle += caf::AppEnum<RimObjectiveFunction::FunctionType>( m_objectiveFunction()->functionType() ).uiText();
|
||||||
caf::AppEnum<RimObjectiveFunction::FunctionType>( m_objectiveFunction()->functionType() ).uiText();
|
|
||||||
|
|
||||||
m_legendConfig->setTitle( legendTitle );
|
m_legendConfig->setTitle( legendTitle );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( group && !group->allSummaryCases().empty() )
|
|
||||||
{
|
|
||||||
auto objectiveFunction = m_objectiveFunction();
|
|
||||||
std::vector<RifEclipseSummaryAddress> summaryAddresses;
|
|
||||||
for ( auto address : m_objectiveValuesSummaryAddresses() )
|
|
||||||
{
|
|
||||||
summaryAddresses.push_back( address->address() );
|
|
||||||
}
|
|
||||||
{
|
|
||||||
RimEnsembleCurveSetColorManager::initializeLegendConfig( m_legendConfig,
|
|
||||||
objectiveFunction,
|
|
||||||
group->allSummaryCases(),
|
|
||||||
summaryAddresses,
|
|
||||||
objectiveFunctionTimeConfig() );
|
|
||||||
for ( auto& curve : m_curves )
|
|
||||||
{
|
|
||||||
if ( curve->summaryAddressY().category() == RifEclipseSummaryAddress::SUMMARY_ENSEMBLE_STATISTICS )
|
|
||||||
continue;
|
|
||||||
RimSummaryCase* rimCase = curve->summaryCaseY();
|
|
||||||
cvf::Color3f curveColor = RimEnsembleCurveSetColorManager::caseColor( m_legendConfig,
|
|
||||||
rimCase,
|
|
||||||
objectiveFunction,
|
|
||||||
summaryAddresses,
|
|
||||||
objectiveFunctionTimeConfig() );
|
|
||||||
curve->setColor( curveColor );
|
|
||||||
curve->updateCurveAppearance();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if ( m_colorMode == ColorMode::BY_CUSTOM_OBJECTIVE_FUNCTION )
|
else if ( m_colorMode == ColorMode::BY_CUSTOM_OBJECTIVE_FUNCTION )
|
||||||
{
|
|
||||||
RimSummaryCaseCollection* group = m_yValuesSummaryCaseCollection();
|
|
||||||
|
|
||||||
{
|
{
|
||||||
QString legendTitle = "Custom\nObjective Function";
|
QString legendTitle = "Custom\nObjective Function";
|
||||||
legendTitle += "\n";
|
legendTitle += "\n";
|
||||||
@@ -1550,24 +1478,117 @@ void RimEnsembleCurveSet::updateCurveColors()
|
|||||||
|
|
||||||
m_legendConfig->setTitle( legendTitle );
|
m_legendConfig->setTitle( legendTitle );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
std::vector<cvf::Color3f> RimEnsembleCurveSet::generateColorsForCases( const std::vector<RimSummaryCase*>& summaryCases ) const
|
||||||
|
{
|
||||||
|
std::vector<cvf::Color3f> caseColors;
|
||||||
|
|
||||||
|
if ( m_colorMode == ColorMode::BY_ENSEMBLE_PARAM )
|
||||||
|
{
|
||||||
|
RimSummaryCaseCollection* group = m_yValuesSummaryCaseCollection();
|
||||||
|
|
||||||
|
QString parameterName = m_ensembleParameter();
|
||||||
|
|
||||||
|
if ( group && !parameterName.isEmpty() && !group->allSummaryCases().empty() )
|
||||||
|
{
|
||||||
|
auto ensembleParam = group->ensembleParameter( parameterName );
|
||||||
|
if ( ensembleParam.isText() || ensembleParam.isNumeric() )
|
||||||
|
{
|
||||||
|
RimEnsembleCurveSetColorManager::initializeLegendConfig( m_legendConfig, ensembleParam );
|
||||||
|
for ( auto& rimCase : summaryCases )
|
||||||
|
{
|
||||||
|
caseColors.push_back(
|
||||||
|
RimEnsembleCurveSetColorManager::caseColor( m_legendConfig, rimCase, ensembleParam ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if ( m_colorMode == ColorMode::SINGLE_COLOR )
|
||||||
|
{
|
||||||
|
caseColors.resize( summaryCases.size(), m_color );
|
||||||
|
}
|
||||||
|
else if ( m_colorMode == ColorMode::BY_OBJECTIVE_FUNCTION )
|
||||||
|
{
|
||||||
|
RimSummaryCaseCollection* group = m_yValuesSummaryCaseCollection();
|
||||||
|
|
||||||
|
if ( group && !group->allSummaryCases().empty() )
|
||||||
|
{
|
||||||
|
auto objectiveFunction = m_objectiveFunction();
|
||||||
|
std::vector<RifEclipseSummaryAddress> summaryAddresses;
|
||||||
|
for ( auto address : m_objectiveValuesSummaryAddresses() )
|
||||||
|
{
|
||||||
|
summaryAddresses.push_back( address->address() );
|
||||||
|
}
|
||||||
|
|
||||||
|
RimEnsembleCurveSetColorManager::initializeLegendConfig( m_legendConfig,
|
||||||
|
objectiveFunction,
|
||||||
|
group->allSummaryCases(),
|
||||||
|
summaryAddresses,
|
||||||
|
objectiveFunctionTimeConfig() );
|
||||||
|
for ( auto& rimCase : summaryCases )
|
||||||
|
{
|
||||||
|
cvf::Color3f curveColor = RimEnsembleCurveSetColorManager::caseColor( m_legendConfig,
|
||||||
|
rimCase,
|
||||||
|
objectiveFunction,
|
||||||
|
summaryAddresses,
|
||||||
|
objectiveFunctionTimeConfig() );
|
||||||
|
caseColors.push_back( curveColor );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if ( m_colorMode == ColorMode::BY_CUSTOM_OBJECTIVE_FUNCTION )
|
||||||
|
{
|
||||||
|
RimSummaryCaseCollection* group = m_yValuesSummaryCaseCollection();
|
||||||
|
|
||||||
if ( group && !group->allSummaryCases().empty() && m_customObjectiveFunction() &&
|
if ( group && !group->allSummaryCases().empty() && m_customObjectiveFunction() &&
|
||||||
m_customObjectiveFunction->isValid() )
|
m_customObjectiveFunction->isValid() )
|
||||||
{
|
{
|
||||||
RimEnsembleCurveSetColorManager::initializeLegendConfig( m_legendConfig, m_customObjectiveFunction() );
|
RimEnsembleCurveSetColorManager::initializeLegendConfig( m_legendConfig, m_customObjectiveFunction() );
|
||||||
for ( auto& curve : m_curves )
|
for ( auto& rimCase : summaryCases )
|
||||||
{
|
{
|
||||||
if ( curve->summaryAddressY().category() == RifEclipseSummaryAddress::SUMMARY_ENSEMBLE_STATISTICS )
|
|
||||||
continue;
|
|
||||||
RimSummaryCase* rimCase = curve->summaryCaseY();
|
|
||||||
cvf::Color3f curveColor =
|
cvf::Color3f curveColor =
|
||||||
RimEnsembleCurveSetColorManager::caseColor( m_legendConfig, rimCase, m_customObjectiveFunction() );
|
RimEnsembleCurveSetColorManager::caseColor( m_legendConfig, rimCase, m_customObjectiveFunction() );
|
||||||
curve->setColor( curveColor );
|
caseColors.push_back( curveColor );
|
||||||
curve->updateCurveAppearance();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return caseColors;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimEnsembleCurveSet::updateCurveColors()
|
||||||
|
{
|
||||||
|
updateLegendTitle();
|
||||||
|
|
||||||
|
// Fint the curves to color (skip the statistics)
|
||||||
|
std::vector<RimSummaryCurve*> curvesToColor;
|
||||||
|
std::vector<RimSummaryCase*> summaryCases;
|
||||||
|
for ( auto& curve : m_curves )
|
||||||
|
{
|
||||||
|
if ( curve->summaryAddressY().category() == RifEclipseSummaryAddress::SUMMARY_ENSEMBLE_STATISTICS ) continue;
|
||||||
|
|
||||||
|
curvesToColor.push_back( curve );
|
||||||
|
summaryCases.push_back( curve->summaryCaseY() );
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get the colors
|
||||||
|
std::vector<cvf::Color3f> caseColors = generateColorsForCases( summaryCases );
|
||||||
|
|
||||||
|
// Apply the colors
|
||||||
|
if ( caseColors.size() != curvesToColor.size() ) return;
|
||||||
|
for ( size_t i = 0; i < curvesToColor.size(); i++ )
|
||||||
|
{
|
||||||
|
curvesToColor[i]->setColor( caseColors[i] );
|
||||||
|
curvesToColor[i]->updateCurveAppearance();
|
||||||
|
}
|
||||||
|
|
||||||
RimSummaryPlot* plot;
|
RimSummaryPlot* plot;
|
||||||
firstAncestorOrThisOfType( plot );
|
firstAncestorOrThisOfType( plot );
|
||||||
if ( plot && plot->viewer() )
|
if ( plot && plot->viewer() )
|
||||||
|
|||||||
@@ -162,6 +162,8 @@ public:
|
|||||||
|
|
||||||
ObjectiveFunctionTimeConfig objectiveFunctionTimeConfig() const;
|
ObjectiveFunctionTimeConfig objectiveFunctionTimeConfig() const;
|
||||||
|
|
||||||
|
std::vector<cvf::Color3f> generateColorsForCases( const std::vector<RimSummaryCase*>& summaryCases ) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void updateEnsembleCurves( const std::vector<RimSummaryCase*>& sumCases );
|
void updateEnsembleCurves( const std::vector<RimSummaryCase*>& sumCases );
|
||||||
void updateStatisticsCurves( const std::vector<RimSummaryCase*>& sumCases );
|
void updateStatisticsCurves( const std::vector<RimSummaryCase*>& sumCases );
|
||||||
@@ -189,6 +191,8 @@ private:
|
|||||||
QString createAutoName() const;
|
QString createAutoName() const;
|
||||||
|
|
||||||
void updateLegendMappingMode();
|
void updateLegendMappingMode();
|
||||||
|
void updateLegendTitle();
|
||||||
|
|
||||||
void updateMaxMinAndDefaultValues();
|
void updateMaxMinAndDefaultValues();
|
||||||
void updateCurveColors();
|
void updateCurveColors();
|
||||||
void updateTimeAnnotations();
|
void updateTimeAnnotations();
|
||||||
|
|||||||
Reference in New Issue
Block a user