Feature/anchor and aim (#799)

Introduce the ability to navigate using an anchor and aim.
Example use: Set spacecraft as anchor and planet as aim to always look down at a planet, while followin the spacecraft in its orbit.
This commit is contained in:
Emil Axelsson
2019-02-19 18:46:58 +01:00
committed by GitHub
parent df9fbf8195
commit 2e71eaa4cb
45 changed files with 972 additions and 490 deletions

View File

@@ -28,6 +28,8 @@
#include <openspace/properties/property.h>
#include <openspace/query/query.h>
#include <ghoul/logging/logmanager.h>
#include <openspace/engine/globals.h>
#include <openspace/scripting/scriptengine.h>
namespace {
constexpr const char* PropertyKey = "property";
@@ -40,22 +42,19 @@ namespace openspace {
void TriggerPropertyTopic::handleJson(const nlohmann::json& json) {
try {
const std::string& propertyKey = json.at(PropertyKey).get<std::string>();
properties::Property* prop = property(propertyKey);
if (prop) {
LDEBUG("Triggering " + propertyKey);
prop->set("poke");
}
else {
LWARNING("Could not find property " + propertyKey);
}
global::scriptEngine.queueScript(
fmt::format(
"openspace.setPropertyValueSingle(\"{}\", nil)", propertyKey
),
scripting::ScriptEngine::RemoteScripting::Yes
);
}
catch (const std::out_of_range& e) {
LERROR("Could not poke property -- key or value is missing in payload");
LERROR("Could not trigger property -- key or value is missing in payload");
LERROR(e.what());
}
catch (const ghoul::RuntimeError& e) {
LERROR("Could not poke property -- runtime error:");
LERROR("Could not trigger property -- runtime error:");
LERROR(e.what());
}
}