mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Support loading hierarchical well paths
This commit is contained in:
@@ -171,7 +171,7 @@ caf::PdmScriptResponse RicfExportWellPathCompletions::execute()
|
||||
std::vector<RimWellPath*> wellPaths;
|
||||
if ( m_wellPathNames().empty() )
|
||||
{
|
||||
for ( auto wellPath : RimProject::current()->activeOilField()->wellPathCollection->wellPaths() )
|
||||
for ( auto wellPath : RimProject::current()->activeOilField()->wellPathCollection->allWellPaths() )
|
||||
{
|
||||
if ( wellPath->showWellPath() )
|
||||
{
|
||||
|
||||
@@ -128,7 +128,7 @@ std::vector<RimWellPath*> RicExportCompletionsForVisibleWellPathsFeature::visibl
|
||||
{
|
||||
for ( auto wellPathCollection : wellPathCollections )
|
||||
{
|
||||
for ( const auto& wellPath : wellPathCollection->wellPaths() )
|
||||
for ( const auto& wellPath : wellPathCollection->allWellPaths() )
|
||||
{
|
||||
if ( wellPath->showWellPath() )
|
||||
{
|
||||
|
||||
@@ -212,7 +212,7 @@ std::vector<RimWellPath*> RicWellPathFractureTextReportFeatureImpl::wellPathsWit
|
||||
auto* wellPathColl = RimTools::wellPathCollection();
|
||||
if ( wellPathColl )
|
||||
{
|
||||
for ( const auto& wellPath : wellPathColl->wellPaths() )
|
||||
for ( const auto& wellPath : wellPathColl->allWellPaths() )
|
||||
{
|
||||
if ( !wellPath->fractureCollection()->activeFractures().empty() )
|
||||
{
|
||||
|
||||
@@ -124,7 +124,7 @@ bool RicDeleteSubItemsFeature::hasDeletableSubItems( caf::PdmUiItem* uiItem )
|
||||
|
||||
{
|
||||
auto collection = dynamic_cast<RimWellPathCollection*>( uiItem );
|
||||
if ( collection && !collection->wellPaths().empty() )
|
||||
if ( collection && !collection->topLevelWellPaths().empty() )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@ bool RicNewWellLogFileCurveFeature::wellLogFilesAvailable()
|
||||
auto wellPathCollection = RimTools::wellPathCollection();
|
||||
if ( wellPathCollection )
|
||||
{
|
||||
for ( auto wellPath : wellPathCollection->wellPaths() )
|
||||
for ( auto wellPath : wellPathCollection->allWellPaths() )
|
||||
{
|
||||
if ( !wellPath->wellLogFiles().empty() )
|
||||
{
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
|
||||
set (SOURCE_GROUP_HEADER_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicWellPathDeleteFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicImportWellPaths.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicNewEditableWellPathFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicShowWellPlanFeature.h
|
||||
@@ -28,7 +27,6 @@ ${CMAKE_CURRENT_LIST_DIR}/PointTangentManipulator/RicPolylineTarget3dEditor.h
|
||||
)
|
||||
|
||||
set (SOURCE_GROUP_SOURCE_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicWellPathDeleteFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicImportWellPaths.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicNewEditableWellPathFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicShowWellPlanFeature.cpp
|
||||
|
||||
@@ -170,7 +170,7 @@ std::vector<RimWellPath*> RicImportWellPaths::importWellPaths( const QStringList
|
||||
project->scheduleCreateDisplayModelAndRedrawAllViews();
|
||||
RimOilField* oilField = project->activeOilField();
|
||||
|
||||
if ( oilField && oilField->wellPathCollection->wellPaths().size() > 0 )
|
||||
if ( oilField && oilField->wellPathCollection->topLevelWellPaths().size() > 0 )
|
||||
{
|
||||
RimWellPath* wellPath = oilField->wellPathCollection->mostRecentlyUpdatedWellPath();
|
||||
if ( wellPath )
|
||||
|
||||
@@ -1,91 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RicWellPathDeleteFeature.h"
|
||||
|
||||
#include "RimWellPath.h"
|
||||
#include "RimWellPathCollection.h"
|
||||
|
||||
#include "cafSelectionManager.h"
|
||||
|
||||
#include <QAction>
|
||||
|
||||
CAF_CMD_SOURCE_INIT( RicWellPathDeleteFeature, "RicWellPathDeleteFeature" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicWellPathDeleteFeature::isCommandEnabled()
|
||||
{
|
||||
std::vector<RimWellPath*> objects;
|
||||
caf::SelectionManager::instance()->objectsByType( &objects );
|
||||
|
||||
if ( objects.size() > 0 )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicWellPathDeleteFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
std::vector<RimWellPath*> objects;
|
||||
caf::SelectionManager::instance()->objectsByType( &objects );
|
||||
|
||||
if ( objects.size() == 0 ) return;
|
||||
|
||||
RimWellPath* firstWellPath = objects[0];
|
||||
|
||||
RimWellPathCollection* wellPathCollection = nullptr;
|
||||
firstWellPath->firstAncestorOrThisOfType( wellPathCollection );
|
||||
if ( !wellPathCollection ) return;
|
||||
|
||||
for ( RimWellPath* wellPath : objects )
|
||||
{
|
||||
wellPathCollection->removeWellPath( wellPath );
|
||||
;
|
||||
delete wellPath;
|
||||
}
|
||||
|
||||
wellPathCollection->uiCapability()->updateConnectedEditors();
|
||||
wellPathCollection->scheduleRedrawAffectedViews();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicWellPathDeleteFeature::setupActionLook( QAction* actionToSetup )
|
||||
{
|
||||
std::vector<RimWellPath*> objects;
|
||||
caf::SelectionManager::instance()->objectsByType( &objects );
|
||||
if ( objects.size() > 1u )
|
||||
{
|
||||
actionToSetup->setText( "Delete Well Paths" );
|
||||
}
|
||||
else
|
||||
{
|
||||
actionToSetup->setText( "Delete Well Path" );
|
||||
}
|
||||
actionToSetup->setIcon( QIcon( ":/Erase.svg" ) );
|
||||
applyShortcutWithHintToAction( actionToSetup, QKeySequence::Delete );
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cafCmdFeature.h"
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicWellPathDeleteFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
protected:
|
||||
// Overrides
|
||||
bool isCommandEnabled() override;
|
||||
void onActionTriggered( bool isChecked ) override;
|
||||
void setupActionLook( QAction* actionToSetup ) override;
|
||||
};
|
||||
@@ -78,7 +78,7 @@ void RicWellPathFormationsImportFileFeature::onActionTriggered( bool isChecked )
|
||||
|
||||
if ( !oilField ) return;
|
||||
|
||||
if ( oilField->wellPathCollection->wellPaths().size() > 0 )
|
||||
if ( oilField->wellPathCollection->topLevelWellPaths().size() > 0 )
|
||||
{
|
||||
RimWellPath* wellPath = oilField->wellPathCollection->mostRecentlyUpdatedWellPath();
|
||||
if ( wellPath )
|
||||
|
||||
@@ -75,7 +75,7 @@ void RimCompletionCellIntersectionCalc::calculateCompletionTypeResult( RimEclips
|
||||
{
|
||||
const RigEclipseCaseData* eclipseCaseData = eclipseCase->eclipseCaseData();
|
||||
|
||||
for ( const RimWellPath* wellPath : project->activeOilField()->wellPathCollection->wellPaths() )
|
||||
for ( const RimWellPath* wellPath : project->activeOilField()->wellPathCollection->allWellPaths() )
|
||||
{
|
||||
if ( wellPath->showWellPath() && wellPath->wellPathGeometry() )
|
||||
{
|
||||
|
||||
@@ -352,7 +352,7 @@ RimWellPath* RimWellPlotTools::wellPathFromWellLogFile( const RimWellLogFile* we
|
||||
RimProject* const project = RimProject::current();
|
||||
for ( const auto& oilField : project->oilFields )
|
||||
{
|
||||
for ( const auto& wellPath : oilField->wellPathCollection()->wellPaths() )
|
||||
for ( const auto& wellPath : oilField->wellPathCollection()->allWellPaths() )
|
||||
{
|
||||
for ( RimWellLogFile* const file : wellPath->wellLogFiles() )
|
||||
{
|
||||
|
||||
@@ -1170,11 +1170,6 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection()
|
||||
|
||||
// Special delete commands for specific features
|
||||
// Placed here to fit context menu location of general delete feature
|
||||
if ( caf::CmdFeatureManager::instance()->getCommandFeature( "RicWellPathDeleteFeature" )->canFeatureBeExecuted() )
|
||||
{
|
||||
menuBuilder << "Separator";
|
||||
menuBuilder << "RicWellPathDeleteFeature";
|
||||
}
|
||||
|
||||
if ( caf::CmdFeatureManager::instance()->getCommandFeature( "Ric3dWellLogCurveDeleteFeature" )->canFeatureBeExecuted() )
|
||||
{
|
||||
|
||||
@@ -992,7 +992,7 @@ bool RimEclipseCase::openReserviorCase()
|
||||
RimProject* proj = RimProject::current();
|
||||
for ( const auto& oilField : proj->oilFields() )
|
||||
{
|
||||
for ( const auto& wellPath : oilField->wellPathCollection()->wellPaths() )
|
||||
for ( const auto& wellPath : oilField->wellPathCollection()->allWellPaths() )
|
||||
{
|
||||
if ( !wellPath->isAssociatedWithSimulationWell() )
|
||||
{
|
||||
|
||||
@@ -1122,7 +1122,7 @@ std::vector<RimWellPath*> RimProject::allWellPaths() const
|
||||
for ( const auto& oilField : oilFields() )
|
||||
{
|
||||
auto wellPathColl = oilField->wellPathCollection();
|
||||
for ( auto wellPath : wellPathColl->wellPaths() )
|
||||
for ( auto wellPath : wellPathColl->allWellPaths() )
|
||||
{
|
||||
wellPaths.push_back( wellPath );
|
||||
}
|
||||
|
||||
@@ -243,7 +243,7 @@ void RimTools::wellPathOptionItems( QList<caf::PdmOptionItemInfo>* options )
|
||||
if ( wellPathColl )
|
||||
{
|
||||
caf::IconProvider wellIcon( ":/Well.png" );
|
||||
for ( auto wellPath : wellPathColl->wellPaths() )
|
||||
for ( auto wellPath : wellPathColl->allWellPaths() )
|
||||
{
|
||||
options->push_back( caf::PdmOptionItemInfo( wellPath->name(), wellPath, false, wellIcon ) );
|
||||
}
|
||||
@@ -276,7 +276,7 @@ void RimTools::wellPathWithFormations( std::vector<RimWellPath*>* wellPaths )
|
||||
auto wellPathColl = RimTools::wellPathCollection();
|
||||
if ( wellPathColl )
|
||||
{
|
||||
for ( RimWellPath* wellPath : wellPathColl->wellPaths() )
|
||||
for ( RimWellPath* wellPath : wellPathColl->allWellPaths() )
|
||||
{
|
||||
if ( wellPath->hasFormations() )
|
||||
{
|
||||
|
||||
@@ -296,7 +296,7 @@ QList<caf::PdmOptionItemInfo> RimWellLogFileCurve::calculateValueOptions( const
|
||||
auto wellPathColl = RimTools::wellPathCollection();
|
||||
if ( wellPathColl )
|
||||
{
|
||||
for ( auto wellPath : wellPathColl->wellPaths() )
|
||||
for ( auto wellPath : wellPathColl->allWellPaths() )
|
||||
{
|
||||
// Only include well paths coming from a well log file
|
||||
if ( wellPath->wellLogFiles().size() > 0 )
|
||||
|
||||
@@ -333,7 +333,7 @@ QList<caf::PdmOptionItemInfo>
|
||||
|
||||
// Find wells with a given measurement.
|
||||
std::set<QString> wellsWithMeasurementKind;
|
||||
for ( const auto& well : wellPathCollection->wellPaths() )
|
||||
for ( const auto& well : wellPathCollection->allWellPaths() )
|
||||
{
|
||||
if ( hasMeasurementKindForWell( well, wellPathCollection, measurements, m_measurementKind ) )
|
||||
wellsWithMeasurementKind.insert( well->name() );
|
||||
@@ -416,7 +416,7 @@ void RimWellMeasurementInView::setAllWellsSelected()
|
||||
|
||||
// Find wells with a given measurement.
|
||||
std::set<QString> wellsWithMeasurementKind;
|
||||
for ( const auto& well : wellPathCollection->wellPaths() )
|
||||
for ( const auto& well : wellPathCollection->allWellPaths() )
|
||||
{
|
||||
if ( hasMeasurementKindForWell( well, wellPathCollection, measurements, m_measurementKind ) )
|
||||
wellsWithMeasurementKind.insert( well->name() );
|
||||
|
||||
@@ -128,6 +128,8 @@ RimWellPath::RimWellPath()
|
||||
m_wellPathAttributes->uiCapability()->setUiTreeHidden( true );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_childWellPaths, "ChildWellPaths", "Child Well Paths", "", "", "" );
|
||||
|
||||
this->setDeletable( true );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -369,6 +371,22 @@ void RimWellPath::addChildWellPath( RimWellPath* wellPath )
|
||||
m_childWellPaths.push_back( wellPath );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimWellPath::hasChildWellPath( RimWellPath* wellPath )
|
||||
{
|
||||
return m_childWellPaths.count( wellPath ) != 0u;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellPath::removeChildWellPath( RimWellPath* wellPath )
|
||||
{
|
||||
m_childWellPaths.removeChildObject( wellPath );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -640,7 +658,12 @@ void RimWellPath::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering,
|
||||
}
|
||||
|
||||
for ( auto child : m_childWellPaths() )
|
||||
uiTreeOrdering.add( child );
|
||||
{
|
||||
if ( child )
|
||||
{
|
||||
uiTreeOrdering.add( child );
|
||||
}
|
||||
}
|
||||
|
||||
uiTreeOrdering.skipRemainingChildren( true );
|
||||
}
|
||||
|
||||
@@ -97,6 +97,8 @@ public:
|
||||
double endMD() const override;
|
||||
|
||||
void addChildWellPath( RimWellPath* wellPath );
|
||||
bool hasChildWellPath( RimWellPath* wellPath );
|
||||
void removeChildWellPath( RimWellPath* wellPath );
|
||||
|
||||
void addWellLogFile( RimWellLogFile* logFileInfo );
|
||||
void deleteWellLogFile( RimWellLogFile* logFileInfo );
|
||||
|
||||
@@ -141,7 +141,7 @@ void RimWellPathCollection::loadDataAndUpdate()
|
||||
|
||||
readWellPathFormationFiles();
|
||||
|
||||
for ( RimWellPath* wellPath : wellPaths() )
|
||||
for ( RimWellPath* wellPath : allWellPaths() )
|
||||
{
|
||||
progress.setProgressDescription( QString( "Reading file %1" ).arg( wellPath->name() ) );
|
||||
|
||||
@@ -257,7 +257,7 @@ std::vector<RimWellPath*> RimWellPathCollection::addWellPaths( QStringList fileP
|
||||
scheduleRedrawAffectedViews();
|
||||
updateAllRequiredEditors();
|
||||
|
||||
return wellPaths();
|
||||
return topLevelWellPaths();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -280,11 +280,21 @@ void RimWellPathCollection::addWellPath( gsl::not_null<RimWellPath*> wellPath )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimWellPath*> RimWellPathCollection::wellPaths()
|
||||
std::vector<RimWellPath*> RimWellPathCollection::topLevelWellPaths() const
|
||||
{
|
||||
return m_wellPaths.childObjects();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimWellPath*> RimWellPathCollection::allWellPaths() const
|
||||
{
|
||||
std::vector<RimWellPath*> wellPaths;
|
||||
descendantsOfType( wellPaths );
|
||||
return wellPaths;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -609,7 +619,26 @@ void RimWellPathCollection::reloadAllWellPathFormations()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellPathCollection::removeWellPath( RimWellPath* wellPath )
|
||||
{
|
||||
m_wellPaths.removeChildObject( wellPath );
|
||||
bool removed = false;
|
||||
if ( m_wellPaths.count( wellPath ) != 0u )
|
||||
{
|
||||
m_wellPaths.removeChildObject( wellPath );
|
||||
removed = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
for ( auto possibleParentWellPath : allWellPaths() )
|
||||
{
|
||||
if ( possibleParentWellPath->hasChildWellPath( wellPath ) )
|
||||
{
|
||||
possibleParentWellPath->removeChildWellPath( wellPath );
|
||||
removed = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
CAF_ASSERT( removed );
|
||||
if ( !removed ) return;
|
||||
|
||||
RimFileWellPath* fileWellPath = dynamic_cast<RimFileWellPath*>( wellPath );
|
||||
if ( fileWellPath )
|
||||
@@ -664,14 +693,11 @@ RimWellPath* RimWellPathCollection::findSuitableParentWellPath( gsl::not_null<co
|
||||
auto wellPathGeometry = wellPath->wellPathGeometry();
|
||||
if ( !wellPathGeometry ) return nullptr;
|
||||
|
||||
std::vector<RimWellPath*> allWellPaths;
|
||||
descendantsOfType( allWellPaths );
|
||||
|
||||
const double eps = 1.0e-4;
|
||||
double maxIdenticalTubeLength = 0.0;
|
||||
RimWellPath* maxIdenticalWellPath = nullptr;
|
||||
|
||||
for ( auto existingWellPath : allWellPaths )
|
||||
for ( auto existingWellPath : allWellPaths() )
|
||||
{
|
||||
double identicalTubeLength = existingWellPath->wellPathGeometry()->identicalTubeLength( *wellPathGeometry );
|
||||
if ( identicalTubeLength > maxIdenticalTubeLength && identicalTubeLength > eps )
|
||||
|
||||
@@ -93,7 +93,8 @@ public:
|
||||
|
||||
void loadDataAndUpdate();
|
||||
std::vector<RimWellPath*> addWellPaths( QStringList filePaths, QStringList* errorMessages );
|
||||
std::vector<RimWellPath*> wellPaths();
|
||||
std::vector<RimWellPath*> topLevelWellPaths() const;
|
||||
std::vector<RimWellPath*> allWellPaths() const;
|
||||
void removeWellPath( RimWellPath* wellPath );
|
||||
void deleteAllWellPaths();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user