mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#12157 Always show vector name when underscore is present
This commit is contained in:
@@ -18,6 +18,8 @@
|
||||
|
||||
#include "RimPlotAxisTools.h"
|
||||
|
||||
#include "RifEclipseSummaryAddress.h"
|
||||
|
||||
#include "RimPlotAxisLogRangeCalculator.h"
|
||||
#include "RimPlotAxisProperties.h"
|
||||
#include "RimPlotCurve.h"
|
||||
@@ -225,4 +227,40 @@ QString scaleFactorText( const RimPlotAxisProperties* const axisProperties )
|
||||
return {};
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString axisTextForAddress( RifEclipseSummaryAddress address )
|
||||
{
|
||||
if ( address.isCalculated() )
|
||||
{
|
||||
auto shortName = shortCalculationName( address.uiText() );
|
||||
return QString::fromStdString( shortName );
|
||||
}
|
||||
|
||||
auto candidate = QString::fromStdString( address.uiText() );
|
||||
|
||||
// Strip text starting with _ to avoid duplicate axis names
|
||||
auto index = candidate.indexOf( "_" );
|
||||
if ( index != -1 ) candidate = candidate.left( index );
|
||||
|
||||
return candidate;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::string shortCalculationName( const std::string& calculationName )
|
||||
{
|
||||
QString calculationShortName = QString::fromStdString( calculationName );
|
||||
|
||||
int indexOfFirstSpace = calculationShortName.indexOf( ' ' );
|
||||
if ( indexOfFirstSpace > -1 && indexOfFirstSpace < calculationShortName.size() )
|
||||
{
|
||||
calculationShortName = calculationShortName.left( indexOfFirstSpace );
|
||||
}
|
||||
|
||||
return calculationShortName.toStdString();
|
||||
}
|
||||
|
||||
} // namespace RimPlotAxisTools
|
||||
|
||||
@@ -22,6 +22,7 @@ class RimPlotAxisProperties;
|
||||
class RimPlotCurve;
|
||||
class RiuPlotAxis;
|
||||
class RiuPlotWidget;
|
||||
class RifEclipseSummaryAddress;
|
||||
|
||||
#include <QString>
|
||||
#include <vector>
|
||||
@@ -36,7 +37,9 @@ void updatePlotWidgetFromAxisProperties( RiuPlotWidget*
|
||||
const QString& axisTitle,
|
||||
const std::vector<const RimPlotCurve*>& plotCurves );
|
||||
|
||||
void applyAxisScaleDraw( RiuPlotWidget* plotWidget, RiuPlotAxis axis, const RimPlotAxisProperties* const axisProperties );
|
||||
QString scaleFactorText( const RimPlotAxisProperties* const axisProperties );
|
||||
void applyAxisScaleDraw( RiuPlotWidget* plotWidget, RiuPlotAxis axis, const RimPlotAxisProperties* const axisProperties );
|
||||
QString scaleFactorText( const RimPlotAxisProperties* const axisProperties );
|
||||
QString axisTextForAddress( RifEclipseSummaryAddress address );
|
||||
std::string shortCalculationName( const std::string& calculationName );
|
||||
|
||||
}; // namespace RimPlotAxisTools
|
||||
|
||||
Reference in New Issue
Block a user