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- Ceetron Solutions AS
//
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// 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.
//
/////////////////////////////////////////////////////////////////////////////////
@ -49,7 +49,7 @@
CAF_CMD_SOURCE_INIT(RicCloseCaseFeature, "RicCloseCaseFeature");
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
bool RicCloseCaseFeature::isCommandEnabled()
{
@ -57,7 +57,7 @@ bool RicCloseCaseFeature::isCommandEnabled()
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RicCloseCaseFeature::onActionTriggered(bool isChecked)
{
@ -91,7 +91,7 @@ void RicCloseCaseFeature::onActionTriggered(bool isChecked)
RiuMainWindow::instance()->cleanupGuiCaseClose();
}
}
if (!geoMechCases.empty())
{
for (RimGeoMechCase* geoMechCase : geoMechCases)
@ -103,7 +103,7 @@ void RicCloseCaseFeature::onActionTriggered(bool isChecked)
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RicCloseCaseFeature::setupActionLook(QAction* actionToSetup)
{
@ -111,9 +111,8 @@ void RicCloseCaseFeature::setupActionLook(QAction* actionToSetup)
actionToSetup->setIcon(QIcon(":/Erase.png"));
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
std::vector<RimCase*> RicCloseCaseFeature::selectedCases() const
{
@ -123,14 +122,14 @@ std::vector<RimCase*> RicCloseCaseFeature::selectedCases() const
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RicCloseCaseFeature::removeCaseFromAllGroups(RimEclipseCase* eclipseCase)
{
CVF_ASSERT(eclipseCase);
RimProject* proj = RiaApplication::instance()->project();
RimOilField* activeOilField = proj ? proj->activeOilField() : nullptr;
RimProject* proj = RiaApplication::instance()->project();
RimOilField* activeOilField = proj ? proj->activeOilField() : nullptr;
RimEclipseCaseCollection* analysisModels = (activeOilField) ? activeOilField->analysisModels() : nullptr;
if (analysisModels)
{
@ -140,7 +139,7 @@ void RicCloseCaseFeature::removeCaseFromAllGroups(RimEclipseCase* eclipseCase)
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RicCloseCaseFeature::deleteEclipseCase(RimEclipseCase* eclipseCase)
{
@ -190,8 +189,9 @@ void RicCloseCaseFeature::deleteEclipseCase(RimEclipseCase* eclipseCase)
RimEclipseResultCase* resultCase = dynamic_cast<RimEclipseResultCase*>(eclipseCase);
if (resultCase)
{
RimProject* project = RiaApplication::instance()->project();
RimSummaryCaseMainCollection* sumCaseColl = project->activeOilField() ? project->activeOilField()->summaryCaseMainCollection() : nullptr;
RimProject* project = RiaApplication::instance()->project();
RimSummaryCaseMainCollection* sumCaseColl =
project->activeOilField() ? project->activeOilField()->summaryCaseMainCollection() : nullptr;
if (sumCaseColl)
{
RimSummaryCase* summaryCase = sumCaseColl->findSummaryCaseFromEclipseResultCase(resultCase);
@ -208,14 +208,14 @@ void RicCloseCaseFeature::deleteEclipseCase(RimEclipseCase* eclipseCase)
{
RimProject* project = RiaApplication::instance()->project();
std::vector<RimCase*> cases;
std::vector<RimCase*> cases;
project->allCases(cases);
if (cases.empty())
{
if (cases.empty())
{
project->multiSnapshotDefinitions.deleteAllChildObjects();
}
else
}
else
{
for (RimAdvancedSnapshotExportDefinition* msd : project->multiSnapshotDefinitions())
{
@ -226,15 +226,15 @@ void RicCloseCaseFeature::deleteEclipseCase(RimEclipseCase* eclipseCase)
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RicCloseCaseFeature::deleteGeoMechCase(RimGeoMechCase* geoMechCase)
{
CVF_ASSERT(geoMechCase);
RimProject* proj = RiaApplication::instance()->project();
RimOilField* activeOilField = proj ? proj->activeOilField() : nullptr;
RimGeoMechModels* models = (activeOilField) ? activeOilField->geoMechModels() : nullptr;
RimProject* proj = RiaApplication::instance()->project();
RimOilField* activeOilField = proj ? proj->activeOilField() : nullptr;
RimGeoMechModels* models = (activeOilField) ? activeOilField->geoMechModels() : nullptr;
if (models)
{
models->cases.removeChildObject(geoMechCase);
@ -245,7 +245,7 @@ void RicCloseCaseFeature::deleteGeoMechCase(RimGeoMechCase* geoMechCase)
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
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++)
{
RimEclipseStatisticsCase* rimStaticsCase = dynamic_cast<RimEclipseStatisticsCase*>(gridCaseGroup->statisticsCaseCollection()->reservoirs[i]);
RimEclipseStatisticsCase* rimStaticsCase =
dynamic_cast<RimEclipseStatisticsCase*>(gridCaseGroup->statisticsCaseCollection()->reservoirs[i]);
if (rimStaticsCase)
{
if (rimStaticsCase->hasComputedStatistics())
@ -266,18 +267,17 @@ bool RicCloseCaseFeature::hasAnyStatisticsResults(RimIdenticalGridCaseGroup* gri
return false;
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
bool RicCloseCaseFeature::userConfirmedGridCaseGroupChange(const std::vector<RimEclipseCase*>& casesToBeDeleted)
{
std::vector<RimIdenticalGridCaseGroup*> gridCaseGroups;
for (size_t i = 0; i < casesToBeDeleted.size(); i++)
for (auto caseToDelete : casesToBeDeleted)
{
RimIdenticalGridCaseGroup* gridCaseGroup = nullptr;
casesToBeDeleted[i]->firstAncestorOrThisOfType(gridCaseGroup);
caseToDelete->firstAncestorOrThisOfType(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();
@ -295,15 +295,16 @@ bool RicCloseCaseFeature::userConfirmedGridCaseGroupChange(const std::vector<Rim
QString questionText;
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.";
}
else
{
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.";

View File

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