#7727 Well Path : Simplify access to all well paths

This commit is contained in:
Magne Sjaastad 2021-05-27 11:25:13 +02:00
parent 087cf41773
commit afb293db52
6 changed files with 9 additions and 24 deletions

View File

@ -144,23 +144,19 @@ void RicWellPathExportCompletionDataFeatureImpl::exportCompletions( const std::v
{ {
caf::ProgressInfo progress( topLevelWellPaths.size(), "Extracting Completion Data For Well Paths" ); caf::ProgressInfo progress( topLevelWellPaths.size(), "Extracting Completion Data For Well Paths" );
for ( RimWellPath* wellPath : topLevelWellPaths ) for ( RimWellPath* topLevelWellPath : topLevelWellPaths )
{ {
std::vector<RimWellPath*> allWellPathLaterals; std::vector<RimWellPath*> allWellPathLaterals;
if ( wellPath->unitSystem() == exportSettings.caseToApply->eclipseCaseData()->unitsType() ) if ( topLevelWellPath->unitSystem() == exportSettings.caseToApply->eclipseCaseData()->unitsType() )
{ {
auto tieInWells = wellPath->wellPathLateralsRecursively(); allWellPathLaterals = topLevelWellPath->wellPathLateralsRecursively();
for ( auto w : tieInWells )
{
allWellPathLaterals.push_back( w );
}
} }
else else
{ {
int caseId = exportSettings.caseToApply->caseId(); int caseId = exportSettings.caseToApply->caseId();
QString format = QString( QString format = QString(
"Unit systems for well path \"%1\" must match unit system of chosen eclipse case \"%2\"" ); "Unit systems for well path \"%1\" must match unit system of chosen eclipse case \"%2\"" );
QString errMsg = format.arg( wellPath->name() ).arg( caseId ); QString errMsg = format.arg( topLevelWellPath->name() ).arg( caseId );
RiaLogging::error( errMsg ); RiaLogging::error( errMsg );
} }

View File

@ -124,7 +124,7 @@ bool RicDeleteSubItemsFeature::hasDeletableSubItems( caf::PdmUiItem* uiItem )
{ {
auto collection = dynamic_cast<RimWellPathCollection*>( uiItem ); auto collection = dynamic_cast<RimWellPathCollection*>( uiItem );
if ( collection && !collection->topLevelWellPaths().empty() ) if ( collection && !collection->allWellPaths().empty() )
{ {
return true; return true;
} }

View File

@ -175,7 +175,7 @@ std::vector<RimWellPath*> RicImportWellPaths::importWellPaths( const QStringList
project->scheduleCreateDisplayModelAndRedrawAllViews(); project->scheduleCreateDisplayModelAndRedrawAllViews();
RimOilField* oilField = project->activeOilField(); RimOilField* oilField = project->activeOilField();
if ( oilField && !oilField->wellPathCollection->topLevelWellPaths().empty() ) if ( oilField && !oilField->wellPathCollection->allWellPaths().empty() )
{ {
RimWellPath* wellPath = oilField->wellPathCollection->mostRecentlyUpdatedWellPath(); RimWellPath* wellPath = oilField->wellPathCollection->mostRecentlyUpdatedWellPath();
if ( wellPath ) if ( wellPath )

View File

@ -78,7 +78,7 @@ void RicWellPathFormationsImportFileFeature::onActionTriggered( bool isChecked )
if ( !oilField ) return; if ( !oilField ) return;
if ( oilField->wellPathCollection->topLevelWellPaths().size() > 0 ) if ( oilField->wellPathCollection->allWellPaths().size() > 0 )
{ {
RimWellPath* wellPath = oilField->wellPathCollection->mostRecentlyUpdatedWellPath(); RimWellPath* wellPath = oilField->wellPathCollection->mostRecentlyUpdatedWellPath();
if ( wellPath ) if ( wellPath )

View File

@ -270,7 +270,7 @@ std::vector<RimWellPath*>
scheduleRedrawAffectedViews(); scheduleRedrawAffectedViews();
updateAllRequiredEditors(); updateAllRequiredEditors();
return topLevelWellPaths(); return allWellPaths();
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -285,22 +285,12 @@ void RimWellPathCollection::addWellPath( gsl::not_null<RimWellPath*> wellPath, b
m_mostRecentlyUpdatedWellPath = wellPath; m_mostRecentlyUpdatedWellPath = wellPath;
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RimWellPath*> RimWellPathCollection::topLevelWellPaths() const
{
return m_wellPaths.childObjects();
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
std::vector<RimWellPath*> RimWellPathCollection::allWellPaths() const std::vector<RimWellPath*> RimWellPathCollection::allWellPaths() const
{ {
std::vector<RimWellPath*> wellPaths; return m_wellPaths.childObjects();
descendantsOfType( wellPaths );
return wellPaths;
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@ -94,7 +94,6 @@ public:
void loadDataAndUpdate(); void loadDataAndUpdate();
std::vector<RimWellPath*> addWellPaths( QStringList filePaths, bool importGrouped, QStringList* errorMessages ); std::vector<RimWellPath*> addWellPaths( QStringList filePaths, bool importGrouped, QStringList* errorMessages );
std::vector<RimWellPath*> topLevelWellPaths() const;
std::vector<RimWellPath*> allWellPaths() const; std::vector<RimWellPath*> allWellPaths() const;
void removeWellPath( gsl::not_null<RimWellPath*> wellPath ); void removeWellPath( gsl::not_null<RimWellPath*> wellPath );