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:
parent
68c72c85cf
commit
f77b3673b0
@ -18,6 +18,8 @@
|
|||||||
|
|
||||||
#include "RicDeleteSubPlotCtxFeature.h"
|
#include "RicDeleteSubPlotCtxFeature.h"
|
||||||
|
|
||||||
|
#include <QAction>
|
||||||
|
|
||||||
CAF_CMD_SOURCE_INIT( RicDeleteSubPlotCtxFeature, "RicDeleteSubPlotCtxFeature" );
|
CAF_CMD_SOURCE_INIT( RicDeleteSubPlotCtxFeature, "RicDeleteSubPlotCtxFeature" );
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -27,3 +29,12 @@ bool RicDeleteSubPlotCtxFeature::isCommandEnabled()
|
|||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RicDeleteSubPlotCtxFeature::setupActionLook( QAction* actionToSetup )
|
||||||
|
{
|
||||||
|
RicDeleteSubPlotFeature::setupActionLook( actionToSetup );
|
||||||
|
actionToSetup->setShortcut( QKeySequence() );
|
||||||
|
}
|
||||||
|
@ -29,4 +29,5 @@ class RicDeleteSubPlotCtxFeature : public RicDeleteSubPlotFeature
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool isCommandEnabled() override;
|
bool isCommandEnabled() override;
|
||||||
|
void setupActionLook( QAction* actionToSetup ) override;
|
||||||
};
|
};
|
||||||
|
@ -55,21 +55,23 @@ public:
|
|||||||
|
|
||||||
WellData readWellData( const QString& filePath, size_t indexInFile );
|
WellData readWellData( const QString& filePath, size_t indexInFile );
|
||||||
WellData readWellData( const QString& filePath );
|
WellData readWellData( const QString& filePath );
|
||||||
WellMetaData readWellMetaData( const QString& filePath, size_t indexInFile );
|
|
||||||
WellMetaData readWellMetaData( const QString& filePath );
|
|
||||||
size_t wellDataCount( const QString& filePath );
|
size_t wellDataCount( const QString& filePath );
|
||||||
|
|
||||||
void clear();
|
void clear();
|
||||||
void removeFilePath( const QString& filePath );
|
void removeFilePath( const QString& filePath );
|
||||||
|
|
||||||
|
static WellMetaData readWellMetaData( const QString& filePath, size_t indexInFile );
|
||||||
|
static WellMetaData readWellMetaData( const QString& filePath );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
WellData readJsonWellData( const QString& filePath );
|
|
||||||
WellMetaData readJsonWellMetaData( const QString& filePath );
|
|
||||||
WellData readAsciiWellData( const QString& filePath, size_t indexInFile );
|
WellData readAsciiWellData( const QString& filePath, size_t indexInFile );
|
||||||
WellMetaData readAsciiWellMetaData( const QString& filePath, size_t indexInFile );
|
|
||||||
void readAllAsciiWellData( const QString& filePath );
|
void readAllAsciiWellData( const QString& filePath );
|
||||||
|
|
||||||
inline bool isJsonFile( const QString& filePath );
|
static WellData readJsonWellData( const QString& filePath );
|
||||||
|
static WellMetaData readJsonWellMetaData( const QString& filePath );
|
||||||
|
static WellMetaData readAsciiWellMetaData( const QString& filePath, size_t indexInFile );
|
||||||
|
static bool isJsonFile( const QString& filePath );
|
||||||
|
|
||||||
|
private:
|
||||||
std::map<QString, std::vector<RifWellPathImporter::WellData>> m_fileNameToWellDataGroupMap;
|
std::map<QString, std::vector<RifWellPathImporter::WellData>> m_fileNameToWellDataGroupMap;
|
||||||
};
|
};
|
||||||
|
@ -305,16 +305,17 @@ void RimWellPathCollection::readAndAddWellPaths( std::vector<RimFileWellPath*>&
|
|||||||
caf::ProgressInfo progress( wellPathArray.size(), "Reading well paths from file" );
|
caf::ProgressInfo progress( wellPathArray.size(), "Reading well paths from file" );
|
||||||
|
|
||||||
std::vector<RimWellPath*> wellPathsToGroup;
|
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 );
|
wellPath->readWellPathFile( nullptr, m_wellPathImporter.get(), true );
|
||||||
|
|
||||||
progress.setProgressDescription( QString( "Reading file %1" ).arg( wellPath->name() ) );
|
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
|
// If a well path with this name exists already, make it read the well path file. This is useful if a well log
|
||||||
RimFileWellPath* existingWellPath = dynamic_cast<RimFileWellPath*>( tryFindMatchingWellPath( wellPath->name() ) );
|
// 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 )
|
if ( existingWellPath )
|
||||||
{
|
{
|
||||||
existingWellPath->setFilepath( wellPath->filePath() );
|
existingWellPath->setFilepath( wellPath->filePath() );
|
||||||
@ -584,6 +585,8 @@ void RimWellPathCollection::deleteAllWellPaths()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimWellPathCollection::deleteWell( RimWellPath* wellPath )
|
void RimWellPathCollection::deleteWell( RimWellPath* wellPath )
|
||||||
{
|
{
|
||||||
|
removeWellPath( wellPath );
|
||||||
|
|
||||||
m_wellPaths.removeChild( wellPath );
|
m_wellPaths.removeChild( wellPath );
|
||||||
delete 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() );
|
auto* fileWellToRemove = dynamic_cast<RimFileWellPath*>( wellToRemove.get() );
|
||||||
if ( fileWellPath )
|
if ( fileWellToRemove )
|
||||||
{
|
{
|
||||||
bool isFilePathUsed = false;
|
bool isFilePathUsed = false;
|
||||||
for ( auto wellPath : m_wellPaths )
|
for ( const auto& well : m_wellPaths )
|
||||||
{
|
{
|
||||||
RimFileWellPath* fWPath = dynamic_cast<RimFileWellPath*>( wellPath.p() );
|
auto fileWell = dynamic_cast<RimFileWellPath*>( well.p() );
|
||||||
if ( fWPath && fWPath->filePath() == fileWellPath->filePath() )
|
if ( fileWell == fileWellToRemove ) continue;
|
||||||
|
|
||||||
|
if ( fileWell && fileWell->filePath() == fileWellToRemove->filePath() )
|
||||||
{
|
{
|
||||||
isFilePathUsed = true;
|
isFilePathUsed = true;
|
||||||
break;
|
break;
|
||||||
@ -723,7 +728,7 @@ void RimWellPathCollection::removeWellPath( gsl::not_null<RimWellPath*> wellPath
|
|||||||
{
|
{
|
||||||
// One file can have multiple well paths
|
// One file can have multiple well paths
|
||||||
// If no other well paths are referencing the filepath, remove cached data from the file reader
|
// 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();
|
updateAllRequiredEditors();
|
||||||
|
Loading…
Reference in New Issue
Block a user