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

Commit

Permalink
[core] Use style::LayerProperties in render layers, buckets and lay…
Browse files Browse the repository at this point in the history
…outs.
  • Loading branch information
pozdnyakov committed Apr 17, 2019
1 parent 1a66a02 commit 4b21560
Show file tree
Hide file tree
Showing 59 changed files with 383 additions and 457 deletions.
2 changes: 1 addition & 1 deletion include/mbgl/layermanager/circle_layer_factory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class CircleLayerFactory : public LayerFactory {
protected:
const style::LayerTypeInfo* getTypeInfo() const noexcept final;
std::unique_ptr<style::Layer> createLayer(const std::string& id, const style::conversion::Convertible& value) noexcept final;
std::unique_ptr<Bucket> createBucket(const BucketParameters&, const std::vector<const RenderLayer*>&) noexcept final;
std::unique_ptr<Bucket> createBucket(const BucketParameters&, const std::vector<Immutable<style::LayerProperties>>&) noexcept final;
std::unique_ptr<RenderLayer> createRenderLayer(Immutable<style::Layer::Impl>) noexcept final;
};

Expand Down
2 changes: 1 addition & 1 deletion include/mbgl/layermanager/fill_extrusion_layer_factory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class FillExtrusionLayerFactory : public LayerFactory {
protected:
const style::LayerTypeInfo* getTypeInfo() const noexcept final;
std::unique_ptr<style::Layer> createLayer(const std::string& id, const style::conversion::Convertible& value) noexcept final;
std::unique_ptr<Layout> createLayout(const LayoutParameters&, std::unique_ptr<GeometryTileLayer>, const std::vector<const RenderLayer*>&) noexcept final;
std::unique_ptr<Layout> createLayout(const LayoutParameters&, std::unique_ptr<GeometryTileLayer>, const std::vector<Immutable<style::LayerProperties>>&) noexcept final;
std::unique_ptr<RenderLayer> createRenderLayer(Immutable<style::Layer::Impl>) noexcept final;
};

Expand Down
2 changes: 1 addition & 1 deletion include/mbgl/layermanager/fill_layer_factory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class FillLayerFactory : public LayerFactory {
protected:
const style::LayerTypeInfo* getTypeInfo() const noexcept final;
std::unique_ptr<style::Layer> createLayer(const std::string& id, const style::conversion::Convertible& value) noexcept final;
std::unique_ptr<Layout> createLayout(const LayoutParameters&, std::unique_ptr<GeometryTileLayer>, const std::vector<const RenderLayer*>&) noexcept final;
std::unique_ptr<Layout> createLayout(const LayoutParameters&, std::unique_ptr<GeometryTileLayer>, const std::vector<Immutable<style::LayerProperties>>&) noexcept final;
std::unique_ptr<RenderLayer> createRenderLayer(Immutable<style::Layer::Impl>) noexcept final;
};

Expand Down
2 changes: 1 addition & 1 deletion include/mbgl/layermanager/heatmap_layer_factory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class HeatmapLayerFactory : public LayerFactory {
protected:
const style::LayerTypeInfo* getTypeInfo() const noexcept final;
std::unique_ptr<style::Layer> createLayer(const std::string& id, const style::conversion::Convertible& value) noexcept final;
std::unique_ptr<Bucket> createBucket(const BucketParameters&, const std::vector<const RenderLayer*>&) noexcept final;
std::unique_ptr<Bucket> createBucket(const BucketParameters&, const std::vector<Immutable<style::LayerProperties>>&) noexcept final;
std::unique_ptr<RenderLayer> createRenderLayer(Immutable<style::Layer::Impl>) noexcept final;
};

Expand Down
7 changes: 5 additions & 2 deletions include/mbgl/layermanager/layer_factory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@

namespace mbgl {

namespace style {
class LayerProperties;
} // namespace style
class Bucket;
class BucketParameters;
class GeometryTileLayer;
Expand All @@ -28,9 +31,9 @@ class LayerFactory {
/// Returns a new RenderLayer instance.
virtual std::unique_ptr<RenderLayer> createRenderLayer(Immutable<style::Layer::Impl>) noexcept = 0;
/// Returns a new Bucket instance on success call; returns `nullptr` otherwise.
virtual std::unique_ptr<Bucket> createBucket(const BucketParameters&, const std::vector<const RenderLayer*>&) noexcept;
virtual std::unique_ptr<Bucket> createBucket(const BucketParameters&, const std::vector<Immutable<style::LayerProperties>>&) noexcept;
/// Returns a new Layout instance on success call; returns `nullptr` otherwise.
virtual std::unique_ptr<Layout> createLayout(const LayoutParameters&, std::unique_ptr<GeometryTileLayer>, const std::vector<const RenderLayer*>&) noexcept;
virtual std::unique_ptr<Layout> createLayout(const LayoutParameters&, std::unique_ptr<GeometryTileLayer>, const std::vector<Immutable<style::LayerProperties>>&) noexcept;

protected:
optional<std::string> getSource(const style::conversion::Convertible& value) const noexcept;
Expand Down
8 changes: 6 additions & 2 deletions include/mbgl/layermanager/layer_manager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
#include <vector>

namespace mbgl {
namespace style {
class LayerProperties;
} // namespace style
class GeometryTileLayer;
class LayerFactory;
class RenderLayer;
Expand Down Expand Up @@ -37,9 +40,10 @@ class LayerManager {
/// Returns a new RenderLayer instance on success call; returns `nullptr` otherwise.
std::unique_ptr<RenderLayer> createRenderLayer(Immutable<style::Layer::Impl>) noexcept;
/// Returns a new Bucket instance on success call; returns `nullptr` otherwise.
std::unique_ptr<Bucket> createBucket(const BucketParameters&, const std::vector<const RenderLayer*>&) noexcept;
std::unique_ptr<Bucket> createBucket(const BucketParameters&, const std::vector<Immutable<style::LayerProperties>>&) noexcept;
/// Returns a new Layout instance on success call; returns `nullptr` otherwise.
std::unique_ptr<Layout> createLayout(const LayoutParameters&, std::unique_ptr<GeometryTileLayer>, const std::vector<const RenderLayer*>&) noexcept;
std::unique_ptr<Layout> createLayout(const LayoutParameters&, std::unique_ptr<GeometryTileLayer>,
const std::vector<Immutable<style::LayerProperties>>&) noexcept;

/**
* @brief a build-time flag to enable/disable annotations in mapbox-gl-native core.
Expand Down
2 changes: 1 addition & 1 deletion include/mbgl/layermanager/line_layer_factory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class LineLayerFactory : public LayerFactory {
std::unique_ptr<style::Layer> createLayer(const std::string& id, const style::conversion::Convertible& value) noexcept final;
std::unique_ptr<Layout> createLayout(const LayoutParameters& parameters,
std::unique_ptr<GeometryTileLayer> tileLayer,
const std::vector<const RenderLayer*>& group) noexcept final;
const std::vector<Immutable<style::LayerProperties>>& group) noexcept final;
std::unique_ptr<RenderLayer> createRenderLayer(Immutable<style::Layer::Impl>) noexcept final;
};

Expand Down
2 changes: 1 addition & 1 deletion include/mbgl/layermanager/symbol_layer_factory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class SymbolLayerFactory : public LayerFactory {
std::unique_ptr<style::Layer> createLayer(const std::string& id, const style::conversion::Convertible& value) noexcept final;
std::unique_ptr<Layout> createLayout(const LayoutParameters& parameters,
std::unique_ptr<GeometryTileLayer> tileLayer,
const std::vector<const RenderLayer*>& group) noexcept final;
const std::vector<Immutable<style::LayerProperties>>& group) noexcept final;
std::unique_ptr<RenderLayer> createRenderLayer(Immutable<style::Layer::Impl>) noexcept final;
};

Expand Down
2 changes: 1 addition & 1 deletion src/mbgl/layermanager/circle_layer_factory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ std::unique_ptr<style::Layer> CircleLayerFactory::createLayer(const std::string&
return layer;
}

std::unique_ptr<Bucket> CircleLayerFactory::createBucket(const BucketParameters& parameters, const std::vector<const RenderLayer*>& layers) noexcept {
std::unique_ptr<Bucket> CircleLayerFactory::createBucket(const BucketParameters& parameters, const std::vector<Immutable<style::LayerProperties>>& layers) noexcept {
return std::make_unique<CircleBucket>(parameters, layers);
}

Expand Down
6 changes: 4 additions & 2 deletions src/mbgl/layermanager/fill_extrusion_layer_factory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@ std::unique_ptr<style::Layer> FillExtrusionLayerFactory::createLayer(const std::

std::unique_ptr<Layout> FillExtrusionLayerFactory::createLayout(const LayoutParameters& parameters,
std::unique_ptr<GeometryTileLayer> layer,
const std::vector<const RenderLayer*>& group) noexcept {
return std::make_unique<PatternLayout<FillExtrusionBucket>>(parameters.bucketParameters, group, std::move(layer), parameters.imageDependencies);
const std::vector<Immutable<style::LayerProperties>>& group) noexcept {
using namespace style;
using LayoutType = PatternLayout<FillExtrusionBucket, FillExtrusionLayerProperties, FillExtrusionPattern, FillExtrusionPaintProperties::PossiblyEvaluated>;
return std::make_unique<LayoutType>(parameters.bucketParameters, group, std::move(layer), parameters.imageDependencies);
}

std::unique_ptr<RenderLayer> FillExtrusionLayerFactory::createRenderLayer(Immutable<style::Layer::Impl> impl) noexcept {
Expand Down
6 changes: 4 additions & 2 deletions src/mbgl/layermanager/fill_layer_factory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,10 @@ std::unique_ptr<style::Layer> FillLayerFactory::createLayer(const std::string& i
std::unique_ptr<Layout>
FillLayerFactory::createLayout(const LayoutParameters& parameters,
std::unique_ptr<GeometryTileLayer> layer,
const std::vector<const RenderLayer*>& group) noexcept {
return std::make_unique<PatternLayout<FillBucket>>(parameters.bucketParameters, group, std::move(layer), parameters.imageDependencies);
const std::vector<Immutable<style::LayerProperties>>& group) noexcept {
using namespace style;
using LayoutType = PatternLayout<FillBucket, FillLayerProperties, FillPattern, FillPaintProperties::PossiblyEvaluated>;
return std::make_unique<LayoutType>(parameters.bucketParameters, group, std::move(layer), parameters.imageDependencies);
}

std::unique_ptr<RenderLayer> FillLayerFactory::createRenderLayer(Immutable<style::Layer::Impl> impl) noexcept {
Expand Down
2 changes: 1 addition & 1 deletion src/mbgl/layermanager/heatmap_layer_factory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ std::unique_ptr<style::Layer> HeatmapLayerFactory::createLayer(const std::string
return layer;
}

std::unique_ptr<Bucket> HeatmapLayerFactory::createBucket(const BucketParameters& parameters, const std::vector<const RenderLayer*>& layers) noexcept {
std::unique_ptr<Bucket> HeatmapLayerFactory::createBucket(const BucketParameters& parameters, const std::vector<Immutable<style::LayerProperties>>& layers) noexcept {
return std::make_unique<HeatmapBucket>(parameters, layers);
}

Expand Down
6 changes: 4 additions & 2 deletions src/mbgl/layermanager/layer_factory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,14 @@ optional<std::string> LayerFactory::getSource(const style::conversion::Convertib
return source;
}

std::unique_ptr<Bucket> LayerFactory::createBucket(const BucketParameters&, const std::vector<const RenderLayer*>&) noexcept {
std::unique_ptr<Bucket> LayerFactory::createBucket(const BucketParameters&, const std::vector<Immutable<style::LayerProperties>>&) noexcept {
assert(false);
return nullptr;
}

std::unique_ptr<Layout> LayerFactory::createLayout(const LayoutParameters&, std::unique_ptr<GeometryTileLayer>, const std::vector<const RenderLayer*>&) noexcept {
std::unique_ptr<Layout> LayerFactory::createLayout(const LayoutParameters&,
std::unique_ptr<GeometryTileLayer>,
const std::vector<Immutable<style::LayerProperties>>&) noexcept {
assert(false);
return nullptr;
}
Expand Down
5 changes: 3 additions & 2 deletions src/mbgl/layermanager/layer_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ std::unique_ptr<style::Layer> LayerManager::createLayer(
return nullptr;
}

std::unique_ptr<Bucket> LayerManager::createBucket(const BucketParameters& parameters, const std::vector<const RenderLayer*>& layers) noexcept {
std::unique_ptr<Bucket> LayerManager::createBucket(const BucketParameters& parameters,
const std::vector<Immutable<style::LayerProperties>>& layers) noexcept {
assert(!layers.empty());
assert(parameters.layerType->layout == style::LayerTypeInfo::Layout::NotRequired);
LayerFactory* factory = getFactory(parameters.layerType);
Expand All @@ -35,7 +36,7 @@ std::unique_ptr<Bucket> LayerManager::createBucket(const BucketParameters& param

std::unique_ptr<Layout> LayerManager::createLayout(const LayoutParameters& parameters,
std::unique_ptr<GeometryTileLayer> tileLayer,
const std::vector<const RenderLayer*>& layers) noexcept {
const std::vector<Immutable<style::LayerProperties>>& layers) noexcept {
assert(!layers.empty());
assert(parameters.bucketParameters.layerType->layout == style::LayerTypeInfo::Layout::Required);
LayerFactory* factory = getFactory(parameters.bucketParameters.layerType);
Expand Down
6 changes: 4 additions & 2 deletions src/mbgl/layermanager/line_layer_factory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@ std::unique_ptr<style::Layer> LineLayerFactory::createLayer(const std::string& i

std::unique_ptr<Layout> LineLayerFactory::createLayout(const LayoutParameters& parameters,
std::unique_ptr<GeometryTileLayer> layer,
const std::vector<const RenderLayer*>& group) noexcept {
return std::make_unique<PatternLayout<LineBucket>>(parameters.bucketParameters, group, std::move(layer), parameters.imageDependencies);
const std::vector<Immutable<style::LayerProperties>>& group) noexcept {
using namespace style;
using LayoutType = PatternLayout<LineBucket, LineLayerProperties, LinePattern, LinePaintProperties::PossiblyEvaluated, LineLayoutProperties::PossiblyEvaluated>;
return std::make_unique<LayoutType>(parameters.bucketParameters, group, std::move(layer), parameters.imageDependencies);
}

std::unique_ptr<RenderLayer> LineLayerFactory::createRenderLayer(Immutable<style::Layer::Impl> impl) noexcept {
Expand Down
2 changes: 1 addition & 1 deletion src/mbgl/layermanager/symbol_layer_factory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ std::unique_ptr<style::Layer> SymbolLayerFactory::createLayer(const std::string&

std::unique_ptr<Layout> SymbolLayerFactory::createLayout(const LayoutParameters& parameters,
std::unique_ptr<GeometryTileLayer> tileLayer,
const std::vector<const RenderLayer*>& group) noexcept {
const std::vector<Immutable<style::LayerProperties>>& group) noexcept {
return std::make_unique<SymbolLayout>(parameters.bucketParameters,
group,
std::move(tileLayer),
Expand Down
Loading

0 comments on commit 4b21560

Please sign in to comment.