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:
@@ -1,17 +1,17 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil ASA
|
||||
//
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -37,15 +37,14 @@
|
||||
#include <QAction>
|
||||
#include <QFile>
|
||||
|
||||
|
||||
CAF_CMD_SOURCE_INIT(RicExportCarfin, "RicExportCarfin");
|
||||
CAF_CMD_SOURCE_INIT( RicExportCarfin, "RicExportCarfin" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicExportCarfin::isCommandEnabled()
|
||||
{
|
||||
if (RicExportCarfin::selectedCase() != nullptr)
|
||||
if ( RicExportCarfin::selectedCase() != nullptr )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -54,100 +53,97 @@ bool RicExportCarfin::isCommandEnabled()
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicExportCarfin::onActionTriggered(bool isChecked)
|
||||
void RicExportCarfin::onActionTriggered( bool isChecked )
|
||||
{
|
||||
RimEclipseCase* rimCase = RicExportCarfin::selectedCase();
|
||||
CVF_ASSERT(rimCase);
|
||||
CVF_ASSERT( rimCase );
|
||||
|
||||
QString exportCarfinDataAsString = RiaApplication::instance()->project()->dialogData()->exportCarfinDataAsString();
|
||||
|
||||
|
||||
RicExportCarfinUi* exportCarfinObject = RiaApplication::instance()->project()->dialogData()->exportCarfin();
|
||||
|
||||
exportCarfinObject->setCase(rimCase);
|
||||
exportCarfinObject->setCase( rimCase );
|
||||
|
||||
caf::PdmUiPropertyViewDialog propertyDialog(nullptr, exportCarfinObject, "Export CARFIN to Eclipse Data", "");
|
||||
RicExportFeatureImpl::configureForExport(propertyDialog.dialogButtonBox());
|
||||
caf::PdmUiPropertyViewDialog propertyDialog( nullptr, exportCarfinObject, "Export CARFIN to Eclipse Data", "" );
|
||||
RicExportFeatureImpl::configureForExport( propertyDialog.dialogButtonBox() );
|
||||
|
||||
if (propertyDialog.exec() == QDialog::Accepted)
|
||||
if ( propertyDialog.exec() == QDialog::Accepted )
|
||||
{
|
||||
QString filePath = exportCarfinObject->exportFileName();
|
||||
QFile exportFile(filePath);
|
||||
if (!exportFile.open(QIODevice::WriteOnly | QIODevice::Text))
|
||||
QFile exportFile( filePath );
|
||||
if ( !exportFile.open( QIODevice::WriteOnly | QIODevice::Text ) )
|
||||
{
|
||||
RiaLogging::error(QString("Export CARFIN: Could not open the file: %1").arg(filePath));
|
||||
RiaLogging::error( QString( "Export CARFIN: Could not open the file: %1" ).arg( filePath ) );
|
||||
return;
|
||||
}
|
||||
|
||||
QTextStream stream(&exportFile);
|
||||
RifEclipseDataTableFormatter formatter(stream);
|
||||
QTextStream stream( &exportFile );
|
||||
RifEclipseDataTableFormatter formatter( stream );
|
||||
|
||||
std::vector<RifEclipseOutputTableColumn> header = {
|
||||
RifEclipseOutputTableColumn("I1"),
|
||||
RifEclipseOutputTableColumn("I2"),
|
||||
RifEclipseOutputTableColumn("J1"),
|
||||
RifEclipseOutputTableColumn("J2"),
|
||||
RifEclipseOutputTableColumn("K1"),
|
||||
RifEclipseOutputTableColumn("K2"),
|
||||
RifEclipseOutputTableColumn("NX"),
|
||||
RifEclipseOutputTableColumn("NY"),
|
||||
RifEclipseOutputTableColumn("NZ"),
|
||||
RifEclipseOutputTableColumn("NWMAX"),
|
||||
RifEclipseOutputTableColumn("Parent LGR")
|
||||
};
|
||||
std::vector<RifEclipseOutputTableColumn> header = {RifEclipseOutputTableColumn( "I1" ),
|
||||
RifEclipseOutputTableColumn( "I2" ),
|
||||
RifEclipseOutputTableColumn( "J1" ),
|
||||
RifEclipseOutputTableColumn( "J2" ),
|
||||
RifEclipseOutputTableColumn( "K1" ),
|
||||
RifEclipseOutputTableColumn( "K2" ),
|
||||
RifEclipseOutputTableColumn( "NX" ),
|
||||
RifEclipseOutputTableColumn( "NY" ),
|
||||
RifEclipseOutputTableColumn( "NZ" ),
|
||||
RifEclipseOutputTableColumn( "NWMAX" ),
|
||||
RifEclipseOutputTableColumn( "Parent LGR" )};
|
||||
|
||||
formatter.keyword("CARFIN");
|
||||
formatter.header(header);
|
||||
formatter.keyword( "CARFIN" );
|
||||
formatter.header( header );
|
||||
|
||||
formatter.add(exportCarfinObject->cellRange()->start().i());
|
||||
formatter.add(exportCarfinObject->cellRange()->start().i() + exportCarfinObject->cellRange()->count().i());
|
||||
formatter.add( exportCarfinObject->cellRange()->start().i() );
|
||||
formatter.add( exportCarfinObject->cellRange()->start().i() + exportCarfinObject->cellRange()->count().i() );
|
||||
|
||||
formatter.add(exportCarfinObject->cellRange()->start().j());
|
||||
formatter.add(exportCarfinObject->cellRange()->start().j() + exportCarfinObject->cellRange()->count().j());
|
||||
formatter.add( exportCarfinObject->cellRange()->start().j() );
|
||||
formatter.add( exportCarfinObject->cellRange()->start().j() + exportCarfinObject->cellRange()->count().j() );
|
||||
|
||||
formatter.add(exportCarfinObject->cellRange()->start().k());
|
||||
formatter.add(exportCarfinObject->cellRange()->start().k() + exportCarfinObject->cellRange()->count().k());
|
||||
formatter.add( exportCarfinObject->cellRange()->start().k() );
|
||||
formatter.add( exportCarfinObject->cellRange()->start().k() + exportCarfinObject->cellRange()->count().k() );
|
||||
|
||||
formatter.add(exportCarfinObject->lgrCellCount().i());
|
||||
formatter.add(exportCarfinObject->lgrCellCount().j());
|
||||
formatter.add(exportCarfinObject->lgrCellCount().k());
|
||||
formatter.add( exportCarfinObject->lgrCellCount().i() );
|
||||
formatter.add( exportCarfinObject->lgrCellCount().j() );
|
||||
formatter.add( exportCarfinObject->lgrCellCount().k() );
|
||||
|
||||
formatter.add(exportCarfinObject->maxWellCount());
|
||||
formatter.add( exportCarfinObject->maxWellCount() );
|
||||
|
||||
if (!exportCarfinObject->gridName().isEmpty())
|
||||
if ( !exportCarfinObject->gridName().isEmpty() )
|
||||
{
|
||||
formatter.add(exportCarfinObject->gridName());
|
||||
formatter.add( exportCarfinObject->gridName() );
|
||||
}
|
||||
|
||||
formatter.rowCompleted();
|
||||
formatter.tableCompleted();
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
RiaApplication::instance()->project()->dialogData()->setExportCarfinDataFromString(exportCarfinDataAsString);
|
||||
RiaApplication::instance()->project()->dialogData()->setExportCarfinDataFromString( exportCarfinDataAsString );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicExportCarfin::setupActionLook(QAction* actionToSetup)
|
||||
void RicExportCarfin::setupActionLook( QAction* actionToSetup )
|
||||
{
|
||||
actionToSetup->setText("Export CARFIN ...");
|
||||
actionToSetup->setIcon(QIcon(":/Save.png"));
|
||||
actionToSetup->setText( "Export CARFIN ..." );
|
||||
actionToSetup->setIcon( QIcon( ":/Save.png" ) );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimEclipseCase* RicExportCarfin::selectedCase()
|
||||
{
|
||||
std::vector<RimEclipseCase*> selectedObjects;
|
||||
caf::SelectionManager::instance()->objectsByType(&selectedObjects);
|
||||
caf::SelectionManager::instance()->objectsByType( &selectedObjects );
|
||||
|
||||
if (selectedObjects.size() == 1)
|
||||
if ( selectedObjects.size() == 1 )
|
||||
{
|
||||
return selectedObjects[0];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user