Bubble Plot : Avoid zero value labels

This commit is contained in:
Magne Sjaastad 2020-02-05 07:21:41 +01:00
parent 228b651789
commit 8a3a1edafc

View File

@ -193,6 +193,7 @@ void RivWellDiskPartMgr::buildWellDiskParts( size_t frameIndex, const caf::Displ
int numberPrecision = 2; int numberPrecision = 2;
double accumulatedPropertyValue = 0.0; double accumulatedPropertyValue = 0.0;
const double valueThresholdForLabel = 1e-6;
QString labelText = m_rimWell->name(); QString labelText = m_rimWell->name();
RigWellDiskData diskData = m_rimWell->wellDiskData(); RigWellDiskData diskData = m_rimWell->wellDiskData();
@ -210,6 +211,8 @@ void RivWellDiskPartMgr::buildWellDiskParts( size_t frameIndex, const caf::Displ
if ( simWellInViewCollection()->showWellDiskQuantityLables() ) if ( simWellInViewCollection()->showWellDiskQuantityLables() )
{ {
const double singleProperty = diskData.singlePropertyValue(); const double singleProperty = diskData.singlePropertyValue();
if ( singleProperty > valueThresholdForLabel )
labelText += QString( "\n%2" ).arg( singleProperty, 0, 'g', numberPrecision ); labelText += QString( "\n%2" ).arg( singleProperty, 0, 'g', numberPrecision );
} }
} }
@ -226,17 +229,18 @@ void RivWellDiskPartMgr::buildWellDiskParts( size_t frameIndex, const caf::Displ
accumulatedPropertyValue = total; accumulatedPropertyValue = total;
const double threshold = 1e-6; if ( total > valueThresholdForLabel )
if ( total > threshold )
{ {
double aggregatedFraction = 0.0; double aggregatedFraction = 0.0;
if ( oilFraction > valueThresholdForLabel )
{ {
auto p = createTextAndLocation( oilFraction / 2.0, diskPosition, ijScaleFactor, oil, numberPrecision ); auto p = createTextAndLocation( oilFraction / 2.0, diskPosition, ijScaleFactor, oil, numberPrecision );
labelsWithPosition.push_back( p ); labelsWithPosition.push_back( p );
aggregatedFraction += oilFraction; aggregatedFraction += oilFraction;
} }
if ( gasFraction > valueThresholdForLabel )
{ {
auto p = createTextAndLocation( aggregatedFraction + gasFraction / 2.0, auto p = createTextAndLocation( aggregatedFraction + gasFraction / 2.0,
diskPosition, diskPosition,
@ -247,6 +251,7 @@ void RivWellDiskPartMgr::buildWellDiskParts( size_t frameIndex, const caf::Displ
aggregatedFraction += gasFraction; aggregatedFraction += gasFraction;
} }
if ( waterFraction > valueThresholdForLabel )
{ {
auto p = createTextAndLocation( aggregatedFraction + waterFraction / 2.0, auto p = createTextAndLocation( aggregatedFraction + waterFraction / 2.0,
diskPosition, diskPosition,
@ -288,8 +293,7 @@ void RivWellDiskPartMgr::buildWellDiskParts( size_t frameIndex, const caf::Displ
} }
geo1->setColorArray( colorArray.p() ); geo1->setColorArray( colorArray.p() );
double threshold = 0.1; if ( accumulatedPropertyValue > valueThresholdForLabel )
if ( accumulatedPropertyValue > threshold )
{ {
{ {
cvf::ref<cvf::Part> part = new cvf::Part; cvf::ref<cvf::Part> part = new cvf::Part;