#5019 Separate intersection legends in place in ordinary views

Needs some cleanup and not working in 2dintersection views
This commit is contained in:
Jacob Støren
2019-11-22 12:36:39 +01:00
parent f3b458dfbc
commit b5e39519c5
11 changed files with 552 additions and 393 deletions

View File

@@ -55,10 +55,14 @@
#include "RimFlowDiagSolution.h"
#include "RimFracture.h"
#include "RimFractureTemplateCollection.h"
#include "RimGeoMechResultDefinition.h"
#include "RimGridCollection.h"
#include "RimGridCrossPlotDataSet.h"
#include "RimGridView.h"
#include "RimIntersection.h"
#include "RimIntersectionCollection.h"
#include "RimIntersectionResultDefinition.h"
#include "RimIntersectionResultsDefinitionCollection.h"
#include "RimOilField.h"
#include "RimProject.h"
#include "RimRegularLegendConfig.h"
@@ -101,9 +105,6 @@
#include <QMessageBox>
#include "RimGridView.h"
#include "RimIntersectionResultDefinition.h"
#include "RimIntersectionResultsDefinitionCollection.h"
#include <climits>
CAF_PDM_SOURCE_INIT( RimEclipseView, "ReservoirView" );
@@ -1203,11 +1204,48 @@ void RimEclipseView::onUpdateLegends()
RigCaseCellResultsData* results = eclipseCase->results( cellResult()->porosityModel() );
CVF_ASSERT( results );
updateMinMaxValuesAndAddLegendToView( QString( "Cell Results: \n" ), this->cellResult(), results );
updateLegendTextAndRanges( this->cellResult()->legendConfig(),
this->cellResult()->ternaryLegendConfig(),
QString( "Cell Results: \n" ),
this->cellResult(),
m_currentTimeStep );
if ( this->faultResultSettings()->showCustomFaultResult() && this->faultResultSettings()->hasValidCustomResult() )
{
updateMinMaxValuesAndAddLegendToView( QString( "Fault Results: \n" ), this->currentFaultResultColors(), results );
updateLegendTextAndRanges( currentFaultResultColors()->legendConfig(),
currentFaultResultColors()->ternaryLegendConfig(),
QString( "Fault Results: \n" ),
this->currentFaultResultColors(),
m_currentTimeStep );
}
for ( RimIntersectionResultDefinition* sepInterResDef :
this->separateIntersectionResultsCollection()->intersectionResultsDefinitions() )
{
if ( !sepInterResDef->isInAction() ) continue;
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() )
@@ -1216,7 +1254,7 @@ void RimEclipseView::onUpdateLegends()
{
if ( this->cellEdgeResult()->isUsingSingleVariable() )
{
this->cellEdgeResult()->singleVarEdgeResultColors()->updateLegendData( m_eclipseCase, m_currentTimeStep );
this->cellEdgeResult()->singleVarEdgeResultColors()->updateRangesForEmbeddedLegends( m_currentTimeStep );
}
else
{
@@ -1303,43 +1341,30 @@ void RimEclipseView::onUpdateLegends()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimEclipseView::updateMinMaxValuesAndAddLegendToView( QString legendLabel,
RimEclipseCellColors* resultColors,
RigCaseCellResultsData* cellResultsData )
void RimEclipseView::updateLegendTextAndRanges( RimRegularLegendConfig* legendConfig,
RimTernaryLegendConfig* ternaryLegendConfig,
QString legendHeading,
RimEclipseResultDefinition* eclResultDef,
int timeStepIndex )
{
resultColors->updateLegendData( m_eclipseCase, m_currentTimeStep );
eclResultDef->updateRangesForExplicitLegends( legendConfig, ternaryLegendConfig, timeStepIndex );
if ( resultColors->hasResult() && resultColors->legendConfig()->showLegend() )
if ( eclResultDef->hasResult() && legendConfig->showLegend() )
{
QString title = legendLabel + resultColors->resultVariableUiName();
if ( !resultColors->diffResultUiShortName().isEmpty() )
{
title += QString( "\n%1" ).arg( resultColors->diffResultUiShortName() );
}
eclResultDef->updateLegendTitle( legendConfig, legendHeading );
if ( resultColors->hasDualPorFractureResult() )
{
QString porosityModelText = caf::AppEnum<RiaDefines::PorosityModelType>::uiText(
resultColors->porosityModel() );
title += QString( "\nDual Por : %1" ).arg( porosityModelText );
}
resultColors->legendConfig()->setTitle( title );
nativeOrOverrideViewer()->addColorLegendToBottomLeftCorner( resultColors->legendConfig()->titledOverlayFrame(),
nativeOrOverrideViewer()->addColorLegendToBottomLeftCorner( legendConfig->titledOverlayFrame(),
isUsingOverrideViewer() );
}
size_t maxTimeStepCount = cellResultsData->maxTimeStepCount();
if ( resultColors->isTernarySaturationSelected() && maxTimeStepCount > 1 )
size_t maxTimeStepCount = eclResultDef->currentGridCellResults()->maxTimeStepCount();
if ( eclResultDef->isTernarySaturationSelected() && maxTimeStepCount > 1 )
{
if ( resultColors->ternaryLegendConfig()->showLegend() &&
resultColors->ternaryLegendConfig()->titledOverlayFrame() )
if ( ternaryLegendConfig->showLegend() && ternaryLegendConfig->titledOverlayFrame() )
{
resultColors->ternaryLegendConfig()->setTitle( legendLabel );
nativeOrOverrideViewer()
->addColorLegendToBottomLeftCorner( resultColors->ternaryLegendConfig()->titledOverlayFrame(),
isUsingOverrideViewer() );
ternaryLegendConfig->setTitle( legendHeading );
nativeOrOverrideViewer()->addColorLegendToBottomLeftCorner( ternaryLegendConfig->titledOverlayFrame(),
isUsingOverrideViewer() );
}
}
}
@@ -2007,6 +2032,13 @@ std::vector<RimLegendConfig*> RimEclipseView::legendConfigs() const
absLegends.push_back( fractureColors()->activeLegend() );
absLegends.push_back( virtualPerforationResult()->legendConfig() );
for ( RimIntersectionResultDefinition* sepInterResDef :
this->separateIntersectionResultsCollection()->intersectionResultsDefinitions() )
{
absLegends.push_back( sepInterResDef->regularLegendConfig() );
absLegends.push_back( sepInterResDef->ternaryLegendConfig() );
}
return absLegends;
}