SSIHUB: Update file paths for and well path cache

Consolidated cache creation in RimTools
This commit is contained in:
Magne Sjaastad
2013-10-24 09:50:16 +02:00
parent 5772767f79
commit 40092b0d62
12 changed files with 191 additions and 25 deletions

View File

@@ -17,8 +17,14 @@
/////////////////////////////////////////////////////////////////////////////////
#include "RimWellPathImport.h"
#include "RimTools.h"
#include "RimWellPath.h"
#include "RimWellPathCollection.h"
#include "cafPdmUiTreeViewEditor.h"
#include <QFileInfo>
namespace caf {
template<>
@@ -209,5 +215,37 @@ RimWellPathImport::~RimWellPathImport()
regions.deleteAllChildObjects();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellPathImport::updateFilePaths()
{
QString wellPathsFolderPath = RimTools::getCacheRootDirectoryPathFromProject();
wellPathsFolderPath += "_wellpaths";
for (size_t regionIdx = 0; regionIdx < this->regions.size(); regionIdx++)
{
for (size_t fIdx = 0; fIdx < this->regions[regionIdx]->fields.size(); fIdx++)
{
RimOilFieldEntry* oilField = this->regions[regionIdx]->fields[fIdx];
QFileInfo fi(oilField->wellsFilePath);
QString newWellsFilePath = wellPathsFolderPath + "/" + fi.fileName();
oilField->wellsFilePath = newWellsFilePath;
for (size_t wIdx = 0; wIdx < oilField->wells.size(); wIdx++)
{
RimWellPathEntry* rimWellPathEntry = oilField->wells[wIdx];
QFileInfo fiWell(rimWellPathEntry->wellPathFilePath);
QString newFilePath = wellPathsFolderPath + "/" + fiWell.fileName();
rimWellPathEntry->wellPathFilePath = newFilePath;
}
}
}
}

View File

@@ -62,7 +62,7 @@ public:
void updateFieldVisibility();
void updateFilePaths();
};