diff options
author | John Firebaugh <john.firebaugh@gmail.com> | 2016-11-30 10:17:47 -0800 |
---|---|---|
committer | John Firebaugh <john.firebaugh@gmail.com> | 2016-12-01 09:00:06 -0800 |
commit | 7d16824fda7086fbeb0a1deae3fc0abdf0c4832d (patch) | |
tree | 11c35642db033c685e78c8b45d28af68a5f3d30b /src | |
parent | 54c557d982c92caefd53a68e2f72bba822101c2c (diff) | |
download | qtlocation-mapboxgl-7d16824fda7086fbeb0a1deae3fc0abdf0c4832d.tar.gz |
[core] Functions must have at least one stop
This is already enforced by the style validator in mapbox-gl-style-spec. Enforce it here too.
Diffstat (limited to 'src')
-rw-r--r-- | src/mbgl/style/property_evaluator.cpp | 27 |
1 files changed, 2 insertions, 25 deletions
diff --git a/src/mbgl/style/property_evaluator.cpp b/src/mbgl/style/property_evaluator.cpp index c19f722100..bfebc38728 100644 --- a/src/mbgl/style/property_evaluator.cpp +++ b/src/mbgl/style/property_evaluator.cpp @@ -11,30 +11,6 @@ namespace mbgl { namespace style { template <typename T> -T defaultStopsValue(); - -template <> bool defaultStopsValue() { return true; } -template <> float defaultStopsValue() { return 1.0f; } -template <> Color defaultStopsValue() { return { 0, 0, 0, 1 }; } -template <> std::vector<float> defaultStopsValue() { return {{ 1, 0 }}; } -template <> std::vector<std::string> defaultStopsValue() { return {{}}; } -template <> std::array<float, 2> defaultStopsValue() { return {{ 0, 0 }}; } -template <> std::array<float, 4> defaultStopsValue() { return {{ 0, 0, 0, 0 }}; } - -template <> std::string defaultStopsValue() { return {}; } -template <> TranslateAnchorType defaultStopsValue() { return {}; } -template <> RotateAnchorType defaultStopsValue() { return {}; } -template <> CirclePitchScaleType defaultStopsValue() { return {}; } -template <> LineCapType defaultStopsValue() { return {}; } -template <> LineJoinType defaultStopsValue() { return {}; } -template <> SymbolPlacementType defaultStopsValue() { return {}; } -template <> TextAnchorType defaultStopsValue() { return {}; } -template <> TextJustifyType defaultStopsValue() { return {}; } -template <> TextTransformType defaultStopsValue() { return {}; } -template <> AlignmentType defaultStopsValue() { return {}; } -template <> IconTextFitType defaultStopsValue() { return {}; }; - -template <typename T> T PropertyEvaluator<T>::operator()(const Function<T>& fn) const { float base = fn.getBase(); const std::vector<std::pair<float, T>>& stops = fn.getStops(); @@ -80,7 +56,8 @@ T PropertyEvaluator<T>::operator()(const Function<T>& fn) const { return smaller_val; } else { // No stop defined. - return defaultStopsValue<T>(); + assert(false); + return T(); } } |