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 "RigCaseCellResultsData.h"
|
||||
#include "RigCaseData.h"
|
||||
#include "RimEclipseInputCase.h"
|
||||
#include "RimEclipseResultDefinition.h"
|
||||
|
||||
#include "cafPdmUiLineEditor.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
|
||||
virtual caf::PdmFieldHandle* userDescriptionField() { return &resultName;}
|
||||
|
||||
private:
|
||||
// Possibly the resultIndex, but it should be superfluous
|
||||
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
|
||||
|
||||
};
|
||||
|
@ -102,7 +102,7 @@ QStringList RimEclipseResultDefinition::getResultVariableListForCurrentUIFieldSe
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimReservoirCellResultsStorage* RimEclipseResultDefinition::currentGridCellResults() const
|
||||
{
|
||||
if (!m_eclipseCase ) return NULL;
|
||||
if (!m_eclipseCase ) return nullptr;
|
||||
|
||||
RifReaderInterface::PorosityModelResultType porosityModel = RigCaseCellResultsData::convertFromProjectModelPorosityModel(m_porosityModel());
|
||||
|
||||
@ -133,87 +133,118 @@ 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)
|
||||
{
|
||||
m_porosityModel = m_porosityModelUiField;
|
||||
m_resultType = m_resultTypeUiField;
|
||||
m_resultVariable = m_resultVariableUiField;
|
||||
|
||||
loadResult();
|
||||
|
||||
if (propFilter)
|
||||
{
|
||||
propFilter->setToDefaultValues();
|
||||
propFilter->updateFilterName();
|
||||
|
||||
if (view)
|
||||
{
|
||||
view->scheduleGeometryRegen(PROPERTY_FILTERED);
|
||||
view->scheduleCreateDisplayModelAndRedraw();
|
||||
}
|
||||
}
|
||||
|
||||
if (dynamic_cast<RimEclipseCellColors*>(this))
|
||||
{
|
||||
this->updateLegendCategorySettings();
|
||||
|
||||
if (view)
|
||||
{
|
||||
RimViewLinker* viewLinker = view->assosiatedViewLinker();
|
||||
if (viewLinker)
|
||||
{
|
||||
viewLinker->updateCellResult();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (cellEdgeColors)
|
||||
{
|
||||
cellEdgeColors->singleVarEdgeResultColors()->updateLegendCategorySettings();
|
||||
cellEdgeColors->loadResult();
|
||||
|
||||
if (view)
|
||||
{
|
||||
view->scheduleCreateDisplayModelAndRedraw();
|
||||
}
|
||||
}
|
||||
|
||||
if (curve)
|
||||
{
|
||||
curve->loadDataAndUpdate();
|
||||
}
|
||||
updateResultNameHasChanged();
|
||||
}
|
||||
|
||||
updateAnyFieldHasChanged();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEclipseResultDefinition::updateAnyFieldHasChanged()
|
||||
{
|
||||
RimEclipsePropertyFilter* propFilter = nullptr;
|
||||
this->firstAncestorOrThisOfType(propFilter);
|
||||
if (propFilter)
|
||||
{
|
||||
propFilter->updateConnectedEditors();
|
||||
}
|
||||
|
||||
RimEclipseFaultColors* faultColors = dynamic_cast<RimEclipseFaultColors*>(this->parentField()->ownerObject());
|
||||
|
||||
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();
|
||||
|
||||
RimEclipsePropertyFilter* propFilter = nullptr;
|
||||
this->firstAncestorOrThisOfType(propFilter);
|
||||
if (propFilter)
|
||||
{
|
||||
propFilter->setToDefaultValues();
|
||||
propFilter->updateFilterName();
|
||||
|
||||
if (view)
|
||||
{
|
||||
view->scheduleGeometryRegen(PROPERTY_FILTERED);
|
||||
view->scheduleCreateDisplayModelAndRedraw();
|
||||
}
|
||||
}
|
||||
|
||||
RimEclipseCellColors* cellColors = nullptr;
|
||||
this->firstAncestorOrThisOfType(cellColors);
|
||||
if (cellColors)
|
||||
{
|
||||
this->updateLegendCategorySettings();
|
||||
|
||||
if (view)
|
||||
{
|
||||
RimViewLinker* viewLinker = view->assosiatedViewLinker();
|
||||
if (viewLinker)
|
||||
{
|
||||
viewLinker->updateCellResult();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RimCellEdgeColors* cellEdgeColors = nullptr;
|
||||
this->firstAncestorOrThisOfType(cellEdgeColors);
|
||||
if (cellEdgeColors)
|
||||
{
|
||||
cellEdgeColors->singleVarEdgeResultColors()->updateLegendCategorySettings();
|
||||
cellEdgeColors->loadResult();
|
||||
|
||||
if (view)
|
||||
{
|
||||
view->scheduleCreateDisplayModelAndRedraw();
|
||||
}
|
||||
}
|
||||
|
||||
RimWellLogCurve* curve = nullptr;
|
||||
this->firstAncestorOrThisOfType(curve);
|
||||
if (curve)
|
||||
{
|
||||
curve->loadDataAndUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -223,19 +254,19 @@ QList<caf::PdmOptionItemInfo> RimEclipseResultDefinition::calculateValueOptions(
|
||||
{
|
||||
bool showPerFaceResultsFirst = false;
|
||||
|
||||
RimEclipseFaultColors* rimEclipseFaultColors = NULL;
|
||||
RimEclipseFaultColors* rimEclipseFaultColors = nullptr;
|
||||
this->firstAncestorOrThisOfType(rimEclipseFaultColors);
|
||||
if (rimEclipseFaultColors) showPerFaceResultsFirst = true;
|
||||
|
||||
QList<caf::PdmOptionItemInfo> optionItems = calculateValueOptionsForSpecifiedDerivedListPosition(showPerFaceResultsFirst, fieldNeedingOptions, useOptionsOnly);
|
||||
|
||||
RimWellLogCurve* curve = NULL;
|
||||
RimWellLogCurve* curve = nullptr;
|
||||
this->firstAncestorOrThisOfType(curve);
|
||||
|
||||
RimEclipsePropertyFilter* propFilter = NULL;
|
||||
RimEclipsePropertyFilter* propFilter = nullptr;
|
||||
this->firstAncestorOrThisOfType(propFilter);
|
||||
|
||||
RimCellEdgeColors* cellEdge = NULL;
|
||||
RimCellEdgeColors* cellEdge = nullptr;
|
||||
this->firstAncestorOrThisOfType(cellEdge);
|
||||
|
||||
if (propFilter || curve || cellEdge)
|
||||
|
@ -64,10 +64,16 @@ public:
|
||||
|
||||
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 initAfterRead();
|
||||
|
||||
virtual void updateLegendCategorySettings() {};
|
||||
|
||||
void updateResultNameHasChanged();
|
||||
void updateAnyFieldHasChanged();
|
||||
|
||||
protected:
|
||||
void updateFieldVisibility();
|
||||
|
||||
|
@ -519,6 +519,25 @@ RifReaderInterface::PorosityModelResultType RigCaseCellResultsData::convertFromP
|
||||
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);
|
||||
|
||||
bool updateResultName(RimDefines::ResultCatType resultType, QString& oldName, const QString& newName);
|
||||
|
||||
public:
|
||||
class ResultInfo
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user