removed iswamanager update function and create cygnet through scripts instead

This commit is contained in:
Michael Nilsson
2016-05-03 15:07:22 -04:00
parent 2f7d2e294f
commit f05672436e
4 changed files with 29 additions and 42 deletions

View File

@@ -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> metadataFuture = downloadMetadata(id);
metadataFuture->guiType = info;
metadataFuture->id = id;
metadataFuture->group = group;
_metadataFutures.push_back(metadataFuture);
//std::shared_ptr<MetadataFuture> metadataFuture = downloadMetadata(id);
std::shared_ptr<MetadataFuture> metaFuture = std::make_shared<MetadataFuture>();
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<DownloadManager::FileFuture> 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){

View File

@@ -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<DownloadManager::FileFuture> downloadImageToMemory(int id, std::string& buffer);
std::shared_ptr<DownloadManager::FileFuture> 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<properties::SelectionProperty::Option>& options);
@@ -97,8 +94,6 @@ private:
std::map<int, std::string> _type;
std::map<int, std::string> _geom;
std::vector<std::shared_ptr<MetadataFuture>> _metadataFutures;
std::map<int, std::shared_ptr<ISWAGroup>> _groups;
};

View File

@@ -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();

View File

@@ -54,10 +54,6 @@
#include <modules/onscreengui/include/gui.h>
#endif
#ifdef OPENSPACE_MODULE_ISWA_ENABLED
#include <modules/iswa/util/iswamanager.h>
#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 {