Add lua function to dispatch point spacecraft event

This commit is contained in:
Ylva Selling
2022-04-26 18:39:31 -04:00
parent 1e180a6fa7
commit 939dfae319
2 changed files with 17 additions and 1 deletions

View File

@@ -435,7 +435,8 @@ scripting::LuaLibrary SkyBrowserModule::luaLibrary() const {
codegen::lua::FinetuneTargetPosition,
codegen::lua::ScrollOverBrowser,
codegen::lua::LoadingImageCollectionComplete,
codegen::lua::ShowAllTargetsAndBrowsers
codegen::lua::ShowAllTargetsAndBrowsers,
codegen::lua::PointSpaceCraft
}
};
}

View File

@@ -27,6 +27,7 @@
#include <modules/skybrowser/include/utility.h>
#include <modules/skybrowser/include/targetbrowserpair.h>
#include <modules/skybrowser/include/wwtdatahandler.h>
#include <openspace/events/eventengine.h>
#include <openspace/engine/globals.h>
#include <openspace/engine/moduleengine.h>
#include <openspace/engine/windowdelegate.h>
@@ -757,6 +758,20 @@ namespace {
}
}
/**
* Point spacecraft to the equatorial coordinates the target points to
* \param identifier Identifier of the sky browser
*/
[[codegen::luawrap]] void pointSpaceCraft(std::string identifier) {
using namespace openspace;
SkyBrowserModule* module = global::moduleEngine->module<SkyBrowserModule>();
TargetBrowserPair* pair = module->getPair(identifier);
glm::dvec2 equatorial = pair->targetDirectionEquatorial();
global::eventEngine->publishEvent<events::EventPointSpacecraft>(
equatorial.x, equatorial.y
);
}
#include "skybrowsermodule_lua_codegen.cpp"
} // namespace