diff options
author | Lauren Budorick <lauren@mapbox.com> | 2017-03-27 14:03:14 -0700 |
---|---|---|
committer | Lauren Budorick <lauren@mapbox.com> | 2017-04-24 17:08:47 -0700 |
commit | eeeaf8f1031daba4c1e9728ab50600297c61e31b (patch) | |
tree | d6213a404a5bedbb357e4a0cccbfb4847eea7770 | |
parent | 3b43ee20d81461b781335a97ba77bc25eb227200 (diff) | |
download | qtlocation-mapboxgl-eeeaf8f1031daba4c1e9728ab50600297c61e31b.tar.gz |
Reconcile changes from rebase
-rw-r--r-- | include/mbgl/style/conversion/constant.hpp | 10 | ||||
-rw-r--r-- | include/mbgl/style/conversion/light.hpp | 25 | ||||
-rw-r--r-- | src/mbgl/renderer/painter.cpp | 2 | ||||
-rw-r--r-- | src/mbgl/style/parser.cpp | 8 |
4 files changed, 28 insertions, 17 deletions
diff --git a/include/mbgl/style/conversion/constant.hpp b/include/mbgl/style/conversion/constant.hpp index bc909cecd5..32800d2024 100644 --- a/include/mbgl/style/conversion/constant.hpp +++ b/include/mbgl/style/conversion/constant.hpp @@ -96,14 +96,18 @@ struct Converter<Color> { template <> struct Converter<Position> { template <class V> - Result<Position> operator()(const V& value) const { - Result<std::array<float, 3>> spherical = convert<std::array<float, 3>>(value); + optional<Position> operator()(const V& value, Error& error) const { + optional<std::array<float, 3>> spherical = convert<std::array<float, 3>>(value, error); if (!spherical) { - return spherical.error(); + return {}; } optional<Position> converted = Position(*spherical); + if (!converted) { + error = { "value must be a valid position" }; + return {}; + } return *converted; } diff --git a/include/mbgl/style/conversion/light.hpp b/include/mbgl/style/conversion/light.hpp index 3e7a0441a4..4ddf225404 100644 --- a/include/mbgl/style/conversion/light.hpp +++ b/include/mbgl/style/conversion/light.hpp @@ -14,53 +14,54 @@ template <> struct Converter<Light> { public: template <class V> - Result<Light> operator()(const V& value) const { + optional<Light> operator()(const V& value, Error& error) const { if (!isObject(value)) { - return Error{ "light must be an object" }; + error = { "light must be an object" }; + return {}; } Light light; const auto anchor = objectMember(value, "anchor"); if (anchor) { - Result<PropertyValue<LightAnchorType>> convertedAnchor = - convert<PropertyValue<LightAnchorType>>(*anchor); + optional<PropertyValue<LightAnchorType>> convertedAnchor = + convert<PropertyValue<LightAnchorType>>(*anchor, error); if (convertedAnchor) { light.set<LightAnchor>(*convertedAnchor); } else { - return convertedAnchor.error(); + return {}; } } const auto color = objectMember(value, "color"); if (color) { - Result<PropertyValue<Color>> convertedColor = convert<PropertyValue<Color>>(*color); + optional<PropertyValue<Color>> convertedColor = convert<PropertyValue<Color>>(*color, error); if (convertedColor) { light.set<LightColor>(*convertedColor); } else { - return convertedColor.error(); + return {}; } } const auto position = objectMember(value, "position"); if (position) { - auto convertedPosition = convert<PropertyValue<Position>>(*position); + optional<PropertyValue<Position>> convertedPosition = convert<PropertyValue<Position>>(*position, error); if (convertedPosition) { light.set<LightPosition>(*convertedPosition); } else { - return convertedPosition.error(); + return {}; } } const auto intensity = objectMember(value, "intensity"); if (intensity) { - Result<PropertyValue<float>> convertedIntensity = - convert<PropertyValue<float>>(*intensity); + optional<PropertyValue<float>> convertedIntensity = + convert<PropertyValue<float>>(*intensity, error); if (convertedIntensity) { light.set<LightIntensity>(*convertedIntensity); } else { - return convertedIntensity.error(); + return {}; } } diff --git a/src/mbgl/renderer/painter.cpp b/src/mbgl/renderer/painter.cpp index 8624d8e465..1296c5d03a 100644 --- a/src/mbgl/renderer/painter.cpp +++ b/src/mbgl/renderer/painter.cpp @@ -309,7 +309,7 @@ void Painter::renderPass(PaintParameters& parameters, auto renderTiles = [this, &item, &layer, ¶meters, &style]() { for (auto& tileRef : item.tiles) { auto& tile = tileRef.get(); - MBGL_DEBUG_GROUP(layer.baseImpl->id + " - " + util::toString(tile.id)); + MBGL_DEBUG_GROUP(context, layer.baseImpl->id + " - " + util::toString(tile.id)); auto bucket = tile.tile.getBucket(layer); if (bucket) { bucket->render(*this, parameters, layer, tile, style); diff --git a/src/mbgl/style/parser.cpp b/src/mbgl/style/parser.cpp index 1fb6d64bb9..5e7ebf0e06 100644 --- a/src/mbgl/style/parser.cpp +++ b/src/mbgl/style/parser.cpp @@ -118,7 +118,13 @@ void Parser::parseLight(const JSValue& value) { return; } - conversion::Result<Light> converted = conversion::convert<Light>(value); + conversion::Error error; + optional<Light> converted = conversion::convert<Light>(value, error); + if (!converted) { + Log::Warning(Event::ParseStyle, error.message); + return; + } + light = *converted; } |