mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Remove pure virtual from RimPlotCurve
Make it possible to use RimPlotCurve directly. Remove depnendencies on special implementation in derived classes.
This commit is contained in:
@@ -20,10 +20,6 @@
|
||||
|
||||
#include "RiaSummaryDefines.h"
|
||||
|
||||
#include "RimProject.h"
|
||||
#include "RimSummaryCalculation.h"
|
||||
#include "RimSummaryCalculationCollection.h"
|
||||
|
||||
#include <QRegularExpression>
|
||||
|
||||
namespace caf
|
||||
|
||||
@@ -25,8 +25,8 @@
|
||||
#include "cafPdmPtrField.h"
|
||||
|
||||
#include "RiaDefines.h"
|
||||
|
||||
#include "RifEclipseSummaryAddressQMetaType.h"
|
||||
#include "RimPlotCurve.h"
|
||||
|
||||
#include "cafAppEnum.h"
|
||||
|
||||
|
||||
@@ -1389,3 +1389,62 @@ void RimSummaryCurve::calculateCurveInterpolationFromAddress()
|
||||
void RimSummaryCurve::updateTimeAnnotations()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryCurve::updateLegendEntryVisibilityNoPlotUpdate()
|
||||
{
|
||||
if ( !m_plotCurve ) return;
|
||||
|
||||
auto ensembleCurveSet = firstAncestorOrThisOfType<RimEnsembleCurveSet>();
|
||||
if ( ensembleCurveSet )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
bool showLegendInPlot = m_showLegend();
|
||||
|
||||
auto summaryPlot = firstAncestorOrThisOfType<RimSummaryPlot>();
|
||||
if ( summaryPlot )
|
||||
{
|
||||
bool anyCalculated = false;
|
||||
for ( const auto c : summaryPlot->summaryCurves() )
|
||||
{
|
||||
if ( c->summaryAddressY().isCalculated() )
|
||||
{
|
||||
// Never hide the legend for calculated curves, as the curve legend is used to
|
||||
// show some essential auto generated data
|
||||
anyCalculated = true;
|
||||
}
|
||||
}
|
||||
|
||||
auto isMultiPlot = ( firstAncestorOrThisOfType<RimMultiPlot>() != nullptr );
|
||||
|
||||
if ( !anyCalculated && isMultiPlot && summaryPlot->ensembleCurveSetCollection()->curveSets().empty() && summaryPlot->curveCount() == 1 )
|
||||
{
|
||||
// Disable display of legend if the summary plot has only one single curve
|
||||
showLegendInPlot = false;
|
||||
}
|
||||
}
|
||||
|
||||
m_plotCurve->setVisibleInLegend( showLegendInPlot );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimSummaryCurve::canCurveBeAttached() const
|
||||
{
|
||||
if ( !RimPlotCurve::canCurveBeAttached() ) return false;
|
||||
|
||||
bool isVisibleInPossibleParent = true;
|
||||
|
||||
auto summaryCurveCollection = firstAncestorOrThisOfType<RimSummaryCurveCollection>();
|
||||
if ( summaryCurveCollection ) isVisibleInPossibleParent = summaryCurveCollection->isCurvesVisible();
|
||||
|
||||
auto ensembleCurveSet = firstAncestorOrThisOfType<RimEnsembleCurveSet>();
|
||||
if ( ensembleCurveSet ) isVisibleInPossibleParent = ensembleCurveSet->isCurvesVisible();
|
||||
|
||||
return isVisibleInPossibleParent;
|
||||
}
|
||||
|
||||
@@ -106,6 +106,7 @@ public:
|
||||
RiaDefines::PhaseType phaseType() const override;
|
||||
|
||||
virtual bool isRegressionCurve() const;
|
||||
void updateLegendEntryVisibilityNoPlotUpdate() override;
|
||||
|
||||
protected:
|
||||
// RimPlotCurve overrides
|
||||
@@ -124,6 +125,7 @@ protected:
|
||||
virtual std::vector<time_t> timeStepsX() const;
|
||||
|
||||
virtual void updateTimeAnnotations();
|
||||
bool canCurveBeAttached() const override;
|
||||
|
||||
// Overridden PDM methods
|
||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
||||
|
||||
Reference in New Issue
Block a user