mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#1923 Add no-plot-update versions of update methods in curve system. onLoadDataAndUpdate is improved for summary curve but not always called with the "no update" flag set
This commit is contained in:
@@ -128,7 +128,7 @@ void RimAsciiDataCurve::updateZoomInParentPlot()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAsciiDataCurve::onLoadDataAndUpdate()
|
||||
void RimAsciiDataCurve::onLoadDataAndUpdate(bool updateParentPlot)
|
||||
{
|
||||
this->RimPlotCurve::updateCurvePresentation();
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ protected:
|
||||
|
||||
virtual QString createCurveAutoName() override;
|
||||
virtual void updateZoomInParentPlot() override;
|
||||
virtual void onLoadDataAndUpdate() override;
|
||||
virtual void onLoadDataAndUpdate(bool updateParentPlot) override;
|
||||
|
||||
private:
|
||||
bool curveData(std::vector<QDateTime>* timeSteps, std::vector<double>* values) const;
|
||||
|
||||
@@ -370,9 +370,17 @@ void RimSummaryCurve::updateZoomInParentPlot()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryCurve::onLoadDataAndUpdate()
|
||||
void RimSummaryCurve::onLoadDataAndUpdate(bool updateParentPlot)
|
||||
{
|
||||
this->RimPlotCurve::updateCurvePresentation();
|
||||
this->updateCurveVisibility();
|
||||
if (updateParentPlot)
|
||||
{
|
||||
this->updateCurveNameAndUpdatePlotLegend();
|
||||
}
|
||||
else
|
||||
{
|
||||
this->updateCurveNameNoLegendUpdate();
|
||||
}
|
||||
|
||||
updateCurveAppearance();
|
||||
|
||||
@@ -419,12 +427,14 @@ void RimSummaryCurve::onLoadDataAndUpdate()
|
||||
m_qwtPlotCurve->setSamplesFromTimeTAndValues(std::vector<time_t>(), std::vector<double>(), isLogCurve);
|
||||
}
|
||||
|
||||
updateZoomInParentPlot();
|
||||
|
||||
if (m_parentQwtPlot) m_parentQwtPlot->replot();
|
||||
if ( updateParentPlot && m_parentQwtPlot)
|
||||
{
|
||||
updateZoomInParentPlot();
|
||||
m_parentQwtPlot->replot();
|
||||
}
|
||||
}
|
||||
|
||||
updateQwtPlotAxis();
|
||||
if (updateParentPlot) updateQwtPlotAxis();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -503,7 +513,7 @@ void RimSummaryCurve::fieldChangedByUi(const caf::PdmFieldHandle* changedField,
|
||||
m_curveVariable->setAddress(m_uiFilterResultSelection());
|
||||
|
||||
this->calculateCurveInterpolationFromAddress();
|
||||
this->loadDataAndUpdate();
|
||||
this->loadDataAndUpdate(true);
|
||||
|
||||
plot->updateAxes();
|
||||
}
|
||||
@@ -520,7 +530,7 @@ void RimSummaryCurve::fieldChangedByUi(const caf::PdmFieldHandle* changedField,
|
||||
else if (changedField == &m_summaryCase)
|
||||
{
|
||||
plot->updateCaseNameHasChanged();
|
||||
this->onLoadDataAndUpdate();
|
||||
this->onLoadDataAndUpdate(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -98,7 +98,7 @@ protected:
|
||||
|
||||
virtual QString createCurveAutoName() override;
|
||||
virtual void updateZoomInParentPlot() override;
|
||||
virtual void onLoadDataAndUpdate() override;
|
||||
virtual void onLoadDataAndUpdate(bool updateParentPlot) override;
|
||||
|
||||
private:
|
||||
RifSummaryReaderInterface* summaryReader() const;
|
||||
|
||||
@@ -241,7 +241,7 @@ void RimSummaryCurveAutoName::fieldChangedByUi(const caf::PdmFieldHandle* change
|
||||
RimSummaryCurve* summaryCurve = dynamic_cast<RimSummaryCurve*>(this->parentField()->ownerObject());
|
||||
if (summaryCurve)
|
||||
{
|
||||
summaryCurve->updateCurveName();
|
||||
summaryCurve->updateCurveNameAndUpdatePlotLegend();
|
||||
summaryCurve->updateConnectedEditors();
|
||||
}
|
||||
|
||||
|
||||
@@ -65,23 +65,37 @@ bool RimSummaryCurveCollection::isCurvesVisible()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryCurveCollection::loadDataAndUpdate()
|
||||
void RimSummaryCurveCollection::loadDataAndUpdate(bool updateParentPlot)
|
||||
{
|
||||
for (RimSummaryCurve* curve : m_curves)
|
||||
{
|
||||
curve->loadDataAndUpdate();
|
||||
curve->loadDataAndUpdate(false);
|
||||
}
|
||||
|
||||
if ( updateParentPlot )
|
||||
{
|
||||
RimSummaryPlot* parentPlot;
|
||||
firstAncestorOrThisOfTypeAsserted(parentPlot);
|
||||
if ( parentPlot->qwtPlot() )
|
||||
{
|
||||
parentPlot->qwtPlot()->updateLegend();
|
||||
parentPlot->updateAxes();
|
||||
parentPlot->updateZoomInQwt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryCurveCollection::setParentQwtPlot(QwtPlot* plot)
|
||||
void RimSummaryCurveCollection::setParentQwtPlotAndReplot(QwtPlot* plot)
|
||||
{
|
||||
for (RimSummaryCurve* curve : m_curves)
|
||||
{
|
||||
curve->setParentQwtPlot(plot);
|
||||
curve->setParentQwtPlotNoReplot(plot);
|
||||
}
|
||||
|
||||
if (plot) plot->replot();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -189,9 +203,13 @@ void RimSummaryCurveCollection::updateCaseNameHasChanged()
|
||||
{
|
||||
for (RimSummaryCurve* curve : m_curves)
|
||||
{
|
||||
curve->updateCurveName();
|
||||
curve->updateCurveNameNoLegendUpdate();
|
||||
curve->updateConnectedEditors();
|
||||
}
|
||||
|
||||
RimSummaryPlot* parentPlot;
|
||||
firstAncestorOrThisOfTypeAsserted(parentPlot);
|
||||
if (parentPlot->qwtPlot()) parentPlot->qwtPlot()->updateLegend();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -49,8 +49,8 @@ public:
|
||||
|
||||
bool isCurvesVisible();
|
||||
|
||||
void loadDataAndUpdate();
|
||||
void setParentQwtPlot(QwtPlot* plot);
|
||||
void loadDataAndUpdate(bool updateParentPlot);
|
||||
void setParentQwtPlotAndReplot(QwtPlot* plot);
|
||||
void detachQwtCurves();
|
||||
|
||||
RimSummaryCurve* findRimCurveFromQwtCurve(const QwtPlotCurve* qwtCurve) const;
|
||||
|
||||
@@ -278,6 +278,7 @@ void RimSummaryCurveFilter::fieldChangedByUi(const caf::PdmFieldHandle* changedF
|
||||
{
|
||||
curve->showLegend(m_showLegend());
|
||||
}
|
||||
m_parentQwtPlot->updateLegend();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -309,13 +310,15 @@ void RimSummaryCurveFilter::loadDataAndUpdatePlot()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryCurveFilter::setParentQwtPlot(QwtPlot* plot)
|
||||
void RimSummaryCurveFilter::setParentQwtPlotAndReplot(QwtPlot* plot)
|
||||
{
|
||||
m_parentQwtPlot = plot;
|
||||
for (RimSummaryCurve* curve : m_curves)
|
||||
{
|
||||
curve->setParentQwtPlot(plot);
|
||||
curve->setParentQwtPlotNoReplot(plot);
|
||||
}
|
||||
|
||||
if (plot) plot->replot();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -455,7 +458,7 @@ void RimSummaryCurveFilter::loadDataAndUpdate()
|
||||
{
|
||||
for (RimSummaryCurve* curve: m_curves)
|
||||
{
|
||||
curve->loadDataAndUpdate();
|
||||
curve->loadDataAndUpdate(true);
|
||||
}
|
||||
|
||||
syncUiSelectionFromCurves();
|
||||
@@ -582,7 +585,7 @@ void RimSummaryCurveFilter::createCurvesFromCurveDefinitions(const std::set<std:
|
||||
RimSummaryCase* currentCase = caseAddrPair.first;
|
||||
|
||||
RimSummaryCurve* curve = new RimSummaryCurve();
|
||||
curve->setParentQwtPlot(m_parentQwtPlot);
|
||||
curve->setParentQwtPlotNoReplot(m_parentQwtPlot);
|
||||
curve->setSummaryCase(currentCase);
|
||||
curve->setSummaryAddress(caseAddrPair.second);
|
||||
curve->setYAxis(m_plotAxis());
|
||||
@@ -601,7 +604,7 @@ void RimSummaryCurveFilter::updateCaseNameHasChanged()
|
||||
{
|
||||
for (RimSummaryCurve* curve : m_curves)
|
||||
{
|
||||
curve->updateCurveName();
|
||||
curve->updateCurveNameAndUpdatePlotLegend();
|
||||
curve->updateConnectedEditors();
|
||||
}
|
||||
}
|
||||
@@ -644,7 +647,7 @@ void RimSummaryCurveFilter::updateCurveNames()
|
||||
for (RimSummaryCurve* curve : m_curves)
|
||||
{
|
||||
curve->applyCurveAutoNameSettings(*m_curveNameConfig());
|
||||
curve->updateCurveName();
|
||||
curve->updateCurveNameAndUpdatePlotLegend();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ public:
|
||||
bool isCurvesVisible();
|
||||
|
||||
void loadDataAndUpdate();
|
||||
void setParentQwtPlot(QwtPlot* plot);
|
||||
void setParentQwtPlotAndReplot(QwtPlot* plot);
|
||||
void detachQwtCurves();
|
||||
|
||||
RimSummaryCurve* findRimCurveFromQwtCurve(const QwtPlotCurve* qwtCurve) const;
|
||||
|
||||
@@ -472,6 +472,14 @@ RimSummaryCurveCollection* RimSummaryPlot::summaryCurveCollection() const
|
||||
return m_summaryCurveCollection();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiuSummaryQwtPlot* RimSummaryPlot::qwtPlot() const
|
||||
{
|
||||
return m_qwtPlot;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -748,7 +756,7 @@ void RimSummaryPlot::updateCaseNameHasChanged()
|
||||
{
|
||||
for (RimSummaryCurve* curve : m_summaryCurves_OBSOLETE)
|
||||
{
|
||||
curve->updateCurveName();
|
||||
curve->updateCurveNameAndUpdatePlotLegend();
|
||||
curve->updateConnectedEditors();
|
||||
}
|
||||
|
||||
@@ -807,7 +815,7 @@ void RimSummaryPlot::zoomAll()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryPlot::addCurve(RimSummaryCurve* curve)
|
||||
void RimSummaryPlot::addCurveAndUpdate(RimSummaryCurve* curve)
|
||||
{
|
||||
if (curve)
|
||||
{
|
||||
@@ -815,12 +823,29 @@ void RimSummaryPlot::addCurve(RimSummaryCurve* curve)
|
||||
|
||||
if (m_qwtPlot)
|
||||
{
|
||||
curve->setParentQwtPlot(m_qwtPlot);
|
||||
curve->setParentQwtPlotAndReplot(m_qwtPlot);
|
||||
this->updateAxes();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryPlot::addCurveNoUpdate(RimSummaryCurve* curve)
|
||||
{
|
||||
if (curve)
|
||||
{
|
||||
m_summaryCurveCollection->addCurve(curve);
|
||||
|
||||
if (m_qwtPlot)
|
||||
{
|
||||
curve->setParentQwtPlotNoReplot(m_qwtPlot);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -892,7 +917,7 @@ void RimSummaryPlot::addCurveFilter(RimSummaryCurveFilter* curveFilter)
|
||||
m_curveFilters_OBSOLETE.push_back(curveFilter);
|
||||
if(m_qwtPlot)
|
||||
{
|
||||
curveFilter->setParentQwtPlot(m_qwtPlot);
|
||||
curveFilter->setParentQwtPlotAndReplot(m_qwtPlot);
|
||||
this->updateAxes();
|
||||
}
|
||||
}
|
||||
@@ -908,7 +933,7 @@ void RimSummaryPlot::setCurveCollection(RimSummaryCurveCollection* curveCollecti
|
||||
m_summaryCurveCollection = curveCollection;
|
||||
if (m_qwtPlot)
|
||||
{
|
||||
m_summaryCurveCollection->setParentQwtPlot(m_qwtPlot);
|
||||
m_summaryCurveCollection->setParentQwtPlotAndReplot(m_qwtPlot);
|
||||
this->updateAxes();
|
||||
}
|
||||
}
|
||||
@@ -924,7 +949,7 @@ void RimSummaryPlot::addGridTimeHistoryCurve(RimGridTimeHistoryCurve* curve)
|
||||
m_gridTimeHistoryCurves.push_back(curve);
|
||||
if (m_qwtPlot)
|
||||
{
|
||||
curve->setParentQwtPlot(m_qwtPlot);
|
||||
curve->setParentQwtPlotAndReplot(m_qwtPlot);
|
||||
this->updateAxes();
|
||||
}
|
||||
}
|
||||
@@ -939,7 +964,7 @@ void RimSummaryPlot::addAsciiDataCruve(RimAsciiDataCurve* curve)
|
||||
m_asciiDataCurves.push_back(curve);
|
||||
if (m_qwtPlot)
|
||||
{
|
||||
curve->setParentQwtPlot(m_qwtPlot);
|
||||
curve->setParentQwtPlotAndReplot(m_qwtPlot);
|
||||
this->updateAxes();
|
||||
}
|
||||
}
|
||||
@@ -1015,26 +1040,26 @@ void RimSummaryPlot::loadDataAndUpdate()
|
||||
|
||||
if (m_summaryCurveCollection)
|
||||
{
|
||||
m_summaryCurveCollection->loadDataAndUpdate();
|
||||
m_summaryCurveCollection->loadDataAndUpdate(false);
|
||||
}
|
||||
|
||||
for (RimSummaryCurve* curve : m_summaryCurves_OBSOLETE)
|
||||
{
|
||||
curve->loadDataAndUpdate();
|
||||
curve->loadDataAndUpdate(true);
|
||||
}
|
||||
|
||||
for (RimGridTimeHistoryCurve* curve : m_gridTimeHistoryCurves)
|
||||
{
|
||||
curve->loadDataAndUpdate();
|
||||
curve->loadDataAndUpdate(true);
|
||||
}
|
||||
|
||||
for (RimAsciiDataCurve* curve : m_asciiDataCurves)
|
||||
{
|
||||
curve->loadDataAndUpdate();
|
||||
curve->loadDataAndUpdate(true);
|
||||
}
|
||||
|
||||
if (m_qwtPlot) m_qwtPlot->updateLegend();
|
||||
this->updateAxes();
|
||||
|
||||
updateZoomInQwt();
|
||||
}
|
||||
|
||||
@@ -1120,29 +1145,29 @@ QWidget* RimSummaryPlot::createViewWidget(QWidget* mainWindowParent)
|
||||
|
||||
for(RimSummaryCurveFilter* curveFilter: m_curveFilters_OBSOLETE)
|
||||
{
|
||||
curveFilter->setParentQwtPlot(m_qwtPlot);
|
||||
curveFilter->setParentQwtPlotAndReplot(m_qwtPlot);
|
||||
}
|
||||
|
||||
for (RimSummaryCurve* curve : m_summaryCurves_OBSOLETE)
|
||||
{
|
||||
curve->setParentQwtPlot(m_qwtPlot);
|
||||
curve->setParentQwtPlotAndReplot(m_qwtPlot);
|
||||
}
|
||||
|
||||
if(m_summaryCurveCollection)
|
||||
for ( RimGridTimeHistoryCurve* curve : m_gridTimeHistoryCurves )
|
||||
{
|
||||
m_summaryCurveCollection->setParentQwtPlot(m_qwtPlot);
|
||||
}
|
||||
|
||||
for (RimGridTimeHistoryCurve* curve : m_gridTimeHistoryCurves)
|
||||
{
|
||||
curve->setParentQwtPlot(m_qwtPlot);
|
||||
curve->setParentQwtPlotNoReplot(m_qwtPlot);
|
||||
}
|
||||
|
||||
for (RimAsciiDataCurve* curve : m_asciiDataCurves)
|
||||
{
|
||||
curve->setParentQwtPlot(m_qwtPlot);
|
||||
curve->setParentQwtPlotNoReplot(m_qwtPlot);
|
||||
}
|
||||
}
|
||||
|
||||
if ( m_summaryCurveCollection )
|
||||
{
|
||||
m_summaryCurveCollection->setParentQwtPlotAndReplot(m_qwtPlot);
|
||||
}
|
||||
}
|
||||
|
||||
return m_qwtPlot;
|
||||
}
|
||||
|
||||
@@ -55,7 +55,9 @@ public:
|
||||
void setDescription(const QString& description);
|
||||
QString description() const;
|
||||
|
||||
void addCurve(RimSummaryCurve* curve);
|
||||
void addCurveAndUpdate(RimSummaryCurve* curve);
|
||||
void addCurveNoUpdate(RimSummaryCurve* curve);
|
||||
|
||||
void deleteCurve(RimSummaryCurve* curve);
|
||||
void addCurveFilter(RimSummaryCurveFilter* curveFilter);
|
||||
void setCurveCollection(RimSummaryCurveCollection* curveCollection);
|
||||
@@ -98,6 +100,8 @@ public:
|
||||
std::vector<RimSummaryCurve*> summaryCurves() const;
|
||||
void deleteAllSummaryCurves();
|
||||
RimSummaryCurveCollection* summaryCurveCollection() const;
|
||||
RiuSummaryQwtPlot* qwtPlot() const;
|
||||
|
||||
// RimViewWindow overrides
|
||||
public:
|
||||
virtual QWidget* createViewWidget(QWidget* mainWindowParent) override;
|
||||
|
||||
Reference in New Issue
Block a user