Merge Resolve

This commit is contained in:
Ester Lindgren
2021-03-08 13:53:58 +01:00
3 changed files with 35 additions and 9 deletions
+20 -7
View File
@@ -117,6 +117,14 @@ scripting::LuaLibrary SkyBrowserModule::luaLibrary() const {
"string or list of strings",
"Add one or multiple exoplanet systems to the scene, as specified by the "
"input. An input string should be the name of the system host star"
},
{
"loacImgCollection",
&skybrowser::luascriptfunctions::loadImgCollection,
{},
"string or list of strings",
"Add one or multiple exoplanet systems to the scene, as specified by the "
"input. An input string should be the name of the system host star"
}
};
@@ -178,7 +186,17 @@ ghoul::Dictionary SkyBrowserModule::createMessageForMovingWWTCamera(const glm::d
return msg;
}
ghoul::Dictionary SkyBrowserModule::createMessageForLoadingWWTImgColl(const std::string& url) const {
using namespace std::string_literals;
ghoul::Dictionary msg;
msg.setValue("event", "center_on_coordinates"s);
msg.setValue("url", url);
return msg;
}
ghoul::Dictionary SkyBrowserModule::createMessageForPausingWWTTime() const {
using namespace std::string_literals;
ghoul::Dictionary msg;
msg.setValue("event", "pause_time"s);
@@ -214,23 +232,18 @@ glm::dvec2 SkyBrowserModule::convertGalacticToCelestial(glm::dvec3 rGal) const {
return glm::dvec2(glm::degrees(ra), glm::degrees(dec));
}
void SkyBrowserModule::showTarget() const{
void SkyBrowserModule::showTarget() const {
using namespace std::string_literals;
ghoul::Dictionary node;
node.setValue("Type", "ScreenSpaceImageLocal"s);
node.setValue("Identifier", "Target"s);
node.setValue("TexturePath", "D:/Esters/OpenSpace/modules/skybrowser/target.png"s);
node.setValue("TexturePath", "D:/Ylvas/OpenSpace/modules/skybrowser/target.png"s);
node.setValue("Scale", 0.07);
openspace::global::scriptEngine->queueScript(
"openspace.addScreenSpaceRenderable(" + ghoul::formatLua(node) + ")",
scripting::ScriptEngine::RemoteScripting::Yes
);
}
/*
+2
View File
@@ -49,9 +49,11 @@ public:
void showTarget() const;
void WWTfollowCamera();
void showTarget() const;
ghoul::Dictionary createMessageForMovingWWTCamera(const glm::dvec2 celestCoords, const float fov, const bool moveInstantly = true) const;
ghoul::Dictionary createMessageForPausingWWTTime() const;
ghoul::Dictionary createMessageForLoadingWWTImgColl(const std::string& url) const;
bool sendMessageToWWT(const ghoul::Dictionary& msg);
+13 -2
View File
@@ -29,6 +29,15 @@ namespace {
namespace openspace::skybrowser::luascriptfunctions {
int loadImgCollection(lua_State* L) {
ghoul::lua::checkArgumentsAndThrow(L, 1, "lua::loadCollection");
// https://docs.worldwidetelescope.org/data-guide/1/data-file-formats/collections/sample-blank-collection.wtml
std::string url = ghoul::lua::value<std::string>(L, 1);
SkybrowserModule* module = global::moduleEngine->module<SkybrowserModule>();
module->sendMessageToWWT(module->createMessageForLoadingWWTImgColl(url));
return 1;
}
int followCamera(lua_State* L) {
ghoul::lua::checkArgumentsAndThrow(L, 0, "lua::followCamera");
@@ -36,7 +45,9 @@ namespace openspace::skybrowser::luascriptfunctions {
SkyBrowserModule* module = global::moduleEngine->module<SkyBrowserModule>();
//ghoul::Dictionary message = module->createMessageForPausingWWTTime();
//module->sendMessageToWWT(message);
std::thread thread(&SkyBrowserModule::WWTfollowCamera, module);
thread.detach();
return 1;
@@ -44,7 +55,7 @@ namespace openspace::skybrowser::luascriptfunctions {
int moveBrowser(lua_State* L) {
ghoul::lua::checkArgumentsAndThrow(L, 0, "lua::moveBrowser");
SkyBrowserModule* module = global::moduleEngine->module<SkyBrowserModule>();
ScreenSpaceSkyBrowser* browser = dynamic_cast<ScreenSpaceSkyBrowser*>(global::renderEngine->screenSpaceRenderable("ScreenSpaceBowser"));
@@ -55,12 +66,12 @@ namespace openspace::skybrowser::luascriptfunctions {
}
int createBrowser(lua_State* L) {
ghoul::lua::checkArgumentsAndThrow(L, 1, "lua::createBrowser");
ghoul::lua::value<std::string>(L, 1);
SkyBrowserModule* module = global::moduleEngine->module<SkyBrowserModule>();
using namespace std::string_literals;
std::string node = "{"