#6843 Grid Cross Plot : Render discrete colors, not continous

This commit is contained in:
Magne Sjaastad
2020-11-09 12:49:53 +01:00
parent 0258874e17
commit 76fa87625c
2 changed files with 13 additions and 2 deletions

View File

@@ -1890,6 +1890,7 @@ void RimEclipseResultDefinition::updateRangesForExplicitLegends( RimRegularLegen
if ( !eclipseCaseData ) return;
RigCaseCellResultsData* cellResultsData = eclipseCaseData->results( this->porosityModel() );
cellResultsData->ensureKnownResultLoaded( this->eclipseResultAddress() );
double globalMin, globalMax;
double globalPosClosestToZero, globalNegClosestToZero;

View File

@@ -17,6 +17,8 @@
/////////////////////////////////////////////////////////////////////////////////
#include "RiuScalarMapperLegendFrame.h"
#include "cvfScalarMapperDiscreteLinear.h"
#include "cvfScalarMapperDiscreteLog.h"
#include "cvfString.h"
#include "cvfqtUtils.h"
@@ -162,6 +164,14 @@ void RiuScalarMapperLegendFrame::renderRect( QPainter* painter, const LayoutInfo
int rectIndexFromBottom = rectCount() - rectIndex - 1;
cvf::Color3ub startColor = m_scalarMapper->mapToColor( m_tickValues[rectIndexFromBottom] );
cvf::Color3ub endColor = m_scalarMapper->mapToColor( m_tickValues[rectIndexFromBottom + 1] );
if ( dynamic_cast<const cvf::ScalarMapperDiscreteLog*>( m_scalarMapper.p() ) ||
dynamic_cast<const cvf::ScalarMapperDiscreteLinear*>( m_scalarMapper.p() ) )
{
// Do not draw gradient for discrete legends
endColor = startColor;
}
QColor startQColor( startColor.r(), startColor.g(), startColor.b() );
QColor endQColor( endColor.r(), endColor.g(), endColor.b() );