Create functions to display WWT images

This commit is contained in:
Ylva Selling
2021-03-29 08:27:40 +02:00
parent 74609230b6
commit bb5042cd50
4 changed files with 34 additions and 4 deletions

View File

@@ -22,6 +22,8 @@ namespace openspace {
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;
ghoul::Dictionary createMessageForSettingForegroundWWT(const std::string& name) const;
ghoul::Dictionary createMessageForSettingForegroundOpacityWWT(double val) const;
bool sendMessageToWWT(const ghoul::Dictionary& msg);
void sendMouseEvent(CefStructBase<CefMouseEventTraits> event, int x, int y) const;
void WWTfollowCamera();

View File

@@ -87,7 +87,7 @@ namespace openspace {
"input. An input string should be the name of the system host star"
},
{
"loacImgCollection",
"loadCollection",
&skybrowser::luascriptfunctions::loadImgCollection,
{},
"string or list of strings",

View File

@@ -32,8 +32,14 @@ namespace {
namespace openspace::skybrowser::luascriptfunctions {
int loadImgCollection(lua_State* L) {
ghoul::lua::checkArgumentsAndThrow(L, 1, "lua::loadCollection");
ghoul::lua::checkArgumentsAndThrow(L, 0, "lua::loadCollection");
ScreenSpaceSkyBrowser* browser = dynamic_cast<ScreenSpaceSkyBrowser*>(global::renderEngine->screenSpaceRenderable("SkyBrowser1"));
std::string url = "http://www.worldwidetelescope.org/wwtweb/catalog.aspx?W=wise";
browser->sendMessageToWWT(browser->createMessageForLoadingWWTImgColl(url));
browser->sendMessageToWWT(browser->createMessageForSettingForegroundWWT("Andromeda Galaxy"));
// browser->sendMessageToWWT(browser->createMessageForMovingWWTCamera(glm::vec2(0.712305533333333, 41.269167), 24.0f));
browser->sendMessageToWWT(browser->createMessageForSettingForegroundOpacityWWT(100));
return 1;
}

View File

@@ -93,7 +93,7 @@ namespace openspace {
_skyTargetID.onChange([&]() {
setConnectedTarget();
});
_fieldOfView.onChange([&]() {
if (_skyTarget) {
_skyTarget->updateFOV(_fieldOfView);
@@ -200,12 +200,34 @@ namespace openspace {
// https://docs.worldwidetelescope.org/data-guide/1/data-file-formats/collections/sample-blank-collection.wtml
using namespace std::string_literals;
ghoul::Dictionary msg;
msg.setValue("event", "center_on_coordinates"s);
msg.setValue("event", "load_image_collection"s);
msg.setValue("url", url);
return msg;
}
ghoul::Dictionary ScreenSpaceSkyBrowser::createMessageForSettingForegroundWWT(const std::string& name) const {
// https://docs.worldwidetelescope.org/data-guide/1/data-file-formats/collections/sample-blank-collection.wtml
using namespace std::string_literals;
ghoul::Dictionary msg;
msg.setValue("event", "set_foreground_by_name"s);
msg.setValue("name", name);
return msg;
}
ghoul::Dictionary ScreenSpaceSkyBrowser::createMessageForSettingForegroundOpacityWWT(double val) const {
// https://docs.worldwidetelescope.org/data-guide/1/data-file-formats/collections/sample-blank-collection.wtml
using namespace std::string_literals;
ghoul::Dictionary msg;
msg.setValue("event", "set_foreground_opacity"s);
msg.setValue("value", val);
return msg;
}
ghoul::Dictionary ScreenSpaceSkyBrowser::createMessageForPausingWWTTime() const {
using namespace std::string_literals;