#2441: Fracture Colors : Make sure conductivity result is set on template for old project files

This commit is contained in:
Magne Sjaastad 2018-02-01 15:37:05 +01:00
parent c5333d09b2
commit a4eb16883b
7 changed files with 71 additions and 0 deletions

View File

@ -96,6 +96,7 @@
#ifdef USE_PROTOTYPE_FEATURE_FRACTURES
#include "RimFractureTemplateCollection.h"
#include "RimWellPathFracture.h"
#include "RimStimPlanColors.h"
#endif // USE_PROTOTYPE_FEATURE_FRACTURES
@ -512,7 +513,9 @@ bool RiaApplication::loadProject(const QString& projectFileName, ProjectLoadActi
}
#ifdef USE_PROTOTYPE_FEATURE_FRACTURES
oilField->fractureDefinitionCollection()->loadAndUpdateData();
oilField->fractureDefinitionCollection()->setDefaultConductivityResultIfEmpty();
{
std::vector<RimWellPathFracture*> wellPathFractures;
@ -543,6 +546,7 @@ bool RiaApplication::loadProject(const QString& projectFileName, ProjectLoadActi
}
// Now load the ReservoirViews for the cases
// Add all "native" cases in the project
std::vector<RimCase*> casesToLoad;
@ -568,6 +572,18 @@ bool RiaApplication::loadProject(const QString& projectFileName, ProjectLoadActi
viewProgress.setProgressDescription(riv->name());
#ifdef USE_PROTOTYPE_FEATURE_FRACTURES
if (m_project->isProjectFileVersionEqualOrOlderThan("2018.1.0.103"))
{
std::vector<RimStimPlanColors*> stimPlanColors;
riv->descendantsIncludingThisOfType(stimPlanColors);
if (stimPlanColors.size() == 1)
{
stimPlanColors[0]->updateConductivityResultName();
}
}
#endif // USE_PROTOTYPE_FEATURE_FRACTURES
riv->loadDataAndUpdate();
this->setActiveReservoirView(riv);

View File

@ -125,6 +125,21 @@ void RimFractureTemplateCollection::loadAndUpdateData()
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimFractureTemplateCollection::setDefaultConductivityResultIfEmpty()
{
for (RimFractureTemplate* f : fractureDefinitions())
{
RimStimPlanFractureTemplate* stimPlanFracture = dynamic_cast<RimStimPlanFractureTemplate*>(f);
if (stimPlanFracture)
{
stimPlanFracture->setDefaultConductivityResultIfEmpty();
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -46,6 +46,7 @@ public:
void deleteFractureDefinitions();
void loadAndUpdateData();
void setDefaultConductivityResultIfEmpty();
void updateFilePathsFromProjectPath(const QString& newProjectPath, const QString& oldProjectPath);
};

View File

@ -397,6 +397,20 @@ QString RimStimPlanFractureTemplate::getUnitForStimPlanParameter(QString paramet
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimStimPlanFractureTemplate::setDefaultConductivityResultIfEmpty()
{
if (m_conductivityResultNameOnFile().isEmpty())
{
if (!m_stimPlanFractureDefinitionData->conductivityResultNames().isEmpty())
{
m_conductivityResultNameOnFile = m_stimPlanFractureDefinitionData->conductivityResultNames().front();
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -86,6 +86,7 @@ public:
PosNegAccumulator& posNegAccumulator) const override;
QString mapUiResultNameToFileResultName(const QString& uiResultName) const;
void setDefaultConductivityResultIfEmpty();
protected:
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;

View File

@ -313,6 +313,28 @@ void RimStimPlanColors::updateStimPlanTemplates() const
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimStimPlanColors::updateConductivityResultName()
{
// Conductivity result name as reported from the XML file was moved to the fracture template
// Replace all conductivity names with the one and only conductivity uiName reported from by fracture template
if (m_resultNameAndUnit().contains("conductivity", Qt::CaseInsensitive))
{
RimFractureTemplateCollection* fractureTemplates = fractureTemplateCollection();
for (auto resultNameAndUnit : fractureTemplates->stimPlanResultNamesAndUnits())
{
if (resultNameAndUnit.first.contains("conductivity", Qt::CaseInsensitive))
{
QString resultNameAndUnitString = toString(resultNameAndUnit);
m_resultNameAndUnit = resultNameAndUnitString;
}
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -67,6 +67,8 @@ public:
void updateStimPlanTemplates() const;
StimPlanResultColorType stimPlanResultColorType() const { return m_stimPlanCellVizMode(); };
void updateConductivityResultName();
protected:
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly) override;
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;