2017-09-08 07:49:41 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
2017-09-14 06:56:50 -05:00
|
|
|
// Copyright (C) 2017- Statoil ASA
|
2019-09-06 03:40:57 -05:00
|
|
|
//
|
2017-09-08 07:49:41 -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
|
|
|
//
|
2017-09-08 07:49:41 -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>
|
2017-09-08 07:49:41 -05:00
|
|
|
// for more details.
|
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#include "RimSummaryCurveCollection.h"
|
|
|
|
|
2018-12-17 08:54:23 -06:00
|
|
|
#include "RiaStdStringTools.h"
|
2017-11-27 01:24:15 -06:00
|
|
|
|
2019-10-25 06:53:51 -05:00
|
|
|
#include "SummaryPlotCommands/RicEditSummaryPlotFeature.h"
|
|
|
|
|
2017-09-14 06:56:50 -05:00
|
|
|
#include "RimProject.h"
|
2017-09-08 07:49:41 -05:00
|
|
|
#include "RimSummaryCase.h"
|
2017-12-01 04:46:29 -06:00
|
|
|
#include "RimSummaryCrossPlot.h"
|
2017-09-14 06:56:50 -05:00
|
|
|
#include "RimSummaryCurve.h"
|
|
|
|
#include "RimSummaryPlot.h"
|
2017-12-01 04:46:29 -06:00
|
|
|
#include "RimSummaryPlotSourceStepping.h"
|
2017-09-14 06:56:50 -05:00
|
|
|
|
2019-02-25 07:54:36 -06:00
|
|
|
#include "RiuQwtPlotCurve.h"
|
2019-09-06 03:40:57 -05:00
|
|
|
#include "RiuSummaryQwtPlot.h"
|
2017-09-14 06:56:50 -05:00
|
|
|
|
2020-08-05 08:30:07 -05:00
|
|
|
#include "cafPdmFieldReorderCapability.h"
|
2019-10-25 06:53:51 -05:00
|
|
|
#include "cafPdmUiPushButtonEditor.h"
|
2022-02-04 08:49:22 -06:00
|
|
|
#include "cafPdmUiTreeAttributes.h"
|
2017-09-27 01:12:01 -05:00
|
|
|
#include "cafPdmUiTreeViewEditor.h"
|
|
|
|
|
2019-02-25 07:54:36 -06:00
|
|
|
#include "qwt_plot.h"
|
|
|
|
|
2017-12-04 01:26:23 -06:00
|
|
|
#include <QKeyEvent>
|
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
CAF_PDM_SOURCE_INIT( RimSummaryCurveCollection, "RimSummaryCurveCollection" );
|
2017-09-08 07:49:41 -05:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2017-09-08 07:49:41 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
RimSummaryCurveCollection::RimSummaryCurveCollection()
|
2020-09-25 03:31:51 -05:00
|
|
|
: curvesChanged( this )
|
2017-09-08 07:49:41 -05:00
|
|
|
{
|
2022-01-07 01:31:52 -06:00
|
|
|
CAF_PDM_InitObject( "Summary Curves", ":/SummaryCurveFilter16x16.png" );
|
2017-11-23 02:15:29 -06:00
|
|
|
|
2021-11-14 07:15:12 -06:00
|
|
|
CAF_PDM_InitFieldNoDefault( &m_curves, "CollectionCurves", "Collection Curves" );
|
2021-10-13 06:39:46 -05:00
|
|
|
m_curves.uiCapability()->setUiTreeHidden( true );
|
2019-09-06 03:40:57 -05:00
|
|
|
m_curves.uiCapability()->setUiTreeChildrenHidden( false );
|
2020-08-10 01:37:17 -05:00
|
|
|
caf::PdmFieldReorderCapability::addToFieldWithCallback( &m_curves, this, &RimSummaryCurveCollection::onCurvesReordered );
|
2017-09-14 06:56:50 -05:00
|
|
|
|
2021-11-14 07:15:12 -06:00
|
|
|
CAF_PDM_InitField( &m_showCurves, "IsActive", true, "Show Curves" );
|
2019-09-06 03:40:57 -05:00
|
|
|
m_showCurves.uiCapability()->setUiHidden( true );
|
2021-10-13 06:39:46 -05:00
|
|
|
m_showCurves.uiCapability()->setUiTreeHidden( true );
|
2017-11-23 02:15:29 -06:00
|
|
|
|
2021-11-14 07:15:12 -06:00
|
|
|
CAF_PDM_InitField( &m_editPlot, "EditPlot", false, "" );
|
2019-10-25 06:53:51 -05:00
|
|
|
m_editPlot.xmlCapability()->disableIO();
|
|
|
|
m_editPlot.uiCapability()->setUiEditorTypeName( caf::PdmUiPushButtonEditor::uiEditorTypeName() );
|
|
|
|
|
2021-11-14 07:15:12 -06:00
|
|
|
CAF_PDM_InitFieldNoDefault( &m_ySourceStepping, "YSourceStepping", "" );
|
2017-12-01 04:46:29 -06:00
|
|
|
m_ySourceStepping = new RimSummaryPlotSourceStepping;
|
2022-01-06 08:18:09 -06:00
|
|
|
m_ySourceStepping->setSourceSteppingType( RimSummaryDataSourceStepping::Axis::Y_AXIS );
|
2021-10-13 06:39:46 -05:00
|
|
|
m_ySourceStepping.uiCapability()->setUiTreeHidden( true );
|
2019-09-06 03:40:57 -05:00
|
|
|
m_ySourceStepping.uiCapability()->setUiTreeChildrenHidden( true );
|
2017-12-01 04:46:29 -06:00
|
|
|
m_ySourceStepping.xmlCapability()->disableIO();
|
|
|
|
|
2021-11-14 07:15:12 -06:00
|
|
|
CAF_PDM_InitFieldNoDefault( &m_xSourceStepping, "XSourceStepping", "" );
|
2017-12-01 04:46:29 -06:00
|
|
|
m_xSourceStepping = new RimSummaryPlotSourceStepping;
|
2022-01-06 08:18:09 -06:00
|
|
|
m_xSourceStepping->setSourceSteppingType( RimSummaryDataSourceStepping::Axis::X_AXIS );
|
2021-10-13 06:39:46 -05:00
|
|
|
m_xSourceStepping.uiCapability()->setUiTreeHidden( true );
|
2019-09-06 03:40:57 -05:00
|
|
|
m_xSourceStepping.uiCapability()->setUiTreeChildrenHidden( true );
|
2017-12-01 04:46:29 -06:00
|
|
|
m_xSourceStepping.xmlCapability()->disableIO();
|
|
|
|
|
2021-11-14 07:15:12 -06:00
|
|
|
CAF_PDM_InitFieldNoDefault( &m_unionSourceStepping, "UnionSourceStepping", "" );
|
2017-12-01 04:46:29 -06:00
|
|
|
m_unionSourceStepping = new RimSummaryPlotSourceStepping;
|
2022-01-06 08:18:09 -06:00
|
|
|
m_unionSourceStepping->setSourceSteppingType( RimSummaryDataSourceStepping::Axis::UNION_X_Y_AXIS );
|
2021-10-13 06:39:46 -05:00
|
|
|
m_unionSourceStepping.uiCapability()->setUiTreeHidden( true );
|
2019-09-06 03:40:57 -05:00
|
|
|
m_unionSourceStepping.uiCapability()->setUiTreeChildrenHidden( true );
|
2017-12-01 04:46:29 -06:00
|
|
|
m_unionSourceStepping.xmlCapability()->disableIO();
|
2017-09-08 07:49:41 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2017-09-08 07:49:41 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
RimSummaryCurveCollection::~RimSummaryCurveCollection()
|
|
|
|
{
|
2022-05-31 06:08:07 -05:00
|
|
|
m_curves.deleteChildren();
|
2017-09-14 06:56:50 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2017-09-14 06:56:50 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
bool RimSummaryCurveCollection::isCurvesVisible()
|
|
|
|
{
|
|
|
|
return m_showCurves();
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2017-09-14 06:56:50 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
void RimSummaryCurveCollection::loadDataAndUpdate( bool updateParentPlot )
|
2017-09-14 06:56:50 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
for ( RimSummaryCurve* curve : m_curves )
|
2017-09-14 06:56:50 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
curve->loadDataAndUpdate( false );
|
2022-01-17 06:14:21 -06:00
|
|
|
curve->updatePlotAxis();
|
2017-09-23 01:47:04 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
if ( updateParentPlot )
|
|
|
|
{
|
|
|
|
RimSummaryPlot* parentPlot;
|
2019-09-06 03:40:57 -05:00
|
|
|
firstAncestorOrThisOfTypeAsserted( parentPlot );
|
2018-06-01 08:37:47 -05:00
|
|
|
parentPlot->updateAll();
|
2017-09-14 06:56:50 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-05-26 10:25:17 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimSummaryCurveCollection::onChildrenUpdated( caf::PdmChildArrayFieldHandle* childArray,
|
|
|
|
std::vector<caf::PdmObjectHandle*>& updatedObjects )
|
|
|
|
{
|
|
|
|
if ( childArray == &m_curves )
|
|
|
|
{
|
|
|
|
for ( RimSummaryCurve* curve : m_curves )
|
|
|
|
{
|
|
|
|
curve->updateCurveAppearance();
|
|
|
|
}
|
|
|
|
|
|
|
|
RimSummaryPlot* parentPlot;
|
|
|
|
firstAncestorOrThisOfTypeAsserted( parentPlot );
|
|
|
|
parentPlot->plotWidget()->scheduleReplot();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-09-14 06:56:50 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2017-09-14 06:56:50 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2022-01-17 06:14:21 -06:00
|
|
|
void RimSummaryCurveCollection::setParentPlotAndReplot( RiuPlotWidget* plot )
|
2022-04-01 12:23:27 -05:00
|
|
|
{
|
|
|
|
setParentPlotNoReplot( plot );
|
|
|
|
|
|
|
|
if ( plot ) plot->replot();
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimSummaryCurveCollection::setParentPlotNoReplot( RiuPlotWidget* plot )
|
2017-09-14 06:56:50 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
for ( RimSummaryCurve* curve : m_curves )
|
2017-09-14 06:56:50 -05:00
|
|
|
{
|
2022-01-17 06:14:21 -06:00
|
|
|
curve->setParentPlotNoReplot( plot );
|
2017-09-14 06:56:50 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2017-09-14 06:56:50 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2022-01-17 06:14:21 -06:00
|
|
|
void RimSummaryCurveCollection::detachPlotCurves()
|
2017-09-14 06:56:50 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
for ( RimSummaryCurve* curve : m_curves )
|
2017-09-14 06:56:50 -05:00
|
|
|
{
|
2022-01-17 06:14:21 -06:00
|
|
|
curve->detach();
|
2017-09-14 06:56:50 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-09-07 07:26:14 -05:00
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2022-01-17 06:14:21 -06:00
|
|
|
void RimSummaryCurveCollection::reattachPlotCurves()
|
2018-09-07 07:26:14 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
for ( RimSummaryCurve* curve : m_curves )
|
2018-09-07 07:26:14 -05:00
|
|
|
{
|
2022-01-20 05:52:36 -06:00
|
|
|
if ( curve->isCurveVisible() ) curve->reattach();
|
2018-09-07 07:26:14 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2017-09-14 06:56:50 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2022-01-17 06:14:21 -06:00
|
|
|
RimSummaryCurve* RimSummaryCurveCollection::findRimCurveFromPlotCurve( const RiuPlotCurve* curve ) const
|
2017-09-14 06:56:50 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
for ( RimSummaryCurve* rimCurve : m_curves )
|
2017-09-14 06:56:50 -05:00
|
|
|
{
|
2022-01-17 06:14:21 -06:00
|
|
|
if ( rimCurve->isSameCurve( curve ) )
|
2017-09-14 06:56:50 -05:00
|
|
|
{
|
|
|
|
return rimCurve;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-02-18 11:56:43 -06:00
|
|
|
return nullptr;
|
2017-09-08 07:49:41 -05:00
|
|
|
}
|
|
|
|
|
2017-09-14 06:56:50 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2017-09-14 06:56:50 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
void RimSummaryCurveCollection::addCurve( RimSummaryCurve* curve )
|
2017-09-08 07:49:41 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( curve )
|
2017-09-08 07:49:41 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
m_curves.push_back( curve );
|
2017-09-14 06:56:50 -05:00
|
|
|
}
|
|
|
|
}
|
2017-09-08 07:49:41 -05:00
|
|
|
|
2020-07-03 06:39:52 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimSummaryCurveCollection::insertCurve( RimSummaryCurve* curve, size_t index )
|
|
|
|
{
|
|
|
|
if ( index >= m_curves.size() )
|
|
|
|
{
|
|
|
|
m_curves.push_back( curve );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
m_curves.insert( index, curve );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-09-14 06:56:50 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2017-09-14 06:56:50 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
void RimSummaryCurveCollection::deleteCurve( RimSummaryCurve* curve )
|
2017-09-14 06:56:50 -05:00
|
|
|
{
|
2020-07-03 06:39:52 -05:00
|
|
|
removeCurve( curve );
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( curve )
|
2017-09-14 06:56:50 -05:00
|
|
|
{
|
|
|
|
delete curve;
|
|
|
|
}
|
|
|
|
}
|
2017-09-08 07:49:41 -05:00
|
|
|
|
2020-07-03 06:39:52 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimSummaryCurveCollection::removeCurve( RimSummaryCurve* curve )
|
|
|
|
{
|
|
|
|
if ( curve )
|
|
|
|
{
|
2022-05-31 06:08:07 -05:00
|
|
|
m_curves.removeChild( curve );
|
2020-07-03 06:39:52 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-09-14 06:56:50 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2017-09-14 06:56:50 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2017-11-27 01:24:15 -06:00
|
|
|
std::vector<RimSummaryCurve*> RimSummaryCurveCollection::curves() const
|
2017-09-14 06:56:50 -05:00
|
|
|
{
|
2022-05-31 06:08:07 -05:00
|
|
|
return m_curves.children();
|
2017-09-14 06:56:50 -05:00
|
|
|
}
|
|
|
|
|
2018-12-17 08:54:23 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2018-12-17 08:54:23 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
std::vector<RimSummaryCurve*>
|
2022-01-06 08:18:09 -06:00
|
|
|
RimSummaryCurveCollection::curvesForSourceStepping( RimSummaryDataSourceStepping::Axis steppingType ) const
|
2018-12-17 08:54:23 -06:00
|
|
|
{
|
|
|
|
std::vector<RimSummaryCurve*> stepCurves;
|
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( m_curveForSourceStepping )
|
2018-12-17 08:54:23 -06:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
stepCurves.push_back( m_curveForSourceStepping );
|
2018-12-17 08:54:23 -06:00
|
|
|
|
|
|
|
{
|
|
|
|
// Add corresponding history/summary curve with or without H
|
|
|
|
|
|
|
|
const std::string historyIdentifier = "H";
|
|
|
|
|
2022-05-06 09:34:37 -05:00
|
|
|
std::string vectorName;
|
2018-12-18 14:22:25 -06:00
|
|
|
|
2022-01-06 08:18:09 -06:00
|
|
|
if ( steppingType == RimSummaryDataSourceStepping::Axis::X_AXIS )
|
2018-12-18 14:22:25 -06:00
|
|
|
{
|
2022-05-06 09:34:37 -05:00
|
|
|
vectorName = m_curveForSourceStepping->summaryAddressX().vectorName();
|
2018-12-18 14:22:25 -06:00
|
|
|
}
|
2022-01-06 08:18:09 -06:00
|
|
|
else if ( steppingType == RimSummaryDataSourceStepping::Axis::Y_AXIS )
|
2018-12-18 14:22:25 -06:00
|
|
|
{
|
2022-05-06 09:34:37 -05:00
|
|
|
vectorName = m_curveForSourceStepping->summaryAddressY().vectorName();
|
2018-12-18 14:22:25 -06:00
|
|
|
}
|
2018-12-17 08:54:23 -06:00
|
|
|
|
|
|
|
std::string candidateName;
|
2022-05-06 09:34:37 -05:00
|
|
|
if ( RiaStdStringTools::endsWith( vectorName, historyIdentifier ) )
|
2018-12-17 08:54:23 -06:00
|
|
|
{
|
2022-05-06 09:34:37 -05:00
|
|
|
candidateName = vectorName.substr( 0, vectorName.size() - 1 );
|
2018-12-17 08:54:23 -06:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2022-05-06 09:34:37 -05:00
|
|
|
candidateName = vectorName + historyIdentifier;
|
2018-12-17 08:54:23 -06:00
|
|
|
}
|
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
for ( const auto& c : curves() )
|
2018-12-17 08:54:23 -06:00
|
|
|
{
|
2022-01-06 08:18:09 -06:00
|
|
|
if ( steppingType == RimSummaryDataSourceStepping::Axis::X_AXIS )
|
2018-12-18 14:22:25 -06:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( c->summaryCaseX() == m_curveForSourceStepping->summaryCaseX() &&
|
2022-05-06 09:34:37 -05:00
|
|
|
c->summaryAddressX().vectorName() == candidateName )
|
2018-12-18 14:22:25 -06:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
stepCurves.push_back( c );
|
2018-12-18 14:22:25 -06:00
|
|
|
}
|
|
|
|
}
|
2022-01-06 08:18:09 -06:00
|
|
|
else if ( steppingType == RimSummaryDataSourceStepping::Axis::Y_AXIS )
|
2018-12-17 08:54:23 -06:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( c->summaryCaseY() == m_curveForSourceStepping->summaryCaseY() &&
|
2022-05-06 09:34:37 -05:00
|
|
|
c->summaryAddressY().vectorName() == candidateName )
|
2018-12-18 14:22:25 -06:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
stepCurves.push_back( c );
|
2018-12-18 14:22:25 -06:00
|
|
|
}
|
2018-12-17 08:54:23 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
stepCurves = curves();
|
|
|
|
}
|
|
|
|
|
|
|
|
return stepCurves;
|
|
|
|
}
|
|
|
|
|
2017-09-14 06:56:50 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2017-09-14 06:56:50 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
void RimSummaryCurveCollection::deleteCurvesAssosiatedWithCase( RimSummaryCase* summaryCase )
|
2017-09-14 06:56:50 -05:00
|
|
|
{
|
|
|
|
std::vector<RimSummaryCurve*> summaryCurvesToDelete;
|
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
for ( RimSummaryCurve* summaryCurve : m_curves )
|
2017-09-14 06:56:50 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( !summaryCurve ) continue;
|
|
|
|
if ( !summaryCurve->summaryCaseY() ) continue;
|
2017-09-14 06:56:50 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( summaryCurve->summaryCaseY() == summaryCase )
|
2017-09-14 06:56:50 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
summaryCurvesToDelete.push_back( summaryCurve );
|
2017-09-14 06:56:50 -05:00
|
|
|
}
|
|
|
|
}
|
2019-09-06 03:40:57 -05:00
|
|
|
for ( RimSummaryCurve* summaryCurve : summaryCurvesToDelete )
|
2017-09-14 06:56:50 -05:00
|
|
|
{
|
2022-05-31 06:08:07 -05:00
|
|
|
m_curves.removeChild( summaryCurve );
|
2017-09-14 06:56:50 -05:00
|
|
|
delete summaryCurve;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-09-15 07:34:33 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2017-09-15 07:34:33 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimSummaryCurveCollection::deleteAllCurves()
|
|
|
|
{
|
2022-05-31 06:08:07 -05:00
|
|
|
m_curves.deleteChildren();
|
2017-09-15 07:34:33 -05:00
|
|
|
}
|
|
|
|
|
2017-09-14 06:56:50 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2017-09-14 06:56:50 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimSummaryCurveCollection::updateCaseNameHasChanged()
|
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
for ( RimSummaryCurve* curve : m_curves )
|
2017-09-14 06:56:50 -05:00
|
|
|
{
|
2017-09-23 01:47:04 -05:00
|
|
|
curve->updateCurveNameNoLegendUpdate();
|
2017-09-14 06:56:50 -05:00
|
|
|
curve->updateConnectedEditors();
|
2017-09-08 07:49:41 -05:00
|
|
|
}
|
2017-09-23 01:47:04 -05:00
|
|
|
|
|
|
|
RimSummaryPlot* parentPlot;
|
2019-09-06 03:40:57 -05:00
|
|
|
firstAncestorOrThisOfTypeAsserted( parentPlot );
|
2018-05-15 01:43:36 -05:00
|
|
|
|
|
|
|
parentPlot->updatePlotTitle();
|
2022-01-17 06:14:21 -06:00
|
|
|
if ( parentPlot->plotWidget() ) parentPlot->plotWidget()->updateLegend();
|
2017-09-08 07:49:41 -05:00
|
|
|
}
|
2017-09-14 06:56:50 -05:00
|
|
|
|
2017-09-27 01:12:01 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2017-09-27 01:12:01 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
void RimSummaryCurveCollection::setCurrentSummaryCurve( RimSummaryCurve* curve )
|
2017-09-27 01:12:01 -05:00
|
|
|
{
|
|
|
|
m_currentSummaryCurve = curve;
|
|
|
|
|
|
|
|
updateConnectedEditors();
|
|
|
|
}
|
|
|
|
|
2017-11-29 05:55:42 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2017-11-29 05:55:42 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
std::vector<caf::PdmFieldHandle*> RimSummaryCurveCollection::fieldsToShowInToolbar()
|
|
|
|
{
|
2017-12-01 04:46:29 -06:00
|
|
|
RimSummaryCrossPlot* parentCrossPlot;
|
2019-09-06 03:40:57 -05:00
|
|
|
firstAncestorOrThisOfType( parentCrossPlot );
|
2017-12-01 04:46:29 -06:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( parentCrossPlot )
|
2017-12-01 04:46:29 -06:00
|
|
|
{
|
|
|
|
return m_unionSourceStepping->fieldsToShowInToolbar();
|
|
|
|
}
|
|
|
|
|
|
|
|
return m_ySourceStepping()->fieldsToShowInToolbar();
|
2017-11-29 05:55:42 -06: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 RimSummaryCurveCollection::setCurveAsTopZWithinCategory( RimSummaryCurve* curve )
|
2018-12-13 09:05:46 -06:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
for ( const auto& c : m_curves )
|
2018-12-13 09:05:46 -06:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( c == curve )
|
2018-12-13 09:05:46 -06:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
c->setAsTopZWithinCategory( true );
|
2018-12-13 09:05:46 -06:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
c->setAsTopZWithinCategory( false );
|
2018-12-13 09:05:46 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
c->setZIndexFromCurveInfo();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-12-17 08:54:23 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2018-12-17 08:54:23 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
void RimSummaryCurveCollection::setCurveForSourceStepping( RimSummaryCurve* curve )
|
2018-12-17 08:54:23 -06:00
|
|
|
{
|
|
|
|
m_curveForSourceStepping = curve;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2018-12-17 08:54:23 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
RimSummaryCurve* RimSummaryCurveCollection::curveForSourceStepping() const
|
|
|
|
{
|
|
|
|
return m_curveForSourceStepping;
|
|
|
|
}
|
|
|
|
|
2019-10-04 06:20:15 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2020-02-12 04:43:15 -06:00
|
|
|
RimSummaryPlotSourceStepping*
|
2022-01-06 08:18:09 -06:00
|
|
|
RimSummaryCurveCollection::sourceSteppingObject( RimSummaryDataSourceStepping::Axis sourceSteppingType ) const
|
2019-10-04 06:20:15 -05:00
|
|
|
{
|
2022-01-06 08:18:09 -06:00
|
|
|
if ( sourceSteppingType == RimSummaryDataSourceStepping::Axis::X_AXIS )
|
2019-10-04 06:20:15 -05:00
|
|
|
{
|
|
|
|
return m_xSourceStepping();
|
|
|
|
}
|
2022-01-06 08:18:09 -06:00
|
|
|
else if ( sourceSteppingType == RimSummaryDataSourceStepping::Axis::Y_AXIS )
|
2019-10-04 06:20:15 -05:00
|
|
|
{
|
|
|
|
return m_ySourceStepping();
|
|
|
|
}
|
2022-01-06 08:18:09 -06:00
|
|
|
if ( sourceSteppingType == RimSummaryDataSourceStepping::Axis::UNION_X_Y_AXIS )
|
2019-10-04 06:20:15 -05:00
|
|
|
{
|
|
|
|
return m_unionSourceStepping();
|
|
|
|
}
|
|
|
|
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
2017-10-02 06:32:02 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2017-10-02 06:32:02 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
void RimSummaryCurveCollection::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
|
|
|
const QVariant& oldValue,
|
|
|
|
const QVariant& newValue )
|
2017-10-02 06:32:02 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( changedField == &m_showCurves )
|
2017-10-02 06:32:02 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
loadDataAndUpdate( true );
|
2017-10-02 06:32:02 -05:00
|
|
|
}
|
2019-10-25 06:53:51 -05:00
|
|
|
else if ( changedField == &m_editPlot )
|
|
|
|
{
|
|
|
|
RimSummaryPlot* plot = nullptr;
|
|
|
|
this->firstAncestorOrThisOfType( plot );
|
|
|
|
if ( plot )
|
|
|
|
{
|
|
|
|
RicEditSummaryPlotFeature::editSummaryPlot( plot );
|
|
|
|
}
|
|
|
|
m_editPlot = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimSummaryCurveCollection::defineEditorAttribute( const caf::PdmFieldHandle* field,
|
|
|
|
QString uiConfigName,
|
|
|
|
caf::PdmUiEditorAttribute* attribute )
|
|
|
|
{
|
|
|
|
if ( &m_editPlot == field )
|
|
|
|
{
|
|
|
|
caf::PdmUiPushButtonEditorAttribute* attrib = dynamic_cast<caf::PdmUiPushButtonEditorAttribute*>( attribute );
|
|
|
|
if ( attrib )
|
|
|
|
{
|
|
|
|
attrib->m_buttonText = "Edit Plot";
|
|
|
|
}
|
|
|
|
}
|
2017-10-02 06:32:02 -05:00
|
|
|
}
|
|
|
|
|
2020-08-05 08:30:07 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimSummaryCurveCollection::onCurvesReordered( const SignalEmitter* emitter )
|
|
|
|
{
|
2022-09-06 08:29:10 -05:00
|
|
|
updateCurveOrder();
|
2020-09-25 03:31:51 -05:00
|
|
|
curvesChanged.send();
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimSummaryCurveCollection::onChildDeleted( caf::PdmChildArrayFieldHandle* childArray,
|
|
|
|
std::vector<caf::PdmObjectHandle*>& referringObjects )
|
|
|
|
{
|
|
|
|
curvesChanged.send();
|
2020-08-05 08:30:07 -05:00
|
|
|
}
|
|
|
|
|
2017-11-23 02:15:29 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2017-11-23 02:15:29 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
void RimSummaryCurveCollection::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
2017-11-23 02:15:29 -06:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2017-09-14 06:56:50 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2017-09-14 06:56:50 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
caf::PdmFieldHandle* RimSummaryCurveCollection::objectToggleField()
|
|
|
|
{
|
|
|
|
return &m_showCurves;
|
2017-09-27 01:12:01 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2017-09-27 01:12:01 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
void RimSummaryCurveCollection::defineObjectEditorAttribute( QString uiConfigName, caf::PdmUiEditorAttribute* attribute )
|
2017-09-27 01:12:01 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
caf::PdmUiTreeViewEditorAttribute* myAttr = dynamic_cast<caf::PdmUiTreeViewEditorAttribute*>( attribute );
|
|
|
|
if ( myAttr && m_currentSummaryCurve.notNull() )
|
2017-09-27 01:12:01 -05:00
|
|
|
{
|
|
|
|
myAttr->currentObject = m_currentSummaryCurve.p();
|
|
|
|
}
|
|
|
|
}
|
2022-09-06 00:21:24 -05:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2022-09-06 08:29:10 -05:00
|
|
|
void RimSummaryCurveCollection::updateCurveOrder()
|
2022-09-06 00:21:24 -05:00
|
|
|
{
|
|
|
|
detachPlotCurves();
|
|
|
|
reattachPlotCurves();
|
|
|
|
}
|