mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Well path import improvements
* #9432 Clean file cache when all wells are deleted * Key Events: Avoid eating Delete key events Do not use a key short cut on menu actions that are always enabled. Will eat events from other actions. * #9433 Well Path Import: Keep prefix when trying to match existing well path
This commit is contained in:
@@ -305,16 +305,17 @@ void RimWellPathCollection::readAndAddWellPaths( std::vector<RimFileWellPath*>&
|
||||
caf::ProgressInfo progress( wellPathArray.size(), "Reading well paths from file" );
|
||||
|
||||
std::vector<RimWellPath*> wellPathsToGroup;
|
||||
for ( size_t wpIdx = 0; wpIdx < wellPathArray.size(); wpIdx++ )
|
||||
for ( RimFileWellPath* wellPath : wellPathArray )
|
||||
{
|
||||
RimFileWellPath* wellPath = wellPathArray[wpIdx];
|
||||
wellPath->readWellPathFile( nullptr, m_wellPathImporter.get(), true );
|
||||
|
||||
progress.setProgressDescription( QString( "Reading file %1" ).arg( wellPath->name() ) );
|
||||
|
||||
// If a well path with this name exists already, make it read the well path file
|
||||
RimFileWellPath* existingWellPath = dynamic_cast<RimFileWellPath*>( tryFindMatchingWellPath( wellPath->name() ) );
|
||||
|
||||
// If a well path with this name exists already, make it read the well path file. This is useful if a well log
|
||||
// file has been imported before a well path file containing the full geometry for the well path.
|
||||
// NB! Do not use tryFindMatchingWellPath(), as this function will remove the prefix and will return an false
|
||||
// match in many cases.
|
||||
auto* existingWellPath = dynamic_cast<RimFileWellPath*>( wellPathByName( wellPath->name() ) );
|
||||
if ( existingWellPath )
|
||||
{
|
||||
existingWellPath->setFilepath( wellPath->filePath() );
|
||||
@@ -584,6 +585,8 @@ void RimWellPathCollection::deleteAllWellPaths()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellPathCollection::deleteWell( RimWellPath* wellPath )
|
||||
{
|
||||
removeWellPath( wellPath );
|
||||
|
||||
m_wellPaths.removeChild( wellPath );
|
||||
delete wellPath;
|
||||
}
|
||||
@@ -703,16 +706,18 @@ void RimWellPathCollection::reloadAllWellPathFormations()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellPathCollection::removeWellPath( gsl::not_null<RimWellPath*> wellPath )
|
||||
void RimWellPathCollection::removeWellPath( gsl::not_null<RimWellPath*> wellToRemove )
|
||||
{
|
||||
RimFileWellPath* fileWellPath = dynamic_cast<RimFileWellPath*>( wellPath.get() );
|
||||
if ( fileWellPath )
|
||||
auto* fileWellToRemove = dynamic_cast<RimFileWellPath*>( wellToRemove.get() );
|
||||
if ( fileWellToRemove )
|
||||
{
|
||||
bool isFilePathUsed = false;
|
||||
for ( auto wellPath : m_wellPaths )
|
||||
for ( const auto& well : m_wellPaths )
|
||||
{
|
||||
RimFileWellPath* fWPath = dynamic_cast<RimFileWellPath*>( wellPath.p() );
|
||||
if ( fWPath && fWPath->filePath() == fileWellPath->filePath() )
|
||||
auto fileWell = dynamic_cast<RimFileWellPath*>( well.p() );
|
||||
if ( fileWell == fileWellToRemove ) continue;
|
||||
|
||||
if ( fileWell && fileWell->filePath() == fileWellToRemove->filePath() )
|
||||
{
|
||||
isFilePathUsed = true;
|
||||
break;
|
||||
@@ -723,7 +728,7 @@ void RimWellPathCollection::removeWellPath( gsl::not_null<RimWellPath*> wellPath
|
||||
{
|
||||
// One file can have multiple well paths
|
||||
// If no other well paths are referencing the filepath, remove cached data from the file reader
|
||||
m_wellPathImporter->removeFilePath( fileWellPath->filePath() );
|
||||
m_wellPathImporter->removeFilePath( fileWellToRemove->filePath() );
|
||||
}
|
||||
}
|
||||
updateAllRequiredEditors();
|
||||
|
||||
Reference in New Issue
Block a user