From f05672436e0071df003f2d2e34b2ef44bd870307 Mon Sep 17 00:00:00 2001 From: Michael Nilsson Date: Tue, 3 May 2016 15:07:22 -0400 Subject: [PATCH] removed iswamanager update function and create cygnet through scripts instead --- modules/iswa/util/iswamanager.cpp | 56 +++++++++++++++---------------- modules/iswa/util/iswamanager.h | 5 --- src/engine/openspaceengine.cpp | 2 +- src/scene/scene.cpp | 8 ----- 4 files changed, 29 insertions(+), 42 deletions(-) diff --git a/modules/iswa/util/iswamanager.cpp b/modules/iswa/util/iswamanager.cpp index 9f4c5d8745..7dd16eafef 100644 --- a/modules/iswa/util/iswamanager.cpp +++ b/modules/iswa/util/iswamanager.cpp @@ -106,11 +106,34 @@ void ISWAManager::addISWACygnet(int id, std::string info, int group){ createScreenSpace(id); }else if(id < 0){ //download metadata to texture plane - std::shared_ptr metadataFuture = downloadMetadata(id); - metadataFuture->guiType = info; - metadataFuture->id = id; - metadataFuture->group = group; - _metadataFutures.push_back(metadataFuture); + //std::shared_ptr metadataFuture = downloadMetadata(id); + std::shared_ptr metaFuture = std::make_shared(); + metaFuture->id = id; + metaFuture->group = group; + if(info == "TEXTURE"){ + metaFuture->type = CygnetType::Texture; + metaFuture->geom = CygnetGeometry::Plane; + } else if (info == "DATA") { + metaFuture->type = CygnetType::Data; + metaFuture->geom = CygnetGeometry::Plane; + } else { + LERROR("\""+ info + "\" is not a valid type"); + return; + } + + auto metadataCallback = + [this, metaFuture](const DownloadManager::FileFuture& f){ + LDEBUG("Download to memory finished"); + metaFuture->isFinished = true; + createPlane(metaFuture); + }; + + DlManager.downloadToMemory( + "http://128.183.168.116:3000/" + std::to_string(-id), + // "http://10.0.0.76:3000/" + std::to_string(-id), + metaFuture->json, + metadataCallback + ); }else{ //create kameleonplane createKameleonPlane(info); @@ -152,29 +175,6 @@ std::shared_ptr ISWAManager::downloadDataToMemory(i ); } -void ISWAManager::update(){ - for (auto it = _metadataFutures.begin(); it != _metadataFutures.end(); ){ - if((*it)->isFinished) { - if((*it)->guiType == "TEXTURE"){ - (*it)->type = CygnetType::Texture; - (*it)->geom = CygnetGeometry::Plane; - // (*it)->group = -1; - }else if ((*it)->guiType == "DATA"){ - (*it)->type = CygnetType::Data; - (*it)->geom = CygnetGeometry::Plane; - // (*it)->group = 1; - } else { - LERROR("\""+ (*it)->guiType + "\" is not a valid type"); - return; - } - createPlane((*it)); - it = _metadataFutures.erase( it ); - }else{ - ++it; - } - } -} - std::string ISWAManager::iSWAurl(int id, std::string type){ std::string url; if(id < 0){ diff --git a/modules/iswa/util/iswamanager.h b/modules/iswa/util/iswamanager.h index b3d08ebeba..2a1820e9fc 100644 --- a/modules/iswa/util/iswamanager.h +++ b/modules/iswa/util/iswamanager.h @@ -46,7 +46,6 @@ class ISWACygnet; struct MetadataFuture { int id; int group; - std::string guiType; std::string name; std::string json; int type; @@ -73,8 +72,6 @@ public: std::shared_ptr downloadImageToMemory(int id, std::string& buffer); std::shared_ptr downloadDataToMemory(int id, std::string& buffer); - void update(); - void registerToGroup(int id, ISWACygnet* cygnet, CygnetType type); void unregisterFromGroup(int id, ISWACygnet* cygnet); void registerOptionsToGroup(int id, const std::vector& options); @@ -97,8 +94,6 @@ private: std::map _type; std::map _geom; - std::vector> _metadataFutures; - std::map> _groups; }; diff --git a/src/engine/openspaceengine.cpp b/src/engine/openspaceengine.cpp index 32f466682c..2d567edaaf 100644 --- a/src/engine/openspaceengine.cpp +++ b/src/engine/openspaceengine.cpp @@ -652,8 +652,8 @@ void OpenSpaceEngine::preSynchronization() { void OpenSpaceEngine::postSynchronizationPreDraw() { Time::ref().postSynchronizationPreDraw(); - _scriptEngine->postSynchronizationPreDraw(); _renderEngine->postSynchronizationPreDraw(); + _scriptEngine->postSynchronizationPreDraw(); if (_isMaster && _gui->isEnabled() && _windowWrapper->isRegularRendering()) { glm::vec2 mousePosition = _windowWrapper->mousePosition(); diff --git a/src/scene/scene.cpp b/src/scene/scene.cpp index 08306a52a0..3daefa60b7 100644 --- a/src/scene/scene.cpp +++ b/src/scene/scene.cpp @@ -54,10 +54,6 @@ #include #endif -#ifdef OPENSPACE_MODULE_ISWA_ENABLED -#include -#endif - #include "scene_lua.inl" namespace { @@ -150,10 +146,6 @@ void Scene::update(const UpdateData& data) { // _graph.addSceneGraphNode(node); // ONCE = true; //} -#ifdef OPENSPACE_MODULE_ISWA_ENABLED - if(ISWAManager::isInitialized()) - ISWAManager::ref().update(); -#endif for (SceneGraphNode* node : _graph.nodes()) { try {