(#483) Gray out icon for overridden cell results

This commit is contained in:
Magne Sjaastad 2015-09-23 13:48:25 +02:00
parent af75f513f9
commit 4ee8929d91
6 changed files with 99 additions and 18 deletions

View File

@ -20,10 +20,13 @@
#include "RimEclipseCellColors.h" #include "RimEclipseCellColors.h"
#include "RimEclipseFaultColors.h"
#include "RimEclipseView.h" #include "RimEclipseView.h"
#include "RimTernaryLegendConfig.h" #include "RimTernaryLegendConfig.h"
#include "RimViewLink.h"
#include "RimViewLinker.h"
#include "RiuMainWindow.h" #include "RiuMainWindow.h"
#include "RimEclipseFaultColors.h"
CAF_PDM_SOURCE_INIT(RimEclipseCellColors, "ResultSlot"); CAF_PDM_SOURCE_INIT(RimEclipseCellColors, "ResultSlot");
@ -174,6 +177,8 @@ void RimEclipseCellColors::initAfterRead()
} }
changeLegendConfig(this->resultVariable()); changeLegendConfig(this->resultVariable());
updateIconState();
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -219,3 +224,21 @@ RimLegendConfig* RimEclipseCellColors::legendConfig()
return m_legendConfigPtrField; return m_legendConfigPtrField;
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimEclipseCellColors::updateIconState()
{
RimViewLink* viewLink = RimViewLinker::viewLinkForView(m_reservoirView);
if (viewLink && viewLink->syncCellResult())
{
updateUiIconFromState(false);
}
else
{
updateUiIconFromState(true);
}
uiCapability()->updateConnectedEditors();
}

View File

@ -48,6 +48,9 @@ public:
caf::PdmChildField<RimTernaryLegendConfig*> ternaryLegendConfig; caf::PdmChildField<RimTernaryLegendConfig*> ternaryLegendConfig;
virtual void setResultVariable(const QString& resultName); virtual void setResultVariable(const QString& resultName);
void updateIconState();
protected: protected:
// Overridden methods // Overridden methods
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);

View File

@ -18,8 +18,11 @@
///////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////
#include "RimGeoMechCellColors.h" #include "RimGeoMechCellColors.h"
#include "RimLegendConfig.h" #include "RimLegendConfig.h"
#include "RimView.h" #include "RimView.h"
#include "RimViewLink.h"
#include "RimViewLinker.h"
CAF_PDM_SOURCE_INIT(RimGeoMechCellColors, "GeoMechResultSlot"); CAF_PDM_SOURCE_INIT(RimGeoMechCellColors, "GeoMechResultSlot");
@ -41,3 +44,32 @@ RimGeoMechCellColors::RimGeoMechCellColors(void)
RimGeoMechCellColors::~RimGeoMechCellColors(void) RimGeoMechCellColors::~RimGeoMechCellColors(void)
{ {
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGeoMechCellColors::updateIconState()
{
RimView* rimView = NULL;
this->firstAnchestorOrThisOfType(rimView);
RimViewLink* viewLink = RimViewLinker::viewLinkForView(rimView);
if (viewLink && viewLink->syncCellResult())
{
updateUiIconFromState(false);
}
else
{
updateUiIconFromState(true);
}
uiCapability()->updateConnectedEditors();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGeoMechCellColors::initAfterRead()
{
updateIconState();
}

View File

@ -40,4 +40,7 @@ public:
virtual ~RimGeoMechCellColors(void); virtual ~RimGeoMechCellColors(void);
caf::PdmChildField<RimLegendConfig*> legendConfig; caf::PdmChildField<RimLegendConfig*> legendConfig;
void updateIconState();
virtual void initAfterRead();
}; };

View File

@ -21,10 +21,19 @@
#include "RiaApplication.h" #include "RiaApplication.h"
#include "RigCaseData.h"
#include "RigCaseToCaseCellMapper.h"
#include "RigFemPartCollection.h"
#include "RigGeoMechCaseData.h"
#include "RimCase.h" #include "RimCase.h"
#include "RimCellRangeFilterCollection.h" #include "RimCellRangeFilterCollection.h"
#include "RimEclipseCase.h"
#include "RimEclipseCellColors.h"
#include "RimEclipsePropertyFilterCollection.h" #include "RimEclipsePropertyFilterCollection.h"
#include "RimEclipseView.h" #include "RimEclipseView.h"
#include "RimGeoMechCase.h"
#include "RimGeoMechCellColors.h"
#include "RimGeoMechPropertyFilterCollection.h" #include "RimGeoMechPropertyFilterCollection.h"
#include "RimGeoMechView.h" #include "RimGeoMechView.h"
#include "RimProject.h" #include "RimProject.h"
@ -35,13 +44,6 @@
#include "RiuViewer.h" #include "RiuViewer.h"
#include "cafPdmUiTreeOrdering.h" #include "cafPdmUiTreeOrdering.h"
#include "RimEclipseCase.h"
#include "RigCaseData.h"
#include "RimGeoMechCase.h"
#include "RigGeoMechCaseData.h"
#include "RigFemPartCollection.h"
#include "RigCaseToCaseCellMapper.h"
CAF_PDM_SOURCE_INIT(RimViewLink, "RimViewLink"); CAF_PDM_SOURCE_INIT(RimViewLink, "RimViewLink");
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -159,9 +161,23 @@ void RimViewLink::fieldChangedByUi(const caf::PdmFieldHandle* changedField, cons
{ {
doSyncTimeStep(); doSyncTimeStep();
} }
else if (changedField == &syncCellResult && syncCellResult()) else if (changedField == &syncCellResult)
{ {
doSyncCellResult(); if (syncCellResult())
{
doSyncCellResult();
}
else
{
if (managedEclipseView())
{
managedEclipseView()->cellResult()->updateIconState();
}
else if (managedGeoView())
{
managedGeoView()->cellResult()->updateIconState();
}
}
} }
else if (changedField == &syncRangeFilters) else if (changedField == &syncRangeFilters)
{ {

View File

@ -141,17 +141,19 @@ void RimViewLinker::updateCellResult()
if (viewLink->managedView()) if (viewLink->managedView())
{ {
if (viewLink->syncCellResult()) RimView* rimView = viewLink->managedView();
RimEclipseView* eclipeView = dynamic_cast<RimEclipseView*>(rimView);
if (eclipeView)
{ {
RimView* rimView = viewLink->managedView(); if (viewLink->syncCellResult())
RimEclipseView* eclipeView = dynamic_cast<RimEclipseView*>(rimView);
if (eclipeView)
{ {
eclipeView->cellResult()->setPorosityModel(eclipseCellResultDefinition->porosityModel()); eclipeView->cellResult()->setPorosityModel(eclipseCellResultDefinition->porosityModel());
eclipeView->cellResult()->setResultType(eclipseCellResultDefinition->resultType()); eclipeView->cellResult()->setResultType(eclipseCellResultDefinition->resultType());
eclipeView->cellResult()->setResultVariable(eclipseCellResultDefinition->resultVariable()); eclipeView->cellResult()->setResultVariable(eclipseCellResultDefinition->resultVariable());
eclipeView->scheduleCreateDisplayModelAndRedraw(); eclipeView->scheduleCreateDisplayModelAndRedraw();
} }
eclipeView->cellResult()->updateIconState();
} }
} }
} }
@ -169,15 +171,17 @@ void RimViewLinker::updateCellResult()
if (viewLink->managedView()) if (viewLink->managedView())
{ {
if (viewLink->syncCellResult()) RimView* rimView = viewLink->managedView();
RimGeoMechView* geoView = dynamic_cast<RimGeoMechView*>(rimView);
if (geoView)
{ {
RimView* rimView = viewLink->managedView(); if (viewLink->syncCellResult())
RimGeoMechView* geoView = dynamic_cast<RimGeoMechView*>(rimView);
if (geoView)
{ {
geoView->cellResult()->setResultAddress(geoMechResultDefinition->resultAddress()); geoView->cellResult()->setResultAddress(geoMechResultDefinition->resultAddress());
geoView->scheduleCreateDisplayModelAndRedraw(); geoView->scheduleCreateDisplayModelAndRedraw();
} }
geoView->cellResult()->updateIconState();
} }
} }
} }