#2135 Rewrote obfuscated less operator and sort OBSERVED PLT sources first

This commit is contained in:
Jacob Støren 2017-11-12 23:53:59 +01:00
parent 5efd60c227
commit cc4041b09b
2 changed files with 40 additions and 2 deletions

View File

@ -124,6 +124,43 @@ QTextStream& operator >> (QTextStream& str, RifWellRftAddress& source)
return str;
}
//--------------------------------------------------------------------------------------------------
/// This sort order controls the plot order in PLT plot. (Layer-wise)
/// Observed data is supposed to be the bottom layers (first)
//--------------------------------------------------------------------------------------------------
bool operator<(const RifWellRftAddress& addr1, const RifWellRftAddress& addr2)
{
if ( addr1.m_sourceType != addr2.m_sourceType )
{
return addr1.m_sourceType < addr2.m_sourceType;
}
if ( addr1.m_sourceType == RifWellRftAddress::NONE ) return false; //
if (addr1.m_sourceType == RifWellRftAddress::OBSERVED)
{
if(addr1.wellLogFile() && addr2.wellLogFile())
{
return addr1.wellLogFile()->fileName() < addr2.wellLogFile()->fileName();
}
else
{
return addr1.wellLogFile() < addr2.wellLogFile();
}
}
else
{
if ( addr1.eclCase() && addr2.eclCase() )
{
return addr1.eclCase()->caseId() < addr2.eclCase()->caseId();
}
else
{
return addr1.eclCase() < addr2.eclCase();
}
}
}
#if 0
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -135,3 +172,4 @@ bool operator<(const RifWellRftAddress& addr1, const RifWellRftAddress& addr2)
addr1.wellLogFile() != nullptr && addr2.wellLogFile() != nullptr ? addr1.wellLogFile()->fileName() < addr2.wellLogFile()->fileName() :
addr1.wellLogFile() < addr2.wellLogFile());
}
#endif

View File

@ -44,9 +44,9 @@ public:
enum SourceType
{
NONE,
OBSERVED,
RFT,
GRID,
OBSERVED
GRID
};
RifWellRftAddress();