mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-05 19:19:39 -06:00
Create functions to display WWT images
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user