diff --git a/modules/iswa/CMakeLists.txt b/modules/iswa/CMakeLists.txt index c7143d0b32..064d47aa59 100644 --- a/modules/iswa/CMakeLists.txt +++ b/modules/iswa/CMakeLists.txt @@ -26,7 +26,6 @@ include(${OPENSPACE_CMAKE_EXT_DIR}/module_definition.cmake) set(HEADER_FILES ${CMAKE_CURRENT_SOURCE_DIR}/rendering/iswacontainer.h - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/iswagroup.h ${CMAKE_CURRENT_SOURCE_DIR}/rendering/cygnetplane.h ${CMAKE_CURRENT_SOURCE_DIR}/rendering/iswacygnet.h ${CMAKE_CURRENT_SOURCE_DIR}/rendering/dataplane.h @@ -35,12 +34,12 @@ set(HEADER_FILES ${CMAKE_CURRENT_SOURCE_DIR}/rendering/screenspacecygnet.h ${CMAKE_CURRENT_SOURCE_DIR}/rendering/colorbar.h ${CMAKE_CURRENT_SOURCE_DIR}/util/iswamanager.h + ${CMAKE_CURRENT_SOURCE_DIR}/rendering/iswagroup.h ) source_group("Header Files" FILES ${HEADER_FILES}) set(SOURCE_FILES ${CMAKE_CURRENT_SOURCE_DIR}/rendering/iswacontainer.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/iswagroup.cpp ${CMAKE_CURRENT_SOURCE_DIR}/rendering/iswacygnet.cpp ${CMAKE_CURRENT_SOURCE_DIR}/rendering/cygnetplane.cpp ${CMAKE_CURRENT_SOURCE_DIR}/rendering/dataplane.cpp @@ -49,6 +48,7 @@ set(SOURCE_FILES ${CMAKE_CURRENT_SOURCE_DIR}/rendering/screenspacecygnet.cpp ${CMAKE_CURRENT_SOURCE_DIR}/rendering/colorbar.cpp ${CMAKE_CURRENT_SOURCE_DIR}/util/iswamanager.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/rendering/iswagroup.cpp ) source_group("Source Files" FILES ${SOURCE_FILES}) diff --git a/modules/iswa/rendering/dataplane.cpp b/modules/iswa/rendering/dataplane.cpp index c7f339b0cb..05a6c519e1 100644 --- a/modules/iswa/rendering/dataplane.cpp +++ b/modules/iswa/rendering/dataplane.cpp @@ -86,7 +86,7 @@ DataPlane::DataPlane(const ghoul::Dictionary& dictionary) setTransferFunctions(_transferFunctionsFile.value()); }); - + _type = ISWAManager::CygnetType::Data; } DataPlane::~DataPlane(){} @@ -118,7 +118,7 @@ bool DataPlane::initialize(){ // } // _textures.push_back(nullptr); - ISWAManager::ref().registerToGroup(_data->groupId, this, "data"); + ISWAManager::ref().registerToGroup(_data->groupId, this, _type); return isReady(); @@ -303,9 +303,10 @@ void DataPlane::readHeader(){ break; } } - }else{ - LWARNING("Noting in memory buffer, are you connected to the information super highway?"); } + // else{ + // LWARNING("Noting in memory buffer, are you connected to the information super highway?"); + // } } std::vector DataPlane::readData(){ @@ -396,10 +397,10 @@ std::vector DataPlane::readData(){ return data; } - else { - LWARNING("Nothing in memory buffer, are you connected to the information super highway?"); - return std::vector(); - } + // else { + // LWARNING("Nothing in memory buffer, are you connected to the information super highway?"); + // return std::vector(); + // } } diff --git a/modules/iswa/rendering/iswacygnet.h b/modules/iswa/rendering/iswacygnet.h index 70dd2f9880..6d7d02bae0 100644 --- a/modules/iswa/rendering/iswacygnet.h +++ b/modules/iswa/rendering/iswacygnet.h @@ -104,7 +104,7 @@ protected: std::vector> _transferFunctions; - + ISWAManager::CygnetType _type; }; }//namespace openspace diff --git a/modules/iswa/rendering/iswagroup.cpp b/modules/iswa/rendering/iswagroup.cpp index a59a2cf1c2..f3be2c4548 100644 --- a/modules/iswa/rendering/iswagroup.cpp +++ b/modules/iswa/rendering/iswagroup.cpp @@ -22,12 +22,15 @@ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * ****************************************************************************************/ #include -#include #include +namespace { + const std::string _loggerCat = "ISWAGroup"; +} + namespace openspace { -ISWAGroup::ISWAGroup(int id, std::string type) +ISWAGroup::ISWAGroup(int id, ISWAManager::CygnetType type) :_enabled("enabled", "Enabled", true) ,_useLog("useLog","Use Logarithm", false) ,_useHistogram("_useHistogram", "Use Histogram", true) @@ -47,7 +50,7 @@ ISWAGroup::ISWAGroup(int id, std::string type) cygnet->enabled(_enabled.value()); }); - if(type == "data"){ + if(type == ISWAManager::CygnetType::Data){ addProperty(_useLog); addProperty(_useHistogram); addProperty(_normValues); @@ -98,8 +101,13 @@ ISWAGroup::~ISWAGroup(){ _cygnets.clear(); } -void ISWAGroup::registerCygnet(ISWACygnet* cygnet, std::string type){ - if(type == "data"){ +void ISWAGroup::registerCygnet(ISWACygnet* cygnet, ISWAManager::CygnetType type){ + if(type != _type){ + LERROR("Can't register cygnet with a different class from the group"); + return; + } + + if(type == ISWAManager::CygnetType::Data){ DataPlane* dataplane = static_cast(cygnet); dataplane->useLog(_useLog.value()); @@ -125,7 +133,7 @@ void ISWAGroup::unregisterCygnet(ISWACygnet* cygnet){ void ISWAGroup::registerOptions(const std::vector& options){ - if(_type == "data"){ + if(_type == ISWAManager::CygnetType::Data){ if(_dataOptions.options().empty()){ for(auto option : options){ _dataOptions.addOption(option); diff --git a/modules/iswa/rendering/iswagroup.h b/modules/iswa/rendering/iswagroup.h index 992154b9ba..df96a8ce3d 100644 --- a/modules/iswa/rendering/iswagroup.h +++ b/modules/iswa/rendering/iswagroup.h @@ -30,17 +30,21 @@ #include #include #include +// #include +#include + namespace openspace{ class ISWACygnet; class ISWAGroup : public properties::PropertyOwner{ public: - ISWAGroup(int id, std::string type); + ISWAGroup(int id, ISWAManager::CygnetType type); ~ISWAGroup(); - void registerCygnet(ISWACygnet* cygnet, std::string type); + void registerCygnet(ISWACygnet* cygnet, ISWAManager::CygnetType type); void unregisterCygnet(ISWACygnet* cygnet); void registerOptions(const std::vector& options); + private: properties::BoolProperty _enabled; @@ -60,7 +64,7 @@ private: // int groupId; // ISWACygnet cygnet; std::vector _cygnets; - std::string _type; + ISWAManager::CygnetType _type; }; } //namespace openspace diff --git a/modules/iswa/util/iswamanager.cpp b/modules/iswa/util/iswamanager.cpp index edee591d22..d19259d3cd 100644 --- a/modules/iswa/util/iswamanager.cpp +++ b/modules/iswa/util/iswamanager.cpp @@ -22,7 +22,7 @@ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * ****************************************************************************************/ #include -#include + #include #include #include @@ -32,6 +32,8 @@ #include #include #include +#include +#include namespace { using json = nlohmann::json; @@ -86,7 +88,7 @@ namespace openspace{ _metadataFutures.push_back(metadataFuture); }else{ //create kameleonplane - createKameleonPlane(info, -1); + createKameleonPlane(info); } } @@ -129,7 +131,7 @@ namespace openspace{ for (auto it = _metadataFutures.begin(); it != _metadataFutures.end(); ){ if((*it)->isFinished) { if((*it)->type == "TEXTURE"){ - createPlane((*it)->id,(*it)->json,std::string("TexturePlane"), -1); + createPlane((*it)->id,(*it)->json, std::string("TexturePlane")); }else if ((*it)->type == "DATA"){ createPlane((*it)->id,(*it)->json,std::string("DataPlane"), 1); } else { @@ -328,7 +330,7 @@ namespace openspace{ } } - void ISWAManager::registerToGroup(int id, ISWACygnet* cygnet, std::string type){ + void ISWAManager::registerToGroup(int id, ISWACygnet* cygnet, CygnetType type){ if(_groups.find(id) != _groups.end()){ _groups[id]->registerCygnet(cygnet, type); }else{ @@ -344,6 +346,12 @@ namespace openspace{ } } + void ISWAManager::registerOptionsToGroup(int id, const std::vector& options){ + if(_groups.find(id) != _groups.end()){ + _groups[id]->registerOptions(options); + } + } + std::shared_ptr ISWAManager::iSWAGroup(std::string name){ for(auto group : _groups){ if(group.second->name() == name){ @@ -354,10 +362,4 @@ namespace openspace{ return nullptr; } - void ISWAManager::registerOptionsToGroup(int id, const std::vector& options){ - if(_groups.find(id) != _groups.end()){ - _groups[id]->registerOptions(options); - } - } - }// namsepace openspace \ No newline at end of file diff --git a/modules/iswa/util/iswamanager.h b/modules/iswa/util/iswamanager.h index 534f091050..72586a0a55 100644 --- a/modules/iswa/util/iswamanager.h +++ b/modules/iswa/util/iswamanager.h @@ -25,7 +25,6 @@ #define __ISWAMANAGER_H__ #include -#include #include #include #include @@ -33,10 +32,14 @@ #include #include #include +// #include +// #include + namespace openspace { -class ISWACygnet; class ISWAGroup; +class ISWACygnet; + struct MetadataFuture { int id; @@ -50,6 +53,7 @@ class ISWAManager : public ghoul::Singleton { friend class ghoul::Singleton; public: + enum CygnetType {Texture, Data}; ISWAManager(); ~ISWAManager(); @@ -64,7 +68,7 @@ public: void update(); - void registerToGroup(int id, ISWACygnet* cygnet, std::string type); + void registerToGroup(int id, ISWACygnet* cygnet, CygnetType type); void unregisterFromGroup(int id, ISWACygnet* cygnet); void registerOptionsToGroup(int id, const std::vector& options); std::shared_ptr iSWAGroup(std::string name); @@ -75,9 +79,9 @@ private: std::string parseJSONToLuaTable(int id, std::string name, std::string json, std::string type, int group); std::string parseKWToLuaTable(std::string kwPath, int group); - void createPlane(int id, std::string json, std::string type, int group); + void createPlane(int id, std::string json, std::string type, int group = -1); void createScreenSpace(int id); - void createKameleonPlane(std::string kwPath, int group); + void createKameleonPlane(std::string kwPath, int group = -1); std::map _month; std::vector> _metadataFutures; diff --git a/src/query/query.cpp b/src/query/query.cpp index 202d9f18ec..af63050b09 100644 --- a/src/query/query.cpp +++ b/src/query/query.cpp @@ -33,7 +33,7 @@ #include #include #include - +#include namespace openspace {