break out StyleSource from Source, move getActiveSources and
updateSources into Map::Map, move getAccessToken from Style to Map Conflicts: include/llmr/style/style.hpp src/map/source.cpp src/style/style_layer.cpp src/style/style_parser.cpp Conflicts: include/llmr/map/source.hpp include/llmr/style/style_parser.hpp include/llmr/style/style_source.hpp src/map/map.cpp src/map/source.cpp src/style/style_parser.cpp
This commit is contained in:
@@ -23,7 +23,7 @@ class Texturepool;
|
||||
|
||||
class Source : public std::enable_shared_from_this<Source>, private util::noncopyable {
|
||||
public:
|
||||
Source(StyleSource style_source);
|
||||
Source(StyleSource style_source, const std::string &access_token = "");
|
||||
Source(SourceType type = SourceType::Vector, const std::string &url = "",
|
||||
uint32_t tile_size = 512, uint32_t min_zoom = 0, uint32_t max_zoom = 22);
|
||||
|
||||
|
||||
@@ -24,6 +24,8 @@ class StyleParser {
|
||||
public:
|
||||
using JSVal = const rapidjson::Value&;
|
||||
|
||||
StyleParser();
|
||||
|
||||
void parse(JSVal document);
|
||||
|
||||
std::shared_ptr<StyleLayerGroup> getLayers() {
|
||||
|
||||
@@ -20,7 +20,7 @@ struct StyleSource {
|
||||
url(url),
|
||||
tile_size(tile_size),
|
||||
min_zoom(min_zoom),
|
||||
max_zoom(max_zoom) {};
|
||||
max_zoom(max_zoom) {}
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -422,7 +422,7 @@ void Map::updateSources(const std::shared_ptr<StyleLayerGroup> &group) {
|
||||
if (!layer) continue;
|
||||
if (layer->bucket) {
|
||||
if (layer->bucket->style_source) {
|
||||
activeSources.emplace(std::make_shared<Source>(*layer->bucket->style_source));
|
||||
activeSources.emplace(std::make_shared<Source>(*layer->bucket->style_source, this->getAccessToken()));
|
||||
}
|
||||
} else if (layer->layers) {
|
||||
updateSources(layer->layers);
|
||||
@@ -656,7 +656,7 @@ void Map::renderLayer(std::shared_ptr<StyleLayer> layer_desc, RenderPass pass) {
|
||||
}
|
||||
|
||||
// TODO: THIS IS BAD, FIXME
|
||||
Source source(*layer_desc->bucket->style_source);
|
||||
Source source(*layer_desc->bucket->style_source, this->getAccessToken());
|
||||
source.render(painter, layer_desc);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,9 +18,9 @@
|
||||
|
||||
namespace llmr {
|
||||
|
||||
Source::Source(StyleSource style_source)
|
||||
Source::Source(StyleSource style_source, const std::string &access_token)
|
||||
: type(style_source.type),
|
||||
url(normalizeSourceURL(style_source.url)),
|
||||
url(normalizeSourceURL(style_source.url, access_token)),
|
||||
tile_size(style_source.tile_size),
|
||||
min_zoom(style_source.min_zoom),
|
||||
max_zoom(style_source.max_zoom) {}
|
||||
|
||||
@@ -8,6 +8,9 @@ namespace llmr {
|
||||
|
||||
using JSVal = const rapidjson::Value&;
|
||||
|
||||
StyleParser::StyleParser() {
|
||||
}
|
||||
|
||||
void StyleParser::parse(JSVal document) {
|
||||
if (document.HasMember("constants")) {
|
||||
parseConstants(document["constants"]);
|
||||
|
||||
Reference in New Issue
Block a user