2018-03-27 01:51:14 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// Copyright (C) 2017- Statoil ASA
|
2019-09-06 03:40:57 -05:00
|
|
|
//
|
2018-03-27 01:51:14 -05:00
|
|
|
// 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.
|
2019-09-06 03:40:57 -05:00
|
|
|
//
|
2018-03-27 01:51:14 -05:00
|
|
|
// 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.
|
2019-09-06 03:40:57 -05:00
|
|
|
//
|
|
|
|
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
2018-03-27 01:51:14 -05:00
|
|
|
// for more details.
|
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2018-04-19 07:00:00 -05:00
|
|
|
#include "RimEnsembleCurveSet.h"
|
2018-03-27 01:51:14 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
#include "RiaGuiApplication.h"
|
2018-06-26 01:48:58 -05:00
|
|
|
#include "RiaStatisticsTools.h"
|
2019-12-18 05:25:19 -06:00
|
|
|
#include "RiuAbstractLegendFrame.h"
|
2018-03-27 01:51:14 -05:00
|
|
|
|
2020-02-18 06:36:07 -06:00
|
|
|
#include "SummaryPlotCommands/RicSummaryPlotEditorUi.h"
|
2018-05-31 03:23:51 -05:00
|
|
|
|
2018-06-07 03:50:32 -05:00
|
|
|
#include "RifEnsembleStatisticsReader.h"
|
2018-03-27 01:51:14 -05:00
|
|
|
#include "RifReaderEclipseSummary.h"
|
|
|
|
|
2018-06-07 03:02:54 -05:00
|
|
|
#include "RigStatisticsMath.h"
|
|
|
|
|
2018-06-25 08:14:47 -05:00
|
|
|
#include "RimDerivedEnsembleCaseCollection.h"
|
2018-05-31 03:23:51 -05:00
|
|
|
#include "RimEnsembleCurveFilter.h"
|
|
|
|
#include "RimEnsembleCurveFilterCollection.h"
|
2018-04-27 06:07:33 -05:00
|
|
|
#include "RimEnsembleCurveSetCollection.h"
|
2018-05-11 01:01:10 -05:00
|
|
|
#include "RimEnsembleCurveSetColorManager.h"
|
2018-06-07 03:02:54 -05:00
|
|
|
#include "RimEnsembleStatistics.h"
|
2018-06-07 03:50:32 -05:00
|
|
|
#include "RimEnsembleStatisticsCase.h"
|
2018-03-27 01:51:14 -05:00
|
|
|
#include "RimProject.h"
|
2018-04-20 03:17:02 -05:00
|
|
|
#include "RimRegularLegendConfig.h"
|
2018-04-27 06:07:33 -05:00
|
|
|
#include "RimSummaryAddress.h"
|
2018-03-27 01:51:14 -05:00
|
|
|
#include "RimSummaryCase.h"
|
2018-04-06 01:16:14 -05:00
|
|
|
#include "RimSummaryCaseCollection.h"
|
2018-03-27 01:51:14 -05:00
|
|
|
#include "RimSummaryCurve.h"
|
2018-04-27 06:07:33 -05:00
|
|
|
#include "RimSummaryCurveAutoName.h"
|
2018-04-06 01:16:14 -05:00
|
|
|
#include "RimSummaryFilter.h"
|
2018-04-27 06:07:33 -05:00
|
|
|
#include "RimSummaryPlot.h"
|
2018-03-27 01:51:14 -05:00
|
|
|
|
2019-12-02 07:05:41 -06:00
|
|
|
#include "RiuCvfOverlayItemWidget.h"
|
2019-12-18 05:25:19 -06:00
|
|
|
#include "RiuDraggableOverlayFrame.h"
|
2018-05-11 06:24:46 -05:00
|
|
|
#include "RiuPlotMainWindow.h"
|
2019-09-06 03:40:57 -05:00
|
|
|
#include "RiuQwtPlotCurve.h"
|
2019-02-25 07:54:36 -06:00
|
|
|
#include "RiuSummaryQwtPlot.h"
|
2020-02-18 07:00:11 -06:00
|
|
|
#include "RiuSummaryVectorSelectionDialog.h"
|
2018-03-27 01:51:14 -05:00
|
|
|
|
2018-04-06 01:16:14 -05:00
|
|
|
#include "cafPdmObject.h"
|
2019-10-09 02:21:28 -05:00
|
|
|
#include "cafPdmUiLineEditor.h"
|
2019-09-06 03:40:57 -05:00
|
|
|
#include "cafPdmUiListEditor.h"
|
2018-04-06 01:16:14 -05:00
|
|
|
#include "cafPdmUiPushButtonEditor.h"
|
2019-09-06 03:40:57 -05:00
|
|
|
#include "cafPdmUiTreeOrdering.h"
|
2019-12-02 07:05:41 -06:00
|
|
|
#include "cafTitledOverlayFrame.h"
|
2018-03-27 01:51:14 -05:00
|
|
|
|
2018-04-20 03:17:02 -05:00
|
|
|
#include "cvfScalarMapper.h"
|
2018-04-06 04:30:48 -05:00
|
|
|
|
2018-05-03 07:50:35 -05:00
|
|
|
#include "qwt_plot_curve.h"
|
|
|
|
#include "qwt_symbol.h"
|
|
|
|
|
2018-05-31 03:23:51 -05:00
|
|
|
#include <algorithm>
|
2018-04-06 01:16:14 -05:00
|
|
|
|
2018-05-04 06:06:48 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
/// Internal constants
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
#define DOUBLE_INF std::numeric_limits<double>::infinity()
|
2018-05-04 06:06:48 -05:00
|
|
|
|
2018-06-27 04:24:07 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
/// Internal functions
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
RiuQwtSymbol::PointSymbolEnum statisticsCurveSymbolFromAddress( const RifEclipseSummaryAddress& address );
|
|
|
|
int statisticsCurveSymbolSize( RiuQwtSymbol::PointSymbolEnum symbol );
|
2018-06-27 04:24:07 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
CAF_PDM_SOURCE_INIT( RimEnsembleCurveSet, "RimEnsembleCurveSet" );
|
2018-03-27 01:51:14 -05:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2018-03-27 01:51:14 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-04-19 07:00:00 -05:00
|
|
|
RimEnsembleCurveSet::RimEnsembleCurveSet()
|
2018-03-27 01:51:14 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
CAF_PDM_InitObject( "Ensemble Curve Set", ":/EnsembleCurveSet16x16.png", "", "" );
|
2018-03-27 01:51:14 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
CAF_PDM_InitFieldNoDefault( &m_curves, "EnsembleCurveSet", "Ensemble Curve Set", "", "", "" );
|
|
|
|
m_curves.uiCapability()->setUiHidden( true );
|
|
|
|
m_curves.uiCapability()->setUiTreeChildrenHidden( false );
|
2018-03-27 01:51:14 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
CAF_PDM_InitField( &m_showCurves, "IsActive", true, "Show Curves", "", "", "" );
|
|
|
|
m_showCurves.uiCapability()->setUiHidden( true );
|
2018-03-27 01:51:14 -05:00
|
|
|
|
2018-04-06 01:16:14 -05:00
|
|
|
// Y Values
|
2019-09-23 07:04:23 -05:00
|
|
|
CAF_PDM_InitFieldNoDefault( &m_yValuesSummaryCaseCollection, "SummaryGroup", "Ensemble", "", "", "" );
|
|
|
|
m_yValuesSummaryCaseCollection.uiCapability()->setUiTreeChildrenHidden( true );
|
|
|
|
m_yValuesSummaryCaseCollection.uiCapability()->setAutoAddingOptionFromValue( false );
|
2018-04-06 01:16:14 -05:00
|
|
|
|
2019-09-23 07:04:23 -05:00
|
|
|
CAF_PDM_InitFieldNoDefault( &m_yValuesSummaryAddressUiField, "SelectedVariableDisplayVar", "Vector", "", "", "" );
|
|
|
|
m_yValuesSummaryAddressUiField.xmlCapability()->disableIO();
|
2019-10-09 02:21:28 -05:00
|
|
|
m_yValuesSummaryAddressUiField.uiCapability()->setUiEditorTypeName( caf::PdmUiLineEditor::uiEditorTypeName() );
|
2018-04-06 01:16:14 -05:00
|
|
|
|
2019-09-23 07:04:23 -05:00
|
|
|
CAF_PDM_InitFieldNoDefault( &m_yValuesSummaryAddress, "SummaryAddress", "Summary Address", "", "", "" );
|
|
|
|
m_yValuesSummaryAddress.uiCapability()->setUiHidden( true );
|
|
|
|
m_yValuesSummaryAddress.uiCapability()->setUiTreeChildrenHidden( true );
|
|
|
|
m_yValuesSummaryAddress = new RimSummaryAddress;
|
2018-04-06 01:16:14 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
CAF_PDM_InitFieldNoDefault( &m_yPushButtonSelectSummaryAddress, "SelectAddress", "", "", "", "" );
|
|
|
|
caf::PdmUiPushButtonEditor::configureEditorForField( &m_yPushButtonSelectSummaryAddress );
|
2019-10-09 02:21:28 -05:00
|
|
|
m_yPushButtonSelectSummaryAddress.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN );
|
2018-04-06 01:16:14 -05:00
|
|
|
m_yPushButtonSelectSummaryAddress = false;
|
|
|
|
|
2020-02-12 04:43:15 -06:00
|
|
|
CAF_PDM_InitField( &m_colorMode, "ColorMode", caf::AppEnum<ColorMode>( ColorMode::SINGLE_COLOR ), "Coloring Mode", "", "", "" );
|
2018-04-06 01:16:14 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
CAF_PDM_InitField( &m_color, "Color", cvf::Color3f( cvf::Color3::BLACK ), "Color", "", "", "" );
|
2018-04-06 01:16:14 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
CAF_PDM_InitField( &m_ensembleParameter, "EnsembleParameter", QString( "" ), "Ensemble Parameter", "", "", "" );
|
|
|
|
m_ensembleParameter.uiCapability()->setUiEditorTypeName( caf::PdmUiListEditor::uiEditorTypeName() );
|
2018-04-06 04:30:48 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
CAF_PDM_InitFieldNoDefault( &m_plotAxis, "PlotAxis", "Axis", "", "", "" );
|
2018-04-18 14:38:50 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
CAF_PDM_InitFieldNoDefault( &m_legendConfig, "LegendConfig", "", "", "", "" );
|
2018-04-18 03:10:39 -05:00
|
|
|
m_legendConfig = new RimRegularLegendConfig();
|
2020-05-23 03:57:09 -05:00
|
|
|
m_legendConfig->setColorLegend(
|
|
|
|
RimRegularLegendConfig::mapToColorLegend( RimEnsembleCurveSetColorManager::DEFAULT_ENSEMBLE_COLOR_RANGE ) );
|
2018-04-27 06:07:33 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
CAF_PDM_InitFieldNoDefault( &m_curveFilters, "CurveFilters", "Curve Filters", "", "", "" );
|
2018-05-31 03:23:51 -05:00
|
|
|
m_curveFilters = new RimEnsembleCurveFilterCollection();
|
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
CAF_PDM_InitFieldNoDefault( &m_statistics, "Statistics", "Statistics", "", "", "" );
|
2018-06-07 03:02:54 -05:00
|
|
|
m_statistics = new RimEnsembleStatistics();
|
2019-09-06 03:40:57 -05:00
|
|
|
m_statistics.uiCapability()->setUiTreeHidden( true );
|
2018-06-07 03:02:54 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
CAF_PDM_InitField( &m_userDefinedName, "UserDefinedName", QString( "Ensemble Curve Set" ), "Curve Set Name", "", "", "" );
|
2018-04-27 06:07:33 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
CAF_PDM_InitFieldNoDefault( &m_autoGeneratedName, "AutoGeneratedName", "Curve Set Name", "", "", "" );
|
|
|
|
m_autoGeneratedName.registerGetMethod( this, &RimEnsembleCurveSet::createAutoName );
|
|
|
|
m_autoGeneratedName.uiCapability()->setUiReadOnly( true );
|
2018-04-27 06:07:33 -05:00
|
|
|
m_autoGeneratedName.xmlCapability()->disableIO();
|
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
CAF_PDM_InitField( &m_isUsingAutoName, "AutoName", true, "Auto Name", "", "", "" );
|
|
|
|
CAF_PDM_InitFieldNoDefault( &m_summaryAddressNameTools, "SummaryAddressNameTools", "SummaryAddressNameTools", "", "", "" );
|
|
|
|
m_summaryAddressNameTools.uiCapability()->setUiHidden( true );
|
|
|
|
m_summaryAddressNameTools.uiCapability()->setUiTreeChildrenHidden( true );
|
2018-04-27 06:07:33 -05:00
|
|
|
|
|
|
|
m_summaryAddressNameTools = new RimSummaryCurveAutoName;
|
2019-09-06 03:40:57 -05:00
|
|
|
|
2018-05-03 07:50:35 -05:00
|
|
|
m_qwtPlotCurveForLegendText = new QwtPlotCurve;
|
2019-09-06 03:40:57 -05:00
|
|
|
m_qwtPlotCurveForLegendText->setLegendAttribute( QwtPlotCurve::LegendShowSymbol, true );
|
2018-06-07 03:02:54 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
m_ensembleStatCase.reset( new RimEnsembleStatisticsCase( this ) );
|
2018-06-07 03:02:54 -05:00
|
|
|
m_ensembleStatCase->createSummaryReaderInterface();
|
2019-08-20 08:09:13 -05:00
|
|
|
m_ensembleStatCase->createRftReaderInterface();
|
2018-06-15 03:54:30 -05:00
|
|
|
|
|
|
|
m_disableStatisticCurves = false;
|
2019-09-06 03:40:57 -05:00
|
|
|
m_isCurveSetFiltered = false;
|
2019-09-23 06:42:25 -05:00
|
|
|
|
|
|
|
// Obsolete fields
|
|
|
|
|
2019-09-23 06:56:40 -05:00
|
|
|
CAF_PDM_InitFieldNoDefault( &m_yValuesSummaryFilter_OBSOLETE, "VarListFilter", "Filter", "", "", "" );
|
|
|
|
m_yValuesSummaryFilter_OBSOLETE.uiCapability()->setUiTreeChildrenHidden( true );
|
|
|
|
m_yValuesSummaryFilter_OBSOLETE.uiCapability()->setUiHidden( true );
|
2019-10-09 02:21:28 -05:00
|
|
|
m_yValuesSummaryFilter_OBSOLETE.xmlCapability()->setIOWritable( false );
|
2019-09-23 06:56:40 -05:00
|
|
|
m_yValuesSummaryFilter_OBSOLETE = new RimSummaryFilter_OBSOLETE;
|
2020-05-18 09:02:27 -05:00
|
|
|
|
|
|
|
setDeletable( true );
|
2018-03-27 01:51:14 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2018-03-27 01:51:14 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-04-19 07:00:00 -05:00
|
|
|
RimEnsembleCurveSet::~RimEnsembleCurveSet()
|
2018-03-27 01:51:14 -05:00
|
|
|
{
|
|
|
|
m_curves.deleteAllChildObjects();
|
2018-04-18 08:58:49 -05:00
|
|
|
|
|
|
|
RimSummaryPlot* parentPlot;
|
2019-09-06 03:40:57 -05:00
|
|
|
firstAncestorOrThisOfType( parentPlot );
|
2019-10-11 08:54:19 -05:00
|
|
|
if ( parentPlot && parentPlot->viewer() )
|
2018-04-18 08:58:49 -05:00
|
|
|
{
|
2018-05-11 13:21:44 -05:00
|
|
|
m_qwtPlotCurveForLegendText->detach();
|
2020-01-03 00:09:35 -06:00
|
|
|
if ( m_legendOverlayFrame )
|
|
|
|
{
|
|
|
|
parentPlot->viewer()->removeOverlayFrame( m_legendOverlayFrame );
|
|
|
|
}
|
2019-12-02 07:05:41 -06:00
|
|
|
}
|
|
|
|
if ( m_legendOverlayFrame )
|
|
|
|
{
|
|
|
|
m_legendOverlayFrame->setParent( nullptr );
|
|
|
|
delete m_legendOverlayFrame;
|
2018-04-18 08:58:49 -05:00
|
|
|
}
|
2018-05-11 13:21:44 -05:00
|
|
|
|
|
|
|
delete m_qwtPlotCurveForLegendText;
|
2018-03-27 01:51:14 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2018-03-27 01:51:14 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-04-19 07:00:00 -05:00
|
|
|
bool RimEnsembleCurveSet::isCurvesVisible()
|
2018-03-27 01:51:14 -05:00
|
|
|
{
|
2018-04-19 07:00:00 -05:00
|
|
|
RimEnsembleCurveSetCollection* coll = nullptr;
|
2019-09-06 03:40:57 -05:00
|
|
|
firstAncestorOrThisOfType( coll );
|
|
|
|
return m_showCurves() && ( coll ? coll->isCurveSetsVisible() : true );
|
2018-03-27 01:51:14 -05:00
|
|
|
}
|
|
|
|
|
2018-04-18 01:32:16 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2018-04-18 01:32:16 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
void RimEnsembleCurveSet::setColor( cvf::Color3f color )
|
2018-04-18 01:32:16 -05:00
|
|
|
{
|
|
|
|
m_color = color;
|
|
|
|
}
|
|
|
|
|
2018-03-27 01:51:14 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2018-03-27 01:51:14 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
void RimEnsembleCurveSet::loadDataAndUpdate( bool updateParentPlot )
|
2018-03-27 01:51:14 -05:00
|
|
|
{
|
2019-10-09 02:21:28 -05:00
|
|
|
m_yValuesSummaryAddressUiField = m_yValuesSummaryAddress->address();
|
2018-04-20 03:17:02 -05:00
|
|
|
|
2018-05-08 03:17:05 -05:00
|
|
|
updateAllCurves();
|
2018-06-01 08:37:47 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( updateParentPlot )
|
2018-06-01 08:37:47 -05:00
|
|
|
{
|
|
|
|
RimSummaryPlot* parentPlot;
|
2019-09-06 03:40:57 -05:00
|
|
|
firstAncestorOrThisOfTypeAsserted( parentPlot );
|
2018-06-01 08:37:47 -05:00
|
|
|
parentPlot->updateAll();
|
|
|
|
}
|
2018-06-07 06:41:45 -05:00
|
|
|
|
|
|
|
m_curveFilters->loadDataAndUpdate();
|
2018-03-27 01:51:14 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2018-03-27 01:51:14 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
void RimEnsembleCurveSet::setParentQwtPlotNoReplot( QwtPlot* plot )
|
2018-03-27 01:51:14 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
for ( RimSummaryCurve* curve : m_curves )
|
2018-03-27 01:51:14 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
curve->setParentQwtPlotNoReplot( plot );
|
2018-03-27 01:51:14 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2018-03-27 01:51:14 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-04-19 07:00:00 -05:00
|
|
|
void RimEnsembleCurveSet::detachQwtCurves()
|
2018-03-27 01:51:14 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
for ( RimSummaryCurve* curve : m_curves )
|
2018-03-27 01:51:14 -05:00
|
|
|
{
|
|
|
|
curve->detachQwtCurve();
|
|
|
|
}
|
2018-05-03 07:50:35 -05:00
|
|
|
|
|
|
|
m_qwtPlotCurveForLegendText->detach();
|
2018-03-27 01:51:14 -05:00
|
|
|
}
|
|
|
|
|
2018-09-07 07:26:14 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimEnsembleCurveSet::reattachQwtCurves()
|
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
for ( RimSummaryCurve* curve : m_curves )
|
2018-09-07 07:26:14 -05:00
|
|
|
{
|
|
|
|
curve->reattachQwtCurve();
|
|
|
|
}
|
|
|
|
|
|
|
|
m_qwtPlotCurveForLegendText->detach();
|
|
|
|
|
|
|
|
RimSummaryPlot* plot = nullptr;
|
2019-09-06 03:40:57 -05:00
|
|
|
firstAncestorOrThisOfType( plot );
|
|
|
|
if ( plot )
|
2018-09-07 07:26:14 -05:00
|
|
|
{
|
2019-10-11 08:54:19 -05:00
|
|
|
m_qwtPlotCurveForLegendText->attach( plot->viewer() );
|
2018-09-07 07:26:14 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-03-27 01:51:14 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2018-03-27 01:51:14 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
void RimEnsembleCurveSet::addCurve( RimSummaryCurve* curve )
|
2018-03-27 01:51:14 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( curve )
|
2018-03-27 01:51:14 -05:00
|
|
|
{
|
2018-04-18 01:32:16 -05:00
|
|
|
RimSummaryPlot* plot;
|
2019-09-06 03:40:57 -05:00
|
|
|
firstAncestorOrThisOfType( plot );
|
2019-10-11 08:54:19 -05:00
|
|
|
if ( plot ) curve->setParentQwtPlotNoReplot( plot->viewer() );
|
2018-04-18 01:32:16 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
curve->setColor( m_color );
|
|
|
|
m_curves.push_back( curve );
|
2018-03-27 01:51:14 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2018-03-27 01:51:14 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
void RimEnsembleCurveSet::deleteCurve( RimSummaryCurve* curve )
|
2018-03-27 01:51:14 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( curve )
|
2018-03-27 01:51:14 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
m_curves.removeChildObject( curve );
|
2018-09-13 05:38:17 -05:00
|
|
|
curve->markCachedDataForPurge();
|
2018-03-27 01:51:14 -05:00
|
|
|
delete curve;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-05-10 14:29:55 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2018-05-10 14:29:55 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
void RimEnsembleCurveSet::setSummaryAddress( RifEclipseSummaryAddress address )
|
2018-05-10 14:29:55 -05:00
|
|
|
{
|
2019-09-23 07:04:23 -05:00
|
|
|
m_yValuesSummaryAddress->setAddress( address );
|
2018-05-10 14:29:55 -05:00
|
|
|
}
|
|
|
|
|
2018-04-29 23:48:22 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2018-04-29 23:48:22 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
RifEclipseSummaryAddress RimEnsembleCurveSet::summaryAddress() const
|
|
|
|
{
|
2019-09-23 07:04:23 -05:00
|
|
|
return m_yValuesSummaryAddress->address();
|
2018-04-29 23:48:22 -05:00
|
|
|
}
|
|
|
|
|
2018-03-27 01:51:14 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2018-03-27 01:51:14 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-04-19 07:00:00 -05:00
|
|
|
std::vector<RimSummaryCurve*> RimEnsembleCurveSet::curves() const
|
2018-03-27 01:51:14 -05:00
|
|
|
{
|
|
|
|
return m_curves.childObjects();
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2018-03-27 01:51:14 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-06-07 03:02:54 -05:00
|
|
|
void RimEnsembleCurveSet::deleteEnsembleCurves()
|
2018-03-27 01:51:14 -05:00
|
|
|
{
|
2018-06-07 03:50:32 -05:00
|
|
|
std::vector<size_t> curvesIndexesToDelete;
|
2019-09-06 03:40:57 -05:00
|
|
|
for ( size_t c = 0; c < m_curves.size(); c++ )
|
2018-06-07 03:02:54 -05:00
|
|
|
{
|
|
|
|
RimSummaryCurve* curve = m_curves[c];
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( curve->summaryAddressY().category() != RifEclipseSummaryAddress::SUMMARY_ENSEMBLE_STATISTICS )
|
|
|
|
curvesIndexesToDelete.push_back( c );
|
2018-06-07 03:02:54 -05:00
|
|
|
}
|
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
while ( curvesIndexesToDelete.size() > 0 )
|
2018-06-07 03:02:54 -05:00
|
|
|
{
|
2018-06-07 03:50:32 -05:00
|
|
|
size_t currIndex = curvesIndexesToDelete.back();
|
2018-06-07 03:02:54 -05:00
|
|
|
delete m_curves[currIndex];
|
2019-09-06 03:40:57 -05:00
|
|
|
m_curves.erase( currIndex );
|
2018-06-07 03:02:54 -05:00
|
|
|
curvesIndexesToDelete.pop_back();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2018-06-07 03:02:54 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimEnsembleCurveSet::deleteStatisticsCurves()
|
|
|
|
{
|
2018-06-07 03:50:32 -05:00
|
|
|
std::vector<size_t> curvesIndexesToDelete;
|
2019-09-06 03:40:57 -05:00
|
|
|
for ( size_t c = 0; c < m_curves.size(); c++ )
|
2018-06-07 03:02:54 -05:00
|
|
|
{
|
|
|
|
RimSummaryCurve* curve = m_curves[c];
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( curve->summaryAddressY().category() == RifEclipseSummaryAddress::SUMMARY_ENSEMBLE_STATISTICS )
|
|
|
|
curvesIndexesToDelete.push_back( c );
|
2018-06-07 03:02:54 -05:00
|
|
|
}
|
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
while ( curvesIndexesToDelete.size() > 0 )
|
2018-06-07 03:02:54 -05:00
|
|
|
{
|
2018-06-07 03:50:32 -05:00
|
|
|
size_t currIndex = curvesIndexesToDelete.back();
|
2018-06-07 03:02:54 -05:00
|
|
|
delete m_curves[currIndex];
|
2019-09-06 03:40:57 -05:00
|
|
|
m_curves.erase( currIndex );
|
2018-06-07 03:02:54 -05:00
|
|
|
curvesIndexesToDelete.pop_back();
|
|
|
|
}
|
2018-03-27 01:51:14 -05:00
|
|
|
}
|
|
|
|
|
2018-04-06 01:16:14 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2018-04-06 01:16:14 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-04-19 07:00:00 -05:00
|
|
|
RimRegularLegendConfig* RimEnsembleCurveSet::legendConfig()
|
2018-04-18 08:58:49 -05:00
|
|
|
{
|
|
|
|
return m_legendConfig;
|
|
|
|
}
|
|
|
|
|
2019-12-02 07:05:41 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-12-18 05:25:19 -06:00
|
|
|
RiuDraggableOverlayFrame* RimEnsembleCurveSet::legendFrame() const
|
2019-12-02 07:05:41 -06:00
|
|
|
{
|
|
|
|
return m_legendOverlayFrame;
|
|
|
|
}
|
|
|
|
|
2018-04-20 03:17:02 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2018-04-20 03:17:02 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimEnsembleCurveSet::onLegendDefinitionChanged()
|
|
|
|
{
|
|
|
|
updateCurveColors();
|
|
|
|
}
|
|
|
|
|
2018-04-29 23:48:22 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2018-04-29 23:48:22 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
void RimEnsembleCurveSet::setSummaryCaseCollection( RimSummaryCaseCollection* sumCaseCollection )
|
2018-04-29 23:48:22 -05:00
|
|
|
{
|
2019-09-23 07:04:23 -05:00
|
|
|
m_yValuesSummaryCaseCollection = sumCaseCollection;
|
2018-04-29 23:48:22 -05:00
|
|
|
}
|
|
|
|
|
2018-04-27 06:36:23 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2018-04-27 06:36:23 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
RimSummaryCaseCollection* RimEnsembleCurveSet::summaryCaseCollection() const
|
|
|
|
{
|
2019-09-23 07:04:23 -05:00
|
|
|
return m_yValuesSummaryCaseCollection();
|
2018-04-27 06:36:23 -05:00
|
|
|
}
|
|
|
|
|
2018-06-18 04:54:04 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2018-06-18 04:54:04 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
RimEnsembleCurveFilterCollection* RimEnsembleCurveSet::filterCollection() const
|
|
|
|
{
|
|
|
|
return m_curveFilters;
|
|
|
|
}
|
|
|
|
|
2018-05-02 07:59:38 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2018-05-02 07:59:38 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
RimEnsembleCurveSet::ColorMode RimEnsembleCurveSet::colorMode() const
|
|
|
|
{
|
|
|
|
return m_colorMode();
|
|
|
|
}
|
|
|
|
|
2019-08-20 08:40:40 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2019-08-20 08:40:40 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
void RimEnsembleCurveSet::setColorMode( ColorMode mode )
|
2019-08-20 08:40:40 -05:00
|
|
|
{
|
|
|
|
m_colorMode = mode;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2019-08-20 08:40:40 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
void RimEnsembleCurveSet::setEnsembleParameter( const QString& parameterName )
|
2019-08-20 08:40:40 -05:00
|
|
|
{
|
|
|
|
m_ensembleParameter = parameterName;
|
|
|
|
}
|
|
|
|
|
2018-05-03 02:53:25 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2018-05-03 02:53:25 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-05-31 03:23:51 -05:00
|
|
|
EnsembleParameter::Type RimEnsembleCurveSet::currentEnsembleParameterType() const
|
2018-05-03 02:53:25 -05:00
|
|
|
{
|
2019-12-02 07:05:41 -06:00
|
|
|
if ( m_colorMode() == ColorMode::BY_ENSEMBLE_PARAM )
|
2018-05-03 02:53:25 -05:00
|
|
|
{
|
2019-09-23 07:04:23 -05:00
|
|
|
RimSummaryCaseCollection* group = m_yValuesSummaryCaseCollection();
|
2019-09-06 03:40:57 -05:00
|
|
|
QString parameterName = m_ensembleParameter();
|
2018-05-03 02:53:25 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( group && !parameterName.isEmpty() )
|
2018-05-03 02:53:25 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
auto eParam = group->ensembleParameter( parameterName );
|
2018-05-31 03:23:51 -05:00
|
|
|
return eParam.type;
|
2018-05-03 02:53:25 -05:00
|
|
|
}
|
|
|
|
}
|
2018-05-31 03:23:51 -05:00
|
|
|
return EnsembleParameter::TYPE_NONE;
|
2018-05-03 02:53:25 -05:00
|
|
|
}
|
|
|
|
|
2018-06-13 06:35:33 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2018-06-13 06:35:33 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimEnsembleCurveSet::updateAllCurves()
|
|
|
|
{
|
2019-09-23 07:04:23 -05:00
|
|
|
RimSummaryCaseCollection* group = m_yValuesSummaryCaseCollection();
|
|
|
|
RimSummaryAddress* addr = m_yValuesSummaryAddress();
|
2018-06-29 05:34:56 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( group && addr->address().category() != RifEclipseSummaryAddress::SUMMARY_INVALID )
|
2018-06-29 05:34:56 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
std::vector<RimSummaryCase*> allCases = group->allSummaryCases();
|
|
|
|
std::vector<RimSummaryCase*> filteredCases = filterEnsembleCases( allCases );
|
2018-06-29 05:34:56 -05:00
|
|
|
|
|
|
|
m_isCurveSetFiltered = filteredCases.size() < allCases.size();
|
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
updateEnsembleCurves( filteredCases );
|
|
|
|
updateStatisticsCurves( m_statistics->basedOnFilteredCases() ? filteredCases : allCases );
|
2018-06-29 05:34:56 -05:00
|
|
|
}
|
2018-06-13 06:35:33 -05:00
|
|
|
}
|
|
|
|
|
2018-04-18 08:58:49 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2018-04-18 08:58:49 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
void RimEnsembleCurveSet::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
|
|
|
const QVariant& oldValue,
|
|
|
|
const QVariant& newValue )
|
2018-04-06 01:16:14 -05:00
|
|
|
{
|
2018-04-18 14:38:50 -05:00
|
|
|
RimSummaryPlot* plot = nullptr;
|
2019-09-06 03:40:57 -05:00
|
|
|
firstAncestorOrThisOfType( plot );
|
|
|
|
CVF_ASSERT( plot );
|
2018-04-18 14:38:50 -05:00
|
|
|
|
2018-05-11 12:29:03 -05:00
|
|
|
bool updateTextInPlot = false;
|
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( changedField == &m_showCurves )
|
2018-03-27 01:51:14 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
loadDataAndUpdate( true );
|
2018-05-02 05:06:36 -05:00
|
|
|
|
|
|
|
updateConnectedEditors();
|
|
|
|
|
|
|
|
RimSummaryPlot* summaryPlot = nullptr;
|
2019-09-06 03:40:57 -05:00
|
|
|
this->firstAncestorOrThisOfTypeAsserted( summaryPlot );
|
2018-05-02 05:06:36 -05:00
|
|
|
summaryPlot->updateConnectedEditors();
|
2018-05-11 12:29:03 -05:00
|
|
|
|
|
|
|
updateTextInPlot = true;
|
2018-04-06 01:16:14 -05:00
|
|
|
}
|
2019-09-23 07:04:23 -05:00
|
|
|
else if ( changedField == &m_yValuesSummaryAddressUiField )
|
2018-04-06 01:16:14 -05:00
|
|
|
{
|
2019-09-23 07:04:23 -05:00
|
|
|
m_yValuesSummaryAddress->setAddress( m_yValuesSummaryAddressUiField() );
|
2018-04-06 01:16:14 -05:00
|
|
|
|
2018-04-19 01:29:58 -05:00
|
|
|
updateAllCurves();
|
2019-09-06 03:40:57 -05:00
|
|
|
|
2018-05-11 12:29:03 -05:00
|
|
|
updateTextInPlot = true;
|
2018-04-18 14:38:50 -05:00
|
|
|
}
|
2019-09-23 07:04:23 -05:00
|
|
|
else if ( changedField == &m_yValuesSummaryCaseCollection )
|
2018-04-18 14:38:50 -05:00
|
|
|
{
|
2018-04-20 03:17:02 -05:00
|
|
|
// Empty address cache
|
2019-09-06 03:40:57 -05:00
|
|
|
// m_allAddressesCache.clear();
|
2018-04-19 01:29:58 -05:00
|
|
|
updateAllCurves();
|
2018-06-07 03:02:54 -05:00
|
|
|
|
2018-05-11 12:29:03 -05:00
|
|
|
updateTextInPlot = true;
|
2018-04-06 01:16:14 -05:00
|
|
|
}
|
2019-09-06 03:40:57 -05:00
|
|
|
else if ( changedField == &m_color )
|
2018-05-03 02:53:25 -05:00
|
|
|
{
|
|
|
|
updateCurveColors();
|
2019-09-06 03:40:57 -05:00
|
|
|
|
2018-05-11 12:29:03 -05:00
|
|
|
updateTextInPlot = true;
|
2018-05-03 02:53:25 -05:00
|
|
|
}
|
2019-09-06 03:40:57 -05:00
|
|
|
else if ( changedField == &m_ensembleParameter )
|
2018-04-06 01:16:14 -05:00
|
|
|
{
|
2018-05-03 02:53:25 -05:00
|
|
|
updateLegendMappingMode();
|
2018-04-18 01:32:16 -05:00
|
|
|
updateCurveColors();
|
2018-04-06 01:16:14 -05:00
|
|
|
}
|
2019-09-06 03:40:57 -05:00
|
|
|
else if ( changedField == &m_colorMode )
|
2018-04-20 06:25:46 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( m_ensembleParameter().isEmpty() )
|
2018-04-20 06:25:46 -05:00
|
|
|
{
|
2020-03-20 05:22:14 -05:00
|
|
|
auto params = variationSortedEnsembleParameters();
|
|
|
|
m_ensembleParameter = !params.empty() ? params.front().name : "";
|
2018-04-20 06:25:46 -05:00
|
|
|
}
|
|
|
|
updateCurveColors();
|
2019-09-06 03:40:57 -05:00
|
|
|
|
2018-05-11 15:23:06 -05:00
|
|
|
updateTextInPlot = true;
|
2018-04-20 06:25:46 -05:00
|
|
|
}
|
2019-09-06 03:40:57 -05:00
|
|
|
else if ( changedField == &m_plotAxis )
|
2018-04-18 14:38:50 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
for ( RimSummaryCurve* curve : curves() )
|
2018-04-18 14:38:50 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
curve->setLeftOrRightAxisY( m_plotAxis() );
|
2018-04-18 14:38:50 -05:00
|
|
|
}
|
2019-09-06 03:40:57 -05:00
|
|
|
|
2018-04-18 14:38:50 -05:00
|
|
|
updateQwtPlotAxis();
|
|
|
|
plot->updateAxes();
|
2019-09-06 03:40:57 -05:00
|
|
|
|
2018-05-11 12:29:03 -05:00
|
|
|
updateTextInPlot = true;
|
2018-04-18 14:38:50 -05:00
|
|
|
}
|
2019-09-06 03:40:57 -05:00
|
|
|
else if ( changedField == &m_isUsingAutoName )
|
2018-04-27 06:07:33 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( !m_isUsingAutoName )
|
2018-05-11 12:29:03 -05:00
|
|
|
{
|
|
|
|
m_userDefinedName = createAutoName();
|
|
|
|
}
|
|
|
|
|
|
|
|
updateTextInPlot = true;
|
2018-04-27 06:07:33 -05:00
|
|
|
}
|
2019-09-06 03:40:57 -05:00
|
|
|
else if ( changedField == &m_userDefinedName )
|
2018-05-11 12:44:01 -05:00
|
|
|
{
|
|
|
|
updateTextInPlot = true;
|
|
|
|
}
|
2019-09-06 03:40:57 -05:00
|
|
|
else if ( changedField == &m_yPushButtonSelectSummaryAddress )
|
2018-05-11 06:24:46 -05:00
|
|
|
{
|
2020-02-18 07:00:11 -06:00
|
|
|
RiuSummaryVectorSelectionDialog dlg( nullptr );
|
|
|
|
RimSummaryCaseCollection* candidateEnsemble = m_yValuesSummaryCaseCollection();
|
|
|
|
RifEclipseSummaryAddress candicateAddress = m_yValuesSummaryAddress->address();
|
2018-05-11 06:24:46 -05:00
|
|
|
|
|
|
|
dlg.hideSummaryCases();
|
2019-09-06 03:40:57 -05:00
|
|
|
dlg.setEnsembleAndAddress( candidateEnsemble, candicateAddress );
|
2018-05-11 06:24:46 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( dlg.exec() == QDialog::Accepted )
|
2018-05-11 06:24:46 -05:00
|
|
|
{
|
|
|
|
auto curveSelection = dlg.curveSelection();
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( !curveSelection.empty() )
|
2018-05-11 06:24:46 -05:00
|
|
|
{
|
2019-09-23 07:04:23 -05:00
|
|
|
m_yValuesSummaryCaseCollection = curveSelection[0].ensemble();
|
|
|
|
m_yValuesSummaryAddress->setAddress( curveSelection[0].summaryAddress() );
|
2018-05-11 06:24:46 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
this->loadDataAndUpdate( true );
|
2018-05-11 06:24:46 -05:00
|
|
|
|
|
|
|
plot->updateAxes();
|
|
|
|
plot->updatePlotTitle();
|
|
|
|
plot->updateConnectedEditors();
|
|
|
|
|
2019-05-06 03:36:05 -05:00
|
|
|
RiuPlotMainWindow* mainPlotWindow = RiaGuiApplication::instance()->mainPlotWindow();
|
2018-05-11 06:24:46 -05:00
|
|
|
mainPlotWindow->updateSummaryPlotToolBar();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
m_yPushButtonSelectSummaryAddress = false;
|
|
|
|
}
|
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( updateTextInPlot )
|
2018-05-03 07:50:35 -05:00
|
|
|
{
|
2018-05-11 12:44:01 -05:00
|
|
|
updateAllTextInPlot();
|
2018-05-03 07:50:35 -05:00
|
|
|
}
|
2018-04-06 01:16:14 -05:00
|
|
|
}
|
2018-03-27 01:51:14 -05:00
|
|
|
|
2018-04-06 01:16:14 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-05-03 07:50:35 -05:00
|
|
|
///
|
2018-04-06 01:16:14 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
void RimEnsembleCurveSet::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
2018-04-06 01:16:14 -05:00
|
|
|
{
|
2018-03-27 01:51:14 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
caf::PdmUiGroup* curveDataGroup = uiOrdering.addNewGroup( "Summary Vector Y" );
|
2019-09-23 07:04:23 -05:00
|
|
|
curveDataGroup->add( &m_yValuesSummaryCaseCollection );
|
|
|
|
curveDataGroup->add( &m_yValuesSummaryAddressUiField );
|
2020-05-22 06:11:33 -05:00
|
|
|
curveDataGroup->add( &m_yPushButtonSelectSummaryAddress, {false, 1, 0} );
|
2019-09-06 03:40:57 -05:00
|
|
|
curveDataGroup->add( &m_plotAxis );
|
2019-10-09 02:21:28 -05:00
|
|
|
}
|
2018-03-27 01:51:14 -05:00
|
|
|
|
2019-10-29 07:40:52 -05:00
|
|
|
appendColorGroup( uiOrdering );
|
2018-04-26 04:48:12 -05:00
|
|
|
|
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
caf::PdmUiGroup* nameGroup = uiOrdering.addNewGroup( "Curve Name" );
|
|
|
|
nameGroup->setCollapsedByDefault( true );
|
|
|
|
nameGroup->add( &m_isUsingAutoName );
|
|
|
|
if ( m_isUsingAutoName )
|
2018-04-29 23:48:22 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
nameGroup->add( &m_autoGeneratedName );
|
|
|
|
m_summaryAddressNameTools->uiOrdering( uiConfigName, *nameGroup );
|
2018-04-29 23:48:22 -05:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
nameGroup->add( &m_userDefinedName );
|
2018-04-29 23:48:22 -05:00
|
|
|
}
|
2018-04-26 04:48:12 -05:00
|
|
|
}
|
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
caf::PdmUiGroup* statGroup = uiOrdering.addNewGroup( "Statistics" );
|
|
|
|
m_statistics->defineUiOrdering( uiConfigName, *statGroup );
|
2018-06-18 04:54:04 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
uiOrdering.skipRemainingFields( true );
|
2018-03-27 01:51:14 -05:00
|
|
|
}
|
|
|
|
|
2019-10-29 07:40:52 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimEnsembleCurveSet::appendColorGroup( caf::PdmUiOrdering& uiOrdering )
|
|
|
|
{
|
|
|
|
caf::PdmUiGroup* colorsGroup = uiOrdering.addNewGroup( "Colors" );
|
|
|
|
m_colorMode.uiCapability()->setUiReadOnly( !m_yValuesSummaryCaseCollection() );
|
|
|
|
colorsGroup->add( &m_colorMode );
|
|
|
|
|
2019-12-02 07:05:41 -06:00
|
|
|
if ( m_colorMode == ColorMode::SINGLE_COLOR )
|
2019-10-29 07:40:52 -05:00
|
|
|
{
|
|
|
|
colorsGroup->add( &m_color );
|
|
|
|
}
|
2019-12-02 07:05:41 -06:00
|
|
|
else if ( m_colorMode == ColorMode::BY_ENSEMBLE_PARAM )
|
2019-10-29 07:40:52 -05:00
|
|
|
{
|
|
|
|
m_ensembleParameter.uiCapability()->setUiReadOnly( !m_yValuesSummaryCaseCollection() );
|
|
|
|
colorsGroup->add( &m_ensembleParameter );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-04-06 04:30:48 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2018-04-06 04:30:48 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
void RimEnsembleCurveSet::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName /*= ""*/ )
|
2018-04-06 04:30:48 -05:00
|
|
|
{
|
2019-12-02 07:05:41 -06:00
|
|
|
if ( m_colorMode == ColorMode::BY_ENSEMBLE_PARAM )
|
2018-04-20 03:17:02 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
uiTreeOrdering.add( m_legendConfig() );
|
2018-04-20 03:17:02 -05:00
|
|
|
}
|
2018-05-31 03:23:51 -05:00
|
|
|
|
2020-02-18 06:36:07 -06:00
|
|
|
if ( uiConfigName != RicSummaryPlotEditorUi::CONFIGURATION_NAME )
|
2018-05-31 03:23:51 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
uiTreeOrdering.add( m_curveFilters );
|
2018-05-31 03:23:51 -05:00
|
|
|
}
|
2018-06-15 03:54:30 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
uiTreeOrdering.skipRemainingChildren( true );
|
2018-12-17 09:01:15 -06:00
|
|
|
|
2020-05-09 04:25:11 -05:00
|
|
|
caf::IconProvider iconProvider = this->uiIconProvider();
|
|
|
|
if ( !iconProvider.valid() ) return;
|
2019-05-06 03:36:05 -05:00
|
|
|
|
2018-12-17 09:01:15 -06:00
|
|
|
RimEnsembleCurveSetCollection* coll = nullptr;
|
2019-09-06 03:40:57 -05:00
|
|
|
this->firstAncestorOrThisOfType( coll );
|
|
|
|
if ( coll && coll->curveSetForSourceStepping() == this )
|
2018-12-17 09:01:15 -06:00
|
|
|
{
|
2020-05-09 04:25:11 -05:00
|
|
|
iconProvider.setOverlayResourceString( ":/StepUpDownCorner16x16.png" );
|
2018-12-17 09:01:15 -06:00
|
|
|
}
|
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
this->setUiIcon( iconProvider );
|
2018-04-06 04:30:48 -05:00
|
|
|
}
|
|
|
|
|
2018-03-27 01:51:14 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2018-03-27 01:51:14 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-04-27 06:07:33 -05:00
|
|
|
caf::PdmFieldHandle* RimEnsembleCurveSet::userDescriptionField()
|
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( m_isUsingAutoName )
|
2018-04-27 06:07:33 -05:00
|
|
|
{
|
|
|
|
return &m_autoGeneratedName;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return &m_userDefinedName;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-04-19 07:00:00 -05:00
|
|
|
caf::PdmFieldHandle* RimEnsembleCurveSet::objectToggleField()
|
2018-03-27 01:51:14 -05:00
|
|
|
{
|
2018-04-06 01:16:14 -05:00
|
|
|
return &m_showCurves;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2018-04-06 01:16:14 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
void RimEnsembleCurveSet::defineEditorAttribute( const caf::PdmFieldHandle* field,
|
|
|
|
QString uiConfigName,
|
|
|
|
caf::PdmUiEditorAttribute* attribute )
|
2018-04-06 01:16:14 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
caf::PdmUiPushButtonEditorAttribute* attrib = dynamic_cast<caf::PdmUiPushButtonEditorAttribute*>( attribute );
|
|
|
|
if ( attrib )
|
2018-03-27 01:51:14 -05:00
|
|
|
{
|
2019-09-23 06:42:25 -05:00
|
|
|
attrib->m_buttonText = "...";
|
2018-03-27 01:51:14 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2018-03-27 01:51:14 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
QList<caf::PdmOptionItemInfo> RimEnsembleCurveSet::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
|
|
|
|
bool* useOptionsOnly )
|
2018-03-27 01:51:14 -05:00
|
|
|
{
|
2018-04-06 01:16:14 -05:00
|
|
|
QList<caf::PdmOptionItemInfo> options;
|
2018-03-27 01:51:14 -05:00
|
|
|
|
2019-09-23 07:04:23 -05:00
|
|
|
if ( fieldNeedingOptions == &m_yValuesSummaryCaseCollection )
|
2018-03-27 01:51:14 -05:00
|
|
|
{
|
2020-05-12 02:50:38 -05:00
|
|
|
RimProject* proj = RimProject::current();
|
2018-04-06 01:16:14 -05:00
|
|
|
std::vector<RimSummaryCaseCollection*> groups = proj->summaryGroups();
|
2018-03-27 01:51:14 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
for ( RimSummaryCaseCollection* group : groups )
|
2018-04-06 01:16:14 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( group->isEnsemble() ) options.push_back( caf::PdmOptionItemInfo( group->name(), group ) );
|
2018-03-27 01:51:14 -05:00
|
|
|
}
|
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
options.push_front( caf::PdmOptionItemInfo( "None", nullptr ) );
|
2018-04-06 01:16:14 -05:00
|
|
|
}
|
2019-09-06 03:40:57 -05:00
|
|
|
else if ( fieldNeedingOptions == &m_colorMode )
|
2018-04-06 01:16:14 -05:00
|
|
|
{
|
2019-12-02 07:05:41 -06:00
|
|
|
auto singleColorOption = ColorModeEnum( ColorMode::SINGLE_COLOR );
|
|
|
|
auto byEnsParamOption = ColorModeEnum( ColorMode::BY_ENSEMBLE_PARAM );
|
2018-03-27 01:51:14 -05:00
|
|
|
|
2019-12-02 08:26:24 -06:00
|
|
|
options.push_back( caf::PdmOptionItemInfo( singleColorOption.uiText(), ColorMode::SINGLE_COLOR ) );
|
2020-08-27 06:07:04 -05:00
|
|
|
if ( !correlationSortedEnsembleParameters().empty() )
|
2018-05-03 04:03:43 -05:00
|
|
|
{
|
2019-12-02 08:26:24 -06:00
|
|
|
options.push_back( caf::PdmOptionItemInfo( byEnsParamOption.uiText(), ColorMode::BY_ENSEMBLE_PARAM ) );
|
2018-05-03 04:03:43 -05:00
|
|
|
}
|
|
|
|
}
|
2019-09-06 03:40:57 -05:00
|
|
|
else if ( fieldNeedingOptions == &m_ensembleParameter )
|
2018-05-03 04:03:43 -05:00
|
|
|
{
|
2020-08-27 06:07:04 -05:00
|
|
|
auto params = correlationSortedEnsembleParameters();
|
|
|
|
for ( const auto& paramCorrPair : params )
|
2018-03-27 01:51:14 -05:00
|
|
|
{
|
2020-08-27 06:07:04 -05:00
|
|
|
QString name = paramCorrPair.first.name;
|
|
|
|
double corr = paramCorrPair.second;
|
|
|
|
options.push_back(
|
2020-09-07 02:14:13 -05:00
|
|
|
caf::PdmOptionItemInfo( QString( "%1 (Avg. correlation: %2)" ).arg( name ).arg( corr, 5, 'f', 2 ), name ) );
|
2018-03-27 01:51:14 -05:00
|
|
|
}
|
|
|
|
}
|
2019-09-23 07:04:23 -05:00
|
|
|
else if ( fieldNeedingOptions == &m_yValuesSummaryAddressUiField )
|
2018-04-18 14:38:50 -05:00
|
|
|
{
|
2019-09-23 07:04:23 -05:00
|
|
|
appendOptionItemsForSummaryAddresses( &options, m_yValuesSummaryCaseCollection() );
|
2018-04-18 14:38:50 -05:00
|
|
|
}
|
2018-04-06 01:16:14 -05:00
|
|
|
|
|
|
|
return options;
|
2018-03-27 01:51:14 -05:00
|
|
|
}
|
|
|
|
|
2018-04-18 14:38:50 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-04-19 01:29:58 -05:00
|
|
|
/// Optimization candidate
|
2018-04-18 14:38:50 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
void RimEnsembleCurveSet::appendOptionItemsForSummaryAddresses( QList<caf::PdmOptionItemInfo>* options,
|
2019-10-09 02:21:28 -05:00
|
|
|
RimSummaryCaseCollection* summaryCaseGroup )
|
2018-04-18 14:38:50 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( !summaryCaseGroup ) return;
|
2018-04-19 02:18:09 -05:00
|
|
|
|
2018-06-14 03:18:09 -05:00
|
|
|
std::set<RifEclipseSummaryAddress> addrSet;
|
2019-09-06 03:40:57 -05:00
|
|
|
for ( RimSummaryCase* summaryCase : summaryCaseGroup->allSummaryCases() )
|
2018-04-18 14:38:50 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
RifSummaryReaderInterface* reader = summaryCase->summaryReader();
|
|
|
|
const std::set<RifEclipseSummaryAddress>& addrs = reader ? reader->allResultAddresses()
|
|
|
|
: std::set<RifEclipseSummaryAddress>();
|
2018-06-14 03:18:09 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
for ( auto& addr : addrs )
|
2018-04-20 03:17:02 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
addrSet.insert( addr );
|
2018-04-20 03:17:02 -05:00
|
|
|
}
|
2018-04-19 01:29:58 -05:00
|
|
|
}
|
2018-04-18 14:38:50 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
for ( auto& addr : addrSet )
|
2018-04-19 01:29:58 -05:00
|
|
|
{
|
2018-06-14 03:18:09 -05:00
|
|
|
std::string name = addr.uiText();
|
2019-09-06 03:40:57 -05:00
|
|
|
QString s = QString::fromStdString( name );
|
|
|
|
options->push_back( caf::PdmOptionItemInfo( s, QVariant::fromValue( addr ) ) );
|
2018-04-18 14:38:50 -05:00
|
|
|
}
|
2018-04-19 01:29:58 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
options->push_front( caf::PdmOptionItemInfo( RiaDefines::undefinedResultName(),
|
|
|
|
QVariant::fromValue( RifEclipseSummaryAddress() ) ) );
|
2018-04-18 14:38:50 -05:00
|
|
|
}
|
|
|
|
|
2018-04-18 01:32:16 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2018-04-18 01:32:16 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-04-19 07:00:00 -05:00
|
|
|
void RimEnsembleCurveSet::updateCurveColors()
|
2018-04-18 01:32:16 -05:00
|
|
|
{
|
2019-12-02 07:05:41 -06:00
|
|
|
if ( m_colorMode == ColorMode::BY_ENSEMBLE_PARAM )
|
2018-04-18 01:32:16 -05:00
|
|
|
{
|
2019-09-23 07:04:23 -05:00
|
|
|
RimSummaryCaseCollection* group = m_yValuesSummaryCaseCollection();
|
2019-09-06 03:40:57 -05:00
|
|
|
|
2018-04-19 07:00:00 -05:00
|
|
|
QString parameterName = m_ensembleParameter();
|
2018-05-02 08:14:17 -05:00
|
|
|
|
|
|
|
{
|
|
|
|
QString legendTitle;
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( m_isUsingAutoName )
|
2018-05-02 08:14:17 -05:00
|
|
|
{
|
|
|
|
legendTitle = m_autoGeneratedName();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
legendTitle += m_userDefinedName();
|
|
|
|
}
|
|
|
|
|
|
|
|
legendTitle += "\n";
|
|
|
|
legendTitle += parameterName;
|
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
m_legendConfig->setTitle( legendTitle );
|
2018-05-02 08:14:17 -05:00
|
|
|
}
|
2018-04-20 11:34:36 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( group && !parameterName.isEmpty() && !group->allSummaryCases().empty() )
|
2018-04-18 01:32:16 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
auto ensembleParam = group->ensembleParameter( parameterName );
|
2019-12-02 08:26:24 -06:00
|
|
|
if ( ensembleParam.isText() || ensembleParam.isNumeric() )
|
2018-04-18 01:32:16 -05:00
|
|
|
{
|
2019-12-02 08:26:24 -06:00
|
|
|
RimEnsembleCurveSetColorManager::initializeLegendConfig( m_legendConfig, ensembleParam );
|
2019-09-06 03:40:57 -05:00
|
|
|
for ( auto& curve : m_curves )
|
2018-05-03 02:53:25 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( curve->summaryAddressY().category() == RifEclipseSummaryAddress::SUMMARY_ENSEMBLE_STATISTICS )
|
|
|
|
continue;
|
2020-02-12 04:43:15 -06:00
|
|
|
RimSummaryCase* rimCase = curve->summaryCaseY();
|
|
|
|
cvf::Color3f curveColor =
|
|
|
|
RimEnsembleCurveSetColorManager::caseColor( m_legendConfig, rimCase, ensembleParam );
|
2019-12-02 08:26:24 -06:00
|
|
|
curve->setColor( curveColor );
|
2018-05-03 02:53:25 -05:00
|
|
|
curve->updateCurveAppearance();
|
|
|
|
}
|
2018-04-18 01:32:16 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-12-02 07:05:41 -06:00
|
|
|
else if ( m_colorMode == ColorMode::SINGLE_COLOR )
|
2018-04-18 01:32:16 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
for ( auto& curve : m_curves )
|
2018-04-18 01:32:16 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( curve->summaryAddressY().category() == RifEclipseSummaryAddress::SUMMARY_ENSEMBLE_STATISTICS )
|
|
|
|
continue;
|
2018-06-15 09:21:32 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
curve->setColor( m_color );
|
2018-04-18 01:32:16 -05:00
|
|
|
curve->updateCurveAppearance();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
RimSummaryPlot* plot;
|
2019-09-06 03:40:57 -05:00
|
|
|
firstAncestorOrThisOfType( plot );
|
2019-10-11 08:54:19 -05:00
|
|
|
if ( plot && plot->viewer() )
|
2018-04-20 03:17:02 -05:00
|
|
|
{
|
2019-12-02 07:05:41 -06:00
|
|
|
if ( m_yValuesSummaryCaseCollection() && isCurvesVisible() && m_colorMode == ColorMode::BY_ENSEMBLE_PARAM &&
|
2019-09-06 03:40:57 -05:00
|
|
|
m_legendConfig->showLegend() )
|
2018-04-20 03:17:02 -05:00
|
|
|
{
|
2019-12-02 07:05:41 -06:00
|
|
|
if ( !m_legendOverlayFrame )
|
|
|
|
{
|
2020-02-12 04:43:15 -06:00
|
|
|
m_legendOverlayFrame =
|
|
|
|
new RiuDraggableOverlayFrame( plot->viewer()->canvas(), plot->viewer()->overlayMargins() );
|
2019-12-02 07:05:41 -06:00
|
|
|
}
|
2019-12-18 05:25:19 -06:00
|
|
|
m_legendOverlayFrame->setContentFrame( m_legendConfig->makeLegendFrame() );
|
2020-01-06 05:11:00 -06:00
|
|
|
plot->viewer()->addOverlayFrame( m_legendOverlayFrame );
|
2018-04-20 03:17:02 -05:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2019-12-02 08:26:24 -06:00
|
|
|
if ( m_legendOverlayFrame )
|
2019-12-02 07:05:41 -06:00
|
|
|
{
|
|
|
|
plot->viewer()->removeOverlayFrame( m_legendOverlayFrame );
|
|
|
|
}
|
2018-04-20 03:17:02 -05:00
|
|
|
}
|
2019-10-11 08:54:19 -05:00
|
|
|
plot->viewer()->scheduleReplot();
|
2018-04-20 03:17:02 -05:00
|
|
|
}
|
2018-04-18 01:32:16 -05:00
|
|
|
}
|
2018-04-18 14:38:50 -05:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2018-04-18 14:38:50 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-04-19 07:00:00 -05:00
|
|
|
void RimEnsembleCurveSet::updateQwtPlotAxis()
|
2018-04-18 14:38:50 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
for ( RimSummaryCurve* curve : curves() )
|
2018-04-18 14:38:50 -05:00
|
|
|
{
|
|
|
|
curve->updateQwtPlotAxis();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2018-04-18 14:38:50 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
void RimEnsembleCurveSet::updateEnsembleCurves( const std::vector<RimSummaryCase*>& sumCases )
|
2018-04-18 14:38:50 -05:00
|
|
|
{
|
|
|
|
RimSummaryPlot* plot = nullptr;
|
2019-09-06 03:40:57 -05:00
|
|
|
firstAncestorOrThisOfType( plot );
|
|
|
|
CVF_ASSERT( plot );
|
2018-04-18 14:38:50 -05:00
|
|
|
|
2018-06-07 03:02:54 -05:00
|
|
|
deleteEnsembleCurves();
|
2018-05-31 06:29:32 -05:00
|
|
|
m_qwtPlotCurveForLegendText->detach();
|
2018-06-13 06:35:33 -05:00
|
|
|
deleteStatisticsCurves();
|
2018-04-18 14:38:50 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( m_statistics->hideEnsembleCurves() ) return;
|
2018-07-09 04:18:42 -05:00
|
|
|
|
2019-09-23 07:04:23 -05:00
|
|
|
RimSummaryAddress* addr = m_yValuesSummaryAddress();
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( plot && addr->address().category() != RifEclipseSummaryAddress::SUMMARY_INVALID )
|
2018-04-18 14:38:50 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( isCurvesVisible() )
|
2018-04-18 14:38:50 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
for ( auto& sumCase : sumCases )
|
2018-05-15 05:10:39 -05:00
|
|
|
{
|
|
|
|
RimSummaryCurve* curve = new RimSummaryCurve();
|
2019-09-06 03:40:57 -05:00
|
|
|
curve->setSummaryCaseY( sumCase );
|
|
|
|
curve->setSummaryAddressYAndApplyInterpolation( addr->address() );
|
|
|
|
curve->setLeftOrRightAxisY( m_plotAxis() );
|
2018-04-18 14:38:50 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
addCurve( curve );
|
2018-04-18 14:38:50 -05:00
|
|
|
|
2019-11-27 07:03:20 -06:00
|
|
|
curve->updateCurveVisibility();
|
2019-09-06 03:40:57 -05:00
|
|
|
curve->loadDataAndUpdate( false );
|
2018-09-19 07:08:16 -05:00
|
|
|
curve->updateQwtPlotAxis();
|
2018-05-03 07:50:35 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( curve->qwtPlotCurve() )
|
2018-05-15 05:10:39 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
curve->qwtPlotCurve()->setItemAttribute( QwtPlotItem::Legend, false );
|
2018-05-15 05:10:39 -05:00
|
|
|
}
|
2018-05-03 07:50:35 -05:00
|
|
|
}
|
2018-04-18 14:38:50 -05:00
|
|
|
|
2019-10-11 08:54:19 -05:00
|
|
|
if ( plot->viewer() ) m_qwtPlotCurveForLegendText->attach( plot->viewer() );
|
2018-05-31 06:45:33 -05:00
|
|
|
}
|
2018-05-31 06:29:32 -05:00
|
|
|
|
2019-10-11 08:54:19 -05:00
|
|
|
if ( plot->viewer() )
|
2018-04-18 14:38:50 -05:00
|
|
|
{
|
2019-10-11 08:54:19 -05:00
|
|
|
plot->viewer()->updateLegend();
|
|
|
|
plot->viewer()->scheduleReplot();
|
2018-04-18 14:38:50 -05:00
|
|
|
plot->updateAxes();
|
2018-06-27 06:10:39 -05:00
|
|
|
plot->updatePlotInfoLabel();
|
2018-04-18 14:38:50 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
updateCurveColors();
|
|
|
|
}
|
2018-04-20 06:25:46 -05:00
|
|
|
|
2018-06-07 03:02:54 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2018-06-07 03:02:54 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
void RimEnsembleCurveSet::updateStatisticsCurves( const std::vector<RimSummaryCase*>& sumCases )
|
2018-06-07 03:02:54 -05:00
|
|
|
{
|
|
|
|
using SAddr = RifEclipseSummaryAddress;
|
|
|
|
|
2019-09-23 07:04:23 -05:00
|
|
|
RimSummaryCaseCollection* group = m_yValuesSummaryCaseCollection();
|
|
|
|
RimSummaryAddress* addr = m_yValuesSummaryAddress();
|
2018-06-15 09:03:39 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( !isCurvesVisible() || m_disableStatisticCurves || !group ||
|
|
|
|
addr->address().category() == RifEclipseSummaryAddress::SUMMARY_INVALID )
|
|
|
|
return;
|
2018-06-13 06:35:33 -05:00
|
|
|
|
2018-06-29 05:34:56 -05:00
|
|
|
// Calculate
|
2018-06-07 03:02:54 -05:00
|
|
|
{
|
2018-06-29 05:34:56 -05:00
|
|
|
std::vector<RimSummaryCase*> statCases = sumCases;
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( statCases.empty() )
|
2018-06-29 05:34:56 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( m_statistics->basedOnFilteredCases() )
|
|
|
|
statCases = filterEnsembleCases( group->allSummaryCases() );
|
|
|
|
else
|
|
|
|
statCases = group->allSummaryCases();
|
2018-06-29 05:34:56 -05:00
|
|
|
}
|
2019-11-27 02:57:17 -06:00
|
|
|
m_ensembleStatCase->calculate( statCases, m_statistics->includeIncompleteCurves() );
|
2018-06-07 03:02:54 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
RimSummaryPlot* plot = nullptr;
|
2019-09-06 03:40:57 -05:00
|
|
|
firstAncestorOrThisOfType( plot );
|
|
|
|
CVF_ASSERT( plot );
|
2018-06-07 03:02:54 -05:00
|
|
|
|
|
|
|
std::vector<RifEclipseSummaryAddress> addresses;
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( m_statistics->isActive() )
|
2018-06-07 03:02:54 -05:00
|
|
|
{
|
2019-09-23 07:04:23 -05:00
|
|
|
RifEclipseSummaryAddress dataAddress = m_yValuesSummaryAddress->address();
|
2018-06-12 07:22:32 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( m_statistics->showP10Curve() && m_ensembleStatCase->hasP10Data() )
|
|
|
|
addresses.push_back(
|
|
|
|
SAddr::ensembleStatisticsAddress( ENSEMBLE_STAT_P10_QUANTITY_NAME, dataAddress.quantityName() ) );
|
|
|
|
if ( m_statistics->showP50Curve() && m_ensembleStatCase->hasP50Data() )
|
|
|
|
addresses.push_back(
|
|
|
|
SAddr::ensembleStatisticsAddress( ENSEMBLE_STAT_P50_QUANTITY_NAME, dataAddress.quantityName() ) );
|
|
|
|
if ( m_statistics->showP90Curve() && m_ensembleStatCase->hasP90Data() )
|
|
|
|
addresses.push_back(
|
|
|
|
SAddr::ensembleStatisticsAddress( ENSEMBLE_STAT_P90_QUANTITY_NAME, dataAddress.quantityName() ) );
|
|
|
|
if ( m_statistics->showMeanCurve() && m_ensembleStatCase->hasMeanData() )
|
|
|
|
addresses.push_back(
|
|
|
|
SAddr::ensembleStatisticsAddress( ENSEMBLE_STAT_MEAN_QUANTITY_NAME, dataAddress.quantityName() ) );
|
2018-06-07 03:02:54 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
deleteStatisticsCurves();
|
2019-09-06 03:40:57 -05:00
|
|
|
for ( auto address : addresses )
|
2018-06-07 03:02:54 -05:00
|
|
|
{
|
|
|
|
auto curve = new RimSummaryCurve();
|
2019-10-11 08:54:19 -05:00
|
|
|
curve->setParentQwtPlotNoReplot( plot->viewer() );
|
2019-09-06 03:40:57 -05:00
|
|
|
m_curves.push_back( curve );
|
|
|
|
curve->setColor( m_statistics->color() );
|
|
|
|
curve->setColor( m_statistics->color() );
|
|
|
|
|
|
|
|
auto symbol = statisticsCurveSymbolFromAddress( address );
|
|
|
|
curve->setSymbol( symbol );
|
|
|
|
curve->setSymbolSize( statisticsCurveSymbolSize( symbol ) );
|
|
|
|
curve->setSymbolSkipDistance( 150 );
|
|
|
|
if ( m_statistics->showCurveLabels() )
|
2018-06-27 04:32:06 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
curve->setSymbolLabel( RiaStatisticsTools::replacePercentileByPValueText(
|
|
|
|
QString::fromStdString( address.ensembleStatisticsQuantityName() ) ) );
|
2018-06-27 04:32:06 -05:00
|
|
|
}
|
2019-09-06 03:40:57 -05:00
|
|
|
curve->setLineStyle( RiuQwtPlotCurve::STYLE_SOLID );
|
|
|
|
curve->setSummaryCaseY( m_ensembleStatCase.get() );
|
|
|
|
curve->setSummaryAddressYAndApplyInterpolation( address );
|
|
|
|
curve->setLeftOrRightAxisY( m_plotAxis() );
|
2018-06-07 03:02:54 -05:00
|
|
|
|
2019-11-27 07:03:20 -06:00
|
|
|
curve->updateCurveVisibility();
|
2019-09-06 03:40:57 -05:00
|
|
|
curve->loadDataAndUpdate( false );
|
2018-09-19 07:08:16 -05:00
|
|
|
curve->updateQwtPlotAxis();
|
2018-06-07 03:02:54 -05:00
|
|
|
}
|
|
|
|
|
2019-10-11 08:54:19 -05:00
|
|
|
if ( plot->viewer() )
|
2018-06-07 03:02:54 -05:00
|
|
|
{
|
2019-10-11 08:54:19 -05:00
|
|
|
plot->viewer()->updateLegend();
|
2018-06-07 03:02:54 -05:00
|
|
|
plot->updateAxes();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-06-29 05:34:56 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2018-06-29 05:34:56 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimEnsembleCurveSet::updateStatisticsCurves()
|
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
updateStatisticsCurves( std::vector<RimSummaryCase*>() );
|
2018-06-29 05:34:56 -05:00
|
|
|
}
|
|
|
|
|
2018-05-10 14:29:55 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2018-05-10 14:29:55 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
RimEnsembleCurveSet* RimEnsembleCurveSet::clone() const
|
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
RimEnsembleCurveSet* copy = dynamic_cast<RimEnsembleCurveSet*>(
|
|
|
|
this->xmlCapability()->copyByXmlSerialization( caf::PdmDefaultObjectFactory::instance() ) );
|
2019-09-23 07:04:23 -05:00
|
|
|
copy->m_yValuesSummaryCaseCollection = m_yValuesSummaryCaseCollection();
|
2018-05-15 03:11:49 -05:00
|
|
|
|
|
|
|
// Update summary case references
|
2019-09-06 03:40:57 -05:00
|
|
|
for ( size_t i = 0; i < m_curves.size(); i++ )
|
2018-05-15 03:11:49 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
copy->m_curves[i]->setSummaryCaseY( m_curves[i]->summaryCaseY() );
|
2018-05-15 03:11:49 -05:00
|
|
|
}
|
2018-05-10 14:29:55 -05:00
|
|
|
return copy;
|
|
|
|
}
|
|
|
|
|
2018-05-11 08:42:56 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2018-05-11 08:42:56 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
void RimEnsembleCurveSet::showCurves( bool show )
|
2018-05-11 08:42:56 -05:00
|
|
|
{
|
|
|
|
m_showCurves = show;
|
|
|
|
}
|
|
|
|
|
2018-09-13 05:38:17 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2018-09-13 05:38:17 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimEnsembleCurveSet::markCachedDataForPurge()
|
|
|
|
{
|
2020-09-14 13:17:20 -05:00
|
|
|
for ( const auto& curve : m_curves )
|
2018-09-13 05:38:17 -05:00
|
|
|
{
|
|
|
|
curve->markCachedDataForPurge();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-05-11 12:44:01 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimEnsembleCurveSet::updateAllTextInPlot()
|
|
|
|
{
|
|
|
|
updateEnsembleLegendItem();
|
|
|
|
|
|
|
|
RimSummaryPlot* summaryPlot = nullptr;
|
2019-09-06 03:40:57 -05:00
|
|
|
this->firstAncestorOrThisOfTypeAsserted( summaryPlot );
|
2019-10-11 08:54:19 -05:00
|
|
|
if ( summaryPlot->viewer() )
|
2018-05-11 12:44:01 -05:00
|
|
|
{
|
|
|
|
summaryPlot->updatePlotTitle();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-05-31 03:23:51 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2018-05-31 03:23:51 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2020-03-20 05:22:14 -05:00
|
|
|
std::vector<EnsembleParameter> RimEnsembleCurveSet::variationSortedEnsembleParameters() const
|
2018-05-31 03:23:51 -05:00
|
|
|
{
|
2020-03-20 05:22:14 -05:00
|
|
|
RimSummaryCaseCollection* ensemble = m_yValuesSummaryCaseCollection;
|
|
|
|
if ( ensemble )
|
2018-05-31 03:23:51 -05:00
|
|
|
{
|
2020-03-20 05:22:14 -05:00
|
|
|
return ensemble->variationSortedEnsembleParameters();
|
2018-05-31 03:23:51 -05:00
|
|
|
}
|
2020-03-20 05:22:14 -05:00
|
|
|
else
|
2019-01-29 08:04:04 -06:00
|
|
|
{
|
2020-03-20 05:22:14 -05:00
|
|
|
return std::vector<EnsembleParameter>();
|
2019-01-29 08:04:04 -06:00
|
|
|
}
|
2018-05-31 03:23:51 -05:00
|
|
|
}
|
|
|
|
|
2020-08-27 06:07:04 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
std::vector<std::pair<EnsembleParameter, double>> RimEnsembleCurveSet::correlationSortedEnsembleParameters() const
|
|
|
|
{
|
|
|
|
RimSummaryCaseCollection* ensemble = m_yValuesSummaryCaseCollection;
|
|
|
|
if ( ensemble )
|
|
|
|
{
|
|
|
|
auto parameters = ensemble->parameterCorrelationsAllTimeSteps( summaryAddress() );
|
|
|
|
std::sort( parameters.begin(),
|
|
|
|
parameters.end(),
|
2020-09-03 08:51:49 -05:00
|
|
|
[]( const std::pair<EnsembleParameter, double>& lhs, const std::pair<EnsembleParameter, double>& rhs ) {
|
|
|
|
return std::abs( lhs.second ) > std::abs( rhs.second );
|
|
|
|
} );
|
2020-08-27 06:07:04 -05:00
|
|
|
return parameters;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return std::vector<std::pair<EnsembleParameter, double>>();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-05-31 03:23:51 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2018-05-31 03:23:51 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
std::vector<RimSummaryCase*> RimEnsembleCurveSet::filterEnsembleCases( const std::vector<RimSummaryCase*>& sumCases )
|
2018-05-31 03:23:51 -05:00
|
|
|
{
|
2018-06-29 05:34:56 -05:00
|
|
|
auto filteredCases = sumCases;
|
2018-05-31 03:23:51 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
for ( auto& filter : m_curveFilters->filters() )
|
2018-06-01 02:08:31 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
filteredCases = filter->applyFilter( filteredCases );
|
2018-05-31 03:23:51 -05:00
|
|
|
}
|
2018-06-29 05:34:56 -05:00
|
|
|
return filteredCases;
|
2018-05-31 03:23:51 -05:00
|
|
|
}
|
|
|
|
|
2018-05-03 07:50:35 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2018-05-03 07:50:35 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-06-15 03:54:30 -05:00
|
|
|
void RimEnsembleCurveSet::disableStatisticCurves()
|
|
|
|
{
|
|
|
|
m_disableStatisticCurves = true;
|
|
|
|
}
|
|
|
|
|
2018-06-27 06:10:39 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2018-06-27 06:10:39 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
bool RimEnsembleCurveSet::isFiltered() const
|
|
|
|
{
|
|
|
|
return m_isCurveSetFiltered;
|
|
|
|
}
|
|
|
|
|
2018-06-15 03:54:30 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2018-06-15 03:54:30 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-06-15 07:26:56 -05:00
|
|
|
bool RimEnsembleCurveSet::hasP10Data() const
|
|
|
|
{
|
|
|
|
return m_ensembleStatCase->hasP10Data();
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2018-06-15 07:26:56 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
bool RimEnsembleCurveSet::hasP50Data() const
|
|
|
|
{
|
|
|
|
return m_ensembleStatCase->hasP50Data();
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2018-06-15 07:26:56 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
bool RimEnsembleCurveSet::hasP90Data() const
|
|
|
|
{
|
|
|
|
return m_ensembleStatCase->hasP90Data();
|
|
|
|
}
|
|
|
|
|
2018-08-15 03:59:47 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2018-08-15 03:59:47 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
bool RimEnsembleCurveSet::hasMeanData() const
|
|
|
|
{
|
|
|
|
return m_ensembleStatCase->hasMeanData();
|
|
|
|
}
|
|
|
|
|
2018-06-15 07:26:56 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2018-06-15 07:26:56 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-05-03 07:50:35 -05:00
|
|
|
void RimEnsembleCurveSet::updateEnsembleLegendItem()
|
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
m_qwtPlotCurveForLegendText->setTitle( name() );
|
2018-05-03 07:50:35 -05:00
|
|
|
|
|
|
|
{
|
|
|
|
QwtSymbol* symbol = nullptr;
|
2019-09-06 03:40:57 -05:00
|
|
|
|
2019-12-02 07:05:41 -06:00
|
|
|
if ( m_colorMode == ColorMode::SINGLE_COLOR )
|
2018-05-03 07:50:35 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
symbol = new QwtSymbol( QwtSymbol::HLine );
|
2018-05-03 07:50:35 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
QColor curveColor( m_color.value().rByte(), m_color.value().gByte(), m_color.value().bByte() );
|
|
|
|
QPen curvePen( curveColor );
|
|
|
|
curvePen.setWidth( 2 );
|
2018-05-03 07:50:35 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
symbol->setPen( curvePen );
|
|
|
|
symbol->setSize( 6, 6 );
|
2018-05-03 07:50:35 -05:00
|
|
|
}
|
2019-12-02 07:05:41 -06:00
|
|
|
else if ( m_colorMode == ColorMode::BY_ENSEMBLE_PARAM )
|
2018-05-03 07:50:35 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
QPixmap p = QPixmap( ":/Legend.png" );
|
|
|
|
|
2018-05-14 02:20:47 -05:00
|
|
|
symbol = new QwtSymbol;
|
2019-09-06 03:40:57 -05:00
|
|
|
symbol->setPixmap( p );
|
|
|
|
symbol->setSize( 8, 8 );
|
2018-05-03 07:50:35 -05:00
|
|
|
}
|
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
m_qwtPlotCurveForLegendText->setSymbol( symbol );
|
2018-05-03 07:50:35 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
bool showLegendItem = isCurvesVisible();
|
2019-09-06 03:40:57 -05:00
|
|
|
m_qwtPlotCurveForLegendText->setItemAttribute( QwtPlotItem::Legend, showLegendItem );
|
2018-05-03 07:50:35 -05:00
|
|
|
}
|
|
|
|
|
2018-05-03 00:58:47 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2018-05-03 00:58:47 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
QString RimEnsembleCurveSet::name() const
|
|
|
|
{
|
|
|
|
QString curveSetName;
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( m_isUsingAutoName )
|
2018-05-03 00:58:47 -05:00
|
|
|
{
|
|
|
|
curveSetName = m_autoGeneratedName();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
curveSetName += m_userDefinedName();
|
|
|
|
}
|
|
|
|
|
|
|
|
return curveSetName;
|
|
|
|
}
|
|
|
|
|
2018-04-27 06:07:33 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
QString RimEnsembleCurveSet::createAutoName() const
|
|
|
|
{
|
|
|
|
RimSummaryPlot* plot = nullptr;
|
2019-09-06 03:40:57 -05:00
|
|
|
firstAncestorOrThisOfTypeAsserted( plot );
|
2018-04-27 06:07:33 -05:00
|
|
|
|
2019-09-23 07:04:23 -05:00
|
|
|
QString curveSetName = m_summaryAddressNameTools->curveNameY( m_yValuesSummaryAddress->address(),
|
2019-09-06 03:40:57 -05:00
|
|
|
plot->activePlotTitleHelperAllCurves() );
|
|
|
|
if ( curveSetName.isEmpty() )
|
2018-04-27 06:07:33 -05:00
|
|
|
{
|
2019-09-23 07:04:23 -05:00
|
|
|
curveSetName = m_summaryAddressNameTools->curveNameY( m_yValuesSummaryAddress->address(), nullptr );
|
2018-04-27 06:07:33 -05:00
|
|
|
}
|
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( curveSetName.isEmpty() )
|
2018-04-27 06:07:33 -05:00
|
|
|
{
|
|
|
|
curveSetName = "Name Placeholder";
|
|
|
|
}
|
|
|
|
|
|
|
|
return curveSetName;
|
|
|
|
}
|
2018-05-03 02:53:25 -05:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2018-05-03 02:53:25 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimEnsembleCurveSet::updateLegendMappingMode()
|
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
switch ( currentEnsembleParameterType() )
|
2018-05-03 02:53:25 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
case EnsembleParameter::TYPE_TEXT:
|
|
|
|
if ( m_legendConfig->mappingMode() != RimRegularLegendConfig::MappingType::CATEGORY_INTEGER )
|
|
|
|
m_legendConfig->setMappingMode( RimRegularLegendConfig::MappingType::CATEGORY_INTEGER );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case EnsembleParameter::TYPE_NUMERIC:
|
|
|
|
if ( m_legendConfig->mappingMode() == RimRegularLegendConfig::MappingType::CATEGORY_INTEGER )
|
|
|
|
m_legendConfig->setMappingMode( RimRegularLegendConfig::MappingType::LINEAR_CONTINUOUS );
|
|
|
|
break;
|
2018-05-03 02:53:25 -05:00
|
|
|
}
|
|
|
|
}
|
2018-06-27 04:24:07 -05:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2018-06-27 04:24:07 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
RiuQwtSymbol::PointSymbolEnum statisticsCurveSymbolFromAddress( const RifEclipseSummaryAddress& address )
|
2018-06-27 04:24:07 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
auto qName = QString::fromStdString( address.quantityName() );
|
2018-06-27 04:24:07 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( qName.contains( ENSEMBLE_STAT_P10_QUANTITY_NAME ) ) return RiuQwtSymbol::SYMBOL_TRIANGLE;
|
|
|
|
if ( qName.contains( ENSEMBLE_STAT_P90_QUANTITY_NAME ) ) return RiuQwtSymbol::SYMBOL_DOWN_TRIANGLE;
|
|
|
|
if ( qName.contains( ENSEMBLE_STAT_P50_QUANTITY_NAME ) ) return RiuQwtSymbol::SYMBOL_DIAMOND;
|
2018-09-04 02:08:29 -05:00
|
|
|
return RiuQwtSymbol::SYMBOL_ELLIPSE;
|
2018-06-27 04:24:07 -05:00
|
|
|
}
|
2018-06-27 07:24:19 -05:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2018-06-27 07:24:19 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
int statisticsCurveSymbolSize( RiuQwtSymbol::PointSymbolEnum symbol )
|
2018-06-27 07:24:19 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( symbol == RiuQwtSymbol::SYMBOL_DIAMOND ) return 8;
|
|
|
|
if ( symbol == RiuQwtSymbol::SYMBOL_TRIANGLE ) return 7;
|
|
|
|
if ( symbol == RiuQwtSymbol::SYMBOL_DOWN_TRIANGLE ) return 7;
|
2018-06-27 07:24:19 -05:00
|
|
|
return 6;
|
|
|
|
}
|