Sort the images on image name

This commit is contained in:
Ylva Selling
2021-05-10 09:19:00 +02:00
parent a456b68b20
commit 4126be2604
+12
View File
@@ -93,6 +93,18 @@ namespace openspace {
std::string collectionName = root->FindAttribute("Name") ? root->FindAttribute("Name")->Value() : "";
loadImagesFromXML(root, collectionName);
}
// Sort images in alphabetial order
std::sort(images.begin(), images.end(), [](ImageData a, ImageData b) {
// If the first charachter in the names are lowercase, make it upper case
if (std::islower(a.name[0])) {
// convert string to upper case
a.name[0] = ::toupper(a.name[0]);
}
if (std::islower(b.name[0])) {
b.name[0] = ::toupper(b.name[0]);
}
return a.name < b.name;
});
return images.size();
}