1#include "OGC3DTilesAccessParser.h"
6#include <Serialization/JsonParser.h>
8#include <Foundation/Logging/Logger.h>
13 const std::string ACCESS_FILE_NAME =
"/access.json";
22 Document doc = parseJson(json, JsonParseFlags::None);
23 accessData->type = doc[
"type"].GetString();
24 accessData->url = doc[
"url"].GetString();
25 accessData->attributionsJSON =
"FIXME";
27 accessData->bearerToken = doc[
"accessToken"].GetString();
37Cogs::Core::DataFetcherManager::FetchId
38OGC3DTilesAccessParser::fetch(
Context* context,
const std::string& baseURL, OGC3DTilesAccessParser::FetchCallback callback)
40 std::string url = baseURL + ACCESS_FILE_NAME;
42 Cogs::Core::DataFetcherManager::FetchId fetchId = DataFetcherManager::fetchAsync(context, url,
43 [context, callback, url](std::unique_ptr<Cogs::FileContents> data) {
44 TilesAccess* accessData =
nullptr;
46 accessData = new TilesAccess;
47 Memory::MemoryBuffer contentsBuff = data->take();
48 std::string_view jsonStr = std::string_view(static_cast<const char*>(contentsBuff.data()), contentsBuff.size());
49 bool success = parseJSON(jsonStr, accessData);
56 LOG_ERROR(logger,
"Failed fetching TileAccess data from '%s'", url.c_str());
59 auto finishTask = [callback, accessData]() {
63#if defined(EMSCRIPTEN)
68 context->
engine->runTaskInMainThread(std::move(finishTask));
A Context instance contains all the services, systems and runtime components needed to use Cogs.
std::unique_ptr< class Engine > engine
Engine instance.
Log implementation class.
Contains the Engine, Renderer, resource managers and other systems needed to run Cogs....
constexpr Log getLogger(const char(&name)[LEN]) noexcept