diff --git a/ApplicationCode/Application/Tools/RiaImportEclipseCaseTools.cpp b/ApplicationCode/Application/Tools/RiaImportEclipseCaseTools.cpp index ed69e9eea2..a95f664eb9 100644 --- a/ApplicationCode/Application/Tools/RiaImportEclipseCaseTools.cpp +++ b/ApplicationCode/Application/Tools/RiaImportEclipseCaseTools.cpp @@ -188,7 +188,7 @@ bool RiaImportEclipseCaseTools::openEclipseCaseShowTimeStepFilterImpl(const QStr summaryCurve->firstAncestorOrThisOfType(parentCollection); if (parentCollection) { - parentCollection->loadDataAndUpdate(); + parentCollection->loadDataAndUpdate(true); parentCollection->updateConnectedEditors(); break; } diff --git a/ApplicationCode/Commands/FlowCommands/RicPlotProductionRateFeature.cpp b/ApplicationCode/Commands/FlowCommands/RicPlotProductionRateFeature.cpp index b3a6c715e9..ac01d5ada8 100644 --- a/ApplicationCode/Commands/FlowCommands/RicPlotProductionRateFeature.cpp +++ b/ApplicationCode/Commands/FlowCommands/RicPlotProductionRateFeature.cpp @@ -294,7 +294,7 @@ RimSummaryCurve* RicPlotProductionRateFeature::addSummaryCurve( RimSummaryPlot* } RimSummaryCurve* newCurve = new RimSummaryCurve(); - plot->addCurve(newCurve); + plot->addCurveAndUpdate(newCurve); newCurve->setSummaryCase(gridSummaryCase); newCurve->setSummaryAddress(addr); diff --git a/ApplicationCode/Commands/SummaryPlotCommands/RicNewGridTimeHistoryCurveFeature.cpp b/ApplicationCode/Commands/SummaryPlotCommands/RicNewGridTimeHistoryCurveFeature.cpp index 8ed8c6cdbd..7db281f25e 100644 --- a/ApplicationCode/Commands/SummaryPlotCommands/RicNewGridTimeHistoryCurveFeature.cpp +++ b/ApplicationCode/Commands/SummaryPlotCommands/RicNewGridTimeHistoryCurveFeature.cpp @@ -67,7 +67,7 @@ void RicNewGridTimeHistoryCurveFeature::createCurveFromSelectionItem(const RiuSe plot->addGridTimeHistoryCurve(newCurve); - newCurve->loadDataAndUpdate(); + newCurve->loadDataAndUpdate(true); plot->updateConnectedEditors(); diff --git a/ApplicationCode/Commands/SummaryPlotCommands/RicNewSummaryCurveFeature.cpp b/ApplicationCode/Commands/SummaryPlotCommands/RicNewSummaryCurveFeature.cpp index 156953ff30..2fb6a8386d 100644 --- a/ApplicationCode/Commands/SummaryPlotCommands/RicNewSummaryCurveFeature.cpp +++ b/ApplicationCode/Commands/SummaryPlotCommands/RicNewSummaryCurveFeature.cpp @@ -70,7 +70,7 @@ void RicNewSummaryCurveFeature::onActionTriggered(bool isChecked) cvf::Color3f curveColor = RicWellLogPlotCurveFeatureImpl::curveColorFromTable(plot->curveCount()); newCurve->setColor(curveColor); - plot->addCurve(newCurve); + plot->addCurveAndUpdate(newCurve); RimSummaryCase* defaultCase = nullptr; if (project->activeOilField()->summaryCaseMainCollection()->summaryCaseCount() > 0) @@ -80,7 +80,7 @@ void RicNewSummaryCurveFeature::onActionTriggered(bool isChecked) newCurve->setSummaryAddress(RifEclipseSummaryAddress::fieldVarAddress("FOPT")); - newCurve->loadDataAndUpdate(); + newCurve->loadDataAndUpdate(true); } plot->updateConnectedEditors(); diff --git a/ApplicationCode/Commands/SummaryPlotCommands/RicPasteAsciiDataCurveFeature.cpp b/ApplicationCode/Commands/SummaryPlotCommands/RicPasteAsciiDataCurveFeature.cpp index 9c0452eaa7..432ac9217f 100644 --- a/ApplicationCode/Commands/SummaryPlotCommands/RicPasteAsciiDataCurveFeature.cpp +++ b/ApplicationCode/Commands/SummaryPlotCommands/RicPasteAsciiDataCurveFeature.cpp @@ -90,7 +90,7 @@ void RicPasteAsciiDataCurveFeature::onActionTriggered(bool isChecked) newObject->initAfterReadRecursively(); - newObject->loadDataAndUpdate(); + newObject->loadDataAndUpdate(true); newObject->updateConnectedEditors(); summaryPlot->updateConnectedEditors(); diff --git a/ApplicationCode/Commands/SummaryPlotCommands/RicPasteSummaryCurveFeature.cpp b/ApplicationCode/Commands/SummaryPlotCommands/RicPasteSummaryCurveFeature.cpp index ba3d518156..3967e0ef6c 100644 --- a/ApplicationCode/Commands/SummaryPlotCommands/RicPasteSummaryCurveFeature.cpp +++ b/ApplicationCode/Commands/SummaryPlotCommands/RicPasteSummaryCurveFeature.cpp @@ -74,7 +74,7 @@ void RicPasteSummaryCurveFeature::onActionTriggered(bool isChecked) RimSummaryCurve* newObject = dynamic_cast(sourceObjects[i]->xmlCapability()->copyByXmlSerialization(caf::PdmDefaultObjectFactory::instance())); CVF_ASSERT(newObject); - summaryPlot->addCurve(newObject); + summaryPlot->addCurveAndUpdate(newObject); // Resolve references after object has been inserted into the project data model newObject->resolveReferencesRecursively(); @@ -85,7 +85,7 @@ void RicPasteSummaryCurveFeature::onActionTriggered(bool isChecked) newObject->initAfterReadRecursively(); - newObject->loadDataAndUpdate(); + newObject->loadDataAndUpdate(true); newObject->updateConnectedEditors(); summaryPlot->updateConnectedEditors(); diff --git a/ApplicationCode/Commands/SummaryPlotCommands/RicPasteTimeHistoryCurveFeature.cpp b/ApplicationCode/Commands/SummaryPlotCommands/RicPasteTimeHistoryCurveFeature.cpp index 115d0bec94..5173af51da 100644 --- a/ApplicationCode/Commands/SummaryPlotCommands/RicPasteTimeHistoryCurveFeature.cpp +++ b/ApplicationCode/Commands/SummaryPlotCommands/RicPasteTimeHistoryCurveFeature.cpp @@ -90,7 +90,7 @@ void RicPasteTimeHistoryCurveFeature::onActionTriggered(bool isChecked) newObject->initAfterReadRecursively(); - newObject->loadDataAndUpdate(); + newObject->loadDataAndUpdate(true); newObject->updateConnectedEditors(); summaryPlot->updateConnectedEditors(); diff --git a/ApplicationCode/Commands/SummaryPlotCommands/RicSummaryCurveCreator.cpp b/ApplicationCode/Commands/SummaryPlotCommands/RicSummaryCurveCreator.cpp index 0dd5d1e2a0..5fa613a429 100644 --- a/ApplicationCode/Commands/SummaryPlotCommands/RicSummaryCurveCreator.cpp +++ b/ApplicationCode/Commands/SummaryPlotCommands/RicSummaryCurveCreator.cpp @@ -51,6 +51,7 @@ #include "RimSummaryCaseCollection.h" #include "RimSummaryCurveAutoName.h" #include "cafPdmUiComboBoxEditor.h" +#include "RiuSummaryQwtPlot.h" CAF_PDM_SOURCE_INIT(RicSummaryCurveCreator, "RicSummaryCurveCreator"); @@ -934,7 +935,7 @@ void RicSummaryCurveCreator::updatePreviewCurvesFromCurveDefinitions(const std:: curve->setSummaryCase(currentCase); curve->setSummaryAddress(curveDef.second); curve->applyCurveAutoNameSettings(*m_curveNameConfig()); - m_previewPlot->addCurve(curve); + m_previewPlot->addCurveNoUpdate(curve); curveLookCalc.setupCurveLook(curve); } @@ -1141,9 +1142,12 @@ void RicSummaryCurveCreator::copyCurveAndAddToPlot(const RimSummaryCurve *curve, RimSummaryCurve* curveCopy = dynamic_cast(curve->xmlCapability()->copyByXmlSerialization(caf::PdmDefaultObjectFactory::instance())); CVF_ASSERT(curveCopy); - if (forceVisible) + if (forceVisible) + { curveCopy->setCurveVisiblity(true); - plot->addCurve(curveCopy); + } + + plot->addCurveNoUpdate(curveCopy); // Resolve references after object has been inserted into the project data model curveCopy->resolveReferencesRecursively(); @@ -1151,7 +1155,7 @@ void RicSummaryCurveCreator::copyCurveAndAddToPlot(const RimSummaryCurve *curve, // The curve creator is not a descendant of the project, and need to be set manually curveCopy->setSummaryCase(curve->summaryCase()); curveCopy->initAfterReadRecursively(); - curveCopy->loadDataAndUpdate(); + curveCopy->loadDataAndUpdate(true); } //-------------------------------------------------------------------------------------------------- @@ -1306,6 +1310,8 @@ void RicSummaryCurveCreator::updateCurveNames() for (RimSummaryCurve* curve : m_previewPlot->summaryCurves()) { curve->applyCurveAutoNameSettings(*m_curveNameConfig()); - curve->updateCurveName(); + curve->updateCurveNameNoLegendUpdate(); } + + if (m_previewPlot && m_previewPlot->qwtPlot()) m_previewPlot->qwtPlot()->updateLegend(); } diff --git a/ApplicationCode/Commands/WellLogCommands/RicAddWellLogToPlotFeature.cpp b/ApplicationCode/Commands/WellLogCommands/RicAddWellLogToPlotFeature.cpp index 4f040b8252..6c68a371c1 100644 --- a/ApplicationCode/Commands/WellLogCommands/RicAddWellLogToPlotFeature.cpp +++ b/ApplicationCode/Commands/WellLogCommands/RicAddWellLogToPlotFeature.cpp @@ -100,7 +100,7 @@ void RicAddWellLogToPlotFeature::onActionTriggered(bool isChecked) curve->setWellPath(wellPath); curve->setWellLogChannelName(wellLog->name()); - curve->loadDataAndUpdate(); + curve->loadDataAndUpdate(true); } } diff --git a/ApplicationCode/Commands/WellLogCommands/RicChangeDataSourceFeature.cpp b/ApplicationCode/Commands/WellLogCommands/RicChangeDataSourceFeature.cpp index b9e66f686e..1912d46d7f 100644 --- a/ApplicationCode/Commands/WellLogCommands/RicChangeDataSourceFeature.cpp +++ b/ApplicationCode/Commands/WellLogCommands/RicChangeDataSourceFeature.cpp @@ -67,7 +67,7 @@ void RicChangeDataSourceFeature::onActionTriggered(bool isChecked) extractionCurve->setWellPath(featureUi.wellPathToApply); extractionCurve->setCase(featureUi.caseToApply); - extractionCurve->loadDataAndUpdate(); + extractionCurve->loadDataAndUpdate(true); } } } diff --git a/ApplicationCode/Commands/WellLogCommands/RicNewWellLogCurveExtractionFeature.cpp b/ApplicationCode/Commands/WellLogCommands/RicNewWellLogCurveExtractionFeature.cpp index 1ad9176a8f..d4f1f181d6 100644 --- a/ApplicationCode/Commands/WellLogCommands/RicNewWellLogCurveExtractionFeature.cpp +++ b/ApplicationCode/Commands/WellLogCommands/RicNewWellLogCurveExtractionFeature.cpp @@ -79,7 +79,7 @@ void RicNewWellLogCurveExtractionFeature::onActionTriggered(bool isChecked) RimWellLogTrack* wellLogPlotTrack = RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack(); RimWellLogExtractionCurve* plotCurve = addCurve(wellLogPlotTrack, RiaApplication::instance()->activeReservoirView(), wellPath, simWell, branchIndex); - plotCurve->loadDataAndUpdate(); + plotCurve->loadDataAndUpdate(true); RimWellLogPlot* plot = NULL; wellLogPlotTrack->firstAncestorOrThisOfType(plot); diff --git a/ApplicationCode/Commands/WellLogCommands/RicNewWellLogFileCurveFeature.cpp b/ApplicationCode/Commands/WellLogCommands/RicNewWellLogFileCurveFeature.cpp index 25129baba4..f28516e95b 100644 --- a/ApplicationCode/Commands/WellLogCommands/RicNewWellLogFileCurveFeature.cpp +++ b/ApplicationCode/Commands/WellLogCommands/RicNewWellLogFileCurveFeature.cpp @@ -174,7 +174,7 @@ void RicNewWellLogFileCurveFeature::addWellLogChannelsToPlotTrack(RimWellLogTrac { plotCurve->setWellPath(wellPath); plotCurve->setWellLogChannelName(wellLogFileChannels[cIdx]->name()); - plotCurve->loadDataAndUpdate(); + plotCurve->loadDataAndUpdate(true); plotCurve->updateConnectedEditors(); } } diff --git a/ApplicationCode/Commands/WellLogCommands/RicPasteWellLogCurveFeature.cpp b/ApplicationCode/Commands/WellLogCommands/RicPasteWellLogCurveFeature.cpp index 48bf741fbd..05216e6f48 100644 --- a/ApplicationCode/Commands/WellLogCommands/RicPasteWellLogCurveFeature.cpp +++ b/ApplicationCode/Commands/WellLogCommands/RicPasteWellLogCurveFeature.cpp @@ -88,7 +88,7 @@ void RicPasteWellLogCurveFeature::onActionTriggered(bool isChecked) newObject->resolveReferencesRecursively(); newObject->initAfterReadRecursively(); - newObject->loadDataAndUpdate(); + newObject->loadDataAndUpdate(true); wellLogTrack->updateConnectedEditors(); } @@ -105,7 +105,7 @@ void RicPasteWellLogCurveFeature::onActionTriggered(bool isChecked) newObject->resolveReferencesRecursively(); newObject->initAfterReadRecursively(); - newObject->loadDataAndUpdate(); + newObject->loadDataAndUpdate(true); wellLogTrack->updateConnectedEditors(); } diff --git a/ApplicationCode/ProjectDataModel/Flow/RimWellAllocationPlot.cpp b/ApplicationCode/ProjectDataModel/Flow/RimWellAllocationPlot.cpp index 532e79e344..5bb672a0e6 100644 --- a/ApplicationCode/ProjectDataModel/Flow/RimWellAllocationPlot.cpp +++ b/ApplicationCode/ProjectDataModel/Flow/RimWellAllocationPlot.cpp @@ -433,7 +433,7 @@ void RimWellAllocationPlot::addStackedCurve(const QString& tracerName, plotTrack->addCurve(curve); - curve->loadDataAndUpdate(); + curve->loadDataAndUpdate(true); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/Flow/RimWellFlowRateCurve.cpp b/ApplicationCode/ProjectDataModel/Flow/RimWellFlowRateCurve.cpp index 7d8d13c7fa..2eea400e53 100644 --- a/ApplicationCode/ProjectDataModel/Flow/RimWellFlowRateCurve.cpp +++ b/ApplicationCode/ProjectDataModel/Flow/RimWellFlowRateCurve.cpp @@ -98,7 +98,7 @@ QString RimWellFlowRateCurve::createCurveAutoName() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimWellFlowRateCurve::onLoadDataAndUpdate() +void RimWellFlowRateCurve::onLoadDataAndUpdate(bool updateParentPlot) { RimWellLogCurve::updateCurvePresentation(); diff --git a/ApplicationCode/ProjectDataModel/Flow/RimWellFlowRateCurve.h b/ApplicationCode/ProjectDataModel/Flow/RimWellFlowRateCurve.h index 80f5c0a06d..68a88e1916 100644 --- a/ApplicationCode/ProjectDataModel/Flow/RimWellFlowRateCurve.h +++ b/ApplicationCode/ProjectDataModel/Flow/RimWellFlowRateCurve.h @@ -46,7 +46,7 @@ public: protected: virtual QString createCurveAutoName() override; - virtual void onLoadDataAndUpdate() override; + virtual void onLoadDataAndUpdate(bool updateParentPlot) override; virtual void updateCurveAppearance() override; virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override; diff --git a/ApplicationCode/ProjectDataModel/RimEclipseResultDefinition.cpp b/ApplicationCode/ProjectDataModel/RimEclipseResultDefinition.cpp index 9960970652..0b45bebe61 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseResultDefinition.cpp +++ b/ApplicationCode/ProjectDataModel/RimEclipseResultDefinition.cpp @@ -429,7 +429,7 @@ void RimEclipseResultDefinition::loadDataAndUpdate() this->firstAncestorOrThisOfType(curve); if (curve) { - curve->loadDataAndUpdate(); + curve->loadDataAndUpdate(true); } } diff --git a/ApplicationCode/ProjectDataModel/RimGeoMechResultDefinition.cpp b/ApplicationCode/ProjectDataModel/RimGeoMechResultDefinition.cpp index c9fe65a189..77decdf994 100644 --- a/ApplicationCode/ProjectDataModel/RimGeoMechResultDefinition.cpp +++ b/ApplicationCode/ProjectDataModel/RimGeoMechResultDefinition.cpp @@ -277,7 +277,7 @@ void RimGeoMechResultDefinition::fieldChangedByUi(const caf::PdmFieldHandle* cha if (curve) { - curve->loadDataAndUpdate(); + curve->loadDataAndUpdate(true); } } } diff --git a/ApplicationCode/ProjectDataModel/RimGridTimeHistoryCurve.cpp b/ApplicationCode/ProjectDataModel/RimGridTimeHistoryCurve.cpp index 8d791bace0..e223d95b65 100644 --- a/ApplicationCode/ProjectDataModel/RimGridTimeHistoryCurve.cpp +++ b/ApplicationCode/ProjectDataModel/RimGridTimeHistoryCurve.cpp @@ -291,7 +291,7 @@ void RimGridTimeHistoryCurve::updateZoomInParentPlot() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimGridTimeHistoryCurve::onLoadDataAndUpdate() +void RimGridTimeHistoryCurve::onLoadDataAndUpdate(bool updateParentPlot) { this->RimPlotCurve::updateCurvePresentation(); diff --git a/ApplicationCode/ProjectDataModel/RimGridTimeHistoryCurve.h b/ApplicationCode/ProjectDataModel/RimGridTimeHistoryCurve.h index 7fd5edc132..39908a9bbd 100644 --- a/ApplicationCode/ProjectDataModel/RimGridTimeHistoryCurve.h +++ b/ApplicationCode/ProjectDataModel/RimGridTimeHistoryCurve.h @@ -64,7 +64,7 @@ public: protected: virtual QString createCurveAutoName() override; virtual void updateZoomInParentPlot() override; - virtual void onLoadDataAndUpdate() override; + virtual void onLoadDataAndUpdate(bool updateParentPlot) override; virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override; diff --git a/ApplicationCode/ProjectDataModel/RimPlotCurve.cpp b/ApplicationCode/ProjectDataModel/RimPlotCurve.cpp index 9b248c95ec..40c746af07 100644 --- a/ApplicationCode/ProjectDataModel/RimPlotCurve.cpp +++ b/ApplicationCode/ProjectDataModel/RimPlotCurve.cpp @@ -136,12 +136,12 @@ void RimPlotCurve::fieldChangedByUi(const caf::PdmFieldHandle* changedField, con if (changedField == &m_showCurve) { this->updateCurveVisibility(); - if (m_showCurve()) loadDataAndUpdate(); + if (m_showCurve()) loadDataAndUpdate(true); } else if (changedField == &m_curveName) { m_customCurveName = m_curveName; - updateCurveName(); + updateCurveNameAndUpdatePlotLegend(); } else if (&m_curveColor == changedField || &m_curveThickness == changedField @@ -159,11 +159,11 @@ void RimPlotCurve::fieldChangedByUi(const caf::PdmFieldHandle* changedField, con m_customCurveName = createCurveAutoName(); } - updateCurveName(); + updateCurveNameAndUpdatePlotLegend(); } else if (changedField == &m_showLegend) { - updateLegendVisibility(); + updateLegendEntryVisibilityAndPlotLegend(); } if (m_parentQwtPlot) m_parentQwtPlot->replot(); @@ -213,7 +213,7 @@ void RimPlotCurve::updateCurveVisibility() void RimPlotCurve::updateCurvePresentation() { this->updateCurveVisibility(); - this->updateCurveName(); + this->updateCurveNameAndUpdatePlotLegend(); updateCurveAppearance(); // Todo: Rest of the curve setup controlled from this class @@ -222,7 +222,7 @@ void RimPlotCurve::updateCurvePresentation() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimPlotCurve::setParentQwtPlot(QwtPlot* plot) +void RimPlotCurve::setParentQwtPlotAndReplot(QwtPlot* plot) { m_parentQwtPlot = plot; if (m_showCurve && m_parentQwtPlot) @@ -232,6 +232,18 @@ void RimPlotCurve::setParentQwtPlot(QwtPlot* plot) } } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimPlotCurve::setParentQwtPlotNoReplot(QwtPlot* plot) +{ + m_parentQwtPlot = plot; + if (m_showCurve && m_parentQwtPlot) + { + m_qwtPlotCurve->attach(m_parentQwtPlot); + } +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -283,7 +295,7 @@ void RimPlotCurve::setCurveVisiblity(bool visible) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimPlotCurve::updateCurveName() +void RimPlotCurve::updateCurveNameAndUpdatePlotLegend() { if (m_isUsingAutoName) { @@ -295,7 +307,25 @@ void RimPlotCurve::updateCurveName() } m_qwtPlotCurve->setTitle(m_curveName); - updateLegendVisibility(); + updateLegendEntryVisibilityAndPlotLegend(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimPlotCurve::updateCurveNameNoLegendUpdate() +{ + if (m_isUsingAutoName) + { + m_curveName = this->createCurveAutoName(); + } + else + { + m_curveName = m_customCurveName; + } + + m_qwtPlotCurve->setTitle(m_curveName); + updateLegendEntryVisibilityNoPlotUpdate(); } //-------------------------------------------------------------------------------------------------- @@ -443,9 +473,9 @@ QList RimPlotCurve::calculateValueOptions(const caf::Pdm //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimPlotCurve::loadDataAndUpdate() +void RimPlotCurve::loadDataAndUpdate(bool updateParentPlot) { - this->onLoadDataAndUpdate(); + this->onLoadDataAndUpdate(updateParentPlot); } //-------------------------------------------------------------------------------------------------- @@ -498,13 +528,13 @@ void RimPlotCurve::resetAppearance() void RimPlotCurve::showLegend(bool show) { m_showLegend = show; - updateLegendVisibility(); + updateLegendEntryVisibilityNoPlotUpdate(); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimPlotCurve::updateLegendVisibility() +void RimPlotCurve::updateLegendEntryVisibilityAndPlotLegend() { if (m_showLegend()) { if (m_curveName().isEmpty()) @@ -526,3 +556,24 @@ void RimPlotCurve::updateLegendVisibility() m_parentQwtPlot->updateLegend(); } } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimPlotCurve::updateLegendEntryVisibilityNoPlotUpdate() +{ + if (m_showLegend()) { + if (m_curveName().isEmpty()) + { + m_qwtPlotCurve->setItemAttribute(QwtPlotItem::Legend, false); + } + else + { + m_qwtPlotCurve->setItemAttribute(QwtPlotItem::Legend, true); + } + } + else + { + m_qwtPlotCurve->setItemAttribute(QwtPlotItem::Legend, false); + } +} \ No newline at end of file diff --git a/ApplicationCode/ProjectDataModel/RimPlotCurve.h b/ApplicationCode/ProjectDataModel/RimPlotCurve.h index 81b5e70c51..fda64ea355 100644 --- a/ApplicationCode/ProjectDataModel/RimPlotCurve.h +++ b/ApplicationCode/ProjectDataModel/RimPlotCurve.h @@ -68,9 +68,10 @@ public: RimPlotCurve(); virtual ~RimPlotCurve(); - void loadDataAndUpdate(); + void loadDataAndUpdate(bool updateParentPlot); - void setParentQwtPlot(QwtPlot* plot); + void setParentQwtPlotAndReplot(QwtPlot* plot); + void setParentQwtPlotNoReplot(QwtPlot* plot); void detachQwtCurve(); QwtPlotCurve* qwtPlotCurve() const; @@ -84,11 +85,14 @@ public: bool isCurveVisible() const; void setCurveVisiblity(bool visible); - void updateCurveName(); + void updateCurveNameAndUpdatePlotLegend(); + void updateCurveNameNoLegendUpdate(); + QString curveName() const { return m_curveName; } void updateCurveVisibility(); - void updateLegendVisibility(); + void updateLegendEntryVisibilityAndPlotLegend(); + void updateLegendEntryVisibilityNoPlotUpdate(); void showLegend(bool show); @@ -96,7 +100,7 @@ protected: virtual QString createCurveAutoName() = 0; virtual void updateZoomInParentPlot() = 0; - virtual void onLoadDataAndUpdate() = 0; + virtual void onLoadDataAndUpdate(bool updateParentPlot) = 0; void updateCurvePresentation(); virtual void updateCurveAppearance(); diff --git a/ApplicationCode/ProjectDataModel/RimWellLogExtractionCurve.cpp b/ApplicationCode/ProjectDataModel/RimWellLogExtractionCurve.cpp index 0bf47f0ba3..4e97ac3393 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogExtractionCurve.cpp +++ b/ApplicationCode/ProjectDataModel/RimWellLogExtractionCurve.cpp @@ -254,26 +254,26 @@ void RimWellLogExtractionCurve::fieldChangedByUi(const caf::PdmFieldHandle* chan clearGeneratedSimWellPaths(); - this->loadDataAndUpdate(); + this->loadDataAndUpdate(true); } else if (changedField == &m_wellPath) { - this->loadDataAndUpdate(); + this->loadDataAndUpdate(true); } else if (changedField == &m_simWellName) { clearGeneratedSimWellPaths(); - this->loadDataAndUpdate(); + this->loadDataAndUpdate(true); } else if (changedField == &m_trajectoryType || changedField == &m_branchIndex) { - this->loadDataAndUpdate(); + this->loadDataAndUpdate(true); } else if (changedField == &m_timeStep) { - this->loadDataAndUpdate(); + this->loadDataAndUpdate(true); } if (changedField == &m_addCaseNameToCurveName || @@ -283,14 +283,14 @@ void RimWellLogExtractionCurve::fieldChangedByUi(const caf::PdmFieldHandle* chan changedField == &m_addDateToCurveName) { this->uiCapability()->updateConnectedEditors(); - updateCurveName(); + updateCurveNameAndUpdatePlotLegend(); } } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimWellLogExtractionCurve::onLoadDataAndUpdate() +void RimWellLogExtractionCurve::onLoadDataAndUpdate(bool updateParentPlot) { RimWellLogCurve::updateCurvePresentation(); diff --git a/ApplicationCode/ProjectDataModel/RimWellLogExtractionCurve.h b/ApplicationCode/ProjectDataModel/RimWellLogExtractionCurve.h index 70734a3414..2aa0cc7c01 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogExtractionCurve.h +++ b/ApplicationCode/ProjectDataModel/RimWellLogExtractionCurve.h @@ -67,7 +67,7 @@ public: protected: virtual QString createCurveAutoName(); - virtual void onLoadDataAndUpdate(); + virtual void onLoadDataAndUpdate(bool updateParentPlot); virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue); virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering); diff --git a/ApplicationCode/ProjectDataModel/RimWellLogFileCurve.cpp b/ApplicationCode/ProjectDataModel/RimWellLogFileCurve.cpp index 5b48955dc7..32a0beea94 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogFileCurve.cpp +++ b/ApplicationCode/ProjectDataModel/RimWellLogFileCurve.cpp @@ -68,7 +68,7 @@ RimWellLogFileCurve::~RimWellLogFileCurve() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimWellLogFileCurve::onLoadDataAndUpdate() +void RimWellLogFileCurve::onLoadDataAndUpdate(bool updateParentPlot) { RimWellLogCurve::updateCurvePresentation(); @@ -154,11 +154,11 @@ void RimWellLogFileCurve::fieldChangedByUi(const caf::PdmFieldHandle* changedFie if (changedField == &m_wellPath) { - this->loadDataAndUpdate(); + this->loadDataAndUpdate(true); } else if (changedField == &m_wellLogChannnelName) { - this->loadDataAndUpdate(); + this->loadDataAndUpdate(true); } if (m_parentQwtPlot) m_parentQwtPlot->replot(); diff --git a/ApplicationCode/ProjectDataModel/RimWellLogFileCurve.h b/ApplicationCode/ProjectDataModel/RimWellLogFileCurve.h index 3e05860a66..a31439b799 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogFileCurve.h +++ b/ApplicationCode/ProjectDataModel/RimWellLogFileCurve.h @@ -51,7 +51,7 @@ public: protected: // Overrides from RimWellLogPlotCurve virtual QString createCurveAutoName(); - virtual void onLoadDataAndUpdate(); + virtual void onLoadDataAndUpdate(bool updateParentPlot); // Pdm overrrides virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue); diff --git a/ApplicationCode/ProjectDataModel/RimWellLogTrack.cpp b/ApplicationCode/ProjectDataModel/RimWellLogTrack.cpp index c63d2a7f49..2431cb1ea8 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogTrack.cpp +++ b/ApplicationCode/ProjectDataModel/RimWellLogTrack.cpp @@ -169,7 +169,7 @@ void RimWellLogTrack::addCurve(RimWellLogCurve* curve) if (m_wellLogTrackPlotWidget) { - curve->setParentQwtPlot(m_wellLogTrackPlotWidget); + curve->setParentQwtPlotAndReplot(m_wellLogTrackPlotWidget); } } @@ -183,7 +183,7 @@ void RimWellLogTrack::insertCurve(RimWellLogCurve* curve, size_t index) if (m_wellLogTrackPlotWidget) { - curve->setParentQwtPlot(m_wellLogTrackPlotWidget); + curve->setParentQwtPlotAndReplot(m_wellLogTrackPlotWidget); } } @@ -257,7 +257,7 @@ void RimWellLogTrack::loadDataAndUpdate() for (size_t cIdx = 0; cIdx < curves.size(); ++cIdx) { - curves[cIdx]->loadDataAndUpdate(); + curves[cIdx]->loadDataAndUpdate(true); } } @@ -281,8 +281,10 @@ void RimWellLogTrack::recreateViewer() for (size_t cIdx = 0; cIdx < curves.size(); ++cIdx) { - curves[cIdx]->setParentQwtPlot(this->m_wellLogTrackPlotWidget); + curves[cIdx]->setParentQwtPlotNoReplot(this->m_wellLogTrackPlotWidget); } + + this->m_wellLogTrackPlotWidget->replot(); } } diff --git a/ApplicationCode/ProjectDataModel/Summary/RimAsciiDataCurve.cpp b/ApplicationCode/ProjectDataModel/Summary/RimAsciiDataCurve.cpp index 3e4916104d..5ccef4e0a4 100644 --- a/ApplicationCode/ProjectDataModel/Summary/RimAsciiDataCurve.cpp +++ b/ApplicationCode/ProjectDataModel/Summary/RimAsciiDataCurve.cpp @@ -128,7 +128,7 @@ void RimAsciiDataCurve::updateZoomInParentPlot() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimAsciiDataCurve::onLoadDataAndUpdate() +void RimAsciiDataCurve::onLoadDataAndUpdate(bool updateParentPlot) { this->RimPlotCurve::updateCurvePresentation(); diff --git a/ApplicationCode/ProjectDataModel/Summary/RimAsciiDataCurve.h b/ApplicationCode/ProjectDataModel/Summary/RimAsciiDataCurve.h index 9685582d34..217432b4db 100644 --- a/ApplicationCode/ProjectDataModel/Summary/RimAsciiDataCurve.h +++ b/ApplicationCode/ProjectDataModel/Summary/RimAsciiDataCurve.h @@ -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* timeSteps, std::vector* values) const; diff --git a/ApplicationCode/ProjectDataModel/Summary/RimSummaryCurve.cpp b/ApplicationCode/ProjectDataModel/Summary/RimSummaryCurve.cpp index cc74730e88..a189fec525 100644 --- a/ApplicationCode/ProjectDataModel/Summary/RimSummaryCurve.cpp +++ b/ApplicationCode/ProjectDataModel/Summary/RimSummaryCurve.cpp @@ -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(), std::vector(), 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); } } diff --git a/ApplicationCode/ProjectDataModel/Summary/RimSummaryCurve.h b/ApplicationCode/ProjectDataModel/Summary/RimSummaryCurve.h index f4c7e16f33..eda142f079 100644 --- a/ApplicationCode/ProjectDataModel/Summary/RimSummaryCurve.h +++ b/ApplicationCode/ProjectDataModel/Summary/RimSummaryCurve.h @@ -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; diff --git a/ApplicationCode/ProjectDataModel/Summary/RimSummaryCurveAutoName.cpp b/ApplicationCode/ProjectDataModel/Summary/RimSummaryCurveAutoName.cpp index 2bba6b72cc..b778c38cdb 100644 --- a/ApplicationCode/ProjectDataModel/Summary/RimSummaryCurveAutoName.cpp +++ b/ApplicationCode/ProjectDataModel/Summary/RimSummaryCurveAutoName.cpp @@ -241,7 +241,7 @@ void RimSummaryCurveAutoName::fieldChangedByUi(const caf::PdmFieldHandle* change RimSummaryCurve* summaryCurve = dynamic_cast(this->parentField()->ownerObject()); if (summaryCurve) { - summaryCurve->updateCurveName(); + summaryCurve->updateCurveNameAndUpdatePlotLegend(); summaryCurve->updateConnectedEditors(); } diff --git a/ApplicationCode/ProjectDataModel/Summary/RimSummaryCurveCollection.cpp b/ApplicationCode/ProjectDataModel/Summary/RimSummaryCurveCollection.cpp index ab8fbc4e63..33a4743422 100644 --- a/ApplicationCode/ProjectDataModel/Summary/RimSummaryCurveCollection.cpp +++ b/ApplicationCode/ProjectDataModel/Summary/RimSummaryCurveCollection.cpp @@ -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(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/Summary/RimSummaryCurveCollection.h b/ApplicationCode/ProjectDataModel/Summary/RimSummaryCurveCollection.h index b36000bd83..60206cc5d4 100644 --- a/ApplicationCode/ProjectDataModel/Summary/RimSummaryCurveCollection.h +++ b/ApplicationCode/ProjectDataModel/Summary/RimSummaryCurveCollection.h @@ -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; diff --git a/ApplicationCode/ProjectDataModel/Summary/RimSummaryCurveFilter.cpp b/ApplicationCode/ProjectDataModel/Summary/RimSummaryCurveFilter.cpp index f6dbbb726e..8e69a578c9 100644 --- a/ApplicationCode/ProjectDataModel/Summary/RimSummaryCurveFilter.cpp +++ b/ApplicationCode/ProjectDataModel/Summary/RimSummaryCurveFilter.cpp @@ -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::setsetParentQwtPlot(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(); } } diff --git a/ApplicationCode/ProjectDataModel/Summary/RimSummaryCurveFilter.h b/ApplicationCode/ProjectDataModel/Summary/RimSummaryCurveFilter.h index 155ecfa194..6b039547b7 100644 --- a/ApplicationCode/ProjectDataModel/Summary/RimSummaryCurveFilter.h +++ b/ApplicationCode/ProjectDataModel/Summary/RimSummaryCurveFilter.h @@ -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; diff --git a/ApplicationCode/ProjectDataModel/Summary/RimSummaryPlot.cpp b/ApplicationCode/ProjectDataModel/Summary/RimSummaryPlot.cpp index 4eb9e30311..8bbdb1d712 100644 --- a/ApplicationCode/ProjectDataModel/Summary/RimSummaryPlot.cpp +++ b/ApplicationCode/ProjectDataModel/Summary/RimSummaryPlot.cpp @@ -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; } diff --git a/ApplicationCode/ProjectDataModel/Summary/RimSummaryPlot.h b/ApplicationCode/ProjectDataModel/Summary/RimSummaryPlot.h index 827fcf882f..f430ecfade 100644 --- a/ApplicationCode/ProjectDataModel/Summary/RimSummaryPlot.h +++ b/ApplicationCode/ProjectDataModel/Summary/RimSummaryPlot.h @@ -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 summaryCurves() const; void deleteAllSummaryCurves(); RimSummaryCurveCollection* summaryCurveCollection() const; + RiuSummaryQwtPlot* qwtPlot() const; + // RimViewWindow overrides public: virtual QWidget* createViewWidget(QWidget* mainWindowParent) override;