#5917 Export Completion: Avoid overwrite of export completion well name

This commit is contained in:
Magne Sjaastad 2020-05-22 12:25:25 +02:00
parent ff90ae5704
commit 4a8aa6ced1
5 changed files with 25 additions and 7 deletions

View File

@ -139,7 +139,7 @@ void RimFileWellPath::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering
//--------------------------------------------------------------------------------------------------
/// Read JSON or ascii file containing well path data
//--------------------------------------------------------------------------------------------------
bool RimFileWellPath::readWellPathFile( QString* errorMessage, RifWellPathImporter* wellPathImporter )
bool RimFileWellPath::readWellPathFile( QString* errorMessage, RifWellPathImporter* wellPathImporter, bool setWellNameForExport )
{
if ( caf::Utils::fileExists( this->filePath() ) )
{
@ -150,7 +150,15 @@ bool RimFileWellPath::readWellPathFile( QString* errorMessage, RifWellPathImport
wellPathImporter->readWellMetaData( this->filePath(), m_wellPathIndexInFile() );
// General well info
setName( wellData.m_name );
if ( setWellNameForExport )
{
setName( wellData.m_name );
}
else
{
setNameNoUpdateOfExportName( wellData.m_name );
}
id = wellMetaData.m_id;
sourceSystem = wellMetaData.m_sourceSystem;
utmZone = wellMetaData.m_utmZone;

View File

@ -28,7 +28,7 @@ public:
QString filePath() const;
void setFilepath( const QString& path );
bool readWellPathFile( QString* errorMessage, RifWellPathImporter* wellPathImporter );
bool readWellPathFile( QString* errorMessage, RifWellPathImporter* wellPathImporter, bool setWellNameForExport );
int wellPathIndexInFile() const; // -1 means none.
void setWellPathIndexInFile( int index );
void updateFilePathsFromProjectPath( const QString& newProjectPath, const QString& oldProjectPath ) override;

View File

@ -460,8 +460,17 @@ QString RimWellPath::name() const
//--------------------------------------------------------------------------------------------------
void RimWellPath::setName( const QString& name )
{
m_name = name;
setNameNoUpdateOfExportName( name );
m_completions->setWellNameForExport( name );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellPath::setNameNoUpdateOfExportName( const QString& name )
{
m_name = name;
tryAssociateWithSimulationWell();
}

View File

@ -75,6 +75,7 @@ public:
QString name() const;
void setName( const QString& name );
void setNameNoUpdateOfExportName( const QString& name );
const QString associatedSimulationWellName() const;
int associatedSimulationWellBranch() const;

View File

@ -152,7 +152,7 @@ void RimWellPathCollection::loadDataAndUpdate()
if ( !fWPath->filePath().isEmpty() )
{
QString errorMessage;
if ( !fWPath->readWellPathFile( &errorMessage, m_wellPathImporter ) )
if ( !fWPath->readWellPathFile( &errorMessage, m_wellPathImporter, false ) )
{
RiaLogging::warning( errorMessage );
}
@ -260,7 +260,7 @@ void RimWellPathCollection::readAndAddWellPaths( std::vector<RimFileWellPath*>&
for ( size_t wpIdx = 0; wpIdx < wellPathArray.size(); wpIdx++ )
{
RimFileWellPath* wellPath = wellPathArray[wpIdx];
wellPath->readWellPathFile( nullptr, m_wellPathImporter );
wellPath->readWellPathFile( nullptr, m_wellPathImporter, true );
progress.setProgressDescription( QString( "Reading file %1" ).arg( wellPath->name() ) );
@ -270,7 +270,7 @@ void RimWellPathCollection::readAndAddWellPaths( std::vector<RimFileWellPath*>&
{
existingWellPath->setFilepath( wellPath->filePath() );
existingWellPath->setWellPathIndexInFile( wellPath->wellPathIndexInFile() );
existingWellPath->readWellPathFile( nullptr, m_wellPathImporter );
existingWellPath->readWellPathFile( nullptr, m_wellPathImporter, true );
// Let name from well path file override name from well log file
existingWellPath->setName( wellPath->name() );