#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

@@ -2,28 +2,28 @@
//
// 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 "Riu3dSelectionManager.h"
#include "RimGridView.h"
#include "Rim2dIntersectionView.h"
#include "RimEclipseView.h"
#include "RimGeoMechView.h"
#include "RimGridView.h"
#include "RimSimWellInView.h"
#include "Rim2dIntersectionView.h"
#include "RimWellPath.h"
#include "RivSimWellPipeSourceInfo.h"
@@ -31,29 +31,28 @@
#include "RiuSelectionChangedHandler.h"
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
Riu3dSelectionManager::Riu3dSelectionManager()
: m_notificationCenter(new RiuSelectionChangedHandler)
: m_notificationCenter( new RiuSelectionChangedHandler )
{
m_selection.resize(2);
m_selection.resize( 2 );
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
Riu3dSelectionManager::~Riu3dSelectionManager()
{
deleteAllItemsFromSelection(RUI_APPLICATION_GLOBAL);
deleteAllItemsFromSelection(RUI_TEMPORARY);
deleteAllItemsFromSelection( RUI_APPLICATION_GLOBAL );
deleteAllItemsFromSelection( RUI_TEMPORARY );
delete m_notificationCenter;
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
Riu3dSelectionManager* Riu3dSelectionManager::instance()
{
@@ -62,26 +61,25 @@ Riu3dSelectionManager* Riu3dSelectionManager::instance()
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void Riu3dSelectionManager::selectedItems(std::vector<RiuSelectionItem*>& items, int role) const
void Riu3dSelectionManager::selectedItems( std::vector<RiuSelectionItem*>& items, int role ) const
{
const std::vector<RiuSelectionItem*>& s = m_selection[role];
items = s;
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
RiuSelectionItem* Riu3dSelectionManager::selectedItem(int role /*= RUI_APPLICATION_GLOBAL*/) const
RiuSelectionItem* Riu3dSelectionManager::selectedItem( int role /*= RUI_APPLICATION_GLOBAL*/ ) const
{
const std::vector<RiuSelectionItem*>& s = m_selection[role];
if (s.size() == 1)
if ( s.size() == 1 )
{
if (s[0])
if ( s[0] )
{
return s[0];
}
@@ -91,48 +89,48 @@ RiuSelectionItem* Riu3dSelectionManager::selectedItem(int role /*= RUI_APPLICATI
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void Riu3dSelectionManager::appendItemToSelection(RiuSelectionItem* item, int role)
void Riu3dSelectionManager::appendItemToSelection( RiuSelectionItem* item, int role )
{
std::vector<RiuSelectionItem*>& s = m_selection[role];
s.push_back(item);
s.push_back( item );
if (role == RUI_APPLICATION_GLOBAL) m_notificationCenter->handleItemAppended(item);
if ( role == RUI_APPLICATION_GLOBAL ) m_notificationCenter->handleItemAppended( item );
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void Riu3dSelectionManager::setSelectedItem(RiuSelectionItem* item, int role)
void Riu3dSelectionManager::setSelectedItem( RiuSelectionItem* item, int role )
{
deleteAllItemsFromSelection(role);
deleteAllItemsFromSelection( role );
std::vector<RiuSelectionItem*>& s = m_selection[role];
s.push_back(item);
s.push_back( item );
if (role == RUI_APPLICATION_GLOBAL) m_notificationCenter->handleSetSelectedItem(item);
if ( role == RUI_APPLICATION_GLOBAL ) m_notificationCenter->handleSetSelectedItem( item );
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void Riu3dSelectionManager::deleteAllItems(int role)
void Riu3dSelectionManager::deleteAllItems( int role )
{
if (!isEmpty(role))
if ( !isEmpty( role ) )
{
deleteAllItemsFromSelection(role);
deleteAllItemsFromSelection( role );
if (role == RUI_APPLICATION_GLOBAL) m_notificationCenter->handleSelectionDeleted();
if ( role == RUI_APPLICATION_GLOBAL ) m_notificationCenter->handleSelectionDeleted();
}
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
bool Riu3dSelectionManager::isEmpty(int role) const
bool Riu3dSelectionManager::isEmpty( int role ) const
{
const std::vector<RiuSelectionItem*>& s = m_selection[role];
@@ -140,13 +138,13 @@ bool Riu3dSelectionManager::isEmpty(int role) const
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void Riu3dSelectionManager::deleteAllItemsFromSelection(int role)
void Riu3dSelectionManager::deleteAllItemsFromSelection( int role )
{
std::vector<RiuSelectionItem*>& s = m_selection[role];
for (RiuSelectionItem* item : s)
for ( RiuSelectionItem* item : s )
{
delete item;
}
@@ -155,86 +153,86 @@ void Riu3dSelectionManager::deleteAllItemsFromSelection(int role)
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
RiuEclipseSelectionItem::RiuEclipseSelectionItem(RimEclipseView* view,
size_t gridIndex,
size_t cellIndex,
size_t nncIndex,
cvf::Color3f color,
cvf::StructGridInterface::FaceType face,
const cvf::Vec3d& localIntersectionPointInDisplay)
: m_view(view),
m_gridIndex(gridIndex),
m_gridLocalCellIndex(cellIndex),
m_nncIndex(nncIndex),
m_color(color),
m_face(face),
m_localIntersectionPointInDisplay(localIntersectionPointInDisplay)
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiuGeoMechSelectionItem::RiuGeoMechSelectionItem(RimGeoMechView* view,
size_t gridIndex,
size_t cellIndex,
cvf::Color3f color,
int elementFace,
const cvf::Vec3d& localIntersectionPointInDisplay)
: m_view(view)
, m_gridIndex(gridIndex)
, m_cellIndex(cellIndex)
, m_color(color)
, m_elementFace(elementFace)
, m_hasIntersectionTriangle(false)
, m_localIntersectionPointInDisplay(localIntersectionPointInDisplay)
RiuEclipseSelectionItem::RiuEclipseSelectionItem( RimEclipseView* view,
size_t gridIndex,
size_t cellIndex,
size_t nncIndex,
cvf::Color3f color,
cvf::StructGridInterface::FaceType face,
const cvf::Vec3d& localIntersectionPointInDisplay )
: m_view( view )
, m_gridIndex( gridIndex )
, m_gridLocalCellIndex( cellIndex )
, m_nncIndex( nncIndex )
, m_color( color )
, m_face( face )
, m_localIntersectionPointInDisplay( localIntersectionPointInDisplay )
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiuGeoMechSelectionItem::RiuGeoMechSelectionItem(RimGeoMechView* view,
size_t gridIndex,
size_t cellIndex,
cvf::Color3f color,
int elementFace,
const cvf::Vec3d& localIntersectionPointInDisplay,
const std::array<cvf::Vec3f, 3>& intersectionTriangle)
: m_view(view)
, m_gridIndex(gridIndex)
, m_cellIndex(cellIndex)
, m_color(color)
, m_elementFace(elementFace)
, m_hasIntersectionTriangle(true)
, m_intersectionTriangle(intersectionTriangle)
, m_localIntersectionPointInDisplay(localIntersectionPointInDisplay)
RiuGeoMechSelectionItem::RiuGeoMechSelectionItem( RimGeoMechView* view,
size_t gridIndex,
size_t cellIndex,
cvf::Color3f color,
int elementFace,
const cvf::Vec3d& localIntersectionPointInDisplay )
: m_view( view )
, m_gridIndex( gridIndex )
, m_cellIndex( cellIndex )
, m_color( color )
, m_elementFace( elementFace )
, m_hasIntersectionTriangle( false )
, m_localIntersectionPointInDisplay( localIntersectionPointInDisplay )
{
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
Riu2dIntersectionSelectionItem::Riu2dIntersectionSelectionItem(Rim2dIntersectionView* view, RiuSelectionItem *selItem)
RiuGeoMechSelectionItem::RiuGeoMechSelectionItem( RimGeoMechView* view,
size_t gridIndex,
size_t cellIndex,
cvf::Color3f color,
int elementFace,
const cvf::Vec3d& localIntersectionPointInDisplay,
const std::array<cvf::Vec3f, 3>& intersectionTriangle )
: m_view( view )
, m_gridIndex( gridIndex )
, m_cellIndex( cellIndex )
, m_color( color )
, m_elementFace( elementFace )
, m_hasIntersectionTriangle( true )
, m_intersectionTriangle( intersectionTriangle )
, m_localIntersectionPointInDisplay( localIntersectionPointInDisplay )
{
m_view = view;
m_eclipseSelItem = dynamic_cast<RiuEclipseSelectionItem*>(selItem);
m_geoMechSelItem = dynamic_cast<RiuGeoMechSelectionItem*>(selItem);
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
Riu2dIntersectionSelectionItem::Riu2dIntersectionSelectionItem( Rim2dIntersectionView* view, RiuSelectionItem* selItem )
{
m_view = view;
m_eclipseSelItem = dynamic_cast<RiuEclipseSelectionItem*>( selItem );
m_geoMechSelItem = dynamic_cast<RiuGeoMechSelectionItem*>( selItem );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
Riu2dIntersectionSelectionItem::~Riu2dIntersectionSelectionItem()
{
if (m_eclipseSelItem) delete m_eclipseSelItem;
if (m_geoMechSelItem) delete m_geoMechSelItem;
if ( m_eclipseSelItem ) delete m_eclipseSelItem;
if ( m_geoMechSelItem ) delete m_geoMechSelItem;
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
caf::PdmPointer<Rim2dIntersectionView> Riu2dIntersectionSelectionItem::view() const
{
@@ -242,7 +240,7 @@ caf::PdmPointer<Rim2dIntersectionView> Riu2dIntersectionSelectionItem::view() co
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
RiuEclipseSelectionItem* Riu2dIntersectionSelectionItem::eclipseSelectionItem() const
{
@@ -250,7 +248,7 @@ RiuEclipseSelectionItem* Riu2dIntersectionSelectionItem::eclipseSelectionItem()
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
RiuGeoMechSelectionItem* Riu2dIntersectionSelectionItem::geoMechSelectionItem() const
{
@@ -258,35 +256,33 @@ RiuGeoMechSelectionItem* Riu2dIntersectionSelectionItem::geoMechSelectionItem()
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
RiuWellPathSelectionItem::RiuWellPathSelectionItem(const RivWellPathSourceInfo* wellPathSourceInfo,
const cvf::Vec3d& pipeCenterLineIntersectionInDomainCoords,
double measuredDepth,
RimWellPathComponentInterface* component /*=nullptr*/)
: m_pipeCenterlineIntersectionInDomainCoords(pipeCenterLineIntersectionInDomainCoords)
, m_measuredDepth(measuredDepth)
, m_wellPathComponent(component)
RiuWellPathSelectionItem::RiuWellPathSelectionItem( const RivWellPathSourceInfo* wellPathSourceInfo,
const cvf::Vec3d& pipeCenterLineIntersectionInDomainCoords,
double measuredDepth,
RimWellPathComponentInterface* component /*=nullptr*/ )
: m_pipeCenterlineIntersectionInDomainCoords( pipeCenterLineIntersectionInDomainCoords )
, m_measuredDepth( measuredDepth )
, m_wellPathComponent( component )
{
m_wellpath = wellPathSourceInfo->wellPath();
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
RiuSimWellSelectionItem::RiuSimWellSelectionItem(RimSimWellInView* simwell,
cvf::Vec3d m_domainCoord,
size_t m_branchIndex)
: m_simWell(simwell),
m_domainCoord(m_domainCoord),
m_branchIndex(m_branchIndex)
RiuSimWellSelectionItem::RiuSimWellSelectionItem( RimSimWellInView* simwell, cvf::Vec3d m_domainCoord, size_t m_branchIndex )
: m_simWell( simwell )
, m_domainCoord( m_domainCoord )
, m_branchIndex( m_branchIndex )
{
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
RiuGeneralSelectionItem::RiuGeneralSelectionItem(caf::PdmObject* object)
: m_object(object)
RiuGeneralSelectionItem::RiuGeneralSelectionItem( caf::PdmObject* object )
: m_object( object )
{
}