Got rid of the "ownership"-changes in EclipseResultDefinition with friends.

Updating is now done more explicitly.
This commit is contained in:
Jacob Støren
2015-08-10 14:14:22 +02:00
parent 8ee3e12335
commit df0b4164c5
5 changed files with 39 additions and 50 deletions

View File

@@ -24,6 +24,7 @@
#include "RimTernaryLegendConfig.h"
#include "RimUiTreeModelPdm.h"
#include "RiuMainWindow.h"
#include "RimEclipseFaultColors.h"
CAF_PDM_SOURCE_INIT(RimEclipseCellColors, "ResultSlot");
@@ -72,7 +73,7 @@ void RimEclipseCellColors::fieldChangedByUi(const caf::PdmFieldHandle* changedFi
{
RimEclipseResultDefinition::fieldChangedByUi(changedField, oldValue, newValue);
// Update of legend config must happen after RimResultDefinition::fieldChangedByUi(), as this function modifies this->resultVariable()
// Update of legend config must happen after RimEclipseResultDefinition::fieldChangedByUi(), as this function modifies this->resultVariable()
if (changedField == &m_resultVariableUiField)
{
if (oldValue != newValue)
@@ -85,7 +86,15 @@ void RimEclipseCellColors::fieldChangedByUi(const caf::PdmFieldHandle* changedFi
if (m_reservoirView) m_reservoirView->hasUserRequestedAnimation = true;
}
RiuMainWindow::instance()->uiPdmModel()->updateUiSubTree(this);
RimEclipseFaultColors* faultColors = dynamic_cast<RimEclipseFaultColors*>(this->parentField()->ownerObject());
if (faultColors)
{
RiuMainWindow::instance()->uiPdmModel()->updateUiSubTree(faultColors);
}
else
{
RiuMainWindow::instance()->uiPdmModel()->updateUiSubTree(this);
}
}
if (m_reservoirView) m_reservoirView->createDisplayModelAndRedraw();

View File

@@ -47,20 +47,7 @@ RimEclipseFaultColors::RimEclipseFaultColors()
CAF_PDM_InitFieldNoDefault(&m_customFaultResultColors, "CustomResultSlot", "Custom Fault Result", ":/CellResult.png", "", "");
m_customFaultResultColors = new RimEclipseCellColors();
// MODTODO how to handle this?
//m_customFaultResultColors.setOwnerObject(this);
m_customFaultResultColors.uiCapability()->setUiHidden(true);
m_customFaultResultColors()->setUiHidden(true);
// MODTODO how to handle this?
/*
// Take ownership of the fields in RimResultDefinition to be able to trap fieldChangedByUi in this class
m_customFaultResultColors->m_resultTypeUiField.setOwnerObject(this);
m_customFaultResultColors->m_porosityModelUiField.setOwnerObject(this);
m_customFaultResultColors->m_resultVariableUiField.setOwnerObject(this);
*/
updateFieldVisibility();
}
@@ -88,13 +75,6 @@ void RimEclipseFaultColors::fieldChangedByUi(const caf::PdmFieldHandle* changedF
{
this->updateUiIconFromToggleField();
m_customFaultResultColors->fieldChangedByUi(changedField, oldValue, newValue);
if (changedField == &m_customFaultResultColors->m_resultVariableUiField)
{
RiuMainWindow::instance()->uiPdmModel()->updateUiSubTree(this);
}
if (m_reservoirView) m_reservoirView->scheduleCreateDisplayModelAndRedraw();
}

View File

@@ -62,18 +62,6 @@ RimEclipsePropertyFilter::RimEclipsePropertyFilter()
CAF_PDM_InitFieldNoDefault(&resultDefinition, "ResultDefinition", "Result definition", "", "", "");
resultDefinition = new RimEclipseResultDefinition();
// MODOTODO
// How to handle this???
/*
// Take ownership of the fields in RimResultDefinition to be able to trap fieldChangedByUi in this class
resultDefinition->m_resultTypeUiField.setparOwnerObject(this);
resultDefinition->m_resultTypeUiField.uiCapability()->setUiName("");
resultDefinition->m_porosityModelUiField.setOwnerObject(this);
resultDefinition->m_porosityModelUiField.uiCapability()->setUiName("");
resultDefinition->m_resultVariableUiField.setOwnerObject(this);
resultDefinition->m_resultVariableUiField.uiCapability()->setUiName("");
*/
// Set to hidden to avoid this item to been displayed as a child item
// Fields in this object are displayed using defineUiOrdering()
resultDefinition.uiCapability()->setUiHidden(true);
@@ -107,20 +95,6 @@ void RimEclipsePropertyFilter::fieldChangedByUi(const caf::PdmFieldHandle* chang
{
}
if ( &(resultDefinition->m_resultTypeUiField) == changedField
|| &(resultDefinition->m_porosityModelUiField) == changedField)
{
resultDefinition->fieldChangedByUi(changedField, oldValue, newValue);
}
if ( &(resultDefinition->m_resultVariableUiField) == changedField )
{
resultDefinition->fieldChangedByUi(changedField, oldValue, newValue);
setToDefaultValues();
m_parentContainer->fieldChangedByUi(changedField, oldValue, newValue);
updateFilterName();
}
if ( &lowerBound == changedField
|| &upperBound == changedField
|| &obsoleteField_evaluationRegion == changedField

View File

@@ -27,6 +27,8 @@
#include "RimEclipseView.h"
#include "cafPdmUiListEditor.h"
#include "RimEclipsePropertyFilter.h"
#include "RimEclipseFaultColors.h"
CAF_PDM_SOURCE_INIT(RimEclipseResultDefinition, "ResultDefinition");
@@ -117,6 +119,7 @@ void RimEclipseResultDefinition::fieldChangedByUi(const caf::PdmFieldHandle* cha
{
m_resultVariableUiField = "";
}
}
if (&m_resultVariableUiField == changedField)
@@ -126,6 +129,28 @@ void RimEclipseResultDefinition::fieldChangedByUi(const caf::PdmFieldHandle* cha
m_resultVariable = m_resultVariableUiField;
loadResult();
RimEclipsePropertyFilter* propFilter = dynamic_cast<RimEclipsePropertyFilter*>(this->parentField()->ownerObject());
if (propFilter)
{
propFilter->setToDefaultValues();
propFilter->updateFilterName();
m_reservoirView->scheduleGeometryRegen(PROPERTY_FILTERED);
m_reservoirView->scheduleCreateDisplayModelAndRedraw();
}
}
RimEclipsePropertyFilter* propFilter = dynamic_cast<RimEclipsePropertyFilter*>(this->parentField()->ownerObject());
if (propFilter)
{
propFilter->updateConnectedEditors();
}
RimEclipseFaultColors* faultColors = dynamic_cast<RimEclipseFaultColors*>(this->parentField()->ownerObject());
if (faultColors)
{
faultColors->updateConnectedEditors();
}
}

View File

@@ -78,7 +78,8 @@ protected:
caf::PdmField< caf::AppEnum< RimDefines::PorosityModelType > > m_porosityModelUiField;
caf::PdmField<QString> m_resultVariableUiField;
caf::PdmPointer<RimEclipseView> m_reservoirView;
caf::PdmPointer<RimEclipseView> m_reservoirView;
protected:
void updateFieldVisibility();