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:
@@ -19,6 +19,7 @@
|
|||||||
#include "RimPlotCurve.h"
|
#include "RimPlotCurve.h"
|
||||||
|
|
||||||
#include "RimEnsembleCurveSet.h"
|
#include "RimEnsembleCurveSet.h"
|
||||||
|
#include "RimSummaryCurve.h"
|
||||||
#include "RimSummaryCurveCollection.h"
|
#include "RimSummaryCurveCollection.h"
|
||||||
#include "RimSummaryCurveFilter.h"
|
#include "RimSummaryCurveFilter.h"
|
||||||
#include "RimSummaryPlot.h"
|
#include "RimSummaryPlot.h"
|
||||||
@@ -590,5 +591,17 @@ void RimPlotCurve::updateLegendEntryVisibilityNoPlotUpdate()
|
|||||||
showLegendInQwt = false;
|
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);
|
m_qwtPlotCurve->setItemAttribute(QwtPlotItem::Legend, showLegendInQwt);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -184,6 +184,7 @@ void RimEnsembleCurveSet::loadDataAndUpdate(bool updateParentPlot)
|
|||||||
firstAncestorOrThisOfTypeAsserted(parentPlot);
|
firstAncestorOrThisOfTypeAsserted(parentPlot);
|
||||||
if (parentPlot->qwtPlot())
|
if (parentPlot->qwtPlot())
|
||||||
{
|
{
|
||||||
|
parentPlot->updatePlotTitle();
|
||||||
parentPlot->qwtPlot()->updateLegend();
|
parentPlot->qwtPlot()->updateLegend();
|
||||||
parentPlot->updateAxes();
|
parentPlot->updateAxes();
|
||||||
parentPlot->updateZoomInQwt();
|
parentPlot->updateZoomInQwt();
|
||||||
@@ -277,6 +278,16 @@ std::vector<RimSummaryCurve*> RimEnsembleCurveSet::visibleCurves() const
|
|||||||
return visible;
|
return visible;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RimSummaryCurve* RimEnsembleCurveSet::firstCurve() const
|
||||||
|
{
|
||||||
|
if (!curves().empty()) return curves().front();
|
||||||
|
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -74,6 +74,7 @@ public:
|
|||||||
RifEclipseSummaryAddress summaryAddress() const;
|
RifEclipseSummaryAddress summaryAddress() const;
|
||||||
std::vector<RimSummaryCurve*> curves() const;
|
std::vector<RimSummaryCurve*> curves() const;
|
||||||
std::vector<RimSummaryCurve*> visibleCurves() const;
|
std::vector<RimSummaryCurve*> visibleCurves() const;
|
||||||
|
RimSummaryCurve* firstCurve() const;
|
||||||
|
|
||||||
void deleteAllCurves();
|
void deleteAllCurves();
|
||||||
|
|
||||||
|
|||||||
@@ -111,17 +111,18 @@ void RimEnsembleCurveSetCollection::loadDataAndUpdate(bool updateParentPlot)
|
|||||||
// curve->updateQwtPlotAxis();
|
// curve->updateQwtPlotAxis();
|
||||||
//}
|
//}
|
||||||
|
|
||||||
//if ( updateParentPlot )
|
if ( updateParentPlot )
|
||||||
//{
|
{
|
||||||
// RimSummaryPlot* parentPlot;
|
RimSummaryPlot* parentPlot;
|
||||||
// firstAncestorOrThisOfTypeAsserted(parentPlot);
|
firstAncestorOrThisOfTypeAsserted(parentPlot);
|
||||||
// if ( parentPlot->qwtPlot() )
|
if ( parentPlot->qwtPlot() )
|
||||||
// {
|
{
|
||||||
// parentPlot->qwtPlot()->updateLegend();
|
parentPlot->updatePlotTitle();
|
||||||
// parentPlot->updateAxes();
|
parentPlot->qwtPlot()->updateLegend();
|
||||||
// parentPlot->updateZoomInQwt();
|
parentPlot->updateAxes();
|
||||||
// }
|
parentPlot->updateZoomInQwt();
|
||||||
//}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -107,6 +107,7 @@ void RimSummaryCurveCollection::loadDataAndUpdate(bool updateParentPlot)
|
|||||||
firstAncestorOrThisOfTypeAsserted(parentPlot);
|
firstAncestorOrThisOfTypeAsserted(parentPlot);
|
||||||
if ( parentPlot->qwtPlot() )
|
if ( parentPlot->qwtPlot() )
|
||||||
{
|
{
|
||||||
|
parentPlot->updatePlotTitle();
|
||||||
parentPlot->qwtPlot()->updateLegend();
|
parentPlot->qwtPlot()->updateLegend();
|
||||||
parentPlot->updateAxes();
|
parentPlot->updateAxes();
|
||||||
parentPlot->updateZoomInQwt();
|
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 && m_ensembleCases.empty())
|
||||||
if (m_summaryCases.size() == 1)
|
|
||||||
{
|
{
|
||||||
auto summaryCase = *(m_summaryCases.begin());
|
auto summaryCase = *(m_summaryCases.begin());
|
||||||
|
|
||||||
summaryCaseTitle = summaryCase->caseName();
|
m_titleCaseName = summaryCase->caseName();
|
||||||
}
|
}
|
||||||
|
else if (m_ensembleCases.size() == 1 && m_summaryCases.empty())
|
||||||
QString ensembleCaseTitle;
|
|
||||||
if (m_titleCaseName.isEmpty() && m_ensembleCases.size() == 1)
|
|
||||||
{
|
{
|
||||||
auto ensembleCase = *(m_ensembleCases.begin());
|
auto ensembleCase = *(m_ensembleCases.begin());
|
||||||
|
|
||||||
ensembleCaseTitle = ensembleCase->name();
|
m_titleCaseName = 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;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user