diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2014-07-02 12:10:09 +0200 |
---|---|---|
committer | Konstantin Käfer <mail@kkaefer.com> | 2014-07-02 12:10:09 +0200 |
commit | af87fb6c264e232a6945f7f6304989a459501720 (patch) | |
tree | 4e9ecc8e58351a76a48f03b02c83188fd26ff642 /src/map | |
parent | e93803ac80f1c505739e24593df7ae562517f76d (diff) | |
download | qtlocation-mapboxgl-af87fb6c264e232a6945f7f6304989a459501720.tar.gz |
load glyphset url from stylesheet
Diffstat (limited to 'src/map')
-rw-r--r-- | src/map/map.cpp | 11 | ||||
-rw-r--r-- | src/map/source.cpp | 3 | ||||
-rw-r--r-- | src/map/tile_parser.cpp | 6 |
3 files changed, 17 insertions, 3 deletions
diff --git a/src/map/map.cpp b/src/map/map.cpp index 703cdf1400..50c172caaa 100644 --- a/src/map/map.cpp +++ b/src/map/map.cpp @@ -24,7 +24,6 @@ Map::Map(View& view) transform(), style(std::make_shared<Style>()), glyphAtlas(std::make_shared<GlyphAtlas>(1024, 1024)), - glyphStore(std::make_shared<GlyphStore>()), spriteAtlas(std::make_shared<SpriteAtlas>(512, 512)), texturepool(std::make_shared<Texturepool>()), painter(*this), @@ -439,6 +438,16 @@ void Map::prepare() { spriteAtlas->resize(state.getPixelRatio()); } + // Create a new glyph store object in case the glyph URL changed. + // TODO: Move this to a less frequently called place; we only need to do this when the + // stylesheet changes. + if (glyphStore && glyphStore->glyphURL != style->glyph_url) { + glyphStore.reset(); + } + if (!glyphStore && style->glyph_url.size()) { + glyphStore = std::make_shared<GlyphStore>(style->glyph_url); + } + if (pixelRatioChanged || dimensionsChanged) { painter.clearFramebuffers(); } diff --git a/src/map/source.cpp b/src/map/source.cpp index 6f7bb811fd..c3c5e89fd4 100644 --- a/src/map/source.cpp +++ b/src/map/source.cpp @@ -17,11 +17,10 @@ namespace llmr { -Source::Source(SourceType type, const std::string &url, const std::string &glyphs, +Source::Source(SourceType type, const std::string &url, uint32_t tile_size, uint32_t min_zoom, uint32_t max_zoom) : type(type), url(normalizeSourceURL(url)), - glyphs(glyphs), tile_size(tile_size), min_zoom(min_zoom), max_zoom(max_zoom) {} diff --git a/src/map/tile_parser.cpp b/src/map/tile_parser.cpp index b3a018f427..4cf7fb22fa 100644 --- a/src/map/tile_parser.cpp +++ b/src/map/tile_parser.cpp @@ -183,6 +183,12 @@ std::unique_ptr<Bucket> TileParser::createIconBucket(const VectorTileLayer& laye std::unique_ptr<Bucket> TileParser::createTextBucket(const VectorTileLayer& layer, const FilterExpression &filter, const StyleBucketText &text) { + // Make sure that we always have a valid glyph store. If this is not set, the stylesheet + // doesn't specify a glyph URL. + if (!glyphStore) { + return nullptr; + } + const StyleBucketText &properties = text; std::unique_ptr<TextBucket> bucket = std::make_unique<TextBucket>( |