Whitespace

This commit is contained in:
Magne Sjaastad 2019-03-25 14:43:28 +01:00
parent d208d9104b
commit 5325f1d5fb
2 changed files with 44 additions and 45 deletions

View File

@ -2,17 +2,17 @@
// //
// Copyright (C) 2015- Statoil ASA // Copyright (C) 2015- Statoil ASA
// Copyright (C) 2015- Ceetron Solutions AS // Copyright (C) 2015- Ceetron Solutions AS
// //
// ResInsight is free software: you can redistribute it and/or modify // ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. // (at your option) any later version.
// //
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY // ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or // WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. // FITNESS FOR A PARTICULAR PURPOSE.
// //
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html> // See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details. // for more details.
// //
///////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////
@ -49,7 +49,7 @@
CAF_CMD_SOURCE_INIT(RicCloseCaseFeature, "RicCloseCaseFeature"); CAF_CMD_SOURCE_INIT(RicCloseCaseFeature, "RicCloseCaseFeature");
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
bool RicCloseCaseFeature::isCommandEnabled() bool RicCloseCaseFeature::isCommandEnabled()
{ {
@ -57,7 +57,7 @@ bool RicCloseCaseFeature::isCommandEnabled()
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RicCloseCaseFeature::onActionTriggered(bool isChecked) void RicCloseCaseFeature::onActionTriggered(bool isChecked)
{ {
@ -91,7 +91,7 @@ void RicCloseCaseFeature::onActionTriggered(bool isChecked)
RiuMainWindow::instance()->cleanupGuiCaseClose(); RiuMainWindow::instance()->cleanupGuiCaseClose();
} }
} }
if (!geoMechCases.empty()) if (!geoMechCases.empty())
{ {
for (RimGeoMechCase* geoMechCase : geoMechCases) for (RimGeoMechCase* geoMechCase : geoMechCases)
@ -103,7 +103,7 @@ void RicCloseCaseFeature::onActionTriggered(bool isChecked)
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RicCloseCaseFeature::setupActionLook(QAction* actionToSetup) void RicCloseCaseFeature::setupActionLook(QAction* actionToSetup)
{ {
@ -111,9 +111,8 @@ void RicCloseCaseFeature::setupActionLook(QAction* actionToSetup)
actionToSetup->setIcon(QIcon(":/Erase.png")); actionToSetup->setIcon(QIcon(":/Erase.png"));
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
std::vector<RimCase*> RicCloseCaseFeature::selectedCases() const std::vector<RimCase*> RicCloseCaseFeature::selectedCases() const
{ {
@ -123,14 +122,14 @@ std::vector<RimCase*> RicCloseCaseFeature::selectedCases() const
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RicCloseCaseFeature::removeCaseFromAllGroups(RimEclipseCase* eclipseCase) void RicCloseCaseFeature::removeCaseFromAllGroups(RimEclipseCase* eclipseCase)
{ {
CVF_ASSERT(eclipseCase); CVF_ASSERT(eclipseCase);
RimProject* proj = RiaApplication::instance()->project(); RimProject* proj = RiaApplication::instance()->project();
RimOilField* activeOilField = proj ? proj->activeOilField() : nullptr; RimOilField* activeOilField = proj ? proj->activeOilField() : nullptr;
RimEclipseCaseCollection* analysisModels = (activeOilField) ? activeOilField->analysisModels() : nullptr; RimEclipseCaseCollection* analysisModels = (activeOilField) ? activeOilField->analysisModels() : nullptr;
if (analysisModels) if (analysisModels)
{ {
@ -140,7 +139,7 @@ void RicCloseCaseFeature::removeCaseFromAllGroups(RimEclipseCase* eclipseCase)
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RicCloseCaseFeature::deleteEclipseCase(RimEclipseCase* eclipseCase) void RicCloseCaseFeature::deleteEclipseCase(RimEclipseCase* eclipseCase)
{ {
@ -190,8 +189,9 @@ void RicCloseCaseFeature::deleteEclipseCase(RimEclipseCase* eclipseCase)
RimEclipseResultCase* resultCase = dynamic_cast<RimEclipseResultCase*>(eclipseCase); RimEclipseResultCase* resultCase = dynamic_cast<RimEclipseResultCase*>(eclipseCase);
if (resultCase) if (resultCase)
{ {
RimProject* project = RiaApplication::instance()->project(); RimProject* project = RiaApplication::instance()->project();
RimSummaryCaseMainCollection* sumCaseColl = project->activeOilField() ? project->activeOilField()->summaryCaseMainCollection() : nullptr; RimSummaryCaseMainCollection* sumCaseColl =
project->activeOilField() ? project->activeOilField()->summaryCaseMainCollection() : nullptr;
if (sumCaseColl) if (sumCaseColl)
{ {
RimSummaryCase* summaryCase = sumCaseColl->findSummaryCaseFromEclipseResultCase(resultCase); RimSummaryCase* summaryCase = sumCaseColl->findSummaryCaseFromEclipseResultCase(resultCase);
@ -208,14 +208,14 @@ void RicCloseCaseFeature::deleteEclipseCase(RimEclipseCase* eclipseCase)
{ {
RimProject* project = RiaApplication::instance()->project(); RimProject* project = RiaApplication::instance()->project();
std::vector<RimCase*> cases; std::vector<RimCase*> cases;
project->allCases(cases); project->allCases(cases);
if (cases.empty()) if (cases.empty())
{ {
project->multiSnapshotDefinitions.deleteAllChildObjects(); project->multiSnapshotDefinitions.deleteAllChildObjects();
} }
else else
{ {
for (RimAdvancedSnapshotExportDefinition* msd : project->multiSnapshotDefinitions()) for (RimAdvancedSnapshotExportDefinition* msd : project->multiSnapshotDefinitions())
{ {
@ -226,15 +226,15 @@ void RicCloseCaseFeature::deleteEclipseCase(RimEclipseCase* eclipseCase)
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RicCloseCaseFeature::deleteGeoMechCase(RimGeoMechCase* geoMechCase) void RicCloseCaseFeature::deleteGeoMechCase(RimGeoMechCase* geoMechCase)
{ {
CVF_ASSERT(geoMechCase); CVF_ASSERT(geoMechCase);
RimProject* proj = RiaApplication::instance()->project(); RimProject* proj = RiaApplication::instance()->project();
RimOilField* activeOilField = proj ? proj->activeOilField() : nullptr; RimOilField* activeOilField = proj ? proj->activeOilField() : nullptr;
RimGeoMechModels* models = (activeOilField) ? activeOilField->geoMechModels() : nullptr; RimGeoMechModels* models = (activeOilField) ? activeOilField->geoMechModels() : nullptr;
if (models) if (models)
{ {
models->cases.removeChildObject(geoMechCase); models->cases.removeChildObject(geoMechCase);
@ -245,7 +245,7 @@ void RicCloseCaseFeature::deleteGeoMechCase(RimGeoMechCase* geoMechCase)
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
bool RicCloseCaseFeature::hasAnyStatisticsResults(RimIdenticalGridCaseGroup* gridCaseGroup) bool RicCloseCaseFeature::hasAnyStatisticsResults(RimIdenticalGridCaseGroup* gridCaseGroup)
{ {
@ -253,7 +253,8 @@ bool RicCloseCaseFeature::hasAnyStatisticsResults(RimIdenticalGridCaseGroup* gri
for (size_t i = 0; i < gridCaseGroup->statisticsCaseCollection()->reservoirs().size(); i++) for (size_t i = 0; i < gridCaseGroup->statisticsCaseCollection()->reservoirs().size(); i++)
{ {
RimEclipseStatisticsCase* rimStaticsCase = dynamic_cast<RimEclipseStatisticsCase*>(gridCaseGroup->statisticsCaseCollection()->reservoirs[i]); RimEclipseStatisticsCase* rimStaticsCase =
dynamic_cast<RimEclipseStatisticsCase*>(gridCaseGroup->statisticsCaseCollection()->reservoirs[i]);
if (rimStaticsCase) if (rimStaticsCase)
{ {
if (rimStaticsCase->hasComputedStatistics()) if (rimStaticsCase->hasComputedStatistics())
@ -266,18 +267,17 @@ bool RicCloseCaseFeature::hasAnyStatisticsResults(RimIdenticalGridCaseGroup* gri
return false; return false;
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
bool RicCloseCaseFeature::userConfirmedGridCaseGroupChange(const std::vector<RimEclipseCase*>& casesToBeDeleted) bool RicCloseCaseFeature::userConfirmedGridCaseGroupChange(const std::vector<RimEclipseCase*>& casesToBeDeleted)
{ {
std::vector<RimIdenticalGridCaseGroup*> gridCaseGroups; std::vector<RimIdenticalGridCaseGroup*> gridCaseGroups;
for (size_t i = 0; i < casesToBeDeleted.size(); i++) for (auto caseToDelete : casesToBeDeleted)
{ {
RimIdenticalGridCaseGroup* gridCaseGroup = nullptr; RimIdenticalGridCaseGroup* gridCaseGroup = nullptr;
casesToBeDeleted[i]->firstAncestorOrThisOfType(gridCaseGroup); caseToDelete->firstAncestorOrThisOfType(gridCaseGroup);
if (gridCaseGroup && hasAnyStatisticsResults(gridCaseGroup)) if (gridCaseGroup && hasAnyStatisticsResults(gridCaseGroup))
{ {
@ -285,7 +285,7 @@ bool RicCloseCaseFeature::userConfirmedGridCaseGroupChange(const std::vector<Rim
} }
} }
if (gridCaseGroups.size() > 0) if (!gridCaseGroups.empty())
{ {
RiuMainWindow* mainWnd = RiuMainWindow::instance(); RiuMainWindow* mainWnd = RiuMainWindow::instance();
@ -295,15 +295,16 @@ bool RicCloseCaseFeature::userConfirmedGridCaseGroupChange(const std::vector<Rim
QString questionText; QString questionText;
if (gridCaseGroups.size() == 1) if (gridCaseGroups.size() == 1)
{ {
questionText = QString("This operation will invalidate statistics results in grid case group\n\"%1\".\n").arg(gridCaseGroups[0]->name()); questionText = QString("This operation will invalidate statistics results in grid case group\n\"%1\".\n")
.arg(gridCaseGroups[0]->name());
questionText += "Computed results in this group will be deleted if you continue."; questionText += "Computed results in this group will be deleted if you continue.";
} }
else else
{ {
questionText = "This operation will invalidate statistics results in grid case groups\n"; questionText = "This operation will invalidate statistics results in grid case groups\n";
for (size_t i = 0; i < gridCaseGroups.size(); i++) for (auto& gridCaseGroup : gridCaseGroups)
{ {
questionText += QString("\"%1\"\n").arg(gridCaseGroups[i]->name()); questionText += QString("\"%1\"\n").arg(gridCaseGroup->name());
} }
questionText += "Computed results in these groups will be deleted if you continue."; questionText += "Computed results in these groups will be deleted if you continue.";

View File

@ -2,17 +2,17 @@
// //
// Copyright (C) 2015- Statoil ASA // Copyright (C) 2015- Statoil ASA
// Copyright (C) 2015- Ceetron Solutions AS // Copyright (C) 2015- Ceetron Solutions AS
// //
// ResInsight is free software: you can redistribute it and/or modify // ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. // (at your option) any later version.
// //
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY // ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or // WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. // FITNESS FOR A PARTICULAR PURPOSE.
// //
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html> // See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details. // for more details.
// //
///////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////
@ -29,7 +29,7 @@ class RimCase;
class RimIdenticalGridCaseGroup; class RimIdenticalGridCaseGroup;
//================================================================================================== //==================================================================================================
/// ///
//================================================================================================== //==================================================================================================
class RicCloseCaseFeature : public caf::CmdFeature class RicCloseCaseFeature : public caf::CmdFeature
{ {
@ -42,16 +42,14 @@ public:
protected: protected:
// Overrides // Overrides
bool isCommandEnabled() override; bool isCommandEnabled() override;
void onActionTriggered( bool isChecked ) override; void onActionTriggered(bool isChecked) override;
void setupActionLook( QAction* actionToSetup ) override; void setupActionLook(QAction* actionToSetup) override;
private: private:
std::vector<RimCase*> selectedCases() const; std::vector<RimCase*> selectedCases() const;
void deleteGeoMechCase(RimGeoMechCase* geoMechCase); void deleteGeoMechCase(RimGeoMechCase* geoMechCase);
static bool hasAnyStatisticsResults(RimIdenticalGridCaseGroup* gridCaseGroup); static bool hasAnyStatisticsResults(RimIdenticalGridCaseGroup* gridCaseGroup);
static void removeCaseFromAllGroups(RimEclipseCase* eclipseCase); static void removeCaseFromAllGroups(RimEclipseCase* eclipseCase);
}; };