mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#2657 WIP: Add movable widget with color legend for ensemble curve sets to summary plot
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user