Commit 32bd6e0f authored by CALKA Maxime's avatar CALKA Maxime

Change defaultNames in InteractiveViewer from array to std::array to do a proper loop in getViewer

parent b562b731
......@@ -78,12 +78,13 @@
#include <vtkExtractSelectedFrustum.h>
#include <vtkPointData.h>
#include <array>
namespace camitk {
// ---------------------- singleton ----------------------------
/// the register containing all the viewers (static instantiation, global variable, but global only for this file)
QMap<QString, InteractiveViewer*> InteractiveViewer::viewers;
QString InteractiveViewer::defaultNames[5] = {QString("3DViewer"), QString("axialViewer"), QString("coronalViewer"), QString("sagittalViewer"), QString("arbitraryViewer") };
std::array<QString, 5> InteractiveViewer::defaultNames = {QString("3DViewer"), QString("axialViewer"), QString("coronalViewer"), QString("sagittalViewer"), QString("arbitraryViewer") };
InteractiveViewer* InteractiveViewer::getNewViewer(QString name, ViewerType type) {
if (!viewers.contains(name)) {
......@@ -114,7 +115,7 @@ InteractiveViewer* InteractiveViewer::getViewer(QString name) {
i++;
while (i < 5 && !singletonInstance) {
while (i < defaultNames.size() && !singletonInstance) {
if (name == defaultNames[i]) {
singletonInstance = getNewViewer(defaultNames[i], SLICE_VIEWER);
}
......
......@@ -365,7 +365,7 @@ protected:
static QMap<QString, InteractiveViewer*> viewers;
/// the QString array containing all InteractiveViewer instance default names
static QString defaultNames[5];
static std::array<QString, 5> defaultNames;
/// @}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment