add heroku baseurl and key bindings

This commit is contained in:
Michael Nilsson
2016-06-15 11:07:20 -04:00
parent 573ebd34a7
commit 6573a6dfce
5 changed files with 36 additions and 7 deletions

View File

@@ -1,5 +1,10 @@
<?xml version="1.0" ?>
<Cluster masterAddress="localhost">
<!-- <Scene>
<Orientation yaw="0.0" pitch="-27.0" roll="0.0" />
<Offset x="0.0" y="0.0" z="0.0" />
<Scale value="1.0" />
</Scene> -->
<Node address="localhost" port="20401">
<Window fullScreen="false" numberOfSamples="8" name="OpenSpace">
<Stereo type="none" />
@@ -20,7 +25,7 @@
<Viewport name="fisheye">
<Pos x="0.0" y="0.0" />
<Size x="1.0" y="1.0" />
<FisheyeProjection fov="180" quality="1k" tilt="27.0">
<FisheyeProjection fov="180" quality="1k" tilt="27.0">
<Background r="0.1" g="0.1" b="0.1" a="1.0" />
</FisheyeProjection>
</Viewport>

View File

@@ -51,6 +51,8 @@
namespace {
using json = nlohmann::json;
const std::string _loggerCat = "IswaManager";
std::string baseUrl = "https://iswa-demo-server.herokuapp.com/";
//const std::string baseUrl = "http://128.183.168.116:3000/";
}
namespace openspace{
@@ -145,8 +147,7 @@ void IswaManager::addIswaCygnet(int id, std::string type, std::string group){
// Download metadata
DlManager.fetchFile(
"http://128.183.168.116:3000/" + std::to_string(-id),
// "http://localhost:3000/" + std::to_string(-id),
baseUrl + std::to_string(-id),
metadataCallback,
[id](const std::string& err){
LDEBUG("Download to memory was aborted for data cygnet with id "+ std::to_string(id)+": " + err);
@@ -195,8 +196,7 @@ std::future<DownloadManager::MemoryFile> IswaManager::fetchDataCygnet(int id, do
std::string IswaManager::iswaUrl(int id, double timestamp, std::string type){
std::string url;
if(id < 0){
url = "http://128.183.168.116:3000/"+type+"/" + std::to_string(-id) + "/";
// url = "http://localhost:3000/"+type+"/" + std::to_string(-id) + "/";
url = baseUrl+type+"/" + std::to_string(-id) + "/";
} else{
url = "http://iswa3.ccmc.gsfc.nasa.gov/IswaSystemWebApp/iSWACygnetStreamer?window=-1&cygnetId="+ std::to_string(id) +"&timestamp=";
}
@@ -262,8 +262,7 @@ std::shared_ptr<MetadataFuture> IswaManager::downloadMetadata(int id){
metaFuture->id = id;
DlManager.fetchFile(
"http://128.183.168.116:3000/" + std::to_string(-id),
// "http://localhost:3000/" + std::to_string(-id),
baseUrl + std::to_string(-id),
[&metaFuture](const DownloadManager::MemoryFile& file){
metaFuture->json = std::string(file.buffer, file.size);
metaFuture->isFinished = true;
@@ -648,6 +647,11 @@ void IswaManager::addCdfFiles(std::string path){
}
}
void IswaManager::setBaseUrl(std::string bUrl){
LDEBUG("Swapped baseurl to: " + bUrl);
baseUrl = bUrl;
}
scripting::ScriptEngine::LuaLibrary IswaManager::luaLibrary() {
return {
"iswa",
@@ -707,6 +711,13 @@ scripting::ScriptEngine::LuaLibrary IswaManager::luaLibrary() {
"int",
"Remove a group of Cygnets",
true
},
{
"setBaseUrl",
&luascriptfunctions::iswa_setBaseUrl,
"string",
"sets the base url",
true
}
}
};

View File

@@ -106,6 +106,7 @@ public:
}
void addCdfFiles(std::string path);
void setBaseUrl(std::string bUrl);
private:
std::shared_ptr<MetadataFuture> downloadMetadata(int id);
std::string jsonPlaneToLuaTable(std::shared_ptr<MetadataFuture> data);

View File

@@ -164,6 +164,12 @@ int iswa_addKameleonPlanes(lua_State* L){
return 0;
}
int iswa_setBaseUrl(lua_State* L){
std::string url = luaL_checkstring(L, 1);
IswaManager::ref().setBaseUrl(url);
return 0;
}
}// namespace luascriptfunctions
}// namespace openspace

View File

@@ -16,3 +16,9 @@ openspace.bindKey("e", helper.renderable.toggle('EarthMarker'))
openspace.bindKey("x", helper.renderable.toggle('Constellation Bounds'))
openspace.bindKey("c", "openspace.parallel.setAddress('130.236.142.51');openspace.parallel.setPassword('newhorizons-20150714');openspace.parallel.connect();")
openspace.bindKey("h", "openspace.iswa.setBaseUrl('https://iswa-demo-server.herokuapp.com/')");
openspace.bindKey("g", "openspace.iswa.setBaseUrl('http://128.183.168.116:3000/')");
openspace.bindKey("l", "openspace.iswa.setBaseUrl('http://localhost:3000/')");
openspace.bindKey("v", "openspace.time.setTime('2015-03-15T02:00:00.00')");