#1732 Update path to StimPlan xml if required

This commit is contained in:
Magne Sjaastad 2017-08-03 13:21:19 +02:00
parent f2c20db534
commit bf3636a9df
5 changed files with 34 additions and 3 deletions

View File

@ -126,3 +126,18 @@ void RimFractureTemplateCollection::loadAndUpdateData()
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimFractureTemplateCollection::updateFilePathsFromProjectPath(const QString& newProjectPath, const QString& oldProjectPath)
{
for (RimFractureTemplate* f : fractureDefinitions())
{
RimStimPlanFractureTemplate* stimPlanFracture = dynamic_cast<RimStimPlanFractureTemplate*>(f);
if (stimPlanFracture)
{
stimPlanFracture->updateFilePathsFromProjectPath(newProjectPath, oldProjectPath);
}
}
}

View File

@ -48,4 +48,5 @@ public:
void deleteFractureDefinitions();
void loadAndUpdateData();
void updateFilePathsFromProjectPath(const QString& newProjectPath, const QString& oldProjectPath);
};

View File

@ -21,16 +21,19 @@
#include "RiaApplication.h"
#include "RiaLogging.h"
#include "RifStimPlanXmlReader.h"
#include "RigStimPlanFractureDefinition.h"
#include "RigFractureGrid.h"
#include "RigFractureCell.h"
#include "RimEclipseView.h"
#include "RimFracture.h"
#include "RimFractureContainment.h"
#include "RimProject.h"
#include "RigFractureCell.h"
#include "RimStimPlanColors.h"
#include "RimStimPlanLegendConfig.h"
#include "RimFractureContainment.h"
#include "RimTools.h"
#include "RivWellFracturePartMgr.h"
@ -46,7 +49,6 @@
#include <algorithm>
#include <vector>
#include <cmath>
#include "RifStimPlanXmlReader.h"
@ -178,6 +180,13 @@ QString RimStimPlanFractureTemplate::fileNameWithOutPath()
return stimplanfileFileInfo.fileName();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimStimPlanFractureTemplate::updateFilePathsFromProjectPath(const QString& newProjectPath, const QString& oldProjectPath)
{
m_stimPlanFileName = RimTools::relocateFile(m_stimPlanFileName(), newProjectPath, oldProjectPath, nullptr, nullptr);
}
//--------------------------------------------------------------------------------------------------
///

View File

@ -62,6 +62,9 @@ public:
const QString& fileName();
QString fileNameWithOutPath();
void updateFilePathsFromProjectPath(const QString& newProjectPath, const QString& oldProjectPath);
// Fracture geometry
const RigFractureGrid* fractureGrid() const;

View File

@ -438,6 +438,9 @@ void RimProject::setProjectFileNameAndUpdateDependencies(const QString& fileName
if (oilField->summaryCaseCollection() != NULL) {
oilField->summaryCaseCollection()->updateFilePathsFromProjectPath(newProjectPath, oldProjectPath);
}
CVF_ASSERT(oilField->fractureDefinitionCollection());
oilField->fractureDefinitionCollection()->updateFilePathsFromProjectPath(newProjectPath, oldProjectPath);
}