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

Commit

Permalink
[core] add raster-dem source type and hillshade layer type (#10642)
Browse files Browse the repository at this point in the history
  • Loading branch information
mollymerp authored Jan 23, 2018
1 parent 2d15aed commit f329420
Show file tree
Hide file tree
Showing 84 changed files with 4,661 additions and 56 deletions.
28 changes: 28 additions & 0 deletions cmake/core-files.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ set(MBGL_CORE_FILES
# geometry
src/mbgl/geometry/anchor.hpp
src/mbgl/geometry/debug_font_data.hpp
src/mbgl/geometry/dem_data.cpp
src/mbgl/geometry/dem_data.hpp
src/mbgl/geometry/feature_index.cpp
src/mbgl/geometry/feature_index.hpp
src/mbgl/geometry/line_atlas.cpp
Expand Down Expand Up @@ -144,6 +146,10 @@ set(MBGL_CORE_FILES
src/mbgl/programs/fill_extrusion_program.hpp
src/mbgl/programs/fill_program.cpp
src/mbgl/programs/fill_program.hpp
src/mbgl/programs/hillshade_prepare_program.cpp
src/mbgl/programs/hillshade_prepare_program.hpp
src/mbgl/programs/hillshade_program.cpp
src/mbgl/programs/hillshade_program.hpp
src/mbgl/programs/line_program.cpp
src/mbgl/programs/line_program.hpp
src/mbgl/programs/program.hpp
Expand Down Expand Up @@ -219,6 +225,8 @@ set(MBGL_CORE_FILES
src/mbgl/renderer/buckets/fill_bucket.hpp
src/mbgl/renderer/buckets/fill_extrusion_bucket.cpp
src/mbgl/renderer/buckets/fill_extrusion_bucket.hpp
src/mbgl/renderer/buckets/hillshade_bucket.cpp
src/mbgl/renderer/buckets/hillshade_bucket.hpp
src/mbgl/renderer/buckets/line_bucket.cpp
src/mbgl/renderer/buckets/line_bucket.hpp
src/mbgl/renderer/buckets/raster_bucket.cpp
Expand All @@ -237,6 +245,8 @@ set(MBGL_CORE_FILES
src/mbgl/renderer/layers/render_fill_extrusion_layer.hpp
src/mbgl/renderer/layers/render_fill_layer.cpp
src/mbgl/renderer/layers/render_fill_layer.hpp
src/mbgl/renderer/layers/render_hillshade_layer.cpp
src/mbgl/renderer/layers/render_hillshade_layer.hpp
src/mbgl/renderer/layers/render_line_layer.cpp
src/mbgl/renderer/layers/render_line_layer.hpp
src/mbgl/renderer/layers/render_raster_layer.cpp
Expand All @@ -251,6 +261,8 @@ set(MBGL_CORE_FILES
src/mbgl/renderer/sources/render_geojson_source.hpp
src/mbgl/renderer/sources/render_image_source.cpp
src/mbgl/renderer/sources/render_image_source.hpp
src/mbgl/renderer/sources/render_raster_dem_source.cpp
src/mbgl/renderer/sources/render_raster_dem_source.hpp
src/mbgl/renderer/sources/render_raster_source.cpp
src/mbgl/renderer/sources/render_raster_source.hpp
src/mbgl/renderer/sources/render_vector_source.cpp
Expand Down Expand Up @@ -285,6 +297,10 @@ set(MBGL_CORE_FILES
src/mbgl/shaders/fill_outline_pattern.hpp
src/mbgl/shaders/fill_pattern.cpp
src/mbgl/shaders/fill_pattern.hpp
src/mbgl/shaders/hillshade.cpp
src/mbgl/shaders/hillshade.hpp
src/mbgl/shaders/hillshade_prepare.cpp
src/mbgl/shaders/hillshade_prepare.hpp
src/mbgl/shaders/line.cpp
src/mbgl/shaders/line.hpp
src/mbgl/shaders/line_pattern.cpp
Expand Down Expand Up @@ -479,6 +495,7 @@ set(MBGL_CORE_FILES
include/mbgl/style/layers/custom_layer.hpp
include/mbgl/style/layers/fill_extrusion_layer.hpp
include/mbgl/style/layers/fill_layer.hpp
include/mbgl/style/layers/hillshade_layer.hpp
include/mbgl/style/layers/line_layer.hpp
include/mbgl/style/layers/raster_layer.hpp
include/mbgl/style/layers/symbol_layer.hpp
Expand All @@ -505,6 +522,11 @@ set(MBGL_CORE_FILES
src/mbgl/style/layers/fill_layer_impl.hpp
src/mbgl/style/layers/fill_layer_properties.cpp
src/mbgl/style/layers/fill_layer_properties.hpp
src/mbgl/style/layers/hillshade_layer.cpp
src/mbgl/style/layers/hillshade_layer_impl.cpp
src/mbgl/style/layers/hillshade_layer_impl.hpp
src/mbgl/style/layers/hillshade_layer_properties.cpp
src/mbgl/style/layers/hillshade_layer_properties.hpp
src/mbgl/style/layers/line_layer.cpp
src/mbgl/style/layers/line_layer_impl.cpp
src/mbgl/style/layers/line_layer_impl.hpp
Expand All @@ -525,6 +547,7 @@ set(MBGL_CORE_FILES
include/mbgl/style/sources/custom_geometry_source.hpp
include/mbgl/style/sources/geojson_source.hpp
include/mbgl/style/sources/image_source.hpp
include/mbgl/style/sources/raster_dem_source.hpp
include/mbgl/style/sources/raster_source.hpp
include/mbgl/style/sources/vector_source.hpp
src/mbgl/style/sources/custom_geometry_source.cpp
Expand All @@ -536,6 +559,7 @@ set(MBGL_CORE_FILES
src/mbgl/style/sources/image_source.cpp
src/mbgl/style/sources/image_source_impl.cpp
src/mbgl/style/sources/image_source_impl.hpp
src/mbgl/style/sources/raster_dem_source.cpp
src/mbgl/style/sources/raster_source.cpp
src/mbgl/style/sources/raster_source_impl.cpp
src/mbgl/style/sources/raster_source_impl.hpp
Expand Down Expand Up @@ -587,6 +611,10 @@ set(MBGL_CORE_FILES
src/mbgl/tile/geometry_tile_data.hpp
src/mbgl/tile/geometry_tile_worker.cpp
src/mbgl/tile/geometry_tile_worker.hpp
src/mbgl/tile/raster_dem_tile.cpp
src/mbgl/tile/raster_dem_tile.hpp
src/mbgl/tile/raster_dem_tile_worker.cpp
src/mbgl/tile/raster_dem_tile_worker.hpp
src/mbgl/tile/raster_tile.cpp
src/mbgl/tile/raster_tile.hpp
src/mbgl/tile/raster_tile_worker.cpp
Expand Down
4 changes: 4 additions & 0 deletions cmake/test-files.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ set(MBGL_TEST_FILES
test/api/recycle_map.cpp
test/api/zoom_history.cpp

# geometry
test/geometry/dem_data.test.cpp

# gl
test/gl/bucket.test.cpp
test/gl/context.test.cpp
Expand Down Expand Up @@ -123,6 +126,7 @@ set(MBGL_TEST_FILES
test/tile/custom_geometry_tile.test.cpp
test/tile/geojson_tile.test.cpp
test/tile/geometry_tile_data.test.cpp
test/tile/raster_dem_tile.test.cpp
test/tile/raster_tile.test.cpp
test/tile/tile_coordinate.test.cpp
test/tile/tile_id.test.cpp
Expand Down
3 changes: 3 additions & 0 deletions include/mbgl/style/layer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class LineLayer;
class CircleLayer;
class SymbolLayer;
class RasterLayer;
class HillshadeLayer;
class BackgroundLayer;
class CustomLayer;
class FillExtrusionLayer;
Expand Down Expand Up @@ -86,6 +87,8 @@ class Layer : public mbgl::util::noncopyable {
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:
Expand Down
3 changes: 2 additions & 1 deletion include/mbgl/style/layer_type.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@ enum class LayerType {
Circle,
Symbol,
Raster,
Hillshade,
Background,
Custom,
FillExtrusion,
};

} // namespace style
} // namespace mbgl
} // namespace mbgl
86 changes: 86 additions & 0 deletions include/mbgl/style/layers/hillshade_layer.hpp
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion include/mbgl/style/layers/layer.hpp.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions include/mbgl/style/source.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ namespace style {

class VectorSource;
class RasterSource;
class RasterDEMSource;
class GeoJSONSource;
class SourceObserver;

Expand Down
25 changes: 25 additions & 0 deletions include/mbgl/style/sources/raster_dem_source.hpp
Original file line number Diff line number Diff line change
@@ -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
4 changes: 2 additions & 2 deletions include/mbgl/style/sources/raster_source.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 6 additions & 0 deletions include/mbgl/style/types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ namespace style {
enum class SourceType : uint8_t {
Vector,
Raster,
RasterDEM,
GeoJSON,
Video,
Annotations,
Expand Down Expand Up @@ -37,6 +38,11 @@ enum class LineJoinType : uint8_t {
FlipBevel
};

enum class HillshadeIlluminationAnchorType : bool {
Map,
Viewport
};

enum class TranslateAnchorType : bool {
Map,
Viewport
Expand Down
Loading

0 comments on commit f329420

Please sign in to comment.