mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#559 : Linked Views: Linking legend definitions
This commit is contained in:
parent
2692abe7fe
commit
3fabe5f8b5
@ -26,6 +26,7 @@
|
|||||||
#include "RimEclipseCellColors.h"
|
#include "RimEclipseCellColors.h"
|
||||||
#include "RimEclipseView.h"
|
#include "RimEclipseView.h"
|
||||||
#include "RimGeoMechResultDefinition.h"
|
#include "RimGeoMechResultDefinition.h"
|
||||||
|
#include "RimViewLinker.h"
|
||||||
|
|
||||||
#include "cafCategoryLegend.h"
|
#include "cafCategoryLegend.h"
|
||||||
#include "cafCategoryMapper.h"
|
#include "cafCategoryMapper.h"
|
||||||
@ -182,6 +183,18 @@ void RimLegendConfig::fieldChangedByUi(const caf::PdmFieldHandle* changedField,
|
|||||||
|
|
||||||
updateLegend();
|
updateLegend();
|
||||||
|
|
||||||
|
RimView* view = nullptr;
|
||||||
|
this->firstAncestorOrThisOfType(view);
|
||||||
|
|
||||||
|
if (view)
|
||||||
|
{
|
||||||
|
RimViewLinker* viewLinker = view->assosiatedViewLinker();
|
||||||
|
if (viewLinker)
|
||||||
|
{
|
||||||
|
viewLinker->updateCellResult();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (m_reservoirView) m_reservoirView->updateCurrentTimeStepAndRedraw();
|
if (m_reservoirView) m_reservoirView->updateCurrentTimeStepAndRedraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -758,6 +771,24 @@ cvf::OverlayItem* RimLegendConfig::legend()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimLegendConfig::setUiValuesFromLegendConfig(const RimLegendConfig* otherLegendConfig)
|
||||||
|
{
|
||||||
|
this->m_numLevels = otherLegendConfig->m_numLevels;
|
||||||
|
this->m_precision = otherLegendConfig->m_precision;
|
||||||
|
this->m_tickNumberFormat = otherLegendConfig->m_tickNumberFormat;
|
||||||
|
this->m_rangeMode = otherLegendConfig->m_rangeMode;
|
||||||
|
this->m_userDefinedMaxValue = otherLegendConfig->m_userDefinedMaxValue;
|
||||||
|
this->m_userDefinedMinValue = otherLegendConfig->m_userDefinedMinValue;
|
||||||
|
this->m_colorRangeMode = otherLegendConfig->m_colorRangeMode;
|
||||||
|
this->m_mappingMode = otherLegendConfig->m_mappingMode;
|
||||||
|
|
||||||
|
this->m_userDefinedMinValue = otherLegendConfig->m_userDefinedMinValue;
|
||||||
|
this->m_userDefinedMaxValue = otherLegendConfig->m_userDefinedMaxValue;
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -126,6 +126,8 @@ private:
|
|||||||
cvf::ref<cvf::Color3ubArray> interpolateColorArray(const cvf::Color3ubArray& colorArray, cvf::uint targetColorCount);
|
cvf::ref<cvf::Color3ubArray> interpolateColorArray(const cvf::Color3ubArray& colorArray, cvf::uint targetColorCount);
|
||||||
double roundToNumSignificantDigits(double value, double precision);
|
double roundToNumSignificantDigits(double value, double precision);
|
||||||
|
|
||||||
|
friend class RimViewLinker;
|
||||||
|
void setUiValuesFromLegendConfig(const RimLegendConfig* otherLegendConfig);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
caf::PdmPointer<RimView> m_reservoirView;
|
caf::PdmPointer<RimView> m_reservoirView;
|
||||||
|
@ -19,15 +19,17 @@
|
|||||||
|
|
||||||
#include "RimTernaryLegendConfig.h"
|
#include "RimTernaryLegendConfig.h"
|
||||||
|
|
||||||
#include "cafPdmUiPushButtonEditor.h"
|
|
||||||
#include "cafPdmUiTextEditor.h"
|
|
||||||
|
|
||||||
#include "RiaApplication.h"
|
#include "RiaApplication.h"
|
||||||
|
|
||||||
#include "RimEclipseView.h"
|
#include "RimEclipseView.h"
|
||||||
|
#include "RimViewLinker.h"
|
||||||
|
|
||||||
#include "RivTernarySaturationOverlayItem.h"
|
#include "RivTernarySaturationOverlayItem.h"
|
||||||
#include "RivTernaryScalarMapper.h"
|
#include "RivTernaryScalarMapper.h"
|
||||||
|
|
||||||
|
#include "cafPdmUiPushButtonEditor.h"
|
||||||
|
#include "cafPdmUiTextEditor.h"
|
||||||
|
|
||||||
#include "cvfqtUtils.h"
|
#include "cvfqtUtils.h"
|
||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
@ -152,6 +154,18 @@ void RimTernaryLegendConfig::fieldChangedByUi(const caf::PdmFieldHandle* changed
|
|||||||
updateLabelText();
|
updateLabelText();
|
||||||
updateLegend();
|
updateLegend();
|
||||||
|
|
||||||
|
RimView* view = nullptr;
|
||||||
|
this->firstAncestorOrThisOfType(view);
|
||||||
|
|
||||||
|
if (view)
|
||||||
|
{
|
||||||
|
RimViewLinker* viewLinker = view->assosiatedViewLinker();
|
||||||
|
if (viewLinker)
|
||||||
|
{
|
||||||
|
viewLinker->updateCellResult();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (m_reservoirView) m_reservoirView->updateCurrentTimeStepAndRedraw();
|
if (m_reservoirView) m_reservoirView->updateCurrentTimeStepAndRedraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -231,6 +245,24 @@ void RimTernaryLegendConfig::recreateLegend()
|
|||||||
updateLegend();
|
updateLegend();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimTernaryLegendConfig::setUiValuesFromLegendConfig(const RimTernaryLegendConfig* otherLegendConfig)
|
||||||
|
{
|
||||||
|
this->precision = otherLegendConfig->precision;
|
||||||
|
this->rangeMode = otherLegendConfig->rangeMode;
|
||||||
|
this->userDefinedMaxValueSoil = otherLegendConfig->userDefinedMaxValueSoil;
|
||||||
|
this->userDefinedMinValueSoil = otherLegendConfig->userDefinedMinValueSoil;
|
||||||
|
this->userDefinedMaxValueSgas = otherLegendConfig->userDefinedMaxValueSgas;
|
||||||
|
this->userDefinedMinValueSgas = otherLegendConfig->userDefinedMinValueSgas;
|
||||||
|
this->userDefinedMaxValueSwat = otherLegendConfig->userDefinedMaxValueSwat;
|
||||||
|
this->userDefinedMinValueSwat = otherLegendConfig->userDefinedMinValueSwat;
|
||||||
|
this->applyLocalMinMax = otherLegendConfig->applyLocalMinMax;
|
||||||
|
this->applyGlobalMinMax = otherLegendConfig->applyGlobalMinMax;
|
||||||
|
this->applyFullRangeMinMax = otherLegendConfig->applyFullRangeMinMax;
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
/// Rounding the double value to given number of significant digits
|
/// Rounding the double value to given number of significant digits
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -73,7 +73,7 @@ public:
|
|||||||
void recreateLegend();
|
void recreateLegend();
|
||||||
|
|
||||||
RivTernarySaturationOverlayItem* legend();
|
RivTernarySaturationOverlayItem* legend();
|
||||||
RivTernaryScalarMapper* scalarMapper();
|
RivTernaryScalarMapper* scalarMapper();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
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);
|
||||||
@ -84,7 +84,9 @@ private:
|
|||||||
void updateLegend();
|
void updateLegend();
|
||||||
void updateLabelText();
|
void updateLabelText();
|
||||||
double roundToNumSignificantDigits(double value, double precision);
|
double roundToNumSignificantDigits(double value, double precision);
|
||||||
|
|
||||||
|
friend class RimViewLinker;
|
||||||
|
void setUiValuesFromLegendConfig(const RimTernaryLegendConfig* otherLegendConfig);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
caf::PdmField<int> precision;
|
caf::PdmField<int> precision;
|
||||||
|
@ -66,9 +66,10 @@ RimViewController::RimViewController(void)
|
|||||||
CAF_PDM_InitFieldNoDefault(&m_managedView, "ManagedView", "Linked View", "", "", "");
|
CAF_PDM_InitFieldNoDefault(&m_managedView, "ManagedView", "Linked View", "", "", "");
|
||||||
m_managedView.uiCapability()->setUiTreeChildrenHidden(true);
|
m_managedView.uiCapability()->setUiTreeChildrenHidden(true);
|
||||||
|
|
||||||
CAF_PDM_InitField(&m_syncCamera, "SyncCamera", true, "Camera", "", "", "");
|
CAF_PDM_InitField(&m_syncCamera, "SyncCamera", true, "Camera", "", "", "");
|
||||||
CAF_PDM_InitField(&m_syncTimeStep, "SyncTimeStep", true, "Time Step", "", "", "");
|
CAF_PDM_InitField(&m_syncTimeStep, "SyncTimeStep", true, "Time Step", "", "", "");
|
||||||
CAF_PDM_InitField(&m_syncCellResult, "SyncCellResult", false, "Cell Color Result", "", "", "");
|
CAF_PDM_InitField(&m_syncCellResult, "SyncCellResult", false, "Cell Result", "", "", "");
|
||||||
|
CAF_PDM_InitField(&m_syncLegendDefinitions, "SyncLegendDefinitions", true, " Legend Definition", "", "", "");
|
||||||
|
|
||||||
CAF_PDM_InitField(&m_syncVisibleCells, "SyncVisibleCells", false, "Visible Cells", "", "", "");
|
CAF_PDM_InitField(&m_syncVisibleCells, "SyncVisibleCells", false, "Visible Cells", "", "", "");
|
||||||
/// We do not support this. Consider to remove sometime
|
/// We do not support this. Consider to remove sometime
|
||||||
@ -185,6 +186,10 @@ void RimViewController::fieldChangedByUi(const caf::PdmFieldHandle* changedField
|
|||||||
managedGeoView()->cellResult()->updateIconState();
|
managedGeoView()->cellResult()->updateIconState();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (changedField == &m_syncLegendDefinitions)
|
||||||
|
{
|
||||||
|
updateLegendDefinitions();
|
||||||
|
}
|
||||||
else if (changedField == &m_syncRangeFilters)
|
else if (changedField == &m_syncRangeFilters)
|
||||||
{
|
{
|
||||||
if (!m_syncRangeFilters)
|
if (!m_syncRangeFilters)
|
||||||
@ -365,6 +370,7 @@ void RimViewController::updateOptionSensitivity()
|
|||||||
{
|
{
|
||||||
isMasterAndDependentViewDifferentType = true;
|
isMasterAndDependentViewDifferentType = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (geoMasterView && !managedGeoView())
|
if (geoMasterView && !managedGeoView())
|
||||||
{
|
{
|
||||||
isMasterAndDependentViewDifferentType = true;
|
isMasterAndDependentViewDifferentType = true;
|
||||||
@ -374,10 +380,22 @@ void RimViewController::updateOptionSensitivity()
|
|||||||
{
|
{
|
||||||
this->m_syncCellResult.uiCapability()->setUiReadOnly(true);
|
this->m_syncCellResult.uiCapability()->setUiReadOnly(true);
|
||||||
this->m_syncCellResult = false;
|
this->m_syncCellResult = false;
|
||||||
|
|
||||||
|
this->m_syncLegendDefinitions.uiCapability()->setUiReadOnly(true);
|
||||||
|
this->m_syncLegendDefinitions = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this->m_syncCellResult.uiCapability()->setUiReadOnly(false);
|
this->m_syncCellResult.uiCapability()->setUiReadOnly(false);
|
||||||
|
|
||||||
|
if (this->m_syncCellResult)
|
||||||
|
{
|
||||||
|
this->m_syncLegendDefinitions.uiCapability()->setUiReadOnly(false);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this->m_syncLegendDefinitions.uiCapability()->setUiReadOnly(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isPropertyFilterControlPossible())
|
if (isPropertyFilterControlPossible())
|
||||||
@ -390,7 +408,6 @@ void RimViewController::updateOptionSensitivity()
|
|||||||
this->m_syncPropertyFilters = false;
|
this->m_syncPropertyFilters = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (isRangeFilterControlPossible())
|
if (isRangeFilterControlPossible())
|
||||||
{
|
{
|
||||||
this->m_syncRangeFilters.uiCapability()->setUiReadOnly(false);
|
this->m_syncRangeFilters.uiCapability()->setUiReadOnly(false);
|
||||||
@ -440,6 +457,7 @@ void RimViewController::defineUiOrdering(QString uiConfigName, caf::PdmUiOrderin
|
|||||||
scriptGroup->add(&m_syncCamera);
|
scriptGroup->add(&m_syncCamera);
|
||||||
scriptGroup->add(&m_syncTimeStep);
|
scriptGroup->add(&m_syncTimeStep);
|
||||||
scriptGroup->add(&m_syncCellResult);
|
scriptGroup->add(&m_syncCellResult);
|
||||||
|
scriptGroup->add(&m_syncLegendDefinitions);
|
||||||
|
|
||||||
caf::PdmUiGroup* visibleCells = uiOrdering.addNewGroup("Link Cell Filters");
|
caf::PdmUiGroup* visibleCells = uiOrdering.addNewGroup("Link Cell Filters");
|
||||||
visibleCells->add(&m_syncVisibleCells);
|
visibleCells->add(&m_syncVisibleCells);
|
||||||
@ -498,6 +516,17 @@ void RimViewController::updateResultColorsControl()
|
|||||||
viewLinker->updateCellResult();
|
viewLinker->updateCellResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimViewController::updateLegendDefinitions()
|
||||||
|
{
|
||||||
|
if (!this->isLegendDefinitionsControlled()) return;
|
||||||
|
|
||||||
|
RimViewLinker* viewLinker = ownerViewLinker();
|
||||||
|
viewLinker->updateCellResult();
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -714,6 +743,21 @@ bool RimViewController::isResultColorControlled()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
bool RimViewController::isLegendDefinitionsControlled()
|
||||||
|
{
|
||||||
|
if (ownerViewLinker()->isActive() && this->m_isActive())
|
||||||
|
{
|
||||||
|
return m_syncLegendDefinitions;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -61,6 +61,7 @@ public:
|
|||||||
bool isTimeStepLinked();
|
bool isTimeStepLinked();
|
||||||
|
|
||||||
bool isResultColorControlled();
|
bool isResultColorControlled();
|
||||||
|
bool isLegendDefinitionsControlled();
|
||||||
bool isRangeFiltersControlled();
|
bool isRangeFiltersControlled();
|
||||||
|
|
||||||
bool isVisibleCellsOveridden();
|
bool isVisibleCellsOveridden();
|
||||||
@ -90,6 +91,7 @@ private:
|
|||||||
void updateCameraLink();
|
void updateCameraLink();
|
||||||
void updateTimeStepLink();
|
void updateTimeStepLink();
|
||||||
void updateResultColorsControl();
|
void updateResultColorsControl();
|
||||||
|
void updateLegendDefinitions();
|
||||||
|
|
||||||
bool isMasterAndDepViewDifferentType();
|
bool isMasterAndDepViewDifferentType();
|
||||||
bool isRangeFilterControlPossible();
|
bool isRangeFilterControlPossible();
|
||||||
@ -111,6 +113,7 @@ private:
|
|||||||
|
|
||||||
// Overridden properties
|
// Overridden properties
|
||||||
caf::PdmField<bool> m_syncCellResult;
|
caf::PdmField<bool> m_syncCellResult;
|
||||||
|
caf::PdmField<bool> m_syncLegendDefinitions;
|
||||||
|
|
||||||
caf::PdmField<bool> m_syncRangeFilters;
|
caf::PdmField<bool> m_syncRangeFilters;
|
||||||
caf::PdmField<bool> m_syncVisibleCells;
|
caf::PdmField<bool> m_syncVisibleCells;
|
||||||
|
@ -24,7 +24,6 @@
|
|||||||
#include "RigCaseData.h"
|
#include "RigCaseData.h"
|
||||||
|
|
||||||
#include "RimCase.h"
|
#include "RimCase.h"
|
||||||
|
|
||||||
#include "RimEclipseCellColors.h"
|
#include "RimEclipseCellColors.h"
|
||||||
#include "RimEclipseInputCase.h"
|
#include "RimEclipseInputCase.h"
|
||||||
#include "RimEclipseResultCase.h"
|
#include "RimEclipseResultCase.h"
|
||||||
@ -34,9 +33,11 @@
|
|||||||
#include "RimGeoMechCellColors.h"
|
#include "RimGeoMechCellColors.h"
|
||||||
#include "RimGeoMechResultDefinition.h"
|
#include "RimGeoMechResultDefinition.h"
|
||||||
#include "RimGeoMechView.h"
|
#include "RimGeoMechView.h"
|
||||||
#include "RimViewController.h"
|
#include "RimLegendConfig.h"
|
||||||
#include "RimProject.h"
|
#include "RimProject.h"
|
||||||
|
#include "RimTernaryLegendConfig.h"
|
||||||
#include "RimView.h"
|
#include "RimView.h"
|
||||||
|
#include "RimViewController.h"
|
||||||
#include "RimViewLinkerCollection.h"
|
#include "RimViewLinkerCollection.h"
|
||||||
|
|
||||||
#include "RiuViewer.h"
|
#include "RiuViewer.h"
|
||||||
@ -147,6 +148,16 @@ void RimViewLinker::updateCellResult()
|
|||||||
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());
|
||||||
|
|
||||||
|
if (viewLink->isLegendDefinitionsControlled())
|
||||||
|
{
|
||||||
|
eclipeView->cellResult()->legendConfig()->setUiValuesFromLegendConfig(masterEclipseView->cellResult()->legendConfig());
|
||||||
|
eclipeView->cellResult()->legendConfig()->updateLegend();
|
||||||
|
|
||||||
|
eclipeView->cellResult()->ternaryLegendConfig()->setUiValuesFromLegendConfig(masterEclipseView->cellResult()->ternaryLegendConfig());
|
||||||
|
eclipeView->cellResult()->ternaryLegendConfig()->updateLegend();
|
||||||
|
}
|
||||||
|
|
||||||
eclipeView->scheduleCreateDisplayModelAndRedraw();
|
eclipeView->scheduleCreateDisplayModelAndRedraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -174,6 +185,13 @@ void RimViewLinker::updateCellResult()
|
|||||||
if (viewLink->isResultColorControlled())
|
if (viewLink->isResultColorControlled())
|
||||||
{
|
{
|
||||||
geoView->cellResult()->setResultAddress(geoMechResultDefinition->resultAddress());
|
geoView->cellResult()->setResultAddress(geoMechResultDefinition->resultAddress());
|
||||||
|
|
||||||
|
if (viewLink->isLegendDefinitionsControlled())
|
||||||
|
{
|
||||||
|
geoView->cellResult()->legendConfig()->setUiValuesFromLegendConfig(masterGeoView->cellResult()->legendConfig());
|
||||||
|
geoView->cellResult()->legendConfig()->updateLegend();
|
||||||
|
}
|
||||||
|
|
||||||
geoView->scheduleCreateDisplayModelAndRedraw();
|
geoView->scheduleCreateDisplayModelAndRedraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,6 +66,7 @@ public:
|
|||||||
void updateScaleZ(RimView* sourceView, double scaleZ);
|
void updateScaleZ(RimView* sourceView, double scaleZ);
|
||||||
|
|
||||||
void updateCellResult();
|
void updateCellResult();
|
||||||
|
|
||||||
void updateRangeFilters(RimCellRangeFilter* changedRangeFilter);
|
void updateRangeFilters(RimCellRangeFilter* changedRangeFilter);
|
||||||
void applyRangeFilterCollectionByUserChoice();
|
void applyRangeFilterCollectionByUserChoice();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user