Download image in ISWAManager

This commit is contained in:
Sebastian Piwell
2016-03-31 11:18:22 -04:00
parent 100f1b75dd
commit b893c60d53
3 changed files with 18 additions and 14 deletions

View File

@@ -21,7 +21,6 @@
// * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
// * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
// ****************************************************************************************/
#include <modules/iswa/rendering/textureplane.h>
#include <openspace/engine/openspaceengine.h>
#include <openspace/rendering/renderengine.h>
@@ -157,20 +156,9 @@ void TexturePlane::setParent(){
}
void TexturePlane::updateTexture(){
int imageSize = 1024;
DownloadManager::FileFuture* future;
future = DlManager.downloadFile(
ISWAManager::ref().iSWAurl(_cygnetId.value()),
absPath(_path.value()),
true,
[](const DownloadManager::FileFuture& f){
std::cout<<"download finished"<<std::endl;
}
);
DownloadManager::FileFuture* future = ISWAManager::ref().downloadImage(_cygnetId.value(), absPath(_path.value()));
if(future){
_futureTexture = future;
imageSize-=1;
}
}

View File

@@ -68,6 +68,18 @@ namespace openspace{
return nullptr;
}
DownloadManager::FileFuture* ISWAManager::downloadImage(int id, std::string path){
return DlManager.downloadFile(
iSWAurl(id),
path,
true,
[](const DownloadManager::FileFuture& f){
std::cout<<"download finished"<<std::endl;
}
);
}
std::string ISWAManager::iSWAurl(int id){
std::string url = "http://iswa2.ccmc.gsfc.nasa.gov/IswaSystemWebApp/iSWACygnetStreamer?timestamp=";
std::string t = Time::ref().currentTimeUTC();

View File

@@ -27,6 +27,8 @@
#include <ghoul/designpattern/singleton.h>
#include <memory>
#include <map>
#include <openspace/engine/downloadmanager.h>
namespace openspace {
class ISWACygnet;
@@ -37,9 +39,11 @@ public:
ISWAManager();
~ISWAManager();
std::shared_ptr<ISWACygnet> createISWACygnet(std::string);
std::string iSWAurl(int);
DownloadManager::FileFuture* downloadImage(int, std::string);
void downloadData();
private:
std::string iSWAurl(int);
std::map<std::string, std::string> _month;
};