mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#2689 ensemble curves. Make the curve set legend work. Cache summary addresses for performance reasons
This commit is contained in:
parent
9550864c9e
commit
6c45725b19
@ -26,6 +26,7 @@
|
|||||||
|
|
||||||
#include "RimCellEdgeColors.h"
|
#include "RimCellEdgeColors.h"
|
||||||
#include "RimEclipseCellColors.h"
|
#include "RimEclipseCellColors.h"
|
||||||
|
#include "RimEnsembleCurveSet.h"
|
||||||
#include "RimEclipseView.h"
|
#include "RimEclipseView.h"
|
||||||
#include "RimGeoMechResultDefinition.h"
|
#include "RimGeoMechResultDefinition.h"
|
||||||
#include "RimIntersectionCollection.h"
|
#include "RimIntersectionCollection.h"
|
||||||
@ -205,6 +206,14 @@ void RimRegularLegendConfig::fieldChangedByUi(const caf::PdmFieldHandle* changed
|
|||||||
{
|
{
|
||||||
stimPlanColors->updateStimPlanTemplates();
|
stimPlanColors->updateStimPlanTemplates();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Update ensemble curve set if relevant
|
||||||
|
RimEnsembleCurveSet* ensembleCurveSet;
|
||||||
|
firstAncestorOrThisOfType(ensembleCurveSet);
|
||||||
|
if (ensembleCurveSet)
|
||||||
|
{
|
||||||
|
ensembleCurveSet->onLegendDefinitionChanged();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
#include "RifReaderEclipseSummary.h"
|
#include "RifReaderEclipseSummary.h"
|
||||||
|
|
||||||
#include "RimProject.h"
|
#include "RimProject.h"
|
||||||
|
#include "RimRegularLegendConfig.h"
|
||||||
#include "RimSummaryCase.h"
|
#include "RimSummaryCase.h"
|
||||||
#include "RimSummaryCaseCollection.h"
|
#include "RimSummaryCaseCollection.h"
|
||||||
#include "RimSummaryCurve.h"
|
#include "RimSummaryCurve.h"
|
||||||
@ -38,7 +39,7 @@
|
|||||||
#include "cafPdmObject.h"
|
#include "cafPdmObject.h"
|
||||||
#include "cafPdmUiPushButtonEditor.h"
|
#include "cafPdmUiPushButtonEditor.h"
|
||||||
|
|
||||||
#include "cvfScalarMapperContinuousLinear.h"
|
#include "cvfScalarMapper.h"
|
||||||
|
|
||||||
|
|
||||||
namespace caf
|
namespace caf
|
||||||
@ -181,6 +182,8 @@ void RimEnsembleCurveSet::loadDataAndUpdate(bool updateParentPlot)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
updateCurveColors();
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -275,6 +278,14 @@ RimRegularLegendConfig* RimEnsembleCurveSet::legendConfig()
|
|||||||
return m_legendConfig;
|
return m_legendConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimEnsembleCurveSet::onLegendDefinitionChanged()
|
||||||
|
{
|
||||||
|
updateCurveColors();
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -296,6 +307,8 @@ void RimEnsembleCurveSet::fieldChangedByUi(const caf::PdmFieldHandle* changedFie
|
|||||||
}
|
}
|
||||||
else if (changedField == &m_yValuesSummaryGroup)
|
else if (changedField == &m_yValuesSummaryGroup)
|
||||||
{
|
{
|
||||||
|
// Empty address cache
|
||||||
|
m_allAddressesCache.clear();
|
||||||
updateAllCurves();
|
updateAllCurves();
|
||||||
}
|
}
|
||||||
else if (changedField == &m_ensembleParameter ||
|
else if (changedField == &m_ensembleParameter ||
|
||||||
@ -313,9 +326,6 @@ void RimEnsembleCurveSet::fieldChangedByUi(const caf::PdmFieldHandle* changedFie
|
|||||||
updateQwtPlotAxis();
|
updateQwtPlotAxis();
|
||||||
plot->updateAxes();
|
plot->updateAxes();
|
||||||
}
|
}
|
||||||
else if (changedField == &m_yPushButtonSelectSummaryAddress)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -357,8 +367,11 @@ void RimEnsembleCurveSet::defineUiOrdering(QString uiConfigName, caf::PdmUiOrder
|
|||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimEnsembleCurveSet::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName /*= ""*/)
|
void RimEnsembleCurveSet::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName /*= ""*/)
|
||||||
|
{
|
||||||
|
if (m_colorMode == BY_ENSEMBLE_PARAM)
|
||||||
{
|
{
|
||||||
uiTreeOrdering.add(m_legendConfig());
|
uiTreeOrdering.add(m_legendConfig());
|
||||||
|
}
|
||||||
uiTreeOrdering.skipRemainingChildren(true);
|
uiTreeOrdering.skipRemainingChildren(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -466,16 +479,17 @@ void RimEnsembleCurveSet::appendOptionItemsForSummaryAddresses(QList<caf::PdmOpt
|
|||||||
{
|
{
|
||||||
if (!summaryCaseGroup) return;
|
if (!summaryCaseGroup) return;
|
||||||
|
|
||||||
std::set<RifEclipseSummaryAddress> allAddresses;
|
if (m_allAddressesCache.empty())
|
||||||
|
{
|
||||||
for (RimSummaryCase* summaryCase : summaryCaseGroup->allSummaryCases())
|
for (RimSummaryCase* summaryCase : summaryCaseGroup->allSummaryCases())
|
||||||
{
|
{
|
||||||
RifSummaryReaderInterface* reader = summaryCase->summaryReader();
|
RifSummaryReaderInterface* reader = summaryCase->summaryReader();
|
||||||
const std::vector<RifEclipseSummaryAddress> addrs = reader ? reader->allResultAddresses() : std::vector<RifEclipseSummaryAddress>();
|
const std::vector<RifEclipseSummaryAddress> addrs = reader ? reader->allResultAddresses() : std::vector<RifEclipseSummaryAddress>();
|
||||||
allAddresses.insert(addrs.begin(), addrs.end());
|
m_allAddressesCache.insert(addrs.begin(), addrs.end());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto& address : allAddresses)
|
for (auto& address : m_allAddressesCache)
|
||||||
{
|
{
|
||||||
if (summaryFilter && !summaryFilter->isIncludedByFilter(address)) continue;
|
if (summaryFilter && !summaryFilter->isIncludedByFilter(address)) continue;
|
||||||
|
|
||||||
@ -514,14 +528,13 @@ void RimEnsembleCurveSet::updateCurveColors()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cvf::ScalarMapperContinuousLinear colorMapper;
|
m_legendConfig->setAutomaticRanges(minValue, maxValue, minValue, maxValue);
|
||||||
colorMapper.setRange(minValue, maxValue);
|
|
||||||
|
|
||||||
for (auto& curve : m_curves)
|
for (auto& curve : m_curves)
|
||||||
{
|
{
|
||||||
RimSummaryCase* rimCase = curve->summaryCaseY();
|
RimSummaryCase* rimCase = curve->summaryCaseY();
|
||||||
double value = rimCase->caseRealizationParameters()->parameterValue(parameterName);
|
double value = rimCase->caseRealizationParameters()->parameterValue(parameterName);
|
||||||
curve->setColor(cvf::Color3f(colorMapper.mapToColor(value)));
|
curve->setColor(cvf::Color3f(m_legendConfig->scalarMapper()->mapToColor(value)));
|
||||||
curve->updateCurveAppearance();
|
curve->updateCurveAppearance();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -537,7 +550,18 @@ void RimEnsembleCurveSet::updateCurveColors()
|
|||||||
|
|
||||||
RimSummaryPlot* plot;
|
RimSummaryPlot* plot;
|
||||||
firstAncestorOrThisOfType(plot);
|
firstAncestorOrThisOfType(plot);
|
||||||
if (plot && plot->qwtPlot()) plot->qwtPlot()->replot();
|
if (plot && plot->qwtPlot())
|
||||||
|
{
|
||||||
|
if (m_colorMode == BY_ENSEMBLE_PARAM)
|
||||||
|
{
|
||||||
|
plot->qwtPlot()->addOrUpdateEnsembleCurveSetLegend(this);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
plot->qwtPlot()->removeEnsembleCurveSetLegend(this);
|
||||||
|
}
|
||||||
|
plot->qwtPlot()->replot();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -34,6 +34,8 @@
|
|||||||
#include "cafPdmPtrField.h"
|
#include "cafPdmPtrField.h"
|
||||||
#include "cafAppEnum.h"
|
#include "cafAppEnum.h"
|
||||||
|
|
||||||
|
#include "RifEclipseSummaryAddressQMetaType.h"
|
||||||
|
|
||||||
class QwtPlot;
|
class QwtPlot;
|
||||||
class QwtPlotCurve;
|
class QwtPlotCurve;
|
||||||
class RimSummaryCase;
|
class RimSummaryCase;
|
||||||
@ -73,6 +75,7 @@ public:
|
|||||||
void deleteAllCurves();
|
void deleteAllCurves();
|
||||||
|
|
||||||
RimRegularLegendConfig* legendConfig();
|
RimRegularLegendConfig* legendConfig();
|
||||||
|
void onLegendDefinitionChanged();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
caf::PdmFieldHandle* objectToggleField();
|
caf::PdmFieldHandle* objectToggleField();
|
||||||
@ -89,7 +92,7 @@ private:
|
|||||||
RimSummaryCase* summaryCase,
|
RimSummaryCase* summaryCase,
|
||||||
RimSummaryFilter* summaryFilter);
|
RimSummaryFilter* summaryFilter);
|
||||||
|
|
||||||
static void appendOptionItemsForSummaryAddresses(QList<caf::PdmOptionItemInfo>* options,
|
void appendOptionItemsForSummaryAddresses(QList<caf::PdmOptionItemInfo>* options,
|
||||||
RimSummaryCaseCollection* summaryCaseGroup,
|
RimSummaryCaseCollection* summaryCaseGroup,
|
||||||
RimSummaryFilter* summaryFilter);
|
RimSummaryFilter* summaryFilter);
|
||||||
|
|
||||||
@ -118,5 +121,7 @@ private:
|
|||||||
caf::PdmField<caf::AppEnum< RiaDefines::PlotAxis>> m_plotAxis;
|
caf::PdmField<caf::AppEnum< RiaDefines::PlotAxis>> m_plotAxis;
|
||||||
|
|
||||||
caf::PdmChildField<RimRegularLegendConfig*> m_legendConfig;
|
caf::PdmChildField<RimRegularLegendConfig*> m_legendConfig;
|
||||||
|
|
||||||
|
std::set<RifEclipseSummaryAddress> m_allAddressesCache;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -957,21 +957,6 @@ void RimSummaryPlot::addCurveNoUpdate(RimSummaryCurve* curve)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
//void RimSummaryPlot::addEnsembleCurve(const RimEnsembleCurveSet* curveSet, RimSummaryCurve* curve)
|
|
||||||
//{
|
|
||||||
// if (curveSet && curve)
|
|
||||||
// {
|
|
||||||
// curve->setColor(RimSummaryCurveAppearanceCalculator::cycledPaletteColor((int)m_ensembleCurveSetCollection->curveSets().size()));
|
|
||||||
//
|
|
||||||
// const_cast<RimEnsembleCurveSet*>(curveSet)->addCurve(curve);
|
|
||||||
// curve->setParentQwtPlotAndReplot(m_qwtPlot);
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -71,8 +71,6 @@ public:
|
|||||||
void addCurveAndUpdate(RimSummaryCurve* curve);
|
void addCurveAndUpdate(RimSummaryCurve* curve);
|
||||||
void addCurveNoUpdate(RimSummaryCurve* curve);
|
void addCurveNoUpdate(RimSummaryCurve* curve);
|
||||||
|
|
||||||
//void addEnsembleCurve(const RimEnsembleCurveSet* curveSet, RimSummaryCurve* curve);
|
|
||||||
|
|
||||||
void deleteCurve(RimSummaryCurve* curve);
|
void deleteCurve(RimSummaryCurve* curve);
|
||||||
void setCurveCollection(RimSummaryCurveCollection* curveCollection);
|
void setCurveCollection(RimSummaryCurveCollection* curveCollection);
|
||||||
void deleteCurvesAssosiatedWithCase(RimSummaryCase* summaryCase);
|
void deleteCurvesAssosiatedWithCase(RimSummaryCase* summaryCase);
|
||||||
|
Loading…
Reference in New Issue
Block a user