mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#2769 Ensemble curves. Fix crash when clicking on ensemble curve
This commit is contained in:
parent
b4fae86aea
commit
68b360a03f
@ -75,6 +75,8 @@ RimEnsembleCurveSetCollection::RimEnsembleCurveSetCollection()
|
||||
//m_unionSourceStepping.uiCapability()->setUiHidden(true);
|
||||
//m_unionSourceStepping.uiCapability()->setUiTreeChildrenHidden(true);
|
||||
//m_unionSourceStepping.xmlCapability()->disableIO();
|
||||
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -146,6 +148,25 @@ void RimEnsembleCurveSetCollection::detachQwtCurves()
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimEnsembleCurveSet* RimEnsembleCurveSetCollection::findRimCurveSetFromQwtCurve(const QwtPlotCurve* qwtCurve) const
|
||||
{
|
||||
for (RimEnsembleCurveSet* curveSet : m_curveSets)
|
||||
{
|
||||
for (RimSummaryCurve* rimCurve : curveSet->curves())
|
||||
{
|
||||
if (rimCurve->qwtPlotCurve() == qwtCurve)
|
||||
{
|
||||
return curveSet;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -250,16 +271,16 @@ void RimEnsembleCurveSetCollection::deleteAllCurveSets()
|
||||
// if (parentPlot->qwtPlot()) parentPlot->qwtPlot()->updateLegend();
|
||||
//}
|
||||
//
|
||||
////--------------------------------------------------------------------------------------------------
|
||||
/////
|
||||
////--------------------------------------------------------------------------------------------------
|
||||
//void RimEnsembleCurveSetCollection::setCurrentSummaryCurve(RimSummaryCurve* curve)
|
||||
//{
|
||||
// m_currentSummaryCurve = curve;
|
||||
//
|
||||
// updateConnectedEditors();
|
||||
//}
|
||||
//
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEnsembleCurveSetCollection::setCurrentSummaryCurveSet(RimEnsembleCurveSet* curveSet)
|
||||
{
|
||||
m_currentEnsembleCurveSet = curveSet;
|
||||
|
||||
updateConnectedEditors();
|
||||
}
|
||||
|
||||
////--------------------------------------------------------------------------------------------------
|
||||
/////
|
||||
////--------------------------------------------------------------------------------------------------
|
||||
|
@ -28,6 +28,7 @@
|
||||
class RimSummaryCase;
|
||||
class RimEnsembleCurveSet;
|
||||
class QwtPlot;
|
||||
class QwtPlotCurve;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
@ -46,7 +47,7 @@ public:
|
||||
void setParentQwtPlotAndReplot(QwtPlot* plot);
|
||||
void detachQwtCurves();
|
||||
|
||||
//RimSummaryCurve* findRimCurveFromQwtCurve(const QwtPlotCurve* qwtCurve) const;
|
||||
RimEnsembleCurveSet* findRimCurveSetFromQwtCurve(const QwtPlotCurve* qwtCurve) const;
|
||||
|
||||
void addCurveSet(RimEnsembleCurveSet* curveSet);
|
||||
void deleteCurveSet(RimEnsembleCurveSet* curveSet);
|
||||
@ -58,7 +59,7 @@ public:
|
||||
void deleteAllCurveSets();
|
||||
//void updateCaseNameHasChanged();
|
||||
|
||||
//void setCurrentSummaryCurve(RimSummaryCurve* curve);
|
||||
void setCurrentSummaryCurveSet(RimEnsembleCurveSet* curveSet);
|
||||
|
||||
//std::vector<caf::PdmFieldHandle*> fieldsToShowInToolbar();
|
||||
|
||||
@ -78,6 +79,6 @@ private:
|
||||
caf::PdmField<bool> m_showCurves;
|
||||
caf::PdmChildArrayField<RimEnsembleCurveSet*> m_curveSets;
|
||||
|
||||
//caf::PdmPointer<RimSummaryCurve> m_currentSummaryCurve;
|
||||
caf::PdmPointer<RimEnsembleCurveSet> m_currentEnsembleCurveSet;
|
||||
};
|
||||
|
||||
|
@ -1520,7 +1520,7 @@ void RimSummaryPlot::detachAllCurves()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmObject* RimSummaryPlot::findRimCurveFromQwtCurve(const QwtPlotCurve* qwtCurve) const
|
||||
caf::PdmObject* RimSummaryPlot::findRimPlotObjectFromQwtCurve(const QwtPlotCurve* qwtCurve) const
|
||||
{
|
||||
for (RimGridTimeHistoryCurve* curve : m_gridTimeHistoryCurves)
|
||||
{
|
||||
@ -1550,6 +1550,17 @@ caf::PdmObject* RimSummaryPlot::findRimCurveFromQwtCurve(const QwtPlotCurve* qwt
|
||||
}
|
||||
}
|
||||
|
||||
if (m_ensembleCurveSetCollection)
|
||||
{
|
||||
RimEnsembleCurveSet* foundCurveSet = m_ensembleCurveSetCollection->findRimCurveSetFromQwtCurve(qwtCurve);
|
||||
|
||||
if (foundCurveSet)
|
||||
{
|
||||
m_ensembleCurveSetCollection->setCurrentSummaryCurveSet(foundCurveSet);
|
||||
|
||||
return foundCurveSet;
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -81,7 +81,7 @@ public:
|
||||
|
||||
void addAsciiDataCruve(RimAsciiDataCurve* curve);
|
||||
|
||||
caf::PdmObject* findRimCurveFromQwtCurve(const QwtPlotCurve* curve) const;
|
||||
caf::PdmObject* findRimPlotObjectFromQwtCurve(const QwtPlotCurve* curve) const;
|
||||
size_t curveCount() const;
|
||||
|
||||
void detachAllCurves();
|
||||
|
@ -409,15 +409,15 @@ void RiuSummaryQwtPlot::selectClosestCurve(const QPoint& pos)
|
||||
|
||||
if(closestCurve && distMin < 20)
|
||||
{
|
||||
caf::PdmObject* selectedCurve = m_plotDefinition->findRimCurveFromQwtCurve(closestCurve);
|
||||
caf::PdmObject* selectedPlotObject = m_plotDefinition->findRimPlotObjectFromQwtCurve(closestCurve);
|
||||
|
||||
RimProject* proj = nullptr;
|
||||
selectedCurve->firstAncestorOrThisOfType(proj);
|
||||
selectedPlotObject->firstAncestorOrThisOfType(proj);
|
||||
|
||||
if(proj && selectedCurve)
|
||||
if(proj && selectedPlotObject)
|
||||
{
|
||||
RiuPlotMainWindowTools::showPlotMainWindow();
|
||||
RiuPlotMainWindowTools::selectAsCurrentItem(selectedCurve);
|
||||
RiuPlotMainWindowTools::selectAsCurrentItem(selectedPlotObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user