mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#5147 RimWellPath::m_wellPathFormationFilePath ->FilePath
RimFileWellPath::m_filepath ->FilePath
This commit is contained in:
@@ -33,7 +33,7 @@ RimFileWellPath::RimFileWellPath()
|
||||
m_surveyType.uiCapability()->setUiReadOnly( true );
|
||||
m_surveyType.xmlCapability()->disableIO();
|
||||
|
||||
CAF_PDM_InitField( &m_filepath, "WellPathFilepath", QString( "" ), "File Path", "", "", "" );
|
||||
CAF_PDM_InitFieldNoDefault( &m_filepath, "WellPathFilepath", "File Path", "", "", "" );
|
||||
m_filepath.uiCapability()->setUiReadOnly( true );
|
||||
CAF_PDM_InitField( &m_wellPathIndexInFile, "WellPathNumberInFile", -1, "Well Number in File", "", "", "" );
|
||||
m_wellPathIndexInFile.uiCapability()->setUiReadOnly( true );
|
||||
@@ -49,7 +49,7 @@ RimFileWellPath::~RimFileWellPath() {}
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimFileWellPath::filepath() const
|
||||
{
|
||||
return m_filepath();
|
||||
return m_filepath().path();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -112,10 +112,12 @@ void RimFileWellPath::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimFileWellPath::readWellPathFile( QString* errorMessage, RifWellPathImporter* wellPathImporter )
|
||||
{
|
||||
if ( caf::Utils::fileExists( m_filepath() ) )
|
||||
if ( caf::Utils::fileExists( m_filepath().path() ) )
|
||||
{
|
||||
RifWellPathImporter::WellData wellData = wellPathImporter->readWellData( m_filepath(), m_wellPathIndexInFile() );
|
||||
RifWellPathImporter::WellMetaData wellMetaData = wellPathImporter->readWellMetaData( m_filepath(),
|
||||
RifWellPathImporter::WellData wellData = wellPathImporter->readWellData( m_filepath().path(),
|
||||
m_wellPathIndexInFile() );
|
||||
|
||||
RifWellPathImporter::WellMetaData wellMetaData = wellPathImporter->readWellMetaData( m_filepath().path(),
|
||||
m_wellPathIndexInFile() );
|
||||
// General well info
|
||||
|
||||
@@ -132,7 +134,7 @@ bool RimFileWellPath::readWellPathFile( QString* errorMessage, RifWellPathImport
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( errorMessage ) ( *errorMessage ) = "Could not find the well path file: " + m_filepath();
|
||||
if ( errorMessage ) ( *errorMessage ) = "Could not find the well path file: " + m_filepath().path();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -152,7 +154,7 @@ QString RimFileWellPath::getCacheDirectoryPath()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimFileWellPath::getCacheFileName()
|
||||
{
|
||||
if ( m_filepath().isEmpty() )
|
||||
if ( m_filepath().path().isEmpty() )
|
||||
{
|
||||
return "";
|
||||
}
|
||||
@@ -161,7 +163,7 @@ QString RimFileWellPath::getCacheFileName()
|
||||
|
||||
// Make the path correct related to the possibly new project filename
|
||||
QString newCacheDirPath = getCacheDirectoryPath();
|
||||
QFileInfo oldCacheFile( m_filepath );
|
||||
QFileInfo oldCacheFile( m_filepath().path() );
|
||||
|
||||
cacheFileName = newCacheDirPath + "/" + oldCacheFile.fileName();
|
||||
|
||||
@@ -179,7 +181,7 @@ void RimFileWellPath::setupBeforeSave()
|
||||
return;
|
||||
}
|
||||
|
||||
if ( m_filepath().isEmpty() )
|
||||
if ( m_filepath().path().isEmpty() )
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -189,12 +191,12 @@ void RimFileWellPath::setupBeforeSave()
|
||||
QString newCacheFileName = getCacheFileName();
|
||||
|
||||
// Use QFileInfo to get same string representation to avoid issues with mix of forward and backward slashes
|
||||
QFileInfo prevFileInfo( m_filepath );
|
||||
QFileInfo prevFileInfo( m_filepath().path() );
|
||||
QFileInfo currentFileInfo( newCacheFileName );
|
||||
|
||||
if ( prevFileInfo.absoluteFilePath().compare( currentFileInfo.absoluteFilePath() ) != 0 )
|
||||
{
|
||||
QFile::copy( m_filepath, newCacheFileName );
|
||||
QFile::copy( m_filepath().path(), newCacheFileName );
|
||||
|
||||
m_filepath = newCacheFileName;
|
||||
}
|
||||
@@ -214,7 +216,7 @@ bool RimFileWellPath::isStoredInCache()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFileWellPath::updateFilePathsFromProjectPath( const QString& newProjectPath, const QString& oldProjectPath )
|
||||
{
|
||||
RimWellPath::updateFilePathsFromProjectPath( newProjectPath, oldProjectPath );
|
||||
// RimWellPath::updateFilePathsFromProjectPath( newProjectPath, oldProjectPath );
|
||||
|
||||
if ( isStoredInCache() )
|
||||
{
|
||||
@@ -225,8 +227,8 @@ void RimFileWellPath::updateFilePathsFromProjectPath( const QString& newProjectP
|
||||
m_filepath = newCacheFileName;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_filepath = RimTools::relocateFile( m_filepath(), newProjectPath, oldProjectPath, nullptr, nullptr );
|
||||
}
|
||||
// else
|
||||
// {
|
||||
// m_filepath = RimTools::relocateFile( m_filepath(), newProjectPath, oldProjectPath, nullptr, nullptr );
|
||||
// }
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ private:
|
||||
|
||||
void setupBeforeSave() override;
|
||||
|
||||
caf::PdmField<QString> m_filepath;
|
||||
caf::PdmField<caf::FilePath> m_filepath;
|
||||
caf::PdmField<int> m_wellPathIndexInFile; // -1 means none.
|
||||
|
||||
caf::PdmField<QString> id;
|
||||
|
||||
@@ -118,7 +118,7 @@ RimWellPath::RimWellPath()
|
||||
CAF_PDM_InitField( &m_formationKeyInFile, "WellPathFormationKeyInFile", QString( "" ), "Key in File", "", "", "" );
|
||||
m_formationKeyInFile.uiCapability()->setUiReadOnly( true );
|
||||
|
||||
CAF_PDM_InitField( &m_wellPathFormationFilePath, "WellPathFormationFilePath", QString( "" ), "File Path", "", "", "" );
|
||||
CAF_PDM_InitFieldNoDefault( &m_wellPathFormationFilePath, "WellPathFormationFilePath", "File Path", "", "", "" );
|
||||
m_wellPathFormationFilePath.uiCapability()->setUiReadOnly( true );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_wellLogFile_OBSOLETE, "WellLogFile", "Well Log File", "", "", "" );
|
||||
@@ -627,20 +627,20 @@ size_t RimWellPath::simulationWellBranchCount( const QString& simWellName )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellPath::updateFilePathsFromProjectPath( const QString& newProjectPath, const QString& oldProjectPath )
|
||||
{
|
||||
{
|
||||
bool foundFile = false;
|
||||
std::vector<QString> searchedPaths;
|
||||
|
||||
QString fileNameCandidate = RimTools::relocateFile( m_wellPathFormationFilePath,
|
||||
newProjectPath,
|
||||
oldProjectPath,
|
||||
&foundFile,
|
||||
&searchedPaths );
|
||||
if ( foundFile )
|
||||
{
|
||||
m_wellPathFormationFilePath = fileNameCandidate;
|
||||
}
|
||||
}
|
||||
//{
|
||||
// bool foundFile = false;
|
||||
// std::vector<QString> searchedPaths;
|
||||
//
|
||||
// QString fileNameCandidate = RimTools::relocateFile( m_wellPathFormationFilePath,
|
||||
// newProjectPath,
|
||||
// oldProjectPath,
|
||||
// &foundFile,
|
||||
// &searchedPaths );
|
||||
// if ( foundFile )
|
||||
// {
|
||||
// m_wellPathFormationFilePath = fileNameCandidate;
|
||||
// }
|
||||
//}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -738,14 +738,14 @@ void RimWellPath::setFormationsGeometry( cvf::ref<RigWellPathFormations> wellPat
|
||||
bool RimWellPath::readWellPathFormationsFile( QString* errorMessage,
|
||||
RifWellPathFormationsImporter* wellPathFormationsImporter )
|
||||
{
|
||||
if ( m_wellPathFormationFilePath().isEmpty() )
|
||||
if ( m_wellPathFormationFilePath().path().isEmpty() )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if ( caf::Utils::fileExists( m_wellPathFormationFilePath() ) )
|
||||
if ( caf::Utils::fileExists( m_wellPathFormationFilePath().path() ) )
|
||||
{
|
||||
m_wellPathFormations = wellPathFormationsImporter->readWellPathFormations( m_wellPathFormationFilePath(),
|
||||
m_wellPathFormations = wellPathFormationsImporter->readWellPathFormations( m_wellPathFormationFilePath().path(),
|
||||
m_formationKeyInFile() );
|
||||
if ( m_name().isEmpty() )
|
||||
{
|
||||
@@ -755,7 +755,8 @@ bool RimWellPath::readWellPathFormationsFile( QString* err
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( errorMessage ) ( *errorMessage ) = "Could not find the well pick file: " + m_wellPathFormationFilePath();
|
||||
if ( errorMessage )
|
||||
( *errorMessage ) = "Could not find the well pick file: " + m_wellPathFormationFilePath().path();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -766,20 +767,21 @@ bool RimWellPath::readWellPathFormationsFile( QString* err
|
||||
bool RimWellPath::reloadWellPathFormationsFile( QString* errorMessage,
|
||||
RifWellPathFormationsImporter* wellPathFormationsImporter )
|
||||
{
|
||||
if ( m_wellPathFormationFilePath().isEmpty() )
|
||||
if ( m_wellPathFormationFilePath().path().isEmpty() )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if ( caf::Utils::fileExists( m_wellPathFormationFilePath() ) )
|
||||
if ( caf::Utils::fileExists( m_wellPathFormationFilePath().path() ) )
|
||||
{
|
||||
m_wellPathFormations = wellPathFormationsImporter->reloadWellPathFormations( m_wellPathFormationFilePath(),
|
||||
m_wellPathFormations = wellPathFormationsImporter->reloadWellPathFormations( m_wellPathFormationFilePath().path(),
|
||||
m_formationKeyInFile() );
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( errorMessage ) ( *errorMessage ) = "Could not find the well pick file: " + m_wellPathFormationFilePath();
|
||||
if ( errorMessage )
|
||||
( *errorMessage ) = "Could not find the well pick file: " + m_wellPathFormationFilePath().path();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include "RimWellPathComponentInterface.h"
|
||||
|
||||
#include "cafAppEnum.h"
|
||||
#include "cafFilePath.h"
|
||||
#include "cafPdmChildField.h"
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmObject.h"
|
||||
@@ -158,7 +159,7 @@ private:
|
||||
|
||||
caf::PdmField<RiaEclipseUnitTools::UnitSystemType> m_unitSystem;
|
||||
|
||||
caf::PdmField<QString> m_wellPathFormationFilePath;
|
||||
caf::PdmField<caf::FilePath> m_wellPathFormationFilePath;
|
||||
caf::PdmField<QString> m_formationKeyInFile;
|
||||
|
||||
caf::PdmField<bool> m_showWellPath;
|
||||
|
||||
Reference in New Issue
Block a user