mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#4683 clang-format on all files in ApplicationCode
This commit is contained in:
@@ -46,7 +46,7 @@
|
||||
#include <QAction>
|
||||
#include <QMessageBox>
|
||||
|
||||
CAF_CMD_SOURCE_INIT(RicCloseCaseFeature, "RicCloseCaseFeature");
|
||||
CAF_CMD_SOURCE_INIT( RicCloseCaseFeature, "RicCloseCaseFeature" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
@@ -59,44 +59,44 @@ bool RicCloseCaseFeature::isCommandEnabled()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicCloseCaseFeature::onActionTriggered(bool isChecked)
|
||||
void RicCloseCaseFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
std::vector<RimEclipseCase*> eclipseCases;
|
||||
std::vector<RimGeoMechCase*> geoMechCases;
|
||||
for (RimCase* rimCase : selectedCases())
|
||||
for ( RimCase* rimCase : selectedCases() )
|
||||
{
|
||||
RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>(rimCase);
|
||||
if (eclipseCase)
|
||||
RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>( rimCase );
|
||||
if ( eclipseCase )
|
||||
{
|
||||
eclipseCases.push_back(eclipseCase);
|
||||
eclipseCases.push_back( eclipseCase );
|
||||
}
|
||||
else
|
||||
{
|
||||
RimGeoMechCase* geoMechCase = dynamic_cast<RimGeoMechCase*>(rimCase);
|
||||
if (geoMechCase)
|
||||
RimGeoMechCase* geoMechCase = dynamic_cast<RimGeoMechCase*>( rimCase );
|
||||
if ( geoMechCase )
|
||||
{
|
||||
geoMechCases.push_back(geoMechCase);
|
||||
geoMechCases.push_back( geoMechCase );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!eclipseCases.empty())
|
||||
if ( !eclipseCases.empty() )
|
||||
{
|
||||
if (userConfirmedGridCaseGroupChange(eclipseCases))
|
||||
if ( userConfirmedGridCaseGroupChange( eclipseCases ) )
|
||||
{
|
||||
for (RimEclipseCase* eclipseCase : eclipseCases)
|
||||
for ( RimEclipseCase* eclipseCase : eclipseCases )
|
||||
{
|
||||
deleteEclipseCase(eclipseCase);
|
||||
deleteEclipseCase( eclipseCase );
|
||||
}
|
||||
RiuMainWindow::instance()->cleanupGuiCaseClose();
|
||||
}
|
||||
}
|
||||
|
||||
if (!geoMechCases.empty())
|
||||
if ( !geoMechCases.empty() )
|
||||
{
|
||||
for (RimGeoMechCase* geoMechCase : geoMechCases)
|
||||
for ( RimGeoMechCase* geoMechCase : geoMechCases )
|
||||
{
|
||||
deleteGeoMechCase(geoMechCase);
|
||||
deleteGeoMechCase( geoMechCase );
|
||||
}
|
||||
RiuMainWindow::instance()->cleanupGuiCaseClose();
|
||||
}
|
||||
@@ -105,11 +105,11 @@ void RicCloseCaseFeature::onActionTriggered(bool isChecked)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicCloseCaseFeature::setupActionLook(QAction* actionToSetup)
|
||||
void RicCloseCaseFeature::setupActionLook( QAction* actionToSetup )
|
||||
{
|
||||
actionToSetup->setText("Close");
|
||||
actionToSetup->setIcon(QIcon(":/Erase.png"));
|
||||
applyShortcutWithHintToAction(actionToSetup, QKeySequence::Delete);
|
||||
actionToSetup->setText( "Close" );
|
||||
actionToSetup->setIcon( QIcon( ":/Erase.png" ) );
|
||||
applyShortcutWithHintToAction( actionToSetup, QKeySequence::Delete );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -118,23 +118,23 @@ void RicCloseCaseFeature::setupActionLook(QAction* actionToSetup)
|
||||
std::vector<RimCase*> RicCloseCaseFeature::selectedCases() const
|
||||
{
|
||||
std::vector<RimCase*> selection;
|
||||
caf::SelectionManager::instance()->objectsByType(&selection);
|
||||
caf::SelectionManager::instance()->objectsByType( &selection );
|
||||
return selection;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicCloseCaseFeature::removeCaseFromAllGroups(RimEclipseCase* eclipseCase)
|
||||
void RicCloseCaseFeature::removeCaseFromAllGroups( RimEclipseCase* eclipseCase )
|
||||
{
|
||||
CVF_ASSERT(eclipseCase);
|
||||
CVF_ASSERT( eclipseCase );
|
||||
|
||||
RimProject* proj = RiaApplication::instance()->project();
|
||||
RimOilField* activeOilField = proj ? proj->activeOilField() : nullptr;
|
||||
RimEclipseCaseCollection* analysisModels = (activeOilField) ? activeOilField->analysisModels() : nullptr;
|
||||
if (analysisModels)
|
||||
RimEclipseCaseCollection* analysisModels = ( activeOilField ) ? activeOilField->analysisModels() : nullptr;
|
||||
if ( analysisModels )
|
||||
{
|
||||
analysisModels->removeCaseFromAllGroups(eclipseCase);
|
||||
analysisModels->removeCaseFromAllGroups( eclipseCase );
|
||||
analysisModels->updateConnectedEditors();
|
||||
}
|
||||
}
|
||||
@@ -142,64 +142,65 @@ void RicCloseCaseFeature::removeCaseFromAllGroups(RimEclipseCase* eclipseCase)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicCloseCaseFeature::deleteEclipseCase(RimEclipseCase* eclipseCase)
|
||||
void RicCloseCaseFeature::deleteEclipseCase( RimEclipseCase* eclipseCase )
|
||||
{
|
||||
CVF_ASSERT(eclipseCase);
|
||||
CVF_ASSERT( eclipseCase );
|
||||
|
||||
RimCaseCollection* caseCollection = eclipseCase->parentCaseCollection();
|
||||
if (caseCollection)
|
||||
if ( caseCollection )
|
||||
{
|
||||
if (RimIdenticalGridCaseGroup::isStatisticsCaseCollection(caseCollection))
|
||||
if ( RimIdenticalGridCaseGroup::isStatisticsCaseCollection( caseCollection ) )
|
||||
{
|
||||
RimIdenticalGridCaseGroup* caseGroup = caseCollection->parentCaseGroup();
|
||||
CVF_ASSERT(caseGroup);
|
||||
CVF_ASSERT( caseGroup );
|
||||
|
||||
caseGroup->statisticsCaseCollection()->reservoirs.removeChildObject(eclipseCase);
|
||||
caseGroup->statisticsCaseCollection()->reservoirs.removeChildObject( eclipseCase );
|
||||
caseGroup->updateConnectedEditors();
|
||||
}
|
||||
else
|
||||
{
|
||||
RimIdenticalGridCaseGroup* caseGroup = caseCollection->parentCaseGroup();
|
||||
if (caseGroup)
|
||||
if ( caseGroup )
|
||||
{
|
||||
// When deleting the last source case for statistics, remove any views on statistics cases.
|
||||
// This is done because the views do not work well
|
||||
if (caseGroup->caseCollection()->reservoirs.size() == 1)
|
||||
if ( caseGroup->caseCollection()->reservoirs.size() == 1 )
|
||||
{
|
||||
std::vector<caf::PdmObjectHandle*> children;
|
||||
caseGroup->statisticsCaseCollection()->reservoirs.childObjects(&children);
|
||||
caseGroup->statisticsCaseCollection()->reservoirs.childObjects( &children );
|
||||
|
||||
for (size_t i = children.size(); i-- > 0;)
|
||||
for ( size_t i = children.size(); i-- > 0; )
|
||||
{
|
||||
caf::PdmObjectHandle* obj = children[i];
|
||||
delete obj;
|
||||
caseGroup->statisticsCaseCollection()->reservoirs.erase(i);
|
||||
caseGroup->statisticsCaseCollection()->reservoirs.erase( i );
|
||||
}
|
||||
|
||||
caseGroup->statisticsCaseCollection()->uiCapability()->updateConnectedEditors();
|
||||
}
|
||||
}
|
||||
removeCaseFromAllGroups(eclipseCase);
|
||||
removeCaseFromAllGroups( eclipseCase );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
removeCaseFromAllGroups(eclipseCase);
|
||||
removeCaseFromAllGroups( eclipseCase );
|
||||
}
|
||||
|
||||
RimEclipseResultCase* resultCase = dynamic_cast<RimEclipseResultCase*>(eclipseCase);
|
||||
if (resultCase)
|
||||
RimEclipseResultCase* resultCase = dynamic_cast<RimEclipseResultCase*>( eclipseCase );
|
||||
if ( resultCase )
|
||||
{
|
||||
RimProject* project = RiaApplication::instance()->project();
|
||||
RimSummaryCaseMainCollection* sumCaseColl =
|
||||
project->activeOilField() ? project->activeOilField()->summaryCaseMainCollection() : nullptr;
|
||||
if (sumCaseColl)
|
||||
RimProject* project = RiaApplication::instance()->project();
|
||||
RimSummaryCaseMainCollection* sumCaseColl = project->activeOilField()
|
||||
? project->activeOilField()->summaryCaseMainCollection()
|
||||
: nullptr;
|
||||
if ( sumCaseColl )
|
||||
{
|
||||
RimSummaryCase* summaryCase = sumCaseColl->findSummaryCaseFromEclipseResultCase(resultCase);
|
||||
if (summaryCase)
|
||||
RimSummaryCase* summaryCase = sumCaseColl->findSummaryCaseFromEclipseResultCase( resultCase );
|
||||
if ( summaryCase )
|
||||
{
|
||||
RimGridSummaryCase* gridSummaryCase = dynamic_cast<RimGridSummaryCase*>(summaryCase);
|
||||
sumCaseColl->convertGridSummaryCasesToFileSummaryCases(gridSummaryCase);
|
||||
RimGridSummaryCase* gridSummaryCase = dynamic_cast<RimGridSummaryCase*>( summaryCase );
|
||||
sumCaseColl->convertGridSummaryCasesToFileSummaryCases( gridSummaryCase );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -210,17 +211,17 @@ void RicCloseCaseFeature::deleteEclipseCase(RimEclipseCase* eclipseCase)
|
||||
RimProject* project = RiaApplication::instance()->project();
|
||||
|
||||
std::vector<RimCase*> cases;
|
||||
project->allCases(cases);
|
||||
project->allCases( cases );
|
||||
|
||||
if (cases.empty())
|
||||
if ( cases.empty() )
|
||||
{
|
||||
project->multiSnapshotDefinitions.deleteAllChildObjects();
|
||||
}
|
||||
else
|
||||
{
|
||||
for (RimAdvancedSnapshotExportDefinition* msd : project->multiSnapshotDefinitions())
|
||||
for ( RimAdvancedSnapshotExportDefinition* msd : project->multiSnapshotDefinitions() )
|
||||
{
|
||||
msd->additionalCases.removePtr(nullptr);
|
||||
msd->additionalCases.removePtr( nullptr );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -229,16 +230,16 @@ 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();
|
||||
RimOilField* activeOilField = proj ? proj->activeOilField() : nullptr;
|
||||
RimGeoMechModels* models = (activeOilField) ? activeOilField->geoMechModels() : nullptr;
|
||||
if (models)
|
||||
RimGeoMechModels* models = ( activeOilField ) ? activeOilField->geoMechModels() : nullptr;
|
||||
if ( models )
|
||||
{
|
||||
models->cases.removeChildObject(geoMechCase);
|
||||
models->cases.removeChildObject( geoMechCase );
|
||||
models->updateConnectedEditors();
|
||||
}
|
||||
|
||||
@@ -248,17 +249,17 @@ void RicCloseCaseFeature::deleteGeoMechCase(RimGeoMechCase* geoMechCase)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicCloseCaseFeature::hasAnyStatisticsResults(RimIdenticalGridCaseGroup* gridCaseGroup)
|
||||
bool RicCloseCaseFeature::hasAnyStatisticsResults( RimIdenticalGridCaseGroup* gridCaseGroup )
|
||||
{
|
||||
CVF_ASSERT(gridCaseGroup);
|
||||
CVF_ASSERT( gridCaseGroup );
|
||||
|
||||
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]);
|
||||
if (rimStaticsCase)
|
||||
RimEclipseStatisticsCase* rimStaticsCase = dynamic_cast<RimEclipseStatisticsCase*>(
|
||||
gridCaseGroup->statisticsCaseCollection()->reservoirs[i] );
|
||||
if ( rimStaticsCase )
|
||||
{
|
||||
if (rimStaticsCase->hasComputedStatistics())
|
||||
if ( rimStaticsCase->hasComputedStatistics() )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -271,52 +272,52 @@ bool RicCloseCaseFeature::hasAnyStatisticsResults(RimIdenticalGridCaseGroup* gri
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicCloseCaseFeature::userConfirmedGridCaseGroupChange(const std::vector<RimEclipseCase*>& casesToBeDeleted)
|
||||
bool RicCloseCaseFeature::userConfirmedGridCaseGroupChange( const std::vector<RimEclipseCase*>& casesToBeDeleted )
|
||||
{
|
||||
std::vector<RimIdenticalGridCaseGroup*> gridCaseGroups;
|
||||
|
||||
for (auto caseToDelete : casesToBeDeleted)
|
||||
for ( auto caseToDelete : casesToBeDeleted )
|
||||
{
|
||||
RimIdenticalGridCaseGroup* gridCaseGroup = nullptr;
|
||||
caseToDelete->firstAncestorOrThisOfType(gridCaseGroup);
|
||||
caseToDelete->firstAncestorOrThisOfType( gridCaseGroup );
|
||||
|
||||
if (gridCaseGroup && hasAnyStatisticsResults(gridCaseGroup))
|
||||
if ( gridCaseGroup && hasAnyStatisticsResults( gridCaseGroup ) )
|
||||
{
|
||||
gridCaseGroups.push_back(gridCaseGroup);
|
||||
gridCaseGroups.push_back( gridCaseGroup );
|
||||
}
|
||||
}
|
||||
|
||||
if (!gridCaseGroups.empty())
|
||||
if ( !gridCaseGroups.empty() )
|
||||
{
|
||||
RiuMainWindow* mainWnd = RiuMainWindow::instance();
|
||||
|
||||
QMessageBox msgBox(mainWnd);
|
||||
msgBox.setIcon(QMessageBox::Question);
|
||||
QMessageBox msgBox( mainWnd );
|
||||
msgBox.setIcon( QMessageBox::Question );
|
||||
|
||||
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.";
|
||||
}
|
||||
else
|
||||
{
|
||||
questionText = "This operation will invalidate statistics results in grid case groups\n";
|
||||
for (auto& gridCaseGroup : gridCaseGroups)
|
||||
for ( auto& gridCaseGroup : gridCaseGroups )
|
||||
{
|
||||
questionText += QString("\"%1\"\n").arg(gridCaseGroup->name());
|
||||
questionText += QString( "\"%1\"\n" ).arg( gridCaseGroup->name() );
|
||||
}
|
||||
|
||||
questionText += "Computed results in these groups will be deleted if you continue.";
|
||||
}
|
||||
|
||||
msgBox.setText(questionText);
|
||||
msgBox.setInformativeText("Do you want to continue?");
|
||||
msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
|
||||
msgBox.setText( questionText );
|
||||
msgBox.setInformativeText( "Do you want to continue?" );
|
||||
msgBox.setStandardButtons( QMessageBox::Yes | QMessageBox::No );
|
||||
|
||||
int ret = msgBox.exec();
|
||||
if (ret == QMessageBox::No)
|
||||
if ( ret == QMessageBox::No )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user