mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#4909 Summary Legend Text : Improve text for statistics curves
This commit is contained in:
parent
2d2ce4a71e
commit
05d2645a0a
@ -63,60 +63,33 @@ RimSummaryCurveAutoName::RimSummaryCurveAutoName()
|
|||||||
QString RimSummaryCurveAutoName::curveNameY( const RifEclipseSummaryAddress& summaryAddress,
|
QString RimSummaryCurveAutoName::curveNameY( const RifEclipseSummaryAddress& summaryAddress,
|
||||||
const RimSummaryPlotNameHelper* nameHelper ) const
|
const RimSummaryPlotNameHelper* nameHelper ) const
|
||||||
{
|
{
|
||||||
std::string text;
|
|
||||||
|
|
||||||
RimSummaryCurve* summaryCurve = nullptr;
|
RimSummaryCurve* summaryCurve = nullptr;
|
||||||
this->firstAncestorOrThisOfType( summaryCurve );
|
this->firstAncestorOrThisOfType( summaryCurve );
|
||||||
|
|
||||||
if ( m_vectorName )
|
std::string unitNameY;
|
||||||
|
if ( summaryCurve )
|
||||||
{
|
{
|
||||||
bool skipSubString = nameHelper && nameHelper->isPlotDisplayingSingleQuantity();
|
unitNameY = summaryCurve->unitNameY();
|
||||||
if ( !skipSubString )
|
|
||||||
{
|
|
||||||
text += summaryAddress.quantityName();
|
|
||||||
|
|
||||||
if ( summaryAddress.category() == RifEclipseSummaryAddress::SUMMARY_ENSEMBLE_STATISTICS )
|
|
||||||
{
|
|
||||||
text = RiaStatisticsTools::replacePercentileByPValueText( QString::fromStdString( text ) ).toStdString();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( m_unit && summaryCurve && !summaryCurve->unitNameY().empty() )
|
std::string caseNameY;
|
||||||
|
if ( caseNameY.empty() && summaryCurve && summaryCurve->summaryCaseY() )
|
||||||
{
|
{
|
||||||
text += "[" + summaryCurve->unitNameY() + "]";
|
caseNameY = summaryCurve->summaryCaseY()->caseName().toStdString();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
appendAddressDetails( text, summaryAddress, nameHelper );
|
|
||||||
|
|
||||||
QString caseName;
|
|
||||||
|
|
||||||
{
|
{
|
||||||
RimEnsembleCurveSet* ensembleCurveSet = nullptr;
|
RimEnsembleCurveSet* ensembleCurveSet = nullptr;
|
||||||
this->firstAncestorOrThisOfType( ensembleCurveSet );
|
this->firstAncestorOrThisOfType( ensembleCurveSet );
|
||||||
if ( ensembleCurveSet && ensembleCurveSet->summaryCaseCollection() )
|
if ( ensembleCurveSet && ensembleCurveSet->summaryCaseCollection() )
|
||||||
{
|
{
|
||||||
caseName = ensembleCurveSet->summaryCaseCollection()->name();
|
caseNameY = ensembleCurveSet->summaryCaseCollection()->name().toStdString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( caseName.isEmpty() && summaryCurve && summaryCurve->summaryCaseY() )
|
QString curveName = buildCurveName( summaryAddress, nameHelper, unitNameY, caseNameY );
|
||||||
{
|
|
||||||
caseName = summaryCurve->summaryCaseY()->caseName();
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( !caseName.isEmpty() )
|
return curveName;
|
||||||
{
|
|
||||||
bool skipSubString = nameHelper && nameHelper->isCaseInTitle();
|
|
||||||
|
|
||||||
if ( m_caseName && !skipSubString )
|
|
||||||
{
|
|
||||||
if ( !text.empty() ) text += ", ";
|
|
||||||
text += caseName.toStdString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return QString::fromStdString( text );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -125,41 +98,33 @@ QString RimSummaryCurveAutoName::curveNameY( const RifEclipseSummaryAddress& sum
|
|||||||
QString RimSummaryCurveAutoName::curveNameX( const RifEclipseSummaryAddress& summaryAddress,
|
QString RimSummaryCurveAutoName::curveNameX( const RifEclipseSummaryAddress& summaryAddress,
|
||||||
const RimSummaryPlotNameHelper* nameHelper ) const
|
const RimSummaryPlotNameHelper* nameHelper ) const
|
||||||
{
|
{
|
||||||
std::string text;
|
|
||||||
|
|
||||||
RimSummaryCurve* summaryCurve = nullptr;
|
RimSummaryCurve* summaryCurve = nullptr;
|
||||||
this->firstAncestorOrThisOfType( summaryCurve );
|
this->firstAncestorOrThisOfType( summaryCurve );
|
||||||
|
|
||||||
if ( m_vectorName )
|
std::string unitNameX;
|
||||||
|
if ( summaryCurve )
|
||||||
{
|
{
|
||||||
bool skipSubString = nameHelper && nameHelper->isPlotDisplayingSingleQuantity();
|
unitNameX = summaryCurve->unitNameX();
|
||||||
if ( !skipSubString )
|
|
||||||
{
|
|
||||||
text += summaryAddress.quantityName();
|
|
||||||
|
|
||||||
if ( m_unit && summaryCurve && !summaryCurve->unitNameX().empty() )
|
|
||||||
{
|
|
||||||
text += "[" + summaryCurve->unitNameX() + "]";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
appendAddressDetails( text, summaryAddress, nameHelper );
|
std::string caseNameX;
|
||||||
|
if ( caseNameX.empty() && summaryCurve && summaryCurve->summaryCaseX() )
|
||||||
if ( summaryCurve && summaryCurve->summaryCaseX() )
|
|
||||||
{
|
{
|
||||||
bool skipSubString = nameHelper && nameHelper->isCaseInTitle();
|
caseNameX = summaryCurve->summaryCaseX()->caseName().toStdString();
|
||||||
|
}
|
||||||
|
|
||||||
if ( m_caseName && !skipSubString )
|
|
||||||
{
|
{
|
||||||
QString caseName = summaryCurve->summaryCaseX()->caseName();
|
RimEnsembleCurveSet* ensembleCurveSet = nullptr;
|
||||||
|
this->firstAncestorOrThisOfType( ensembleCurveSet );
|
||||||
if ( !text.empty() ) text += ", ";
|
if ( ensembleCurveSet && ensembleCurveSet->summaryCaseCollection() )
|
||||||
text += caseName.toStdString();
|
{
|
||||||
|
caseNameX = ensembleCurveSet->summaryCaseCollection()->name().toStdString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return QString::fromStdString( text );
|
QString curveName = buildCurveName( summaryAddress, nameHelper, unitNameX, caseNameX );
|
||||||
|
|
||||||
|
return curveName;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -208,6 +173,53 @@ void RimSummaryCurveAutoName::appendLgrName( std::string& text, const RifEclipse
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
QString RimSummaryCurveAutoName::buildCurveName( const RifEclipseSummaryAddress& summaryAddress,
|
||||||
|
const RimSummaryPlotNameHelper* nameHelper,
|
||||||
|
const std::string& unitText,
|
||||||
|
const std::string& caseName ) const
|
||||||
|
{
|
||||||
|
std::string text; // Using std::string locally to avoid a lot of conversion when building the curve name
|
||||||
|
|
||||||
|
if ( m_vectorName )
|
||||||
|
{
|
||||||
|
bool skipSubString = nameHelper && nameHelper->isPlotDisplayingSingleQuantity();
|
||||||
|
if ( !skipSubString )
|
||||||
|
{
|
||||||
|
text = summaryAddress.quantityName();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( summaryAddress.category() == RifEclipseSummaryAddress::SUMMARY_ENSEMBLE_STATISTICS )
|
||||||
|
{
|
||||||
|
text = RiaStatisticsTools::replacePercentileByPValueText(
|
||||||
|
QString::fromStdString( summaryAddress.quantityName() ) )
|
||||||
|
.toStdString();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( m_unit && !unitText.empty() )
|
||||||
|
{
|
||||||
|
text += "[" + unitText + "]";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
appendAddressDetails( text, summaryAddress, nameHelper );
|
||||||
|
|
||||||
|
if ( !caseName.empty() )
|
||||||
|
{
|
||||||
|
bool skipSubString = nameHelper && nameHelper->isCaseInTitle();
|
||||||
|
|
||||||
|
if ( m_caseName && !skipSubString )
|
||||||
|
{
|
||||||
|
if ( !text.empty() ) text += ", ";
|
||||||
|
text += caseName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return QString::fromStdString( text );
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -52,6 +52,11 @@ private:
|
|||||||
const RimSummaryPlotNameHelper* nameHelper ) const;
|
const RimSummaryPlotNameHelper* nameHelper ) const;
|
||||||
void appendLgrName( std::string& text, const RifEclipseSummaryAddress& summaryAddress ) const;
|
void appendLgrName( std::string& text, const RifEclipseSummaryAddress& summaryAddress ) const;
|
||||||
|
|
||||||
|
QString buildCurveName( const RifEclipseSummaryAddress& summaryAddress,
|
||||||
|
const RimSummaryPlotNameHelper* nameHelper,
|
||||||
|
const std::string& unitText,
|
||||||
|
const std::string& caseName ) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
caf::PdmField<bool> m_vectorName;
|
caf::PdmField<bool> m_vectorName;
|
||||||
caf::PdmField<bool> m_unit;
|
caf::PdmField<bool> m_unit;
|
||||||
|
Loading…
Reference in New Issue
Block a user