#2298 Fracture. Update fracture colors when changing stim plan legend settings

This commit is contained in:
Bjørn Erik Jensen 2018-01-02 11:21:37 +01:00
parent 79818cecac
commit 70a3df3b3c
3 changed files with 32 additions and 16 deletions

View File

@ -204,6 +204,15 @@ void RimLegendConfig::fieldChangedByUi(const caf::PdmFieldHandle* changedField,
view->updateCurrentTimeStepAndRedraw();
}
// Update stim plan templates if relevant
RimStimPlanColors* stimPlanColors;
firstAncestorOrThisOfType(stimPlanColors);
if (stimPlanColors)
{
stimPlanColors->updateStimPlanTemplates();
}
}
//--------------------------------------------------------------------------------------------------

View File

@ -179,22 +179,7 @@ void RimStimPlanColors::fieldChangedByUi(const caf::PdmFieldHandle* changedField
if (changedField == &m_resultNameAndUnit)
{
//Get all frac templates and re-generate stimplan cells
RimProject* proj;
this->firstAncestorOrThisOfType(proj);
if (proj)
{
std::vector<RimStimPlanFractureTemplate*> stimPlanFracTemplates;
proj->descendantsIncludingThisOfType(stimPlanFracTemplates);
for (RimStimPlanFractureTemplate* stimPlanFracTemplate : stimPlanFracTemplates)
{
stimPlanFracTemplate->updateFractureGrid();
}
proj->createDisplayModelAndRedrawAllViews();
}
updateStimPlanTemplates();
}
}
@ -281,6 +266,26 @@ void RimStimPlanColors::updateLegendData()
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimStimPlanColors::updateStimPlanTemplates() const
{
//Get all frac templates and re-generate stimplan cells
RimProject* proj;
this->firstAncestorOrThisOfType(proj);
if (proj)
{
std::vector<RimStimPlanFractureTemplate*> stimPlanFracTemplates;
proj->descendantsIncludingThisOfType(stimPlanFracTemplates);
for (RimStimPlanFractureTemplate* stimPlanFracTemplate : stimPlanFracTemplates)
{
stimPlanFracTemplate->updateFractureGrid();
}
proj->createDisplayModelAndRedrawAllViews();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -58,6 +58,8 @@ public:
void loadDataAndUpdate();
void updateLegendData();
void updateStimPlanTemplates() const;
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;