diff options
author | Lauren Budorick <lauren@mapbox.com> | 2014-08-04 17:24:22 -0700 |
---|---|---|
committer | Lauren Budorick <lauren@mapbox.com> | 2014-08-11 12:12:43 -0700 |
commit | df925fe0e5429085f0f443f4be1326c0616f6acc (patch) | |
tree | a502590190ef6898ddbbd468cf2afb03ea55a4d3 /src/style | |
parent | 7a98ad4cf949dd1279719bf926bd08da0133210f (diff) | |
download | qtlocation-mapboxgl-df925fe0e5429085f0f443f4be1326c0616f6acc.tar.gz |
nonworking prerendering attempts
Diffstat (limited to 'src/style')
-rw-r--r-- | src/style/style_parser.cpp | 40 |
1 files changed, 22 insertions, 18 deletions
diff --git a/src/style/style_parser.cpp b/src/style/style_parser.cpp index f72b47d1f5..3ca8742965 100644 --- a/src/style/style_parser.cpp +++ b/src/style/style_parser.cpp @@ -344,7 +344,7 @@ bool StyleParser::parseOptionalProperty(const char *property_name, PropertyKey k template <typename T> bool StyleParser::parseOptionalProperty(const char *property_name, T &target, JSVal value) { if (!value.HasMember(property_name)) { - return false; + return false; } else { return setProperty<T>(replaceConstant(value[property_name]), property_name, target); } @@ -494,14 +494,16 @@ std::shared_ptr<StyleLayer> StyleParser::createLayer(JSVal value) { // Parse Rasterization options, as they can't be inherited anyway. std::unique_ptr<const RasterizeProperties> rasterize; - if (value.HasMember("rasterize")) { - rasterize = parseRasterize(replaceConstant(value["rasterize"])); - } std::shared_ptr<StyleLayer> layer = std::make_shared<StyleLayer>( layer_id, std::move(styles), std::move(rasterize)); if (value.HasMember("layers")) { + if (value.HasMember("type")) { + JSVal type = value["type"]; + if (std::string { type.GetString(), type.GetStringLength() } == "raster") { + } + } layer->layers = createLayers(value["layers"]); } @@ -525,7 +527,8 @@ void StyleParser::parseLayer(std::pair<JSVal, std::shared_ptr<StyleLayer>> &pair JSVal value = pair.first; std::shared_ptr<StyleLayer> &layer = pair.second; - if (layer->bucket || layer->layers) { + if (layer->bucket) { +// if (layer->bucket || layer->layers) { // Skip parsing this again. We already have a valid layer definition. return; } @@ -637,6 +640,7 @@ void StyleParser::parseStyle(JSVal value, ClassProperties &klass) { parseOptionalProperty<Function<float>>("composite-opacity", Key::CompositeOpacity, klass, value); parseOptionalProperty<PropertyTransition>("transition-composite-opacity", Key::CompositeOpacity, klass, value); +// TODO edit these: parseOptionalProperty<Function<float>>("raster-opacity", Key::RasterOpacity, klass, value); parseOptionalProperty<PropertyTransition>("transition-raster-opacity", Key::RasterOpacity, klass, value); parseOptionalProperty<Function<float>>("raster-spin", Key::RasterSpin, klass, value); @@ -655,19 +659,6 @@ void StyleParser::parseStyle(JSVal value, ClassProperties &klass) { parseOptionalProperty<Function<Color>>("background-color", Key::BackgroundColor, klass, value); } -std::unique_ptr<RasterizeProperties> StyleParser::parseRasterize(JSVal value) { - auto rasterize = std::make_unique<RasterizeProperties>(); - - if (value.IsObject()) { - parseOptionalProperty("enabled", rasterize->enabled, value); - parseOptionalProperty("buffer", rasterize->buffer, value); - parseOptionalProperty("size", rasterize->size, value); - parseOptionalProperty("blur", rasterize->blur, value); - } - - return rasterize; -} - void StyleParser::parseReference(JSVal value, std::shared_ptr<StyleLayer> &layer) { if (!value.IsString()) { fprintf(stderr, "[WARNING] layer ref of '%s' must be a string\n", layer->id.c_str()); @@ -926,6 +917,19 @@ void StyleParser::parseRender(JSVal value, std::shared_ptr<StyleLayer> &layer) { parseRenderProperty(value, render.text.ignore_placement, "text-ignore-placement"); parseRenderProperty(value, render.text.optional, "text-optional"); } break; + + case StyleLayerType::Raster: { + StyleBucketRaster &render = bucket.render.get<StyleBucketRaster>(); + + auto rasterize = std::make_unique<RasterizedProperties>(); + parseRenderProperty(value, render.raster_size, "raster-size"); + parseRenderProperty(value, render.blur, "raster-blur"); + parseRenderProperty(value, render.buffer, "raster-buffer"); + +// return rasterize; + + } break; + default: // There are no render properties for these layer types. break; |