mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-05-11 22:10:07 -05:00
Removed path property
This commit is contained in:
@@ -24,8 +24,8 @@
|
||||
|
||||
namespace openspace{
|
||||
|
||||
CygnetPlane::CygnetPlane(std::string path)
|
||||
:ISWACygnet(path)
|
||||
CygnetPlane::CygnetPlane()
|
||||
:ISWACygnet()
|
||||
,_quad(0)
|
||||
,_vertexPositionBuffer(0)
|
||||
{}
|
||||
@@ -89,10 +89,6 @@ void CygnetPlane::update(){
|
||||
}
|
||||
}
|
||||
|
||||
// void CygnetPlane::loadTexture(){
|
||||
|
||||
// }
|
||||
|
||||
void CygnetPlane::createPlane(){
|
||||
// ============================
|
||||
// GEOMETRY (quad)
|
||||
@@ -120,7 +116,4 @@ void CygnetPlane::createPlane(){
|
||||
|
||||
}
|
||||
|
||||
} //namespace openspace
|
||||
// :ISWACygnet(path)
|
||||
// , _quad(0)
|
||||
// , _vertexPositionBuffer(0)
|
||||
} //namespace openspace
|
||||
@@ -32,7 +32,7 @@
|
||||
namespace openspace{
|
||||
class CygnetPlane : public ISWACygnet {
|
||||
public:
|
||||
CygnetPlane(std::string path);
|
||||
CygnetPlane();
|
||||
~CygnetPlane();
|
||||
|
||||
virtual bool initialize();
|
||||
|
||||
@@ -41,21 +41,30 @@ namespace {
|
||||
|
||||
namespace openspace {
|
||||
|
||||
DataPlane::DataPlane(std::shared_ptr<KameleonWrapper> kw, std::string path)
|
||||
:CygnetPlane(path)
|
||||
DataPlane::DataPlane(std::shared_ptr<KameleonWrapper> kw)
|
||||
:CygnetPlane()
|
||||
, _kw(kw)
|
||||
{
|
||||
_id = id();
|
||||
setName("DataPlane" + std::to_string(_id));
|
||||
registerProperties();
|
||||
|
||||
_fileExtension = ISWAManager::ref().fileExtension(_cygnetId.value());
|
||||
_path = "${OPENSPACE_DATA}/"+ name()+_fileExtension;
|
||||
|
||||
_cygnetId.onChange([this](){
|
||||
_fileExtension = ISWAManager::ref().fileExtension(_cygnetId.value());
|
||||
_path = "${OPENSPACE_DATA}/"+ name()+_fileExtension;
|
||||
updateTexture(); });
|
||||
|
||||
|
||||
KameleonWrapper::Model model = _kw->model();
|
||||
if( model == KameleonWrapper::Model::BATSRUS){
|
||||
_var = "p";
|
||||
}else{
|
||||
_var = "rho";
|
||||
}
|
||||
std::cout << name() << std::endl;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -187,7 +196,7 @@ void DataPlane::loadTexture() {
|
||||
std::unique_ptr<ghoul::opengl::Texture> texture =
|
||||
std::make_unique<ghoul::opengl::Texture>(_dataSlice, _dimensions, ghoul::opengl::Texture::Format::Red, GL_RED, GL_FLOAT, filtermode, wrappingmode);
|
||||
if (texture) {
|
||||
LDEBUG("Loaded texture from '" << absPath(_path) << "'");
|
||||
// LDEBUG("Loaded texture from '" << absPath(_path) << "'");
|
||||
|
||||
texture->uploadTexture();
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
|
||||
class DataPlane : public CygnetPlane {
|
||||
public:
|
||||
DataPlane(std::shared_ptr<KameleonWrapper> kw, std::string path);
|
||||
DataPlane(std::shared_ptr<KameleonWrapper> kw);
|
||||
~DataPlane();
|
||||
|
||||
virtual bool initialize();
|
||||
|
||||
@@ -31,10 +31,9 @@
|
||||
|
||||
namespace openspace{
|
||||
|
||||
ISWACygnet::ISWACygnet(std::string path)
|
||||
ISWACygnet::ISWACygnet()
|
||||
:_enabled("enabled", "Is Enabled", true)
|
||||
,_cygnetId("cygnetId", "CygnetID",7, 0, 10)
|
||||
,_path("path", "Path", path)
|
||||
,_updateInterval("updateInterval", "Update Interval", 3, 1, 10)
|
||||
,_shader(nullptr)
|
||||
,_texture(nullptr)
|
||||
@@ -42,7 +41,6 @@ ISWACygnet::ISWACygnet(std::string path)
|
||||
{
|
||||
addProperty(_enabled);
|
||||
addProperty(_cygnetId);
|
||||
addProperty(_path);
|
||||
addProperty(_updateInterval);
|
||||
}
|
||||
|
||||
@@ -78,7 +76,6 @@ void ISWACygnet::setPscUniforms(
|
||||
void ISWACygnet::registerProperties(){
|
||||
OsEng.gui()._property.registerProperty(&_enabled);
|
||||
OsEng.gui()._property.registerProperty(&_cygnetId);
|
||||
OsEng.gui()._property.registerProperty(&_path);
|
||||
OsEng.gui()._property.registerProperty(&_updateInterval);
|
||||
}
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
namespace openspace{
|
||||
class ISWACygnet : public properties::PropertyOwner{
|
||||
public:
|
||||
ISWACygnet(std::string path);
|
||||
ISWACygnet();
|
||||
~ISWACygnet();
|
||||
|
||||
virtual bool initialize();
|
||||
@@ -59,7 +59,6 @@ protected:
|
||||
|
||||
properties::BoolProperty _enabled;
|
||||
properties::IntProperty _cygnetId;
|
||||
properties::StringProperty _path;
|
||||
properties::FloatProperty _updateInterval;
|
||||
|
||||
std::unique_ptr<ghoul::opengl::ProgramObject> _shader;
|
||||
@@ -77,6 +76,9 @@ protected:
|
||||
double _lastUpdateTime = 0;
|
||||
std::map<std::string, std::string> _month;
|
||||
|
||||
std::string _fileExtension;
|
||||
std::string _path;
|
||||
|
||||
int _id;
|
||||
};
|
||||
|
||||
|
||||
@@ -41,16 +41,21 @@ namespace {
|
||||
|
||||
namespace openspace {
|
||||
|
||||
TexturePlane::TexturePlane(std::string path)
|
||||
:CygnetPlane(path)
|
||||
TexturePlane::TexturePlane()
|
||||
:CygnetPlane()
|
||||
,_futureTexture(nullptr)
|
||||
{
|
||||
_id = id();
|
||||
setName("TexturePlane" + std::to_string(_id));
|
||||
registerProperties();
|
||||
|
||||
_path.setValue("${OPENSPACE_DATA}/"+ name() + ".jpg");
|
||||
_cygnetId.onChange([this](){ updateTexture(); });
|
||||
_fileExtension = ISWAManager::ref().fileExtension(_cygnetId.value());
|
||||
_path = "${OPENSPACE_DATA}/"+ name()+_fileExtension;
|
||||
|
||||
_cygnetId.onChange([this](){
|
||||
_fileExtension = ISWAManager::ref().fileExtension(_cygnetId.value());
|
||||
_path = "${OPENSPACE_DATA}/"+ name()+_fileExtension;
|
||||
updateTexture(); });
|
||||
}
|
||||
|
||||
|
||||
@@ -88,7 +93,7 @@ bool TexturePlane::deinitialize(){
|
||||
_shader = nullptr;
|
||||
}
|
||||
|
||||
std::remove(absPath(_path.value()).c_str());
|
||||
std::remove(absPath(_path).c_str());
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -143,7 +148,7 @@ void TexturePlane::update(){
|
||||
CygnetPlane::update();
|
||||
|
||||
if(_futureTexture && _futureTexture->isFinished){
|
||||
_path.set(absPath("${OPENSPACE_DATA}/"+_futureTexture->filePath));
|
||||
_path = absPath("${OPENSPACE_DATA}/"+_futureTexture->filePath);
|
||||
loadTexture();
|
||||
|
||||
delete _futureTexture;
|
||||
@@ -156,11 +161,10 @@ void TexturePlane::setParent(){
|
||||
}
|
||||
|
||||
void TexturePlane::updateTexture(){
|
||||
DownloadManager::FileFuture* future = ISWAManager::ref().downloadImage(_cygnetId.value(), absPath(_path.value()));
|
||||
DownloadManager::FileFuture* future = ISWAManager::ref().downloadImage(_cygnetId.value(), absPath(_path));
|
||||
if(future){
|
||||
_futureTexture = future;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void TexturePlane::loadTexture() {
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
|
||||
class TexturePlane : public CygnetPlane{
|
||||
public:
|
||||
TexturePlane(std::string path);
|
||||
TexturePlane();
|
||||
~TexturePlane();
|
||||
|
||||
virtual bool initialize();
|
||||
|
||||
@@ -54,9 +54,9 @@ namespace openspace{
|
||||
|
||||
if(extension == "cdf"){
|
||||
std::shared_ptr<KameleonWrapper> kw = std::make_shared<KameleonWrapper>(absPath(path));
|
||||
cygnet = std::make_shared<DataPlane>(kw, path);
|
||||
cygnet = std::make_shared<DataPlane>(kw);
|
||||
} else {
|
||||
cygnet = std::make_shared<TexturePlane>(path);
|
||||
cygnet = std::make_shared<TexturePlane>();
|
||||
}
|
||||
|
||||
cygnet->initialize();
|
||||
@@ -69,6 +69,7 @@ namespace openspace{
|
||||
}
|
||||
|
||||
DownloadManager::FileFuture* ISWAManager::downloadImage(int id, std::string path){
|
||||
// extension = "I have changed it";
|
||||
return DlManager.downloadFile(
|
||||
iSWAurl(id),
|
||||
path,
|
||||
@@ -80,6 +81,12 @@ namespace openspace{
|
||||
|
||||
}
|
||||
|
||||
void ISWAManager::downloadData(){}
|
||||
|
||||
std::string ISWAManager::fileExtension(int id){
|
||||
return ".jpg";
|
||||
}
|
||||
|
||||
std::string ISWAManager::iSWAurl(int id){
|
||||
std::string url = "http://iswa2.ccmc.gsfc.nasa.gov/IswaSystemWebApp/iSWACygnetStreamer?timestamp=";
|
||||
std::string t = Time::ref().currentTimeUTC();
|
||||
|
||||
@@ -41,7 +41,7 @@ public:
|
||||
std::shared_ptr<ISWACygnet> createISWACygnet(std::string);
|
||||
DownloadManager::FileFuture* downloadImage(int, std::string);
|
||||
void downloadData();
|
||||
|
||||
std::string fileExtension(int);
|
||||
private:
|
||||
std::string iSWAurl(int);
|
||||
std::map<std::string, std::string> _month;
|
||||
|
||||
Reference in New Issue
Block a user