summaryrefslogtreecommitdiff
path: root/include/llmr
diff options
context:
space:
mode:
authorJustin R. Miller <incanus@codesorcery.net>2014-07-09 17:18:36 -0700
committerJustin R. Miller <incanus@codesorcery.net>2014-07-09 17:18:36 -0700
commit98a415416a35bb4a2c834361391b8855a0bca644 (patch)
tree9bd2dc4251258a213a162c3a77dad61630c62b1e /include/llmr
parente66ed8fea417ae3d81c676264e09e4526c018ebf (diff)
downloadqtlocation-mapboxgl-98a415416a35bb4a2c834361391b8855a0bca644.tar.gz
move to per-map access token
Diffstat (limited to 'include/llmr')
-rw-r--r--include/llmr/map/map.hpp3
-rw-r--r--include/llmr/map/source.hpp5
-rw-r--r--include/llmr/style/style.hpp4
-rw-r--r--include/llmr/style/style_parser.hpp5
4 files changed, 14 insertions, 3 deletions
diff --git a/include/llmr/map/map.hpp b/include/llmr/map/map.hpp
index 1af6b3c540..defc1bef1f 100644
--- a/include/llmr/map/map.hpp
+++ b/include/llmr/map/map.hpp
@@ -59,6 +59,8 @@ public:
void setDefaultTransitionDuration(uint64_t duration_milliseconds = 0);
void setStyleJSON(std::string newStyleJSON);
std::string getStyleJSON() const;
+ void setAccessToken(std::string access_token);
+ std::string getAccessToken() const;
// Transition
void cancelTransitions();
@@ -166,6 +168,7 @@ private:
Painter painter;
std::string styleJSON = "";
+ std::string accessToken = "";
bool debug = false;
timestamp animationTime = 0;
diff --git a/include/llmr/map/source.hpp b/include/llmr/map/source.hpp
index 2937a8f690..f746249252 100644
--- a/include/llmr/map/source.hpp
+++ b/include/llmr/map/source.hpp
@@ -23,7 +23,8 @@ class Texturepool;
class Source : public std::enable_shared_from_this<Source>, private util::noncopyable {
public:
Source(SourceType type = SourceType::Vector, const std::string &url = "",
- uint32_t tile_size = 512, uint32_t min_zoom = 0, uint32_t max_zoom = 22);
+ uint32_t tile_size = 512, uint32_t min_zoom = 0, uint32_t max_zoom = 22,
+ const std::string &access_token = "");
bool update(Map &map);
void updateMatrices(const mat4 &projMatrix, const TransformState &transform);
@@ -35,7 +36,7 @@ public:
std::forward_list<Tile::ID> getIDs() const;
void updateClipIDs(const std::map<Tile::ID, ClipID> &mapping);
- static std::string normalizeSourceURL(const std::string &url);
+ static std::string normalizeSourceURL(const std::string &url, const std::string &access_token);
public:
const SourceType type;
diff --git a/include/llmr/style/style.hpp b/include/llmr/style/style.hpp
index 37a50485ba..cfaba1898c 100644
--- a/include/llmr/style/style.hpp
+++ b/include/llmr/style/style.hpp
@@ -16,6 +16,7 @@
namespace llmr {
+class Map;
class Sprite;
class Source;
class StyleLayer;
@@ -27,7 +28,7 @@ public:
struct exception : std::runtime_error { exception(const char *msg) : std::runtime_error(msg) {} };
public:
- Style();
+ Style(Map &map);
void loadJSON(const uint8_t *const data);
@@ -63,6 +64,7 @@ private:
private:
+ Map &map;
std::set<std::shared_ptr<Source>> activeSources;
PropertyTransition defaultTransition;
bool initial_render_complete = false;
diff --git a/include/llmr/style/style_parser.hpp b/include/llmr/style/style_parser.hpp
index 10cd3d2e88..27dfd47579 100644
--- a/include/llmr/style/style_parser.hpp
+++ b/include/llmr/style/style_parser.hpp
@@ -17,6 +17,7 @@ namespace llmr {
enum class ClassID : uint32_t;
+class Map;
class StyleLayer;
class StyleLayerGroup;
@@ -24,6 +25,8 @@ class StyleParser {
public:
using JSVal = const rapidjson::Value&;
+ StyleParser(Map &map);
+
void parse(JSVal document);
std::shared_ptr<StyleLayerGroup> getLayers() {
@@ -92,6 +95,8 @@ private:
std::forward_list<Value> parseValues(JSVal values);
private:
+ Map &map;
+
std::unordered_map<std::string, const rapidjson::Value *> constants;
std::unordered_map<std::string, const std::shared_ptr<Source>> sources;