[core] Add LayerTypeInfo::TileKind
This commit is contained in:
@@ -57,6 +57,12 @@ struct LayerTypeInfo {
|
||||
* requires cross-tile indexing and placement. Contains \c CrossTileIndex::NotRequired otherwise.
|
||||
*/
|
||||
const enum class CrossTileIndex { Required, NotRequired } crossTileIndex;
|
||||
|
||||
/**
|
||||
* @brief contains the Id of the supported tile type. Used for internal checks.
|
||||
* The contained values correspond to \c Tile::Kind enum.
|
||||
*/
|
||||
const enum class TileKind : uint8_t { Geometry, Raster, RasterDEM, NotRequired } tileKind;
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -4,12 +4,17 @@
|
||||
#include <mbgl/style/conversion/constant.hpp>
|
||||
#include <mbgl/style/conversion/filter.hpp>
|
||||
#include <mbgl/style/conversion_impl.hpp>
|
||||
#include <mbgl/tile/tile.hpp>
|
||||
|
||||
#include <mbgl/renderer/render_layer.hpp>
|
||||
|
||||
namespace mbgl {
|
||||
namespace style {
|
||||
|
||||
static_assert(mbgl::underlying_type(Tile::Kind::Geometry) == mbgl::underlying_type(LayerTypeInfo::TileKind::Geometry), "tile kind error");
|
||||
static_assert(mbgl::underlying_type(Tile::Kind::Raster) == mbgl::underlying_type(LayerTypeInfo::TileKind::Raster), "tile kind error");
|
||||
static_assert(mbgl::underlying_type(Tile::Kind::RasterDEM) == mbgl::underlying_type(LayerTypeInfo::TileKind::RasterDEM), "tile kind error");
|
||||
|
||||
static LayerObserver nullObserver;
|
||||
|
||||
Layer::Layer(Immutable<Impl> impl)
|
||||
|
||||
@@ -25,7 +25,8 @@ const LayerTypeInfo* BackgroundLayer::Impl::staticTypeInfo() noexcept {
|
||||
LayerTypeInfo::Pass3D::NotRequired,
|
||||
LayerTypeInfo::Layout::NotRequired,
|
||||
LayerTypeInfo::FadingTiles::NotRequired,
|
||||
LayerTypeInfo::CrossTileIndex::NotRequired
|
||||
LayerTypeInfo::CrossTileIndex::NotRequired,
|
||||
LayerTypeInfo::TileKind::NotRequired
|
||||
};
|
||||
return &typeInfo;
|
||||
}
|
||||
|
||||
@@ -25,7 +25,8 @@ const LayerTypeInfo* CircleLayer::Impl::staticTypeInfo() noexcept {
|
||||
LayerTypeInfo::Pass3D::NotRequired,
|
||||
LayerTypeInfo::Layout::NotRequired,
|
||||
LayerTypeInfo::FadingTiles::NotRequired,
|
||||
LayerTypeInfo::CrossTileIndex::NotRequired
|
||||
LayerTypeInfo::CrossTileIndex::NotRequired,
|
||||
LayerTypeInfo::TileKind::Geometry
|
||||
};
|
||||
return &typeInfo;
|
||||
}
|
||||
|
||||
@@ -14,7 +14,8 @@ namespace {
|
||||
LayerTypeInfo::Pass3D::NotRequired,
|
||||
LayerTypeInfo::Layout::NotRequired,
|
||||
LayerTypeInfo::FadingTiles::NotRequired,
|
||||
LayerTypeInfo::CrossTileIndex::NotRequired };
|
||||
LayerTypeInfo::CrossTileIndex::NotRequired,
|
||||
LayerTypeInfo::TileKind::NotRequired };
|
||||
} // namespace
|
||||
|
||||
CustomLayer::CustomLayer(const std::string& layerID,
|
||||
|
||||
@@ -25,7 +25,8 @@ const LayerTypeInfo* FillExtrusionLayer::Impl::staticTypeInfo() noexcept {
|
||||
LayerTypeInfo::Pass3D::Required,
|
||||
LayerTypeInfo::Layout::Required,
|
||||
LayerTypeInfo::FadingTiles::NotRequired,
|
||||
LayerTypeInfo::CrossTileIndex::NotRequired
|
||||
LayerTypeInfo::CrossTileIndex::NotRequired,
|
||||
LayerTypeInfo::TileKind::Geometry
|
||||
};
|
||||
return &typeInfo;
|
||||
}
|
||||
|
||||
@@ -25,7 +25,8 @@ const LayerTypeInfo* FillLayer::Impl::staticTypeInfo() noexcept {
|
||||
LayerTypeInfo::Pass3D::NotRequired,
|
||||
LayerTypeInfo::Layout::Required,
|
||||
LayerTypeInfo::FadingTiles::NotRequired,
|
||||
LayerTypeInfo::CrossTileIndex::NotRequired
|
||||
LayerTypeInfo::CrossTileIndex::NotRequired,
|
||||
LayerTypeInfo::TileKind::Geometry
|
||||
};
|
||||
return &typeInfo;
|
||||
}
|
||||
|
||||
@@ -25,7 +25,8 @@ const LayerTypeInfo* HeatmapLayer::Impl::staticTypeInfo() noexcept {
|
||||
LayerTypeInfo::Pass3D::Required,
|
||||
LayerTypeInfo::Layout::NotRequired,
|
||||
LayerTypeInfo::FadingTiles::NotRequired,
|
||||
LayerTypeInfo::CrossTileIndex::NotRequired
|
||||
LayerTypeInfo::CrossTileIndex::NotRequired,
|
||||
LayerTypeInfo::TileKind::Geometry
|
||||
};
|
||||
return &typeInfo;
|
||||
}
|
||||
|
||||
@@ -25,7 +25,8 @@ const LayerTypeInfo* HillshadeLayer::Impl::staticTypeInfo() noexcept {
|
||||
LayerTypeInfo::Pass3D::Required,
|
||||
LayerTypeInfo::Layout::NotRequired,
|
||||
LayerTypeInfo::FadingTiles::NotRequired,
|
||||
LayerTypeInfo::CrossTileIndex::NotRequired
|
||||
LayerTypeInfo::CrossTileIndex::NotRequired,
|
||||
LayerTypeInfo::TileKind::RasterDEM
|
||||
};
|
||||
return &typeInfo;
|
||||
}
|
||||
|
||||
@@ -27,13 +27,20 @@ let defaults = { caps: { 'Source': 'NotRequired',
|
||||
'Pass3D': 'NotRequired',
|
||||
'Layout': 'NotRequired',
|
||||
'FadingTiles': 'NotRequired',
|
||||
'CrossTileIndex': 'NotRequired'
|
||||
'CrossTileIndex': 'NotRequired',
|
||||
'TileKind' : 'NotRequired'
|
||||
},
|
||||
require: function(cap) {
|
||||
let copy = Object.assign({}, this);
|
||||
copy.caps = Object.assign({}, this.caps);
|
||||
copy.caps[cap] = 'Required';
|
||||
return copy;
|
||||
let copy = Object.assign({}, this);
|
||||
copy.caps = Object.assign({}, this.caps);
|
||||
copy.caps[cap] = 'Required';
|
||||
return copy;
|
||||
},
|
||||
set: function(cap, value) {
|
||||
let copy = Object.assign({}, this);
|
||||
copy.caps = Object.assign({}, this.caps);
|
||||
copy.caps[cap] = value;
|
||||
return copy;
|
||||
},
|
||||
finalize: function() {
|
||||
return Object.keys(this.caps).reduce((acc, key) => {
|
||||
@@ -46,23 +53,30 @@ let defaults = { caps: { 'Source': 'NotRequired',
|
||||
layerCapabilities['background'] = defaults.finalize();
|
||||
layerCapabilities['fill'] = defaults.require('Source')
|
||||
.require('Layout')
|
||||
.set('TileKind', 'Geometry')
|
||||
.finalize();
|
||||
layerCapabilities['fill-extrusion'] = defaults.require('Source')
|
||||
.require('Pass3D')
|
||||
.require('Layout')
|
||||
.set('TileKind', 'Geometry')
|
||||
.finalize();
|
||||
layerCapabilities['hillshade'] = defaults.require('Source')
|
||||
.require('Pass3D')
|
||||
.set('TileKind', 'RasterDEM')
|
||||
.finalize();
|
||||
layerCapabilities['symbol'] = defaults.require('Source')
|
||||
.require('Layout')
|
||||
.require('FadingTiles')
|
||||
.require('CrossTileIndex')
|
||||
.set('TileKind', 'Geometry')
|
||||
.finalize();
|
||||
layerCapabilities['circle'] = defaults.require('Source').finalize();
|
||||
layerCapabilities['circle'] = defaults.require('Source').set('TileKind', 'Geometry').finalize();
|
||||
layerCapabilities['line'] = layerCapabilities['fill'];
|
||||
layerCapabilities['heatmap'] = layerCapabilities['hillshade'];
|
||||
layerCapabilities['raster'] = layerCapabilities['circle'];
|
||||
layerCapabilities['heatmap'] = defaults.require('Source')
|
||||
.require('Pass3D')
|
||||
.set('TileKind', 'Geometry')
|
||||
.finalize();
|
||||
layerCapabilities['raster'] = defaults.require('Source').set('TileKind', 'Raster').finalize();
|
||||
%>
|
||||
// static
|
||||
const LayerTypeInfo* <%- camelize(type) %>Layer::Impl::staticTypeInfo() noexcept {
|
||||
|
||||
@@ -25,7 +25,8 @@ const LayerTypeInfo* LineLayer::Impl::staticTypeInfo() noexcept {
|
||||
LayerTypeInfo::Pass3D::NotRequired,
|
||||
LayerTypeInfo::Layout::Required,
|
||||
LayerTypeInfo::FadingTiles::NotRequired,
|
||||
LayerTypeInfo::CrossTileIndex::NotRequired
|
||||
LayerTypeInfo::CrossTileIndex::NotRequired,
|
||||
LayerTypeInfo::TileKind::Geometry
|
||||
};
|
||||
return &typeInfo;
|
||||
}
|
||||
|
||||
@@ -25,7 +25,8 @@ const LayerTypeInfo* RasterLayer::Impl::staticTypeInfo() noexcept {
|
||||
LayerTypeInfo::Pass3D::NotRequired,
|
||||
LayerTypeInfo::Layout::NotRequired,
|
||||
LayerTypeInfo::FadingTiles::NotRequired,
|
||||
LayerTypeInfo::CrossTileIndex::NotRequired
|
||||
LayerTypeInfo::CrossTileIndex::NotRequired,
|
||||
LayerTypeInfo::TileKind::Raster
|
||||
};
|
||||
return &typeInfo;
|
||||
}
|
||||
|
||||
@@ -25,7 +25,8 @@ const LayerTypeInfo* SymbolLayer::Impl::staticTypeInfo() noexcept {
|
||||
LayerTypeInfo::Pass3D::NotRequired,
|
||||
LayerTypeInfo::Layout::Required,
|
||||
LayerTypeInfo::FadingTiles::Required,
|
||||
LayerTypeInfo::CrossTileIndex::Required
|
||||
LayerTypeInfo::CrossTileIndex::Required,
|
||||
LayerTypeInfo::TileKind::Geometry
|
||||
};
|
||||
return &typeInfo;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user