mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#2760 Ensemble Curves: Show one curve legend
This commit is contained in:
parent
1a0f242c0b
commit
0da7686cdb
@ -19,6 +19,7 @@
|
||||
#include "RimPlotCurve.h"
|
||||
|
||||
#include "RimEnsembleCurveSet.h"
|
||||
#include "RimSummaryCurve.h"
|
||||
#include "RimSummaryCurveCollection.h"
|
||||
#include "RimSummaryCurveFilter.h"
|
||||
#include "RimSummaryPlot.h"
|
||||
@ -590,5 +591,17 @@ void RimPlotCurve::updateLegendEntryVisibilityNoPlotUpdate()
|
||||
showLegendInQwt = false;
|
||||
}
|
||||
|
||||
RimEnsembleCurveSet* ensembleCurveSet = nullptr;
|
||||
this->firstAncestorOrThisOfType(ensembleCurveSet);
|
||||
if (ensembleCurveSet)
|
||||
{
|
||||
auto firstCurve = ensembleCurveSet->firstCurve();
|
||||
if (firstCurve != this)
|
||||
{
|
||||
// Hide legend display for curves other than the first
|
||||
showLegendInQwt = false;
|
||||
}
|
||||
}
|
||||
|
||||
m_qwtPlotCurve->setItemAttribute(QwtPlotItem::Legend, showLegendInQwt);
|
||||
}
|
||||
|
@ -184,6 +184,7 @@ void RimEnsembleCurveSet::loadDataAndUpdate(bool updateParentPlot)
|
||||
firstAncestorOrThisOfTypeAsserted(parentPlot);
|
||||
if (parentPlot->qwtPlot())
|
||||
{
|
||||
parentPlot->updatePlotTitle();
|
||||
parentPlot->qwtPlot()->updateLegend();
|
||||
parentPlot->updateAxes();
|
||||
parentPlot->updateZoomInQwt();
|
||||
@ -277,6 +278,16 @@ std::vector<RimSummaryCurve*> RimEnsembleCurveSet::visibleCurves() const
|
||||
return visible;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimSummaryCurve* RimEnsembleCurveSet::firstCurve() const
|
||||
{
|
||||
if (!curves().empty()) return curves().front();
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -74,6 +74,7 @@ public:
|
||||
RifEclipseSummaryAddress summaryAddress() const;
|
||||
std::vector<RimSummaryCurve*> curves() const;
|
||||
std::vector<RimSummaryCurve*> visibleCurves() const;
|
||||
RimSummaryCurve* firstCurve() const;
|
||||
|
||||
void deleteAllCurves();
|
||||
|
||||
|
@ -111,17 +111,18 @@ void RimEnsembleCurveSetCollection::loadDataAndUpdate(bool updateParentPlot)
|
||||
// curve->updateQwtPlotAxis();
|
||||
//}
|
||||
|
||||
//if ( updateParentPlot )
|
||||
//{
|
||||
// RimSummaryPlot* parentPlot;
|
||||
// firstAncestorOrThisOfTypeAsserted(parentPlot);
|
||||
// if ( parentPlot->qwtPlot() )
|
||||
// {
|
||||
// parentPlot->qwtPlot()->updateLegend();
|
||||
// parentPlot->updateAxes();
|
||||
// parentPlot->updateZoomInQwt();
|
||||
// }
|
||||
//}
|
||||
if ( updateParentPlot )
|
||||
{
|
||||
RimSummaryPlot* parentPlot;
|
||||
firstAncestorOrThisOfTypeAsserted(parentPlot);
|
||||
if ( parentPlot->qwtPlot() )
|
||||
{
|
||||
parentPlot->updatePlotTitle();
|
||||
parentPlot->qwtPlot()->updateLegend();
|
||||
parentPlot->updateAxes();
|
||||
parentPlot->updateZoomInQwt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -107,6 +107,7 @@ void RimSummaryCurveCollection::loadDataAndUpdate(bool updateParentPlot)
|
||||
firstAncestorOrThisOfTypeAsserted(parentPlot);
|
||||
if ( parentPlot->qwtPlot() )
|
||||
{
|
||||
parentPlot->updatePlotTitle();
|
||||
parentPlot->qwtPlot()->updateLegend();
|
||||
parentPlot->updateAxes();
|
||||
parentPlot->updateZoomInQwt();
|
||||
|
@ -1516,6 +1516,16 @@ void RimSummaryPlot::updateCurveNames()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (auto curveSet : m_ensembleCurveSetCollection->curveSets())
|
||||
{
|
||||
if (curveSet->isCurvesVisible() && curveSet->firstCurve())
|
||||
{
|
||||
// Only the first curve in the set is used in the legend,
|
||||
// skip update of other curves
|
||||
curveSet->firstCurve()->updateCurveNameNoLegendUpdate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -213,30 +213,17 @@ void RimSummaryPlotNameHelper::extractPlotTitleSubStrings()
|
||||
}
|
||||
|
||||
{
|
||||
QString summaryCaseTitle;
|
||||
if (m_summaryCases.size() == 1)
|
||||
if (m_summaryCases.size() == 1 && m_ensembleCases.empty())
|
||||
{
|
||||
auto summaryCase = *(m_summaryCases.begin());
|
||||
|
||||
summaryCaseTitle = summaryCase->caseName();
|
||||
m_titleCaseName = summaryCase->caseName();
|
||||
}
|
||||
|
||||
QString ensembleCaseTitle;
|
||||
if (m_titleCaseName.isEmpty() && m_ensembleCases.size() == 1)
|
||||
else if (m_ensembleCases.size() == 1 && m_summaryCases.empty())
|
||||
{
|
||||
auto ensembleCase = *(m_ensembleCases.begin());
|
||||
|
||||
ensembleCaseTitle = ensembleCase->name();
|
||||
}
|
||||
|
||||
// If one case title is the single available, use the single title
|
||||
if (summaryCaseTitle.isEmpty() && !ensembleCaseTitle.isEmpty())
|
||||
{
|
||||
m_titleCaseName = ensembleCaseTitle;
|
||||
}
|
||||
else if (!summaryCaseTitle.isEmpty() && ensembleCaseTitle.isEmpty())
|
||||
{
|
||||
m_titleCaseName = summaryCaseTitle;
|
||||
m_titleCaseName = ensembleCase->name();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user