Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Commit

Permalink
parse min-zoom/max-zoom values
Browse files Browse the repository at this point in the history
  • Loading branch information
kkaefer committed Jul 17, 2014
1 parent afe069d commit c01143a
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
2 changes: 2 additions & 0 deletions include/mbgl/style/style_bucket.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ class StyleBucket {
std::string source_layer;
FilterExpression filter;
StyleBucketRender render = std::false_type();
float min_zoom = -std::numeric_limits<float>::infinity();
float max_zoom = std::numeric_limits<float>::infinity();
};


Expand Down
19 changes: 19 additions & 0 deletions src/style/style_parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#include <mbgl/style/style_layer_group.hpp>
#include <mbgl/util/constants.hpp>
#include <mbgl/util/std.hpp>
#include <mbgl/platform/log.hpp>
#include <csscolorparser/csscolorparser.hpp>

namespace mbgl {
Expand Down Expand Up @@ -714,6 +715,24 @@ void StyleParser::parseBucket(JSVal value, std::shared_ptr<StyleLayer> &layer) {
JSVal value_render = replaceConstant(value["render"]);
parseRender(value_render, layer);
}

if (value.HasMember("min-zoom")) {
JSVal min_zoom = value["min-zoom"];
if (min_zoom.IsNumber()) {
layer->bucket->min_zoom = min_zoom.GetDouble();
} else {
Log::Warning(Event::ParseStyle, "min-zoom of layer %s must be numeric", layer->id.c_str());
}
}

if (value.HasMember("max-zoom")) {
JSVal max_zoom = value["max-zoom"];
if (max_zoom.IsNumber()) {
layer->bucket->min_zoom = max_zoom.GetDouble();
} else {
Log::Warning(Event::ParseStyle, "max-zoom of layer %s must be numeric", layer->id.c_str());
}
}
}

FilterExpression StyleParser::parseFilter(JSVal value) {
Expand Down

0 comments on commit c01143a

Please sign in to comment.