mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#760 Input Property rename does not update dependent fields
This commit is contained in:
parent
3bdefca77e
commit
7c69ae434e
@ -20,6 +20,11 @@
|
|||||||
|
|
||||||
#include "RimEclipseInputProperty.h"
|
#include "RimEclipseInputProperty.h"
|
||||||
|
|
||||||
|
#include "RigCaseCellResultsData.h"
|
||||||
|
#include "RigCaseData.h"
|
||||||
|
#include "RimEclipseInputCase.h"
|
||||||
|
#include "RimEclipseResultDefinition.h"
|
||||||
|
|
||||||
#include "cafPdmUiLineEditor.h"
|
#include "cafPdmUiLineEditor.h"
|
||||||
#include "cvfAssert.h"
|
#include "cvfAssert.h"
|
||||||
|
|
||||||
@ -69,3 +74,57 @@ RimEclipseInputProperty::~RimEclipseInputProperty()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimEclipseInputProperty::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
|
||||||
|
{
|
||||||
|
if (changedField == &resultName)
|
||||||
|
{
|
||||||
|
RimEclipseInputCase* rimCase = nullptr;
|
||||||
|
this->firstAncestorOrThisOfType(rimCase);
|
||||||
|
if (rimCase)
|
||||||
|
{
|
||||||
|
bool anyNameUpdated = false;
|
||||||
|
|
||||||
|
QString oldName = oldValue.toString();
|
||||||
|
QString newName = newValue.toString();
|
||||||
|
|
||||||
|
RigCaseCellResultsData* matrixResults = rimCase->reservoirData()->results(RifReaderInterface::MATRIX_RESULTS);
|
||||||
|
if (matrixResults)
|
||||||
|
{
|
||||||
|
if (matrixResults->updateResultName(RimDefines::INPUT_PROPERTY, oldName, newName))
|
||||||
|
{
|
||||||
|
anyNameUpdated = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
RigCaseCellResultsData* fracResults = rimCase->reservoirData()->results(RifReaderInterface::FRACTURE_RESULTS);
|
||||||
|
if (fracResults)
|
||||||
|
{
|
||||||
|
if (fracResults->updateResultName(RimDefines::INPUT_PROPERTY, oldName, newName))
|
||||||
|
{
|
||||||
|
anyNameUpdated = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (anyNameUpdated)
|
||||||
|
{
|
||||||
|
std::vector<RimEclipseResultDefinition*> resDefs;
|
||||||
|
rimCase->descendantsIncludingThisOfType(resDefs);
|
||||||
|
|
||||||
|
for (auto it : resDefs)
|
||||||
|
{
|
||||||
|
if (it->resultVariable() == oldName)
|
||||||
|
{
|
||||||
|
it->setResultVariable(newName);
|
||||||
|
}
|
||||||
|
|
||||||
|
it->updateResultNameHasChanged();
|
||||||
|
it->updateAnyFieldHasChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -57,8 +57,6 @@ public:
|
|||||||
|
|
||||||
// PdmObject Overrides
|
// PdmObject Overrides
|
||||||
virtual caf::PdmFieldHandle* userDescriptionField() { return &resultName;}
|
virtual caf::PdmFieldHandle* userDescriptionField() { return &resultName;}
|
||||||
|
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
|
||||||
private:
|
|
||||||
// Possibly the resultIndex, but it should be superfluous
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -102,7 +102,7 @@ QStringList RimEclipseResultDefinition::getResultVariableListForCurrentUIFieldSe
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
RimReservoirCellResultsStorage* RimEclipseResultDefinition::currentGridCellResults() const
|
RimReservoirCellResultsStorage* RimEclipseResultDefinition::currentGridCellResults() const
|
||||||
{
|
{
|
||||||
if (!m_eclipseCase ) return NULL;
|
if (!m_eclipseCase ) return nullptr;
|
||||||
|
|
||||||
RifReaderInterface::PorosityModelResultType porosityModel = RigCaseCellResultsData::convertFromProjectModelPorosityModel(m_porosityModel());
|
RifReaderInterface::PorosityModelResultType porosityModel = RigCaseCellResultsData::convertFromProjectModelPorosityModel(m_porosityModel());
|
||||||
|
|
||||||
@ -133,23 +133,71 @@ void RimEclipseResultDefinition::fieldChangedByUi(const caf::PdmFieldHandle* cha
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
RimEclipsePropertyFilter* propFilter = dynamic_cast<RimEclipsePropertyFilter*>(this->parentField()->ownerObject());
|
|
||||||
RimView* view = NULL;
|
|
||||||
this->firstAncestorOrThisOfType(view);
|
|
||||||
RimWellLogCurve* curve = NULL;
|
|
||||||
this->firstAncestorOrThisOfType(curve);
|
|
||||||
|
|
||||||
RimCellEdgeColors* cellEdgeColors = NULL;
|
|
||||||
this->firstAncestorOrThisOfType(cellEdgeColors);
|
|
||||||
|
|
||||||
if (&m_resultVariableUiField == changedField)
|
if (&m_resultVariableUiField == changedField)
|
||||||
{
|
{
|
||||||
m_porosityModel = m_porosityModelUiField;
|
m_porosityModel = m_porosityModelUiField;
|
||||||
m_resultType = m_resultTypeUiField;
|
m_resultType = m_resultTypeUiField;
|
||||||
m_resultVariable = m_resultVariableUiField;
|
m_resultVariable = m_resultVariableUiField;
|
||||||
|
|
||||||
|
updateResultNameHasChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
updateAnyFieldHasChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimEclipseResultDefinition::updateAnyFieldHasChanged()
|
||||||
|
{
|
||||||
|
RimEclipsePropertyFilter* propFilter = nullptr;
|
||||||
|
this->firstAncestorOrThisOfType(propFilter);
|
||||||
|
if (propFilter)
|
||||||
|
{
|
||||||
|
propFilter->updateConnectedEditors();
|
||||||
|
}
|
||||||
|
|
||||||
|
RimEclipseFaultColors* faultColors = nullptr;
|
||||||
|
this->firstAncestorOrThisOfType(faultColors);
|
||||||
|
if (faultColors)
|
||||||
|
{
|
||||||
|
faultColors->updateConnectedEditors();
|
||||||
|
}
|
||||||
|
|
||||||
|
RimCellEdgeColors* cellEdgeColors = nullptr;
|
||||||
|
this->firstAncestorOrThisOfType(cellEdgeColors);
|
||||||
|
if (cellEdgeColors)
|
||||||
|
{
|
||||||
|
cellEdgeColors->updateConnectedEditors();
|
||||||
|
}
|
||||||
|
|
||||||
|
RimEclipseCellColors* cellColors = nullptr;
|
||||||
|
this->firstAncestorOrThisOfType(cellColors);
|
||||||
|
if (cellColors)
|
||||||
|
{
|
||||||
|
cellColors->updateConnectedEditors();
|
||||||
|
}
|
||||||
|
|
||||||
|
RimWellLogCurve* curve = nullptr;
|
||||||
|
this->firstAncestorOrThisOfType(curve);
|
||||||
|
if (curve)
|
||||||
|
{
|
||||||
|
curve->updateConnectedEditors();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimEclipseResultDefinition::updateResultNameHasChanged()
|
||||||
|
{
|
||||||
|
RimView* view = nullptr;
|
||||||
|
this->firstAncestorOrThisOfType(view);
|
||||||
|
|
||||||
loadResult();
|
loadResult();
|
||||||
|
|
||||||
|
RimEclipsePropertyFilter* propFilter = nullptr;
|
||||||
|
this->firstAncestorOrThisOfType(propFilter);
|
||||||
if (propFilter)
|
if (propFilter)
|
||||||
{
|
{
|
||||||
propFilter->setToDefaultValues();
|
propFilter->setToDefaultValues();
|
||||||
@ -162,7 +210,9 @@ void RimEclipseResultDefinition::fieldChangedByUi(const caf::PdmFieldHandle* cha
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dynamic_cast<RimEclipseCellColors*>(this))
|
RimEclipseCellColors* cellColors = nullptr;
|
||||||
|
this->firstAncestorOrThisOfType(cellColors);
|
||||||
|
if (cellColors)
|
||||||
{
|
{
|
||||||
this->updateLegendCategorySettings();
|
this->updateLegendCategorySettings();
|
||||||
|
|
||||||
@ -176,6 +226,8 @@ void RimEclipseResultDefinition::fieldChangedByUi(const caf::PdmFieldHandle* cha
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RimCellEdgeColors* cellEdgeColors = nullptr;
|
||||||
|
this->firstAncestorOrThisOfType(cellEdgeColors);
|
||||||
if (cellEdgeColors)
|
if (cellEdgeColors)
|
||||||
{
|
{
|
||||||
cellEdgeColors->singleVarEdgeResultColors()->updateLegendCategorySettings();
|
cellEdgeColors->singleVarEdgeResultColors()->updateLegendCategorySettings();
|
||||||
@ -187,35 +239,14 @@ void RimEclipseResultDefinition::fieldChangedByUi(const caf::PdmFieldHandle* cha
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RimWellLogCurve* curve = nullptr;
|
||||||
|
this->firstAncestorOrThisOfType(curve);
|
||||||
if (curve)
|
if (curve)
|
||||||
{
|
{
|
||||||
curve->loadDataAndUpdate();
|
curve->loadDataAndUpdate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (propFilter)
|
|
||||||
{
|
|
||||||
propFilter->updateConnectedEditors();
|
|
||||||
}
|
|
||||||
|
|
||||||
RimEclipseFaultColors* faultColors = dynamic_cast<RimEclipseFaultColors*>(this->parentField()->ownerObject());
|
|
||||||
if (faultColors)
|
|
||||||
{
|
|
||||||
faultColors->updateConnectedEditors();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cellEdgeColors)
|
|
||||||
{
|
|
||||||
cellEdgeColors->updateConnectedEditors();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (curve)
|
|
||||||
{
|
|
||||||
curve->updateConnectedEditors();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -223,19 +254,19 @@ QList<caf::PdmOptionItemInfo> RimEclipseResultDefinition::calculateValueOptions(
|
|||||||
{
|
{
|
||||||
bool showPerFaceResultsFirst = false;
|
bool showPerFaceResultsFirst = false;
|
||||||
|
|
||||||
RimEclipseFaultColors* rimEclipseFaultColors = NULL;
|
RimEclipseFaultColors* rimEclipseFaultColors = nullptr;
|
||||||
this->firstAncestorOrThisOfType(rimEclipseFaultColors);
|
this->firstAncestorOrThisOfType(rimEclipseFaultColors);
|
||||||
if (rimEclipseFaultColors) showPerFaceResultsFirst = true;
|
if (rimEclipseFaultColors) showPerFaceResultsFirst = true;
|
||||||
|
|
||||||
QList<caf::PdmOptionItemInfo> optionItems = calculateValueOptionsForSpecifiedDerivedListPosition(showPerFaceResultsFirst, fieldNeedingOptions, useOptionsOnly);
|
QList<caf::PdmOptionItemInfo> optionItems = calculateValueOptionsForSpecifiedDerivedListPosition(showPerFaceResultsFirst, fieldNeedingOptions, useOptionsOnly);
|
||||||
|
|
||||||
RimWellLogCurve* curve = NULL;
|
RimWellLogCurve* curve = nullptr;
|
||||||
this->firstAncestorOrThisOfType(curve);
|
this->firstAncestorOrThisOfType(curve);
|
||||||
|
|
||||||
RimEclipsePropertyFilter* propFilter = NULL;
|
RimEclipsePropertyFilter* propFilter = nullptr;
|
||||||
this->firstAncestorOrThisOfType(propFilter);
|
this->firstAncestorOrThisOfType(propFilter);
|
||||||
|
|
||||||
RimCellEdgeColors* cellEdge = NULL;
|
RimCellEdgeColors* cellEdge = nullptr;
|
||||||
this->firstAncestorOrThisOfType(cellEdge);
|
this->firstAncestorOrThisOfType(cellEdge);
|
||||||
|
|
||||||
if (propFilter || curve || cellEdge)
|
if (propFilter || curve || cellEdge)
|
||||||
|
@ -64,10 +64,16 @@ public:
|
|||||||
|
|
||||||
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly);
|
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly);
|
||||||
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue);
|
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
virtual void initAfterRead();
|
virtual void initAfterRead();
|
||||||
|
|
||||||
virtual void updateLegendCategorySettings() {};
|
virtual void updateLegendCategorySettings() {};
|
||||||
|
|
||||||
|
void updateResultNameHasChanged();
|
||||||
|
void updateAnyFieldHasChanged();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void updateFieldVisibility();
|
void updateFieldVisibility();
|
||||||
|
|
||||||
|
@ -519,6 +519,25 @@ RifReaderInterface::PorosityModelResultType RigCaseCellResultsData::convertFromP
|
|||||||
return RifReaderInterface::FRACTURE_RESULTS;
|
return RifReaderInterface::FRACTURE_RESULTS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
bool RigCaseCellResultsData::updateResultName(RimDefines::ResultCatType resultType, QString& oldName, const QString& newName)
|
||||||
|
{
|
||||||
|
bool anyNameUpdated = false;
|
||||||
|
|
||||||
|
for (auto& it : m_resultInfos)
|
||||||
|
{
|
||||||
|
if (it.m_resultType == resultType && it.m_resultName == oldName)
|
||||||
|
{
|
||||||
|
anyNameUpdated = true;
|
||||||
|
it.m_resultName = newName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return anyNameUpdated;
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -96,6 +96,8 @@ public:
|
|||||||
|
|
||||||
static RifReaderInterface::PorosityModelResultType convertFromProjectModelPorosityModel(RimDefines::PorosityModelType porosityModel);
|
static RifReaderInterface::PorosityModelResultType convertFromProjectModelPorosityModel(RimDefines::PorosityModelType porosityModel);
|
||||||
|
|
||||||
|
bool updateResultName(RimDefines::ResultCatType resultType, QString& oldName, const QString& newName);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
class ResultInfo
|
class ResultInfo
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user