Line data Source code
1 : /****************************************************************************** 2 : * 3 : * Project: Earth Engine Data API Images driver 4 : * Purpose: Earth Engine Data API Images driver 5 : * Author: Even Rouault, even dot rouault at spatialys.com 6 : * 7 : ****************************************************************************** 8 : * Copyright (c) 2017-2018, Planet Labs 9 : * 10 : * SPDX-License-Identifier: MIT 11 : ****************************************************************************/ 12 : 13 : #ifndef EEDA_H_INCLUDED 14 : #define EEDA_H_INCLUDED 15 : 16 : #include "cpl_string.h" 17 : #include "gdal.h" 18 : #include "cpl_json_header.h" 19 : #undef TRUE 20 : #define TRUE 1 21 : #undef FALSE 22 : #define FALSE 0 23 : #include "gdal_priv.h" 24 : #include "cpl_http.h" 25 : #include <vector> 26 : #include <map> 27 : 28 : CPLHTTPResult *EEDAHTTPFetch(const char *pszURL, char **papszOptions); 29 : 30 : /************************************************************************/ 31 : /* EEDAIBandDesc */ 32 : /************************************************************************/ 33 : 34 : class EEDAIBandDesc 35 : { 36 : public: 37 : CPLString osName{}; 38 : CPLString osWKT{}; 39 : GDALDataType eDT{GDT_Unknown}; 40 : GDALGeoTransform gt{}; 41 : int nWidth{0}; 42 : int nHeight{0}; 43 : 44 : /* Check if it similar enough for being considered as a compatible */ 45 : /* GDAL band in the same dataset */ 46 25 : bool IsSimilar(const EEDAIBandDesc &oOther) const 47 : { 48 50 : return osWKT == oOther.osWKT && gt == oOther.gt && 49 50 : nWidth == oOther.nWidth && nHeight == oOther.nHeight; 50 : } 51 : }; 52 : 53 : std::vector<EEDAIBandDesc> 54 : BuildBandDescArray(json_object *poBands, 55 : std::map<CPLString, CPLString> &oMapCodeToWKT); 56 : 57 : /************************************************************************/ 58 : /* GDALEEDABaseDataset */ 59 : /************************************************************************/ 60 : 61 : class GDALEEDABaseDataset CPL_NON_FINAL : public GDALDataset 62 : { 63 : protected: 64 : bool m_bMustCleanPersistent; 65 : CPLString m_osBaseURL{}; 66 : CPLString m_osBearer{}; 67 : GIntBig m_nExpirationTime; 68 : 69 : char **GetBaseHTTPOptions(); 70 : static CPLString ConvertPathToName(const CPLString &path); 71 : 72 : public: 73 : GDALEEDABaseDataset(); 74 : virtual ~GDALEEDABaseDataset(); 75 : 76 : const CPLString &GetBaseURL() const 77 : { 78 : return m_osBaseURL; 79 : } 80 : }; 81 : 82 : #endif // EEDA_H_INCLUDED