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
This commit is contained in:
Mike Morris
2014-07-10 16:29:49 -07:00
parent 356c9ce7e4
commit 4590adc115
12 changed files with 91 additions and 66 deletions

View File

@@ -1,4 +1,3 @@
#include <llmr/map/map.hpp>
#include <llmr/style/style_parser.hpp>
#include <llmr/style/style_layer_group.hpp>
#include <llmr/util/constants.hpp>
@@ -9,8 +8,7 @@ namespace llmr {
using JSVal = const rapidjson::Value&;
StyleParser::StyleParser(Map &map)
: map(map) {
StyleParser::StyleParser() {
}
void StyleParser::parse(JSVal document) {
@@ -176,7 +174,7 @@ void StyleParser::parseSources(JSVal value) {
parseRenderProperty(itr->value, min_zoom, "minZoom");
parseRenderProperty(itr->value, max_zoom, "maxZoom");
sources.emplace(std::move(name), std::make_shared<Source>(type, url, tile_size, min_zoom, max_zoom, map.getAccessToken()));
sources.emplace(std::move(name), std::make_shared<StyleSource>(type, url, tile_size, min_zoom, max_zoom));
}
} else {
throw Style::exception("sources must be an object");
@@ -727,7 +725,7 @@ void StyleParser::parseBucket(JSVal value, std::shared_ptr<StyleLayer> &layer) {
const std::string source_name = { value_source.GetString(), value_source.GetStringLength() };
auto source_it = sources.find(source_name);
if (source_it != sources.end()) {
layer->bucket->source = source_it->second;
layer->bucket->style_source = source_it->second;
} else {
fprintf(stderr, "[WARNING] can't find source '%s' required for layer '%s'\n",
source_name.c_str(), layer->id.c_str());