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.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -24,11 +24,11 @@
|
||||
|
||||
#include "RigWellPath.h"
|
||||
|
||||
#include "RimProject.h"
|
||||
#include "Rim3dView.h"
|
||||
#include "RimFishboneWellPathCollection.h"
|
||||
#include "RimFishbonesCollection.h"
|
||||
#include "RimFishbonesMultipleSubs.h"
|
||||
#include "Rim3dView.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimWellPathCollection.h"
|
||||
#include "RimWellPathCompletions.h"
|
||||
|
||||
@@ -41,84 +41,83 @@
|
||||
|
||||
#include <cmath>
|
||||
|
||||
|
||||
CAF_CMD_SOURCE_INIT(RicNewFishbonesSubsFeature, "RicNewFishbonesSubsFeature");
|
||||
CAF_CMD_SOURCE_INIT( RicNewFishbonesSubsFeature, "RicNewFishbonesSubsFeature" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
double getWellPathTipMd(RimWellPath* wellPath);
|
||||
double getWellPathTipMd( RimWellPath* wellPath );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicNewFishbonesSubsFeature::onActionTriggered(bool isChecked)
|
||||
void RicNewFishbonesSubsFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
RimFishbonesCollection* fishbonesCollection = selectedFishbonesCollection();
|
||||
CVF_ASSERT(fishbonesCollection);
|
||||
CVF_ASSERT( fishbonesCollection );
|
||||
|
||||
RimWellPath* wellPath;
|
||||
fishbonesCollection->firstAncestorOrThisOfTypeAsserted(wellPath);
|
||||
if (!RicWellPathsUnitSystemSettingsImpl::ensureHasUnitSystem(wellPath)) return;
|
||||
fishbonesCollection->firstAncestorOrThisOfTypeAsserted( wellPath );
|
||||
if ( !RicWellPathsUnitSystemSettingsImpl::ensureHasUnitSystem( wellPath ) ) return;
|
||||
|
||||
RimFishbonesMultipleSubs* obj = new RimFishbonesMultipleSubs;
|
||||
fishbonesCollection->appendFishbonesSubs(obj);
|
||||
fishbonesCollection->appendFishbonesSubs( obj );
|
||||
|
||||
double wellPathTipMd = getWellPathTipMd(wellPath);
|
||||
if (wellPathTipMd != HUGE_VAL)
|
||||
double wellPathTipMd = getWellPathTipMd( wellPath );
|
||||
if ( wellPathTipMd != HUGE_VAL )
|
||||
{
|
||||
double startMd = wellPathTipMd - 150 - 100;
|
||||
if (startMd < 100) startMd = 100;
|
||||
if ( startMd < 100 ) startMd = 100;
|
||||
|
||||
obj->setMeasuredDepthAndCount(startMd, 12.5, 13);
|
||||
obj->setMeasuredDepthAndCount( startMd, 12.5, 13 );
|
||||
}
|
||||
|
||||
RicNewFishbonesSubsFeature::askUserToSetUsefulScaling(fishbonesCollection);
|
||||
|
||||
RicNewFishbonesSubsFeature::askUserToSetUsefulScaling( fishbonesCollection );
|
||||
|
||||
RimWellPathCollection* wellPathCollection = nullptr;
|
||||
fishbonesCollection->firstAncestorOrThisOfType(wellPathCollection);
|
||||
if (wellPathCollection)
|
||||
fishbonesCollection->firstAncestorOrThisOfType( wellPathCollection );
|
||||
if ( wellPathCollection )
|
||||
{
|
||||
wellPathCollection->uiCapability()->updateConnectedEditors();
|
||||
}
|
||||
|
||||
RiuMainWindow::instance()->selectAsCurrentItem(obj);
|
||||
RiuMainWindow::instance()->selectAsCurrentItem( obj );
|
||||
|
||||
RimProject* proj;
|
||||
fishbonesCollection->firstAncestorOrThisOfTypeAsserted(proj);
|
||||
fishbonesCollection->firstAncestorOrThisOfTypeAsserted( proj );
|
||||
proj->reloadCompletionTypeResultsInAllViews();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimFishbonesCollection* RicNewFishbonesSubsFeature::selectedFishbonesCollection()
|
||||
{
|
||||
std::vector<caf::PdmUiItem*> allSelectedItems;
|
||||
caf::SelectionManager::instance()->selectedItems(allSelectedItems);
|
||||
if (allSelectedItems.size() != 1u) return nullptr;
|
||||
caf::SelectionManager::instance()->selectedItems( allSelectedItems );
|
||||
if ( allSelectedItems.size() != 1u ) return nullptr;
|
||||
|
||||
RimFishbonesCollection* objToFind = nullptr;
|
||||
|
||||
|
||||
caf::PdmUiItem* pdmUiItem = allSelectedItems.front();
|
||||
|
||||
caf::PdmObjectHandle* objHandle = dynamic_cast<caf::PdmObjectHandle*>(pdmUiItem);
|
||||
if (objHandle)
|
||||
caf::PdmObjectHandle* objHandle = dynamic_cast<caf::PdmObjectHandle*>( pdmUiItem );
|
||||
if ( objHandle )
|
||||
{
|
||||
objHandle->firstAncestorOrThisOfType(objToFind);
|
||||
objHandle->firstAncestorOrThisOfType( objToFind );
|
||||
}
|
||||
|
||||
if (objToFind == nullptr)
|
||||
if ( objToFind == nullptr )
|
||||
{
|
||||
std::vector<RimWellPath*> wellPaths;
|
||||
caf::SelectionManager::instance()->objectsByType(&wellPaths);
|
||||
if (!wellPaths.empty())
|
||||
caf::SelectionManager::instance()->objectsByType( &wellPaths );
|
||||
if ( !wellPaths.empty() )
|
||||
{
|
||||
return wellPaths[0]->fishbonesCollection();
|
||||
}
|
||||
RimWellPathCompletions* completions = caf::SelectionManager::instance()->selectedItemOfType<RimWellPathCompletions>();
|
||||
if (completions)
|
||||
RimWellPathCompletions* completions = caf::SelectionManager::instance()
|
||||
->selectedItemOfType<RimWellPathCompletions>();
|
||||
if ( completions )
|
||||
{
|
||||
return completions->fishbonesCollection();
|
||||
}
|
||||
@@ -128,20 +127,20 @@ RimFishbonesCollection* RicNewFishbonesSubsFeature::selectedFishbonesCollection(
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicNewFishbonesSubsFeature::setupActionLook(QAction* actionToSetup)
|
||||
void RicNewFishbonesSubsFeature::setupActionLook( QAction* actionToSetup )
|
||||
{
|
||||
actionToSetup->setIcon(QIcon(":/FishBoneGroup16x16.png"));
|
||||
actionToSetup->setText("Create Fishbones");
|
||||
actionToSetup->setIcon( QIcon( ":/FishBoneGroup16x16.png" ) );
|
||||
actionToSetup->setText( "Create Fishbones" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicNewFishbonesSubsFeature::isCommandEnabled()
|
||||
{
|
||||
if (selectedFishbonesCollection())
|
||||
if ( selectedFishbonesCollection() )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -150,54 +149,55 @@ bool RicNewFishbonesSubsFeature::isCommandEnabled()
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicNewFishbonesSubsFeature::askUserToSetUsefulScaling(RimFishbonesCollection* fishboneCollection)
|
||||
void RicNewFishbonesSubsFeature::askUserToSetUsefulScaling( RimFishbonesCollection* fishboneCollection )
|
||||
{
|
||||
// Always reset well path collection scale factor
|
||||
CVF_ASSERT(fishboneCollection);
|
||||
CVF_ASSERT( fishboneCollection );
|
||||
RimWellPathCollection* wellPathColl = nullptr;
|
||||
fishboneCollection->firstAncestorOrThisOfTypeAsserted(wellPathColl);
|
||||
fishboneCollection->firstAncestorOrThisOfTypeAsserted( wellPathColl );
|
||||
wellPathColl->wellPathRadiusScaleFactor = 0.01;
|
||||
|
||||
Rim3dView* activeView = RiaApplication::instance()->activeReservoirView();
|
||||
if (!activeView) return;
|
||||
if ( !activeView ) return;
|
||||
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
QString sessionKey = "AutoAdjustSettingsForFishbones";
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
QString sessionKey = "AutoAdjustSettingsForFishbones";
|
||||
|
||||
bool autoAdjustSettings = false;
|
||||
QVariant v = app->cacheDataObject(sessionKey);
|
||||
if (!v.isValid())
|
||||
bool autoAdjustSettings = false;
|
||||
QVariant v = app->cacheDataObject( sessionKey );
|
||||
if ( !v.isValid() )
|
||||
{
|
||||
double currentScaleFactor = activeView->scaleZ();
|
||||
if (fabs(currentScaleFactor - 1.0) < 0.1) return;
|
||||
if ( fabs( currentScaleFactor - 1.0 ) < 0.1 ) return;
|
||||
|
||||
QMessageBox msgBox;
|
||||
msgBox.setIcon(QMessageBox::Question);
|
||||
msgBox.setIcon( QMessageBox::Question );
|
||||
|
||||
QString questionText;
|
||||
questionText = QString("When displaying Fishbones structures, the view scaling should be set to 1.\n\nDo you want ResInsight to automatically set view scaling to 1?");
|
||||
questionText = QString( "When displaying Fishbones structures, the view scaling should be set to 1.\n\nDo you "
|
||||
"want ResInsight to automatically set view scaling to 1?" );
|
||||
|
||||
msgBox.setText(questionText);
|
||||
msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
|
||||
msgBox.setText( questionText );
|
||||
msgBox.setStandardButtons( QMessageBox::Yes | QMessageBox::No );
|
||||
|
||||
int ret = msgBox.exec();
|
||||
if (ret == QMessageBox::Yes)
|
||||
if ( ret == QMessageBox::Yes )
|
||||
{
|
||||
autoAdjustSettings = true;
|
||||
}
|
||||
|
||||
app->setCacheDataObject(sessionKey, autoAdjustSettings);
|
||||
app->setCacheDataObject( sessionKey, autoAdjustSettings );
|
||||
}
|
||||
else
|
||||
{
|
||||
autoAdjustSettings = v.toBool();
|
||||
}
|
||||
|
||||
if (autoAdjustSettings)
|
||||
if ( autoAdjustSettings )
|
||||
{
|
||||
activeView->setScaleZAndUpdate(1.0);
|
||||
activeView->setScaleZAndUpdate( 1.0 );
|
||||
activeView->scheduleCreateDisplayModelAndRedraw();
|
||||
activeView->updateZScaleLabel();
|
||||
|
||||
@@ -206,13 +206,13 @@ void RicNewFishbonesSubsFeature::askUserToSetUsefulScaling(RimFishbonesCollectio
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
double getWellPathTipMd(RimWellPath* wellPath)
|
||||
double getWellPathTipMd( RimWellPath* wellPath )
|
||||
{
|
||||
RigWellPath* geometry = wellPath ? wellPath->wellPathGeometry() : nullptr;
|
||||
|
||||
if (geometry && !geometry->m_measuredDepths.empty())
|
||||
if ( geometry && !geometry->m_measuredDepths.empty() )
|
||||
{
|
||||
return geometry->m_measuredDepths.back();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user