#2657 WIP: Add movable widget with color legend for ensemble curve sets to summary plot

This commit is contained in:
Jacob Støren
2018-04-18 15:58:49 +02:00
parent e468227dfe
commit 53a6e0e502
9 changed files with 443 additions and 0 deletions

View File

@@ -52,6 +52,12 @@
#include <float.h>
#include "RiuWidgetDragger.h"
#include "RiuCvfOverlayItemWidget.h"
#include "RimEnsambleCurveSet.h"
#include "RimRegularLegendConfig.h"
#include "cafTitledOverlayFrame.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -158,6 +164,48 @@ void RiuSummaryQwtPlot::setZoomWindow(const QwtInterval& leftAxis, const QwtInte
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuSummaryQwtPlot::addOrUpdateEnsambleCurveSetLegend(RimEnsambleCurveSet * curveSetToShowLegendFor)
{
RiuCvfOverlayItemWidget* overlayWidget = nullptr;
auto it = m_ensembleLegendWidgets.find(curveSetToShowLegendFor);
if (it == m_ensembleLegendWidgets.end() || it->second == nullptr)
{
overlayWidget = new RiuCvfOverlayItemWidget(this);
new RiuWidgetDragger(overlayWidget);
m_ensembleLegendWidgets[curveSetToShowLegendFor] = overlayWidget;
overlayWidget->move(30, 30);
}
else
{
overlayWidget = it->second;
}
if ( overlayWidget )
{
overlayWidget->updateFromOverlyItem(curveSetToShowLegendFor->legendConfig()->titledOverlayFrame());
overlayWidget->show();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuSummaryQwtPlot::removeEnsambleCurveSetLegend(RimEnsambleCurveSet * curveSetToShowLegendFor)
{
auto it = m_ensembleLegendWidgets.find(curveSetToShowLegendFor);
if ( it != m_ensembleLegendWidgets.end() )
{
if ( it->second != nullptr ) it->second->deleteLater();
m_ensembleLegendWidgets.erase(it);
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------