#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::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; std::vector<caf::PdmUiItem*> selectedItems;
@@ -59,17 +62,21 @@ std::vector<RimWellLogCurve*> RicWellLogPlotCurveFeatureImpl::selectedWellLogCur
for ( RimWellLogCurve* curve : childCurves ) for ( RimWellLogCurve* curve : childCurves )
{ {
curveSet.insert( curve ); if ( !uniqueCurves.count( curve ) )
{
uniqueCurves.insert( curve );
allCurves.push_back( curve );
}
} }
} }
} }
} }
std::vector<RimWellLogCurve*> allCurves; // Sort by curve name in a way that retains the original order of equivalent items
for ( RimWellLogCurve* curve : curveSet ) // This way we have a completely deterministic order
{ std::stable_sort( allCurves.begin(), allCurves.end(), []( const RimWellLogCurve* lhs, const RimWellLogCurve* rhs ) {
allCurves.push_back( curve ); return lhs->curveName() < rhs->curveName();
} } );
return allCurves; return allCurves;
} }