#5147 RimEclipseCase::m_filesContainingFaults -> vector<FilePath>

This commit is contained in:
Jacob Støren 2019-12-10 16:36:07 +01:00
parent d19c87c23a
commit 723caaaf79
3 changed files with 26 additions and 31 deletions

View File

@ -89,8 +89,8 @@ RimEclipseCase::RimEclipseCase()
CAF_PDM_InitField( &m_flipXAxis, "FlipXAxis", false, "Flip X Axis", "", "", "" ); CAF_PDM_InitField( &m_flipXAxis, "FlipXAxis", false, "Flip X Axis", "", "", "" );
CAF_PDM_InitField( &m_flipYAxis, "FlipYAxis", false, "Flip Y Axis", "", "", "" ); CAF_PDM_InitField( &m_flipYAxis, "FlipYAxis", false, "Flip Y Axis", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_filesContainingFaultsSemColSeparated, "CachedFileNamesContainingFaults", "", "", "", "" ); CAF_PDM_InitFieldNoDefault( &m_filesContainingFaults, "CachedFileNamesContainingFaults", "", "", "", "" );
m_filesContainingFaultsSemColSeparated.uiCapability()->setUiHidden( true ); m_filesContainingFaults.uiCapability()->setUiHidden( true );
CAF_PDM_InitFieldNoDefault( &m_contourMapCollection, "ContourMaps", "2d Contour Maps", "", "", "" ); CAF_PDM_InitFieldNoDefault( &m_contourMapCollection, "ContourMaps", "2d Contour Maps", "", "", "" );
m_contourMapCollection = new RimEclipseContourMapViewCollection; m_contourMapCollection = new RimEclipseContourMapViewCollection;
@ -746,12 +746,12 @@ const RimReservoirCellResultsStorage* RimEclipseCase::resultsStorage( RiaDefines
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
std::vector<QString> RimEclipseCase::filesContainingFaults() const std::vector<QString> RimEclipseCase::filesContainingFaults() const
{ {
QString separatedPaths = m_filesContainingFaultsSemColSeparated;
QStringList pathList = separatedPaths.split( ";", QString::SkipEmptyParts );
std::vector<QString> stdPathList; std::vector<QString> stdPathList;
for ( auto& path : pathList ) for ( auto& filePath : m_filesContainingFaults() )
stdPathList.push_back( path ); {
stdPathList.push_back( filePath.path() );
}
return stdPathList; return stdPathList;
} }
@ -759,20 +759,15 @@ std::vector<QString> RimEclipseCase::filesContainingFaults() const
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimEclipseCase::setFilesContainingFaults( const std::vector<QString>& val ) void RimEclipseCase::setFilesContainingFaults( const std::vector<QString>& pathStrings )
{ {
QString separatedPaths; std::vector<caf::FilePath> filePaths;
for ( const auto& pathString : pathStrings )
for ( size_t i = 0; i < val.size(); ++i )
{ {
const auto& path = val[i]; filePaths.push_back( pathString );
separatedPaths += path;
if ( !( i + 1 >= val.size() ) )
{
separatedPaths += ";";
}
} }
m_filesContainingFaultsSemColSeparated = separatedPaths;
m_filesContainingFaults = filePaths;
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@ -145,8 +145,8 @@ protected:
caf::PdmChildField<RimEclipseInputPropertyCollection*> m_inputPropertyCollection; caf::PdmChildField<RimEclipseInputPropertyCollection*> m_inputPropertyCollection;
private: private:
caf::PdmField<QString> m_filesContainingFaultsSemColSeparated; caf::PdmField<std::vector<caf::FilePath>> m_filesContainingFaults;
caf::PdmField<bool> m_releaseResultMemory; caf::PdmField<bool> m_releaseResultMemory;
caf::PdmChildField<RimEclipseContourMapViewCollection*> m_contourMapCollection; caf::PdmChildField<RimEclipseContourMapViewCollection*> m_contourMapCollection;

View File

@ -486,22 +486,22 @@ void RimEclipseResultCase::readGridDimensions( std::vector<std::vector<int>>& gr
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimEclipseResultCase::updateFilePathsFromProjectPath( const QString& newProjectPath, const QString& oldProjectPath ) void RimEclipseResultCase::updateFilePathsFromProjectPath( const QString& newProjectPath, const QString& oldProjectPath )
{ {
bool foundFile = false; // bool foundFile = false;
std::vector<QString> searchedPaths; // std::vector<QString> searchedPaths;
// Update filename and folder paths when opening project from a different file location // Update filename and folder paths when opening project from a different file location
// caseFileName = RimTools::relocateFile( caseFileName().path(), newProjectPath, oldProjectPath, &foundFile, &searchedPaths ); // caseFileName = RimTools::relocateFile( caseFileName().path(), newProjectPath, oldProjectPath, &foundFile, &searchedPaths );
std::vector<QString> relocatedFaultFiles; // std::vector<QString> relocatedFaultFiles;
const std::vector<QString>& orgFilesContainingFaults = filesContainingFaults(); // const std::vector<QString>& orgFilesContainingFaults = filesContainingFaults();
for ( auto faultFileName : orgFilesContainingFaults ) // for ( auto faultFileName : orgFilesContainingFaults )
{ // {
QString relocatedFaultFile = // QString relocatedFaultFile =
RimTools::relocateFile( faultFileName, newProjectPath, oldProjectPath, &foundFile, &searchedPaths ); // RimTools::relocateFile( faultFileName, newProjectPath, oldProjectPath, &foundFile, &searchedPaths );
relocatedFaultFiles.push_back( relocatedFaultFile ); // relocatedFaultFiles.push_back( relocatedFaultFile );
} // }
//
setFilesContainingFaults( relocatedFaultFiles ); // setFilesContainingFaults( relocatedFaultFiles );
#if 0 // Output the search path for debugging #if 0 // Output the search path for debugging
for (size_t i = 0; i < searchedPaths.size(); ++i) for (size_t i = 0; i < searchedPaths.size(); ++i)