Update Ghoul and SGCT

Adapt to changes by using more string_view
This commit is contained in:
Alexander Bock
2020-08-09 20:11:40 +02:00
parent 968080abc4
commit e3699a43a8
30 changed files with 235 additions and 385 deletions
+2 -49
View File
@@ -27,9 +27,9 @@
#include <openspace/engine/globals.h>
#include <openspace/interaction/inputstate.h>
#include <openspace/scripting/scriptengine.h>
#include <utility>
#include <ghoul/misc/exception.h>
#include <cmath>
#include <utility>
namespace openspace::interaction {
@@ -224,50 +224,3 @@ std::vector<std::string> JoystickCameraStates::buttonCommand(int button) const {
} // namespace openspace::interaction
namespace ghoul {
template <>
std::string to_string(const openspace::interaction::JoystickCameraStates::AxisType& value)
{
using T = openspace::interaction::JoystickCameraStates::AxisType;
switch (value) {
case T::None: return "None";
case T::OrbitX: return "Orbit X";
case T::OrbitY: return "Orbit Y";
case T::ZoomIn: return "Zoom In";
case T::ZoomOut: return "Zoom Out";
case T::LocalRollX: return "LocalRoll X";
case T::LocalRollY: return "LocalRoll Y";
case T::GlobalRollX: return "GlobalRoll X";
case T::GlobalRollY: return "GlobalRoll Y";
case T::PanX: return "Pan X";
case T::PanY: return "Pan Y";
default: return "";
}
}
template <>
openspace::interaction::JoystickCameraStates::AxisType from_string(
const std::string& string)
{
using T = openspace::interaction::JoystickCameraStates::AxisType;
static const std::map<std::string, T> Map = {
{ "None", T::None },
{ "Orbit X", T::OrbitX },
{ "Orbit Y", T::OrbitY },
{ "Zoom In", T::ZoomIn },
{ "Zoom Out", T::ZoomOut },
{ "LocalRoll X", T::LocalRollX },
{ "LocalRoll Y", T::LocalRollY },
{ "GlobalRoll X", T::GlobalRollX },
{ "GlobalRoll Y", T::GlobalRollY },
{ "Pan X", T::PanX },
{ "Pan Y", T::PanY }
};
return Map.at(string);
}
} // namespace ghoul
-28
View File
@@ -68,31 +68,3 @@ bool JoystickInputStates::button(int button, JoystickAction action) const {
}
} // namespace openspace::interaction
namespace ghoul {
template <>
std::string to_string(const openspace::interaction::JoystickAction& value) {
switch (value) {
case openspace::interaction::JoystickAction::Idle: return "Idle";
case openspace::interaction::JoystickAction::Press: return "Press";
case openspace::interaction::JoystickAction::Repeat: return "Repeat";
case openspace::interaction::JoystickAction::Release: return "Release";
default: return "";
}
}
template <>
openspace::interaction::JoystickAction from_string(const std::string& string) {
static const std::map<std::string, openspace::interaction::JoystickAction> Map = {
{ "Idle", openspace::interaction::JoystickAction::Idle },
{ "Press", openspace::interaction::JoystickAction::Press },
{ "Repeat", openspace::interaction::JoystickAction::Repeat },
{ "Release", openspace::interaction::JoystickAction::Release }
};
return Map.at(string);
}
} // namespace ghoul
+1 -48
View File
@@ -27,6 +27,7 @@
#include <openspace/engine/openspaceengine.h>
#include <openspace/interaction/inputstate.h>
#include <openspace/scripting/scriptengine.h>
#include <ghoul/misc/exception.h>
#include <ghoul/misc/stringconversion.h>
#include <utility>
#include <cmath>
@@ -212,52 +213,4 @@ std::vector<std::string> WebsocketCameraStates::buttonCommand(int button) const
return result;
}
} // namespace openspace::interaction
namespace ghoul {
template <>
std::string to_string(const openspace::interaction::WebsocketCameraStates::AxisType& type)
{
using T = openspace::interaction::WebsocketCameraStates::AxisType;
switch (type) {
case T::None: return "None";
case T::OrbitX: return "Orbit X";
case T::OrbitY: return "Orbit Y";
case T::ZoomIn: return "Zoom In";
case T::ZoomOut: return "Zoom Out";
case T::LocalRollX: return "LocalRoll X";
case T::LocalRollY: return "LocalRoll Y";
case T::GlobalRollX: return "GlobalRoll X";
case T::GlobalRollY: return "GlobalRoll Y";
case T::PanX: return "Pan X";
case T::PanY: return "Pan Y";
default: return "";
}
}
template <>
openspace::interaction::WebsocketCameraStates::AxisType from_string(
const std::string& string)
{
using T = openspace::interaction::WebsocketCameraStates::AxisType;
static const std::map<std::string, T> Map = {
{ "None", T::None },
{ "Orbit X", T::OrbitX },
{ "Orbit Y", T::OrbitY },
{ "Zoom In", T::ZoomIn },
{ "Zoom Out", T::ZoomOut },
{ "LocalRoll X", T::LocalRollX },
{ "LocalRoll Y", T::LocalRollY },
{ "GlobalRoll X", T::GlobalRollX },
{ "GlobalRoll Y", T::GlobalRollY },
{ "Pan X", T::PanX },
{ "Pan Y", T::PanY }
};
return Map.at(string);
}
} // namespace ghoul
+1 -28
View File
@@ -24,6 +24,7 @@
#include <openspace/interaction/websocketinputstate.h>
#include <ghoul/misc/exception.h>
#include <ghoul/misc/invariants.h>
#include <ghoul/misc/stringconversion.h>
#include <algorithm>
@@ -71,31 +72,3 @@ bool WebsocketInputStates::button(int button, WebsocketAction action) const {
}
} // namespace openspace::interaction
namespace ghoul {
template <>
std::string to_string(const openspace::interaction::WebsocketAction& action) {
switch (action) {
case openspace::interaction::WebsocketAction::Idle: return "Idle";
case openspace::interaction::WebsocketAction::Press: return "Press";
case openspace::interaction::WebsocketAction::Repeat: return "Repeat";
case openspace::interaction::WebsocketAction::Release: return "Release";
default: return "";
}
}
template <>
openspace::interaction::WebsocketAction from_string(const std::string& string) {
static const std::map<std::string, openspace::interaction::WebsocketAction> Map = {
{ "Idle", openspace::interaction::WebsocketAction::Idle },
{ "Press", openspace::interaction::WebsocketAction::Press },
{ "Repeat", openspace::interaction::WebsocketAction::Repeat },
{ "Release", openspace::interaction::WebsocketAction::Release }
};
return Map.at(string);
}
} // namespace ghoul