Clang-format changed files

This commit is contained in:
Gaute Lindkvist
2019-09-06 13:17:36 +02:00
parent bf9f43c3b4
commit de8a5a59f3
34 changed files with 3612 additions and 3469 deletions

View File

@@ -2,44 +2,44 @@
//
// 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.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RicNewPltPlotFeature.h"
#include "RicWellLogPlotCurveFeatureImpl.h"
#include "RicNewWellLogPlotFeatureImpl.h"
#include "RicWellLogPlotCurveFeatureImpl.h"
#include "RiaApplication.h"
#include "RigWellLogCurveData.h"
#include "Rim3dView.h"
#include "RimEclipseResultCase.h"
#include "RimMainPlotCollection.h"
#include "RimPltPlotCollection.h"
#include "RimProject.h"
#include "RimSimWellInView.h"
#include "Rim3dView.h"
#include "RimWellLogExtractionCurve.h"
#include "RimWellPltPlot.h"
#include "RimWellLogPlot.h"
#include "RimWellLogTrack.h"
#include "RimWellPath.h"
#include "RimPltPlotCollection.h"
#include "RimMainPlotCollection.h"
#include "RimEclipseResultCase.h"
#include "RimWellPltPlot.h"
#include "RiuPlotMainWindowTools.h"
#include "Riu3dSelectionManager.h"
#include "RiuPlotMainWindowTools.h"
#include "cafSelectionManagerTools.h"
@@ -47,99 +47,98 @@
#include <vector>
CAF_CMD_SOURCE_INIT(RicNewPltPlotFeature, "RicNewPltPlotFeature");
CAF_CMD_SOURCE_INIT( RicNewPltPlotFeature, "RicNewPltPlotFeature" );
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
bool RicNewPltPlotFeature::isCommandEnabled()
{
if (RicWellLogPlotCurveFeatureImpl::parentWellAllocationPlot()) return false;
if ( RicWellLogPlotCurveFeatureImpl::parentWellAllocationPlot() ) return false;
RimSimWellInView* simWell = caf::firstAncestorOfTypeFromSelectedObject<RimSimWellInView*>();
RimWellPath* selectedWellPath = caf::firstAncestorOfTypeFromSelectedObject<RimWellPath*>();
RimSimWellInView* simWell = caf::firstAncestorOfTypeFromSelectedObject<RimSimWellInView*>();
RimWellPath* selectedWellPath = caf::firstAncestorOfTypeFromSelectedObject<RimWellPath*>();
bool enable = true;
if (selectedWellPath)
if ( selectedWellPath )
{
if (selectedWellPath->wellPathGeometry() == nullptr && !RimWellPlotTools::hasFlowData(selectedWellPath))
if ( selectedWellPath->wellPathGeometry() == nullptr && !RimWellPlotTools::hasFlowData( selectedWellPath ) )
{
return false;
}
}
if (simWell != nullptr)
if ( simWell != nullptr )
{
RimProject* proj = RiaApplication::instance()->project();
QString simWellName = simWell->name();
RimProject* proj = RiaApplication::instance()->project();
QString simWellName = simWell->name();
RimWellPath* wellPath = proj->wellPathFromSimWellName(simWellName);
enable = wellPath != nullptr;
RimWellPath* wellPath = proj->wellPathFromSimWellName( simWellName );
enable = wellPath != nullptr;
}
return enable;
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RicNewPltPlotFeature::onActionTriggered(bool isChecked)
void RicNewPltPlotFeature::onActionTriggered( bool isChecked )
{
RimProject* proj = RiaApplication::instance()->project();
RimPltPlotCollection* pltPlotColl = proj->mainPlotCollection()->pltPlotCollection();
if (pltPlotColl)
if ( pltPlotColl )
{
QString wellPathName;
RimWellPath* wellPath = nullptr;
QString wellPathName;
RimWellPath* wellPath = nullptr;
RimSimWellInView* eclipseWell = nullptr;
if ((wellPath = caf::firstAncestorOfTypeFromSelectedObject<RimWellPath*>()) != nullptr)
if ( ( wellPath = caf::firstAncestorOfTypeFromSelectedObject<RimWellPath*>() ) != nullptr )
{
wellPathName = wellPath->name();
}
else if ((eclipseWell = caf::firstAncestorOfTypeFromSelectedObject<RimSimWellInView*>()) != nullptr)
else if ( ( eclipseWell = caf::firstAncestorOfTypeFromSelectedObject<RimSimWellInView*>() ) != nullptr )
{
wellPath = proj->wellPathFromSimWellName(eclipseWell->name());
if (!wellPath ) return;
wellPath = proj->wellPathFromSimWellName( eclipseWell->name() );
if ( !wellPath ) return;
wellPathName = wellPath->name();
}
QString plotName = QString(RimWellPltPlot::plotNameFormatString()).arg(wellPathName);
QString plotName = QString( RimWellPltPlot::plotNameFormatString() ).arg( wellPathName );
RimWellPltPlot* pltPlot = new RimWellPltPlot();
pltPlot->setCurrentWellName(wellPathName);
pltPlot->setCurrentWellName( wellPathName );
RimWellLogTrack* plotTrack = new RimWellLogTrack();
pltPlot->addTrack(plotTrack);
plotTrack->setDescription(QString("Track %1").arg(pltPlot->trackCount()));
pltPlot->addTrack( plotTrack );
plotTrack->setDescription( QString( "Track %1" ).arg( pltPlot->trackCount() ) );
pltPlotColl->addPlot(pltPlot);
pltPlot->setDescription(plotName);
pltPlotColl->addPlot( pltPlot );
pltPlot->setDescription( plotName );
//pltPlot->applyInitialSelections();
// pltPlot->applyInitialSelections();
pltPlot->loadDataAndUpdate();
pltPlotColl->updateConnectedEditors();
RiuPlotMainWindowTools::showPlotMainWindow();
RiuPlotMainWindowTools::setExpanded(plotTrack);
RiuPlotMainWindowTools::selectAsCurrentItem(pltPlot);
RiuPlotMainWindowTools::setExpanded( plotTrack );
RiuPlotMainWindowTools::selectAsCurrentItem( pltPlot );
}
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RicNewPltPlotFeature::setupActionLook(QAction* actionToSetup)
void RicNewPltPlotFeature::setupActionLook( QAction* actionToSetup )
{
actionToSetup->setText("New PLT Plot");
actionToSetup->setIcon(QIcon(":/WellFlowPlot16x16.png"));
actionToSetup->setText( "New PLT Plot" );
actionToSetup->setIcon( QIcon( ":/WellFlowPlot16x16.png" ) );
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
RimWellPath* RicNewPltPlotFeature::selectedWellPath() const
{
@@ -148,34 +147,33 @@ RimWellPath* RicNewPltPlotFeature::selectedWellPath() const
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
RimSimWellInView* RicNewPltPlotFeature::selectedSimulationWell(int * branchIndex) const
RimSimWellInView* RicNewPltPlotFeature::selectedSimulationWell( int* branchIndex ) const
{
RiuSelectionItem* selItem = Riu3dSelectionManager::instance()->selectedItem(Riu3dSelectionManager::RUI_TEMPORARY);
RiuSimWellSelectionItem* simWellSelItem = dynamic_cast<RiuSimWellSelectionItem*>(selItem);
if (simWellSelItem)
RiuSelectionItem* selItem = Riu3dSelectionManager::instance()->selectedItem( Riu3dSelectionManager::RUI_TEMPORARY );
RiuSimWellSelectionItem* simWellSelItem = dynamic_cast<RiuSimWellSelectionItem*>( selItem );
if ( simWellSelItem )
{
(*branchIndex) = static_cast<int>(simWellSelItem->m_branchIndex);
( *branchIndex ) = static_cast<int>( simWellSelItem->m_branchIndex );
return simWellSelItem->m_simWell;
}
else
{
std::vector<RimSimWellInView*> selection;
caf::SelectionManager::instance()->objectsByType(&selection);
(*branchIndex) = 0;
caf::SelectionManager::instance()->objectsByType( &selection );
( *branchIndex ) = 0;
return selection.size() > 0 ? selection[0] : nullptr;
}
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
bool RicNewPltPlotFeature::caseAvailable() const
{
std::vector<RimCase*> cases;
RiaApplication::instance()->project()->allCases(cases);
RiaApplication::instance()->project()->allCases( cases );
return cases.size() > 0;
}

View File

@@ -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,18 +37,17 @@
#include <vector>
CAF_CMD_SOURCE_INIT(RicNewRftPlotFeature, "RicNewRftPlotFeature");
CAF_CMD_SOURCE_INIT( RicNewRftPlotFeature, "RicNewRftPlotFeature" );
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
bool RicNewRftPlotFeature::isCommandEnabled()
{
RimRftPlotCollection* simWell = caf::firstAncestorOfTypeFromSelectedObject<RimRftPlotCollection*>();
if (simWell) return true;
if (selectedWellName().isEmpty())
if ( simWell ) return true;
if ( selectedWellName().isEmpty() )
{
return false;
}
@@ -57,58 +56,58 @@ bool RicNewRftPlotFeature::isCommandEnabled()
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RicNewRftPlotFeature::onActionTriggered(bool isChecked)
void RicNewRftPlotFeature::onActionTriggered( bool isChecked )
{
RimProject* proj = RiaApplication::instance()->project();
RimRftPlotCollection* rftPlotColl = proj->mainPlotCollection()->rftPlotCollection();
if (rftPlotColl)
if ( rftPlotColl )
{
QString wellName = selectedWellName();
QString plotName = QString(RimWellRftPlot::plotNameFormatString()).arg(wellName);
QString plotName = QString( RimWellRftPlot::plotNameFormatString() ).arg( wellName );
RimWellRftPlot* rftPlot = new RimWellRftPlot();
rftPlot->setSimWellOrWellPathName(wellName);
rftPlot->setSimWellOrWellPathName( wellName );
RimWellLogTrack* plotTrack = new RimWellLogTrack();
rftPlot->addTrack(plotTrack);
plotTrack->setDescription(QString("Track %1").arg(rftPlot->trackCount()));
rftPlot->addTrack( plotTrack );
plotTrack->setDescription( QString( "Track %1" ).arg( rftPlot->trackCount() ) );
rftPlotColl->addPlot(rftPlot);
rftPlot->setDescription(plotName);
rftPlotColl->addPlot( rftPlot );
rftPlot->setDescription( plotName );
rftPlot->applyInitialSelections();
rftPlot->loadDataAndUpdate();
rftPlotColl->updateConnectedEditors();
RiuPlotMainWindowTools::showPlotMainWindow();
RiuPlotMainWindowTools::setExpanded(plotTrack);
RiuPlotMainWindowTools::selectAsCurrentItem(rftPlot);
RiuPlotMainWindowTools::setExpanded( plotTrack );
RiuPlotMainWindowTools::selectAsCurrentItem( rftPlot );
}
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RicNewRftPlotFeature::setupActionLook(QAction* actionToSetup)
void RicNewRftPlotFeature::setupActionLook( QAction* actionToSetup )
{
actionToSetup->setText("New RFT Plot");
actionToSetup->setIcon(QIcon(":/FlowCharPlot16x16.png"));
actionToSetup->setText( "New RFT Plot" );
actionToSetup->setIcon( QIcon( ":/FlowCharPlot16x16.png" ) );
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
QString RicNewRftPlotFeature::selectedWellName()
{
RimSimWellInView* simWell = caf::firstAncestorOfTypeFromSelectedObject<RimSimWellInView*>();
if (simWell) return simWell->name();
if ( simWell ) return simWell->name();
RimWellPath* rimWellPath = caf::firstAncestorOfTypeFromSelectedObject<RimWellPath*>();
if (rimWellPath) return rimWellPath->name();
if ( rimWellPath ) return rimWellPath->name();
return QString();
}