Trigger update of contour maps following legend changes

This commit is contained in:
Gaute Lindkvist
2020-12-04 13:21:19 +01:00
parent a7dd6f893d
commit 02298d81b1
6 changed files with 37 additions and 4 deletions

View File

@@ -47,6 +47,7 @@ CAF_PDM_SOURCE_INIT( RimEclipseCellColors, "ResultSlot" );
///
//--------------------------------------------------------------------------------------------------
RimEclipseCellColors::RimEclipseCellColors()
: legendConfigChanged( this )
{
CAF_PDM_InitScriptableObjectWithNameAndComment( "Cell Result",
":/CellResult.png",
@@ -179,13 +180,25 @@ void RimEclipseCellColors::changeLegendConfig( QString resultVarNameOfNewLegend
newLegend->setColorLegend(
RimRegularLegendConfig::mapToColorLegend( RimRegularLegendConfig::ColorRangesType::CATEGORY ) );
}
m_legendConfigData.push_back( newLegend );
this->m_legendConfigPtrField = newLegend;
}
}
}
for ( auto legendConfig : m_legendConfigData )
{
legendConfig->changed.connect( this, &RimEclipseCellColors::onLegendConfigChanged );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimEclipseCellColors::onLegendConfigChanged( const caf::SignalEmitter* emitter )
{
legendConfigChanged.send();
}
//--------------------------------------------------------------------------------------------------

View File

@@ -38,6 +38,9 @@ class RimEclipseCellColors : public RimEclipseResultDefinition
{
CAF_PDM_HEADER_INIT;
public:
caf::Signal<> legendConfigChanged;
public:
RimEclipseCellColors();
~RimEclipseCellColors() override;
@@ -69,6 +72,7 @@ protected:
private:
void changeLegendConfig( QString resultVarNameOfNewLegend );
void onLegendConfigChanged( const caf::SignalEmitter* emitter );
caf::PdmChildArrayField<RimRegularLegendConfig*> m_legendConfigData;
caf::PdmPtrField<RimRegularLegendConfig*> m_legendConfigPtrField;

View File

@@ -74,6 +74,7 @@ RimEclipseContourMapView::RimEclipseContourMapView()
( (RiuViewerToViewInterface*)this )->setCameraPosition( sm_defaultViewMatrix );
cellResult()->setTernaryEnabled( false );
cellResult()->legendConfigChanged.connect( this, &RimEclipseContourMapView::onLegendConfigChanged );
}
//--------------------------------------------------------------------------------------------------
@@ -378,9 +379,9 @@ void RimEclipseContourMapView::onUpdateLegends()
{
nativeOrOverrideViewer()->removeAllColorLegends();
}
else if ( m_contourMapProjection && m_contourMapProjection->legendConfig() )
else if ( cellResult() && cellResult()->legendConfig() )
{
nativeOrOverrideViewer()->removeColorLegend( m_contourMapProjection->legendConfig()->titledOverlayFrame() );
nativeOrOverrideViewer()->removeColorLegend( cellResult()->legendConfig()->titledOverlayFrame() );
}
if ( m_contourMapProjection && m_contourMapProjection->isChecked() )
@@ -533,3 +534,11 @@ void RimEclipseContourMapView::scheduleGeometryRegen( RivCellSetEnum geometryTyp
m_contourMapProjection->clearGeometry();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimEclipseContourMapView::onLegendConfigChanged( const caf::SignalEmitter* emitter )
{
m_contourMapProjection->clearGeometry();
}

View File

@@ -67,6 +67,8 @@ protected:
bool zoomChangeAboveTreshold( const cvf::Vec3d& currentCameraPosition ) const;
void scheduleGeometryRegen( RivCellSetEnum geometryType ) override;
void onLegendConfigChanged( const caf::SignalEmitter* emitter );
private:
cvf::ref<RivContourMapProjectionPartMgr> m_contourMapProjectionPartMgr;
caf::PdmChildField<RimEclipseContourMapProjection*> m_contourMapProjection;

View File

@@ -141,7 +141,8 @@ void AppEnum<RimRegularLegendConfig::CategoryColorModeType>::setUp()
///
//--------------------------------------------------------------------------------------------------
RimRegularLegendConfig::RimRegularLegendConfig()
: m_globalAutoMax( cvf::UNDEFINED_DOUBLE )
: changed( this )
, m_globalAutoMax( cvf::UNDEFINED_DOUBLE )
, m_globalAutoMin( cvf::UNDEFINED_DOUBLE )
, m_localAutoMax( cvf::UNDEFINED_DOUBLE )
, m_localAutoMin( cvf::UNDEFINED_DOUBLE )
@@ -313,6 +314,7 @@ void RimRegularLegendConfig::fieldChangedByUi( const caf::PdmFieldHandle* change
m_resetUserDefinedValuesButton = false;
}
changed.send();
updateLegend();
RimGridView* view = nullptr;

View File

@@ -61,6 +61,9 @@ class RimRegularLegendConfig : public RimLegendConfig
{
CAF_PDM_HEADER_INIT;
public:
caf::Signal<> changed;
public:
RimRegularLegendConfig();
~RimRegularLegendConfig() override;