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:
@@ -2,103 +2,100 @@
|
||||
//
|
||||
// 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 "RicNewViewFeature.h"
|
||||
|
||||
#include "RimEclipseContourMapView.h"
|
||||
#include "Rim3dView.h"
|
||||
#include "RimEclipseCase.h"
|
||||
#include "RimEclipseContourMapView.h"
|
||||
#include "RimEclipseView.h"
|
||||
#include "RimGeoMechCase.h"
|
||||
#include "RimGeoMechView.h"
|
||||
#include "Rim3dView.h"
|
||||
|
||||
#include "Riu3DMainWindowTools.h"
|
||||
#include "RiaLogging.h"
|
||||
#include "Riu3DMainWindowTools.h"
|
||||
|
||||
#include "cafSelectionManager.h"
|
||||
|
||||
#include <QAction>
|
||||
|
||||
CAF_CMD_SOURCE_INIT(RicNewViewFeature, "RicNewViewFeature");
|
||||
CAF_CMD_SOURCE_INIT( RicNewViewFeature, "RicNewViewFeature" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicNewViewFeature::addReservoirView(RimEclipseCase* eclipseCase, RimGeoMechCase* geomCase)
|
||||
void RicNewViewFeature::addReservoirView( RimEclipseCase* eclipseCase, RimGeoMechCase* geomCase )
|
||||
{
|
||||
Rim3dView* newView = createReservoirView(eclipseCase, geomCase);
|
||||
Rim3dView* newView = createReservoirView( eclipseCase, geomCase );
|
||||
|
||||
if (newView)
|
||||
if ( newView )
|
||||
{
|
||||
Riu3DMainWindowTools::setExpanded(newView);
|
||||
Riu3DMainWindowTools::setExpanded( newView );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicNewViewFeature::isCommandEnabled()
|
||||
{
|
||||
return selectedEclipseCase() != nullptr
|
||||
|| selectedEclipseView() != nullptr
|
||||
|| selectedGeoMechCase() != nullptr
|
||||
|| selectedGeoMechView() != nullptr;
|
||||
return selectedEclipseCase() != nullptr || selectedEclipseView() != nullptr || selectedGeoMechCase() != nullptr ||
|
||||
selectedGeoMechView() != nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicNewViewFeature::onActionTriggered(bool isChecked)
|
||||
void RicNewViewFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
// Establish type of selected object
|
||||
RimEclipseCase* eclipseCase = selectedEclipseCase();
|
||||
RimGeoMechCase* geomCase = selectedGeoMechCase();
|
||||
RimGeoMechView* geoMechView = selectedGeoMechView();
|
||||
RimEclipseCase* eclipseCase = selectedEclipseCase();
|
||||
RimGeoMechCase* geomCase = selectedGeoMechCase();
|
||||
RimGeoMechView* geoMechView = selectedGeoMechView();
|
||||
RimEclipseView* reservoirView = selectedEclipseView();
|
||||
|
||||
|
||||
// Find case to insert into
|
||||
if (geoMechView) geomCase = geoMechView->geoMechCase();
|
||||
if (reservoirView) eclipseCase = reservoirView->eclipseCase();
|
||||
if ( geoMechView ) geomCase = geoMechView->geoMechCase();
|
||||
if ( reservoirView ) eclipseCase = reservoirView->eclipseCase();
|
||||
|
||||
addReservoirView(eclipseCase, geomCase);
|
||||
addReservoirView( eclipseCase, geomCase );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicNewViewFeature::setupActionLook(QAction* actionToSetup)
|
||||
void RicNewViewFeature::setupActionLook( QAction* actionToSetup )
|
||||
{
|
||||
actionToSetup->setText("New View");
|
||||
actionToSetup->setIcon(QIcon(":/3DView16x16.png"));
|
||||
}
|
||||
actionToSetup->setText( "New View" );
|
||||
actionToSetup->setIcon( QIcon( ":/3DView16x16.png" ) );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
Rim3dView* RicNewViewFeature::createReservoirView(RimEclipseCase* eclipseCase, RimGeoMechCase* geomCase)
|
||||
Rim3dView* RicNewViewFeature::createReservoirView( RimEclipseCase* eclipseCase, RimGeoMechCase* geomCase )
|
||||
{
|
||||
Rim3dView* insertedView = nullptr;
|
||||
|
||||
if (eclipseCase)
|
||||
if ( eclipseCase )
|
||||
{
|
||||
insertedView = eclipseCase->createAndAddReservoirView();
|
||||
}
|
||||
else if (geomCase)
|
||||
else if ( geomCase )
|
||||
{
|
||||
insertedView = geomCase->createAndAddReservoirView();
|
||||
}
|
||||
@@ -106,12 +103,12 @@ Rim3dView* RicNewViewFeature::createReservoirView(RimEclipseCase* eclipseCase, R
|
||||
// Must be run before buildViewItems, as wells are created in this function
|
||||
insertedView->loadDataAndUpdate();
|
||||
|
||||
if (eclipseCase)
|
||||
if ( eclipseCase )
|
||||
{
|
||||
eclipseCase->updateConnectedEditors();
|
||||
}
|
||||
|
||||
if (geomCase)
|
||||
if ( geomCase )
|
||||
{
|
||||
geomCase->updateConnectedEditors();
|
||||
}
|
||||
@@ -120,14 +117,14 @@ Rim3dView* RicNewViewFeature::createReservoirView(RimEclipseCase* eclipseCase, R
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimEclipseCase* RicNewViewFeature::selectedEclipseCase()
|
||||
{
|
||||
std::vector<RimEclipseCase*> selection;
|
||||
caf::SelectionManager::instance()->objectsByType(&selection);
|
||||
caf::SelectionManager::instance()->objectsByType( &selection );
|
||||
|
||||
if (selection.size() > 0)
|
||||
if ( selection.size() > 0 )
|
||||
{
|
||||
return selection[0];
|
||||
}
|
||||
@@ -136,14 +133,14 @@ RimEclipseCase* RicNewViewFeature::selectedEclipseCase()
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimGeoMechCase* RicNewViewFeature::selectedGeoMechCase()
|
||||
{
|
||||
std::vector<RimGeoMechCase*> selection;
|
||||
caf::SelectionManager::instance()->objectsByType(&selection);
|
||||
caf::SelectionManager::instance()->objectsByType( &selection );
|
||||
|
||||
if (selection.size() > 0)
|
||||
if ( selection.size() > 0 )
|
||||
{
|
||||
return selection[0];
|
||||
}
|
||||
@@ -152,16 +149,16 @@ RimGeoMechCase* RicNewViewFeature::selectedGeoMechCase()
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimEclipseView* RicNewViewFeature::selectedEclipseView()
|
||||
{
|
||||
std::vector<RimEclipseView*> selection;
|
||||
caf::SelectionManager::instance()->objectsByType(&selection);
|
||||
caf::SelectionManager::instance()->objectsByType( &selection );
|
||||
|
||||
for (RimEclipseView* view : selection)
|
||||
for ( RimEclipseView* view : selection )
|
||||
{
|
||||
if (dynamic_cast<RimEclipseContourMapView*>(view) == nullptr)
|
||||
if ( dynamic_cast<RimEclipseContourMapView*>( view ) == nullptr )
|
||||
{
|
||||
return view;
|
||||
}
|
||||
@@ -171,14 +168,14 @@ RimEclipseView* RicNewViewFeature::selectedEclipseView()
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimGeoMechView* RicNewViewFeature::selectedGeoMechView()
|
||||
{
|
||||
std::vector<RimGeoMechView*> selection;
|
||||
caf::SelectionManager::instance()->objectsByType(&selection);
|
||||
caf::SelectionManager::instance()->objectsByType( &selection );
|
||||
|
||||
if (selection.size() > 0)
|
||||
if ( selection.size() > 0 )
|
||||
{
|
||||
return selection[0];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user