#2283 Cross Plot : Improve curve title and plot title based on x-axis data

This commit is contained in:
Magne Sjaastad 2017-12-21 21:03:23 +01:00
parent 1583923ed1
commit 388d4196f1
4 changed files with 136 additions and 69 deletions

View File

@ -371,18 +371,18 @@ QString RimSummaryCurve::createCurveAutoName()
RimSummaryPlot* plot = nullptr;
firstAncestorOrThisOfTypeAsserted(plot);
QString name = m_curveNameConfig->curveName(m_yValuesCurveVariable->address(), plot->activePlotTitleHelper());
QString curveName = m_curveNameConfig->curveNameY(m_yValuesCurveVariable->address(), plot->activePlotTitleHelper());
if (isCrossPlotCurve())
{
QString xCurveName = m_curveNameConfig->curveName(m_xValuesCurveVariable->address(), plot->activePlotTitleHelper());
QString curveNameX = m_curveNameConfig->curveNameX(m_xValuesCurveVariable->address(), plot->activePlotTitleHelper());
if (!name.isEmpty() || !xCurveName.isEmpty())
if (!curveName.isEmpty() || !curveNameX.isEmpty())
{
name += " | " + xCurveName;
curveName += " | " + curveNameX;
}
}
return name;
return curveName;
}
//--------------------------------------------------------------------------------------------------

View File

@ -56,7 +56,7 @@ RimSummaryCurveAutoName::RimSummaryCurveAutoName()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimSummaryCurveAutoName::curveName(const RifEclipseSummaryAddress& summaryAddress,
QString RimSummaryCurveAutoName::curveNameY(const RifEclipseSummaryAddress& summaryAddress,
const RimSummaryPlotNameHelper* nameHelper) const
{
std::string text;
@ -78,6 +78,120 @@ QString RimSummaryCurveAutoName::curveName(const RifEclipseSummaryAddress& summa
}
}
appendAddressDetails(text, summaryAddress, nameHelper);
if (summaryCurve)
{
bool skipSubString = nameHelper && nameHelper->isCaseInTitle();
if (m_caseName && !skipSubString)
{
if (summaryCurve && summaryCurve->summaryCaseY())
{
if (text.size() > 0) text += ", ";
text += summaryCurve->summaryCaseY()->caseName().toStdString();
}
}
}
return QString::fromStdString(text);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimSummaryCurveAutoName::curveNameX(const RifEclipseSummaryAddress& summaryAddress,
const RimSummaryPlotNameHelper* nameHelper) const
{
std::string text;
RimSummaryCurve* summaryCurve = nullptr;
this->firstAncestorOrThisOfType(summaryCurve);
if (m_vectorName)
{
bool skipSubString = nameHelper && nameHelper->isQuantityInTitle();
if (!skipSubString)
{
text += summaryAddress.quantityName();
if (m_unit && summaryCurve && !summaryCurve->unitNameX().empty())
{
text += "[" + summaryCurve->unitNameX() + "]";
}
}
}
appendAddressDetails(text, summaryAddress, nameHelper);
if (summaryCurve)
{
bool skipSubString = nameHelper && nameHelper->isCaseInTitle();
if (m_caseName && !skipSubString)
{
if (summaryCurve && summaryCurve->summaryCaseX())
{
if (text.size() > 0) text += ", ";
text += summaryCurve->summaryCaseX()->caseName().toStdString();
}
}
}
return QString::fromStdString(text);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimSummaryCurveAutoName::applySettings(const RimSummaryCurveAutoName& other)
{
m_caseName = other.m_caseName;
m_vectorName = other.m_vectorName;
m_unit = other.m_unit;
m_regionNumber = other.m_regionNumber;
m_wellGroupName = other.m_wellGroupName;
m_wellName = other.m_wellName;
m_wellSegmentNumber = other.m_wellSegmentNumber;
m_lgrName = other.m_lgrName;
m_completion = other.m_completion;
m_aquiferNumber = other.m_aquiferNumber;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimSummaryCurveAutoName::appendWellName(std::string& text, const RifEclipseSummaryAddress& summaryAddress,
const RimSummaryPlotNameHelper* nameHelper) const
{
bool skipSubString = nameHelper && nameHelper->isWellNameInTitle();
if (skipSubString) return;
if (m_wellName)
{
if (text.size() > 0) text += ":";
text += summaryAddress.wellName();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimSummaryCurveAutoName::appendLgrName(std::string& text, const RifEclipseSummaryAddress& summaryAddress) const
{
if (m_lgrName)
{
if (text.size() > 0) text += ":";
text += ":" + summaryAddress.lgrName();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimSummaryCurveAutoName::appendAddressDetails(std::string& text, const RifEclipseSummaryAddress& summaryAddress,
const RimSummaryPlotNameHelper* nameHelper) const
{
switch (summaryAddress.category())
{
case RifEclipseSummaryAddress::SUMMARY_AQUIFER:
@ -193,67 +307,6 @@ QString RimSummaryCurveAutoName::curveName(const RifEclipseSummaryAddress& summa
}
break;
}
if (summaryCurve)
{
bool skipSubString = nameHelper && nameHelper->isCaseInTitle();
if (m_caseName && !skipSubString)
{
if (summaryCurve && summaryCurve->summaryCaseY())
{
if (text.size() > 0) text += ", ";
text += summaryCurve->summaryCaseY()->caseName().toStdString();
}
}
}
return QString::fromStdString(text);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimSummaryCurveAutoName::applySettings(const RimSummaryCurveAutoName& other)
{
m_caseName = other.m_caseName;
m_vectorName = other.m_vectorName;
m_unit = other.m_unit;
m_regionNumber = other.m_regionNumber;
m_wellGroupName = other.m_wellGroupName;
m_wellName = other.m_wellName;
m_wellSegmentNumber = other.m_wellSegmentNumber;
m_lgrName = other.m_lgrName;
m_completion = other.m_completion;
m_aquiferNumber = other.m_aquiferNumber;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimSummaryCurveAutoName::appendWellName(std::string& text, const RifEclipseSummaryAddress& summaryAddress,
const RimSummaryPlotNameHelper* nameHelper) const
{
bool skipSubString = nameHelper && nameHelper->isWellNameInTitle();
if (skipSubString) return;
if (m_wellName)
{
if (text.size() > 0) text += ":";
text += summaryAddress.wellName();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimSummaryCurveAutoName::appendLgrName(std::string& text, const RifEclipseSummaryAddress& summaryAddress) const
{
if (m_lgrName)
{
if (text.size() > 0) text += ":";
text += ":" + summaryAddress.lgrName();
}
}
//--------------------------------------------------------------------------------------------------

View File

@ -31,8 +31,10 @@ class RimSummaryCurveAutoName : public caf::PdmObject
public:
RimSummaryCurveAutoName();
QString curveName(const RifEclipseSummaryAddress& summaryAddress, const RimSummaryPlotNameHelper* nameHelper) const;
void applySettings(const RimSummaryCurveAutoName& other);
QString curveNameY(const RifEclipseSummaryAddress& summaryAddress, const RimSummaryPlotNameHelper* nameHelper) const;
QString curveNameX(const RifEclipseSummaryAddress& summaryAddress, const RimSummaryPlotNameHelper* nameHelper) const;
void applySettings(const RimSummaryCurveAutoName& other);
private:
friend class RimSummaryCurve;
@ -41,6 +43,8 @@ private:
const QVariant& newValue) override;
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
void appendAddressDetails(std::string& text, const RifEclipseSummaryAddress& summaryAddress,
const RimSummaryPlotNameHelper* nameHelper) const;
void appendWellName(std::string& text, const RifEclipseSummaryAddress& summaryAddress,
const RimSummaryPlotNameHelper* nameHelper) const;
void appendLgrName(std::string& text, const RifEclipseSummaryAddress& summaryAddress) const;

View File

@ -1384,6 +1384,16 @@ QString RimSummaryPlot::generatePlotTitle(RimSummaryPlotNameHelper* nameHelper)
{
addresses.push_back(curve->summaryAddressY());
sumCases.push_back(curve->summaryCaseY());
if (curve->summaryCaseX())
{
sumCases.push_back(curve->summaryCaseX());
if (curve->summaryAddressX().category() != RifEclipseSummaryAddress::SUMMARY_INVALID)
{
addresses.push_back(curve->summaryAddressX());
}
}
}
}
}