#4683 clang-format on all files in ApplicationCode

This commit is contained in:
Magne Sjaastad
2019-09-06 10:40:57 +02:00
parent 3a317504bb
commit fe9e567825
2092 changed files with 117952 additions and 111846 deletions

View File

@@ -1,17 +1,17 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2011-2012 Statoil ASA, Ceetron 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.
//
/////////////////////////////////////////////////////////////////////////////////
@@ -28,105 +28,103 @@
#include <QFileInfo>
namespace caf {
template<>
void caf::AppEnum< RimWellPathImport::UtmFilterEnum >::setUp()
{
addItem(RimWellPathImport::UTM_FILTER_OFF, "UTM_FILTER_OFF", "Off");
addItem(RimWellPathImport::UTM_FILTER_PROJECT, "UTM_FILTER_PROJECT", "Project");
addItem(RimWellPathImport::UTM_FILTER_CUSTOM, "UTM_FILTER_CUSTOM", "Custom");
setDefault(RimWellPathImport::UTM_FILTER_PROJECT);
}
namespace caf
{
template <>
void caf::AppEnum<RimWellPathImport::UtmFilterEnum>::setUp()
{
addItem( RimWellPathImport::UTM_FILTER_OFF, "UTM_FILTER_OFF", "Off" );
addItem( RimWellPathImport::UTM_FILTER_PROJECT, "UTM_FILTER_PROJECT", "Project" );
addItem( RimWellPathImport::UTM_FILTER_CUSTOM, "UTM_FILTER_CUSTOM", "Custom" );
setDefault( RimWellPathImport::UTM_FILTER_PROJECT );
}
} // End namespace caf
CAF_PDM_SOURCE_INIT(RimWellPathImport, "RimWellPathImport");
CAF_PDM_SOURCE_INIT( RimWellPathImport, "RimWellPathImport" );
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
RimWellPathImport::RimWellPathImport()
{
CAF_PDM_InitObject("RimWellPathImport", "", "", "");
CAF_PDM_InitObject( "RimWellPathImport", "", "", "" );
CAF_PDM_InitField( &wellTypeSurvey, "WellTypeSurvey", true, "Survey", "", "", "" );
CAF_PDM_InitField( &wellTypePlans, "WellTypePlans", true, "Plans", "", "", "" );
CAF_PDM_InitField(&wellTypeSurvey, "WellTypeSurvey", true, "Survey", "", "", "");
CAF_PDM_InitField(&wellTypePlans, "WellTypePlans", true, "Plans", "", "", "");
caf::AppEnum<RimWellPathImport::UtmFilterEnum> defaultUtmMode = UTM_FILTER_OFF;
CAF_PDM_InitField(&utmFilterMode, "UtmMode", defaultUtmMode, "Utm Filter", "", "", "");
CAF_PDM_InitField( &utmFilterMode, "UtmMode", defaultUtmMode, "Utm Filter", "", "", "" );
CAF_PDM_InitField(&north, "UtmNorth", 0.0, "North", "", "", "");
CAF_PDM_InitField(&south, "UtmSouth", 0.0, "South", "", "", "");
CAF_PDM_InitField(&east, "UtmEast", 0.0, "East", "", "", "");
CAF_PDM_InitField(&west, "UtmWest", 0.0, "West", "", "", "");
CAF_PDM_InitField( &north, "UtmNorth", 0.0, "North", "", "", "" );
CAF_PDM_InitField( &south, "UtmSouth", 0.0, "South", "", "", "" );
CAF_PDM_InitField( &east, "UtmEast", 0.0, "East", "", "", "" );
CAF_PDM_InitField( &west, "UtmWest", 0.0, "West", "", "", "" );
CAF_PDM_InitFieldNoDefault(&regions, "Regions", "", "", "", "");
regions.uiCapability()->setUiHidden(true);
CAF_PDM_InitFieldNoDefault( &regions, "Regions", "", "", "", "" );
regions.uiCapability()->setUiHidden( true );
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RimWellPathImport::updateRegions(const QStringList& regionStrings, const QStringList& fieldStrings, const QStringList& edmIds)
void RimWellPathImport::updateRegions( const QStringList& regionStrings,
const QStringList& fieldStrings,
const QStringList& edmIds )
{
assert(regionStrings.size() == fieldStrings.size() && regionStrings.size() == edmIds.size());
assert( regionStrings.size() == fieldStrings.size() && regionStrings.size() == edmIds.size() );
std::vector<RimOilRegionEntry*> regionsToRemove;
// Remove regions and fields not present in last request
for (size_t regionIdx = 0; regionIdx < this->regions.size(); regionIdx++)
for ( size_t regionIdx = 0; regionIdx < this->regions.size(); regionIdx++ )
{
if (!regionStrings.contains(this->regions[regionIdx]->name))
if ( !regionStrings.contains( this->regions[regionIdx]->name ) )
{
regionsToRemove.push_back(this->regions[regionIdx]);
regionsToRemove.push_back( this->regions[regionIdx] );
}
else
{
std::vector<RimOilFieldEntry*> fieldsToRemove;
for (size_t fIdx = 0; fIdx < this->regions[regionIdx]->fields.size(); fIdx++)
for ( size_t fIdx = 0; fIdx < this->regions[regionIdx]->fields.size(); fIdx++ )
{
if (!fieldStrings.contains(this->regions[regionIdx]->fields[fIdx]->name))
if ( !fieldStrings.contains( this->regions[regionIdx]->fields[fIdx]->name ) )
{
fieldsToRemove.push_back(this->regions[regionIdx]->fields[fIdx]);
fieldsToRemove.push_back( this->regions[regionIdx]->fields[fIdx] );
}
}
for (size_t i = 0; i < fieldsToRemove.size(); i++)
for ( size_t i = 0; i < fieldsToRemove.size(); i++ )
{
this->regions[regionIdx]->fields.removeChildObject(fieldsToRemove[i]);
this->regions[regionIdx]->fields.removeChildObject( fieldsToRemove[i] );
delete fieldsToRemove[i];
}
}
}
for (size_t i = 0; i < regionsToRemove.size(); i++)
for ( size_t i = 0; i < regionsToRemove.size(); i++ )
{
this->regions.removeChildObject(regionsToRemove[i]);
this->regions.removeChildObject( regionsToRemove[i] );
delete regionsToRemove[i];
}
for (int i = 0; i < regionStrings.size(); i++)
for ( int i = 0; i < regionStrings.size(); i++ )
{
RimOilRegionEntry* oilRegionEntry = nullptr;
RimOilFieldEntry* oilFieldEntry = nullptr;
RimOilFieldEntry* oilFieldEntry = nullptr;
for (size_t regionIdx = 0; regionIdx < this->regions.size(); regionIdx++)
for ( size_t regionIdx = 0; regionIdx < this->regions.size(); regionIdx++ )
{
if (this->regions[regionIdx]->name == regionStrings[i])
if ( this->regions[regionIdx]->name == regionStrings[i] )
{
oilRegionEntry = this->regions[regionIdx];
for (size_t fIdx = 0; fIdx < this->regions[regionIdx]->fields.size(); fIdx++)
for ( size_t fIdx = 0; fIdx < this->regions[regionIdx]->fields.size(); fIdx++ )
{
if (this->regions[regionIdx]->fields[fIdx]->edmId == edmIds[i])
if ( this->regions[regionIdx]->fields[fIdx]->edmId == edmIds[i] )
{
oilFieldEntry = this->regions[regionIdx]->fields[fIdx];
}
@@ -134,23 +132,23 @@ void RimWellPathImport::updateRegions(const QStringList& regionStrings, const QS
}
}
if (!oilRegionEntry)
if ( !oilRegionEntry )
{
oilRegionEntry = new RimOilRegionEntry;
oilRegionEntry = new RimOilRegionEntry;
oilRegionEntry->name = regionStrings[i];
this->regions.push_back(oilRegionEntry);
this->regions.push_back( oilRegionEntry );
}
assert(oilRegionEntry);
assert( oilRegionEntry );
if (!oilFieldEntry)
if ( !oilFieldEntry )
{
oilFieldEntry = new RimOilFieldEntry;
oilFieldEntry->name = fieldStrings[i];
oilFieldEntry = new RimOilFieldEntry;
oilFieldEntry->name = fieldStrings[i];
oilFieldEntry->edmId = edmIds[i];
oilRegionEntry->fields.push_back(oilFieldEntry);
oilRegionEntry->fields.push_back( oilFieldEntry );
}
}
@@ -158,7 +156,7 @@ void RimWellPathImport::updateRegions(const QStringList& regionStrings, const QS
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RimWellPathImport::initAfterRead()
{
@@ -166,44 +164,46 @@ void RimWellPathImport::initAfterRead()
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RimWellPathImport::updateFieldVisibility()
{
if (utmFilterMode == UTM_FILTER_CUSTOM)
if ( utmFilterMode == UTM_FILTER_CUSTOM )
{
north.uiCapability()->setUiReadOnly(false);
south.uiCapability()->setUiReadOnly(false);
east.uiCapability()->setUiReadOnly(false);
west.uiCapability()->setUiReadOnly(false);
north.uiCapability()->setUiReadOnly( false );
south.uiCapability()->setUiReadOnly( false );
east.uiCapability()->setUiReadOnly( false );
west.uiCapability()->setUiReadOnly( false );
}
else
{
north.uiCapability()->setUiReadOnly(true);
south.uiCapability()->setUiReadOnly(true);
east.uiCapability()->setUiReadOnly(true);
west.uiCapability()->setUiReadOnly(true);
north.uiCapability()->setUiReadOnly( true );
south.uiCapability()->setUiReadOnly( true );
east.uiCapability()->setUiReadOnly( true );
west.uiCapability()->setUiReadOnly( true );
}
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RimWellPathImport::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
void RimWellPathImport::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
const QVariant& newValue )
{
if (changedField == &utmFilterMode)
if ( changedField == &utmFilterMode )
{
updateFieldVisibility();
}
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RimWellPathImport::defineObjectEditorAttribute(QString uiConfigName, caf::PdmUiEditorAttribute * attribute)
void RimWellPathImport::defineObjectEditorAttribute( QString uiConfigName, caf::PdmUiEditorAttribute* attribute )
{
caf::PdmUiTreeViewEditorAttribute* myAttr = dynamic_cast<caf::PdmUiTreeViewEditorAttribute*>(attribute);
if (myAttr)
caf::PdmUiTreeViewEditorAttribute* myAttr = dynamic_cast<caf::PdmUiTreeViewEditorAttribute*>( attribute );
if ( myAttr )
{
QStringList colHeaders;
colHeaders << "Region";
@@ -212,7 +212,7 @@ void RimWellPathImport::defineObjectEditorAttribute(QString uiConfigName, caf::P
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
RimWellPathImport::~RimWellPathImport()
{
@@ -220,36 +220,33 @@ RimWellPathImport::~RimWellPathImport()
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RimWellPathImport::updateFilePaths()
{
QString wellPathsFolderPath = RimTools::getCacheRootDirectoryPathFromProject();
wellPathsFolderPath += "_wellpaths";
for (size_t regionIdx = 0; regionIdx < this->regions.size(); regionIdx++)
for ( size_t regionIdx = 0; regionIdx < this->regions.size(); regionIdx++ )
{
for (size_t fIdx = 0; fIdx < this->regions[regionIdx]->fields.size(); fIdx++)
for ( size_t fIdx = 0; fIdx < this->regions[regionIdx]->fields.size(); fIdx++ )
{
RimOilFieldEntry* oilField = this->regions[regionIdx]->fields[fIdx];
QFileInfo fi(oilField->wellsFilePath);
QFileInfo fi( oilField->wellsFilePath );
QString newWellsFilePath = wellPathsFolderPath + "/" + fi.fileName();
oilField->wellsFilePath = newWellsFilePath;
oilField->wellsFilePath = newWellsFilePath;
for (size_t wIdx = 0; wIdx < oilField->wells.size(); wIdx++)
for ( size_t wIdx = 0; wIdx < oilField->wells.size(); wIdx++ )
{
RimWellPathEntry* rimWellPathEntry = oilField->wells[wIdx];
QFileInfo fiWell(rimWellPathEntry->wellPathFilePath);
QFileInfo fiWell( rimWellPathEntry->wellPathFilePath );
QString newFilePath = wellPathsFolderPath + "/" + fiWell.fileName();
QString newFilePath = wellPathsFolderPath + "/" + fiWell.fileName();
rimWellPathEntry->wellPathFilePath = newFilePath;
}
}
}
}