#2873 Do only one updateAllRequiredEditors when closing cases

* Instead of one for every case that is being closed.
This commit is contained in:
Gaute Lindkvist 2018-05-23 13:33:10 +02:00
parent 743993718c
commit 4c6a56bb52
3 changed files with 20 additions and 6 deletions

View File

@ -22,8 +22,10 @@
#include "RifEclipseSummaryAddress.h" #include "RifEclipseSummaryAddress.h"
#include "RimOilField.h"
#include "RimMainPlotCollection.h" #include "RimMainPlotCollection.h"
#include "RimProject.h" #include "RimProject.h"
#include "RimSummaryCaseMainCollection.h"
#include "RimSummaryCrossPlot.h" #include "RimSummaryCrossPlot.h"
#include "RimSummaryCurve.h" #include "RimSummaryCurve.h"
#include "RimSummaryPlot.h" #include "RimSummaryPlot.h"
@ -42,6 +44,17 @@ RimSummaryPlotCollection* RiaSummaryTools::summaryPlotCollection()
return project->mainPlotCollection()->summaryPlotCollection(); return project->mainPlotCollection()->summaryPlotCollection();
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimSummaryCaseMainCollection* RiaSummaryTools::summaryCaseMainCollection()
{
RimProject* project = RiaApplication::instance()->project();
RimSummaryCaseMainCollection* summaryCaseMainCollection = project->activeOilField()->summaryCaseMainCollection();
CVF_ASSERT(summaryCaseMainCollection);
return summaryCaseMainCollection;
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// Update the summary curves referencing this curve, as the curve is identified by the name /// Update the summary curves referencing this curve, as the curve is identified by the name
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@ -22,6 +22,7 @@ class RimSummaryPlotCollection;
class RimSummaryPlot; class RimSummaryPlot;
class RimSummaryCrossPlot; class RimSummaryCrossPlot;
class RimSummaryCrossPlotCollection; class RimSummaryCrossPlotCollection;
class RimSummaryCaseMainCollection;
class QString; class QString;
@ -35,8 +36,9 @@ namespace caf {
class RiaSummaryTools class RiaSummaryTools
{ {
public: public:
static RimSummaryPlotCollection* summaryPlotCollection(); static RimSummaryPlotCollection* summaryPlotCollection();
static void notifyCalculatedCurveNameHasChanged(const QString& previousCurveName, static RimSummaryCaseMainCollection* summaryCaseMainCollection();
static void notifyCalculatedCurveNameHasChanged(const QString& previousCurveName,
const QString& currentCurveName); const QString& currentCurveName);
static RimSummaryPlot* parentSummaryPlot(caf::PdmObject* object); static RimSummaryPlot* parentSummaryPlot(caf::PdmObject* object);

View File

@ -54,6 +54,7 @@ void RicCloseSummaryCaseFeature::setupActionLook(QAction* actionToSetup)
void RicCloseSummaryCaseFeature::deleteSummaryCases(std::vector<RimSummaryCase*>& cases) void RicCloseSummaryCaseFeature::deleteSummaryCases(std::vector<RimSummaryCase*>& cases)
{ {
RimSummaryPlotCollection* summaryPlotColl = RiaSummaryTools::summaryPlotCollection(); RimSummaryPlotCollection* summaryPlotColl = RiaSummaryTools::summaryPlotCollection();
RimSummaryCaseMainCollection* summaryCaseMainCollection = RiaSummaryTools::summaryCaseMainCollection();
for (RimSummaryCase* summaryCase : cases) for (RimSummaryCase* summaryCase : cases)
{ {
@ -63,13 +64,11 @@ void RicCloseSummaryCaseFeature::deleteSummaryCases(std::vector<RimSummaryCase*>
} }
summaryPlotColl->updateConnectedEditors(); summaryPlotColl->updateConnectedEditors();
RimSummaryCaseMainCollection* summaryCaseMainCollection = nullptr;
summaryCase->firstAncestorOrThisOfTypeAsserted(summaryCaseMainCollection);
summaryCaseMainCollection->removeCase(summaryCase); summaryCaseMainCollection->removeCase(summaryCase);
summaryCaseMainCollection->updateAllRequiredEditors();
} }
summaryCaseMainCollection->updateAllRequiredEditors();
RiuPlotMainWindow* mainPlotWindow = RiaApplication::instance()->mainPlotWindow(); RiuPlotMainWindow* mainPlotWindow = RiaApplication::instance()->mainPlotWindow();
mainPlotWindow->updateSummaryPlotToolBar(); mainPlotWindow->updateSummaryPlotToolBar();