mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-02-16 17:29:20 -06:00
@@ -1,116 +1,122 @@
|
||||
{
|
||||
"0": {
|
||||
"id": "scene",
|
||||
"visible": true,
|
||||
"name": "Scene",
|
||||
"isOpen": false
|
||||
},
|
||||
"1": {
|
||||
"id": "settings",
|
||||
"visible": false,
|
||||
"name": "Settings",
|
||||
"isOpen": false
|
||||
},
|
||||
"2": {
|
||||
"id": "navigation",
|
||||
"visible": true,
|
||||
"name": "Navigation",
|
||||
"isOpen": false
|
||||
},
|
||||
"3": {
|
||||
"id": "timePanel",
|
||||
"visible": true,
|
||||
"name": "Time Panel",
|
||||
"isOpen": false
|
||||
},
|
||||
"4": {
|
||||
"id": "sessionRecording",
|
||||
"visible": true,
|
||||
"name": "Session Recording",
|
||||
"isOpen": false
|
||||
},
|
||||
"5": {
|
||||
"id": "geoLocation",
|
||||
"visible": true,
|
||||
"name": "Geo Location",
|
||||
"isOpen": false
|
||||
},
|
||||
"6": {
|
||||
"id": "screenSpaceRenderables",
|
||||
"visible": true,
|
||||
"name": "Screenspace Renderables",
|
||||
"isOpen": false
|
||||
},
|
||||
"7": {
|
||||
"id": "exoplanets",
|
||||
"visible": true,
|
||||
"name": "Exoplanets",
|
||||
"isOpen": false
|
||||
},
|
||||
"8": {
|
||||
"id": "userPanels",
|
||||
"visible": true,
|
||||
"name": "User Panels",
|
||||
"isOpen": false
|
||||
},
|
||||
"9": {
|
||||
"id": "actions",
|
||||
"visible": true,
|
||||
"name": "Actions",
|
||||
"isOpen": false
|
||||
},
|
||||
"10": {
|
||||
"id": "skyBrowser",
|
||||
"visible": true,
|
||||
"name": "SkyBrowser",
|
||||
"isOpen": false
|
||||
},
|
||||
"11": {
|
||||
"id": "mission",
|
||||
"visible": false,
|
||||
"name": "Mission",
|
||||
"isOpen": false
|
||||
},
|
||||
"12": {
|
||||
"id": "flightControl",
|
||||
"visible": true,
|
||||
"name": "Flight Control",
|
||||
"isOpen": false
|
||||
},
|
||||
"13": {
|
||||
"id": "keybindingsLayout",
|
||||
"visible": false,
|
||||
"name": "Keybinds",
|
||||
"isOpen": false
|
||||
},
|
||||
"14": {
|
||||
"id": "nightSky",
|
||||
"visible": false,
|
||||
"name": "Night Sky",
|
||||
"isOpen": false
|
||||
},
|
||||
"15": {
|
||||
"id": "gettingStartedTour",
|
||||
"visible": false,
|
||||
"name": "Getting Started Tour",
|
||||
"isOpen": false
|
||||
},
|
||||
"16": {
|
||||
"id": "scriptLogPanel",
|
||||
"visible": false,
|
||||
"name": "Script Log",
|
||||
"isOpen": false
|
||||
},
|
||||
"17": {
|
||||
"id": "assetsFolderPanel",
|
||||
"visible": false,
|
||||
"name": "Assets",
|
||||
"isOpen": false
|
||||
},
|
||||
"18": {
|
||||
"id": "devPanel",
|
||||
"visible": false,
|
||||
"name": "Dev Panel",
|
||||
"isOpen": false
|
||||
}
|
||||
}
|
||||
"0": {
|
||||
"id": "scene",
|
||||
"visible": true,
|
||||
"name": "Scene",
|
||||
"isOpen": false
|
||||
},
|
||||
"1": {
|
||||
"id": "settings",
|
||||
"visible": false,
|
||||
"name": "Settings",
|
||||
"isOpen": false
|
||||
},
|
||||
"2": {
|
||||
"id": "navigation",
|
||||
"visible": true,
|
||||
"name": "Navigation",
|
||||
"isOpen": false
|
||||
},
|
||||
"3": {
|
||||
"id": "timePanel",
|
||||
"visible": true,
|
||||
"name": "Time Panel",
|
||||
"isOpen": false
|
||||
},
|
||||
"4": {
|
||||
"id": "sessionRecording",
|
||||
"visible": true,
|
||||
"name": "Session Recording",
|
||||
"isOpen": false
|
||||
},
|
||||
"5": {
|
||||
"id": "geoLocation",
|
||||
"visible": true,
|
||||
"name": "Geo Location",
|
||||
"isOpen": false
|
||||
},
|
||||
"6": {
|
||||
"id": "screenSpaceRenderables",
|
||||
"visible": true,
|
||||
"name": "Screenspace Renderables",
|
||||
"isOpen": false
|
||||
},
|
||||
"7": {
|
||||
"id": "exoplanets",
|
||||
"visible": true,
|
||||
"name": "Exoplanets",
|
||||
"isOpen": false
|
||||
},
|
||||
"8": {
|
||||
"id": "userPanels",
|
||||
"visible": true,
|
||||
"name": "User Panels",
|
||||
"isOpen": false
|
||||
},
|
||||
"9": {
|
||||
"id": "actions",
|
||||
"visible": true,
|
||||
"name": "Actions",
|
||||
"isOpen": false
|
||||
},
|
||||
"10": {
|
||||
"id": "skyBrowser",
|
||||
"visible": true,
|
||||
"name": "SkyBrowser",
|
||||
"isOpen": false
|
||||
},
|
||||
"11": {
|
||||
"id": "mission",
|
||||
"visible": false,
|
||||
"name": "Mission",
|
||||
"isOpen": false
|
||||
},
|
||||
"12": {
|
||||
"id": "flightControl",
|
||||
"visible": true,
|
||||
"name": "Flight Control",
|
||||
"isOpen": false
|
||||
},
|
||||
"13": {
|
||||
"id": "keybindingsLayout",
|
||||
"visible": false,
|
||||
"name": "Keybinds",
|
||||
"isOpen": false
|
||||
},
|
||||
"14": {
|
||||
"id": "nightSky",
|
||||
"visible": false,
|
||||
"name": "Night Sky",
|
||||
"isOpen": false
|
||||
},
|
||||
"15": {
|
||||
"id": "gettingStartedTour",
|
||||
"visible": false,
|
||||
"name": "Getting Started Tour",
|
||||
"isOpen": false
|
||||
},
|
||||
"16": {
|
||||
"id": "scriptLogPanel",
|
||||
"visible": false,
|
||||
"name": "Script Log",
|
||||
"isOpen": false
|
||||
},
|
||||
"17": {
|
||||
"id": "assetsFolderPanel",
|
||||
"visible": false,
|
||||
"name": "Assets",
|
||||
"isOpen": false
|
||||
},
|
||||
"18": {
|
||||
"id": "globeImageryBrowserPanel",
|
||||
"visible": false,
|
||||
"name": "Globe Imagery Browser",
|
||||
"isOpen": false
|
||||
},
|
||||
"19": {
|
||||
"id": "devPanel",
|
||||
"visible": false,
|
||||
"name": "Dev Panel",
|
||||
"isOpen": false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -515,7 +515,9 @@ scripting::LuaLibrary GlobeBrowsingModule::luaLibrary() const {
|
||||
codegen::lua::CapabilitiesWMS,
|
||||
codegen::lua::AddGeoJson,
|
||||
codegen::lua::DeleteGeoJson,
|
||||
codegen::lua::AddGeoJsonFromFile
|
||||
codegen::lua::AddGeoJsonFromFile,
|
||||
codegen::lua::Globes,
|
||||
codegen::lua::UrlInfo
|
||||
},
|
||||
.scripts = {
|
||||
absPath("${MODULE_GLOBEBROWSING}/scripts/layer_support.lua"),
|
||||
|
||||
@@ -533,6 +533,99 @@ namespace {
|
||||
globe->geoJsonManager().addGeoJsonLayer(d);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an object containing a list of all loaded `RenderableGlobe`s sorted first by
|
||||
* the presence of WMS server info, then alphabetically. The index `firstIndexWithoutUrl`
|
||||
* indicates the first item in the list that does not have WMS server info.
|
||||
*
|
||||
* \return Table containing a list of `renderableGlobe` identifiers, and an index
|
||||
* indicating the first item in the list that does not have a WMS server
|
||||
*/
|
||||
[[codegen::luawrap]] ghoul::Dictionary globes() {
|
||||
using namespace openspace;
|
||||
using namespace globebrowsing;
|
||||
GlobeBrowsingModule* module = global::moduleEngine->module<GlobeBrowsingModule>();
|
||||
|
||||
std::vector<SceneGraphNode*> nodes =
|
||||
global::renderEngine->scene()->allSceneGraphNodes();
|
||||
|
||||
nodes.erase(
|
||||
std::remove_if(
|
||||
nodes.begin(),
|
||||
nodes.end(),
|
||||
[](const SceneGraphNode* n) {
|
||||
const Renderable* r = n->renderable();
|
||||
const RenderableGlobe* rg = dynamic_cast<const RenderableGlobe*>(r);
|
||||
return rg == nullptr;
|
||||
}
|
||||
),
|
||||
nodes.end()
|
||||
);
|
||||
|
||||
// Sort the globes with respect to WMS server info followed by alphabetical order
|
||||
std::sort(
|
||||
nodes.begin(),
|
||||
nodes.end(),
|
||||
[module](const SceneGraphNode* lhs, const SceneGraphNode* rhs) {
|
||||
const bool lhsHasUrl = module->hasUrlInfo(lhs->identifier());
|
||||
const bool rhsHasUrl = module->hasUrlInfo(rhs->identifier());
|
||||
|
||||
if (lhsHasUrl && !rhsHasUrl) {
|
||||
return true;
|
||||
}
|
||||
if (!lhsHasUrl && rhsHasUrl) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return lhs->guiName() < rhs->guiName();
|
||||
}
|
||||
);
|
||||
std::vector<std::string> globeIdentifiers;
|
||||
globeIdentifiers.reserve(nodes.size());
|
||||
for (const SceneGraphNode* node : nodes) {
|
||||
globeIdentifiers.push_back(node->identifier());
|
||||
}
|
||||
|
||||
auto firstWithoutUrl = std::find_if(
|
||||
nodes.begin(),
|
||||
nodes.end(),
|
||||
[module](const SceneGraphNode* n) {
|
||||
return !module->hasUrlInfo(n->identifier());
|
||||
}
|
||||
);
|
||||
|
||||
int index = static_cast<int>(firstWithoutUrl - nodes.begin());
|
||||
|
||||
ghoul::Dictionary e;
|
||||
e.setValue("identifiers", globeIdentifiers);
|
||||
e.setValue("firstIndexWithoutUrl", index);
|
||||
return e;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a list of all WMS servers associated with the `renderableGlobe` globe.
|
||||
*
|
||||
* \param globe The identifier of the `renderableGlobe` to fetch WMS servers for
|
||||
* \return A list of WMS server info containing its name and URL
|
||||
*/
|
||||
[[codegen::luawrap]] std::vector<ghoul::Dictionary> urlInfo(std::string globe) {
|
||||
using namespace openspace;
|
||||
using namespace globebrowsing;
|
||||
GlobeBrowsingModule* module = global::moduleEngine->module<GlobeBrowsingModule>();
|
||||
std::vector<GlobeBrowsingModule::UrlInfo> info = module->urlInfo(globe);
|
||||
|
||||
std::vector<ghoul::Dictionary> res;
|
||||
for (const GlobeBrowsingModule::UrlInfo& i : info) {
|
||||
ghoul::Dictionary e;
|
||||
e.setValue("name", i.name);
|
||||
e.setValue("url", i.url);
|
||||
res.push_back(std::move(e));
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
#include "globebrowsingmodule_lua_codegen.cpp"
|
||||
|
||||
} // namespace
|
||||
|
||||
|
||||
Reference in New Issue
Block a user