diff options
author | Molly Lloyd <mollymerp@users.noreply.github.com> | 2018-01-23 10:49:23 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-23 10:49:23 -0800 |
commit | f3294200c6c866e5ab031ad8346c59a76aa37249 (patch) | |
tree | 6d9aedb552552607641a15c415a60be99a0877d5 /include/mbgl | |
parent | 2d15aed43c9faa875a8f625c3afc286f1175e0ce (diff) | |
download | qtlocation-mapboxgl-f3294200c6c866e5ab031ad8346c59a76aa37249.tar.gz |
[core] add raster-dem source type and hillshade layer type (#10642)
Diffstat (limited to 'include/mbgl')
-rw-r--r-- | include/mbgl/style/layer.hpp | 3 | ||||
-rw-r--r-- | include/mbgl/style/layer_type.hpp | 3 | ||||
-rw-r--r-- | include/mbgl/style/layers/hillshade_layer.hpp | 86 | ||||
-rw-r--r-- | include/mbgl/style/layers/layer.hpp.ejs | 2 | ||||
-rw-r--r-- | include/mbgl/style/source.hpp | 1 | ||||
-rw-r--r-- | include/mbgl/style/sources/raster_dem_source.hpp | 25 | ||||
-rw-r--r-- | include/mbgl/style/sources/raster_source.hpp | 4 | ||||
-rw-r--r-- | include/mbgl/style/types.hpp | 6 |
8 files changed, 126 insertions, 4 deletions
diff --git a/include/mbgl/style/layer.hpp b/include/mbgl/style/layer.hpp index eb2dbf830b..8a5a4236b3 100644 --- a/include/mbgl/style/layer.hpp +++ b/include/mbgl/style/layer.hpp @@ -19,6 +19,7 @@ class LineLayer; class CircleLayer; class SymbolLayer; class RasterLayer; +class HillshadeLayer; class BackgroundLayer; class CustomLayer; class FillExtrusionLayer; @@ -86,6 +87,8 @@ public: return std::forward<V>(visitor)(*as<RasterLayer>()); case LayerType::Background: return std::forward<V>(visitor)(*as<BackgroundLayer>()); + case LayerType::Hillshade: + return std::forward<V>(visitor)(*as<HillshadeLayer>()); case LayerType::Custom: return std::forward<V>(visitor)(*as<CustomLayer>()); case LayerType::FillExtrusion: diff --git a/include/mbgl/style/layer_type.hpp b/include/mbgl/style/layer_type.hpp index 66ff834eee..951757134b 100644 --- a/include/mbgl/style/layer_type.hpp +++ b/include/mbgl/style/layer_type.hpp @@ -9,10 +9,11 @@ enum class LayerType { Circle, Symbol, Raster, + Hillshade, Background, Custom, FillExtrusion, }; } // namespace style -} // namespace mbgl
\ No newline at end of file +} // namespace mbgl diff --git a/include/mbgl/style/layers/hillshade_layer.hpp b/include/mbgl/style/layers/hillshade_layer.hpp new file mode 100644 index 0000000000..35664da46c --- /dev/null +++ b/include/mbgl/style/layers/hillshade_layer.hpp @@ -0,0 +1,86 @@ +// This file is generated. Do not edit. + +#pragma once + +#include <mbgl/style/layer.hpp> +#include <mbgl/style/filter.hpp> +#include <mbgl/style/property_value.hpp> +#include <mbgl/style/data_driven_property_value.hpp> + +#include <mbgl/util/color.hpp> + +namespace mbgl { +namespace style { + +class TransitionOptions; + +class HillshadeLayer : public Layer { +public: + HillshadeLayer(const std::string& layerID, const std::string& sourceID); + ~HillshadeLayer() final; + + // Source + const std::string& getSourceID() const; + + // Visibility + void setVisibility(VisibilityType) final; + + // Zoom range + void setMinZoom(float) final; + void setMaxZoom(float) final; + + // Paint properties + + static PropertyValue<float> getDefaultHillshadeIlluminationDirection(); + PropertyValue<float> getHillshadeIlluminationDirection() const; + void setHillshadeIlluminationDirection(PropertyValue<float>); + void setHillshadeIlluminationDirectionTransition(const TransitionOptions&); + TransitionOptions getHillshadeIlluminationDirectionTransition() const; + + static PropertyValue<HillshadeIlluminationAnchorType> getDefaultHillshadeIlluminationAnchor(); + PropertyValue<HillshadeIlluminationAnchorType> getHillshadeIlluminationAnchor() const; + void setHillshadeIlluminationAnchor(PropertyValue<HillshadeIlluminationAnchorType>); + void setHillshadeIlluminationAnchorTransition(const TransitionOptions&); + TransitionOptions getHillshadeIlluminationAnchorTransition() const; + + static PropertyValue<float> getDefaultHillshadeExaggeration(); + PropertyValue<float> getHillshadeExaggeration() const; + void setHillshadeExaggeration(PropertyValue<float>); + void setHillshadeExaggerationTransition(const TransitionOptions&); + TransitionOptions getHillshadeExaggerationTransition() const; + + static PropertyValue<Color> getDefaultHillshadeShadowColor(); + PropertyValue<Color> getHillshadeShadowColor() const; + void setHillshadeShadowColor(PropertyValue<Color>); + void setHillshadeShadowColorTransition(const TransitionOptions&); + TransitionOptions getHillshadeShadowColorTransition() const; + + static PropertyValue<Color> getDefaultHillshadeHighlightColor(); + PropertyValue<Color> getHillshadeHighlightColor() const; + void setHillshadeHighlightColor(PropertyValue<Color>); + void setHillshadeHighlightColorTransition(const TransitionOptions&); + TransitionOptions getHillshadeHighlightColorTransition() const; + + static PropertyValue<Color> getDefaultHillshadeAccentColor(); + PropertyValue<Color> getHillshadeAccentColor() const; + void setHillshadeAccentColor(PropertyValue<Color>); + void setHillshadeAccentColorTransition(const TransitionOptions&); + TransitionOptions getHillshadeAccentColorTransition() const; + + // Private implementation + + class Impl; + const Impl& impl() const; + + Mutable<Impl> mutableImpl() const; + HillshadeLayer(Immutable<Impl>); + std::unique_ptr<Layer> cloneRef(const std::string& id) const final; +}; + +template <> +inline bool Layer::is<HillshadeLayer>() const { + return getType() == LayerType::Hillshade; +} + +} // namespace style +} // namespace mbgl diff --git a/include/mbgl/style/layers/layer.hpp.ejs b/include/mbgl/style/layers/layer.hpp.ejs index 4ee5545247..265dd57e1f 100644 --- a/include/mbgl/style/layers/layer.hpp.ejs +++ b/include/mbgl/style/layers/layer.hpp.ejs @@ -35,7 +35,7 @@ public: <% if (type !== 'background') { -%> // Source const std::string& getSourceID() const; -<% if (type !== 'raster') { -%> +<% if (type !== 'raster' && type !== 'hillshade') { -%> const std::string& getSourceLayer() const; void setSourceLayer(const std::string& sourceLayer); diff --git a/include/mbgl/style/source.hpp b/include/mbgl/style/source.hpp index 0b6a6c72d9..2f2838ade8 100644 --- a/include/mbgl/style/source.hpp +++ b/include/mbgl/style/source.hpp @@ -17,6 +17,7 @@ namespace style { class VectorSource; class RasterSource; +class RasterDEMSource; class GeoJSONSource; class SourceObserver; diff --git a/include/mbgl/style/sources/raster_dem_source.hpp b/include/mbgl/style/sources/raster_dem_source.hpp new file mode 100644 index 0000000000..82588613bc --- /dev/null +++ b/include/mbgl/style/sources/raster_dem_source.hpp @@ -0,0 +1,25 @@ +#pragma once + +#include <mbgl/style/sources/raster_source.hpp> +#include <mbgl/util/tileset.hpp> +#include <mbgl/util/variant.hpp> + +namespace mbgl { + +class AsyncRequest; + +namespace style { + +class RasterDEMSource : public RasterSource { +public: + RasterDEMSource(std::string id, variant<std::string, Tileset> urlOrTileset, uint16_t tileSize); + +}; + +template <> +inline bool Source::is<RasterDEMSource>() const { + return getType() == SourceType::RasterDEM; +} + +} // namespace style +} // namespace mbgl diff --git a/include/mbgl/style/sources/raster_source.hpp b/include/mbgl/style/sources/raster_source.hpp index 7f23a7ca4b..5aa81aa979 100644 --- a/include/mbgl/style/sources/raster_source.hpp +++ b/include/mbgl/style/sources/raster_source.hpp @@ -12,8 +12,8 @@ namespace style { class RasterSource : public Source { public: - RasterSource(std::string id, variant<std::string, Tileset> urlOrTileset, uint16_t tileSize); - ~RasterSource() final; + RasterSource(std::string id, variant<std::string, Tileset> urlOrTileset, uint16_t tileSize, SourceType sourceType = SourceType::Raster); + ~RasterSource() override; const variant<std::string, Tileset>& getURLOrTileset() const; optional<std::string> getURL() const; diff --git a/include/mbgl/style/types.hpp b/include/mbgl/style/types.hpp index 6fe457e181..693972a72f 100644 --- a/include/mbgl/style/types.hpp +++ b/include/mbgl/style/types.hpp @@ -10,6 +10,7 @@ namespace style { enum class SourceType : uint8_t { Vector, Raster, + RasterDEM, GeoJSON, Video, Annotations, @@ -37,6 +38,11 @@ enum class LineJoinType : uint8_t { FlipBevel }; +enum class HillshadeIlluminationAnchorType : bool { + Map, + Viewport +}; + enum class TranslateAnchorType : bool { Map, Viewport |