#5019 Use same code for separate intersection legend setup in eclipse and geomech

This commit is contained in:
Jacob Støren
2019-11-22 13:31:35 +01:00
parent b5e39519c5
commit 1ab815e673
5 changed files with 73 additions and 86 deletions

View File

@@ -1204,48 +1204,25 @@ void RimEclipseView::onUpdateLegends()
RigCaseCellResultsData* results = eclipseCase->results( cellResult()->porosityModel() ); RigCaseCellResultsData* results = eclipseCase->results( cellResult()->porosityModel() );
CVF_ASSERT( results ); CVF_ASSERT( results );
updateLegendTextAndRanges( this->cellResult()->legendConfig(), updateLegendRangesTextAndVisibility( this->cellResult()->legendConfig(),
this->cellResult()->ternaryLegendConfig(), this->cellResult()->ternaryLegendConfig(),
QString( "Cell Results: \n" ), QString( "Cell Results: \n" ),
this->cellResult(), this->cellResult(),
m_currentTimeStep ); m_currentTimeStep );
if ( this->faultResultSettings()->showCustomFaultResult() && this->faultResultSettings()->hasValidCustomResult() ) if ( this->faultResultSettings()->showCustomFaultResult() && this->faultResultSettings()->hasValidCustomResult() )
{ {
updateLegendTextAndRanges( currentFaultResultColors()->legendConfig(), updateLegendRangesTextAndVisibility( currentFaultResultColors()->legendConfig(),
currentFaultResultColors()->ternaryLegendConfig(), currentFaultResultColors()->ternaryLegendConfig(),
QString( "Fault Results: \n" ), QString( "Fault Results: \n" ),
this->currentFaultResultColors(), this->currentFaultResultColors(),
m_currentTimeStep ); m_currentTimeStep );
} }
for ( RimIntersectionResultDefinition* sepInterResDef : for ( RimIntersectionResultDefinition* sepInterResDef :
this->separateIntersectionResultsCollection()->intersectionResultsDefinitions() ) this->separateIntersectionResultsCollection()->intersectionResultsDefinitions() )
{ {
if ( !sepInterResDef->isInAction() ) continue; sepInterResDef->updateLegendRangesTextAndVisibility( nativeOrOverrideViewer(), isUsingOverrideViewer() );
if ( sepInterResDef->isEclipseResultDefinition() )
{
updateLegendTextAndRanges( sepInterResDef->regularLegendConfig(),
sepInterResDef->ternaryLegendConfig(),
QString( "Intersection Results: \n" ),
sepInterResDef->eclipseResultDefinition(),
sepInterResDef->timeStep() );
}
else
{
sepInterResDef->geoMechResultDefinition()->updateLegendTextAndRanges( sepInterResDef->regularLegendConfig(),
"Intersection Results:\n",
sepInterResDef->timeStep() );
if ( sepInterResDef->geoMechResultDefinition()->hasResult() &&
sepInterResDef->regularLegendConfig()->showLegend() )
{
nativeOrOverrideViewer()
->addColorLegendToBottomLeftCorner( sepInterResDef->regularLegendConfig()->titledOverlayFrame(),
isUsingOverrideViewer() );
}
}
} }
if ( this->cellEdgeResult()->legendConfig()->showLegend() ) if ( this->cellEdgeResult()->legendConfig()->showLegend() )
@@ -1341,11 +1318,11 @@ void RimEclipseView::onUpdateLegends()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimEclipseView::updateLegendTextAndRanges( RimRegularLegendConfig* legendConfig, void RimEclipseView::updateLegendRangesTextAndVisibility( RimRegularLegendConfig* legendConfig,
RimTernaryLegendConfig* ternaryLegendConfig, RimTernaryLegendConfig* ternaryLegendConfig,
QString legendHeading, QString legendHeading,
RimEclipseResultDefinition* eclResultDef, RimEclipseResultDefinition* eclResultDef,
int timeStepIndex ) int timeStepIndex )
{ {
eclResultDef->updateRangesForExplicitLegends( legendConfig, ternaryLegendConfig, timeStepIndex ); eclResultDef->updateRangesForExplicitLegends( legendConfig, ternaryLegendConfig, timeStepIndex );

View File

@@ -179,11 +179,11 @@ private:
void updateStaticCellColors( RivCellSetEnum geometryType ); void updateStaticCellColors( RivCellSetEnum geometryType );
void onUpdateLegends() override; void onUpdateLegends() override;
void updateLegendTextAndRanges( RimRegularLegendConfig* legendConfig, void updateLegendRangesTextAndVisibility( RimRegularLegendConfig* legendConfig,
RimTernaryLegendConfig* ternaryLegendConfig, RimTernaryLegendConfig* ternaryLegendConfig,
QString legendLabel, QString legendLabel,
RimEclipseResultDefinition* eclResDef, RimEclipseResultDefinition* eclResDef,
int timeStepIndex ); int timeStepIndex );
void onResetLegendsInViewer() override; void onResetLegendsInViewer() override;
void updateVirtualConnectionLegendRanges(); void updateVirtualConnectionLegendRanges();

View File

@@ -470,48 +470,7 @@ void RimGeoMechView::onUpdateLegends()
for ( RimIntersectionResultDefinition* sepInterResDef : for ( RimIntersectionResultDefinition* sepInterResDef :
this->separateIntersectionResultsCollection()->intersectionResultsDefinitions() ) this->separateIntersectionResultsCollection()->intersectionResultsDefinitions() )
{ {
if ( !sepInterResDef->isInAction() ) continue; sepInterResDef->updateLegendRangesTextAndVisibility( nativeOrOverrideViewer(), isUsingOverrideViewer() );
if ( sepInterResDef->isEclipseResultDefinition() )
{
RimEclipseResultDefinition* eclResultDef = sepInterResDef->eclipseResultDefinition();
eclResultDef->updateRangesForExplicitLegends( sepInterResDef->regularLegendConfig(),
sepInterResDef->ternaryLegendConfig(),
sepInterResDef->timeStep() );
eclResultDef->updateLegendTitle( sepInterResDef->regularLegendConfig(), "Intersection Results:\n" );
if ( sepInterResDef->regularLegendConfig()->showLegend() && eclResultDef->hasResult() )
{
nativeOrOverrideViewer()
->addColorLegendToBottomLeftCorner( sepInterResDef->regularLegendConfig()->titledOverlayFrame(),
isUsingOverrideViewer() );
}
else if ( eclResultDef->isTernarySaturationSelected() &&
eclResultDef->currentGridCellResults()->maxTimeStepCount() > 1 &&
sepInterResDef->ternaryLegendConfig()->showLegend() &&
sepInterResDef->ternaryLegendConfig()->titledOverlayFrame() )
{
sepInterResDef->ternaryLegendConfig()->setTitle( "Intersection Results: \n" );
nativeOrOverrideViewer()
->addColorLegendToBottomLeftCorner( sepInterResDef->ternaryLegendConfig()->titledOverlayFrame(),
isUsingOverrideViewer() );
}
}
else
{
sepInterResDef->geoMechResultDefinition()->updateLegendTextAndRanges( sepInterResDef->regularLegendConfig(),
"Intersection Results:\n",
sepInterResDef->timeStep() );
if ( sepInterResDef->geoMechResultDefinition()->hasResult() &&
sepInterResDef->regularLegendConfig()->showLegend() )
{
nativeOrOverrideViewer()
->addColorLegendToBottomLeftCorner( sepInterResDef->regularLegendConfig()->titledOverlayFrame(),
isUsingOverrideViewer() );
}
}
} }
if ( tensorResults()->showTensors() ) if ( tensorResults()->showTensors() )

View File

@@ -28,6 +28,9 @@
#include "RimRegularLegendConfig.h" #include "RimRegularLegendConfig.h"
#include "RimTernaryLegendConfig.h" #include "RimTernaryLegendConfig.h"
#include "RimTools.h" #include "RimTools.h"
#include "RiuViewer.h"
#include "cafPdmUiTreeOrdering.h" #include "cafPdmUiTreeOrdering.h"
CAF_PDM_SOURCE_INIT( RimIntersectionResultDefinition, "IntersectionResultDefinition" ); CAF_PDM_SOURCE_INIT( RimIntersectionResultDefinition, "IntersectionResultDefinition" );
@@ -183,6 +186,51 @@ RimGeoMechResultDefinition* RimIntersectionResultDefinition::geoMechResultDefini
return m_geomResultDefinition(); return m_geomResultDefinition();
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimIntersectionResultDefinition::updateLegendRangesTextAndVisibility( RiuViewer* nativeOrOverrideViewer,
bool isUsingOverrideViewer )
{
if ( !this->isInAction() ) return;
if ( this->isEclipseResultDefinition() )
{
RimEclipseResultDefinition* eclResultDef = this->eclipseResultDefinition();
eclResultDef->updateRangesForExplicitLegends( this->regularLegendConfig(),
this->ternaryLegendConfig(),
this->timeStep() );
eclResultDef->updateLegendTitle( this->regularLegendConfig(), "Intersection Results:\n" );
if ( this->regularLegendConfig()->showLegend() && eclResultDef->hasResult() )
{
nativeOrOverrideViewer->addColorLegendToBottomLeftCorner( this->regularLegendConfig()->titledOverlayFrame(),
isUsingOverrideViewer );
}
else if ( eclResultDef->isTernarySaturationSelected() &&
eclResultDef->currentGridCellResults()->maxTimeStepCount() > 1 &&
this->ternaryLegendConfig()->showLegend() && this->ternaryLegendConfig()->titledOverlayFrame() )
{
this->ternaryLegendConfig()->setTitle( "Intersection Results: \n" );
nativeOrOverrideViewer->addColorLegendToBottomLeftCorner( this->ternaryLegendConfig()->titledOverlayFrame(),
isUsingOverrideViewer );
}
}
else
{
this->geoMechResultDefinition()->updateLegendTextAndRanges( this->regularLegendConfig(),
"Intersection Results:\n",
this->timeStep() );
if ( this->geoMechResultDefinition()->hasResult() && this->regularLegendConfig()->showLegend() )
{
nativeOrOverrideViewer->addColorLegendToBottomLeftCorner( this->regularLegendConfig()->titledOverlayFrame(),
isUsingOverrideViewer );
}
}
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@@ -29,6 +29,7 @@ class RimGeoMechResultDefinition;
class RimCase; class RimCase;
class RimRegularLegendConfig; class RimRegularLegendConfig;
class RimTernaryLegendConfig; class RimTernaryLegendConfig;
class RiuViewer;
class RimIntersectionResultDefinition : public caf::PdmObject class RimIntersectionResultDefinition : public caf::PdmObject
{ {
@@ -51,6 +52,8 @@ public:
RimEclipseResultDefinition* eclipseResultDefinition() const; RimEclipseResultDefinition* eclipseResultDefinition() const;
RimGeoMechResultDefinition* geoMechResultDefinition() const; RimGeoMechResultDefinition* geoMechResultDefinition() const;
void updateLegendRangesTextAndVisibility( RiuViewer* nativeOrOverrideViewer, bool isUsingOverrideViewer );
protected: protected:
virtual caf::PdmFieldHandle* userDescriptionField() override; virtual caf::PdmFieldHandle* userDescriptionField() override;
virtual caf::PdmFieldHandle* objectToggleField() override; virtual caf::PdmFieldHandle* objectToggleField() override;