2016-05-09 05:13:54 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// Copyright (C) 2016 Statoil ASA
|
2019-09-06 03:40:57 -05:00
|
|
|
//
|
2016-05-09 05:13:54 -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
|
|
|
//
|
2016-05-09 05:13:54 -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>
|
2016-05-09 05:13:54 -05:00
|
|
|
// for more details.
|
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#include "RimSummaryCurve.h"
|
|
|
|
|
2019-07-25 00:38:46 -05:00
|
|
|
#include "RiaCurveMerger.h"
|
2017-10-18 04:19:31 -05:00
|
|
|
#include "RiaDefines.h"
|
2019-08-16 08:41:58 -05:00
|
|
|
#include "RiaGuiApplication.h"
|
|
|
|
#include "RiaPreferences.h"
|
2019-08-27 00:35:35 -05:00
|
|
|
#include "RiaStatisticsTools.h"
|
2016-10-10 04:05:45 -05:00
|
|
|
|
2016-05-09 05:13:54 -05:00
|
|
|
#include "RifReaderEclipseSummary.h"
|
2016-10-10 04:05:45 -05:00
|
|
|
|
2016-05-09 05:13:54 -05:00
|
|
|
#include "RimEclipseResultCase.h"
|
2018-06-28 08:15:25 -05:00
|
|
|
#include "RimEnsembleCurveSet.h"
|
|
|
|
#include "RimEnsembleCurveSetCollection.h"
|
2016-05-09 05:13:54 -05:00
|
|
|
#include "RimProject.h"
|
2017-11-08 06:09:05 -06:00
|
|
|
#include "RimSummaryAddress.h"
|
|
|
|
#include "RimSummaryCalculationCollection.h"
|
2016-10-10 04:05:45 -05:00
|
|
|
#include "RimSummaryCase.h"
|
2018-06-28 08:15:25 -05:00
|
|
|
#include "RimSummaryCaseCollection.h"
|
2017-11-14 05:58:24 -06:00
|
|
|
#include "RimSummaryCrossPlot.h"
|
2016-11-04 08:32:39 -05:00
|
|
|
#include "RimSummaryCurveAutoName.h"
|
2017-12-14 01:56:11 -06:00
|
|
|
#include "RimSummaryCurveCollection.h"
|
2016-10-10 04:05:45 -05:00
|
|
|
#include "RimSummaryFilter.h"
|
2016-05-09 05:13:54 -05:00
|
|
|
#include "RimSummaryPlot.h"
|
2017-12-14 01:56:11 -06:00
|
|
|
#include "RimSummaryPlotCollection.h"
|
2017-03-09 00:08:42 -06:00
|
|
|
#include "RimSummaryTimeAxisProperties.h"
|
2017-11-21 04:52:49 -06:00
|
|
|
#include "RimTools.h"
|
2016-10-10 04:05:45 -05:00
|
|
|
|
2018-04-26 23:28:08 -05:00
|
|
|
#include "RiuPlotMainWindow.h"
|
2019-09-06 03:40:57 -05:00
|
|
|
#include "RiuQwtPlotCurve.h"
|
2017-11-15 08:20:47 -06:00
|
|
|
#include "RiuSummaryCurveDefSelectionDialog.h"
|
2016-05-09 05:13:54 -05:00
|
|
|
|
|
|
|
#include "cafPdmUiComboBoxEditor.h"
|
|
|
|
#include "cafPdmUiListEditor.h"
|
2017-11-15 08:20:47 -06:00
|
|
|
#include "cafPdmUiPushButtonEditor.h"
|
2016-05-09 05:13:54 -05:00
|
|
|
#include "cafPdmUiTreeOrdering.h"
|
2016-10-10 04:05:45 -05:00
|
|
|
|
2016-05-25 06:15:17 -05:00
|
|
|
#include "qwt_date.h"
|
2019-02-25 07:54:36 -06:00
|
|
|
#include "qwt_plot.h"
|
2016-10-10 04:05:45 -05:00
|
|
|
|
2019-08-27 09:18:00 -05:00
|
|
|
#include "cafPdmUiLineEditor.h"
|
2019-09-06 03:40:57 -05:00
|
|
|
#include <QMessageBox>
|
2017-11-21 04:52:49 -06:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
CAF_PDM_SOURCE_INIT( RimSummaryCurve, "SummaryCurve" );
|
2016-05-09 05:13:54 -05:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2016-05-09 05:13:54 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
RimSummaryCurve::RimSummaryCurve()
|
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
CAF_PDM_InitObject( "Summary Curve", ":/SummaryCurve16x16.png", "", "" );
|
2016-05-09 05:13:54 -05:00
|
|
|
|
2017-11-08 08:12:53 -06:00
|
|
|
// Y Values
|
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
CAF_PDM_InitFieldNoDefault( &m_yValuesSummaryCase, "SummaryCase", "Case", "", "", "" );
|
|
|
|
m_yValuesSummaryCase.uiCapability()->setUiTreeChildrenHidden( true );
|
|
|
|
m_yValuesSummaryCase.uiCapability()->setAutoAddingOptionFromValue( false );
|
2017-10-18 05:47:07 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
CAF_PDM_InitFieldNoDefault( &m_yValuesSummaryAddressUiField, "SelectedVariableDisplayVar", "Vector", "", "", "" );
|
2019-08-27 09:18:00 -05:00
|
|
|
m_yValuesSummaryAddressUiField.xmlCapability()->disableIO();
|
2019-09-06 03:40:57 -05:00
|
|
|
m_yValuesSummaryAddressUiField.uiCapability()->setUiEditorTypeName( caf::PdmUiLineEditor::uiEditorTypeName() );
|
2016-06-15 10:31:50 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
CAF_PDM_InitFieldNoDefault( &m_yValuesSummaryAddress, "SummaryAddress", "Summary Address", "", "", "" );
|
|
|
|
m_yValuesSummaryAddress.uiCapability()->setUiHidden( true );
|
|
|
|
m_yValuesSummaryAddress.uiCapability()->setUiTreeChildrenHidden( true );
|
2016-06-09 03:55:48 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
CAF_PDM_InitFieldNoDefault( &m_yPushButtonSelectSummaryAddress, "SelectAddress", "", "", "", "" );
|
|
|
|
caf::PdmUiPushButtonEditor::configureEditorForField( &m_yPushButtonSelectSummaryAddress );
|
|
|
|
m_yPushButtonSelectSummaryAddress.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN );
|
2017-11-15 08:20:47 -06:00
|
|
|
m_yPushButtonSelectSummaryAddress = false;
|
|
|
|
|
2019-08-27 09:18:00 -05:00
|
|
|
m_yValuesSummaryAddress = new RimSummaryAddress;
|
2016-11-04 08:32:39 -05:00
|
|
|
|
2017-11-08 08:12:53 -06:00
|
|
|
// X Values
|
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
CAF_PDM_InitFieldNoDefault( &m_xValuesSummaryCase, "SummaryCaseX", "Case", "", "", "" );
|
|
|
|
m_xValuesSummaryCase.uiCapability()->setUiTreeChildrenHidden( true );
|
|
|
|
m_xValuesSummaryCase.uiCapability()->setAutoAddingOptionFromValue( false );
|
2017-11-08 08:12:53 -06:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
CAF_PDM_InitFieldNoDefault( &m_xValuesSummaryAddressUiField, "SelectedVariableDisplayVarX", "Vector", "", "", "" );
|
2019-08-27 09:18:00 -05:00
|
|
|
m_xValuesSummaryAddressUiField.xmlCapability()->disableIO();
|
2019-09-06 03:40:57 -05:00
|
|
|
m_xValuesSummaryAddressUiField.uiCapability()->setUiEditorTypeName( caf::PdmUiLineEditor::uiEditorTypeName() );
|
2017-11-08 08:12:53 -06:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
CAF_PDM_InitFieldNoDefault( &m_xValuesSummaryAddress, "SummaryAddressX", "Summary Address", "", "", "" );
|
|
|
|
m_xValuesSummaryAddress.uiCapability()->setUiHidden( true );
|
|
|
|
m_xValuesSummaryAddress.uiCapability()->setUiTreeChildrenHidden( true );
|
2017-11-08 08:12:53 -06:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
CAF_PDM_InitFieldNoDefault( &m_xPushButtonSelectSummaryAddress, "SelectAddressX", "", "", "", "" );
|
|
|
|
caf::PdmUiPushButtonEditor::configureEditorForField( &m_xPushButtonSelectSummaryAddress );
|
|
|
|
m_xPushButtonSelectSummaryAddress.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN );
|
2019-08-27 09:18:00 -05:00
|
|
|
|
2017-11-15 08:20:47 -06:00
|
|
|
m_xPushButtonSelectSummaryAddress = false;
|
|
|
|
|
2019-08-27 09:18:00 -05:00
|
|
|
m_xValuesSummaryAddress = new RimSummaryAddress;
|
2017-11-08 08:12:53 -06:00
|
|
|
|
|
|
|
// Other members
|
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
CAF_PDM_InitFieldNoDefault( &m_plotAxis, "PlotAxis", "Axis", "", "", "" );
|
2016-10-10 04:05:45 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
CAF_PDM_InitFieldNoDefault( &m_curveNameConfig, "SummaryCurveNameConfig", "SummaryCurveNameConfig", "", "", "" );
|
|
|
|
m_curveNameConfig.uiCapability()->setUiHidden( true );
|
|
|
|
m_curveNameConfig.uiCapability()->setUiTreeChildrenHidden( true );
|
2016-11-04 08:32:39 -05:00
|
|
|
|
2017-03-09 00:08:42 -06:00
|
|
|
m_curveNameConfig = new RimSummaryCurveAutoName;
|
2016-07-01 04:29:48 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
CAF_PDM_InitField( &m_isTopZWithinCategory, "isTopZWithinCategory", false, "", "", "", "" );
|
|
|
|
m_isTopZWithinCategory.uiCapability()->setUiHidden( true );
|
2018-12-13 09:05:46 -06:00
|
|
|
|
2016-06-22 03:42:45 -05:00
|
|
|
m_symbolSkipPixelDistance = 10.0f;
|
2019-09-06 03:40:57 -05:00
|
|
|
m_curveThickness = 2;
|
2019-08-27 09:18:00 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
CAF_PDM_InitFieldNoDefault( &m_yValuesSummaryFilter_OBSOLETE, "VarListFilter", "Filter", "", "", "" );
|
|
|
|
m_yValuesSummaryFilter_OBSOLETE.uiCapability()->setUiTreeChildrenHidden( true );
|
|
|
|
m_yValuesSummaryFilter_OBSOLETE.uiCapability()->setUiHidden( true );
|
|
|
|
m_yValuesSummaryFilter_OBSOLETE.xmlCapability()->setIOWritable( false );
|
2019-09-23 06:56:40 -05:00
|
|
|
m_yValuesSummaryFilter_OBSOLETE = new RimSummaryFilter_OBSOLETE;
|
2019-08-27 09:18:00 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
CAF_PDM_InitFieldNoDefault( &m_xValuesSummaryFilter_OBSOLETE, "VarListFilterX", "Filter", "", "", "" );
|
|
|
|
m_xValuesSummaryFilter_OBSOLETE.uiCapability()->setUiTreeChildrenHidden( true );
|
|
|
|
m_xValuesSummaryFilter_OBSOLETE.uiCapability()->setUiHidden( true );
|
|
|
|
m_xValuesSummaryFilter_OBSOLETE.xmlCapability()->setIOWritable( false );
|
2019-09-23 06:56:40 -05:00
|
|
|
m_xValuesSummaryFilter_OBSOLETE = new RimSummaryFilter_OBSOLETE;
|
2016-05-09 05:13:54 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2016-05-09 05:13:54 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
RimSummaryCurve::~RimSummaryCurve() {}
|
2016-05-09 05:13:54 -05:00
|
|
|
|
2016-05-31 06:42:27 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2016-05-31 06:42:27 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
void RimSummaryCurve::setSummaryCaseY( RimSummaryCase* sumCase )
|
2016-05-31 06:42:27 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( m_yValuesSummaryCase != sumCase )
|
2018-07-09 06:20:59 -05:00
|
|
|
{
|
|
|
|
m_qwtPlotCurve->clearErrorBars();
|
|
|
|
}
|
|
|
|
|
2018-03-12 05:12:39 -05:00
|
|
|
m_yValuesSummaryCase = sumCase;
|
2016-05-31 06:42:27 -05:00
|
|
|
}
|
|
|
|
|
2016-06-16 09:10:16 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2016-06-16 09:10:16 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2017-11-15 04:36:33 -06:00
|
|
|
RimSummaryCase* RimSummaryCurve::summaryCaseY() const
|
2016-06-16 09:10:16 -05:00
|
|
|
{
|
2017-11-08 06:09:05 -06:00
|
|
|
return m_yValuesSummaryCase();
|
2016-06-16 09:10:16 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2016-06-16 09:10:16 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2017-11-15 04:36:33 -06:00
|
|
|
RifEclipseSummaryAddress RimSummaryCurve::summaryAddressX() const
|
|
|
|
{
|
2019-08-27 09:18:00 -05:00
|
|
|
return m_xValuesSummaryAddress->address();
|
2017-11-15 04:36:33 -06:00
|
|
|
}
|
|
|
|
|
2017-12-01 04:15:19 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2017-12-01 04:15:19 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
void RimSummaryCurve::setSummaryAddressX( const RifEclipseSummaryAddress& address )
|
2017-12-01 04:15:19 -06:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
m_xValuesSummaryAddress->setAddress( address );
|
2017-12-01 04:15:19 -06:00
|
|
|
|
|
|
|
// TODO: Should interpolation be computed similar to RimSummaryCurve::setSummaryAddressY
|
|
|
|
}
|
|
|
|
|
2017-11-15 04:36:33 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2017-11-15 04:36:33 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
RifEclipseSummaryAddress RimSummaryCurve::summaryAddressY() const
|
2016-06-16 09:10:16 -05:00
|
|
|
{
|
2019-08-27 09:18:00 -05:00
|
|
|
return m_yValuesSummaryAddress->address();
|
2016-06-16 09:10:16 -05:00
|
|
|
}
|
|
|
|
|
2019-02-07 01:30:55 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2019-02-07 01:30:55 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
void RimSummaryCurve::setSummaryAddressYAndApplyInterpolation( const RifEclipseSummaryAddress& address )
|
2019-02-07 01:30:55 -06:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
setSummaryAddressY( address );
|
|
|
|
|
2019-02-07 01:30:55 -06:00
|
|
|
calculateCurveInterpolationFromAddress();
|
|
|
|
}
|
|
|
|
|
2016-06-16 09:10:16 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2016-06-16 09:10:16 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
void RimSummaryCurve::setSummaryAddressY( const RifEclipseSummaryAddress& address )
|
2016-06-16 09:10:16 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( m_yValuesSummaryAddress->address() != address )
|
2018-07-09 02:09:51 -05:00
|
|
|
{
|
|
|
|
m_qwtPlotCurve->clearErrorBars();
|
|
|
|
}
|
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
m_yValuesSummaryAddress->setAddress( address );
|
2016-06-16 09:10:16 -05:00
|
|
|
}
|
|
|
|
|
2016-06-22 07:34:56 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2016-06-22 07:34:56 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2017-11-15 04:36:33 -06:00
|
|
|
std::string RimSummaryCurve::unitNameY() const
|
|
|
|
{
|
|
|
|
RifSummaryReaderInterface* reader = valuesSummaryReaderY();
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( reader ) return reader->unitName( this->summaryAddressY() );
|
2017-11-15 04:36:33 -06:00
|
|
|
|
|
|
|
return "";
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2017-11-15 04:36:33 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
std::string RimSummaryCurve::unitNameX() const
|
2016-06-22 07:34:56 -05:00
|
|
|
{
|
2017-11-15 04:36:33 -06:00
|
|
|
RifSummaryReaderInterface* reader = valuesSummaryReaderX();
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( reader ) return reader->unitName( this->summaryAddressX() );
|
2017-11-08 08:12:53 -06:00
|
|
|
|
2016-06-22 07:34:56 -05:00
|
|
|
return "";
|
|
|
|
}
|
|
|
|
|
2016-10-10 04:05:45 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2016-10-10 04:05:45 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2017-11-15 04:36:33 -06:00
|
|
|
std::vector<double> RimSummaryCurve::valuesY() const
|
2016-10-10 04:05:45 -05:00
|
|
|
{
|
|
|
|
std::vector<double> values;
|
|
|
|
|
2017-11-15 04:36:33 -06:00
|
|
|
RifSummaryReaderInterface* reader = valuesSummaryReaderY();
|
2016-11-22 04:13:34 -06:00
|
|
|
|
|
|
|
if ( !reader ) return values;
|
|
|
|
|
2019-08-27 09:18:00 -05:00
|
|
|
RifEclipseSummaryAddress addr = m_yValuesSummaryAddress()->address();
|
2019-09-06 03:40:57 -05:00
|
|
|
reader->values( addr, &values );
|
2016-10-10 04:05:45 -05:00
|
|
|
|
2019-08-14 01:30:11 -05:00
|
|
|
RimSummaryPlot* plot = nullptr;
|
2019-09-06 03:40:57 -05:00
|
|
|
firstAncestorOrThisOfTypeAsserted( plot );
|
2019-08-14 01:30:11 -05:00
|
|
|
bool isNormalized = plot->isNormalizationEnabled();
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( isNormalized )
|
2019-08-14 01:30:11 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
auto minMaxPair = std::minmax_element( values.begin(), values.end() );
|
|
|
|
double min = *minMaxPair.first;
|
|
|
|
double max = *minMaxPair.second;
|
|
|
|
double range = max - min;
|
|
|
|
|
|
|
|
for ( double& v : values )
|
|
|
|
{
|
|
|
|
v = ( v - min ) / range;
|
|
|
|
}
|
2019-08-14 01:30:11 -05:00
|
|
|
}
|
2019-09-06 03:40:57 -05:00
|
|
|
|
2016-10-10 04:05:45 -05:00
|
|
|
return values;
|
|
|
|
}
|
|
|
|
|
2018-07-10 06:55:54 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2018-07-10 06:55:54 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
RifEclipseSummaryAddress RimSummaryCurve::errorSummaryAddressY() const
|
|
|
|
{
|
|
|
|
auto addr = summaryAddressY();
|
|
|
|
addr.setAsErrorResult();
|
|
|
|
return addr;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2018-07-10 06:55:54 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
std::vector<double> RimSummaryCurve::errorValuesY() const
|
|
|
|
{
|
|
|
|
std::vector<double> values;
|
|
|
|
|
|
|
|
RifSummaryReaderInterface* reader = valuesSummaryReaderY();
|
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( !reader ) return values;
|
2018-07-10 06:55:54 -05:00
|
|
|
|
|
|
|
RifEclipseSummaryAddress addr = errorSummaryAddressY();
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( reader->hasAddress( addr ) )
|
2019-03-11 15:24:46 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
reader->values( addr, &values );
|
2019-03-11 15:24:46 -05:00
|
|
|
}
|
2018-07-10 06:55:54 -05:00
|
|
|
|
|
|
|
return values;
|
|
|
|
}
|
|
|
|
|
2017-11-09 05:49:27 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2017-11-09 05:49:27 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2017-11-15 04:36:33 -06:00
|
|
|
std::vector<double> RimSummaryCurve::valuesX() const
|
2017-11-09 05:49:27 -06:00
|
|
|
{
|
|
|
|
std::vector<double> values;
|
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( m_xValuesSummaryCase() && m_xValuesSummaryCase()->summaryReader() )
|
2017-11-09 05:49:27 -06:00
|
|
|
{
|
|
|
|
RifSummaryReaderInterface* reader = m_xValuesSummaryCase()->summaryReader();
|
|
|
|
|
2019-08-27 09:18:00 -05:00
|
|
|
RifEclipseSummaryAddress addr = m_xValuesSummaryAddress()->address();
|
2019-09-06 03:40:57 -05:00
|
|
|
reader->values( addr, &values );
|
2017-11-09 05:49:27 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
return values;
|
|
|
|
}
|
|
|
|
|
2016-11-22 04:13:34 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2016-11-22 04:13:34 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2017-11-21 04:52:49 -06:00
|
|
|
const std::vector<time_t>& RimSummaryCurve::timeStepsY() const
|
2016-11-22 04:13:34 -06:00
|
|
|
{
|
|
|
|
static std::vector<time_t> emptyVector;
|
2017-11-15 04:36:33 -06:00
|
|
|
RifSummaryReaderInterface* reader = valuesSummaryReaderY();
|
2016-11-22 04:13:34 -06:00
|
|
|
|
|
|
|
if ( !reader ) return emptyVector;
|
|
|
|
|
2019-08-27 09:18:00 -05:00
|
|
|
RifEclipseSummaryAddress addr = m_yValuesSummaryAddress()->address();
|
2019-09-06 03:40:57 -05:00
|
|
|
|
|
|
|
return reader->timeSteps( addr );
|
2016-11-22 04:13:34 -06:00
|
|
|
}
|
|
|
|
|
2017-12-01 04:15:19 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2017-12-01 04:15:19 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
void RimSummaryCurve::setSummaryCaseX( RimSummaryCase* sumCase )
|
2017-12-01 04:15:19 -06:00
|
|
|
{
|
|
|
|
m_xValuesSummaryCase = sumCase;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2017-12-01 04:15:19 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
RimSummaryCase* RimSummaryCurve::summaryCaseX() const
|
|
|
|
{
|
|
|
|
return m_xValuesSummaryCase();
|
|
|
|
}
|
|
|
|
|
2016-10-10 04:05:45 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2016-10-10 04:05:45 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
void RimSummaryCurve::setLeftOrRightAxisY( RiaDefines::PlotAxis plotAxis )
|
2016-10-10 04:05:45 -05:00
|
|
|
{
|
|
|
|
m_plotAxis = plotAxis;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2016-10-10 04:05:45 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2017-11-15 04:36:33 -06:00
|
|
|
RiaDefines::PlotAxis RimSummaryCurve::axisY() const
|
2016-10-10 04:05:45 -05:00
|
|
|
{
|
|
|
|
return m_plotAxis();
|
|
|
|
}
|
|
|
|
|
2016-05-09 05:13:54 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2016-05-09 05:13:54 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
QList<caf::PdmOptionItemInfo> RimSummaryCurve::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
|
|
|
|
bool* useOptionsOnly )
|
2016-05-09 05:13:54 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
QList<caf::PdmOptionItemInfo> options = this->RimPlotCurve::calculateValueOptions( fieldNeedingOptions,
|
|
|
|
useOptionsOnly );
|
|
|
|
if ( !options.isEmpty() ) return options;
|
2016-05-24 03:33:47 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( fieldNeedingOptions == &m_yValuesSummaryCase || fieldNeedingOptions == &m_xValuesSummaryCase )
|
2016-05-09 05:13:54 -05:00
|
|
|
{
|
|
|
|
RimProject* proj = RiaApplication::instance()->project();
|
|
|
|
|
2017-12-01 02:34:43 -06:00
|
|
|
std::vector<RimSummaryCase*> cases = proj->allSummaryCases();
|
2016-05-09 05:13:54 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
cases.push_back( proj->calculationCollection->calculationSummaryCase() );
|
2017-10-18 04:19:31 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
for ( RimSummaryCase* rimCase : cases )
|
2016-05-09 05:13:54 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
options.push_back( caf::PdmOptionItemInfo( rimCase->caseName(), rimCase ) );
|
2016-05-09 05:13:54 -05:00
|
|
|
}
|
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( options.size() > 0 )
|
2016-05-09 05:13:54 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
options.push_front( caf::PdmOptionItemInfo( "None", nullptr ) );
|
2016-05-09 05:13:54 -05:00
|
|
|
}
|
|
|
|
}
|
2019-09-06 03:40:57 -05:00
|
|
|
else if ( &m_yValuesSummaryAddressUiField == fieldNeedingOptions )
|
2016-05-31 06:42:27 -05:00
|
|
|
{
|
2019-10-03 06:10:53 -05:00
|
|
|
appendOptionItemsForSummaryAddresses( &options, m_yValuesSummaryCase() );
|
2017-11-08 08:12:53 -06:00
|
|
|
}
|
2019-09-06 03:40:57 -05:00
|
|
|
else if ( &m_xValuesSummaryAddressUiField == fieldNeedingOptions )
|
2017-11-08 08:12:53 -06:00
|
|
|
{
|
2019-09-23 07:04:23 -05:00
|
|
|
appendOptionItemsForSummaryAddresses( &options, m_xValuesSummaryCase() );
|
2016-05-31 06:42:27 -05:00
|
|
|
}
|
2017-11-08 08:12:53 -06:00
|
|
|
return options;
|
2016-05-09 05:13:54 -05:00
|
|
|
}
|
|
|
|
|
2016-05-24 03:33:47 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2016-05-24 03:33:47 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
QString RimSummaryCurve::createCurveAutoName()
|
|
|
|
{
|
2017-12-13 00:40:37 -06:00
|
|
|
RimSummaryPlot* plot = nullptr;
|
2019-09-06 03:40:57 -05:00
|
|
|
firstAncestorOrThisOfTypeAsserted( plot );
|
2017-11-15 04:36:33 -06:00
|
|
|
|
2018-05-15 01:43:36 -05:00
|
|
|
const RimSummaryPlotNameHelper* nameHelper = plot->activePlotTitleHelperAllCurves();
|
2019-09-06 03:40:57 -05:00
|
|
|
QString curveName = m_curveNameConfig->curveNameY( m_yValuesSummaryAddress->address(), nameHelper );
|
|
|
|
if ( curveName.isEmpty() )
|
2018-04-27 00:38:32 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
curveName = m_curveNameConfig->curveNameY( m_yValuesSummaryAddress->address(), nullptr );
|
2018-04-27 00:38:32 -05:00
|
|
|
}
|
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( isCrossPlotCurve() )
|
2017-11-15 04:36:33 -06:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
QString curveNameX = m_curveNameConfig->curveNameX( m_xValuesSummaryAddress->address(), nameHelper );
|
|
|
|
if ( curveNameX.isEmpty() )
|
2018-04-27 00:38:32 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
curveNameX = m_curveNameConfig->curveNameX( m_xValuesSummaryAddress->address(), nullptr );
|
2018-04-27 00:38:32 -05:00
|
|
|
}
|
2017-11-15 04:36:33 -06:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( !curveName.isEmpty() || !curveNameX.isEmpty() )
|
2017-12-21 05:55:48 -06:00
|
|
|
{
|
2017-12-21 14:03:23 -06:00
|
|
|
curveName += " | " + curveNameX;
|
2017-12-21 05:55:48 -06:00
|
|
|
}
|
2017-11-15 04:36:33 -06:00
|
|
|
}
|
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( curveName.isEmpty() )
|
2018-04-27 00:38:32 -05:00
|
|
|
{
|
|
|
|
curveName = "Curve Name Placeholder";
|
|
|
|
}
|
|
|
|
|
2017-12-21 14:03:23 -06:00
|
|
|
return curveName;
|
2016-05-24 03:33:47 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2016-05-24 03:33:47 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2016-09-13 02:59:34 -05:00
|
|
|
void RimSummaryCurve::updateZoomInParentPlot()
|
2016-05-24 03:33:47 -05:00
|
|
|
{
|
2016-07-05 03:47:03 -05:00
|
|
|
RimSummaryPlot* plot = nullptr;
|
2019-09-06 03:40:57 -05:00
|
|
|
firstAncestorOrThisOfTypeAsserted( plot );
|
2016-05-25 06:15:17 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
plot->updateZoomInQwt();
|
2016-05-24 03:33:47 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2016-05-24 03:33:47 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
void RimSummaryCurve::onLoadDataAndUpdate( bool updateParentPlot )
|
2016-05-24 03:33:47 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
this->RimPlotCurve::updateCurvePresentation( updateParentPlot );
|
2016-06-10 05:30:20 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
m_yValuesSummaryAddressUiField = m_yValuesSummaryAddress->address();
|
|
|
|
m_xValuesSummaryAddressUiField = m_xValuesSummaryAddress->address();
|
2017-11-15 01:20:54 -06:00
|
|
|
|
2017-09-23 01:01:46 -05:00
|
|
|
updateConnectedEditors();
|
2016-11-06 01:24:14 -06:00
|
|
|
|
2018-12-13 08:36:49 -06:00
|
|
|
setZIndexFromCurveInfo();
|
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( isCurveVisible() )
|
2016-05-24 03:33:47 -05:00
|
|
|
{
|
2017-11-21 03:39:20 -06:00
|
|
|
std::vector<double> curveValuesY = this->valuesY();
|
2016-05-24 03:33:47 -05:00
|
|
|
|
2016-10-12 06:49:57 -05:00
|
|
|
RimSummaryPlot* plot = nullptr;
|
2019-09-06 03:40:57 -05:00
|
|
|
firstAncestorOrThisOfTypeAsserted( plot );
|
|
|
|
bool isLogCurve = plot->isLogarithmicScaleEnabled( this->axisY() );
|
2016-10-12 06:49:57 -05:00
|
|
|
|
2017-11-09 05:49:27 -06:00
|
|
|
bool shouldPopulateViewWithEmptyData = false;
|
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( isCrossPlotCurve() )
|
2016-06-10 05:30:20 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
auto curveValuesX = this->valuesX();
|
2017-11-21 03:39:20 -06:00
|
|
|
auto curveTimeStepsX = timeStepsX();
|
|
|
|
|
2017-11-21 04:52:49 -06:00
|
|
|
auto curveTimeStepsY = timeStepsY();
|
2017-11-09 05:49:27 -06:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( curveValuesY.empty() || curveValuesX.empty() )
|
2016-11-22 04:13:34 -06:00
|
|
|
{
|
2017-11-21 03:39:20 -06:00
|
|
|
shouldPopulateViewWithEmptyData = true;
|
2016-11-22 04:13:34 -06:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2018-06-08 08:10:45 -05:00
|
|
|
RiaTimeHistoryCurveMerger curveMerger;
|
2019-09-06 03:40:57 -05:00
|
|
|
curveMerger.addCurveData( curveTimeStepsX, curveValuesX );
|
|
|
|
curveMerger.addCurveData( curveTimeStepsY, curveValuesY );
|
2017-11-21 03:39:20 -06:00
|
|
|
curveMerger.computeInterpolatedValues();
|
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( curveMerger.allXValues().size() > 0 )
|
2017-11-21 03:39:20 -06:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
m_qwtPlotCurve->setSamplesFromXValuesAndYValues( curveMerger.interpolatedYValuesForAllXValues( 0 ),
|
|
|
|
curveMerger.interpolatedYValuesForAllXValues( 1 ),
|
|
|
|
isLogCurve );
|
2017-11-21 03:39:20 -06:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
shouldPopulateViewWithEmptyData = true;
|
|
|
|
}
|
2017-11-09 05:49:27 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2017-11-21 04:52:49 -06:00
|
|
|
std::vector<time_t> curveTimeStepsY = this->timeStepsY();
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( curveTimeStepsY.size() > 0 && curveTimeStepsY.size() == curveValuesY.size() )
|
2017-11-09 05:49:27 -06:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( plot->timeAxisProperties()->timeMode() == RimSummaryTimeAxisProperties::DATE )
|
2017-11-09 05:49:27 -06:00
|
|
|
{
|
2018-05-25 04:10:03 -05:00
|
|
|
auto reader = summaryCaseY()->summaryReader();
|
2019-09-13 09:51:21 -05:00
|
|
|
if ( reader )
|
2018-05-25 04:10:03 -05:00
|
|
|
{
|
2019-09-13 09:51:21 -05:00
|
|
|
auto errAddress = reader->errorAddress( summaryAddressY() );
|
|
|
|
if ( errAddress.isValid() )
|
2019-09-13 06:17:07 -05:00
|
|
|
{
|
|
|
|
std::vector<double> errValues;
|
2019-09-13 09:51:21 -05:00
|
|
|
reader->values( errAddress, &errValues );
|
|
|
|
m_qwtPlotCurve->setSamplesFromTimeTAndYValues( curveTimeStepsY,
|
|
|
|
curveValuesY,
|
|
|
|
errValues,
|
|
|
|
isLogCurve );
|
2019-09-13 06:17:07 -05:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2019-09-13 09:51:21 -05:00
|
|
|
m_qwtPlotCurve->setSamplesFromTimeTAndYValues( curveTimeStepsY, curveValuesY, isLogCurve );
|
2019-09-13 06:17:07 -05:00
|
|
|
}
|
2018-05-25 04:10:03 -05:00
|
|
|
}
|
2017-11-09 05:49:27 -06:00
|
|
|
}
|
|
|
|
else
|
2016-11-22 04:13:34 -06:00
|
|
|
{
|
2017-11-21 03:39:20 -06:00
|
|
|
double timeScale = plot->timeAxisProperties()->fromTimeTToDisplayUnitScale();
|
2017-11-09 05:49:27 -06:00
|
|
|
|
2017-11-21 03:39:20 -06:00
|
|
|
std::vector<double> timeFromSimulationStart;
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( curveTimeStepsY.size() )
|
2016-11-22 04:13:34 -06:00
|
|
|
{
|
2017-11-21 03:39:20 -06:00
|
|
|
time_t startDate = curveTimeStepsY[0];
|
2019-09-06 03:40:57 -05:00
|
|
|
for ( const auto& date : curveTimeStepsY )
|
2017-11-09 05:49:27 -06:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
timeFromSimulationStart.push_back( timeScale * ( date - startDate ) );
|
2017-11-09 05:49:27 -06:00
|
|
|
}
|
2016-11-22 04:13:34 -06:00
|
|
|
}
|
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
m_qwtPlotCurve->setSamplesFromXValuesAndYValues( timeFromSimulationStart, curveValuesY, isLogCurve );
|
2017-11-09 05:49:27 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
shouldPopulateViewWithEmptyData = true;
|
|
|
|
}
|
2016-06-10 05:30:20 -05:00
|
|
|
}
|
2017-11-09 05:49:27 -06:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( shouldPopulateViewWithEmptyData )
|
2016-06-10 05:30:20 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
m_qwtPlotCurve->setSamplesFromXValuesAndYValues( std::vector<double>(), std::vector<double>(), isLogCurve );
|
2016-06-10 05:30:20 -05:00
|
|
|
}
|
2016-05-24 03:33:47 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( updateParentPlot && m_parentQwtPlot )
|
2017-09-23 01:47:04 -05:00
|
|
|
{
|
|
|
|
updateZoomInParentPlot();
|
|
|
|
m_parentQwtPlot->replot();
|
|
|
|
}
|
2018-05-25 04:10:03 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
m_qwtPlotCurve->showErrorBars( m_showErrorBars );
|
2016-05-24 03:33:47 -05:00
|
|
|
}
|
2016-10-10 04:05:45 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( updateParentPlot ) updateQwtPlotAxis();
|
2016-05-24 03:33:47 -05:00
|
|
|
}
|
|
|
|
|
2018-09-07 07:26:14 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimSummaryCurve::updateLegendsInPlot()
|
|
|
|
{
|
|
|
|
RimSummaryPlot* plot = nullptr;
|
2019-09-06 03:40:57 -05:00
|
|
|
firstAncestorOrThisOfTypeAsserted( plot );
|
2018-09-07 07:26:14 -05:00
|
|
|
plot->updateAllLegendItems();
|
|
|
|
}
|
|
|
|
|
2018-12-17 09:01:15 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2018-12-17 09:01:15 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
void RimSummaryCurve::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName /*= ""*/ )
|
2018-12-17 09:01:15 -06:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
RimPlotCurve::defineUiTreeOrdering( uiTreeOrdering, uiConfigName );
|
2018-12-17 09:01:15 -06:00
|
|
|
|
|
|
|
// Reset dynamic icon
|
2019-09-06 03:40:57 -05:00
|
|
|
this->setUiIcon( caf::QIconProvider() );
|
2018-12-17 09:01:15 -06:00
|
|
|
// Get static one
|
2019-05-06 03:36:05 -05:00
|
|
|
caf::QIconProvider iconProvider = this->uiIconProvider();
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( iconProvider.isNull() ) return;
|
2019-05-06 03:36:05 -05:00
|
|
|
|
|
|
|
QIcon icon = iconProvider.icon();
|
2018-12-17 09:01:15 -06:00
|
|
|
|
|
|
|
RimSummaryCurveCollection* coll = nullptr;
|
2019-09-06 03:40:57 -05:00
|
|
|
this->firstAncestorOrThisOfType( coll );
|
|
|
|
if ( coll && coll->curveForSourceStepping() == this )
|
2018-12-17 09:01:15 -06:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
QPixmap combined = icon.pixmap( 16, 16 );
|
|
|
|
QPainter painter( &combined );
|
|
|
|
QPixmap updownpixmap( ":/StepUpDownCorner16x16.png" );
|
|
|
|
painter.drawPixmap( 0, 0, updownpixmap );
|
|
|
|
iconProvider.setPixmap( combined );
|
|
|
|
setUiIcon( iconProvider );
|
2018-12-17 09:01:15 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-11-15 08:20:47 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2017-11-15 08:20:47 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
void RimSummaryCurve::defineEditorAttribute( const caf::PdmFieldHandle* field,
|
|
|
|
QString uiConfigName,
|
|
|
|
caf::PdmUiEditorAttribute* attribute )
|
2017-11-15 08:20:47 -06:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( &m_yPushButtonSelectSummaryAddress == field || &m_xPushButtonSelectSummaryAddress == field )
|
2017-11-15 08:20:47 -06:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
caf::PdmUiPushButtonEditorAttribute* attrib = dynamic_cast<caf::PdmUiPushButtonEditorAttribute*>( attribute );
|
|
|
|
if ( attrib )
|
2017-11-15 08:20:47 -06:00
|
|
|
{
|
2019-08-27 09:18:00 -05:00
|
|
|
attrib->m_buttonText = "...";
|
2017-11-15 08:20:47 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-05-31 06:42:27 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2016-05-31 06:42:27 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
void RimSummaryCurve::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
2016-05-31 06:42:27 -05:00
|
|
|
{
|
2017-03-17 09:51:32 -05:00
|
|
|
RimPlotCurve::updateOptionSensitivity();
|
|
|
|
|
2017-11-08 08:12:53 -06:00
|
|
|
{
|
|
|
|
QString curveDataGroupName = "Summary Vector";
|
2019-08-27 09:18:00 -05:00
|
|
|
if ( isCrossPlotCurve() ) curveDataGroupName += " Y";
|
2019-09-06 03:40:57 -05:00
|
|
|
caf::PdmUiGroup* curveDataGroup = uiOrdering.addNewGroupWithKeyword( curveDataGroupName, "Summary Vector Y" );
|
2019-11-04 04:34:34 -06:00
|
|
|
curveDataGroup->add( &m_yValuesSummaryCase, {true, 3, 1} );
|
|
|
|
curveDataGroup->add( &m_yValuesSummaryAddressUiField, {true, 2, 1} );
|
|
|
|
curveDataGroup->add( &m_yPushButtonSelectSummaryAddress, {false, 1, 0} );
|
|
|
|
curveDataGroup->add( &m_plotAxis, {true, 3, 1} );
|
2019-09-06 03:40:57 -05:00
|
|
|
|
|
|
|
if ( isCrossPlotCurve() )
|
|
|
|
m_showErrorBars = false;
|
|
|
|
else
|
|
|
|
curveDataGroup->add( &m_showErrorBars );
|
2017-11-08 08:12:53 -06:00
|
|
|
}
|
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( isCrossPlotCurve() )
|
2017-11-08 08:12:53 -06:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
caf::PdmUiGroup* curveDataGroup = uiOrdering.addNewGroup( "Summary Vector X" );
|
2019-11-04 04:34:34 -06:00
|
|
|
curveDataGroup->add( &m_xValuesSummaryCase, {true, 3, 1} );
|
|
|
|
curveDataGroup->add( &m_xValuesSummaryAddressUiField, {true, 2, 1} );
|
|
|
|
curveDataGroup->add( &m_xPushButtonSelectSummaryAddress, {false, 1, 0} );
|
2017-11-08 08:12:53 -06:00
|
|
|
}
|
2016-05-31 06:42:27 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
caf::PdmUiGroup* appearanceGroup = uiOrdering.addNewGroup( "Appearance" );
|
|
|
|
RimPlotCurve::appearanceUiOrdering( *appearanceGroup );
|
2017-04-07 05:10:27 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
caf::PdmUiGroup* nameGroup = uiOrdering.addNewGroup( "Curve Name" );
|
|
|
|
nameGroup->setCollapsedByDefault( true );
|
|
|
|
nameGroup->add( &m_showLegend );
|
|
|
|
RimPlotCurve::curveNameUiOrdering( *nameGroup );
|
2016-11-04 08:32:39 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( m_isUsingAutoName )
|
2016-07-01 04:29:48 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
m_curveNameConfig->uiOrdering( uiConfigName, *nameGroup );
|
2016-07-01 04:29:48 -05:00
|
|
|
}
|
2016-05-31 06:42:27 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
uiOrdering.skipRemainingFields(); // For now.
|
2016-05-31 06:42:27 -05:00
|
|
|
}
|
2016-06-09 03:55:48 -05:00
|
|
|
|
2017-11-08 08:12:53 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2017-11-08 08:12:53 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
void RimSummaryCurve::appendOptionItemsForSummaryAddresses( QList<caf::PdmOptionItemInfo>* options,
|
2019-09-23 07:04:23 -05:00
|
|
|
RimSummaryCase* summaryCase )
|
2017-11-08 08:12:53 -06:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( summaryCase )
|
2017-11-08 08:12:53 -06:00
|
|
|
{
|
|
|
|
RifSummaryReaderInterface* reader = summaryCase->summaryReader();
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( reader )
|
2017-11-08 08:12:53 -06:00
|
|
|
{
|
2018-06-25 08:14:47 -05:00
|
|
|
const std::set<RifEclipseSummaryAddress> allAddresses = reader->allResultAddresses();
|
2017-11-08 08:12:53 -06:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
for ( auto& address : allAddresses )
|
2017-11-08 08:12:53 -06:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( address.isErrorResult() ) continue;
|
2017-11-08 08:12:53 -06:00
|
|
|
|
|
|
|
std::string name = address.uiText();
|
2019-09-06 03:40:57 -05:00
|
|
|
QString s = QString::fromStdString( name );
|
|
|
|
options->push_back( caf::PdmOptionItemInfo( s, QVariant::fromValue( address ) ) );
|
2017-11-08 08:12:53 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
options->push_front( caf::PdmOptionItemInfo( RiaDefines::undefinedResultName(),
|
|
|
|
QVariant::fromValue( RifEclipseSummaryAddress() ) ) );
|
2017-11-08 08:12:53 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-10-10 04:05:45 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-11-29 08:28:53 -06:00
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimSummaryCurve::setZIndexFromCurveInfo()
|
|
|
|
{
|
|
|
|
auto sumAddr = summaryAddressY();
|
|
|
|
auto sumCase = summaryCaseY();
|
|
|
|
|
2018-12-13 09:05:46 -06:00
|
|
|
double zOrder = 0.0;
|
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( sumCase && sumAddr.isValid() )
|
2018-11-29 08:28:53 -06:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( sumCase->isObservedData() )
|
2018-11-29 08:28:53 -06:00
|
|
|
{
|
2018-12-13 09:05:46 -06:00
|
|
|
zOrder = RiuQwtPlotCurve::Z_SINGLE_CURVE_OBSERVED;
|
2018-11-29 08:28:53 -06:00
|
|
|
}
|
2019-09-06 03:40:57 -05:00
|
|
|
else if ( sumAddr.category() == RifEclipseSummaryAddress::SUMMARY_ENSEMBLE_STATISTICS )
|
2018-11-29 08:28:53 -06:00
|
|
|
{
|
2018-12-13 09:05:46 -06:00
|
|
|
zOrder = RiuQwtPlotCurve::Z_ENSEMBLE_STAT_CURVE;
|
2018-11-29 08:28:53 -06:00
|
|
|
}
|
2019-09-06 03:40:57 -05:00
|
|
|
else if ( sumCase->ensemble() )
|
2018-11-29 08:28:53 -06:00
|
|
|
{
|
2018-12-13 09:05:46 -06:00
|
|
|
zOrder = RiuQwtPlotCurve::Z_ENSEMBLE_CURVE;
|
2018-11-29 08:28:53 -06:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2018-12-13 09:05:46 -06:00
|
|
|
zOrder = RiuQwtPlotCurve::Z_SINGLE_CURVE_NON_OBSERVED;
|
2018-11-29 08:28:53 -06:00
|
|
|
}
|
|
|
|
}
|
2018-12-13 09:05:46 -06:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( m_isTopZWithinCategory )
|
2018-12-13 09:05:46 -06:00
|
|
|
{
|
|
|
|
zOrder += 1.0;
|
|
|
|
}
|
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
setZOrder( zOrder );
|
2018-11-29 08:28:53 -06:00
|
|
|
}
|
2019-09-06 03:40:57 -05:00
|
|
|
|
2018-11-29 08:28:53 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2016-10-10 04:05:45 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimSummaryCurve::updateQwtPlotAxis()
|
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( m_qwtPlotCurve )
|
2016-10-10 04:05:45 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( this->axisY() == RiaDefines::PLOT_AXIS_LEFT )
|
2016-10-10 04:05:45 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
m_qwtPlotCurve->setYAxis( QwtPlot::yLeft );
|
2016-10-10 04:05:45 -05:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
m_qwtPlotCurve->setYAxis( QwtPlot::yRight );
|
2016-10-10 04:05:45 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2016-06-09 03:55:48 -05:00
|
|
|
|
2016-11-04 09:23:44 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2016-11-04 09:23:44 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
void RimSummaryCurve::applyCurveAutoNameSettings( const RimSummaryCurveAutoName& autoNameSettings )
|
2016-11-04 09:23:44 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
m_curveNameConfig->applySettings( autoNameSettings );
|
2016-11-04 09:23:44 -05:00
|
|
|
}
|
|
|
|
|
2016-06-09 03:55:48 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2016-06-09 03:55:48 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
QString RimSummaryCurve::curveExportDescription( const RifEclipseSummaryAddress& address ) const
|
2018-06-28 08:15:25 -05:00
|
|
|
{
|
2019-08-27 09:18:00 -05:00
|
|
|
auto addr = address.isValid() ? address : m_yValuesSummaryAddress->address();
|
2018-06-28 08:15:25 -05:00
|
|
|
|
|
|
|
RimEnsembleCurveSetCollection* coll;
|
2019-09-06 03:40:57 -05:00
|
|
|
firstAncestorOrThisOfType( coll );
|
2018-06-28 08:15:25 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
auto curveSet = coll ? coll->findRimCurveSetFromQwtCurve( m_qwtPlotCurve ) : nullptr;
|
|
|
|
auto group = curveSet ? curveSet->summaryCaseCollection() : nullptr;
|
2018-06-28 08:15:25 -05:00
|
|
|
|
2019-08-27 00:35:35 -05:00
|
|
|
auto addressUiText = addr.uiText();
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( addr.category() == RifEclipseSummaryAddress::SUMMARY_ENSEMBLE_STATISTICS )
|
2019-08-27 00:35:35 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
addressUiText = RiaStatisticsTools::replacePercentileByPValueText( QString::fromStdString( addressUiText ) )
|
|
|
|
.toStdString();
|
2019-08-27 00:35:35 -05:00
|
|
|
}
|
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( group && group->isEnsemble() )
|
2018-06-28 08:15:25 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
return QString( "%1.%2.%3" )
|
|
|
|
.arg( QString::fromStdString( addressUiText ) )
|
|
|
|
.arg( m_yValuesSummaryCase->caseName() )
|
|
|
|
.arg( group->name() );
|
2018-06-28 08:15:25 -05:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
return QString( "%1.%2" ).arg( QString::fromStdString( addressUiText ) ).arg( m_yValuesSummaryCase->caseName() );
|
2018-06-28 08:15:25 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2018-06-28 08:15:25 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-08-16 07:40:12 -05:00
|
|
|
void RimSummaryCurve::setCurveAppearanceFromCaseType()
|
2018-07-09 06:58:01 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( m_yValuesSummaryCase )
|
2018-07-09 06:58:01 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( m_yValuesSummaryCase->isObservedData() )
|
2018-07-09 06:58:01 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
setLineStyle( RiuQwtPlotCurve::STYLE_NONE );
|
|
|
|
setSymbol( RiuQwtSymbol::SYMBOL_XCROSS );
|
2019-08-16 07:40:12 -05:00
|
|
|
|
|
|
|
return;
|
2018-07-09 06:58:01 -05:00
|
|
|
}
|
|
|
|
}
|
2019-08-16 08:41:58 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( m_yValuesSummaryAddress && m_yValuesSummaryAddress->address().isHistoryQuantity() )
|
2019-08-16 08:41:58 -05:00
|
|
|
{
|
|
|
|
RiaPreferences* prefs = RiaApplication::instance()->preferences();
|
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( prefs->defaultSummaryHistoryCurveStyle() == RiaPreferences::SYMBOLS )
|
2019-08-16 08:41:58 -05:00
|
|
|
{
|
2019-11-04 03:15:57 -06:00
|
|
|
m_symbolEdgeColor = m_curveColor;
|
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
setSymbol( RiuQwtSymbol::SYMBOL_XCROSS );
|
|
|
|
setLineStyle( RiuQwtPlotCurve::STYLE_NONE );
|
2019-08-16 08:41:58 -05:00
|
|
|
}
|
2019-09-06 03:40:57 -05:00
|
|
|
else if ( prefs->defaultSummaryHistoryCurveStyle() == RiaPreferences::SYMBOLS_AND_LINES )
|
2019-08-16 08:41:58 -05:00
|
|
|
{
|
2019-11-04 03:15:57 -06:00
|
|
|
m_symbolEdgeColor = m_curveColor;
|
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
setSymbol( RiuQwtSymbol::SYMBOL_XCROSS );
|
|
|
|
setLineStyle( RiuQwtPlotCurve::STYLE_SOLID );
|
2019-08-16 08:41:58 -05:00
|
|
|
}
|
2019-09-06 03:40:57 -05:00
|
|
|
else if ( prefs->defaultSummaryHistoryCurveStyle() == RiaPreferences::LINES )
|
2019-08-16 08:41:58 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
setSymbol( RiuQwtSymbol::SYMBOL_NONE );
|
|
|
|
setLineStyle( RiuQwtPlotCurve::STYLE_SOLID );
|
2019-08-16 08:41:58 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
2018-07-09 06:58:01 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2018-07-09 06:58:01 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-09-13 05:38:17 -05:00
|
|
|
void RimSummaryCurve::markCachedDataForPurge()
|
|
|
|
{
|
2018-09-18 04:29:45 -05:00
|
|
|
auto reader = valuesSummaryReaderY();
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( reader ) reader->markForCachePurge( m_yValuesSummaryAddress->address() );
|
2018-09-13 05:38:17 -05:00
|
|
|
}
|
|
|
|
|
2018-12-13 09:05:46 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2018-12-13 09:05:46 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
void RimSummaryCurve::setAsTopZWithinCategory( bool enable )
|
2018-12-13 09:05:46 -06:00
|
|
|
{
|
|
|
|
m_isTopZWithinCategory = enable;
|
|
|
|
}
|
|
|
|
|
2018-09-13 05:38:17 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2018-09-13 05:38:17 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
void RimSummaryCurve::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
|
|
|
const QVariant& oldValue,
|
|
|
|
const QVariant& newValue )
|
2016-06-09 03:55:48 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
this->RimPlotCurve::fieldChangedByUi( changedField, oldValue, newValue );
|
|
|
|
|
2016-10-10 04:05:45 -05:00
|
|
|
RimSummaryPlot* plot = nullptr;
|
2019-09-06 03:40:57 -05:00
|
|
|
firstAncestorOrThisOfType( plot );
|
|
|
|
CVF_ASSERT( plot );
|
2016-10-10 04:05:45 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
bool loadAndUpdate = false;
|
2017-11-21 04:52:49 -06:00
|
|
|
bool crossPlotTestForMatchingTimeSteps = false;
|
2017-11-15 08:20:47 -06:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( changedField == &m_yValuesSummaryAddressUiField )
|
2016-05-24 03:33:47 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
m_yValuesSummaryAddress->setAddress( m_yValuesSummaryAddressUiField() );
|
2016-06-09 03:55:48 -05:00
|
|
|
|
2017-08-22 08:24:35 -05:00
|
|
|
this->calculateCurveInterpolationFromAddress();
|
2016-06-22 07:34:56 -05:00
|
|
|
|
2017-11-15 08:20:47 -06:00
|
|
|
loadAndUpdate = true;
|
2019-09-06 03:40:57 -05:00
|
|
|
}
|
|
|
|
else if ( changedField == &m_xValuesSummaryAddressUiField )
|
2017-11-08 08:12:53 -06:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
m_xValuesSummaryAddress->setAddress( m_xValuesSummaryAddressUiField() );
|
2017-11-08 08:12:53 -06:00
|
|
|
|
|
|
|
this->calculateCurveInterpolationFromAddress();
|
|
|
|
|
2017-11-15 08:20:47 -06:00
|
|
|
loadAndUpdate = true;
|
2019-09-06 03:40:57 -05:00
|
|
|
}
|
|
|
|
else if ( &m_showCurve == changedField )
|
2016-06-22 07:34:56 -05:00
|
|
|
{
|
2016-10-11 12:40:45 -05:00
|
|
|
plot->updateAxes();
|
2017-12-14 07:25:49 -06:00
|
|
|
plot->updatePlotTitle();
|
2017-12-14 08:04:14 -06:00
|
|
|
plot->updateConnectedEditors();
|
2017-12-15 03:18:05 -06:00
|
|
|
|
2019-05-06 03:36:05 -05:00
|
|
|
RiuPlotMainWindow* mainPlotWindow = RiaGuiApplication::instance()->mainPlotWindow();
|
2017-12-15 03:18:05 -06:00
|
|
|
mainPlotWindow->updateSummaryPlotToolBar();
|
2018-12-13 09:05:46 -06:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( m_showCurve() == true )
|
2018-12-13 09:05:46 -06:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
plot->summaryCurveCollection()->setCurveAsTopZWithinCategory( this );
|
2018-12-13 09:05:46 -06:00
|
|
|
}
|
2016-05-09 05:13:54 -05:00
|
|
|
}
|
2019-09-06 03:40:57 -05:00
|
|
|
else if ( changedField == &m_plotAxis )
|
2016-10-10 04:05:45 -05:00
|
|
|
{
|
|
|
|
updateQwtPlotAxis();
|
|
|
|
|
2016-10-11 12:40:45 -05:00
|
|
|
plot->updateAxes();
|
2016-10-10 04:05:45 -05:00
|
|
|
}
|
2019-09-06 03:40:57 -05:00
|
|
|
else if ( changedField == &m_yValuesSummaryCase )
|
2017-09-12 08:26:11 -05:00
|
|
|
{
|
2018-05-28 07:25:45 -05:00
|
|
|
PdmObjectHandle* oldVal = oldValue.value<caf::PdmPointer<PdmObjectHandle>>().rawPtr();
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( oldVal == nullptr && m_yValuesSummaryCase->isObservedData() )
|
2018-05-28 07:25:45 -05:00
|
|
|
{
|
|
|
|
// If no previous case selected and observed data, use symbols to indicate observed data curve
|
2019-09-06 03:40:57 -05:00
|
|
|
setLineStyle( RiuQwtPlotCurve::STYLE_NONE );
|
|
|
|
setSymbol( RiuQwtSymbol::SYMBOL_XCROSS );
|
2018-05-28 07:25:45 -05:00
|
|
|
}
|
2017-09-12 08:26:11 -05:00
|
|
|
plot->updateCaseNameHasChanged();
|
2019-09-06 03:40:57 -05:00
|
|
|
this->onLoadDataAndUpdate( true );
|
2017-09-12 08:26:11 -05:00
|
|
|
}
|
2019-09-06 03:40:57 -05:00
|
|
|
else if ( changedField == &m_yPushButtonSelectSummaryAddress )
|
2017-11-15 08:20:47 -06:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
RiuSummaryCurveDefSelectionDialog dlg( nullptr );
|
|
|
|
RimSummaryCase* candidateCase = m_yValuesSummaryCase();
|
|
|
|
RifEclipseSummaryAddress candicateAddress = m_yValuesSummaryAddress->address();
|
2017-11-27 00:17:26 -06:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( candidateCase == nullptr )
|
2017-11-27 00:17:26 -06:00
|
|
|
{
|
|
|
|
candidateCase = m_xValuesSummaryCase();
|
|
|
|
}
|
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( !candicateAddress.isValid() )
|
2017-11-27 00:17:26 -06:00
|
|
|
{
|
2019-08-27 09:18:00 -05:00
|
|
|
candicateAddress = m_xValuesSummaryAddress->address();
|
2017-11-27 00:17:26 -06:00
|
|
|
}
|
|
|
|
|
2018-05-11 06:24:46 -05:00
|
|
|
dlg.hideEnsembles();
|
2019-09-06 03:40:57 -05:00
|
|
|
dlg.setCaseAndAddress( candidateCase, candicateAddress );
|
|
|
|
|
|
|
|
if ( dlg.exec() == QDialog::Accepted )
|
2017-11-15 08:20:47 -06:00
|
|
|
{
|
|
|
|
auto curveSelection = dlg.curveSelection();
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( curveSelection.size() > 0 )
|
2017-11-15 08:20:47 -06:00
|
|
|
{
|
|
|
|
m_yValuesSummaryCase = curveSelection[0].summaryCase();
|
2019-09-06 03:40:57 -05:00
|
|
|
m_yValuesSummaryAddress->setAddress( curveSelection[0].summaryAddress() );
|
2017-11-15 08:20:47 -06:00
|
|
|
|
2017-11-21 04:52:49 -06:00
|
|
|
crossPlotTestForMatchingTimeSteps = true;
|
2019-09-06 03:40:57 -05:00
|
|
|
loadAndUpdate = true;
|
2017-11-15 08:20:47 -06:00
|
|
|
}
|
|
|
|
}
|
2017-11-16 06:06:16 -06:00
|
|
|
|
|
|
|
m_yPushButtonSelectSummaryAddress = false;
|
2017-11-15 08:20:47 -06:00
|
|
|
}
|
2019-09-06 03:40:57 -05:00
|
|
|
else if ( changedField == &m_xPushButtonSelectSummaryAddress )
|
2017-11-15 08:20:47 -06:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
RiuSummaryCurveDefSelectionDialog dlg( nullptr );
|
|
|
|
RimSummaryCase* candidateCase = m_xValuesSummaryCase();
|
|
|
|
RifEclipseSummaryAddress candicateAddress = m_xValuesSummaryAddress->address();
|
2017-11-27 00:17:26 -06:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( candidateCase == nullptr )
|
2017-11-27 00:17:26 -06:00
|
|
|
{
|
|
|
|
candidateCase = m_yValuesSummaryCase();
|
|
|
|
}
|
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( !candicateAddress.isValid() )
|
2017-11-27 00:17:26 -06:00
|
|
|
{
|
2019-08-27 09:18:00 -05:00
|
|
|
candicateAddress = m_yValuesSummaryAddress->address();
|
2017-11-27 00:17:26 -06:00
|
|
|
}
|
|
|
|
|
2018-05-11 06:24:46 -05:00
|
|
|
dlg.hideEnsembles();
|
2019-09-06 03:40:57 -05:00
|
|
|
dlg.setCaseAndAddress( candidateCase, candicateAddress );
|
2017-11-15 08:20:47 -06:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( dlg.exec() == QDialog::Accepted )
|
2017-11-15 08:20:47 -06:00
|
|
|
{
|
|
|
|
auto curveSelection = dlg.curveSelection();
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( curveSelection.size() > 0 )
|
2017-11-15 08:20:47 -06:00
|
|
|
{
|
|
|
|
m_xValuesSummaryCase = curveSelection[0].summaryCase();
|
2019-09-06 03:40:57 -05:00
|
|
|
m_xValuesSummaryAddress->setAddress( curveSelection[0].summaryAddress() );
|
2017-11-15 08:20:47 -06:00
|
|
|
|
2017-11-21 04:52:49 -06:00
|
|
|
crossPlotTestForMatchingTimeSteps = true;
|
2019-09-06 03:40:57 -05:00
|
|
|
loadAndUpdate = true;
|
2017-11-15 08:20:47 -06:00
|
|
|
}
|
|
|
|
}
|
2017-11-16 06:06:16 -06:00
|
|
|
|
|
|
|
m_xPushButtonSelectSummaryAddress = false;
|
2017-11-15 08:20:47 -06:00
|
|
|
}
|
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( crossPlotTestForMatchingTimeSteps )
|
2017-11-21 04:52:49 -06:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
auto curveValuesX = this->valuesX();
|
2017-11-21 04:52:49 -06:00
|
|
|
auto curveTimeStepsX = timeStepsX();
|
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
auto curveValuesY = this->valuesY();
|
2017-11-21 04:52:49 -06:00
|
|
|
auto curveTimeStepsY = timeStepsY();
|
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( !curveValuesX.empty() && !curveValuesY.empty() )
|
2017-11-21 04:52:49 -06:00
|
|
|
{
|
2018-06-08 08:10:45 -05:00
|
|
|
RiaTimeHistoryCurveMerger curveMerger;
|
2019-09-06 03:40:57 -05:00
|
|
|
curveMerger.addCurveData( curveTimeStepsX, curveValuesX );
|
|
|
|
curveMerger.addCurveData( curveTimeStepsY, curveValuesY );
|
2017-11-21 04:52:49 -06:00
|
|
|
curveMerger.computeInterpolatedValues();
|
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( curveMerger.validIntervalsForAllXValues().size() == 0 )
|
2017-11-21 04:52:49 -06:00
|
|
|
{
|
|
|
|
QString description;
|
|
|
|
|
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
QDateTime first = QDateTime::fromTime_t( curveTimeStepsX.front() );
|
|
|
|
QDateTime last = QDateTime::fromTime_t( curveTimeStepsX.back() );
|
2017-11-21 04:52:49 -06:00
|
|
|
|
|
|
|
std::vector<QDateTime> timeSteps;
|
2019-09-06 03:40:57 -05:00
|
|
|
timeSteps.push_back( first );
|
|
|
|
timeSteps.push_back( last );
|
2017-11-21 04:52:49 -06:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
QString formatString = RiaQDateTimeTools::createTimeFormatStringFromDates( timeSteps );
|
2017-11-21 04:52:49 -06:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
description += QString( "Time step range for X : '%1' - '%2'" )
|
|
|
|
.arg( first.toString( formatString ) )
|
|
|
|
.arg( last.toString( formatString ) );
|
2017-11-21 04:52:49 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
QDateTime first = QDateTime::fromTime_t( curveTimeStepsY.front() );
|
|
|
|
QDateTime last = QDateTime::fromTime_t( curveTimeStepsY.back() );
|
2017-11-21 04:52:49 -06:00
|
|
|
|
|
|
|
std::vector<QDateTime> timeSteps;
|
2019-09-06 03:40:57 -05:00
|
|
|
timeSteps.push_back( first );
|
|
|
|
timeSteps.push_back( last );
|
2017-11-21 04:52:49 -06:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
QString formatString = RiaQDateTimeTools::createTimeFormatStringFromDates( timeSteps );
|
2017-11-21 04:52:49 -06:00
|
|
|
|
|
|
|
description += "\n";
|
2019-09-06 03:40:57 -05:00
|
|
|
description += QString( "Time step range for Y : '%1' - '%2'" )
|
|
|
|
.arg( first.toString( formatString ) )
|
|
|
|
.arg( last.toString( formatString ) );
|
2017-11-21 04:52:49 -06:00
|
|
|
}
|
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
QMessageBox::warning( nullptr, "Detected no overlapping time steps", description );
|
2017-11-21 04:52:49 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( loadAndUpdate )
|
2017-11-15 08:20:47 -06:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
this->loadDataAndUpdate( true );
|
2017-11-15 08:20:47 -06:00
|
|
|
|
|
|
|
plot->updateAxes();
|
2017-12-14 07:25:49 -06:00
|
|
|
plot->updatePlotTitle();
|
2017-12-14 08:04:14 -06:00
|
|
|
plot->updateConnectedEditors();
|
2017-12-15 03:18:05 -06:00
|
|
|
|
2019-05-06 03:36:05 -05:00
|
|
|
RiuPlotMainWindow* mainPlotWindow = RiaGuiApplication::instance()->mainPlotWindow();
|
2017-12-15 03:18:05 -06:00
|
|
|
mainPlotWindow->updateSummaryPlotToolBar();
|
2017-11-15 08:20:47 -06:00
|
|
|
}
|
2017-12-14 01:56:11 -06:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( &m_showCurve == changedField )
|
2017-12-14 01:56:11 -06:00
|
|
|
{
|
|
|
|
// If no plot collection is found, we assume that we are inside a curve creator
|
|
|
|
// Update the summary curve collection to make sure the curve names are updated in curve creator UI
|
|
|
|
|
|
|
|
RimSummaryPlotCollection* plotCollection = nullptr;
|
2019-09-06 03:40:57 -05:00
|
|
|
this->firstAncestorOrThisOfType( plotCollection );
|
|
|
|
if ( !plotCollection )
|
2017-12-14 01:56:11 -06:00
|
|
|
{
|
|
|
|
RimSummaryCurveCollection* curveColl = nullptr;
|
2019-09-06 03:40:57 -05:00
|
|
|
this->firstAncestorOrThisOfType( curveColl );
|
|
|
|
if ( curveColl )
|
2017-12-14 01:56:11 -06:00
|
|
|
{
|
|
|
|
curveColl->updateConnectedEditors();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2016-05-09 05:13:54 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2016-05-09 05:13:54 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2017-11-15 04:36:33 -06:00
|
|
|
RifSummaryReaderInterface* RimSummaryCurve::valuesSummaryReaderX() const
|
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( !m_xValuesSummaryCase() ) return nullptr;
|
2017-11-15 04:36:33 -06:00
|
|
|
|
|
|
|
return m_xValuesSummaryCase()->summaryReader();
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2017-11-15 04:36:33 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
RifSummaryReaderInterface* RimSummaryCurve::valuesSummaryReaderY() const
|
2016-05-09 05:13:54 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( !m_yValuesSummaryCase() ) return nullptr;
|
2016-05-31 06:42:27 -05:00
|
|
|
|
2017-11-08 06:09:05 -06:00
|
|
|
return m_yValuesSummaryCase()->summaryReader();
|
2016-05-09 05:13:54 -05:00
|
|
|
}
|
|
|
|
|
2017-11-21 03:39:20 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2017-11-21 03:39:20 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
const std::vector<time_t>& RimSummaryCurve::timeStepsX() const
|
|
|
|
{
|
|
|
|
static std::vector<time_t> emptyVector;
|
|
|
|
RifSummaryReaderInterface* reader = valuesSummaryReaderX();
|
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( !reader ) return emptyVector;
|
2017-11-21 03:39:20 -06:00
|
|
|
|
2019-08-27 09:18:00 -05:00
|
|
|
RifEclipseSummaryAddress addr = m_xValuesSummaryAddress()->address();
|
2017-11-21 03:39:20 -06:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
return reader->timeSteps( addr );
|
2017-11-21 03:39:20 -06:00
|
|
|
}
|
|
|
|
|
2017-08-22 08:24:35 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2017-08-22 08:24:35 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimSummaryCurve::calculateCurveInterpolationFromAddress()
|
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( m_yValuesSummaryAddress() )
|
2017-08-22 08:24:35 -05:00
|
|
|
{
|
2019-08-27 09:18:00 -05:00
|
|
|
auto address = m_yValuesSummaryAddress()->address();
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( address.hasAccumulatedData() )
|
2017-08-22 08:24:35 -05:00
|
|
|
{
|
2018-09-04 02:08:29 -05:00
|
|
|
m_curveInterpolation = RiuQwtPlotCurve::INTERPOLATION_POINT_TO_POINT;
|
2017-08-22 08:24:35 -05:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2018-09-04 02:08:29 -05:00
|
|
|
m_curveInterpolation = RiuQwtPlotCurve::INTERPOLATION_STEP_LEFT;
|
2017-08-22 08:24:35 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|