Add sample count to grid property statistics

This commit is contained in:
Magne Sjaastad 2022-08-19 08:05:59 +02:00
parent 0b74be6c5e
commit 07f0362298
4 changed files with 25 additions and 2 deletions

View File

@ -32,7 +32,8 @@ CAF_CMD_SOURCE_INIT( RicRenameCaseFeature, "RicRenameCaseFeature" );
//--------------------------------------------------------------------------------------------------
bool RicRenameCaseFeature::isCommandEnabled()
{
return true;
auto rimCase = caf::SelectionManager::instance()->selectedItemOfType<RimCase>();
return ( rimCase != nullptr );
}
//--------------------------------------------------------------------------------------------------

View File

@ -32,7 +32,8 @@ CAF_CMD_SOURCE_INIT( RicRenameSummaryCaseFeature, "RicRenameSummaryCaseFeature"
//--------------------------------------------------------------------------------------------------
bool RicRenameSummaryCaseFeature::isCommandEnabled()
{
return true;
auto summaryCase = caf::SelectionManager::instance()->selectedItemOfType<RimSummaryCase>();
return ( summaryCase != nullptr );
}
//--------------------------------------------------------------------------------------------------

View File

@ -211,6 +211,19 @@ QString Rim3dOverlayInfoConfig::resultInfoText( const RigHistogramData& histData
return "";
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString Rim3dOverlayInfoConfig::sampleCountText( const std::vector<size_t>& histogram )
{
size_t sampleCount = std::accumulate( histogram.begin(), histogram.end(), size_t( 0 ) );
QLocale localeWithSpaceAsGroupSeparator( caf::norwegianLocale() );
QString text = localeWithSpaceAsGroupSeparator.toString( (qulonglong)sampleCount );
return QString( "<br><b>Sample Count:</b> %1" ).arg( text );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -418,6 +431,9 @@ QString Rim3dOverlayInfoConfig::resultInfoText( const RigHistogramData& histData
if ( histData.isMinMaxValid() )
{
infoText += QString( "<br><b>Statistics:</b> Current Time Step and Visible Cells" );
infoText += sampleCountText( histData.histogram );
infoText += QString( "<table border=0 cellspacing=5 >"
"<tr> <td>Min</td> <td>Mean</td> <td>Max</td> </tr>"
"<tr> <td>%1</td> <td> %2</td> <td> %3</td> </tr>"
@ -473,6 +489,9 @@ QString Rim3dOverlayInfoConfig::resultInfoText( const RigHistogramData& histData
{
infoText += QString( "<br><b>Statistics:</b> " ) + timeRangeText + " and " +
m_statisticsCellRange().uiText();
infoText += sampleCountText( histData.histogram );
infoText +=
QString( "<table border=0 cellspacing=5 >"
"<tr> <td>Min</td> <td>P90</td> <td>Mean</td> <td>P10</td> <td>Max</td> <td>Sum</td> </tr>"

View File

@ -90,6 +90,8 @@ private:
QString resultInfoText( const RigHistogramData& histData, RimEclipseView* eclipseView, bool showVolumeWeightedMean );
QString resultInfoText( const RigHistogramData& histData, RimGeoMechView* geoMechView );
QString sampleCountText( const std::vector<size_t>& histogram );
void displayPropertyFilteredStatisticsMessage( bool showSwitchToCurrentTimestep );
bool hasInvalidStatisticsCombination();