From 723caaaf79e7cfee6e786d1d6f1ccf8179a1ff92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacob=20St=C3=B8ren?= Date: Tue, 10 Dec 2019 16:36:07 +0100 Subject: [PATCH] #5147 RimEclipseCase::m_filesContainingFaults -> vector --- .../ProjectDataModel/RimEclipseCase.cpp | 29 ++++++++----------- .../ProjectDataModel/RimEclipseCase.h | 4 +-- .../ProjectDataModel/RimEclipseResultCase.cpp | 24 +++++++-------- 3 files changed, 26 insertions(+), 31 deletions(-) diff --git a/ApplicationCode/ProjectDataModel/RimEclipseCase.cpp b/ApplicationCode/ProjectDataModel/RimEclipseCase.cpp index 4486c5a5ec..770ac6cfcd 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseCase.cpp +++ b/ApplicationCode/ProjectDataModel/RimEclipseCase.cpp @@ -89,8 +89,8 @@ RimEclipseCase::RimEclipseCase() CAF_PDM_InitField( &m_flipXAxis, "FlipXAxis", false, "Flip X Axis", "", "", "" ); CAF_PDM_InitField( &m_flipYAxis, "FlipYAxis", false, "Flip Y Axis", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_filesContainingFaultsSemColSeparated, "CachedFileNamesContainingFaults", "", "", "", "" ); - m_filesContainingFaultsSemColSeparated.uiCapability()->setUiHidden( true ); + CAF_PDM_InitFieldNoDefault( &m_filesContainingFaults, "CachedFileNamesContainingFaults", "", "", "", "" ); + m_filesContainingFaults.uiCapability()->setUiHidden( true ); CAF_PDM_InitFieldNoDefault( &m_contourMapCollection, "ContourMaps", "2d Contour Maps", "", "", "" ); m_contourMapCollection = new RimEclipseContourMapViewCollection; @@ -746,12 +746,12 @@ const RimReservoirCellResultsStorage* RimEclipseCase::resultsStorage( RiaDefines //-------------------------------------------------------------------------------------------------- std::vector RimEclipseCase::filesContainingFaults() const { - QString separatedPaths = m_filesContainingFaultsSemColSeparated; - QStringList pathList = separatedPaths.split( ";", QString::SkipEmptyParts ); std::vector stdPathList; - for ( auto& path : pathList ) - stdPathList.push_back( path ); + for ( auto& filePath : m_filesContainingFaults() ) + { + stdPathList.push_back( filePath.path() ); + } return stdPathList; } @@ -759,20 +759,15 @@ std::vector RimEclipseCase::filesContainingFaults() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimEclipseCase::setFilesContainingFaults( const std::vector& val ) +void RimEclipseCase::setFilesContainingFaults( const std::vector& pathStrings ) { - QString separatedPaths; - - for ( size_t i = 0; i < val.size(); ++i ) + std::vector filePaths; + for ( const auto& pathString : pathStrings ) { - const auto& path = val[i]; - separatedPaths += path; - if ( !( i + 1 >= val.size() ) ) - { - separatedPaths += ";"; - } + filePaths.push_back( pathString ); } - m_filesContainingFaultsSemColSeparated = separatedPaths; + + m_filesContainingFaults = filePaths; } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/RimEclipseCase.h b/ApplicationCode/ProjectDataModel/RimEclipseCase.h index 76f58702ea..fd067d01f7 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseCase.h +++ b/ApplicationCode/ProjectDataModel/RimEclipseCase.h @@ -145,8 +145,8 @@ protected: caf::PdmChildField m_inputPropertyCollection; private: - caf::PdmField m_filesContainingFaultsSemColSeparated; - caf::PdmField m_releaseResultMemory; + caf::PdmField> m_filesContainingFaults; + caf::PdmField m_releaseResultMemory; caf::PdmChildField m_contourMapCollection; diff --git a/ApplicationCode/ProjectDataModel/RimEclipseResultCase.cpp b/ApplicationCode/ProjectDataModel/RimEclipseResultCase.cpp index 9db0687f2c..123bf2a0eb 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseResultCase.cpp +++ b/ApplicationCode/ProjectDataModel/RimEclipseResultCase.cpp @@ -486,22 +486,22 @@ void RimEclipseResultCase::readGridDimensions( std::vector>& gr //-------------------------------------------------------------------------------------------------- void RimEclipseResultCase::updateFilePathsFromProjectPath( const QString& newProjectPath, const QString& oldProjectPath ) { - bool foundFile = false; - std::vector searchedPaths; + // bool foundFile = false; + // std::vector searchedPaths; // Update filename and folder paths when opening project from a different file location // caseFileName = RimTools::relocateFile( caseFileName().path(), newProjectPath, oldProjectPath, &foundFile, &searchedPaths ); - std::vector relocatedFaultFiles; - const std::vector& orgFilesContainingFaults = filesContainingFaults(); - for ( auto faultFileName : orgFilesContainingFaults ) - { - QString relocatedFaultFile = - RimTools::relocateFile( faultFileName, newProjectPath, oldProjectPath, &foundFile, &searchedPaths ); - relocatedFaultFiles.push_back( relocatedFaultFile ); - } - - setFilesContainingFaults( relocatedFaultFiles ); + // std::vector relocatedFaultFiles; + // const std::vector& orgFilesContainingFaults = filesContainingFaults(); + // for ( auto faultFileName : orgFilesContainingFaults ) + // { + // QString relocatedFaultFile = + // RimTools::relocateFile( faultFileName, newProjectPath, oldProjectPath, &foundFile, &searchedPaths ); + // relocatedFaultFiles.push_back( relocatedFaultFile ); + // } + // + // setFilesContainingFaults( relocatedFaultFiles ); #if 0 // Output the search path for debugging for (size_t i = 0; i < searchedPaths.size(); ++i)