mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Refactor: Make interface to enable reuse
This commit is contained in:
parent
f31aecf507
commit
6c11b6f33b
@ -155,6 +155,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RimTimeAxisAnnotation.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimPolylinesDataInterface.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimEnsembleWellLogs.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimEnsembleWellLogsCollection.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimEnsembleCurveSetInterface.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimWellPathTieIn.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/cafTreeNode.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimMultipleLocations.h
|
||||
|
@ -0,0 +1,35 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2021- Equinor ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimEnsembleCurveSetInterface
|
||||
{
|
||||
public:
|
||||
virtual void updateEditors() = 0;
|
||||
virtual void updateAllCurves() = 0;
|
||||
virtual void updateStatisticsCurves() = 0;
|
||||
|
||||
virtual bool hasP10Data() const = 0;
|
||||
virtual bool hasP50Data() const = 0;
|
||||
virtual bool hasP90Data() const = 0;
|
||||
virtual bool hasMeanData() const = 0;
|
||||
};
|
@ -207,7 +207,7 @@ RimEnsembleCurveSet::RimEnsembleCurveSet()
|
||||
m_objectiveFunction->changed.connect( this, &RimEnsembleCurveSet::onObjectiveFunctionChanged );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_statistics, "Statistics", "Statistics", "", "", "" );
|
||||
m_statistics = new RimEnsembleStatistics();
|
||||
m_statistics = new RimEnsembleStatistics( this );
|
||||
m_statistics.uiCapability()->setUiTreeHidden( true );
|
||||
|
||||
CAF_PDM_InitField( &m_userDefinedName, "UserDefinedName", QString( "Ensemble Curve Set" ), "Curve Set Name", "", "", "" );
|
||||
@ -587,6 +587,14 @@ void RimEnsembleCurveSet::updateAllCurves()
|
||||
filterChanged.send();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEnsembleCurveSet::updateEditors()
|
||||
{
|
||||
updateConnectedEditors();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include "RiaQDateTimeTools.h"
|
||||
|
||||
#include "RimEnsembleCurveSetColorManager.h"
|
||||
#include "RimEnsembleCurveSetInterface.h"
|
||||
#include "RimObjectiveFunction.h"
|
||||
#include "RimRegularLegendConfig.h"
|
||||
#include "RimSummaryCase.h"
|
||||
@ -72,7 +73,7 @@ class QDate;
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimEnsembleCurveSet : public caf::PdmObject
|
||||
class RimEnsembleCurveSet : public caf::PdmObject, public RimEnsembleCurveSetInterface
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
@ -126,10 +127,8 @@ public:
|
||||
void updateEnsembleLegendItem();
|
||||
RiuDraggableOverlayFrame* legendFrame() const;
|
||||
|
||||
void updateAllCurves();
|
||||
void setTimeSteps( const std::vector<size_t>& timeStepIndices );
|
||||
std::vector<time_t> selectedTimeSteps() const;
|
||||
void updateStatisticsCurves();
|
||||
|
||||
RimEnsembleCurveSet* clone() const;
|
||||
void showCurves( bool show );
|
||||
@ -143,10 +142,13 @@ public:
|
||||
void disableStatisticCurves();
|
||||
bool isFiltered() const;
|
||||
|
||||
bool hasP10Data() const;
|
||||
bool hasP50Data() const;
|
||||
bool hasP90Data() const;
|
||||
bool hasMeanData() const;
|
||||
void updateEditors() override;
|
||||
void updateAllCurves() override;
|
||||
void updateStatisticsCurves() override;
|
||||
bool hasP10Data() const override;
|
||||
bool hasP50Data() const override;
|
||||
bool hasP90Data() const override;
|
||||
bool hasMeanData() const override;
|
||||
|
||||
void appendColorGroup( caf::PdmUiOrdering& uiOrdering );
|
||||
|
||||
|
@ -17,24 +17,23 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RimEnsembleStatistics.h"
|
||||
#include "RimEnsembleCurveSetInterface.h"
|
||||
|
||||
#include "RiaColorTools.h"
|
||||
#include "RifSummaryReaderInterface.h"
|
||||
#include "RigStatisticsMath.h"
|
||||
|
||||
#include "RimEnsembleCurveSet.h"
|
||||
#include "RimSummaryCase.h"
|
||||
#include "RimSummaryCaseCollection.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RimEnsembleStatistics, "RimEnsembleStatistics" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimEnsembleStatistics::RimEnsembleStatistics()
|
||||
RimEnsembleStatistics::RimEnsembleStatistics( RimEnsembleCurveSetInterface* parentCurveSet )
|
||||
{
|
||||
CAF_PDM_InitObject( "Ensemble Curve Filter", ":/EnsembleCurveSet16x16.png", "", "" );
|
||||
|
||||
m_parentCurveSet = parentCurveSet;
|
||||
|
||||
CAF_PDM_InitField( &m_active, "Active", true, "Show Statistics Curves", "", "", "" );
|
||||
CAF_PDM_InitField( &m_hideEnsembleCurves, "HideEnsembleCurves", false, "Hide Ensemble Curves", "", "", "" );
|
||||
CAF_PDM_InitField( &m_basedOnFilteredCases, "BasedOnFilteredCases", false, "Based on Filtered Cases", "", "", "" );
|
||||
@ -105,17 +104,17 @@ void RimEnsembleStatistics::fieldChangedByUi( const caf::PdmFieldHandle* changed
|
||||
changedField == &m_showP50Curve || changedField == &m_showP90Curve || changedField == &m_showMeanCurve ||
|
||||
changedField == &m_showCurveLabels || changedField == &m_color || changedField == &m_includeIncompleteCurves )
|
||||
{
|
||||
auto curveSet = parentCurveSet();
|
||||
auto curveSet = m_parentCurveSet;
|
||||
if ( !curveSet ) return;
|
||||
|
||||
curveSet->updateStatisticsCurves();
|
||||
|
||||
if ( changedField == &m_active || changedField == &m_basedOnFilteredCases ) curveSet->updateConnectedEditors();
|
||||
if ( changedField == &m_active || changedField == &m_basedOnFilteredCases ) curveSet->updateEditors();
|
||||
}
|
||||
|
||||
if ( changedField == &m_hideEnsembleCurves )
|
||||
{
|
||||
auto curveSet = parentCurveSet();
|
||||
auto curveSet = m_parentCurveSet;
|
||||
if ( !curveSet ) return;
|
||||
|
||||
curveSet->updateAllCurves();
|
||||
@ -127,7 +126,7 @@ void RimEnsembleStatistics::fieldChangedByUi( const caf::PdmFieldHandle* changed
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEnsembleStatistics::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
||||
{
|
||||
auto curveSet = parentCurveSet();
|
||||
auto curveSet = m_parentCurveSet;
|
||||
|
||||
uiOrdering.add( &m_active );
|
||||
uiOrdering.add( &m_hideEnsembleCurves );
|
||||
@ -155,13 +154,3 @@ void RimEnsembleStatistics::defineUiOrdering( QString uiConfigName, caf::PdmUiOr
|
||||
|
||||
uiOrdering.skipRemainingFields( true );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimEnsembleCurveSet* RimEnsembleStatistics::parentCurveSet() const
|
||||
{
|
||||
RimEnsembleCurveSet* curveSet;
|
||||
firstAncestorOrThisOfType( curveSet );
|
||||
return curveSet;
|
||||
}
|
||||
|
@ -18,15 +18,11 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RimEnsembleCurveSet.h"
|
||||
#include "RimSummaryCase.h"
|
||||
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmFieldCvfColor.h"
|
||||
#include "cafPdmObject.h"
|
||||
|
||||
class RifEclipseSummaryAddress;
|
||||
class RimSummaryCaseCollection;
|
||||
class RimEnsembleStatisticsCase;
|
||||
class RimEnsembleCurveSetInterface;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
@ -36,7 +32,7 @@ class RimEnsembleStatistics : public caf::PdmObject
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimEnsembleStatistics();
|
||||
RimEnsembleStatistics( RimEnsembleCurveSetInterface* parentCurveSet = nullptr );
|
||||
|
||||
bool isActive() const;
|
||||
bool hideEnsembleCurves() const { return m_hideEnsembleCurves; }
|
||||
@ -59,7 +55,7 @@ public:
|
||||
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
||||
|
||||
private:
|
||||
RimEnsembleCurveSet* parentCurveSet() const;
|
||||
RimEnsembleCurveSetInterface* m_parentCurveSet;
|
||||
|
||||
caf::PdmField<bool> m_active;
|
||||
caf::PdmField<bool> m_hideEnsembleCurves;
|
||||
|
Loading…
Reference in New Issue
Block a user