Remove redundant part of hierarchical well paths

This commit is contained in:
Gaute Lindkvist committed 2020-10-26 10:43:14 +01:00
1 parent 7684596829
commit 362dcb4dd1
7 files changed
+95 -20

No files matched your search

@@ -53,7 +53,6 @@
#include "cafPdmUiTreeOrdering.h"
#include "cafProgressInfo.h"
#include <QDebug>
#include <QFile>
#include <QFileInfo>
#include <QString>
@@ -150,6 +149,7 @@ void RimWellPathCollection::loadDataAndUpdate()
RimFileWellPath* fWPath = dynamic_cast<RimFileWellPath*>( wellPath );
RimModeledWellPath* mWPath = dynamic_cast<RimModeledWellPath*>( wellPath );
RimWellPathGroup* branch = dynamic_cast<RimWellPathGroup*>( wellPath );
if ( fWPath )
{
if ( !fWPath->filePath().isEmpty() )
@@ -165,6 +165,10 @@ void RimWellPathCollection::loadDataAndUpdate()
{
mWPath->createWellPathGeometry();
}
else if ( branch )
{
branch->updateWellPathName();
}
if ( wellPath )
{
@@ -191,7 +195,10 @@ void RimWellPathCollection::loadDataAndUpdate()
}
progress.incrementProgress();
}
for ( auto group : topLevelGroups() )
{
group->createWellPathGeometry();
}
this->checkAndFixBranchNames();
this->sortWellsByName();
}
@@ -669,12 +676,14 @@ void RimWellPathCollection::removeWellPath( RimWellPath* wellPath )
{
for ( auto possibleParentWellPath : allWellPaths() )
{
auto wellPathGroup = dynamic_cast<RimWellPathGroup*>( possibleParentWellPath );
if ( wellPathGroup->hasChildWellPath( wellPath ) )
if ( auto wellPathGroup = dynamic_cast<RimWellPathGroup*>( possibleParentWellPath ); wellPathGroup )
{
wellPathGroup->removeChildWellPath( wellPath );
removed = true;
break;
if ( wellPathGroup->hasChildWellPath( wellPath ) )
{
wellPathGroup->removeChildWellPath( wellPath );
removed = true;
break;
}
}
}
}
@@ -726,6 +735,22 @@ void RimWellPathCollection::sortWellsByName()
std::sort( m_wellPaths.begin(), m_wellPaths.end(), lessWellPath );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RimWellPathGroup*> RimWellPathCollection::topLevelGroups() const
{
std::vector<RimWellPathGroup*> groups;
for ( auto wellPath : m_wellPaths )
{
if ( auto group = dynamic_cast<RimWellPathGroup*>( wellPath.p() ); group )
{
groups.push_back( group );
}
}
return groups;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -734,8 +759,6 @@ RimWellPathGroup* RimWellPathCollection::findOrCreateWellPathGroup( gsl::not_nul
auto wellPathGeometry = wellPath->wellPathGeometry();
if ( !wellPathGeometry ) return nullptr;
qDebug() << wellPath->name();
const double eps = 1.0e-4;
std::map<RimWellPath*, double> wellPathsWithCommonGeometry;