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:
@@ -23,32 +23,22 @@
|
||||
#include "RiaGuiApplication.h"
|
||||
#include "RiaPreferences.h"
|
||||
|
||||
#include "RimEnsembleCurveSet.h"
|
||||
#include "RimEnsembleCurveSetCollection.h"
|
||||
#include "RimMultiPlot.h"
|
||||
#include "RimNameConfig.h"
|
||||
#include "RimPlotRectAnnotation.h"
|
||||
#include "RimPlotWindow.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimSummaryCurve.h"
|
||||
#include "RimSummaryCurveCollection.h"
|
||||
#include "RimSummaryPlot.h"
|
||||
|
||||
#include "RiuGuiTheme.h"
|
||||
#include "RiuPlotCurve.h"
|
||||
#include "RiuPlotCurveSymbol.h"
|
||||
#include "RiuPlotMainWindowTools.h"
|
||||
#include "RiuPlotWidget.h"
|
||||
|
||||
#include "cafAssert.h"
|
||||
#include "cafPdmUiColorEditor.h"
|
||||
#include "cafPdmUiComboBoxEditor.h"
|
||||
#include "cafPdmUiTreeAttributes.h"
|
||||
#include "cafPdmUiTreeSelectionEditor.h"
|
||||
|
||||
#include <QPen>
|
||||
|
||||
// NB! Special macro for pure virtual class
|
||||
CAF_PDM_XML_ABSTRACT_SOURCE_INIT( RimPlotCurve, "PlotCurve" );
|
||||
CAF_PDM_SOURCE_INIT( RimPlotCurve, "PlotCurve" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
@@ -244,6 +234,14 @@ bool RimPlotCurve::isCurveNameTemplateSupported() const
|
||||
return !supportedCurveNameVariables().isEmpty();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimPlotCurve::createCurveAutoName()
|
||||
{
|
||||
return "Default Curve Name";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -252,6 +250,24 @@ QStringList RimPlotCurve::supportedCurveNameVariables() const
|
||||
return {};
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPlotCurve::updateZoomInParentPlot()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPlotCurve::onLoadDataAndUpdate( bool updateParentPlot )
|
||||
{
|
||||
if ( updateParentPlot && m_parentPlot )
|
||||
{
|
||||
m_parentPlot->scheduleReplot();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -549,17 +565,7 @@ bool RimPlotCurve::canCurveBeAttached() const
|
||||
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;
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -893,38 +899,7 @@ void RimPlotCurve::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 );
|
||||
m_plotCurve->setVisibleInLegend( m_showLegend() );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -1238,6 +1213,14 @@ void RimPlotCurve::deletePlotCurve()
|
||||
m_plotCurve = nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiuPlotCurve* RimPlotCurve::plotCurve() const
|
||||
{
|
||||
return m_plotCurve;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -1286,3 +1269,16 @@ void RimPlotCurve::onColorTagClicked( const SignalEmitter* emitter, size_t index
|
||||
m_curveAppearance->setColorWithFieldChanged( newColor );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPlotCurve::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
||||
{
|
||||
caf::PdmUiGroup* appearanceGroup = uiOrdering.addNewGroup( "Appearance" );
|
||||
RimPlotCurve::appearanceUiOrdering( *appearanceGroup );
|
||||
caf::PdmUiGroup* nameGroup = uiOrdering.addNewGroup( "Curve Name" );
|
||||
nameGroup->add( &m_curveName );
|
||||
nameGroup->add( &m_showLegend );
|
||||
uiOrdering.skipRemainingFields( true );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user