mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-09 23:16:00 -06:00
#4031 Ensemble : Fix operator<
This commit is contained in:
parent
89d55d8354
commit
d275b2bf60
@ -142,28 +142,45 @@ QString RiaSummaryCurveDefinition::curveDefinitionText(const QString& caseName,
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RiaSummaryCurveDefinition::operator<(const RiaSummaryCurveDefinition& other) const
|
||||
{
|
||||
if (m_summaryCase != other.summaryCase())
|
||||
{
|
||||
// Try comparing the dereferenced objects first. They have a predictable sorting operator.
|
||||
if (m_summaryCase && other.summaryCase())
|
||||
QString ensembleName;
|
||||
QString otherEnsembleName;
|
||||
|
||||
if (m_ensemble)
|
||||
{
|
||||
return *m_summaryCase < *other.summaryCase();
|
||||
ensembleName = m_ensemble->name();
|
||||
}
|
||||
|
||||
if (other.ensemble())
|
||||
{
|
||||
otherEnsembleName = other.ensemble()->name();
|
||||
}
|
||||
|
||||
if (ensembleName != otherEnsembleName)
|
||||
{
|
||||
return ensembleName < otherEnsembleName;
|
||||
}
|
||||
// Sorting by pointer address, which may appear random to the user.
|
||||
return m_summaryCase < other.summaryCase();
|
||||
}
|
||||
|
||||
if (m_ensemble != other.ensemble())
|
||||
{
|
||||
// Try comparing the dereferenced objects first. They have a predictable sorting operator.
|
||||
if (m_ensemble && other.ensemble())
|
||||
QString summaryCaseName;
|
||||
QString otherSummaryCaseName;
|
||||
|
||||
if (m_summaryCase)
|
||||
{
|
||||
return *m_ensemble < *other.ensemble();
|
||||
summaryCaseName = m_summaryCase->caseName();
|
||||
}
|
||||
if (other.summaryCase())
|
||||
{
|
||||
otherSummaryCaseName = other.summaryCase()->caseName();
|
||||
}
|
||||
|
||||
if (summaryCaseName != otherSummaryCaseName)
|
||||
{
|
||||
return summaryCaseName < otherSummaryCaseName;
|
||||
}
|
||||
// Sorting by pointer address, which may appear random to the user.
|
||||
return (m_ensemble < other.ensemble());
|
||||
}
|
||||
|
||||
|
||||
return (m_summaryAddress < other.summaryAddress());
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user