mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-05-01 00:09:58 -05:00
New dataprocessor classes works with IswaGroup
This commit is contained in:
@@ -29,10 +29,6 @@ function postInitialization()
|
||||
openspace.setPropertyValue("MilkyWay.renderable.segments", 50)
|
||||
|
||||
openspace.printInfo("Done setting default values")
|
||||
|
||||
--openspace.iswa.addCygnet(0,"x");
|
||||
--openspace.iswa.addCygnet(0,"y", "Kameleon");
|
||||
--openspace.iswa.addCygnet(0,"z", "Kameleon");
|
||||
|
||||
--openspace.iswa.addCygnet(-4,"Data");
|
||||
|
||||
@@ -40,10 +36,13 @@ function postInitialization()
|
||||
--openspace.iswa.addCygnet(-2,"Data");
|
||||
--openspace.iswa.addCygnet(-3,"Data");
|
||||
|
||||
--openspace.iswa.addCygnet(-3,"Data","GM");
|
||||
openspace.iswa.addCygnet(-3,"Data","GM");
|
||||
--openspace.iswa.addCygnet(-2,"Data","GM");
|
||||
--openspace.iswa.addCygnet(-1,"Data","GM");
|
||||
|
||||
--openspace.iswa.addCygnet(-3,"Texture","GM");
|
||||
openspace.iswa.addCygnet(-2,"Texture","GM");
|
||||
--openspace.iswa.addCygnet(-1,"Texture","GM");
|
||||
|
||||
openspace.iswa.addCdfFiles("${OPENSPACE_DATA}/cdflist.json");
|
||||
|
||||
|
||||
@@ -67,24 +67,25 @@ DataPlane::DataPlane(const ghoul::Dictionary& dictionary)
|
||||
addProperty(_backgroundValues);
|
||||
addProperty(_transferFunctionsFile);
|
||||
addProperty(_dataOptions);
|
||||
|
||||
_type = IswaManager::CygnetType::Data;
|
||||
}
|
||||
|
||||
DataPlane::~DataPlane(){}
|
||||
|
||||
bool DataPlane::initialize(){
|
||||
std::cout << "DataPlane: " << typeid(this).name() << std::endl;
|
||||
|
||||
IswaCygnet::initialize();
|
||||
|
||||
if(_group){
|
||||
_dataProcessor = _group->dataProcessor();
|
||||
auto groupEvent = _group->groupEvent();
|
||||
|
||||
_groupEvent->subscribe(name(), "useLogChanged", [&](const ghoul::Dictionary& dict){
|
||||
groupEvent->subscribe(name(), "useLogChanged", [&](const ghoul::Dictionary& dict){
|
||||
LDEBUG(name() + " Event useLogChanged");
|
||||
_useLog.setValue(dict.value<bool>("useLog"));
|
||||
});
|
||||
|
||||
_groupEvent->subscribe(name(), "normValuesChanged", [&](ghoul::Dictionary dict){
|
||||
groupEvent->subscribe(name(), "normValuesChanged", [&](ghoul::Dictionary dict){
|
||||
LDEBUG(name() + " Event normValuesChanged");
|
||||
std::shared_ptr<glm::vec2> values;
|
||||
bool success = dict.getValue("normValues", values);
|
||||
@@ -93,12 +94,12 @@ bool DataPlane::initialize(){
|
||||
}
|
||||
});
|
||||
|
||||
_groupEvent->subscribe(name(), "useHistogramChanged", [&](ghoul::Dictionary dict){
|
||||
groupEvent->subscribe(name(), "useHistogramChanged", [&](ghoul::Dictionary dict){
|
||||
LDEBUG(name() + " Event useHistogramChanged");
|
||||
_useHistogram.setValue(dict.value<bool>("useHistogram"));
|
||||
});
|
||||
|
||||
_groupEvent->subscribe(name(), "dataOptionsChanged", [&](ghoul::Dictionary dict){
|
||||
groupEvent->subscribe(name(), "dataOptionsChanged", [&](ghoul::Dictionary dict){
|
||||
LDEBUG(name() + " Event dataOptionsChanged");
|
||||
std::shared_ptr<std::vector<int> > values;
|
||||
bool success = dict.getValue("dataOptions", values);
|
||||
@@ -107,12 +108,12 @@ bool DataPlane::initialize(){
|
||||
}
|
||||
});
|
||||
|
||||
_groupEvent->subscribe(name(), "transferFunctionsChanged", [&](ghoul::Dictionary dict){
|
||||
groupEvent->subscribe(name(), "transferFunctionsChanged", [&](ghoul::Dictionary dict){
|
||||
LDEBUG(name() + " Event transferFunctionsChanged");
|
||||
_transferFunctionsFile.setValue(dict.value<std::string>("transferFunctions"));
|
||||
});
|
||||
|
||||
_groupEvent->subscribe(name(), "backgroundValuesChanged", [&](ghoul::Dictionary dict){
|
||||
groupEvent->subscribe(name(), "backgroundValuesChanged", [&](ghoul::Dictionary dict){
|
||||
LDEBUG(name() + " Event backgroundValuesChanged");
|
||||
std::shared_ptr<glm::vec2> values;
|
||||
bool success = dict.getValue("backgroundValues", values);
|
||||
@@ -121,12 +122,12 @@ bool DataPlane::initialize(){
|
||||
}
|
||||
});
|
||||
|
||||
_groupEvent->subscribe(name(), "autoFilterChanged", [&](ghoul::Dictionary dict){
|
||||
groupEvent->subscribe(name(), "autoFilterChanged", [&](ghoul::Dictionary dict){
|
||||
LDEBUG(name() + " Event autoFilterChanged");
|
||||
_autoFilter.setValue(dict.value<bool>("autoFilter"));
|
||||
});
|
||||
|
||||
_groupEvent->subscribe(name(), "updateGroup", [&](ghoul::Dictionary dict){
|
||||
groupEvent->subscribe(name(), "updateGroup", [&](ghoul::Dictionary dict){
|
||||
LDEBUG(name() + " Event updateGroup");
|
||||
loadTexture();
|
||||
});
|
||||
|
||||
@@ -61,8 +61,6 @@ DataSphere::DataSphere(const ghoul::Dictionary& dictionary)
|
||||
addProperty(_backgroundValues);
|
||||
addProperty(_transferFunctionsFile);
|
||||
addProperty(_dataOptions);
|
||||
|
||||
_type = IswaManager::CygnetType::Data;
|
||||
}
|
||||
|
||||
DataSphere::~DataSphere(){}
|
||||
@@ -72,13 +70,15 @@ bool DataSphere::initialize(){
|
||||
|
||||
if(_group){
|
||||
_dataProcessor = _group->dataProcessor();
|
||||
auto groupEvent = _group->groupEvent();
|
||||
|
||||
_groupEvent->subscribe(name(), "useLogChanged", [&](const ghoul::Dictionary& dict){
|
||||
|
||||
groupEvent->subscribe(name(), "useLogChanged", [&](const ghoul::Dictionary& dict){
|
||||
LDEBUG(name() + " Event useLogChanged");
|
||||
_useLog.setValue(dict.value<bool>("useLog"));
|
||||
});
|
||||
|
||||
_groupEvent->subscribe(name(), "normValuesChanged", [&](ghoul::Dictionary dict){
|
||||
groupEvent->subscribe(name(), "normValuesChanged", [&](ghoul::Dictionary dict){
|
||||
LDEBUG(name() + " Event normValuesChanged");
|
||||
std::shared_ptr<glm::vec2> values;
|
||||
bool success = dict.getValue("normValues", values);
|
||||
@@ -87,12 +87,12 @@ bool DataSphere::initialize(){
|
||||
}
|
||||
});
|
||||
|
||||
_groupEvent->subscribe(name(), "useHistogramChanged", [&](ghoul::Dictionary dict){
|
||||
groupEvent->subscribe(name(), "useHistogramChanged", [&](ghoul::Dictionary dict){
|
||||
LDEBUG(name() + " Event useHistogramChanged");
|
||||
_useHistogram.setValue(dict.value<bool>("useHistogram"));
|
||||
});
|
||||
|
||||
_groupEvent->subscribe(name(), "dataOptionsChanged", [&](ghoul::Dictionary dict){
|
||||
groupEvent->subscribe(name(), "dataOptionsChanged", [&](ghoul::Dictionary dict){
|
||||
LDEBUG(name() + " Event dataOptionsChanged");
|
||||
std::shared_ptr<std::vector<int> > values;
|
||||
bool success = dict.getValue("dataOptions", values);
|
||||
@@ -101,12 +101,12 @@ bool DataSphere::initialize(){
|
||||
}
|
||||
});
|
||||
|
||||
_groupEvent->subscribe(name(), "transferFunctionsChanged", [&](ghoul::Dictionary dict){
|
||||
groupEvent->subscribe(name(), "transferFunctionsChanged", [&](ghoul::Dictionary dict){
|
||||
LDEBUG(name() + " Event transferFunctionsChanged");
|
||||
_transferFunctionsFile.setValue(dict.value<std::string>("transferFunctions"));
|
||||
});
|
||||
|
||||
_groupEvent->subscribe(name(), "backgroundValuesChanged", [&](ghoul::Dictionary dict){
|
||||
groupEvent->subscribe(name(), "backgroundValuesChanged", [&](ghoul::Dictionary dict){
|
||||
LDEBUG(name() + " Event backgroundValuesChanged");
|
||||
std::shared_ptr<glm::vec2> values;
|
||||
bool success = dict.getValue("backgroundValues", values);
|
||||
@@ -115,12 +115,12 @@ bool DataSphere::initialize(){
|
||||
}
|
||||
});
|
||||
|
||||
_groupEvent->subscribe(name(), "autoFilterChanged", [&](ghoul::Dictionary dict){
|
||||
groupEvent->subscribe(name(), "autoFilterChanged", [&](ghoul::Dictionary dict){
|
||||
LDEBUG(name() + " Event autoFilterChanged");
|
||||
_autoFilter.setValue(dict.value<bool>("autoFilter"));
|
||||
});
|
||||
|
||||
_groupEvent->subscribe(name(), "updateGroup", [&](ghoul::Dictionary dict){
|
||||
groupEvent->subscribe(name(), "updateGroup", [&](ghoul::Dictionary dict){
|
||||
LDEBUG(name() + " Event updateGroup");
|
||||
loadTexture();
|
||||
});
|
||||
|
||||
@@ -28,6 +28,8 @@
|
||||
#include <openspace/scene/scenegraphnode.h>
|
||||
#include <openspace/util/time.h>
|
||||
#include <openspace/util/transformationmanager.h>
|
||||
#include <modules/iswa/rendering/iswagroup.h>
|
||||
|
||||
|
||||
namespace {
|
||||
const std::string _loggerCat = "IswaCygnet";
|
||||
@@ -40,8 +42,6 @@ IswaCygnet::IswaCygnet(const ghoul::Dictionary& dictionary)
|
||||
, _delete("delete", "Delete")
|
||||
,_alpha("alpha", "Alpha", 0.9f, 0.0f, 1.0f)
|
||||
, _shader(nullptr)
|
||||
,_type(IswaManager::CygnetType::NoType)
|
||||
,_groupEvent()
|
||||
,_group(nullptr)
|
||||
,_textureDirty(false)
|
||||
{
|
||||
@@ -134,7 +134,7 @@ bool IswaCygnet::initialize(){
|
||||
|
||||
bool IswaCygnet::deinitialize(){
|
||||
if(!_data->groupName.empty())
|
||||
_groupEvent->unsubscribe(name());
|
||||
_group->groupEvent()->unsubscribe(name());
|
||||
// IswaManager::ref().unregisterFromGroup(_data->groupName, this);
|
||||
|
||||
|
||||
@@ -244,21 +244,22 @@ void IswaCygnet::initializeTime(){
|
||||
}
|
||||
|
||||
void IswaCygnet::initializeGroup(){
|
||||
_groupEvent = IswaManager::ref().groupEvent(_data->groupName, _type);
|
||||
_group = IswaManager::ref().registerToGroup(_data->groupName, _type);
|
||||
// _groupEvent = IswaManager::ref().groupEvent(_data->groupName, _type);
|
||||
_group = IswaManager::ref().iswaGroup(_data->groupName);
|
||||
|
||||
//Subscribe to enable propert and delete
|
||||
_groupEvent->subscribe(name(), "enabledChanged", [&](const ghoul::Dictionary& dict){
|
||||
auto groupEvent = _group->groupEvent();
|
||||
groupEvent->subscribe(name(), "enabledChanged", [&](const ghoul::Dictionary& dict){
|
||||
LDEBUG(name() + " Event enabledChanged");
|
||||
_enabled.setValue(dict.value<bool>("enabled"));
|
||||
});
|
||||
|
||||
_groupEvent->subscribe(name(), "alphaChanged", [&](const ghoul::Dictionary& dict){
|
||||
groupEvent->subscribe(name(), "alphaChanged", [&](const ghoul::Dictionary& dict){
|
||||
LDEBUG(name() + " Event alphaChanged");
|
||||
_alpha.setValue(dict.value<float>("alpha"));
|
||||
});
|
||||
|
||||
_groupEvent->subscribe(name(), "clearGroup", [&](ghoul::Dictionary dict){
|
||||
groupEvent->subscribe(name(), "clearGroup", [&](ghoul::Dictionary dict){
|
||||
LDEBUG(name() + " Event clearGroup");
|
||||
OsEng.scriptEngine().queueScript("openspace.removeSceneGraphNode('" + name() + "')");
|
||||
});
|
||||
|
||||
@@ -121,11 +121,9 @@ protected:
|
||||
std::vector<std::shared_ptr<TransferFunction>> _transferFunctions;
|
||||
std::future<DownloadManager::MemoryFile> _futureObject;
|
||||
|
||||
std::shared_ptr<ghoul::Event<ghoul::Dictionary> > _groupEvent;
|
||||
|
||||
std::shared_ptr<IswaGroup> _group;
|
||||
|
||||
IswaManager::CygnetType _type;
|
||||
// IswaManager::CygnetType _type;
|
||||
bool _textureDirty;
|
||||
};
|
||||
|
||||
|
||||
@@ -27,6 +27,15 @@
|
||||
#include <fstream>
|
||||
#include <modules/iswa/ext/json/json.hpp>
|
||||
|
||||
#include <modules/iswa/util/dataprocessortext.h>
|
||||
#include <modules/iswa/util/dataprocessorjson.h>
|
||||
#include <modules/iswa/util/dataprocessorkameleon.h>
|
||||
|
||||
#include <modules/iswa/rendering/dataplane.h>
|
||||
#include <modules/iswa/rendering/datasphere.h>
|
||||
#include <modules/iswa/rendering/kameleonplane.h>
|
||||
|
||||
|
||||
namespace {
|
||||
const std::string _loggerCat = "IswaGroup";
|
||||
using json = nlohmann::json;
|
||||
@@ -34,8 +43,7 @@ namespace {
|
||||
}
|
||||
|
||||
namespace openspace {
|
||||
|
||||
IswaGroup::IswaGroup(std::string name, IswaManager::CygnetType type)
|
||||
IswaGroup::IswaGroup(std::string name, std::string type)
|
||||
:_enabled("enabled", "Enabled", true)
|
||||
,_alpha("alpha", "Alpha", 0.9f, 0.0f, 1.0f)
|
||||
,_useLog("useLog","Use Logarithm", false)
|
||||
@@ -48,8 +56,8 @@ IswaGroup::IswaGroup(std::string name, IswaManager::CygnetType type)
|
||||
,_dataOptions("dataOptions", "Data Options")
|
||||
,_fieldlines("fieldlineSeedsIndexFile", "Fieldline Seedpoints")
|
||||
,_fieldlineIndexFile("")
|
||||
,_type(type)
|
||||
,_registered(false)
|
||||
,_type(type)
|
||||
{
|
||||
setName(name);
|
||||
|
||||
@@ -67,11 +75,7 @@ IswaGroup::IswaGroup(std::string name, IswaManager::CygnetType type)
|
||||
|
||||
addProperty(_delete);
|
||||
|
||||
_dataProcessor = std::make_shared<DataProcessor>(
|
||||
_useLog.value(),
|
||||
_useHistogram.value(),
|
||||
_normValues
|
||||
);
|
||||
createDataProcessor();
|
||||
_groupEvent = std::make_shared<ghoul::Event<ghoul::Dictionary> >();
|
||||
registerProperties();
|
||||
}
|
||||
@@ -80,9 +84,10 @@ IswaGroup::~IswaGroup(){}
|
||||
|
||||
|
||||
void IswaGroup::registerOptions(const std::vector<properties::SelectionProperty::Option>& options){
|
||||
if(!_registered){
|
||||
registerProperties(); }
|
||||
if(_type == IswaManager::CygnetType::Data){
|
||||
if(!_registered)
|
||||
registerProperties();
|
||||
if(_type == typeid(DataPlane).name() || _type == typeid(DataSphere).name() ||
|
||||
_type == typeid(KameleonPlane).name()){
|
||||
if(_dataOptions.options().empty()){
|
||||
for(auto option : options){
|
||||
_dataOptions.addOption({option.value, option.description});
|
||||
@@ -106,8 +111,7 @@ void IswaGroup::setFieldlineInfo(std::string fieldlineIndexFile, std::string kam
|
||||
}
|
||||
}
|
||||
|
||||
bool IswaGroup::isType(IswaManager::CygnetType type){
|
||||
if(_type == IswaManager::CygnetType::NoType) return true;
|
||||
bool IswaGroup::isType(std::string type){
|
||||
return (_type == type);
|
||||
}
|
||||
|
||||
@@ -126,14 +130,14 @@ void IswaGroup::registerProperties(){
|
||||
});
|
||||
|
||||
|
||||
if(_type == IswaManager::CygnetType::Data){
|
||||
if(_type == typeid(DataPlane).name() || _type == typeid(DataSphere).name() ||
|
||||
_type == typeid(KameleonPlane).name() ){
|
||||
OsEng.gui()._iswa.registerProperty(&_useLog);
|
||||
OsEng.gui()._iswa.registerProperty(&_useHistogram);
|
||||
OsEng.gui()._iswa.registerProperty(&_autoFilter);
|
||||
OsEng.gui()._iswa.registerProperty(&_normValues);
|
||||
OsEng.gui()._iswa.registerProperty(&_backgroundValues);
|
||||
OsEng.gui()._iswa.registerProperty(&_transferFunctionsFile);
|
||||
OsEng.gui()._iswa.registerProperty(&_fieldlines);
|
||||
OsEng.gui()._iswa.registerProperty(&_dataOptions);
|
||||
|
||||
_useLog.onChange([this]{
|
||||
@@ -171,6 +175,11 @@ void IswaGroup::registerProperties(){
|
||||
_groupEvent->publish("dataOptionsChanged", ghoul::Dictionary({{"dataOptions", std::make_shared<std::vector<int> >(_dataOptions.value())}}));
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
if(_type == typeid(KameleonPlane).name()){
|
||||
OsEng.gui()._iswa.registerProperty(&_fieldlines);
|
||||
|
||||
_fieldlines.onChange([this]{
|
||||
updateFieldlineSeeds();
|
||||
// LDEBUG("Group " + name() + " published fieldlinesChanged");
|
||||
@@ -267,4 +276,14 @@ void IswaGroup::clearFieldlines(){
|
||||
}
|
||||
}
|
||||
|
||||
void IswaGroup::createDataProcessor(){
|
||||
if(_type == typeid(DataPlane).name()){
|
||||
_dataProcessor = std::make_shared<DataProcessorText>();
|
||||
}else if(_type == typeid(DataSphere).name()){
|
||||
_dataProcessor = std::make_shared<DataProcessorJson>();
|
||||
}else if(_type == typeid(KameleonPlane).name()){
|
||||
_dataProcessor = std::make_shared<DataProcessorKameleon>();
|
||||
}
|
||||
}
|
||||
|
||||
} //namespace openspace
|
||||
@@ -43,28 +43,24 @@ class IswaCygnet;
|
||||
class IswaGroup : public properties::PropertyOwner{
|
||||
public:
|
||||
IswaGroup(std::string name, IswaManager::CygnetType type);
|
||||
IswaGroup(std::string name, std::string type);
|
||||
~IswaGroup();
|
||||
//void registerCygnet(IswaCygnet* cygnet, IswaManager::CygnetType type);
|
||||
//void unregisterCygnet(IswaCygnet* cygnet);
|
||||
void registerOptions(const std::vector<properties::SelectionProperty::Option>& options);
|
||||
void registerFieldLineOptions(const std::vector<properties::SelectionProperty::Option>& options);
|
||||
bool isType(IswaManager::CygnetType type);
|
||||
bool isType(std::string type);
|
||||
|
||||
void clearGroup();
|
||||
void updateGroup();
|
||||
|
||||
std::shared_ptr<ghoul::Event<ghoul::Dictionary> > groupEvent(){ return _groupEvent; };
|
||||
std::shared_ptr<DataProcessor> dataProcessor();
|
||||
std::shared_ptr<ghoul::Event<ghoul::Dictionary> > groupEvent(){ return _groupEvent; };
|
||||
std::vector<int> fieldlineValue() {return _fieldlines.value();}
|
||||
std::vector<int> dataOptionsValue() {return _dataOptions.value();}
|
||||
void setFieldlineInfo(std::string fieldlineIndexFile, std::string kameleonPath);
|
||||
// bool useLog(){return _useLog.value();};
|
||||
// glm::vec2 normValues(){return _normValues.value();};
|
||||
// bool useHistogram(){return _useHistogram.value();};
|
||||
// std::vector<int> dataOptions(){return _dataOptions.value();};
|
||||
// std::string transferFunctionsFile(){return _transferFunctionsFile.value();};
|
||||
// glm::vec2 backgroundValues(){return _backgroundValues.value();};
|
||||
|
||||
private:
|
||||
void createDataProcessor();
|
||||
|
||||
void registerProperties();
|
||||
void unregisterProperties();
|
||||
|
||||
@@ -83,25 +79,17 @@ private:
|
||||
properties::SelectionProperty _dataOptions;
|
||||
properties::SelectionProperty _fieldlines;
|
||||
properties::TriggerProperty _delete;
|
||||
// properties::SelectionProperty _dataOptions;
|
||||
// properties::StringProperty _transferFunctionsFile;
|
||||
// properties::Vec2Property _normValues;
|
||||
// properties::Vec2Property _backgroundValues;
|
||||
// properties::BoolProperty _useLog;
|
||||
// properties::BoolProperty _useHistogram;;
|
||||
|
||||
// int groupId;
|
||||
// IswaCygnet cygnet;
|
||||
int _id;
|
||||
std::shared_ptr<ghoul::Event<ghoul::Dictionary> > _groupEvent;
|
||||
std::shared_ptr<DataProcessor> _dataProcessor;
|
||||
//std::vector<IswaCygnet* > _cygnets;
|
||||
IswaManager::CygnetType _type;
|
||||
|
||||
bool _registered;
|
||||
|
||||
std::string _fieldlineIndexFile;
|
||||
std::string _kameleonPath;
|
||||
std::map<int, std::tuple<std::string, std::string, bool> > _fieldlineState;
|
||||
std::string _type;
|
||||
};
|
||||
|
||||
} //namespace openspace
|
||||
|
||||
@@ -80,9 +80,6 @@ KameleonPlane::KameleonPlane(const ghoul::Dictionary& dictionary)
|
||||
addProperty(_dataOptions);
|
||||
addProperty(_fieldlines);
|
||||
|
||||
|
||||
_type = IswaManager::CygnetType::Data;
|
||||
|
||||
dictionary.getValue("kwPath", _kwPath);
|
||||
|
||||
std::string fieldlineIndexFile;
|
||||
@@ -138,13 +135,14 @@ bool KameleonPlane::initialize(){
|
||||
|
||||
if(_group){
|
||||
_dataProcessor = _group->dataProcessor();
|
||||
auto groupEvent = _group->groupEvent();
|
||||
|
||||
_groupEvent->subscribe(name(), "useLogChanged", [&](const ghoul::Dictionary& dict){
|
||||
groupEvent->subscribe(name(), "useLogChanged", [&](const ghoul::Dictionary& dict){
|
||||
LDEBUG(name() + " Event useLogChanged");
|
||||
_useLog.setValue(dict.value<bool>("useLog"));
|
||||
});
|
||||
|
||||
_groupEvent->subscribe(name(), "normValuesChanged", [&](ghoul::Dictionary dict){
|
||||
groupEvent->subscribe(name(), "normValuesChanged", [&](ghoul::Dictionary dict){
|
||||
LDEBUG(name() + " Event normValuesChanged");
|
||||
std::shared_ptr<glm::vec2> values;
|
||||
bool success = dict.getValue("normValues", values);
|
||||
@@ -153,12 +151,12 @@ bool KameleonPlane::initialize(){
|
||||
}
|
||||
});
|
||||
|
||||
_groupEvent->subscribe(name(), "useHistogramChanged", [&](ghoul::Dictionary dict){
|
||||
groupEvent->subscribe(name(), "useHistogramChanged", [&](ghoul::Dictionary dict){
|
||||
LDEBUG(name() + " Event useHistogramChanged");
|
||||
_useHistogram.setValue(dict.value<bool>("useHistogram"));
|
||||
});
|
||||
|
||||
_groupEvent->subscribe(name(), "dataOptionsChanged", [&](ghoul::Dictionary dict){
|
||||
groupEvent->subscribe(name(), "dataOptionsChanged", [&](ghoul::Dictionary dict){
|
||||
LDEBUG(name() + " Event dataOptionsChanged");
|
||||
std::shared_ptr<std::vector<int> > values;
|
||||
bool success = dict.getValue("dataOptions", values);
|
||||
@@ -167,12 +165,12 @@ bool KameleonPlane::initialize(){
|
||||
}
|
||||
});
|
||||
|
||||
_groupEvent->subscribe(name(), "transferFunctionsChanged", [&](ghoul::Dictionary dict){
|
||||
groupEvent->subscribe(name(), "transferFunctionsChanged", [&](ghoul::Dictionary dict){
|
||||
LDEBUG(name() + " Event transferFunctionsChanged");
|
||||
_transferFunctionsFile.setValue(dict.value<std::string>("transferFunctions"));
|
||||
});
|
||||
|
||||
_groupEvent->subscribe(name(), "backgroundValuesChanged", [&](ghoul::Dictionary dict){
|
||||
groupEvent->subscribe(name(), "backgroundValuesChanged", [&](ghoul::Dictionary dict){
|
||||
LDEBUG(name() + " Event backgroundValuesChanged");
|
||||
std::shared_ptr<glm::vec2> values;
|
||||
bool success = dict.getValue("backgroundValues", values);
|
||||
@@ -181,12 +179,12 @@ bool KameleonPlane::initialize(){
|
||||
}
|
||||
});
|
||||
|
||||
_groupEvent->subscribe(name(), "autoFilterChanged", [&](ghoul::Dictionary dict){
|
||||
groupEvent->subscribe(name(), "autoFilterChanged", [&](ghoul::Dictionary dict){
|
||||
LDEBUG(name() + " Event autoFilterChanged");
|
||||
_autoFilter.setValue(dict.value<bool>("autoFilter"));
|
||||
});
|
||||
|
||||
_groupEvent->subscribe(name(), "updateGroup", [&](ghoul::Dictionary dict){
|
||||
groupEvent->subscribe(name(), "updateGroup", [&](ghoul::Dictionary dict){
|
||||
LDEBUG(name() + " Event updateGroup");
|
||||
loadTexture();
|
||||
});
|
||||
|
||||
@@ -47,9 +47,6 @@ TexturePlane::TexturePlane(const ghoul::Dictionary& dictionary)
|
||||
dictionary.getValue("Name", name);
|
||||
setName(name);
|
||||
registerProperties();
|
||||
|
||||
_type = IswaManager::CygnetType::Texture;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -69,6 +69,10 @@ IswaManager::IswaManager()
|
||||
_type[CygnetType::Texture] = "Texture";
|
||||
_type[CygnetType::Data] = "Data";
|
||||
_type[CygnetType::Kameleon] = "Kameleon";
|
||||
// _type[CygnetType::TexturePlane] = "TexturePlane";
|
||||
// _type[CygnetType::DataPlane] = "DataPlane";
|
||||
// _type[CygnetType::KameleonPlane] = "KameleonPlane";
|
||||
// _type[CygnetType::Kameleon] = "DataSphere";
|
||||
|
||||
_geom[CygnetGeometry::Plane] = "Plane";
|
||||
_geom[CygnetGeometry::Sphere] = "Sphere";
|
||||
@@ -212,41 +216,14 @@ std::string IswaManager::iswaUrl(int id, std::string type){
|
||||
return url;
|
||||
}
|
||||
|
||||
std::shared_ptr<ghoul::Event<ghoul::Dictionary> > IswaManager::groupEvent(std::string groupName, CygnetType type){
|
||||
|
||||
// Do some type checking and get the groupEvent
|
||||
void IswaManager::registerGroup(std::string groupName, std::string type){
|
||||
if(_groups.find(groupName) == _groups.end()){
|
||||
_groups.insert(std::pair<std::string, std::shared_ptr<IswaGroup>>(groupName, std::make_shared<IswaGroup>(groupName, type)));
|
||||
} else if(!_groups[groupName]->isType(type)){
|
||||
LWARNING("Can't subscribe to Events from groups with diffent type");
|
||||
return nullptr;
|
||||
LWARNING("Can't add cygnet to groups with diffent type");
|
||||
}
|
||||
|
||||
return _groups[groupName]->groupEvent();
|
||||
}
|
||||
|
||||
std::shared_ptr<IswaGroup> IswaManager::registerToGroup(std::string groupName, CygnetType type){
|
||||
if(_groups.find(groupName) == _groups.end()){
|
||||
_groups.insert(std::pair<std::string, std::shared_ptr<IswaGroup>>(groupName, std::make_shared<IswaGroup>(groupName, type)));
|
||||
} else if(!_groups[groupName]->isType(type)){
|
||||
LWARNING("Can't subscribe to Events from groups with diffent type");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return _groups[groupName];
|
||||
}
|
||||
|
||||
// void IswaManager::unregisterFromGroup(std::string name, IswaCygnet* cygnet){
|
||||
// if(_groups.find(name) != _groups.end()){
|
||||
// _groups[name]->unregisterCygnet(cygnet);
|
||||
// }
|
||||
// }
|
||||
|
||||
// void IswaManager::registerOptionsToGroup(std::string name, const std::vector<properties::SelectionProperty::Option>& options){
|
||||
// if(_groups.find(name) != _groups.end()){
|
||||
// _groups[name]->registerOptions(options);
|
||||
// }
|
||||
// }
|
||||
|
||||
std::shared_ptr<IswaGroup> IswaManager::iswaGroup(std::string name){
|
||||
if(_groups.find(name) != _groups.end()){
|
||||
@@ -382,7 +359,7 @@ std::string IswaManager::parseKWToLuaTable(CdfInfo info, std::string cut){
|
||||
"kwPath = '" + info.path + "' ,"
|
||||
"axisCut = '"+cut+"',"
|
||||
"CoordinateType = '" + coordinateType + "', "
|
||||
// "Group = '"+ info.group + "',"
|
||||
"Group = '"+ info.group + "',"
|
||||
"Group = '',"
|
||||
"fieldlineSeedsIndexFile = '"+info.fieldlineSeedsIndexFile+"'"
|
||||
"}"
|
||||
@@ -451,12 +428,26 @@ void IswaManager::createScreenSpace(int id){
|
||||
|
||||
void IswaManager::createPlane(std::shared_ptr<MetadataFuture> data){
|
||||
// check if this plane already exist
|
||||
std::cout << "IswaManager: " << typeid(DataPlane).name() << std::endl;
|
||||
|
||||
std::string name = _type[data->type] + _geom[data->geom] + std::to_string(data->id);
|
||||
|
||||
if(!data->group.empty()){
|
||||
std::string type;
|
||||
if(data->type == CygnetType::Data){
|
||||
type = typeid(DataPlane).name();
|
||||
}else{
|
||||
type = typeid(TexturePlane).name();
|
||||
}
|
||||
|
||||
registerGroup(data->group, type);
|
||||
|
||||
auto it = _groups.find(data->group);
|
||||
if(it == _groups.end() || (*it).second->isType((CygnetType) data->type))
|
||||
if(it == _groups.end() || (*it).second->isType(type)){
|
||||
name = data->group +"_"+ name;
|
||||
}else{
|
||||
data->group="";
|
||||
}
|
||||
}
|
||||
|
||||
data->name = name;
|
||||
@@ -478,9 +469,14 @@ void IswaManager::createSphere(std::shared_ptr<MetadataFuture> data){
|
||||
std::string name = _type[data->type] + _geom[data->geom] + std::to_string(data->id);
|
||||
|
||||
if(!data->group.empty()){
|
||||
std::string type = typeid(DataSphere).name();
|
||||
|
||||
auto it = _groups.find(data->group);
|
||||
if(it == _groups.end() || (*it).second->isType((CygnetType) data->type))
|
||||
if(it == _groups.end() || (*it).second->isType(type)){
|
||||
name = data->group +"_"+name;
|
||||
}else{
|
||||
data->group="";
|
||||
}
|
||||
}
|
||||
|
||||
data->name = name;
|
||||
|
||||
@@ -94,8 +94,8 @@ public:
|
||||
std::string iswaUrl(int id, std::string type = "image");
|
||||
|
||||
std::shared_ptr<ghoul::Event<ghoul::Dictionary> > groupEvent(std::string name, CygnetType type);
|
||||
std::shared_ptr<IswaGroup> registerToGroup(std::string name, CygnetType type);
|
||||
void unregisterFromGroup(std::string name, IswaCygnet* cygnet);
|
||||
// std::shared_ptr<IswaGroup> getIswaGroup(std::string groupName, CygnetType type);
|
||||
// void unregisterFromGroup(std::string name, IswaCygnet* cygnet);
|
||||
// void registerOptionsToGroup(std::string name, const std::vector<properties::SelectionProperty::Option>& options);
|
||||
std::shared_ptr<IswaGroup> iswaGroup(std::string name);
|
||||
|
||||
@@ -124,6 +124,8 @@ private:
|
||||
|
||||
void fillCygnetInfo(std::string jsonString);
|
||||
|
||||
void registerGroup(std::string groupName, std::string type);
|
||||
|
||||
std::map<std::string, std::string> _month;
|
||||
std::map<int, std::string> _type;
|
||||
std::map<int, std::string> _geom;
|
||||
|
||||
Reference in New Issue
Block a user