#4797 Alphabetize order of well log channels in LAS-file export

This commit is contained in:
Gaute Lindkvist 2019-09-30 12:52:55 +02:00
parent 288acda703
commit 62c48d3cdb

View File

@ -43,7 +43,10 @@ cvf::Color3f RicWellLogPlotCurveFeatureImpl::curveColorFromTable( size_t index )
//--------------------------------------------------------------------------------------------------
std::vector<RimWellLogCurve*> RicWellLogPlotCurveFeatureImpl::selectedWellLogCurves()
{
std::set<RimWellLogCurve*> curveSet;
// Use std::set to determine uniqueness but a vector for inserting curves.
// This is to retain deterministic order.
std::vector<RimWellLogCurve*> allCurves;
std::set<RimWellLogCurve*> uniqueCurves;
{
std::vector<caf::PdmUiItem*> selectedItems;
@ -59,17 +62,21 @@ std::vector<RimWellLogCurve*> RicWellLogPlotCurveFeatureImpl::selectedWellLogCur
for ( RimWellLogCurve* curve : childCurves )
{
curveSet.insert( curve );
if ( !uniqueCurves.count( curve ) )
{
uniqueCurves.insert( curve );
allCurves.push_back( curve );
}
}
}
}
}
std::vector<RimWellLogCurve*> allCurves;
for ( RimWellLogCurve* curve : curveSet )
{
allCurves.push_back( curve );
}
// Sort by curve name in a way that retains the original order of equivalent items
// This way we have a completely deterministic order
std::stable_sort( allCurves.begin(), allCurves.end(), []( const RimWellLogCurve* lhs, const RimWellLogCurve* rhs ) {
return lhs->curveName() < rhs->curveName();
} );
return allCurves;
}